-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix deletion failure/error of unused index template when the index template matches a data stream but has lower priority #20102
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
Conversation
…tches a data stream but has low priority Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
server/src/main/java/org/opensearch/cluster/metadata/MetadataIndexTemplateService.java
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20102 +/- ##
=========================================
Coverage 73.33% 73.34%
- Complexity 71679 71710 +31
=========================================
Files 5790 5786 -4
Lines 327549 327611 +62
Branches 47181 47203 +22
=========================================
+ Hits 240217 240287 +70
- Misses 68080 68089 +9
+ Partials 19252 19235 -17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sandeshkr419
left a comment
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, thanks for adding the test case.
Minor nit-pick on making the changelog more clarifying.
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
❌ Gradle check result for a88ef78: 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? |
|
❌ Gradle check result for a88ef78: 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? |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughRefactors template resolution to select a single highest-priority V2 template per pattern and restricts data-stream associations to that winner; adds tests and REST-spec coverage plus a changelog entry describing the deletion fix for an unused lower-priority data-stream index template. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Resolver as MetadataIndexTemplateService
participant Cluster as ClusterState
rect `#F8F9FB`
note right of Resolver: Old behavior (bug)
Client->>Resolver: resolve V2 templates for pattern "test*"
Resolver->>Resolver: collect ALL matching templates (50, 51)
Resolver->>Cluster: ask which data streams match any pattern
Cluster-->>Resolver: data stream "test" matches
Resolver-->>Client: report template "test" in use (blocks deletion)
end
rect `#F6FBF8`
note right of Resolver: New behavior (fixed)
Client->>Resolver: resolve V2 templates for pattern "test*"
Resolver->>Resolver: select HIGHEST-priority winner (51)
Resolver->>Cluster: ask which data streams use winner (51)
Cluster-->>Resolver: "test" uses winner (51) only
Resolver-->>Client: allow deletion of lower-priority template (50)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
|
❌ Gradle check result for 90d582b: 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? |
…mplate matches a data stream but has lower priority (opensearch-project#20102) * Fix delete not using index template failed when the index template matches a data stream but has low priority Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Modify change log Signed-off-by: Binlong Gao <gbinlong@amazon.com> * Optimize change log Signed-off-by: Binlong Gao <gbinlong@amazon.com> --------- Signed-off-by: Binlong Gao <gbinlong@amazon.com> Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> Co-authored-by: Sandesh Kumar <sandeshkr419@gmail.com>
Description
When there're multiple index templates matching data stream, the highest priority template will be used for the new created data stream, we can check the current used template by GET _data_stream/{name} API, but for the low priority template which are not used by any data streams, it cannot be deleted, this PR fixes this bug and add some tests for this case.
Related Issues
Resolves #20078
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.
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.