fix(rust_brain): preserve HLC on snapshot restore and gossip replay - #59
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(rust_brain): preserve HLC on snapshot restore and gossip replay#59cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
restore_from_file() dropped Hybrid Logical Clock timestamps from snapshots, assigning fresh wall-clock HLCs instead. After disaster recovery, causal successor writes and gossip replays with pre-crash HLCs were rejected or mis-ordered, causing silent data loss in distributed deployments. - Add _parse_hlc() for snapshot/wire normalisation with legacy fallback - restore_from_file: restore node HLC and advance global clock via _hlc.update() - bulk_write: pass through hlc from row payloads - gossip.receive: apply remote HLC, reject stale overwrites, skip HLC-less updates on existing keys - Tests lock in snapshot round-trip and gossip causal ordering 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()dropped Hybrid Logical Clock (HLC) timestamps from snapshots, assigning fresh wall-clock HLCs instead. After disaster recovery:TimestampRegression)bulk_writereplay ignored HLC fields entirelyThis caused silent data loss in distributed deployments that rely on snapshot restore + gossip replication.
Root cause
HLC was added in v0.6.0 for causal ordering, but
restore_from_file(),bulk_write(), andgossip.receive()were never updated to preserve/apply HLC timestamps from snapshot and wire payloads.Fix
_parse_hlc()for snapshot/wire normalisation with legacyts_nsfallbackrestore_from_file: restore node HLC and advance global clock via_hlc.update()under lockbulk_write: pass throughhlcfrom row payloadsgossip.receive: apply remote HLC, reject stale overwrites, skip HLC-less updates on existing keysValidation
test_restore_preserves_hlc_for_replicationand gossip HLC ordering tests