Skip to content
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

[Remote Store] Add support to restore only unassigned shards of an index #8792

Merged
merged 15 commits into from
Jul 27, 2023

Conversation

sachinpkale
Copy link
Member

@sachinpkale sachinpkale commented Jul 20, 2023

Description

  • Currently, remote store restore API restores all the shards of a given index irrespective of the shard state.
  • This approach is not optimized for scenarios where only few of the shards are unassigned. Restore will still download data for all the shards in order to restore them.
  • We also need to close the index before calling remote store restore API. This impacts the index availability during the restore.
  • Ideally, we should be able to restore only those shards that are unassigned and that too without closing the index.
  • In restore API execution, while marking shards to be restored, we filter shards based on existing ShardRoutingState.
  • We pick only shards that are in UNASSIGNED state as shards to be restored.
  • User do not need to provide shard info in the API request. API signature would remain same which accepts index/indices to be restored. API implementation internally picks up only unassigned shards to restore.
  • We also provided a query parameter restore_all_shards which, as the name suggests, will restore all the shards of the given index. As some of the shards can be active, to avoid an inconsistent state, when restore_all_shards=true is passed, index needs to be in closed state.

Related Issues

Resolves #8836

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale force-pushed the shard-level-restore branch from 446187d to b2485fc Compare July 20, 2023 05:08
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale changed the title Add support to restore only unassigned shards of an index [Remote Store] Add support to restore only unassigned shards of an index Jul 20, 2023
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale force-pushed the shard-level-restore branch from ccdf757 to 8b6f741 Compare July 20, 2023 16:52
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale force-pushed the shard-level-restore branch from 8b6f741 to 4f4c650 Compare July 21, 2023 04:12
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale sachinpkale force-pushed the shard-level-restore branch from 4f4c650 to cb66244 Compare July 21, 2023 07:33
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.snapshots.DedicatedClusterSnapshotRestoreIT.testIndexDeletionDuringSnapshotCreationInQueue

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #8792 (9ad837f) into main (4319f2b) will decrease coverage by 0.07%.
Report is 1 commits behind head on main.
The diff coverage is 38.88%.

@@             Coverage Diff              @@
##               main    #8792      +/-   ##
============================================
- Coverage     71.06%   70.99%   -0.07%     
+ Complexity    57253    57245       -8     
============================================
  Files          4758     4758              
  Lines        269840   269862      +22     
  Branches      39480    39484       +4     
============================================
- Hits         191751   191596     -155     
- Misses        61925    62191     +266     
+ Partials      16164    16075      -89     
Files Changed Coverage Δ
...on/admin/cluster/RestRestoreRemoteStoreAction.java 30.00% <0.00%> (-3.34%) ⬇️
.../java/org/opensearch/snapshots/RestoreService.java 54.79% <0.00%> (+0.51%) ⬆️
...remotestore/restore/RestoreRemoteStoreRequest.java 70.68% <100.00%> (+0.68%) ⬆️
.../opensearch/cluster/routing/IndexRoutingTable.java 76.22% <100.00%> (+0.19%) ⬆️
...a/org/opensearch/cluster/routing/RoutingTable.java 94.37% <100.00%> (ø)

... and 475 files with indirect coverage changes

Sachin Kale added 5 commits July 26, 2023 15:06
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
@sachinpkale sachinpkale force-pushed the shard-level-restore branch from f7de81e to a30f2cf Compare July 26, 2023 09:36
@sachinpkale sachinpkale requested a review from sohami as a code owner July 26, 2023 09:36
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Sachin Kale added 2 commits July 26, 2023 16:06
Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <kalsac@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationIT.testDropPrimaryDuringReplication

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@sachinpkale
Copy link
Member Author

Integ tests are covering new changes. Bypassing the codecov/patch failure.

@sachinpkale sachinpkale merged commit c25c175 into opensearch-project:main Jul 27, 2023
@sachinpkale sachinpkale added the backport 2.x Backport to 2.x branch label Jul 27, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-8792-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 c25c175c94efa4d90a1d98e3c7eac3e4aad6e41f
# Push it to GitHub
git push --set-upstream origin backport/backport-8792-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-8792-to-2.x.

sarthakaggarwal97 pushed a commit to sarthakaggarwal97/OpenSearch that referenced this pull request Jul 27, 2023
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
sachinpkale added a commit to sachinpkale/OpenSearch that referenced this pull request Jul 28, 2023
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
gbbafna pushed a commit that referenced this pull request Jul 28, 2023
…dex (#8792) (#8950)

Signed-off-by: Sachin Kale <kalsac@amazon.com>
baba-devv pushed a commit to baba-devv/OpenSearch that referenced this pull request Jul 29, 2023
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this pull request Sep 12, 2023
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Ivan Brusic <ivan.brusic@flocksafety.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…dex (opensearch-project#8792)

* Add support to restore only unassigned shards of an index

---------

Signed-off-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Sachin Kale <sachinpkale@gmail.com>
Co-authored-by: Sachin Kale <kalsac@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Remote Store] Add support to restore only unassigned shards
5 participants