Fix relocating shards size calculation (#48421)
In #48392 we added a second computation of the sizes of the relocating shards in `canRemain()` but passed the wrong value for `subtractLeavingShards`. This fixes that. It also removes some unnecessary logging in a test case added in the same commit.
This commit is contained in:
parent
dc5c31d67a
commit
50518359fe
|
@ -317,7 +317,7 @@ public class DiskThresholdDecider extends AllocationDecider {
|
||||||
"this shard is not allocated on the most utilized disk and can remain");
|
"this shard is not allocated on the most utilized disk and can remain");
|
||||||
}
|
}
|
||||||
if (freeBytes < 0L) {
|
if (freeBytes < 0L) {
|
||||||
final long sizeOfRelocatingShards = sizeOfRelocatingShards(node, false, usage.getPath(),
|
final long sizeOfRelocatingShards = sizeOfRelocatingShards(node, true, usage.getPath(),
|
||||||
allocation.clusterInfo(), allocation.metaData(), allocation.routingTable());
|
allocation.clusterInfo(), allocation.metaData(), allocation.routingTable());
|
||||||
logger.debug("fewer free bytes remaining than the size of all incoming shards: " +
|
logger.debug("fewer free bytes remaining than the size of all incoming shards: " +
|
||||||
"usage {} on node {} including {} bytes of relocations, shard cannot remain",
|
"usage {} on node {} including {} bytes of relocations, shard cannot remain",
|
||||||
|
|
|
@ -754,17 +754,13 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
|
||||||
AllocationCommand moveAllocationCommand = new MoveAllocationCommand("test2", 0, "node2", "node3");
|
AllocationCommand moveAllocationCommand = new MoveAllocationCommand("test2", 0, "node2", "node3");
|
||||||
AllocationCommands cmds = new AllocationCommands(moveAllocationCommand);
|
AllocationCommands cmds = new AllocationCommands(moveAllocationCommand);
|
||||||
|
|
||||||
logger.info("--> before starting: {}", clusterState);
|
|
||||||
clusterState = startInitializingShardsAndReroute(strategy, clusterState);
|
clusterState = startInitializingShardsAndReroute(strategy, clusterState);
|
||||||
logger.info("--> after starting: {}", clusterState);
|
|
||||||
clusterState = strategy.reroute(clusterState, cmds, false, false).getClusterState();
|
clusterState = strategy.reroute(clusterState, cmds, false, false).getClusterState();
|
||||||
logger.info("--> after running another command: {}", clusterState);
|
|
||||||
logShardStates(clusterState);
|
logShardStates(clusterState);
|
||||||
|
|
||||||
clusterInfoReference.set(overfullClusterInfo);
|
clusterInfoReference.set(overfullClusterInfo);
|
||||||
|
|
||||||
clusterState = strategy.reroute(clusterState, "foo");
|
strategy.reroute(clusterState, "foo"); // ensure reroute doesn't fail even though there is negative free space
|
||||||
logger.info("--> after another reroute: {}", clusterState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue