diff options
| author | tv <tv@krebsco.de> | 2026-11-01 13:37:04 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 13:37:04 +0100 |
| commit | 5f2fdae1ea54b73eeb2352a28c6558b1e344e4e2 (patch) | |
| tree | 605dc197f553df4572e3b1f1a5992bc8184d2507 /src/remake/catchup.rs | |
| parent | efbc9899ab92c34db607f26c0e1b676e1e9d1c81 (diff) | |
remake: copy stale view when writes stop
This ensures that stale reads show every write that was answered.
Diffstat (limited to 'src/remake/catchup.rs')
| -rw-r--r-- | src/remake/catchup.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index 43cc390..2da8540 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -233,16 +233,17 @@ async fn start<H: Host>(host: &H, local: Epoch, target: Epoch, attempts: u32) { })); // Keep answering reads, from a copy of the current document marked stale, before - // the node stops being ready: no window in which reads get 503. - if host.is_node_ready().await { - let copy = host.read_doc(|doc| doc.clone()).await; + // the node stops being ready: no window in which reads get 503. Taken as writes + // stop, so it holds every write answered. + if let Some(copy) = host.refuse_writes(host.is_node_ready().await).await { host.set_stale_view(Some((local, copy))); } let was_ready = host.suspend().await; let actor = ActorId::random(); host.remake().add_own_actor(actor.clone()); - // The fresh document takes no writes until the rejoin is done: one checked as - // ready just before the suspension above would land in it (`Replica::writable`). + // The fresh document takes no writes either until the rejoin is done + // (`Replica::writable`): one checked as ready before the suspension above would + // land in it. let old = match host .switch_epoch(target, false, move |_live| { Ok::<_, Infallible>(Document::new().with_actor(actor)) |
