From 5c30a74456e6743282f3af98ef950964ddc64f19 Mon Sep 17 00:00:00 2001 From: ludongyu Date: Thu, 21 Mar 2024 14:26:35 +0800 Subject: [PATCH] fix format by spotless Signed-off-by: ludongyu --- .../decider/NodeVersionAllocationDecider.java | 4 +-- .../NodeVersionAllocationDeciderTests.java | 30 ++++++++----------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/server/src/main/java/org/opensearch/cluster/routing/allocation/decider/NodeVersionAllocationDecider.java b/server/src/main/java/org/opensearch/cluster/routing/allocation/decider/NodeVersionAllocationDecider.java index 50f09d8200218..b4df80ac7b3f4 100644 --- a/server/src/main/java/org/opensearch/cluster/routing/allocation/decider/NodeVersionAllocationDecider.java +++ b/server/src/main/java/org/opensearch/cluster/routing/allocation/decider/NodeVersionAllocationDecider.java @@ -39,7 +39,6 @@ import org.opensearch.cluster.routing.RoutingNodes; import org.opensearch.cluster.routing.ShardRouting; import org.opensearch.cluster.routing.allocation.RoutingAllocation; -import org.opensearch.common.settings.Settings; import org.opensearch.indices.replication.common.ReplicationType; import java.util.List; @@ -58,8 +57,7 @@ public class NodeVersionAllocationDecider extends AllocationDecider { public static final String NAME = "node_version"; - public NodeVersionAllocationDecider() { - } + public NodeVersionAllocationDecider() {} @Override public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) { diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 6729070de6cd0..f6648eccb4d02 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -441,9 +441,7 @@ public void testRebalanceDoesNotAllocatePrimaryAndReplicasOnDifferentVersionNode .routingTable(routingTable) .nodes(DiscoveryNodes.builder().add(newNode).add(oldNode1).add(oldNode2)) .build(); - AllocationDeciders allocationDeciders = new AllocationDeciders( - Collections.singleton(new NodeVersionAllocationDecider()) - ); + AllocationDeciders allocationDeciders = new AllocationDeciders(Collections.singleton(new NodeVersionAllocationDecider())); AllocationService strategy = new MockAllocationService( allocationDeciders, new TestGatewayAllocator(), @@ -648,9 +646,7 @@ public void testRebalanceDoesNotAllocatePrimaryOnHigherVersionNodesSegrepEnabled .routingTable(routingTable) .nodes(DiscoveryNodes.builder().add(newNode1).add(newNode2).add(oldNode1).add(oldNode2)) .build(); - AllocationDeciders allocationDeciders = new AllocationDeciders( - Collections.singleton(new NodeVersionAllocationDecider()) - ); + AllocationDeciders allocationDeciders = new AllocationDeciders(Collections.singleton(new NodeVersionAllocationDecider())); AllocationService strategy = new MockAllocationService( allocationDeciders, new TestGatewayAllocator(), @@ -715,16 +711,16 @@ public void testCanAllocatePrimaryOnHigherVersionNodesDocRepEnabled() { IndexRoutingTable.builder(shard1.getIndex()) .addIndexShard( new IndexShardRoutingTable.Builder(shard1).addShard( - TestShardRouting.newShardRouting( - shard1.getIndexName(), - shard1.getId(), - oldNode1.getId(), - null, - true, - ShardRoutingState.STARTED, - allocationId1P - ) + TestShardRouting.newShardRouting( + shard1.getIndexName(), + shard1.getId(), + oldNode1.getId(), + null, + true, + ShardRoutingState.STARTED, + allocationId1P ) + ) .addShard( TestShardRouting.newShardRouting( shard1.getIndexName(), @@ -745,9 +741,7 @@ public void testCanAllocatePrimaryOnHigherVersionNodesDocRepEnabled() { .routingTable(routingTable) .nodes(DiscoveryNodes.builder().add(newNode1).add(oldNode1).add(oldNode2)) .build(); - AllocationDeciders allocationDeciders = new AllocationDeciders( - Collections.singleton(new NodeVersionAllocationDecider()) - ); + AllocationDeciders allocationDeciders = new AllocationDeciders(Collections.singleton(new NodeVersionAllocationDecider())); AllocationService strategy = new MockAllocationService( allocationDeciders, new TestGatewayAllocator(),