diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java index ee1826859da16..5ab1fc79fa68a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/replication/SegmentReplicationIT.java @@ -230,7 +230,10 @@ public void testAddNewReplicaFailure() throws Exception { final String replicaNode = internalCluster().startNode(); // Mock transport service to add behaviour of throwing corruption exception during segment replication process. - MockTransportService mockTransportService = ((MockTransportService) internalCluster().getInstance(TransportService.class, primaryNode)); + MockTransportService mockTransportService = ((MockTransportService) internalCluster().getInstance( + TransportService.class, + primaryNode + )); mockTransportService.addSendBehavior( internalCluster().getInstance(TransportService.class, replicaNode), (connection, requestId, action, request, options) -> { diff --git a/server/src/main/java/org/opensearch/indices/cluster/IndicesClusterStateService.java b/server/src/main/java/org/opensearch/indices/cluster/IndicesClusterStateService.java index 180032bfb621f..45c7824c04b6c 100644 --- a/server/src/main/java/org/opensearch/indices/cluster/IndicesClusterStateService.java +++ b/server/src/main/java/org/opensearch/indices/cluster/IndicesClusterStateService.java @@ -782,9 +782,10 @@ public synchronized void handleRecoveryFailure(ShardRouting shardRouting, boolea public void handleRecoveryDone(ReplicationState state, ShardRouting shardRouting, long primaryTerm) { RecoveryState recoveryState = (RecoveryState) state; AllocatedIndex indexService = indicesService.indexService(shardRouting.shardId().getIndex()); - if(indexService.getIndexSettings().isSegRepEnabled()){ + if (indexService.getIndexSettings().isSegRepEnabled()) { IndexShard indexShard = (IndexShard) indexService.getShardOrNull(shardRouting.id()); - // For Segment Replication enabled indices, we want replica shards to start a replication event to fetch latest segments before it + // For Segment Replication enabled indices, we want replica shards to start a replication event to fetch latest segments before + // it // is marked as Started. if (indexShard != null && shardRouting.primary() == false @@ -835,11 +836,20 @@ public void onReplicationFailure( } ); } else { - shardStateAction.shardStarted(shardRouting, primaryTerm, "after " + recoveryState.getRecoverySource(), SHARD_STATE_ACTION_LISTENER); + shardStateAction.shardStarted( + shardRouting, + primaryTerm, + "after " + recoveryState.getRecoverySource(), + SHARD_STATE_ACTION_LISTENER + ); } - } - else{ - shardStateAction.shardStarted(shardRouting, primaryTerm, "after " + recoveryState.getRecoverySource(), SHARD_STATE_ACTION_LISTENER); + } else { + shardStateAction.shardStarted( + shardRouting, + primaryTerm, + "after " + recoveryState.getRecoverySource(), + SHARD_STATE_ACTION_LISTENER + ); } }