-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Add dedicated step for checking shrink allocation status #35161
Add dedicated step for checking shrink allocation status #35161
Conversation
This adds a new step for checking whether an index is allocated correctly based on the rules added prior to running the shrink step. It also fixes a bug where for shrink we are not allowed to have the shards relocating for the shrink step. Resolves elastic#34938
Pinging @elastic/es-core-infra |
…rink-allocation-check
…rink-allocation-check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dakrone I left a comment
int allocationPendingAllShards = 0; | ||
|
||
ImmutableOpenIntMap<IndexShardRoutingTable> allShards = clusterState.getRoutingTable().index(index).getShards(); | ||
for (ObjectCursor<IndexShardRoutingTable> shardRoutingTable : allShards.values()) { | ||
int allocationPendingThisShard = 0; | ||
int shardCopiesThisShard = shardRoutingTable.value.size(); | ||
for (ShardRouting shardRouting : shardRoutingTable.value.shards()) { | ||
String currentNodeId = shardRouting.currentNodeId(); | ||
boolean canRemainOnCurrentNode = ALLOCATION_DECIDERS | ||
.canRemain(shardRouting, clusterState.getRoutingNodes().node(currentNodeId), allocation) | ||
.type() == Decision.Type.YES; | ||
if (canRemainOnCurrentNode == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add a check for the shard being started here too otherwise we will end up with the same issue on the allocate action but it will be harder to diagnose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to address that in a separate PR, since I think it warrants more testing for the full ramifications, would that be okay with you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, could you create an issue so we can track the extra work and it doesn't get missed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, opened #35258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM when the issue for the extra work is created
int allocationPendingAllShards = 0; | ||
|
||
ImmutableOpenIntMap<IndexShardRoutingTable> allShards = clusterState.getRoutingTable().index(index).getShards(); | ||
for (ObjectCursor<IndexShardRoutingTable> shardRoutingTable : allShards.values()) { | ||
int allocationPendingThisShard = 0; | ||
int shardCopiesThisShard = shardRoutingTable.value.size(); | ||
for (ShardRouting shardRouting : shardRoutingTable.value.shards()) { | ||
String currentNodeId = shardRouting.currentNodeId(); | ||
boolean canRemainOnCurrentNode = ALLOCATION_DECIDERS | ||
.canRemain(shardRouting, clusterState.getRoutingNodes().node(currentNodeId), allocation) | ||
.type() == Decision.Type.YES; | ||
if (canRemainOnCurrentNode == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, could you create an issue so we can track the extra work and it doesn't get missed?
This adds a new step for checking whether an index is allocated correctly based on the rules added prior to running the shrink step. It also fixes a bug where for shrink we are not allowed to have the shards relocating for the shrink step. This also allows us to simplify AllocationRoutedStep and provide better feedback in the step info for why either the allocation or the shrink checks have failed. Resolves #34938
This is a follow-up from elastic#35161 where we now check for started and relocating state in `AllocationRoutedStep`. Resolves elastic#35258
…tic#35316) * [ILM] Check shard and relocation status in AllocationRoutedStep This is a follow-up from elastic#35161 where we now check for started and relocating state in `AllocationRoutedStep`. Resolves elastic#35258
This adds a new step for checking whether an index is allocated correctly based
on the rules added prior to running the shrink step. It also fixes a bug where
for shrink we are not allowed to have the shards relocating for the shrink step.
This also allows us to simplify AllocationRoutedStep and provide better
feedback in the step info for why either the allocation or the shrink checks
have failed.
Resolves #34938