From eeb31d16d04589ac09e58ecc0932512dd8c710c1 Mon Sep 17 00:00:00 2001 From: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:09:56 +0530 Subject: [PATCH] Removing unintended changes Signed-off-by: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com> --- .../ReplicationModeAwareProxy.java | 1 + .../cluster/routing/ShardRouting.java | 1 - .../index/seqno/ReplicationTracker.java | 4 +-- .../ReplicationOperationTests.java | 26 ++++++++++--------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/support/replication/ReplicationModeAwareProxy.java b/server/src/main/java/org/opensearch/action/support/replication/ReplicationModeAwareProxy.java index bd7eb90c5dbb0..83003d0cd931d 100644 --- a/server/src/main/java/org/opensearch/action/support/replication/ReplicationModeAwareProxy.java +++ b/server/src/main/java/org/opensearch/action/support/replication/ReplicationModeAwareProxy.java @@ -53,6 +53,7 @@ protected void performOnReplicaProxy( BiConsumer>, ReplicationProxyRequest> performOnReplicaConsumer ) { assert replicationMode == ReplicationMode.FULL_REPLICATION || replicationMode == ReplicationMode.PRIMARY_TERM_VALIDATION; + Consumer> replicasProxyConsumer; if (replicationMode == ReplicationMode.FULL_REPLICATION) { replicasProxyConsumer = getReplicasProxyConsumer(fullReplicationProxy, proxyRequest); diff --git a/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java b/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java index 743b0128fbc16..45de045a8fc69 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java +++ b/server/src/main/java/org/opensearch/cluster/routing/ShardRouting.java @@ -878,5 +878,4 @@ public boolean unassignedReasonIndexCreated() { } return false; } - } diff --git a/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java b/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java index 330e8b4cb4261..3bbf37917cf7a 100644 --- a/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java +++ b/server/src/main/java/org/opensearch/index/seqno/ReplicationTracker.java @@ -1002,7 +1002,7 @@ public ReplicationTracker( final LongSupplier currentTimeMillisSupplier, final BiConsumer> onSyncRetentionLeases, final Supplier safeCommitInfoSupplier, - final Function checkForRemoteDiscoveryNode + final Function isShardOnRemoteEnabledNode ) { this( shardId, @@ -1015,7 +1015,7 @@ public ReplicationTracker( onSyncRetentionLeases, safeCommitInfoSupplier, x -> {}, - checkForRemoteDiscoveryNode + isShardOnRemoteEnabledNode ); } diff --git a/server/src/test/java/org/opensearch/action/support/replication/ReplicationOperationTests.java b/server/src/test/java/org/opensearch/action/support/replication/ReplicationOperationTests.java index 28be9507e70bd..4b54e05c5c859 100644 --- a/server/src/test/java/org/opensearch/action/support/replication/ReplicationOperationTests.java +++ b/server/src/test/java/org/opensearch/action/support/replication/ReplicationOperationTests.java @@ -210,12 +210,14 @@ public void testReplicationWithRemoteTranslogEnabled() throws Exception { ShardRoutingState.STARTED, primaryId ); - initializingIds.forEach(aId -> { - builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.INITIALIZING, aId)); - }); - activeIds.stream().filter(aId -> !aId.equals(primaryId)).forEach(aId -> { - builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.INITIALIZING, aId)); - }); + initializingIds.forEach( + aId -> builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.INITIALIZING, aId)) + ); + activeIds.stream() + .filter(aId -> !aId.equals(primaryId)) + .forEach( + aId -> builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.STARTED, aId)) + ); builder.addShard(primaryShard); IndexShardRoutingTable routingTable = builder.build(); @@ -276,12 +278,12 @@ public void testPrimaryToPrimaryReplicationWithRemoteTranslogEnabled() throws Ex ShardRoutingState.RELOCATING, primaryId ); - initializingIds.forEach(aId -> { - builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.INITIALIZING, aId)); - }); - activeIds.forEach(aId -> { - builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.STARTED, aId)); - }); + initializingIds.forEach( + aId -> builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.INITIALIZING, aId)) + ); + activeIds.forEach( + aId -> builder.addShard(newShardRouting(shardId, nodeIdFromAllocationId(aId), null, false, ShardRoutingState.STARTED, aId)) + ); builder.addShard(primaryShard); IndexShardRoutingTable routingTable = builder.build();