2323import org .apache .logging .log4j .message .ParameterizedMessage ;
2424import org .apache .logging .log4j .util .Supplier ;
2525import org .elasticsearch .ExceptionsHelper ;
26+ import org .elasticsearch .Version ;
2627import org .elasticsearch .action .DocWriteRequest ;
2728import org .elasticsearch .action .DocWriteResponse ;
2829import 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