Conversation
The receive() method was incrementing the local node's vector clock entry twice: once during merge() (which takes the max of both clocks) and again with an explicit increment(). This inflated the local node's clock value on every receive, breaking causal ordering guarantees. The standard HLC receive algorithm only merges clocks and updates logical_time — the local node's entry should not be incremented separately during receive. Fixes hetu-project#22
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.
Summary
Fixes #22
Problem
The
VLCSnapshot::receive()method incremented the local node's vector clock entry twice:merge()takes the component-wise max of both clocks (correct)vector_clock.increment(local_node_id)adds +1 on top of the merged value (incorrect)This inflated the local node's clock on every receive operation, breaking causal ordering. A node that received many events would have artificially high vector clock values, causing incorrect concurrency detection.
Standard HLC receive algorithm:
Fix
Removed the extra
self.vector_clock.increment(local_node_id)call fromreceive(). The local node's clock is already correct after merge — it only needs incrementing during localtick()operations.