-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Tighten on when THROTTLE decision can be returned #136794
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
Changes from 7 commits
9c56ded
e039dc1
4024c40
3a8664d
4af235f
7d19eac
548ea9d
c7f50d8
1f04641
4025f16
d36a3d9
69227ae
f7eba77
b905995
c62be8e
3750f3d
44c9c66
6cdfdc1
1726061
228c35d
d0883de
2c44ae1
abfe345
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -705,12 +705,16 @@ private boolean balanceByWeights(NodeSorter sorter) { | |
| highIdx = relevantNodes - 1; | ||
|
|
||
| if (routingNodes.getRelocatingShardCount() > 0) { | ||
| // ES-12955: Check routingNodes.getRelocatingShardCount() > 0 in case the first relocation is a THROTTLE. | ||
| // This should rarely happen since in most cases, we don't throttle unless there is an existing relocation. | ||
| // But it can happen in production for frozen indices when the cache is still being prepared. It can also | ||
| // happen in tests because we have decider like RandomAllocationDecider that can randomly return THROTTLE | ||
| // when there is no existing relocation. | ||
| // Check routingNodes.getRelocatingShardCount() > 0 in case the first relocation is a THROTTLE. | ||
| shardBalanced = true; | ||
| } else { | ||
| // A THROTTLE decision can happen when not simulating | ||
| assert allocation.isSimulating() == false | ||
| : "unexpected THROTTLE decision (simulation=" | ||
| + allocation.isSimulating() | ||
| + ") when balancing index [" | ||
| + index | ||
| + "]"; | ||
|
||
| } | ||
| if (completeEarlyOnShardAssignmentChange && shardBalanced) { | ||
| return true; | ||
|
|
@@ -835,6 +839,18 @@ public boolean moveShards() { | |
| } else if (moveDecision.isDecisionTaken() && moveDecision.canRemain() == false) { | ||
| logger.trace("[{}][{}] can't move", shardRouting.index(), shardRouting.id()); | ||
| } | ||
|
|
||
| // A THROTTLE allocation decision can happen when not simulating | ||
| assert moveDecision.getAllocationDecision() != AllocationDecision.THROTTLED || allocation.isSimulating() == false | ||
|
||
| : "unexpected allocation decision [" | ||
| + moveDecision.getAllocationDecision() | ||
| + "] (simulation=" | ||
| + allocation.isSimulating() | ||
| + ") with " | ||
| + (shardMoved ? "" : "no ") | ||
| + "prior shard movements when moving shard [" | ||
| + shardRouting | ||
| + "]"; | ||
| } | ||
|
|
||
| // If we get here, attempt to move one of the best not-preferred shards that we identified earlier | ||
|
|
@@ -1268,9 +1284,15 @@ private boolean allocateUnassigned() { | |
| assert allocationDecision.getAllocationStatus() == AllocationStatus.DECIDERS_THROTTLED; | ||
| final long shardSize = getExpectedShardSize(shard, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE, allocation); | ||
| minNode.addShard(projectIndex(shard), shard.initialize(minNode.getNodeId(), null, shardSize)); | ||
| // If we see a throttle decision in simulation, there must be other shards that got assigned before it. | ||
| // If we see a THROTTLE decision, it's either: | ||
| // 1. Not simulating | ||
| // 2. Or, there is shard assigned before this one | ||
| assert allocation.isSimulating() == false || shardAssignmentChanged | ||
| : "shard " + shard + " was throttled but no other shards were assigned"; | ||
| : "unexpected THROTTLE decision (simulation=" | ||
| + allocation.isSimulating() | ||
| + ") with no prior assignment when allocating unassigned shard [" | ||
| + shard | ||
| + "]"; | ||
|
||
| } else { | ||
| if (logger.isTraceEnabled()) { | ||
| logger.trace("No Node found to assign shard [{}]", shard); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.