fix(rust_brain): preserve HLC on snapshot restore and gossip receive#33
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(rust_brain): preserve HLC on snapshot restore and gossip receive#33cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
restore_from_file() dropped hlc fields from snapshots, assigning fresh timestamps that rejected legitimate causal writes (TimestampRegression) after disaster recovery. gossip.receive() also ignored incoming HLC, allowing stale overwrites or silent update skips. - Add _parse_hlc() for snapshot/wire normalisation - Restore HLC and update process clock on snapshot restore - Pass hlc through bulk_write and gossip receive with stale rejection 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
After snapshot restore or cross-node gossip, Hybrid Logical Clock (HLC) timestamps were not preserved. Restored nodes received fresh HLC values, causing legitimate causal writes to raise
TimestampRegression— silent data loss after disaster recovery. Gossip without HLC could overwrite fresher local data.Root cause
restore_from_file()reconstructedMemoryNodewithout thehlcfield (defaulting to a new clock).bulk_write()andgossip.receive()also ignored incoming HLC metadata.Fix
_parse_hlc()to normalise HLC from snapshot/wire format_hlc.update()bulk_write()andgossip.receive()with stale-update rejectionValidation
TimestampRegressionpytest tests/test_enterprise_backup.py tests/test_gossip.py tests/test_rust_brain.py— 28 passed