From bfe93eea9b707b29b78e1f9a7a425e6f891701a0 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 13 Nov 2026 02:39:55 +0000 Subject: state: quarantine a drop's own writes before the document is let go A node dropping a change taken unjudged swapped in the document without it, released it, and only then quarantined its own writes that were dropped with it. In between, a reader found them gone and not quarantined: `simtest::policy::a_change_taken_unjudged` asserts right after seeing the change gone, and found the quarantine empty now and then. They are quarantined now under the document's lock, with the swap. --- src/state/host.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/state/host.rs') diff --git a/src/state/host.rs b/src/state/host.rs index 5b52e1d..771884e 100644 --- a/src/state/host.rs +++ b/src/state/host.rs @@ -229,20 +229,22 @@ impl AppState { let mut screening = state.screening.lock_or_recover(); screening.of(replica.epoch_seq).keep_dropped(theirs); } - Some((epoch, old, paths, tainted.len())) + let own_paths = paths.len(); + // Before the document is let go: whoever reads it without the writes finds + // them quarantined. + crate::remake::quarantine_taken(&state, epoch, &old, paths); + Some((own_paths, tainted.len())) }) .await .ok() .flatten(); - let Some((epoch, old, paths, count)) = dropped else { + let Some((own_paths, count)) = dropped else { return; }; info!( changes = count, - own_paths = paths.len(), - "Dropped a change taken unjudged and what built on it" + own_paths, "Dropped a change taken unjudged and what built on it" ); - crate::remake::quarantine_taken(self, epoch, &old, paths); self.after_epoch_switch().await; } -- cgit v1.3.1