Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented Sep 19, 2018

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

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.
@dnhatn dnhatn added >enhancement v7.0.0 :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. v6.5.0 labels Sep 19, 2018
@dnhatn dnhatn requested review from jasontedor and s1monw September 19, 2018 18:50
Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jasontedor jasontedor left a 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) {
Copy link
Member

@jasontedor jasontedor Sep 19, 2018

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.

Copy link
Member Author

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.

@dnhatn dnhatn requested a review from jasontedor September 19, 2018 20:53
Copy link
Member

@jasontedor jasontedor left a 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.

@dnhatn
Copy link
Member Author

dnhatn commented Sep 20, 2018

Thanks @s1monw and @jasontedor.

@dnhatn dnhatn merged commit 05bf9dc into elastic:master Sep 20, 2018
@dnhatn dnhatn deleted the add-contains branch September 20, 2018 00:29
dnhatn added a commit that referenced this pull request Sep 20, 2018
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
dnhatn added a commit that referenced this pull request Sep 20, 2018
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
dnhatn added a commit that referenced this pull request Sep 20, 2018
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
kcm pushed a commit that referenced this pull request Oct 30, 2018
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
kcm pushed a commit that referenced this pull request Oct 30, 2018
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
dnhatn added a commit that referenced this pull request Feb 12, 2019
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains`
without proper synchronization.

Relates #33871
dnhatn added a commit that referenced this pull request Feb 12, 2019
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains`
without proper synchronization.

Relates #33871
dnhatn added a commit that referenced this pull request Feb 12, 2019
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains`
without proper synchronization.

Relates #33871
dnhatn added a commit that referenced this pull request Feb 12, 2019
We are accessing the `CountedBitSet` in `LocalCheckpointTracker#contains`
without proper synchronization.

Relates #33871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >enhancement v6.5.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants