-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] Filter shards for sliced search at coordinator (#17025)
* Filter shards for sliced search at coordinator (#16771) * Filter shards for sliced search at coordinator Prior to this commit, a sliced search would fan out to every shard, then apply a MatchNoDocsQuery filter on shards that don't correspond to the current slice. This still creates a (useless) search context on each shard for every slice, though. For a long-running sliced scroll, this can quickly exhaust the number of available scroll contexts. This change avoids fanning out to all the shards by checking at the coordinator if a shard is matched by the current slice. This should reduce the number of open scroll contexts to max(numShards, numSlices) instead of numShards * numSlices. --------- Signed-off-by: Michael Froh <[email protected]> (cherry picked from commit f9c239d) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Fix versions and breaking API changes Signed-off-by: Andriy Redko <[email protected]> --------- Signed-off-by: Michael Froh <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Andriy Redko <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <[email protected]>
- Loading branch information
1 parent
bf06726
commit 81ee44a
Showing
12 changed files
with
229 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
rest-api-spec/src/main/resources/rest-api-spec/test/search_shards/20_slice.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
"Search shards with slice specified in body": | ||
- skip: | ||
version: " - 2.18.99" | ||
reason: "Added slice body to search_shards in 2.19" | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 7 | ||
number_of_replicas: 0 | ||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
body: | ||
slice: | ||
id: 0 | ||
max: 3 | ||
- length: { shards: 3 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 0 } | ||
- match: { shards.1.0.shard: 3 } | ||
- match: { shards.2.0.shard: 6 } | ||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
body: | ||
slice: | ||
id: 1 | ||
max: 3 | ||
- length: { shards: 2 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 1 } | ||
- match: { shards.1.0.shard: 4 } | ||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
body: | ||
slice: | ||
id: 2 | ||
max: 3 | ||
- length: { shards: 2 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 2 } | ||
- match: { shards.1.0.shard: 5 } | ||
|
||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
preference: "_shards:0,2,4,6" | ||
body: | ||
slice: | ||
id: 0 | ||
max: 3 | ||
- length: { shards: 2 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 0 } | ||
- match: { shards.1.0.shard: 6 } | ||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
preference: "_shards:0,2,4,6" | ||
body: | ||
slice: | ||
id: 1 | ||
max: 3 | ||
- length: { shards: 1 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 2 } | ||
|
||
- do: | ||
search_shards: | ||
index: test_index | ||
preference: "_shards:0,2,4,6" | ||
body: | ||
slice: | ||
id: 2 | ||
max: 3 | ||
- length: { shards: 1 } | ||
- match: { shards.0.0.index: "test_index" } | ||
- match: { shards.0.0.shard: 4 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.