From 8ff191b1c03b06828c3b8176986b4e817a3f2aa8 Mon Sep 17 00:00:00 2001 From: dawn <90008@klbr.net> Date: Wed, 5 Aug 2026 18:23:39 +0300 Subject: [PATCH] [backfill] lock sparse existing-head snapshot persist_sparse_backfill computed its existing-head diff before any lock, so a live write or operator redaction could invalidate unchanged decisions before the root commit landed. permanent mode now holds the repo write lock from before the snapshot through commit; ephemeral mode has no heads and nothing to lock. issue: hydrant-uee --- src/backfill/sparse.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backfill/sparse.rs b/src/backfill/sparse.rs index 8189133..a71bd4e 100644 --- a/src/backfill/sparse.rs +++ b/src/backfill/sparse.rs @@ -439,6 +439,12 @@ async fn persist_sparse_backfill( let mut collection_counts: HashMap = HashMap::new(); let mut txn = DbTxn::new(db); + // permanent mode locks before the existing-head snapshot so a live + // write or operator redaction cannot invalidate the diff. ephemeral + // mode has no heads and therefore no shared record state to lock. + if !app_state.ephemeral { + txn.hold_repo_write_lock(&did); + } let prefix = keys::record_prefix_did(&did); let mut existing_cids: HashMap<(SmolStr, DbRkey), SmolStr> = HashMap::new(); -- 2.51.2