Skip to content

Commit 8f19392

Browse files
committed
lookup the existing term
1 parent 40fb87e commit 8f19392

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ private NoOpResult innerNoOp(final NoOp noOp) throws IOException {
14601460
* Executes a pre-flight check for a given NoOp.
14611461
* If this method returns a non-empty result, the engine won't process this NoOp and returns a failure.
14621462
*/
1463-
protected Optional<Exception> preFlightCheckForNoOp(final NoOp noOp) {
1463+
protected Optional<Exception> preFlightCheckForNoOp(final NoOp noOp) throws IOException {
14641464
return Optional.empty();
14651465
}
14661466

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ protected InternalEngine.DeletionStrategy deletionStrategyForOperation(final Del
112112
}
113113

114114
@Override
115-
protected Optional<Exception> preFlightCheckForNoOp(NoOp noOp) {
115+
protected Optional<Exception> preFlightCheckForNoOp(NoOp noOp) throws IOException {
116116
if (noOp.origin() == Operation.Origin.PRIMARY && hasBeenProcessedBefore(noOp)) {
117117
// See the comment in #indexingStrategyForOperation for the explanation why we can safely skip this operation.
118-
return Optional.of(new AlreadyProcessedFollowingEngineException(shardId, noOp.seqNo()));
118+
final OptionalLong existingTerm = lookupPrimaryTerm(noOp.seqNo());
119+
return Optional.of(new AlreadyProcessedFollowingEngineException(shardId, noOp.seqNo(), existingTerm));
119120
} else {
120121
return super.preFlightCheckForNoOp(noOp);
121122
}

0 commit comments

Comments
 (0)