diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconciler.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconciler.java index 129f1abdc1b36..8df50196c5d4b 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconciler.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconciler.java @@ -34,7 +34,7 @@ import java.util.Comparator; import java.util.Iterator; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import java.util.function.BiFunction; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -74,15 +74,15 @@ public class DesiredBalanceReconciler { /** * Number of unassigned shards during last reconciliation */ - protected final AtomicInteger unassignedShards = new AtomicInteger(); + protected final AtomicLong unassignedShards = new AtomicLong(); /** * Total number of assigned shards during last reconciliation */ - protected final AtomicInteger totalAllocations = new AtomicInteger(); + protected final AtomicLong totalAllocations = new AtomicLong(); /** * Number of assigned shards during last reconciliation that are not allocated on desired node and need to be moved */ - protected final AtomicInteger undesiredAllocations = new AtomicInteger(); + protected final AtomicLong undesiredAllocations = new AtomicLong(); public DesiredBalanceReconciler(ClusterSettings clusterSettings, ThreadPool threadPool) { this.undesiredAllocationLogInterval = new FrequencyCappedAction(threadPool); diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStats.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStats.java index 717e36c6367ef..6a08b896136d2 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStats.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStats.java @@ -31,9 +31,9 @@ public record DesiredBalanceStats( long computedShardMovements, long cumulativeComputationTime, long cumulativeReconciliationTime, - int unassignedShards, - int totalAllocations, - int undesiredAllocations + long unassignedShards, + long totalAllocations, + long undesiredAllocations ) implements Writeable, ToXContentObject { private static final TransportVersion COMPUTED_SHARD_MOVEMENTS_VERSION = TransportVersions.V_8_8_0; @@ -56,9 +56,9 @@ public static DesiredBalanceStats readFrom(StreamInput in) throws IOException { in.getTransportVersion().onOrAfter(COMPUTED_SHARD_MOVEMENTS_VERSION) ? in.readVLong() : -1, in.readVLong(), in.readVLong(), - in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVInt() : -1, - in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVInt() : -1, - in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVInt() : -1 + in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVLong() : -1, + in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVLong() : -1, + in.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS) ? in.readVLong() : -1 ); } @@ -76,9 +76,9 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVLong(cumulativeComputationTime); out.writeVLong(cumulativeReconciliationTime); if (out.getTransportVersion().onOrAfter(ADDITIONAL_DESIRED_BALANCE_RECONCILIATION_STATS)) { - out.writeVInt(unassignedShards); - out.writeVInt(totalAllocations); - out.writeVInt(undesiredAllocations); + out.writeVLong(unassignedShards); + out.writeVLong(totalAllocations); + out.writeVLong(undesiredAllocations); } } diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStatsTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStatsTests.java index 462abeef04ec3..d962472f23f95 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStatsTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceStatsTests.java @@ -37,9 +37,9 @@ public static DesiredBalanceStats randomDesiredBalanceStats() { randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong(), - randomNonNegativeInt(), - randomNonNegativeInt(), - randomNonNegativeInt() + randomNonNegativeLong(), + randomNonNegativeLong(), + randomNonNegativeLong() ); }