Skip to content

fix: Separate internal ignore settings from user ignore settings in restore#20494

Open
piyushk6130 wants to merge 2 commits intoopensearch-project:mainfrom
piyushk6130:fix-internal-ignore-settings-restore
Open

fix: Separate internal ignore settings from user ignore settings in restore#20494
piyushk6130 wants to merge 2 commits intoopensearch-project:mainfrom
piyushk6130:fix-internal-ignore-settings-restore

Conversation

@piyushk6130
Copy link

Description

This PR fixes an issue where internal ignore settings were being blocked by user-unremovable settings protection during snapshot restore operations.

Problem

When restoring snapshots across clusters (e.g., from a remote-store enabled cluster to a non-remote-store cluster), internal settings like index.remote_store.* need to be filtered out. However, the current implementation combines internal ignore settings with user ignore settings, causing internal settings to be blocked by the USER_UNREMOVABLE_SETTINGS protection check.

Solution

Separate internal ignore settings into their own filter lists (internalKeyFilters and internalSimpleMatchPatterns) that are evaluated first and bypass the user-unremovable settings protection. This ensures:

Internal ignore settings (like index.remote_store.*) are always filtered regardless of protection status
User ignore settings continue to respect the USER_UNREMOVABLE_SETTINGS protection
Testing

Manually tested cross-cluster restore scenarios:

Remote store → Non-remote store: Remote store settings correctly stripped ✓
Non-remote store → Remote store: Settings correctly applied by target cluster ✓
Remote store → Remote store: Settings preserved ✓
Non-remote store → Non-remote store: No changes ✓

…estore

Internal ignore settings should override user-unremovable settings protection

to allow proper filtering of settings like remote_store.* during cross-cluster

restores.

Signed-off-by: Piyush Kumar <piykumab@amazon.com>
@piyushk6130 piyushk6130 requested a review from a team as a code owner January 28, 2026 08:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

The change introduces separate internal and user-facing ignore settings lists in RestoreService. Internal ignore patterns are collected separately and applied first in the filtering logic, while user-protected settings protection semantics are preserved. No public API modifications.

Changes

Cohort / File(s) Summary
Settings Filtering Logic
server/src/main/java/org/opensearch/snapshots/RestoreService.java
Introduces internalKeyFilters and internalSimpleMatchPatterns lists to segregate internal ignore settings. Updates filtering logic to apply internal ignore patterns with override precedence, followed by user ignore patterns for non-protected settings. Minor structural adjustments to comments and method organization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: separating internal ignore settings from user ignore settings in the restore process.
Description check ✅ Passed The description includes all required sections with detailed problem statement, solution explanation, and manual testing results; minor testing checklist items not explicitly marked but testing is documented.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

❌ Gradle check result for 1dfa515: null

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?


Predicate<String> settingsFilter = k -> {
// Check internal ignore patterns first (they override protection)
for (String filterKey : internalKeyFilters) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we replace the for loop with a exists check in the Set

Copy link
Author

Choose a reason for hiding this comment

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

done

if (k.equals(filterKey)) {
return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to cover this change in some UT or IT

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Author

Choose a reason for hiding this comment

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

added UT.

Add tests to verify that internal ignore patterns can filter protected

settings while user ignore patterns respect protection. Also optimize

the predicate to use Set.contains() instead of iteration.

Signed-off-by: Piyush Kumar <piykumab@amazon.com>
@piyushk6130 piyushk6130 force-pushed the fix-internal-ignore-settings-restore branch from c55065f to 377242f Compare February 2, 2026 11:17
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

❌ Gradle check result for 377242f: 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?

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stalled Issues that have stalled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants