-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
CCR: Following primary should process NoOps once #34408
Conversation
This is a follow-up for elastic#34288 (comment). Relates elastic#34288
Pinging @elastic/es-distributed |
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.
@@ -2338,7 +2358,7 @@ public void waitForOpsToComplete(long seqNo) throws InterruptedException { | |||
*/ | |||
protected final boolean hasBeenProcessedBefore(Operation op) { | |||
assert op.seqNo() != SequenceNumbers.UNASSIGNED_SEQ_NO : "operation is not assigned seq_no"; | |||
assert versionMap.assertKeyedLockHeldByCurrentThread(op.uid().bytes()); | |||
assert noOpKeyedLock.isHeldByCurrentThread(op.seqNo()) || versionMap.assertKeyedLockHeldByCurrentThread(op.uid().bytes()); |
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.
can we condition this on the op type?
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.
++
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 pushed 1df9b22
protected Optional<Exception> preFlightCheckForNoOp(NoOp noOp) { | ||
if (noOp.origin() == Operation.Origin.PRIMARY && hasBeenProcessedBefore(noOp)) { | ||
// See the comment in #indexingStrategyForOperation for the explanation why we can safely skip this operation. | ||
return Optional.of(new AlreadyProcessedFollowingEngineException(shardId, noOp.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.
Note that this will require changing the other PR to accept no opes with seq > gcp having no term and replicating them with current term.
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.
Yes, will do.
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 pushed 8f19392
protected Optional<Exception> preFlightCheckForNoOp(NoOp noOp) throws IOException { | ||
if (noOp.origin() == Operation.Origin.PRIMARY && hasBeenProcessedBefore(noOp)) { | ||
// See the comment in #indexingStrategyForOperation for the explanation why we can safely skip this operation. | ||
final OptionalLong existingTerm = lookupPrimaryTerm(noOp.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.
random thought - I wonder if we should load the operation under assertion code and check it's the same (this goes for all duplicate ops).
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.
Do you mean the existing operation should equal the processing operation except for the primary term?
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.
yes
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'll make it in a follow-up after this PR.
Clear the injected exception after the indexing
Thanks @bleskes. |
This is a follow-up for #34288 (comment).
Relates #34288