Skip to content

Check shard limit after applying index templates#44619

Merged
jasontedor merged 6 commits intoelastic:masterfrom
jasontedor:check-shard-limit-after-templates
Jul 23, 2019
Merged

Check shard limit after applying index templates#44619
jasontedor merged 6 commits intoelastic:masterfrom
jasontedor:check-shard-limit-after-templates

Conversation

@jasontedor
Copy link
Copy Markdown
Member

@jasontedor jasontedor commented Jul 19, 2019

Today when creating an index and checking cluster shard limits, we check the number of shards before applying index templates. At this point, we do not know the actual number of shards that will be used to create the index. In a case when the defaults are used and a template would override, we could be grossly underestimating the number of shards that would be created, and thus incorrectly applying the limits. This commit addresses this by checking the shard limits after applying index templates.

Closes #44567
Relates #34021
Supersedes #44619

Today when creating an index and checking cluster shard limits, we check
the number of shards before applying index templates. At this point, we
do not know the actual number of shards that will be used to create the
index. In a case when the defaults are used and a template would
override, we could be grossly underestimating the number of shards that
would be created, and thus incorrectly applying the limits. This commit
addresses this by checking the shard limits after applying index
templates.
@jasontedor jasontedor added >bug :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. v8.0.0 v7.3.0 v7.2.1 v7.4.0 v6.8.3 labels Jul 19, 2019
@jasontedor jasontedor requested a review from AthenaEryma July 19, 2019 11:02
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features

Copy link
Copy Markdown
Contributor

@AthenaEryma AthenaEryma left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. LGTM, with one very minor nitpick

validator, IndexScopedSettings.DEFAULT_SCOPED_SETTINGS) {

@Override
protected void checkShardLimit(final Settings settings, final ClusterState clusterState) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we add a short comment here explaining why this is here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I pushed f1ea945.

@jasontedor
Copy link
Copy Markdown
Member Author

@elasticmachine run elasticsearch-ci/bwc

@jasontedor
Copy link
Copy Markdown
Member Author

@elasticmachine run elasticsearch-ci/2

@jasontedor jasontedor merged commit 5cdbefd into elastic:master Jul 23, 2019
jasontedor added a commit that referenced this pull request Jul 23, 2019
Today when creating an index and checking cluster shard limits, we check
the number of shards before applying index templates. At this point, we
do not know the actual number of shards that will be used to create the
index. In a case when the defaults are used and a template would
override, we could be grossly underestimating the number of shards that
would be created, and thus incorrectly applying the limits. This commit
addresses this by checking the shard limits after applying index
templates.
jasontedor added a commit that referenced this pull request Jul 23, 2019
Today when creating an index and checking cluster shard limits, we check
the number of shards before applying index templates. At this point, we
do not know the actual number of shards that will be used to create the
index. In a case when the defaults are used and a template would
override, we could be grossly underestimating the number of shards that
would be created, and thus incorrectly applying the limits. This commit
addresses this by checking the shard limits after applying index
templates.
jasontedor added a commit that referenced this pull request Jul 23, 2019
Today when creating an index and checking cluster shard limits, we check
the number of shards before applying index templates. At this point, we
do not know the actual number of shards that will be used to create the
index. In a case when the defaults are used and a template would
override, we could be grossly underestimating the number of shards that
would be created, and thus incorrectly applying the limits. This commit
addresses this by checking the shard limits after applying index
templates.
jasontedor added a commit that referenced this pull request Jul 23, 2019
Today when creating an index and checking cluster shard limits, we check
the number of shards before applying index templates. At this point, we
do not know the actual number of shards that will be used to create the
index. In a case when the defaults are used and a template would
override, we could be grossly underestimating the number of shards that
would be created, and thus incorrectly applying the limits. This commit
addresses this by checking the shard limits after applying index
templates.
@jasontedor jasontedor deleted the check-shard-limit-after-templates branch July 23, 2019 08:15
@mfussenegger mfussenegger mentioned this pull request Mar 26, 2020
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. v6.8.3 v7.2.1 v7.3.0 v7.4.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cluster.max_shards_per_node derives shard count from default not template settings

4 participants