-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ILM: Add total_shards_per_node setting to searchable snapshot #112972
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
ILM: Add total_shards_per_node setting to searchable snapshot #112972
Conversation
Pinging @elastic/es-data-management (Team:Data Management) |
Hi @samxbr, I've created a changelog YAML for 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.
Thanks for working on this Sam! I left some comments, but nothing major, this is pretty close!
"searchable_snapshot" : { | ||
"snapshot_repository" : "backing_repo" | ||
"snapshot_repository" : "backing_repo", | ||
"total_shards_per_node" : 2 |
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 think this is a pretty power-user sort of feature, so I think it'd be best not to have it in the example (I worry about unthinking copy-and-paste)
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.
Make sense
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java
Outdated
Show resolved
Hide resolved
this.forceMergeIndex = forceMergeIndex; | ||
|
||
if (totalShardsPerNode != null && totalShardsPerNode < -1) { | ||
throw new IllegalArgumentException("[" + TOTAL_SHARDS_PER_NODE.getPreferredName() + "] must be >= -1"); |
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.
throw new IllegalArgumentException("[" + TOTAL_SHARDS_PER_NODE.getPreferredName() + "] must be >= -1"); | |
throw new IllegalArgumentException("[" + TOTAL_SHARDS_PER_NODE.getPreferredName() + "] must be >= 1"); |
this.snapshotRepository = snapshotRepository; | ||
this.forceMergeIndex = forceMergeIndex; | ||
|
||
if (totalShardsPerNode != null && totalShardsPerNode < -1) { |
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.
if (totalShardsPerNode != null && totalShardsPerNode < -1) { | |
if (totalShardsPerNode != null && totalShardsPerNode < 1) { |
(since we want to disallow -1 and 0)
Collections.singletonMap( | ||
SearchableSnapshotAction.NAME, | ||
new SearchableSnapshotAction(randomAlphaOfLength(10), randomBoolean()) | ||
new SearchableSnapshotAction(randomAlphaOfLength(10), randomBoolean(), randomIntBetween(-1, 100)) |
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.
0 is not a valid setting (it would be like saying "you can allocate zero copies of the data to the node"), so I think this would be better as something like:
new SearchableSnapshotAction(randomAlphaOfLength(10), randomBoolean(), randomIntBetween(-1, 100)) | |
new SearchableSnapshotAction(randomAlphaOfLength(10), randomBoolean(), (randomBoolean() ? null : randomIntBetween(1, 100))) |
} | ||
|
||
private Integer randomTotalShardsPerNode() { | ||
return randomIntBetween(-1, 100); |
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 would suggest encapsulating the nullability (and fixing the bounds) with:
return randomIntBetween(-1, 100); | |
return randomBoolean() ? null : randomIntBetween(1, 100); |
Co-authored-by: Lee Hinman <[email protected]>
…ilm/MountSnapshotStep.java Co-authored-by: Lee Hinman <[email protected]>
CI tests failing due to #113296 |
@elasticmachine update branch |
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, I left one more comment, thanks Sam!
this.restoredIndexPrefix = restoredIndexPrefix; | ||
this.storageType = Objects.requireNonNull(storageType, "a storage type must be specified"); | ||
if (totalShardsPerNode != null && totalShardsPerNode < 1) { | ||
throw new IllegalArgumentException("[totalShardsPerNode] must be >= 1"); |
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 think this should use the preferred name (and to match the config flag name), something like:
throw new IllegalArgumentException("[totalShardsPerNode] must be >= 1"); | |
throw new IllegalArgumentException("[" + SearchableSnapshotAction.TOTAL_SHARDS_PER_NODE.getPreferredName() + "] must be >= 1"); |
Double checking: was this change supposed to go to main only? Or should it have been backported to 8.x? |
Thanks @javanna for the reminder, I added backport for 8.16. |
@samxbr I'm afraid you'll have to backport manually, because the PR has already been merged. |
…c#112972) Allows setting index total_shards_per_node in the SearchableSnapshot action of ILM to remediate hot spot in shard allocation for searchable snapshot index. Closes elastic#112261
Allows setting index
total_shards_per_node
in the SearchableSnapshot action of ILM to remediate hot spot in shard allocation for searchable snapshot index.Closes #112261