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

Added new Setting property UnmodifiableOnRestore to prevent updating settings on restore snapshot #16957

Merged
merged 20 commits into from
Jan 24, 2025

Conversation

anntians
Copy link
Contributor

@anntians anntians commented Jan 6, 2025

Description

This PR adds a new Setting property UnmodifiableOnRestore to prevent customers from updating certain settings on restore snapshot. The motivation behind this change is to prevent customers from updating index.knn setting when restoring a snapshot. The PR is related to another PR (opensearch-project/k-NN#2348) which fixes a bug by making index.knn setting immutable after index creation. However, that PR doesn't cover the case for snapshots, so this PR adds Setting property UnmodifiableOnRestore so that index.knn will be immutable when restoring an index from a snapshot.

Related Issues

Resolves Issue 2334 in KNN repository: opensearch-project/k-NN#2334
#17019

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Contributor

github-actions bot commented Jan 6, 2025

✅ Gradle check result for 4a659c0: SUCCESS

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.23%. Comparing base (13ab4ec) to head (9b3e7ce).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../java/org/opensearch/snapshots/RestoreService.java 42.85% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #16957      +/-   ##
============================================
- Coverage     72.32%   72.23%   -0.10%     
+ Complexity    65477    65393      -84     
============================================
  Files          5309     5309              
  Lines        304306   304319      +13     
  Branches      44124    44128       +4     
============================================
- Hits         220098   219813     -285     
- Misses        66159    66502     +343     
+ Partials      18049    18004      -45     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 7, 2025

❌ Gradle check result for f33c9bc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for f487f95: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for c1c3593: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

…ady registered, will raise separate PR for settings not yet registered. Add validation check in Setting.java. Add UnmodifiableOnRestore settings cannot be removed on restore

Signed-off-by: AnnTian Shao <[email protected]>
Copy link
Contributor

✅ Gradle check result for dc281ce: SUCCESS

@anntians anntians requested a review from dblock January 23, 2025 17:16
Copy link
Collaborator

@jed326 jed326 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few comments but none are blocking, LGTM. @dblock would you like to take another look too?

@navneet1v navneet1v added the backport 2.x Backport to 2.x branch label Jan 23, 2025
@kotwanikunal kotwanikunal dismissed dblock’s stale review January 23, 2025 20:54

Requested changes adapted.

Copy link
Contributor

❌ Gradle check result for 3227d08: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for b55cbed: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Collaborator

@sohami sohami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, LGTM

Copy link
Contributor

✅ Gradle check result for 5a836e3: SUCCESS

Copy link
Contributor

✅ Gradle check result for 9b3e7ce: SUCCESS

@sohami sohami merged commit 822f80c into opensearch-project:main Jan 24, 2025
30 checks passed
@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:

# 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-16957-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 822f80cf2cdc8398d6861827bca2d53f91329f8d
# Push it to GitHub
git push --set-upstream origin backport/backport-16957-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 base branch is 2.x and the compare/head branch is backport/backport-16957-to-2.x.

sohami pushed a commit that referenced this pull request Jan 24, 2025
…g settings on restore snapshot (#16957) (#17116)

* Add index.knn setting to list of unmodifiable settings when restore snapshot

Signed-off-by: AnnTian Shao <[email protected]>

* Add index.knn setting to list of unmodifiable settings when restore snapshot

Signed-off-by: AnnTian Shao <[email protected]>

* Add new Setting property UnmodifiableOnRestore to mark setting as immutable on restore snapshot

Signed-off-by: AnnTian Shao <[email protected]>

* Add tests for new Setting property UnmodifiableOnRestore

Signed-off-by: AnnTian Shao <[email protected]>

* fixes and added more tests for new setting property UnmodifiableOnRestore

Signed-off-by: AnnTian Shao <[email protected]>

* fix test failures

Signed-off-by: AnnTian Shao <[email protected]>

* Revert "fix test failures"

This reverts commit 252100c.

Signed-off-by: AnnTian Shao <[email protected]>

* fixes by adding back USER_UNMODIFIABLE_SETTINGS for settings without Setting implementation

Signed-off-by: AnnTian Shao <[email protected]>

* testing CI config for registering plugin settings

Signed-off-by: AnnTian Shao <[email protected]>

* Revert "testing CI config for registering plugin settings"

This reverts commit 9ebab5a.

Signed-off-by: AnnTian Shao <[email protected]>

* Add UnmodifiableOnRestore only to unmodifiable settings that are already registered, will raise separate PR for settings not yet registered. Add validation check in Setting.java. Add UnmodifiableOnRestore settings cannot be removed on restore

Signed-off-by: AnnTian Shao <[email protected]>

* fixes and move tests to RestoreSnapshotIT

Signed-off-by: AnnTian Shao <[email protected]>

* Add back testInvalidRestoreRequestScenarios test method

Signed-off-by: AnnTian Shao <[email protected]>

---------

Signed-off-by: AnnTian Shao <[email protected]>
Signed-off-by: Tommy Shao <[email protected]>
Co-authored-by: AnnTian Shao <[email protected]>
(cherry picked from commit 822f80c)

Signed-off-by: Tommy Shao <[email protected]>
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 backport-failed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants