Repository navigation
fix(engine): give a restore into another backup's target DynamoDB's text - #1371
LeeroyHannigan wants to merge 1 commit into
Conversation
A RestoreTableFromBackup into a CREATING restore target answered the text for the backup of the restore in progress, whichever backup it named. That text is "Table: <name> is already being restored from backup: <arn>". All four backends answered it. Measured on DynamoDB in us-east-1 on 22 Nov 2026, with a target CREATING from backup B1. Each request went out twice, 5 seconds apart, and got the same 400 both times: - B2 into the target's name: TableInUseException, "Attempt to change a resource which is still in use: Table: <name> is being used." - B1 into the target's name: TableInUseException, "Table: <name> is already being restored from backup: <B1 ARN>". restore_storage_err_to_dynamo now takes the ARN the request resolved to. It compares that ARN with the backup a TableBeingRestored error carries, the target's RestoreSummary.SourceBackupArn. The same backup keeps its text. Another backup gets the measured text from restore_target_in_use_message. That function is split out of restore_target_in_use, so DeleteTable and the restore share one copy of the text. Each call site passes the resolved ARN. The legacy path passes the spelling the legacy reader resolved, and the catalog row path passes the row's ARN. The same backup keeps its text in each spelling the engine resolves: trimmed, another region, or an earlier server.region. The row "Restoring into a name that exists" of docs/differences-from-dynamodb.md now records the different-backup text. Fixes #1369.
navareamol
left a comment
There was a problem hiding this comment.
I think the new answer has no test on a backend. The five changed engine tests use a fake backend and a store held in memory, and the engine picks the text by comparing the ARN the request resolved to with the backup_arn that the backend reads from the target's restore row. So the text depends on each backend storing the same spelling. The docs row now states the other backup text for all four backends, and test_restore_into_a_creating_target_and_a_second_restore_of_its_backup_are_refused in tests/test_backup_restore_fidelity.py only restores the same backup. On SQLite, with and without a backup store, I restored a second backup of the same table into the CREATING target and got "Attempt to change a resource which is still in use: Table: is being used.", and the base gave the first backup's text. Could you add a second backup to that wire test and check this text, so CI runs it on PostgreSQL, Cassandra and MongoDB too?
The description says there is no conflict with main or #1096. On current main (92155f3) it conflicts in crates/engine/src/backup.rs, on the use extenddb_storage::backup_catalog line: main removed TimeBounds and this PR adds restore_target_in_use_message. #1366 alone merges clean, and #1096 now conflicts on the same line for the same reason. With both sides kept, the engine lib tests pass (978) and the SQLite run gives the same answers. The CI here ran before main added its wasm and other workflows, so none of them has run on this code. Could you merge main and update the sentence?
Three of the new engine rows expect the same backup text for the backup's ARN with surrounding whitespace, written with another region, and stored under an earlier server.region. The description says DynamoDB was not measured with these. Has anyone sent the padded ARN or the other region ARN of the same backup into its CREATING target on DynamoDB?
I will approve once a wire test checks the other backup text on every backend and main is merged with CI green on it.
What
A RestoreTableFromBackup can name a target that is still
CREATINGfrom a restore of another backup. Such a request now getsTableInUseExceptionwith the text that DynamoDB gives:Attempt to change a resource which is still in use: Table: <name> is being used.Before, the answer was the text for the same backup,
Table: <name> is already being restored from backup: <arn>, and the ARN was the backup of the restore in progress. A restore that names the backup of the restore in progress keeps that text.The changes:
restore_storage_err_to_dynamoincrates/engine/src/backup.rsnow takes the ARN that the request resolved to. AStorageError::TableBeingRestoredcarries the backup of the restore in progress, which is the target'sRestoreSummary.SourceBackupArn. When the two ARNs differ, the answer is the new text.restore_target_in_use_messageincrates/storage/src/backup_catalog.rsgives the text. It is split out ofrestore_target_in_use, which fix(storage): answer DeleteTable on a restore target with DynamoDB's text #1366 adds for DeleteTable. So DeleteTable and the restore share one copy of the text.check_restore_target_nameand the backend's registration. On the store-backed path, they are the name check, the registration in flight and the claim refusal.docs/differences-from-dynamodb.mdchanges. It said that ExtendDB does not give the text for another backup.The base of this PR is #1366.
Fixes #1369
Why
These are DynamoDB's answers, measured in us-east-1 on 22 November 2026. A table with one item had two backups, B1 and B2, both
AVAILABLE. A RestoreTableFromBackup of B1 into a new name made the target. DescribeTable of the target gaveTableStatusCREATING, with B1 asRestoreSummary.SourceBackupArn. Each request below went out twice, 5 seconds apart, and got the same answer both times.TableInUseException,Attempt to change a resource which is still in use: Table: <name> is being used.TableInUseException,Table: <name> is already being restored from backup: <B1 ARN>TableInUseException,Table: <name> is already being restored from backup: <B1 ARN>Testing done
cargo test -p extenddb-engine --lib backup --no-fail-fast: 467 passed.cargo test -p extenddb-storage --no-fail-fast: 284 passed.cargo +1.97.0 clippy -p extenddb-engine -p extenddb-storage --all-targets -- -D warningsandcargo +1.97.0 fmt --all -- --checkare clean.server.region. DynamoDB was not measured with these spellings of the ARN.eu-west-1got the text for the same backup, with the stored ARN. The target then becameACTIVEwith all 60,000 items.tests/test_backup_restore_fidelity.pypassed 37 tests withEXTENDDB_TEST_BACKUP_STORE=none./,/localand/local/home, and no S3 endpoint was running.Production is +58 -29 and the tests are +87 -44.
git merge-treeshows no conflict withmain, #1359, #1365, #1366, #1367 or #1096. This PR adds no conflict with any open 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
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.