fix(rust_brain): preserve HLC on snapshot restore, bulk_write, and gossip - #77
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(rust_brain): preserve HLC on snapshot restore, bulk_write, and gossip#77cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
…ssip restore_from_file() assigned fresh HLC timestamps instead of restoring the snapshot values added in v0.6.0. After disaster recovery, any write with a causally valid HLC was rejected with TimestampRegression — silent data loss in production restore/gossip paths. - Add _parse_hlc() for wire/snapshot normalization - Restore HLC and advance global clock on snapshot restore - Pass HLC through bulk_write rows - Apply HLC in gossip.receive() with stale-update rejection - Add regression tests in test_hlc_snapshot_gossip.py Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
restore_from_file(),bulk_write(), andgossip.receive()did not preserve Hybrid Logical Clock (HLC) timestamps introduced in v0.6.0. After disaster recovery from a snapshot, any write with a causally valid HLC was rejected withTimestampRegression— causing silent data loss in production restore and gossip paths.Concrete trigger: Snapshot a node with
hlc=(5000, 10, "nodeA"), restore, then attempt a legitimate update withhlc=(5000, 11, "nodeA"). Restore assigns a fresh wall-clock HLC, so the successor write is rejected.Root cause
v0.6.0 added HLC-based monotonic enforcement but
restore_from_file()createdMemoryNodewithout restoring thehlcfield (defaulting to_hlc.now()).bulk_write()andgossip.receive()also omitted HLC passthrough.Fix
_parse_hlc()for wire/snapshot normalization (with legacyts_nsfallback)bulk_write()rowsgossip.receive()with stale-update rejection and skip missing-HLC updates on existing keysValidation
test_hlc_snapshot_gossip.py,test_enterprise_backup.py,test_gossip.py,test_rust_brain.py,test_rust_brain_concurrency.py