Skip to content

Commit

Permalink
convert measurements to long (so that they are better compatible with…
Browse files Browse the repository at this point in the history
… a future

apm integration)
  • Loading branch information
idegtiarenko committed Nov 15, 2023
1 parent e25689b commit 401a8ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
);
}

Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static DesiredBalanceStats randomDesiredBalanceStats() {
randomNonNegativeLong(),
randomNonNegativeLong(),
randomNonNegativeLong(),
randomNonNegativeInt(),
randomNonNegativeInt(),
randomNonNegativeInt()
randomNonNegativeLong(),
randomNonNegativeLong(),
randomNonNegativeLong()
);
}

Expand Down

0 comments on commit 401a8ea

Please sign in to comment.