-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Fix FollowingEngineTests#testOptimizeMultipleVersions #75583
Changes from 3 commits
b50bc3d
42a4c2d
b583c5b
ed4451d
8540ae1
2a3af97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ | |
/** | ||
* An engine implementation for following shards. | ||
*/ | ||
public final class FollowingEngine extends InternalEngine { | ||
public class FollowingEngine extends InternalEngine { | ||
|
||
|
||
/** | ||
|
@@ -118,14 +118,27 @@ protected long generateSeqNoForOperationOnPrimary(final Operation operation) { | |
} | ||
|
||
@Override | ||
protected void advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(long seqNo) { | ||
protected void advanceMaxSeqNoOfDeleteOnPrimary(long seqNo) { | ||
if (Assertions.ENABLED) { | ||
fcofdez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
final long localCheckpoint = getProcessedLocalCheckpoint(); | ||
final long maxSeqNoOfUpdates = getMaxSeqNoOfUpdatesOrDeletes(); | ||
assert localCheckpoint < maxSeqNoOfUpdates || maxSeqNoOfUpdates >= seqNo : | ||
"maxSeqNoOfUpdates is not advanced local_checkpoint=" + localCheckpoint + " msu=" + maxSeqNoOfUpdates + " seq_no=" + seqNo; | ||
} | ||
super.advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(seqNo); // extra safe in production code | ||
|
||
super.advanceMaxSeqNoOfDeleteOnPrimary(seqNo); | ||
} | ||
|
||
@Override | ||
protected void advanceMaxSeqNoOfUpdateOnPrimary(long seqNo) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also plural here for consistency. |
||
// In some scenarios it is possible to advance maxSeqNoOfUpdatesOrDeletes over the leader | ||
// maxSeqNoOfUpdatesOrDeletes, since in this engine (effectively it is a replica) we don't check if the previous version | ||
// was a delete and it's possible to consider it as an update, advancing the max sequence number over the leader | ||
// maxSeqNoOfUpdatesOrDeletes. | ||
// The goal of this marker it's just an optimization and it won't affect the correctness or durability of the indexed documents. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A wrong number could lead to incorrect behavior so I suggest to rephrase this to something like: |
||
|
||
// See FollowingEngineTests#testConcurrentUpdateOperationsWithDeletesCanAdvanceMaxSeqNoOfUpdates or #72527 for more details. | ||
super.advanceMaxSeqNoOfUpdateOnPrimary(seqNo); | ||
} | ||
|
||
@Override | ||
|
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 think we should keep this in plural, i.e., advanceMaxSeqNoOfDeletesOnPrimary