Repository navigation
fix(storage): answer DeleteTable on a restore target with DynamoDB's text - #1366
Open
LeeroyHannigan wants to merge 1 commit into
Open
LeeroyHannigan wants to merge 1 commit into
LeeroyHannigan wants to merge 1 commit into
Conversation
…text DeleteTable on a restore target that is still CREATING answered ResourceInUseException on all four backends. Its text was "Attempt to change a resource which is still in use: Table is being restored: <name>". DynamoDB answers the same exception with another text. Measured in us-east-1 on 2026-11-21, twice, 5 seconds apart, on a target whose DescribeTable gave TableStatus CREATING and RestoreSummary.RestoreInProgress true: 400 ResourceInUseException Attempt to change a resource which is still in use: Table: <name> is being used. The text now comes from one function, restore_target_in_use in extenddb_storage::backup_catalog, next to backup_in_use. The SQLite, PostgreSQL, MongoDB and Cassandra delete paths call it, and the Cassandra backend's own table_being_restored helper is gone. The exception type and every other answer of the delete paths are unchanged. The text for a table that CreateTable is still creating is a separate case (#603) and does not change here. The four backend tests that cover DeleteTable of a CREATING restore target now assert the measured text by equality. Fixes #1316.
LeeroyHannigan
marked this pull request as ready for review
November 23, 2026 11:28
LeeroyHannigan
requested review from
amrith,
c33howard,
demohan,
eliseong,
hitesh96db,
jcshepherd,
navareamol,
pdf-amzn and
robinnsc
as code owners
November 23, 2026 11:28
This was referenced Nov 25, 2026
hitesh96db
reviewed
Dec 1, 2026
hitesh96db
left a comment
Contributor
There was a problem hiding this comment.
The change is a text-only substitution at the four refusal sites, and which tables get refused is the same as on main. On a SQLite build of this head, and on a merge into current main, DeleteTable on a restore target that is still CREATING now answers ResourceInUseException with Attempt to change a resource which is still in use: Table: <name> is being used., the text recorded in #1316. DeleteTable on a table that does not exist, an ACTIVE table, a DELETING table, a table CreateTable is still creating, and a restore source answer as they do on main. CI is green (58 of 58).
Suggestions, none blocking:
test_target_and_backup_are_held_while_the_copy_runs(tests/test_backup_restore_fidelity.py, lines 1258 to 1316) checks only the exception class (line 1281). Asserting the message there would pin the text on all four backends in CI. The exact-text tests for PostgreSQL, MongoDB and Cassandra need a server or cluster, and the PR body says they did not run for you, so today CI proves the text on SQLite only.docs/differences-from-dynamodb.mdline 130 ("DeleteBackup and DeleteTable during a restore") gives the exception without the text in either column. #1316 names that row, and the "documentation updated" box is unticked.- A question about the measurement. On DynamoDB a restore target answers differently at two points while it is CREATING. In two restores I ran on 2026-11-30, for about 5 to 31 seconds after the restore started, every operation answered as if the table did not exist (for example UpdateTable:
ResourceNotFoundException,Requested resource not found: Table: <name> not found). After that, UpdateTable and TagResource answeredResourceInUseExceptionwithAttempt to change a resource which is still in use: Table is being used: <name>, and DescribeTable read CREATING withRestoreInProgresstrue the whole time. I could not run DeleteTable on DynamoDB, so I do not know which of the two stages your 2026-11-21 measurement in #1316 sampled. A DeleteTable at both stages would show whether the early one needs its own answer.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DeleteTable on a restore target that is still
CREATINGnow answers DynamoDB's text on SQLite, PostgreSQL, MongoDB and Cassandra:ResourceInUseExceptionwithAttempt to change a resource which is still in use: Table: <name> is being used.Before, each backend answeredAttempt to change a resource which is still in use: Table is being restored: <name>.The text comes from one function,
restore_target_in_useincrates/storage/src/backup_catalog.rs, next tobackup_in_use. The four delete paths call it, and the Cassandra backend's owntable_being_restoredhelper is gone. The exception type and every other answer of the delete paths do not change.DeleteTable on a table that CreateTable is still creating is a separate case (#603). This PR does not change it.
Fixes #1316
Why
This is DynamoDB's answer, measured in us-east-1 on 21 November 2026. A RestoreTableFromBackup of an AVAILABLE backup made a new target. DescribeTable of the target gave
TableStatusCREATINGandRestoreSummary.RestoreInProgresstrue. DeleteTable of the target went out twice, 5 seconds apart, and both times got HTTP 400ResourceInUseExceptionwithAttempt to change a resource which is still in use: Table: <name> is being used.Testing done
cargo test -p extenddb-storage -p extenddb-storage-sqlite --no-fail-fast: 286 storage tests and 316 SQLite tests passed. 4 SQLite tests of the filesystem backup store fail on this host onmaintoo, because uid 65534 owns every ancestor directory.cargo test --libpassed 84 PostgreSQL, 190 MongoDB and 178 Cassandra tests. Three tests need a database container and did not run on this host. They are the PostgreSQL test intests/backup_restore.rs, the Cassandra held-target test and the MongoDB live test.cargo +1.97.0 clippyon the five storage crates with--all-targets -- -D warnings, andcargo +1.97.0 fmt --all -- --check, are clean.CREATINGrestore target got DynamoDB's answer, and the restore still copied all 60,000 items. The same target answers HTTP 200 once it isACTIVE. A table that CreateTable is still creating answers as onmain.tests/test_backup_restore_fidelity.pypassed 37 tests.Production is +17 -23 and the tests are +15 -4.
#1329 expects the old text in
tests/test_backup_restore_fidelity.pyand in its new row ofdocs/differences-from-dynamodb.md. The two PRs merge without a conflict, but with both merged,test_target_and_backup_are_held_while_the_copy_runsfails on ExtendDB. Whichever of the two merges second expectsTable: <target> is being used.on DynamoDB and ExtendDB alike, and drops the sentence of the row about the text of the backend.git merge-treeshows no conflict withmain. Incrates/storage-cassandra/src/delete_table.rs, this PR adds one conflict hunk with #599 and one with #550, and two with #598, which conflicts there already. The resolution keeps theirstatus == "CREATING"condition and the call torestore_target_in_use. None of them adds a call totable_being_restored, which this PR deletes.Not in this PR: a RestoreTableFromBackup into a
CREATINGtarget of another backup. ExtendDB answers it with the text for the same backup, where DynamoDB answersTable: <name> is being used.The row "Restoring into a name that exists" ofdocs/differences-from-dynamodb.mdrecords it.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.