Repository navigation
fix(engine): name every batch table outside its count limit as DynamoDB does - #1234
LeeroyHannigan wants to merge 6 commits into
Conversation
DynamoDB refuses these batch requests in the member path form and names every table it refuses. ExtendDB quoted the request map for two of them and named one table where DynamoDB names two. A BatchWriteItem of more than 25 tables now gets DynamoDB's fixed text, which names `RequestItems` and quotes no request. A BatchWriteItem table with no requests is named at `RequestItems.<table>.member`. Each table over its limit or with none gets its own clause, up to 10, in BatchGetItem and in BatchWriteItem. These clauses come before the check of the total. DynamoDB listed the tables in a different order from one send to the next. ExtendDB lists them in the order of the request map. Measured in us-east-1 on 20 November 2026, each body sent twice: - 26 tables of one put: the fixed text with 25. - One table of one put and one of none: the empty table at its member path. - One table of 26 puts and one of none: both tables, in either order. - BatchGetItem, two tables of 101 keys, or 101 keys and none: both. - 11 tables of 101 keys, or 11 tables of no puts: 10 of the 11. - Tables of 20, 10 and no puts, or of 60, 41 and no keys: the empty table, not the total. The answers were the same for tables that exist and for names of tables that do not exist. Fixes #1205.
…er-paths per_table_count_error keeps this branch's clauses and passes them to validation_refusal, which now writes the header. The comment over CLAUSE keeps this branch's text.
On 2026-11-25 DynamoDB answered each BatchWriteItem count refusal with the request map quoted at 'requestItems'. For 26 tables of one put, the clause ended in "Member must have length less than or equal to 25". That message does not hold QUOTED_MAP, so the 26_tables row failed when the suite ran against DynamoDB. The test now accepts from DynamoDB any message that holds QUOTED. Each quoted answer of 14, 16 and 25 November holds that text before its constraint. Against ExtendDB the test still checks the header and each clause.
demohan
left a comment
There was a problem hiding this comment.
BatchGetItem's count refusals match the service at 53a53c0, and BatchWriteItem's move further from it. With 56 shapes sent twice to us-east-1 and to this head, its base (#1215) and main on SQLite and PostgreSQL, the two backends answer alike everywhere, and every BatchGetItem row (tables over 100, tables over 100 keys, several at once) gives the service's text and member path. On BatchWriteItem the service answered all 60 count refusals in the quoted-map form at 'requestItems', as our review of #1215 says; this head answers every one with a member path, and two that main and the base answered as the service does now differ (below). The 7 new wire rows fail on the base and pass here, five of six engine mutations fail the new test, fmt, clippy, 934 engine tests and the 1.91.1 check are clean, and every CI run at this head was cancelled. The branch conflicts with main at 222d80a only in partiql/request_checks.rs, as #1215 does, and a resolution builds and passes 979 engine tests.
I will approve once BatchWriteItem's count refusals give the service's quoted-map form, with the BatchWriteItem rows checked against the service without the QUOTED escape.
| "1 validation error detected: Value '{{{map}}}' at 'requestItems' failed to satisfy constraint: Member must have length less than or equal to 25" | ||
| ) | ||
| })); | ||
| return Err(DynamoDbError::ValidationException(format!( |
There was a problem hiding this comment.
For BatchWriteItem with 26 or 101 tables, the service quotes the whole request map at 'requestItems' ending less than or equal to 25, twice for each size, and main and the base give that path and constraint; this text, with Value at 'RequestItems', is right for BatchGetItem's 100 but is not what the service sends for BatchWriteItem.
There was a problem hiding this comment.
8fd5f4e gives more than 25 BatchWriteItem tables main's clause again: Value '{<map>}' at 'requestItems' failed to satisfy constraint: Member must have length less than or equal to 25. DynamoDB gave that form for 26 and 101 tables on 2 December, both sends. BatchGetItem keeps Value at 'RequestItems', as DynamoDB gave for 101 tables the same day.
| if !over.is_empty() { | ||
| return Err(per_table_count_error(get, &over, false)); | ||
| if !failed.is_empty() { | ||
| return Err(per_table_count_error(get, limit, &failed)); |
There was a problem hiding this comment.
An empty BatchWriteItem table gets Value '{edbv-1234-c-a=[]}' at 'requestItems' ... Map value must satisfy constraint: [...] from the service (2 of 2), and the same text from main and the base; here it gets Value at 'RequestItems.edbv-1234-c-a.member' ... greater than or equal to 1. For 20, 10 and no requests in three tables, the service quotes all three in one clause. The new rows 26_and_none, 20_10_and_none and 11x0 pin the member-path form for BatchWriteItem. The service also listed the tables in a different order from send to send (a101_b101 came back a,b four times of seven), and the engine's own check, which the wasm adapter reaches, reads a HashMap; .take(MAX_PARTS) here changes nothing while the cap at line 44 stays.
There was a problem hiding this comment.
8fd5f4e answers a BatchWriteItem table with no request or more than 25 in one clause that quotes the whole map, Value '{<map>}' at 'requestItems' failed to satisfy constraint: Map value must satisfy constraint: [...], before the total. So tables of 20, 10 and no requests get that clause, as DynamoDB answered on 2 December. The rows 26_and_none, 20_10_and_none and 11x0 expect that form now.
The quoted map lists the tables in name order on every build, so the HashMap of the engine's check does not change the text. DynamoDB's order changes from send to send, so the wire test checks that the map names every table, in any order. The .take(MAX_PARTS) is gone: BatchGetItem's clauses go to validation_refusal, which keeps the first 10.
| error = exc.value.response["Error"] | ||
| assert error["Code"] == "ValidationException" | ||
| if not is_extenddb and QUOTED_MAP in error["Message"]: | ||
| if not is_extenddb and QUOTED in error["Message"]: |
There was a problem hiding this comment.
With this escape the BatchWriteItem test passes against the service on any quoted answer, so the live run checks nothing for those rows: with the line disabled, all 9 BatchWriteItem rows fail against the service, twice, and the 4 BatchGetItem rows pass. The body's "ExtendDB answers each row as DynamoDB does" holds for the BatchGetItem rows only.
There was a problem hiding this comment.
The escape is gone in 8fd5f4e. Against DynamoDB, _assert_write_refusal checks the text outside the quoted map byte for byte, and that the map names every table. Against ExtendDB it compares the whole message. On the recorded answers of 2 December, the DynamoDB branch passes both sends of all nine BatchWriteItem rows. It fails when the map leaves out a table, on the member path form and with a second clause. The body now says which form each operation gets.
…er-paths The base now holds main at 01556cf and the quoted request map form of BatchWriteItem's per-table refusal. Where both branches changed the count check and its tests, the merge keeps this branch's code. The next commit moves BatchWriteItem's count refusals to the quoted map form.
DynamoDB answered every BatchWriteItem count refusal measured on 25 Nov and 2 Dec 2026 in one clause at 'requestItems'. That clause quotes the whole request map, every table included. BatchGetItem kept the member path form. More than 25 tables get main's quoted table count clause again. A table with no request or more than 25 now gets one Map value clause that quotes every table. Main quoted the first such table alone. The quoted map lists the tables in name order on every build, and prints each request as its type name. That check runs before the total, as the service answers 20, 10 and no requests in three tables. BatchGetItem keeps a member path clause for each table with no keys or more than 100. The clause uses AT_LEAST_ONE, and the list is not cut before validation_refusal, which keeps the first 10. The wire test checks DynamoDB's text outside the quoted map byte for byte, with no escape for a quoted answer. It also checks that the map names every table. It checks ExtendDB's text by equality.
…er-paths The base now writes per_table_count_error with validation_refusal. This branch has no per_table_count_error, so the merge keeps this branch's code, and no file changes.
|
Changes since the last review
'requestItems'that quotes the whole request map. BatchGetItem keeps the member path form, which DynamoDB still gives. The wire test checks DynamoDB's BatchWriteItem text with no escape for a quoted answer.per_table_count_error, so no file changes.What
check_batch_countsincrates/engine/src/request_limits.rsnow answers these counts as DynamoDB does:1 validation error detected: Value '{<map>}' at 'requestItems' failed to satisfy constraint: Member must have length less than or equal to 25, as on main.Value '{<map>}' at 'requestItems' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 25, Member must have length greater than or equal to 1]. Main quoted the first such table alone. This check now comes before the total, so tables of 20, 10 and no requests get this clause too.1 validation error detected: Value at 'RequestItems' failed to satisfy constraint: Member must have length less than or equal to 100, as on main.RequestItems.<table>.member.Keys, up to 10 clauses, before the total. Main named the first such table alone, and checked the total before an empty table.The quoted map lists the tables in name order and prints each request as
WriteRequest. DynamoDB lists the tables in an order of its own, and prints each request with its fields or, on some sends, as object hashes. So the tables and the count of requests match, and the text of each request does not. Both forms go throughvalidation_refusalfrom #1215, which keeps the first 10 clauses.The base of this PR is #1215, which changes the same functions.
Why
DynamoDB's answers in us-east-1, each request sent twice, on table names that do not exist. The BatchWriteItem rows and the first two BatchGetItem rows are from 2 December 2026 at 21:03 UTC. The other BatchGetItem rows are from 20 November, and the review of 30 November found the same BatchGetItem answers.
Too many items requested for the BatchWriteItem callValue at 'RequestItems.<table>.member.Keys' failed to satisfy constraint: Member must have length less than or equal to 10010 validation errors detected:, ten clausesToo many items requested for the BatchGetItem callWith this change, ExtendDB gives each row DynamoDB's clauses. DynamoDB listed the clauses of two BatchGetItem tables in either order, and named a different 10 of 11 tables, from one send to the next. ExtendDB lists them in the order of its parsed request map, and the wire tests accept any order.
#1205 names the member path form for BatchWriteItem, which DynamoDB gave on 20 November. This PR gives the form that DynamoDB gives now.
Fixes #1205
Testing done
At 0c2ac39, whose tree is the tree of 8fd5f4e:
cargo test -p extenddb-engine --lib: 979 passed.cargo test -p extenddb-wasm-adapter: 4 passed, theparitycorpus test among them.cargo +1.97.0 fmt --all -- --check, the two clippy commands of.github/workflows/clippy.ymlwith-D warningsonextenddb-core,extenddb-engineandextenddb-server,cargo +1.97.0 clippy -p extenddb-engine --lib --no-default-features -- -D warningsandcargo +1.94.0 check --all-targetson the same crates are clean.python3 -m pytest --collect-only -qcollects 7173 tests intestsand 692 intests/python, with no error.batch_count_refusals_name_each_pathholds 15 rows of these counts. It also checks that two tables sent in the other order get the same text.test_batch.pyagainst a server built from refactor(engine): share the validation refusal header with the batch checks #1215's head 26ca9c6: 8 failed and 19 passed. The 8 failures are the rows with more than one table, 5 for BatchWriteItem and 3 for BatchGetItem.tests/python/test_batch.py,tests/test_batch_operations.pyandtests/test_batch_write_validation_order.pypassed 72 tests on SQLite and 72 on PostgreSQL, 27 of them intest_batch.py.test_batch_write_too_many_itemspasses on each recorded send of 2 December of its nine rows. It fails when the map leaves out a table, on the member path form and with a wrong number of clauses.Line counts against #1215: production +61 -55, tests +147 -44.
This PR adds no conflict with an open PR. No other open PR changes
request_limits.rsortests/python/test_batch.py. This head merges with each open PR that changes another of its files with no conflict that the PR does not have with main already.Not in this PR:
Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
A BatchWriteItem with several tables and a table outside its count gets one clause that quotes every table. A BatchGetItem gets a clause for each table outside its count, as the What section says. A client that matches the old text sees the new one. Requests within the counts get the same answers as before.
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.