From 0fdfe7d6f35b1914f901c710b23f88c64773fa90 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 25 Oct 2026 20:09:39 +0100 Subject: only keep list of actor IDs within one epoch (fixup) --- src/remake/catchup.rs | 2 ++ src/remake/local.rs | 12 ++++++++++-- src/remake/switch.rs | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/remake/catchup.rs b/src/remake/catchup.rs index 4feb70e..631fb25 100644 --- a/src/remake/catchup.rs +++ b/src/remake/catchup.rs @@ -382,6 +382,8 @@ async fn finish(host: &H) { }, ); host.remake().set_catch_up(None); + let actor = host.read_doc(|doc| doc.get_actor().clone()).await; + host.remake().reset_own_actors(actor); if was_ready { host.resume().await; } diff --git a/src/remake/local.rs b/src/remake/local.rs index 09c99bd..65a2735 100644 --- a/src/remake/local.rs +++ b/src/remake/local.rs @@ -55,8 +55,10 @@ struct Inner { content_fetches: HashSet<[u8; 32]>, /// Remakes this node coordinates now (`coordinator`). coordinating: HashSet, - /// Every actor this node writes or wrote with: one per run and epoch, and those of - /// earlier runs it knows of (`--document-file`). Its own writes, for a rejoin. + /// The actors this node writes or wrote with in the current document: this run's, + /// and those of earlier runs it knows of (`--document-file`). Its own writes, for a + /// rejoin. A switch or rejoin starts the list over with the new document's actor, so + /// it only grows with restarts within one epoch. own_actors: Vec, } @@ -158,6 +160,12 @@ impl RemakeState { } } + /// The current document is a new one, written with `actor` only (a switch or rejoin + /// is done). + pub(crate) fn reset_own_actors(&self, actor: ActorId) { + self.lock().own_actors = vec![actor]; + } + pub(crate) fn own_actors(&self) -> Vec { self.lock().own_actors.clone() } diff --git a/src/remake/switch.rs b/src/remake/switch.rs index e78643a..1a4dbf9 100644 --- a/src/remake/switch.rs +++ b/src/remake/switch.rs @@ -207,6 +207,7 @@ async fn switch( let actor = ActorId::random(); host.remake().add_own_actor(actor.clone()); + let new_actor = actor.clone(); // 2. Build (or reuse), verify and replay without holding any lock. let (new_doc, copy_heads, mut stats) = tokio::task::spawn_blocking( @@ -245,6 +246,7 @@ async fn switch( // 3. Swap, replaying what arrived since the copy. let (old, late) = swap_in(host, expected, new_doc, copy_heads, late_translator).await?; stats.absorb(late); + host.remake().reset_own_actors(new_actor); // 4. Writes the remake had no place for wait for an operator (the old document // holds them); the old document is kept as configured either way. -- cgit v1.3.1