Skip to content

Commit d153fdc

Browse files
committed
add assert to remove handling noop primary response when 5.0 nodes are not supported
1 parent 8f325df commit d153fdc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.logging.log4j.message.ParameterizedMessage;
2424
import org.apache.logging.log4j.util.Supplier;
2525
import org.elasticsearch.ExceptionsHelper;
26+
import org.elasticsearch.Version;
2627
import org.elasticsearch.action.DocWriteRequest;
2728
import org.elasticsearch.action.DocWriteResponse;
2829
import org.elasticsearch.action.delete.DeleteRequest;
@@ -381,6 +382,13 @@ public enum ReplicaItemExecutionMode {
381382
FAILURE
382383
}
383384

385+
static {
386+
assert Version.CURRENT.minimumCompatibilityVersion().after(Version.V_5_0_0) == false:
387+
"Remove logic handling NoOp result from primary response; see TODO in replicaItemExecutionMode" +
388+
" as the current minimum compatible version [" +
389+
Version.CURRENT.minimumCompatibilityVersion() + "] is after 5.0";
390+
}
391+
384392
/**
385393
* Determines whether a bulk item request should be executed on the replica.
386394
* @return {@link ReplicaItemExecutionMode#NORMAL} upon normal primary execution with no failures
@@ -398,6 +406,8 @@ static ReplicaItemExecutionMode replicaItemExecutionMode(final BulkItemRequest r
398406
} else {
399407
// NOTE: write requests originating from pre-6.0 nodes can send a no-op operation to
400408
// the replica; we ignore replication
409+
// TODO: remove noOp result check from primary response, when pre-6.0 nodes are not supported
410+
// we should return ReplicationItemExecutionMode.NORMAL instead
401411
return primaryResponse.getResponse().getResult() != DocWriteResponse.Result.NOOP
402412
? ReplicaItemExecutionMode.NORMAL // execution successful on primary
403413
: ReplicaItemExecutionMode.NOOP; // ignore replication

0 commit comments

Comments
 (0)