-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Weighted Routing] Allow Search with preference parameter in weighed in nodes #6296
[Weighted Routing] Allow Search with preference parameter in weighed in nodes #6296
Conversation
Signed-off-by: Anshu Agarwal <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Anshu Agarwal <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Does this effectively revert #5874? Is there a top level issue somewhere the fully describes the behavior of weighted routing that can help me understand this? |
* round-robin scheduling policy. Uses the passed seed to shuffle the shards. | ||
* | ||
*/ | ||
public ShardIterator activeInitializingShardsSimpleWeightedIt( |
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.
Should this be package private
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.
tests won't compile
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.
Might need exhaustive tests for this
No the previous change was strict, this change relaxes the checks to allow the search preference parameter if preference isn't hard(like ONLY_NODES) when those nodes are weighed away. |
Signed-off-by: Anshu Agarwal <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Anshu Agarwal <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Anshu Agarwal <[email protected]>
Signed-off-by: Anshu Agarwal <[email protected]>
@Bukhtawar added tests for all the preference parameter |
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #6296 +/- ##
============================================
- Coverage 70.78% 70.59% -0.19%
+ Complexity 59062 58951 -111
============================================
Files 4800 4800
Lines 282420 282496 +76
Branches 40718 40735 +17
============================================
- Hits 199908 199442 -466
- Misses 66126 66658 +532
- Partials 16386 16396 +10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
final Set<String> nodesIds = Arrays.stream(preference.substring(Preference.PREFER_NODES.type().length() + 1).split(",")) | ||
.collect(Collectors.toSet()); | ||
return indexShard.preferNodeActiveInitializingShardsWeightedIt( | ||
nodesIds, | ||
nodes, | ||
weightedRoutingMetadata.getWeightedRouting(), | ||
getWeightedRoutingDefaultWeight() | ||
); | ||
case LOCAL: | ||
return indexShard.preferNodeActiveInitializingShardsWeightedIt( | ||
Collections.singleton(localNodeId), | ||
nodes, | ||
weightedRoutingMetadata.getWeightedRouting(), | ||
getWeightedRoutingDefaultWeight() | ||
); | ||
case ONLY_LOCAL: | ||
if (!indexShard.isNodeWeighedAway( | ||
weightedRoutingMetadata.getWeightedRouting(), | ||
nodes, | ||
localNodeId, | ||
getWeightedRoutingDefaultWeight() | ||
)) return indexShard.onlyNodeActiveInitializingShardsIt(localNodeId); | ||
else { | ||
throw new PreferenceBasedSearchNotAllowedException( | ||
"Preference based routing not allowed on weigh away node with strict weighted shard routing enabled" | ||
); | ||
} | ||
case ONLY_NODES: | ||
String nodeAttributes = preference.substring(Preference.ONLY_NODES.type().length() + 1); | ||
return indexShard.onlyNodeSelectorActiveInitializingWeightedShardsIt( | ||
nodeAttributes.split(","), | ||
nodes, | ||
weightedRoutingMetadata.getWeightedRouting(), | ||
getWeightedRoutingDefaultWeight() |
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.
There could be multiple cases for each of these cases. Lets add comments on the behavioural change. We might also want to document the same
Signed-off-by: Anshu Agarwal <[email protected]>
Signed-off-by: Anshu Agarwal <[email protected]>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
.routingTable(routingTable) | ||
.build(); | ||
|
||
threadPool = new TestThreadPool("testThatOnlyNodesSupport"); |
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.
Copy/paste error on "testThatOnlyNodesSupport"? Also can probably move this assignment up and skip assigning null
to threadPool
.
@@ -112,6 +112,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
- Cluster health call to throw decommissioned exception for local decommissioned node([#6008](https://github.com/opensearch-project/OpenSearch/pull/6008)) | |||
- [Refactor] core.common to new opensearch-common library ([#5976](https://github.com/opensearch-project/OpenSearch/pull/5976)) | |||
- Cluster local health call to throw exception if node is decommissioned or weighed away ([#6198](https://github.com/opensearch-project/OpenSearch/pull/6198)) | |||
- Allow search with preference parameter when strict weighted shard routing is enabled ([#6296](https://github.com/opensearch-project/OpenSearch/pull/6296)) |
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 now have the following two entries to go in the next release notes:
- Add support to disallow search request with preference parameter with strict weighted shard routing
- Allow search with preference parameter when strict weighted shard routing is enabled
I find these two statements confusing! Since the second change is just modifying a subtle behavior of the first change (which is still unreleased), maybe we don't need the second entry?
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.
Sure, will modify the first entry itself
Signed-off-by: Anshu Agarwal [email protected]
Description
This PR adds support to allow searches with preference parameter when strict weighted routing is enabled.
Issues Resolved
#6297
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.