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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing version vector to solve GC problem #899
Introducing version vector to solve GC problem #899
Changes from all commits
e0988d0
9580b97
dee2778
f6177d2
df82b83
0dd1ece
11d4848
313a81c
cadecd8
f4e3431
3e3afe7
557702e
6f383e6
13f528b
0c6a7db
f4f7ff4
40d5792
cae3f9c
ee8e411
e3b438e
6f14089
95e5cac
047510f
95e8871
9f670ad
6e98529
6e7e344
6376dbf
06569de
73aad7b
4dc3e1c
3aff0b5
43b2f6b
7e39737
3528aa0
e5321c4
6d5ece1
c4dea81
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid Unnecessary Non-Null Assertion Operator in
hexToVersionVector
In the function
hexToVersionVector
, the non-null assertion operator!
is used infromVersionVector(pbVersionVector)!
. SincefromVersionVector
can returnundefined
, using!
here could result in a runtime error iffromVersionVector
returnsundefined
. It's advisable to handle the potentialundefined
value or adjustfromVersionVector
to guarantee a validVersionVector
is returned.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct lamport calculation in
syncClocks
methodIn the
syncClocks
method, the lamport clock calculation might introduce an off-by-one error:According to Lamport clock synchronization rules, the new lamport should be
max(this.lamport, other.lamport) + 1n
. The current implementation adds1n
to the larger lamport value, potentially leading to an incorrect increment whenother.lamport
is greater. Consider revising the calculation:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust lamport calculation in
setClocks
methodIn the
setClocks
method, the lamport clock calculation may not increment correctly:To adhere to Lamport clock rules, the lamport should be set to
max(this.lamport, otherLamport) + 1n
. This ensures the clock advances properly regardless of which lamport is greater. Consider updating the calculation: