Skip to content
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

Ensuring that the ShrinkAction does not hang if total shards per node is too low #76732

Merged
merged 4 commits into from
Aug 20, 2021

Conversation

masseyke
Copy link
Member

We added configuration to AllocateAction to set the total shards per node property on the index. This makes it possible that a user could set this to a value lower than the total number of shards in the index that is about to be shrunk, meaning that all of the shards could not be moved to a single node in the ShrinkAction. This commit sets the total shards per node property to -1 (unlimited) in the ShrinkAction to avoid this.
Relates to #44070

@masseyke masseyke added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 19, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Aug 19, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@masseyke
Copy link
Member Author

This is related to this PR: #76134

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, I left one minor comment, thanks for fixing this!

@@ -95,7 +96,8 @@ public void performAction(IndexMetadata indexMetadata, ClusterState clusterState

if (nodeId.isPresent()) {
Settings settings = Settings.builder()
.put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id", nodeId.get()).build();
.put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id", nodeId.get())
.put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), -1).build();
Copy link
Member

@dakrone dakrone Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rather than setting this explicitly to -1, we might be better if we did:

Suggested change
.put(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.getKey(), -1).build();
.putNull(ShardsLimitAllocationDecider.INDEX_TOTAL_SHARDS_PER_NODE_SETTING.getKey()).build();

Since the default value is -1 (rather than setting it to that explicitly)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Done.

@masseyke masseyke merged commit 0aab3c0 into elastic:master Aug 20, 2021
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Aug 20, 2021
… is too low (elastic#76732)

We added configuration to AllocateAction to set the total shards per node property on the index. This makes it possible that a user could set this to a value lower than the total number of shards in the index that is about to be shrunk, meaning that all of the shards could not be moved to a single node in the ShrinkAction. This commit unsets the total shards per node property so that we fall back to the default value (-1, unlimited) in the ShrinkAction to avoid this.
Relates to elastic#44070
masseyke added a commit that referenced this pull request Aug 20, 2021
… is too low (#76732) (#76780)

This is a backport of #76732. We added configuration to AllocateAction to set the total shards
per node property on the index. This makes it possible that a user could set this to a value lower
than the total number of shards in the index that is about to be shrunk, meaning that all of the
shards could not be moved to a single node in the ShrinkAction. This commit unsets the total
shards per node property so that we fall back to the default value (-1, unlimited) in the
ShrinkAction to avoid this.
Relates to #44070
@masseyke masseyke deleted the fix/prevent-blocking-shrink branch November 2, 2021 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow adjustment of index resource constraints in ILM phase transitions
5 participants