-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Add contains method to LocalCheckpointTracker #33871
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
Conversation
This change adds "contains" method to LocalCheckpointTracker. One of the use cases is to check if a given operation has been processed in an engine or not by looking up its seq_no in LocalCheckpointTracker.
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.
LGTM
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.
I left a comment.
/** | ||
* Checks if the given sequence number was marked as completed in this tracker. | ||
*/ | ||
public synchronized boolean contains(long seqNo) { |
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.
I don't think we need to be fully synchronized here (and so can save ourselves from locking for the quick returns). I think that we only need to lock on this
on access to processedSeqNo
. I see that we have asserts that we have a lock on this
in getBitSetKey
and seqNoToBitSetOffset
but I think that neither of those are necessary.
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.
Good suggestion. I pushed d22f136.
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.
Looks good @dnhatn! Thanks.
Thanks @s1monw and @jasontedor. |
This change adds "contains" method to LocalCheckpointTracker. One of the use cases is to check if a given operation has been processed in an engine or not by looking up its seq_no in LocalCheckpointTracker. Relates #33656
It's possible for the set "seqNos" to contain only the "unFinishedSeq" in the testConcurrentReplica test. If this is the case, the call `randomValueOtherThan` won't make any progress because the predicate will never be false. This commit removes this expectation because it's incorrect and it's no longer needed as we have a dedicated test to verify the contains method. Relates #33871
It's possible for the set "seqNos" to contain only the "unFinishedSeq" in the testConcurrentReplica test. If this is the case, the call `randomValueOtherThan` won't make any progress because the predicate will never be false. This commit removes this expectation because it's incorrect and it's no longer needed as we have a dedicated test to verify the contains method. Relates #33871
This change adds "contains" method to LocalCheckpointTracker. One of the use cases is to check if a given operation has been processed in an engine or not by looking up its seq_no in LocalCheckpointTracker. Relates #33656
It's possible for the set "seqNos" to contain only the "unFinishedSeq" in the testConcurrentReplica test. If this is the case, the call `randomValueOtherThan` won't make any progress because the predicate will never be false. This commit removes this expectation because it's incorrect and it's no longer needed as we have a dedicated test to verify the contains method. Relates #33871
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains` without proper synchronization. Relates #33871
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains` without proper synchronization. Relates #33871
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains` without proper synchronization. Relates #33871
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains` without proper synchronization. Relates #33871
This change adds "contains" method to LocalCheckpointTracker.
One of the use cases is to check if a given operation has been processed
in an engine or not by looking up its seq_no in LocalCheckpointTracker.
Relates #33656