Repository navigation
fix(backup): word the startup sync's stop line by the call in flight [backup/restore 10 follow-up] #932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(backup): word the startup sync's stop line by the call in flight [backup/restore 10 follow-up] #932
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ use extenddb_core::backup_format::{ | |
| use extenddb_core::metrics::MetricsCollector; | ||
| use extenddb_storage::BackupCatalog; | ||
| use extenddb_storage::backup_catalog::{ | ||
| BackupKey, BackupRow, BackupStatus, ForgetRow, StoreIdentity, StoreKind, UNOWNED_GENERATION, | ||
| BackupKey, BackupRow, BackupStatus, ForgetRow, StoreIdentity, UNOWNED_GENERATION, | ||
| is_backup_not_found, | ||
| }; | ||
| use extenddb_storage::error::StorageError; | ||
|
|
@@ -1032,22 +1032,33 @@ pub async fn startup_sync<S: BackupCatalog + ?Sized>( | |
| claim: None, | ||
| }, | ||
| ); | ||
| // A store call abandoned at its bound or dropped with the run (a | ||
| // filesystem call, whose thread still runs) is marked in flight under | ||
| // its caller's name: the run's own call, or another caller's (a | ||
| // deletion's, whose call held the slot the run waited for). Until it | ||
| // returns, each cycle's check is refused and the store is unreachable, | ||
| // so the sync runs again on the first cycle after it; the clause names | ||
| // the caller as the refusal does. A run cut in a catalog call, or after | ||
| // its last store call returned, marks nothing, and with no other | ||
| // caller's call in flight the next cycle's check runs as usual. | ||
| let in_flight = || { | ||
| store | ||
| .call_in_flight_caller() | ||
| .map_or_else(String::new, |caller| { | ||
| format!( | ||
| " (once the abandoned {caller} has returned; until then the store is \ | ||
| unreachable)" | ||
| ) | ||
| }) | ||
| }; | ||
| let Ok(outcome) = tokio::time::timeout(STARTUP_SYNC_TIMEOUT, run).await else { | ||
| // On a filesystem store the abandoned listing's walk still runs: | ||
| // until it returns, each cycle's check is refused and the store is | ||
| // unreachable, so the sync runs again on the first cycle after it. | ||
| tracing::warn!( | ||
| "backup store ({}) startup sync of the in-memory catalog did not finish within {} \ | ||
| s; the backups it adopted keep their rows, and a later reconciler cycle runs it \ | ||
| again from the first key of the root{}", | ||
| store.kind, | ||
| STARTUP_SYNC_TIMEOUT.as_secs(), | ||
| if store.kind == StoreKind::Filesystem { | ||
| " (once the abandoned listing of the root has returned; until then the store is \ | ||
| unreachable)" | ||
| } else { | ||
| "" | ||
| } | ||
| in_flight() | ||
| ); | ||
| return None; | ||
| }; | ||
|
|
@@ -1102,8 +1113,9 @@ pub async fn startup_sync<S: BackupCatalog + ?Sized>( | |
| } | ||
| Err(e) => tracing::warn!( | ||
| "backup store ({}) startup sync of the in-memory catalog stopped: {e}; a later \ | ||
| reconciler cycle runs it again", | ||
| store.kind | ||
| reconciler cycle runs it again{}", | ||
| store.kind, | ||
| in_flight() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No test checks how this line ends when nothing is marked. The only assertion on the error arm, at tests.rs:22038, runs with the walk marked. The failed-listing run in
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added as the fourth cut, |
||
| ), | ||
| } | ||
| Some(outcome) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No cut reaches this arm while another caller's call is marked.
SidecarReadStalledruns with the startup sync's own mark, andInsertStalledwith none.DeletionInFlightends in the error arm, because the listing's slot wait and the run's bound both end at 60 seconds. Reading the tests, a change that makes this arm name the startup sync's own call whenever the mark is set fails none of them. Please add a cut that ends here with a deletion marked, and assert that this line names the deletion. One way is a delay of 1 second on the manifest's read and a deletion started after 500 milliseconds. The deletion then takes the slot first, and the run's bound ends the run before the sidecar read's wait ends.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a sixth cut,
Cut::DeletionAheadOfTheSidecarRead, toa_cut_startup_sync_names_the_store_unreachable_only_while_its_call_is_in_flight(crates/engine/src/backup/tests.rs:21973), along the lines you suggested. Each store call takes 1 s, deletions stall, and acalls("deletion")delete starts at 500 ms. The deletion takes the slot when the manifest read returns at 1 s, so the sidecar read's wait for the slot would end at 61 s, and the run's 60 s bound ends the run first. The cut asserts that the run timed out rather than returningErr, thatcall_in_flight_caller()isSome("deletion"), and that the timeout line ends with the deletion's clause and never names the startup sync's own call. Your mutant fails it: the timeout arm naming the startup sync's call whenever the mark is set. The cell passed 20 runs in a row, andbackup::passes 339.