-
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
Prevent deletion of snapshot backing index #5069
Prevent deletion of snapshot backing index #5069
Conversation
…dexes Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
server/src/main/java/org/opensearch/snapshots/SnapshotsService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/snapshots/SnapshotsService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/snapshots/SnapshotsService.java
Outdated
Show resolved
Hide resolved
Can you add some tests of the new behavior? |
Already working on it while I get any review comments on the PR. |
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #5069 +/- ##
============================================
- Coverage 71.07% 71.07% -0.01%
- Complexity 58135 58141 +6
============================================
Files 4704 4705 +1
Lines 277266 277288 +22
Branches 40147 40151 +4
============================================
Hits 197080 197080
- Misses 64001 64021 +20
- Partials 16185 16187 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
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.
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.
Do we have similar behavior elsewhere where we return a 403 when some resource is holding the one being deleted?
By returning FORBIDDEN (401) we are breaking the contract in which FORBIDDEN means "server doesn't want to tell you why this is not allowed". We are explicitly telling the client that this is not allowed. Should this be a 400? Or a 405 (operation not allowed?), or some kind of other not permitted error?
server/src/main/java/org/opensearch/snapshots/SnapshotDeletionException.java
Outdated
Show resolved
Hide resolved
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'll hit approve. Leaving it to @andrross to final-comment, if you think we're making a mistake, then let's discuss. I am not sure anymore.
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
server/src/test/java/org/opensearch/snapshots/SnapshotUtilsTests.java
Outdated
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/opensearch/snapshots/SearchableSnapshotIT.java
Outdated
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/opensearch/snapshots/SearchableSnapshotIT.java
Outdated
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/opensearch/snapshots/SearchableSnapshotIT.java
Outdated
Show resolved
Hide resolved
server/src/internalClusterTest/java/org/opensearch/snapshots/SearchableSnapshotIT.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/snapshots/SnapshotUtils.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/snapshots/SnapshotUtils.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/opensearch/snapshots/SnapshotDeletionException.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
The backport to
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-5069-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 08ac17fd7b9a604ecffee0a8e0d666f4dd372dba
# Push it to GitHub
git push --set-upstream origin backport/backport-5069-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 |
Is this a breaking change for 2.x? Was the user experience broken when these snapshots were deleted in 2.4.0? @Vishalks this will need a manual backport |
@dblock Yes, it was broken. Searchable snapshots are still behind a feature flag so we have some latitude for changing behavior here. |
Starting the backport |
Prevent deletion of snapshots that are backing searchable snapshot indexes Signed-off-by: Vishal Sarda <vsarda@amazon.com> (cherry picked from commit 08ac17f) Signed-off-by: Vishal Sarda <vsarda@amazon.com>
Description
The changes prevent deletion of snapshots that are backing searchable snapshot indexes
Issues Resolved
#4967
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.