@@ -281,7 +281,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
281281 assertTrue (index1RoutingTable .primaryShard ().unassigned ());
282282 assertTrue (index1RoutingTable .replicaShards ().stream ().allMatch (ShardRouting ::unassigned ));
283283 assertNotNull (allocationStats .get ());
284- assertEquals (new DesiredBalanceMetrics .AllocationStats (3 , 1 , 0 , Map . of () ), allocationStats .get ());
284+ assertEquals (new DesiredBalanceMetrics .AllocationStats (3 , 1 , 0 ), allocationStats .get ());
285285 }
286286
287287 // now relax the filter so that the replica of index-0 and the primary of index-1 can both be assigned to node-1, but the throttle
@@ -296,7 +296,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
296296 assertTrue (index1RoutingTable .primaryShard ().initializing ());
297297 assertTrue (index1RoutingTable .replicaShards ().stream ().allMatch (ShardRouting ::unassigned ));
298298 assertNotNull (allocationStats .get ());
299- assertEquals (new DesiredBalanceMetrics .AllocationStats (2 , 2 , 0 , Map . of () ), allocationStats .get ());
299+ assertEquals (new DesiredBalanceMetrics .AllocationStats (2 , 2 , 0 ), allocationStats .get ());
300300 }
301301
302302 final var stateWithStartedPrimariesAndInitializingReplica = startInitializingShardsAndReroute (
@@ -313,7 +313,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, Routing
313313 assertTrue (index1RoutingTable .primaryShard ().started ());
314314 assertTrue (index1RoutingTable .replicaShards ().stream ().allMatch (ShardRouting ::unassigned ));
315315 assertNotNull (allocationStats .get ());
316- assertEquals (new DesiredBalanceMetrics .AllocationStats (1 , 3 , 0 , Map . of () ), allocationStats .get ());
316+ assertEquals (new DesiredBalanceMetrics .AllocationStats (1 , 3 , 0 ), allocationStats .get ());
317317 }
318318 }
319319
@@ -910,7 +910,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
910910 assertThat (shardRouting .currentNodeId (), oneOf ("node-0" , "node-1" ));
911911 }
912912 assertNotNull (allocationStats );
913- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 , Map . of () ), allocationStats .get ());
913+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 ), allocationStats .get ());
914914
915915 // Only allow allocation on two of the nodes, excluding the other two nodes.
916916 clusterSettings .applySettings (
@@ -926,7 +926,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
926926 assertSame (clusterState , allocationService .reroute (clusterState , "test" , ActionListener .noop ())); // all still on desired nodes, no
927927 // movement needed
928928 assertNotNull (allocationStats );
929- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 , Map . of () ), allocationStats .get ());
929+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 ), allocationStats .get ());
930930
931931 desiredBalance .set (desiredBalance (clusterState , (shardId , nodeId ) -> nodeId .equals ("node-2" ) || nodeId .equals ("node-3" )));
932932
@@ -937,12 +937,12 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
937937 assertThat (reroutedState .getRoutingNodes ().node ("node-1" ).numberOfShardsWithState (ShardRoutingState .RELOCATING ), equalTo (1 ));
938938 assertNotNull (allocationStats );
939939 // Total allocations counts relocating and intializing shards, so the two relocating shards will be counted twice.
940- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 8 , 4 , Map . of ( ShardRouting . Role . DEFAULT , 4L ) ), allocationStats .get ());
940+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 8 , 4 ), allocationStats .get ());
941941
942942 // Ensuring that we check the shortcut two-param canAllocate() method up front
943943 canAllocateRef .set (Decision .NO );
944944 assertSame (clusterState , allocationService .reroute (clusterState , "test" , ActionListener .noop ()));
945- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 6 , Map . of ( ShardRouting . Role . DEFAULT , 6L ) ), allocationStats .get ());
945+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 6 ), allocationStats .get ());
946946 canAllocateRef .set (Decision .YES );
947947
948948 // Restore filter to default
@@ -980,7 +980,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
980980 "test" ,
981981 ActionListener .noop ()
982982 );
983- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 7 , 3 , Map . of ( ShardRouting . Role . DEFAULT , 3L ) ), allocationStats .get ());
983+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 7 , 3 ), allocationStats .get ());
984984
985985 assertThat (shuttingDownState .getRoutingNodes ().node ("node-2" ).numberOfShardsWithState (ShardRoutingState .INITIALIZING ), equalTo (1 ));
986986 }
@@ -1048,7 +1048,7 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
10481048
10491049 // All still on desired nodes, no movement needed, cluster state remains the same.
10501050 assertSame (clusterState , allocationService .reroute (clusterState , "test" , ActionListener .noop ()));
1051- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 , Map . of () ), allocationStats .get ());
1051+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 0 ), allocationStats .get ());
10521052
10531053 desiredBalance .set (desiredBalance (clusterState , (shardId , nodeId ) -> nodeId .equals ("node-2" ) || nodeId .equals ("node-3" )));
10541054
@@ -1076,15 +1076,15 @@ public Decision canAllocate(ShardRouting shardRouting, RoutingAllocation allocat
10761076 assertThat (reroutedState .getRoutingNodes ().node ("node-0" ).numberOfShardsWithState (ShardRoutingState .RELOCATING ), equalTo (1 ));
10771077 assertThat (reroutedState .getRoutingNodes ().node ("node-1" ).numberOfShardsWithState (ShardRoutingState .RELOCATING ), equalTo (1 ));
10781078 assertNotNull (allocationStats .get ());
1079- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 6 , Map . of ( ShardRouting . Role . DEFAULT , 6L ) ), allocationStats .get ());
1079+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 6 , 6 ), allocationStats .get ());
10801080
10811081 // Test that the AllocationStats are still updated, even though throttling is active. The cluster state should remain unchanged
10821082 // because due to throttling: the previous reroute request started relocating two shards and, since those reallocations have not
10831083 // been completed, no additional shard relocations can begin.
10841084 assertSame (reroutedState , allocationService .reroute (reroutedState , "test" , ActionListener .noop ()));
10851085 assertNotNull (allocationStats );
10861086 // Note: total allocations counts relocating and intializing shards, so the two relocating shards will be counted twice.
1087- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 8 , 4 , Map . of ( ShardRouting . Role . DEFAULT , 4L ) ), allocationStats .get ());
1087+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , 8 , 4 ), allocationStats .get ());
10881088 }
10891089
10901090 public void testDoNotRebalanceToTheNodeThatNoLongerExists () {
@@ -1293,7 +1293,7 @@ public void testRebalanceDoesNotCauseHotSpots() {
12931293
12941294 var initializing = shardsWithState (allocation .routingNodes (), ShardRoutingState .INITIALIZING );
12951295 if (initializing .isEmpty ()) {
1296- assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , shardsPerNode * numberOfNodes , 0 , Map . of () ), allocationStats );
1296+ assertEquals (new DesiredBalanceMetrics .AllocationStats (0 , shardsPerNode * numberOfNodes , 0 ), allocationStats );
12971297 break ;
12981298 }
12991299
0 commit comments