Repository navigation
fix(core): stage CarrierStore recovery accounting and reconcile partial/uncertain writes (#1203) - #1240
fix(core): stage CarrierStore recovery accounting and reconcile partial/uncertain writes (#1203)#1240RyanKung wants to merge 2 commits into
Conversation
|
Reviewed commit: Verdict: one confirmed P2 finding needs correction. [P2] Fence detached backend writes before publishing recovered accounting. Dropping Please retain completion/reconciliation ownership beyond caller cancellation, or establish a backend ordering barrier so recovery cannot overtake submitted writes. Setting a dirty flag only when the awaiter drops is insufficient. Reproduction: a review-only regression, Other reviewed dimensions:
Validation: all 10 existing |
Summary
Closes #1203 (including consolidated #1205 items 3, 4, 5).
CarrierStore::ensure_recovered([P2] CarrierStore recovery & partial-commit accounting: prevent retry double-charge, reconcile uncertain commits, and normalize partial writes (#1203, #1205) #1203, Pre-1.0 hardening: effect boundaries, async progress, and ownership duplication #1205 item 3):SlotAccountingin a private staging instance (recover_locked) while scanningremovals.get_all()and normalizingelements, publishing*index.accounting.lock() = rebuilttogether withindex.recovered.store(true, Ordering::Release)only after the entire recovery pass completes.UnfinishedRemovalWrite/UnfinishedRemovalDelete). Whenremovals.put/removals.removeerrors, reads backremovals.get(key)to reconcileindex.accountingagainst the actual stored record; if read-back fails or the future is cancelled mid-await, reverts optimistic deltas and marksindex.recovered = falsefor full reconciliation on the next operation.DirtyElements+ElementSyncGuardonRemovalIndexsoCarrierStore::getandget_allbypass fastgluefor dirty keys, performing a full normalizingEntry::join(E_old ⊔ R_new) so tombstoned or register-floored elements are never served without a restart, and opportunistically repairingelementsonce idle.dots/co_dotsclone inelement_side.Test Plan
cargo test -p rings-core --lib dht::storage::tests(93 passed)cargo clippy -p rings-core --all-targets -- -D warningscargo check -p rings-core --lib --target wasm32-unknown-unknown --no-default-features --features wasm