summaryrefslogtreecommitdiffstats
path: root/src/compaction
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 02:25:54 +0200
committertv <tv@krebsco.de>2026-10-20 02:25:54 +0200
commit6ef01932cc08bdb1a514d30ab6fb3f131f38f4dc (patch)
treeffd79831f0d4510cf6606cfbe5c79e0f9ccaa55b /src/compaction
parent11a8ec06429b639e9fefec85b72a48451acad456 (diff)
fix catch-up / compaction in general
Diffstat (limited to 'src/compaction')
-rw-r--r--src/compaction/switch.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compaction/switch.rs b/src/compaction/switch.rs
index 9f17df2..4093e7d 100644
--- a/src/compaction/switch.rs
+++ b/src/compaction/switch.rs
@@ -141,6 +141,11 @@ async fn switch<H: Host>(host: &H, id: &str, record: &Record) -> Result<ReplaySt
let previous = request.previous;
let base = request.base_heads.clone();
let retention = record.proposal.policy.archive_retention.clone();
+ // Only the coordinator carries the record into the new epoch: one writer, so the
+ // nodes don't all write the same path concurrently right after switching (a merge
+ // conflict, plus one change per node to sync). The epoch metadata in the snapshot
+ // keeps the essentials on every node anyway.
+ let carry_record = record.proposal.coordinator == host.node_id();
let record_path = records::record_path(id, "");
info!(compaction = %id, from = %previous, to = %expected, "Switching epoch");
@@ -172,8 +177,10 @@ async fn switch<H: Host>(host: &H, id: &str, record: &Record) -> Result<ReplaySt
let mut doc = snapshot.doc.with_actor(ActorId::random());
// Keep this compaction's record visible in the new epoch, for its history.
- if let Err(error) = store::copy_path(&copy, &mut doc, &record_path) {
- warn!(error = %error, "Could not carry the compaction record into the new epoch");
+ if carry_record {
+ if let Err(error) = store::copy_path(&copy, &mut doc, &record_path) {
+ warn!(error = %error, "Could not carry the compaction record into the new epoch");
+ }
}
let heads = copy.get_heads();