Skip to content

Commit 0f4492b

Browse files
committed
Restore advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary
1 parent 81873b5 commit 0f4492b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

server/src/main/java/org/elasticsearch/index/engine/InternalEngine.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,10 @@ protected long generateSeqNoForOperationOnPrimary(final Operation operation) {
808808
return doGenerateSeqNoForOperation(operation);
809809
}
810810

811+
protected void advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(long seqNo) {
812+
advanceMaxSeqNoOfUpdatesOrDeletes(seqNo);
813+
}
814+
811815
/**
812816
* Generate the sequence number for the specified operation.
813817
*
@@ -873,7 +877,7 @@ public IndexResult index(Index index) throws IOException {
873877

874878
final boolean toAppend = plan.indexIntoLucene && plan.useLuceneUpdateDocument == false;
875879
if (toAppend == false) {
876-
advanceMaxSeqNoOfUpdatesOrDeletes(index.seqNo());
880+
advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(index.seqNo());
877881
}
878882
} else {
879883
markSeqNoAsSeen(index.seqNo());
@@ -1242,7 +1246,7 @@ public DeleteResult delete(Delete delete) throws IOException {
12421246
delete.primaryTerm(), delete.version(), delete.versionType(), delete.origin(), delete.startTime(),
12431247
delete.getIfSeqNo(), delete.getIfPrimaryTerm());
12441248

1245-
advanceMaxSeqNoOfUpdatesOrDeletes(delete.seqNo());
1249+
advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(delete.seqNo());
12461250
} else {
12471251
markSeqNoAsSeen(delete.seqNo());
12481252
}

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/index/engine/FollowingEngine.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ protected long generateSeqNoForOperationOnPrimary(final Operation operation) {
131131
return operation.seqNo();
132132
}
133133

134+
@Override
135+
protected void advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(long seqNo) {
136+
assert getMaxSeqNoOfUpdatesOrDeletes() >= seqNo : seqNo + " < " + getMaxSeqNoOfUpdatesOrDeletes();
137+
super.advanceMaxSeqNoOfUpdatesOrDeletesOnPrimary(seqNo); // extra safe in production code
138+
}
139+
134140
@Override
135141
public int fillSeqNoGaps(long primaryTerm) throws IOException {
136142
// a noop implementation, because follow shard does not own the history but the leader shard does.

0 commit comments

Comments
 (0)