Skip to content

test(backup): pause the clock in a_resume_loads_from_the_recorded_progress - #1193

Merged
LeeroyHannigan merged 1 commit into
mainfrom
fix/1101-resume-paused-clock
Nov 20, 2026
Merged

LeeroyHannigan merged 1 commit into
mainfrom
fix/1101-resume-paused-clock

Conversation

@hitesh96db

Copy link
Copy Markdown
Contributor

Fixes #1101.

a_resume_loads_from_the_recorded_progress failed once under load with the resumed restore job's record still Running after every file was loaded.

Before its DONE write, a restore job checks that its last confirmed heartbeat is at most two periods old (restore.rs, the confirms_the_claim check before finish). The test runtime's heartbeat is 50 ms, so the window is 100 ms. On a loaded host the beat aged past that, the job stopped as a lost claim with the load complete, and the record stayed Running. wait_for_jobs was not the cause: cycle_on spawns the resumed job on the runtime's task tracker before it returns, and running_jobs() counts the job until it ends.

The heartbeat measures time with tokio::time::Instant, so this change runs the test as #[tokio::test(start_paused = true)], as other tests in the module already do. A stalled host then cannot age the beat, and the test keeps its 50 ms heartbeat. No product code changes.

Testing, with cargo test -p extenddb-engine --lib:

Run Before After
The test with a 150 ms blocking stall before the DONE check fails at tests.rs:16113, left: Running, right: Done passes
The test with a 3 s blocking stall before the DONE check passes
The test alone, without a stall, 200 runs 0 failures
The backup::tests module, 5 runs 431 passed in each run, about 31 s
  • cargo +1.97.0 fmt --all -- --check: no changes.
  • cargo +1.97.0 clippy -p extenddb-engine --all-targets --features extenddb-engine/backup-test-hooks -- -D warnings: no warnings.

…gress

The resumed job checks for a confirmed heartbeat at most two periods
old before its DONE write, 100 ms at the test's 50 ms heartbeat. On a
loaded host the beat aged past that, the job stopped as a lost claim
with every file loaded, and the test read the record as RUNNING. Run
the test on a paused tokio clock, which the heartbeat reads, so a
stalled host no longer ages the beat.

Fixes #1101

@LeeroyHannigan LeeroyHannigan 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.

Looks good. I reproduced your table on this head with main merged in. With main's #[tokio::test], a 150 ms blocking stall before the DONE check fails at the status assertion, left: Running, right: Done. With start_paused = true the same stall passes, and so does a 3 s one. The test still catches a broken resume: with the open file reloaded from 0, it fails at the bulk_load_files assertion. It passed 200 of 200 runs idle and 200 of 200 with 8 busy processes on the host. #997 doesn't reach this test, because this test builds job_runtime.

Please use the PR template for the description.

You could also name the count check in the description, the commit message and the new comment. They name the DONE check as the place the job stopped. The count check right before it (crates/engine/src/backup/restore.rs:873) stops the job the same way and leaves the same RUNNING record, and the paused clock covers both. "Before its count and its DONE write" would cover both.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit ca768ed Nov 20, 2026
58 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/1101-resume-paused-clock branch November 20, 2026 17:26
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: a_resume_loads_from_the_recorded_progress reads the resumed restore job as Running after wait_for_jobs

2 participants