Repository navigation
docs(node): stop claiming no reconciliation sweep backs the coalesced drain #686
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -1750,11 +1750,11 @@ async fn commit_request_outcomes_seamed( | |
|
|
||
| /// Attempts allowed for the drain re-read before the lap gives up. The coalesced | ||
| /// push's work is already out of the pending slot (`finish_or_take_pending` took it | ||
| /// in the same critical section that kept the key), and there is no reconciliation | ||
| /// sweep to re-derive it: a transient read error must be RETRIED here or that push's | ||
| /// pin/encrypt pass is gone. The bound keeps a sustained outage from spinning | ||
| /// forever; on exhaustion the work is still lost (the pre-existing residual), but | ||
| /// the give-up is logged at ERROR so it is observable instead of silent. | ||
| /// in the same critical section that kept the key), so a transient read error must be | ||
| /// RETRIED here or that push's pin/encrypt pass waits for the reconciliation sweep's | ||
| /// next pass (and is lost when the sweep is disabled). The bound keeps a sustained | ||
| /// outage from spinning forever; on exhaustion the lap is dropped and the give-up is | ||
| /// logged at ERROR so it is observable instead of silent. | ||
| const DRAIN_REREAD_MAX_ATTEMPTS: usize = 3; | ||
|
|
||
| /// Backoff before the next re-read attempt. Doubles per attempt. | ||
|
|
@@ -1821,7 +1821,8 @@ async fn drain_refresh_state(ctx: &EncryptTaskCtx) -> DrainRefresh { | |
| repo = %ctx.repo_id, | ||
| attempts = DRAIN_REREAD_MAX_ATTEMPTS, | ||
| "coalesced drain: re-read failed on every attempt; the coalesced push's \ | ||
| pin/encrypt pass is dropped (no reconciliation sweep re-derives it)" | ||
| pin/encrypt pass is dropped until the reconciliation sweep's next pass \ | ||
| (never, if the sweep is disabled)" | ||
|
Contributor
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. Account for recovery by a later push. If the sweep is disabled, a later admitted push can still walk the repository’s withheld blobs and seal a missing recovery copy. The log says recovery is impossible in that case. Qualify this message and the related comments to distinguish loss of the sweep backstop from permanent loss.
|
||
| ); | ||
| #[cfg(test)] | ||
| drain_faults::mark_reread_exhausted(&ctx.repo_id); | ||
|
|
@@ -1850,7 +1851,8 @@ async fn resolve_drain_object_list( | |
| )> { | ||
| // Both re-reads are bounded-retried: a transient blip must not discard the | ||
| // coalesced push's work (`finish_or_take_pending` already took it out of the | ||
| // pending slot and no sweep re-derives it). The rules come back from the same | ||
| // pending slot, and only the reconciliation sweep's next pass would re-derive | ||
| // it). The rules come back from the same | ||
| // refresh, read against the FRESH record.id, never the spawn-time ctx.repo_id. | ||
| let (record, rules_opt) = match drain_refresh_state(ctx).await { | ||
| // A mirror row's rules were never synced, so its empty snapshot means | ||
|
|
@@ -14566,16 +14568,17 @@ mod tests { | |
| // unbounded outstanding set. U4 bounds it by coalescing per repo: before spawning, | ||
| // if a task for the repo is in flight, skip the duplicate. Crucially this DEFERS a | ||
| // duplicate walk (the newer push's objects are covered by the pending one) and does | ||
| // NOT shed — there is no reconciliation sweep, so a dropped job would permanently | ||
| // lose the withheld-blob recovery copy (`2a54c15`'s fail-closed durability stance). | ||
| // NOT shed: a dropped job would leave the withheld-blob recovery copy missing until | ||
| // the reconciliation sweep's next pass, and for good with the sweep disabled | ||
| // (`2a54c15`'s fail-closed durability stance). | ||
| // | ||
| // These drive the coalescing seam (`EncryptInflight`) that the detached spawn at | ||
| // `repos.rs` consults directly (the try_begin gate on the in-flight set, guarded by | ||
| // `withheld.is_some()`). Observing `encrypt_and_pin`'s IPFS effect end-to-end needs a live IPFS node | ||
| // (`pin_git_object` hits the API), so the durability property is proven at this | ||
| // layer: a coalesced repo's key is released when its task ends, so a later push for | ||
| // that repo is processed once — NOT permanently skipped, which is exactly what a | ||
| // coalesce->shed mutation would break by dropping the job with no sweep to recover it. | ||
| // coalesce->shed mutation would break by dropping the job and leaving it to the sweep. | ||
|
|
||
| /// Bounded outstanding set under saturation (R4). Simulate K rapid path-scoped | ||
| /// pushes to the SAME repo while the encrypt pool is saturated (every spawned task | ||
|
|
@@ -14656,7 +14659,8 @@ mod tests { | |
| /// property: once an in-flight task ENDS (its guard drops — completion, error, or | ||
| /// panic-unwind) the repo key is released, so the NEXT push for that repo is admitted | ||
| /// and processed again. A coalesce->shed mutation would drop the job AND never | ||
| /// re-admit — with no reconciliation sweep the copy is lost forever. Here re-admission | ||
| /// re-admit, leaving the copy to the reconciliation sweep (lost forever with the sweep | ||
| /// disabled). Here re-admission | ||
| /// survives normal completion AND a panic, so no permanent skip / no leaked key. | ||
| #[test] | ||
| fn u4_coalesced_repo_is_reprocessed_after_task_ends_not_permanently_skipped() { | ||
|
|
@@ -14685,8 +14689,9 @@ mod tests { | |
| ); | ||
|
|
||
| // A LATER push for the SAME repo is admitted again (processed, not skipped | ||
| // forever). This is what coalesce->shed breaks: shed drops the job and no sweep | ||
| // re-derives the missing copy, so the recovery copy is permanently lost. | ||
| // forever). This is what coalesce->shed breaks: shed drops the job, and the | ||
| // recovery copy stays missing until the reconciliation sweep's next pass (for good | ||
| // with the sweep disabled). | ||
| let guard2 = admit(&inflight, repo); | ||
| // An errored task (guard dropped without finishing) still releases the key. | ||
| drop(guard2); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,8 +311,9 @@ pub struct AppState { | |
| /// has a task in flight it coalesces (skips the duplicate spawn) rather than parking | ||
| /// a new waiter, and its tip pairs are recorded for that task's drain loop (#174 F5). | ||
| /// Coalescing only delays the coalesced push's walk — it never drops the withheld-blob | ||
| /// recovery copy, which `2a54c15` deliberately kept fail-closed (there is no | ||
| /// reconciliation sweep to re-derive a dropped copy). See [`EncryptInflight`]. | ||
| /// recovery copy, which `2a54c15` deliberately kept fail-closed (a dropped copy waits | ||
| /// for the reconciliation sweep's next pass, and is lost when the sweep is disabled). | ||
| /// See [`EncryptInflight`]. | ||
| pub encrypt_inflight: EncryptInflight, | ||
| /// Per-repo in-process write serializer that SUPPLEMENTS the cluster-wide pg | ||
| /// advisory lock on the receive-pack path (#174 U2/F3). On a client disconnect | ||
|
|
@@ -667,8 +668,9 @@ impl AppState { | |
| /// only its own pre-spawn object-list snapshot, so the merge is what keeps coalescing | ||
| /// lossless (#174 F5): the task loop-drains the pending slot via | ||
| /// [`EncryptInflightGuard::finish_or_take_pending`] before releasing the key, so a | ||
| /// coalesced push's pins and recovery copies are delayed, never dropped (there is no | ||
| /// reconciliation sweep, so a *dropped* job would be lost forever). Check-then-record | ||
| /// coalesced push's pins and recovery copies are delayed, never dropped (a *dropped* | ||
| /// job waits for the reconciliation sweep's next pass, and is lost for good when the | ||
| /// sweep is disabled). Check-then-record | ||
| /// as two lock acquisitions would race the task's final pending check — hence one | ||
| /// critical section for both. | ||
| /// | ||
|
|
@@ -859,8 +861,9 @@ impl Drop for EncryptInflightGuard { | |
| // Normal exit disarmed us inside finish_or_take_pending's critical section; | ||
| // an armed drop means the task ended abnormally (panic-unwind, or a future | ||
| // code path that returns without finishing). Release the key so the repo is | ||
| // not permanently locked out, and log any pending work this loses — there | ||
| // is no sweep, so it stays lost until a later push re-walks the repo. | ||
| // not permanently locked out, and log any pending work this loses. It stays | ||
| // lost until the reconciliation sweep's next pass or a later push re-walks the | ||
| // repo, and with the sweep disabled only the push re-derives it. | ||
|
Comment on lines
+865
to
+866
Contributor
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. Do not promise that a later push restores dropped public pins. If the A→B drain is dropped, a later B→C push scans the B→C delta. Objects introduced by B are already at the old tip, so that scan need not pin them. Distinguish the full-history recovery-copy walk from public pin recovery.
|
||
| if !self.armed { | ||
| return; | ||
| } | ||
|
|
||
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.
Do not promise recovery on the next sweep pass.
A pass covers at most 100 repositories. If this repository is outside the next batch, that pass will not recover its dropped work. Say recovery waits until a sweep pass visits the repository.