-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[BUG] Update index.knn setting to be immutable on restore snapshot #17019
Comments
Thanks @anntians. I have only looked into this briefly, but at a high level I'm unsure any listener hook sort of pattern is the right approach. It looks like today what happens is if we try to update one of these settings then we get a OpenSearch/server/src/main/java/org/opensearch/snapshots/RestoreService.java Lines 834 to 837 in a609e63
However, if you were to use a callback listener, then
OpenSearch/server/src/main/java/org/opensearch/index/CompositeIndexEventListener.java Lines 164 to 174 in aca2e9d
Taking a step back, it seems like this is really a feature request for making the notion of OpenSearch/server/src/main/java/org/opensearch/common/settings/Setting.java Lines 111 to 117 in 8347d0e
|
Going one step further I would actually argue the javadoc for the OpenSearch/server/src/main/java/org/opensearch/common/settings/Setting.java Lines 128 to 132 in 8347d0e
|
@jed326 - That's a fair callout. I was initially thinking of failing the shard, but we still need a way to clean up / prevent the restore completely.
This actually makes a lot more sense. It will be easier to fail the request at validation if a final property is being overridden by the user. @anntians Can you give this a try? |
+1, I agree with this. |
@jed326 Good callouts.
I don't think the javadoc makes any claim on the behavior of Also the change for behavior of Instead I was thinking if we introduce another property like |
Thank you for commenting, I had a few questions following up:
Thanks! |
Describe the bug
This issue builds on top of this KNN issue: opensearch-project/k-NN#2334. Today, user can update index.knn flag even after an index is created which should not be allowed. For instance, users can close an index, update index.knn, and reopen index. This bug has be resolved by this PR: opensearch-project/k-NN#2348. However, another loophole is users can take a snapshot of an index, delete index, and update index.knn on restore from snapshot.
The focus of this issue is for the bug case when restoring from snapshot. There is an open PR: #16957 attempting to fix the bug, but there are a few implementation considerations that need to be discussed. The current implementation in the PR is not best practice as it introduces plugin-specific settings in core Opensearch. So below are two suggestions on implementation:
Currently in execute of restoreService we store a custom object RestoreInProgress in the clusterState here. We could update RestoreInProgress to include a diff of index settings changed, so that once the clusterState is passed downstream to the IndexEventListener callback methods, we can perform validation checks from within the KNN plugin.
Pro: Perform validation within KNN plugin. Straightforward to expand on an existing custom class that is part of clusterState. Faster implementation/merge timeline.
Con: Doesn't offer great extensibility if in the future we want to add more use cases to access data/updates during restore operations.
Currently, the reason we cannot use the existing callback methods in IndexEventListener is because they do not have access to the prev clusterState to know which settings were updated. Further the callback methods can be triggered from other non-restore API calls. However, if we create a new callback method that will strictly be called in the restoreService, pass it clusterState and diff of changed settings, then we can perform validation from within the KNN plugin.
Pro: Creates better extensibility for other use cases to build off of this new callback method in the future. There have been several requests for additional access for restore related updates
Con: Will have to go through several approvals and discussions to make this change, as it updates the core repository and affects future customers/contributors use cases. Will be a longer completion date compared to option 1.
I would like to start a discussion on which option to execute on and additional context that may help resolve this bug.
Related component
Storage:Snapshots
To Reproduce
Expected behavior
index.knn should be immutable on restore. An error should be thrown if the setting is updated on restore api call
Additional Details
Additional context
Original issue: opensearch-project/k-NN#2334
PR for original issue: opensearch-project/k-NN#2348
Open PR for this issue: #16957
The text was updated successfully, but these errors were encountered: