Skip to content

test(backup): accept a DELETING restore target while the cell waits for it to go - #994

Merged
eliseong merged 1 commit into
mainfrom
fix/993-restore-target-deleting
Nov 20, 2026
Merged

eliseong merged 1 commit into
mainfrom
fix/993-restore-target-deleting

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

_wait_table_gone in tests/test_backup_job.py now accepts a target that answers DELETING while the helper waits for the target to go. Before this change it failed on any status other than CREATING.

Why

Closes #993

On PostgreSQL, abort_restore sets a failed restore's target to DELETING before it drops the data and deletes the row. A DescribeTable poll in that window failed test_a_tampered_data_file_fails_the_restore_before_any_item in run 43619460425 (#398, run-integration (2)). The helper polls every 0.2 s, so the cell failed only when a poll landed in the window.

The assertion is there to catch a target that became writable. A DELETING table is not writable either, so the helper still fails on ACTIVE or on any other status.

Testing done

  • python3 -m py_compile tests/test_backup_job.py: no errors.
  • I did not run the cell on this host. It needs a PostgreSQL deployment, and the CI integration jobs run it.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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.

…or it to go

_wait_table_gone failed on any status other than CREATING. On PostgreSQL, abort_restore sets a failed restore's target to DELETING before it drops the data and deletes the row. A DescribeTable poll in that window failed test_a_tampered_data_file_fails_the_restore_before_any_item in run 43619460425.

The helper now accepts CREATING and DELETING. Neither status is writable, and the assertion checks that the target never became writable.

Fixes #993

@eliseong eliseong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I ran the tampered-file cell on PostgreSQL 16 on a loaded Linux host, 12 runs on each side with one server build.

  • With the helper from main, 12 of 12 runs failed with "tamper--r is DELETING, it was never writable". This is the failure of run 43619460425.
  • With this branch, 12 of 12 runs passed.

The DELETING state is expected. PostgreSQL's abort_restore commits DELETING, then drops the data, then deletes the row (backup_engine.rs:957-998). SQLite removes the row and the data in one transaction, so it never shows DELETING. The helper still fails on ACTIVE and on any other status.

The change covers all three cells that call _restore_fails: the tampered file, the duplicate key across files and key_range. No other wire test waits for a failed restore's target with a status check that rejects DELETING.

@eliseong
eliseong added this pull request to the merge queue Nov 20, 2026
@eliseong eliseong self-assigned this Nov 20, 2026
Merged via the queue into main with commit b793835 Nov 20, 2026
51 checks passed
@eliseong
eliseong deleted the fix/993-restore-target-deleting branch November 20, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky: test_a_tampered_data_file_fails_the_restore_before_any_item fails when it sees the target DELETING

2 participants