Skip to content

Fix relocating shards size calculation #48421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public Decision canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAl
"this shard is not allocated on the most utilized disk and can remain");
}
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());
logger.debug("fewer free bytes remaining than the size of all incoming shards: " +
"usage {} on node {} including {} bytes of relocations, shard cannot remain",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,17 +754,13 @@ public void testShardRelocationsTakenIntoAccount() {
AllocationCommand moveAllocationCommand = new MoveAllocationCommand("test2", 0, "node2", "node3");
AllocationCommands cmds = new AllocationCommands(moveAllocationCommand);

logger.info("--> before starting: {}", clusterState);
clusterState = startInitializingShardsAndReroute(strategy, clusterState);
logger.info("--> after starting: {}", clusterState);
clusterState = strategy.reroute(clusterState, cmds, false, false).getClusterState();
logger.info("--> after running another command: {}", clusterState);
logShardStates(clusterState);

clusterInfoReference.set(overfullClusterInfo);

clusterState = strategy.reroute(clusterState, "foo");
logger.info("--> after another reroute: {}", clusterState);
strategy.reroute(clusterState, "foo"); // ensure reroute doesn't fail even though there is negative free space
}
}

Expand Down