Repository navigation
fix(engine): answer missing restore override members as DynamoDB does - #1365
LeeroyHannigan wants to merge 11 commits into
Conversation
RestoreTableFromBackup answered a member missing inside an override with a SerializationException. It checked the SSEType of SSESpecificationOverride only after it read the backup. It skipped a capacity figure with a fraction, and it refused an empty VectorIndexOverride. DynamoDB lists these faults as clauses of the request's one validation message (measured in us-east-1 on 21 Nov 2026, each request twice): - ProvisionedThroughputOverride without WriteCapacityUnits gets "Value null at 'provisionedThroughputOverride.writeCapacityUnits' failed to satisfy constraint: Member must not be null". A missing ReadCapacityUnits gets the same text, after it. - An index override entry without IndexName, KeySchema or Projection gets the same text at 'globalSecondaryIndexOverride.1.member.indexName' and the like, in that member order. - An SSEType of BAD gets "Value 'BAD' at 'sSESpecificationOverride.sSEType' failed to satisfy constraint: Member must satisfy enum value set: [AES256, KMS]". - DynamoDB reads a ReadCapacityUnits of 0.5 as 0. It gets "Value '0' at 'provisionedThroughputOverride.readCapacityUnits' failed to satisfy constraint: Member must have value greater than or equal to 1". The throughput, billing mode and SSE clauses come before the clauses of the TargetTableName, and the index override clauses come after them. All of them come after the account and the shape of the BackupArn and after the length text of the name. They come before the check of the backup id. DynamoDB answers BackupNotFoundException to an empty VectorIndexOverride when the backup does not exist. The engine now adds these clauses to the one message, in that order. The clause of a missing member shows its value as null. An empty VectorIndexOverride is no override, and any other one keeps the refusal of ExtendDB. The constraint text of a missing member is now one constant in extenddb_core::error, which the PartiQL request checks also read. Fixes #1348.
The new head of fix/1326-cross-region-restore holds main and the new
heads of the three branches below it.
Conflicts:
- crates/core/src/error/mod.rs: the pub use messages::{...} line. This
branch adds MEMBER_NOT_NULL. On main, #468 added INVALID_STREAM_ARN
and validation_errors_detected to it. The merge keeps every name.
- backup_requests/pitr.rs: the doc of check_restore_table_name.
fix/1224-restore-target-name added an Errors section, and this branch
added the later clauses. The merge keeps both.
In messages.rs, main moved the envelope of validation_errors to
validation_errors_detected. The merge keeps the null value of this
branch for a clause of MEMBER_NOT_NULL in validation_errors.
A restore with an entry without members in both index override lists
got the null clauses of the GSI list first. DynamoDB lists the LSI list
first. GlobalSecondaryIndexOverride [{}] with LocalSecondaryIndexOverride
[{}] gets six clauses: the indexName, keySchema and projection of
localSecondaryIndexOverride.1, then those of
globalSecondaryIndexOverride.1. Measured in us-east-1 on 25 Nov 2026,
each request twice.
missing_members now reads the LSI list first. The engine table and the
wire table have that row, and with the old order the engine row fails.
Both tables also have the row of a null ReadCapacityUnits. It gets the
null clause at provisionedThroughputOverride.readCapacityUnits, as on
DynamoDB (measured on 25 Nov 2026).
The doc ended with "which #1167 changes". A statement about another open PR in a code comment goes out of date when that PR merges. The doc now ends at the refusal of the parse.
The README table of the checks that the WebAssembly build does not make listed two kinds of override clauses before the clauses of the name. It now also lists the null clause of a missing or null throughput member, a fraction read as its integer part and the SSEType enum. After the clauses of the name it lists the null clauses of the index override entries, the LSI list first. The rows of VectorIndexOverride in docs/differences-from-dynamodb.md and docs/dynamodb-limits.md said that ExtendDB refuses every one. They now say that a null or an empty list is no override. DynamoDB reads the empty list the same way.
The new head of fix/1326-cross-region-restore splits long sentences in the BackupArn rows of docs/differences-from-dynamodb.md and docs/dynamodb-limits.md. No conflict: this branch changes other rows of those files.
navareamol
left a comment
There was a problem hiding this comment.
I think the answer to a restore with many index override entries has no limit. A request with 100000 entries of {} (a body of about 300 KB) gets a 36,966,789 byte answer that says "300000 validation errors detected". On a SQLite build of the base (#1359) the same request gets 150 bytes. Has anyone sent a long list of empty entries to DynamoDB to see whether it lists every one or stops at a count?
I think three behaviours have no test and no live measurement. A null member inside ProvisionedThroughputOverride or an index entry counts as missing, and the GSI list's clauses come before the LSI list's. The description says the null case and the both lists case are not measured. I changed entry.get(member).is_none_or(Value::is_null) to entry.get(member).is_none() in missing_members, changed override_member(throughput?, member) to throughput?.get(member), and swapped the two lists, one at a time. The new unit test and the other restore override tests pass each time. Could you measure these two requests on DynamoDB, or take them out of this PR, and add a row for each either way?
The description says git merge-tree shows no conflict with main. On current main (92155f3) it conflicts in crates/core/src/error/mod.rs, crates/engine/src/backup.rs, crates/engine/src/lib.rs and crates/engine/src/partiql/request_checks.rs. The first and last are this PR's: main now exports INVALID_STREAM_ARN and validation_errors_detected on the same pub use line, and moved AT_LEAST_ONE out of request_checks.rs. The CI run here is on the merge with the base branch only, so it did not run main's CodeQL, wasm or wire matrix checks. Could you merge main and update the sentence?
docs/differences-from-dynamodb.md line 160 says VectorIndexOverride is "Refused with ValidationException", and docs/manuals/14-backup-and-restore.md line 1157 says it is refused. With this change an empty list restores. Could you update both lines?
Has SSEType of an empty string or lowercase kms been sent to DynamoDB? Both get the enum clause here, and only BAD is measured. A capacity of -1e30 prints Value '-9223372036854775808' here, and the comment on capacity_units calls that saturation without saying it was measured.
Two description sentences do not match the code. "Any other VectorIndexOverride that is not null keeps the refusal of ExtendDB" holds for [null] and [{}], but {} and [[]] get a SerializationException. "872 engine tests and 516 server unit tests passed" is 871 and 521 on this head with cargo +1.97.0 test --locked -p extenddb-core -p extenddb-engine -p extenddb-server --lib, 0 failed.
I will approve once the null and both lists requests are measured or removed with rows added, main is merged with CI green on it, and the two doc lines are updated.
The new head of fix/1326-cross-region-restore holds the new heads of the three branches below it and main of 2 Dec. On main, #1521 moved the WebAssembly section of README.md to docs/webassembly.md, and the PartiQL request checks read AT_LEAST_ONE from request_limits.rs. Conflicts: - README.md: this branch changed the TargetTableName row of the table of checks in the WebAssembly section. The merge takes the README of fix/1326-cross-region-restore. It makes the same change in docs/webassembly.md. - partiql/request_checks.rs: this branch removed the NOT_NULL constant, which it reads from extenddb_core::error now, and main removed AT_LEAST_ONE. The merge removes both. - backup/tests.rs: the doc and the bindings of the restore order test. The merge keeps the words and bindings of both sides. The core test of validate_name_member_after from fix/1271-restore-check-order gets the later argument that this branch added.
A restore with many index override entries of {} listed every missing
member. 100000 entries in a body of about 300 KB got an answer of 37
MB. DynamoDB lists the first 10 clauses, and its count says 10. On 3 Dec
2026, 4, 50 and 1000 entries of {} got the same 10 clauses, each request
sent twice. The name's clause and the throughput clauses count
among the 10.
validate_name_member_after now keeps the first 10 clauses, and
missing_members stops at 10 paths. The PartiQL request checks had the
same limit as a private constant. Both now read MAX_CLAUSES in
extenddb_core::validation.
The engine table of the restore order and _OVERRIDE_MEMBER_ROWS get
seven rows measured on 3 Dec 2026. Three rows test the limit. The others
send a null IndexName in a GSI entry, an SSEType of "" and of "kms", and
a ReadCapacityUnits of -1e30. The doc of capacity_units cites that row.
The backup and restore manual still said that every VectorIndexOverride is refused. A null or an empty one is no override, and the manual now says so. The overrides row of docs/differences-from-dynamodb.md said that every list with entries gets a ValidationException. A list with an entry of another JSON kind, such as [[]], gets a SerializationException, as a value that is not a list does. The row now says so.
The new head of fix/1326-cross-region-restore gives the service's answer for a padded backup ARN of another account in the BackupArn row of docs/differences-from-dynamodb.md. The row named an issue number there. The merge has no conflict.
Clippy 1.97 refuses the clone that made a one-entry slice in a row of the restore order test (cloned_ref_to_slice_refs). The row now uses std::slice::from_ref.
|
Changes since the last review
The branch is at
13f6a213c0. These commits sit onede255504, the head that the review of 2 Dec 2026 read:9d760b41emerges fix(engine): answer a restore from another region as DynamoDB does #1359 atc15ba3632, which holdsmainof 25 Nov and the heads of the PRs below this one of that day. The conflicts:pub use messages::{...}line ofcrates/core/src/error/mod.rs. This PR addsMEMBER_NOT_NULL, and onmainfeat(streams): AT_TIMESTAMP shard iterator on all four backends #468 addedINVALID_STREAM_ARNandvalidation_errors_detected. The merge keeps every name.check_restore_table_nameincrates/engine/src/backup_requests/pitr.rs. fix(engine): check a restore's TargetTableName with the restore's rules #1247 added an# Errorssection, and this PR added the later clauses. The merge keeps both.crates/core/src/error/messages.rs,mainmoved the envelope ofvalidation_errorstovalidation_errors_detected. The merge keeps thenullvalue of aMEMBER_NOT_NULLclause invalidation_errors.fc0af5bfa: the null clauses list the entries ofLocalSecondaryIndexOverridebefore those ofGlobalSecondaryIndexOverride, as DynamoDB does (measured on 25 November 2026). The engine table and the wire table have that row, and with the old order the engine row fails. Both tables also have the row of a nullReadCapacityUnits(measured on 25 November 2026).d5cf6fab6ends the doc ofcapacity_unitsat the refusal of the parse.db0571dc5: the table of the checks that the WebAssembly build does not make lists the new clauses. TheVectorIndexOverriderows ofdocs/differences-from-dynamodb.mdanddocs/dynamodb-limits.mdsay that a null or an empty list is no override.296204d71merges fix(engine): answer a restore from another region as DynamoDB does #1359 at697a46709, with no conflict.07570f1f0cmerges fix(engine): answer a restore from another region as DynamoDB does #1359 atbc4e812bfc, which holds fix(engine): answer a missing or malformed BackupArn as DynamoDB does #1327's pushed head andmainof 2 Dec. The conflicts:README.md, which docs(readme): lead with a first request, move WebAssembly to its own page #1521 moved todocs/webassembly.mdonmain. The merge makes this PR's change of theTargetTableNamerow there.crates/engine/src/partiql/request_checks.rs: this PR removed theNOT_NULLconstant, andmainremovedAT_LEAST_ONE, which it reads fromrequest_limits.rsnow. The merge removes both.crates/engine/src/backup/tests.rs. The merge keeps the words and bindings of both sides. The core test ofvalidate_name_member_afterfrom fix(engine): check a restore's override values in DynamoDB's order #1353 gets thelaterargument of this PR.bb38573599lists at most 10 clauses for missing members, as DynamoDB does (measured on 3 December 2026). Before, 100000 entries of{}got an answer of 37 MB.validate_name_member_afterkeeps the first 10 clauses, andmissing_membersstops at 10 paths. The PartiQL request checks had the same limit as a private constant, and both now readMAX_CLAUSESinextenddb_core::validation. The engine table of the restore order and_OVERRIDE_MEMBER_ROWSget seven rows measured on 3 December 2026. Three rows test the limit. The others send a nullIndexName, anSSETypeof""and ofkms, and aReadCapacityUnitsof -1e30.3b921c0dd3:docs/manuals/14-backup-and-restore.mdsays that a null or an emptyVectorIndexOverrideis no override. The overrides row ofdocs/differences-from-dynamodb.mdsays that a list with an entry of another JSON kind, such as[[]], getsSerializationException.ab4adea834merges fix(engine): answer a restore from another region as DynamoDB does #1359 at6f959528e4, with no conflict.13f6a213c0builds one row of the restore order test withstd::slice::from_ref, which clippy 1.97 asks for.VectorIndexOverridesentence, and gives the conflicts and the test runs at the new head.What
RestoreTableFromBackup now answers these faults inside an override as DynamoDB does. Each fault is a clause of the request's one validation message.
WriteCapacityUnitsorReadCapacityUnitsinProvisionedThroughputOverridegetsValue null at '<path>' failed to satisfy constraint: Member must not be null. The path isprovisionedThroughputOverride.writeCapacityUnitsorprovisionedThroughputOverride.readCapacityUnits, and theWriteCapacityUnitsclause comes first. A member sent asnullgets the same clause.0.5getsValue '0' at 'provisionedThroughputOverride.readCapacityUnits' failed to satisfy constraint: Member must have value greater than or equal to 1.SSETypeoutside[AES256, KMS]inSSESpecificationOverridegets the enum clause atsSESpecificationOverride.sSEType.GlobalSecondaryIndexOverrideorLocalSecondaryIndexOverrideentry withoutIndexName,KeySchemaorProjectiongets aValue nullclause for each missing member, in that order. A member sent asnullis missing. The paths areglobalSecondaryIndexOverride.1.member.indexNameand the like. The entries of the LSI list come first."VectorIndexOverride": []is no override. A list with entries, such as[null]or[{}], keeps the refusal of ExtendDB. A value that is not a list, such as{}, and a list with an entry of another JSON kind, such as[[]], getSerializationException.The throughput, billing mode and SSE clauses come before the clauses of
TargetTableName, and the index override clauses come after them. All of them come after the account and shape answers for theBackupArnand after the length text of the name. They come before the check of the backup id.Before this change, the restore answered a missing member with a
SerializationException. It checked the SSE type only after it read the backup, and it refused"VectorIndexOverride": [].check_restore_name_and_overridesincrates/engine/src/backup.rsadds the clauses to the message ofvalidate_name_member_after.IndexOverrides::missing_membersincrates/engine/src/backup/overrides.rsfinds the missing index members.validation_errorsincrates/coreprints the value of aMember must not be nullclause asnull. The constraint text is the new constantMEMBER_NOT_NULLinextenddb_core::error.validation_errorsand the PartiQL request checks read it, and they read the clause limitMAX_CLAUSESinextenddb_core::validation.The table in
docs/webassembly.mdof the checks that the WebAssembly build does not make,docs/differences-from-dynamodb.md,docs/dynamodb-limits.mdanddocs/manuals/14-backup-and-restore.mddescribe these answers.The base of this PR is #1359.
Why
These are DynamoDB's answers, measured in us-east-1 on 21 November 2026 with signed requests. Each request went out twice and got the same answer both times. No backup exists. Unless the text says otherwise, the
BackupArnnames the caller's account and the target name is valid. Each answer with clauses is aValidationException.NULL(
<path>) isValue null at '<path>' failed to satisfy constraint: Member must not be null."ProvisionedThroughputOverride": {"ReadCapacityUnits": 1}provisionedThroughputOverride.writeCapacityUnits)SerializationException"ProvisionedThroughputOverride": {}writeCapacityUnits, then forreadCapacityUnitsSerializationException"ProvisionedThroughputOverride": {"ReadCapacityUnits": 0}writeCapacityUnits, then thereadCapacityUnitsrange clause"BillingModeOverride": "PAY"with{"ReadCapacityUnits": 1}writeCapacityUnits, then thebillingModeOverrideenum clause"GlobalSecondaryIndexOverride": [{}]indexName,keySchemaandprojectionofglobalSecondaryIndexOverride.1.memberSerializationException"GlobalSecondaryIndexOverride": [{"IndexName": "gsi"}]keySchemaandprojectionSerializationException"LocalSecondaryIndexOverride": [{}]localSecondaryIndexOverride.1.memberSerializationException"SSESpecificationOverride": {"SSEType": "BAD"}sSESpecificationOverride.sSETypeenum clauseBackupNotFoundException{"ReadCapacityUnits": 0.5, "WriteCapacityUnits": 1}, backup idbadValue '0'atprovisionedThroughputOverride.readCapacityUnitsInvalid Request: BackupArn is not valid"VectorIndexOverride": []BackupNotFoundExceptionWith the target name
a b, DynamoDB adds the pattern clause oftargetTableNamein the order that the What section gives. ExtendDB on #1359 leaves out the new clauses. With the backup idbad, DynamoDB gives the same clauses. ExtendDB on #1359 answersInvalid Request: BackupArn is not validwhen the only fault is a missing member or the SSE type.The comparison covers 181 requests. Of the 143 requests in scope, this PR gives DynamoDB's answer to 143, and #1359 to 105. The other 38 requests have another JSON kind in an override member or an entry in
VectorIndexOverride. This PR and #1359 give the same answer to each, and 34 of them match DynamoDB. The 4 others have aVectorIndexOverrideentry. DynamoDB answers the length clause of its index name. ExtendDB answers its refusal, the name's clause alone or the backup id text, with and without this PR.DynamoDB gave these answers on 25 November and 3 December 2026, measured the same way. The ExtendDB columns of the rows of 3 December come from SQLite servers built from
6f959528e4and13f6a213c0."GlobalSecondaryIndexOverride": [{}]and"LocalSecondaryIndexOverride": [{}]indexName,keySchemaandprojectionoflocalSecondaryIndexOverride.1.member, then ofglobalSecondaryIndexOverride.1.memberSerializationException"ProvisionedThroughputOverride": {"ReadCapacityUnits": null, "WriteCapacityUnits": 1}provisionedThroughputOverride.readCapacityUnits)SerializationException"ProvisionedThroughputOverride": {"ReadCapacityUnits": 1.5, "WriteCapacityUnits": 1}BackupNotFoundExceptionSerializationExceptionSerializationException"GlobalSecondaryIndexOverride": [{"IndexName": null, ...}]with a validKeySchemaandProjectionglobalSecondaryIndexOverride.1.member.indexName)SerializationException"SSESpecificationOverride": {"SSEType": ""}, and the same withkmssSESpecificationOverride.sSETypeenum clauseBackupNotFoundException{"ReadCapacityUnits": -1e30, "WriteCapacityUnits": 1}Value '-9223372036854775808'atprovisionedThroughputOverride.readCapacityUnitsSerializationException"GlobalSecondaryIndexOverride"with 4, 50 or 1000 entries of{}indexNameof entry 4SerializationExceptiona btargetTableName, then 9 NULL clauses"ProvisionedThroughputOverride": {}SerializationExceptionFixes #1348
Testing done
At
13f6a213c0, each cargo command with--locked:cargo +1.97.0 test -p extenddb-core -p extenddb-engine -p extenddb-server --lib --no-fail-fast: core 1260 passed and 1 ignored, engine 983 passed, server 524 passed. On this host 5backup_store::testsof the server fail on every branch,mainincluded, because another user owns/local/home.cargo +1.97.0 clippyof the core, engine, server and storage crates with--all-targets -- -D warnings, the same command with--features extenddb-engine/backup-test-hooks,cargo +1.94.0 checkof the four crates with--all-targets, andcargo +1.97.0 fmt --all -- --checkare clean.cargo +1.97.0 test -p extenddb-wasm-adapter: the 3 unit tests pass, and the parity test passes all 281 cases of the corpus. The clippy step of the WebAssembly workflow is clean.tests/test_backup_restore_fidelity.py118 passed andtests/test_authz_cross_account.py19 passed.pytest --collect-only -qcollectstests/andtests/pythonwith no error.bb38573599, each with the tests kept: without the cut to 10 clauses invalidate_name_member_after, or without the stop at 10 paths inmissing_members,a_restore_checks_its_members_in_the_services_orderfails. Withentry.get(member).is_none()inmissing_members, it fails at the nullIndexNamerow.9d760b41e, the engine test with the new rows ran with the old order of the two lists. It failed at the row with entries in both lists, where it got the GSI list first.tests/test_backup_restore_fidelity.pypassed 95 tests against it. 402 random restore requests went to that build and to fix(engine): answer a restore from another region as DynamoDB does #1359's head. The 161 answers that differ add clauses of this change, in the order above.Line counts at
13f6a213c0, against #1359's head6f959528e4: production +138 -39, tests +276 -48, docs +4 -4. The test files, the parity corpus and the lines after#[cfg(test)]andmod testscount as tests, and.mdfiles as docs.git merge-treeshows no conflict withmainatc8e66fb568. Of the 106 open PRs that change the files of this stack, these get a new conflict from this PR:pub use messages::{...}line ofcrates/core/src/error/mod.rs. The resolution keeps every name.check_index_namesincrates/engine/src/backup/overrides.rs, next tomissing_members. The resolution keeps both functions. fix(engine): answer the IndexName faults of both restore override lists #1273 conflicts with the PRs below this one already. fix(engine): answer the IndexName faults of both restore override lists #1273 also addsMAX_LISTED_CLAUSESincrates/core/src/validation/mod.rs, and fix(engine): refuse ProjectionType and StreamViewType outside their sets #1110 addsMAX_FAULTSincrates/engine/src/nested_enums.rs. Both hold the same limit of 10 asMAX_CLAUSES. Each of these PRs that merges after another one drops its copy and reads the constant that is already on main.docs/differences-from-dynamodb.mdand the overrides row ofdocs/dynamodb-limits.md, next to theVectorIndexOverridetexts of this PR. The PR that merges second takes both changes. fix(engine): give RestoreTableFromBackup override conflicts DynamoDB's texts #1096 conflicts with the PRs below this one already, incrates/engine/src/backup.rsandcrates/engine/src/backup/tests.rs.crates/engine/src/partiql/request_checks.rs, and fix(engine): refuse a BatchGetItem table value with no Keys by path #1301 in one. This PR removes the privateNOT_NULLconstant and makesinto_resultreadMAX_CLAUSES. refactor(engine): share the validation refusal header with the batch checks #1215 moves the message ofinto_resulttovalidation_refusalincrates/engine/src/request_limits.rs, with the same limit asMAX_PARTSthere. Whichever merges second keeps one constant,extenddb_core::validation::MAX_CLAUSES, andvalidation_refusalreads it.capacity_unitsreads a fraction as #1167 does indeserialize_capacity_units. Whichever of the two merges second should calldeserialize_capacity_units, so that one copy remains. On this base, a fraction of 1 or more, such as1.5, passes the clause check, and so does a figure above the 64-bit range. DynamoDB accepts1.5there and answersBackupNotFoundExceptionfor a backup that does not exist (measured on 25 November 2026). Here the parse refuses both with aSerializationExceptionuntil #1167 changes the parse.Not in this PR:
IndexNameclauses of an entry, which DynamoDB lists in the same message as its missing members (measured on 25 November 2026, RestoreTableFromBackup checks an override value before the BackupArn and the TargetTableName length, where DynamoDB checks those first #1271). For"GlobalSecondaryIndexOverride": [{"IndexName": "g i", "Projection": {"ProjectionType": "KEYS_ONLY"}}], DynamoDB answers2 validation errors detected: Value 'g i' at 'globalSecondaryIndexOverride.1.member.indexName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.-]+; Value null at 'globalSecondaryIndexOverride.1.member.keySchema' failed to satisfy constraint: Member must not be null. This PR answers1 validation error detected: Value null at 'globalSecondaryIndexOverride.1.member.keySchema' failed to satisfy constraint: Member must not be null.KeySchema, theKeyTypeandProjectionTypevalues and the entry'sProvisionedThroughput. These are not measured.VectorIndexOverrideentry (the 4 requests above).SerializationException(A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012).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
RestoreTableFromBackup answers a missing or null throughput member and a missing member of an index override entry with
ValidationExceptionclauses, where it answeredSerializationException. The message lists at most 10 clauses. It answers anSSETypeoutside its enum with its clause before the backup read, where it answered after the read. It accepts"VectorIndexOverride": []as no override, where it refused it. A client that matches on the old answers sees the new ones. A restore with complete overrides gets the same answer 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.