summaryrefslogtreecommitdiffstats
path: root/src/remake
diff options
context:
space:
mode:
Diffstat (limited to 'src/remake')
-rw-r--r--src/remake/catchup.rs2
-rw-r--r--src/remake/local.rs12
-rw-r--r--src/remake/switch.rs2
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<H: Host>(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<String>,
- /// 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<ActorId>,
}
@@ -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<ActorId> {
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<H: Host>(
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<H: Host>(
// 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.