-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Initial commit to support a search only replica for RW separation. #15410
Conversation
a1b71a9
to
e50f2dc
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Signed-off-by: Marc Handalian <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-15410-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1e9fdb452101476a24737cc1b3aa1fad15df8fca
# Push it to GitHub
git push --set-upstream origin backport/backport-15410-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x Then, create a pull request where the |
…pensearch-project#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]> (cherry picked from commit 1e9fdb4) Signed-off-by: Marc Handalian <[email protected]>
… separation (#15535) * Initial commit to support a search only replica for RW separation. (#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]> (cherry picked from commit 1e9fdb4) Signed-off-by: Marc Handalian <[email protected]> * Update wire compatibility version to 2_17_0 Signed-off-by: Marc Handalian <[email protected]> * change assertion for ff disabled from SettingsException to IllegalArgumentException Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]>
@@ -357,7 +357,7 @@ private ShardRouting initializingShard(ShardRouting shardRouting, String current | |||
@Override | |||
public Decision canMoveAway(ShardRouting shardRouting, RoutingAllocation allocation) { | |||
int outgoingRecoveries = 0; | |||
if (!shardRouting.primary()) { | |||
if (!shardRouting.primary() && !shardRouting.isSearchOnly()) { |
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.
Sorry couldn't understand the context for this change. This is meant to move the replica and check if the outgoing recovery from it's peer primary is getting throttled. Wouldn't search only replica recover from the primary copy or the plan is to make recoveries totally independent? cc: @mch2
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.
Err thanks for calling this out I'm not handling this correclty.
This was to resolve an NPE a few lines later when we only have search replicas and the primary has a node drop. In this case the NPE occurs right after this where we fetch the active primary as null and then invoke .currentNodeId on it. We should be setting outgoingRecoveries to 0 in this case instead.
To answer your question the plan is to have search replica recover directly from the remote store when its enabled but we need to still honor node-node with active primary.
…pensearch-project#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]>
…pensearch-project#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]>
…pensearch-project#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]>
…pensearch-project#15410) * Initial commit for search only replica. This PR contains the following: 1. Introduce searchOnly flag on ShardRouting. 2. Added feature flag to enable/disable the feature. 3. supports both create and update APIs to toggle search replica count. 4. Changes to exclude search replicas from primary eligibility. 5. Changes to prevent replicationOperations from routing to search replicas. Signed-off-by: Marc Handalian <[email protected]> * add some missing feature flag checks Signed-off-by: Marc Handalian <[email protected]> * Pr feedback from @andrross Signed-off-by: Marc Handalian <[email protected]> * Add more unit tests for settings create and update Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests from setting rename Signed-off-by: Marc Handalian <[email protected]> * Fix broken tests and add changelog entry Signed-off-by: Marc Handalian <[email protected]> * More PR feedback. Signed-off-by: Marc Handalian <[email protected]> * add missing searchOnly property to initializeTargetRelocatingShard. Without this search replicas will become regular replicas on relocation. Signed-off-by: Marc Handalian <[email protected]> * test fixes Signed-off-by: Marc Handalian <[email protected]> * spotless Signed-off-by: Marc Handalian <[email protected]> --------- Signed-off-by: Marc Handalian <[email protected]>
Description
Initial commit for the search only replica for reader writer split.
This PR contains the following:
/_cat/shards
Related Issues
Resolves #15368
related #15306
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.