diff --git a/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java b/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java index 1ecc1fd2c1955..ee5150c97fb4f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/SegmentReplicationPressureIT.java @@ -57,6 +57,7 @@ protected Collection> nodePlugins() { return asList(MockTransportService.TestPlugin.class); } + @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6671") public void testWritesRejected() throws Exception { final String primaryNode = internalCluster().startNode(); createIndex(INDEX_NAME); @@ -97,6 +98,7 @@ public void testWritesRejected() throws Exception { * This test ensures that a replica can be added while the index is under write block. * Ensuring that only write requests are blocked. */ + @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6671") public void testAddReplicaWhileWritesBlocked() throws Exception { final String primaryNode = internalCluster().startNode(); createIndex(INDEX_NAME); diff --git a/server/src/main/java/org/opensearch/indices/replication/OngoingSegmentReplications.java b/server/src/main/java/org/opensearch/indices/replication/OngoingSegmentReplications.java index 5a23bfff7c040..60078c082a7e3 100644 --- a/server/src/main/java/org/opensearch/indices/replication/OngoingSegmentReplications.java +++ b/server/src/main/java/org/opensearch/indices/replication/OngoingSegmentReplications.java @@ -41,6 +41,8 @@ * @opensearch.internal */ class OngoingSegmentReplications { + + private static final Logger logger = LogManager.getLogger(OngoingSegmentReplications.class); private final RecoverySettings recoverySettings; private final IndicesService indicesService; private final Map copyStateMap; @@ -95,8 +97,6 @@ synchronized CopyState getCachedCopyState(ReplicationCheckpoint checkpoint) thro } } - private static final Logger logger = LogManager.getLogger(OngoingSegmentReplications.class); - /** * Start sending files to the replica. * @@ -269,6 +269,9 @@ private void cancelHandlers(Predicate p .filter(predicate) .map(SegmentReplicationSourceHandler::getAllocationId) .collect(Collectors.toList()); + if (allocationIds.size() == 0) { + return; + } logger.warn(() -> new ParameterizedMessage("Cancelling replications for allocationIds {}", allocationIds)); for (String allocationId : allocationIds) { cancel(allocationId, reason);