-
Notifications
You must be signed in to change notification settings - Fork 26
Retain local indices on exporter type change #465
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
base: main
Are you sure you want to change the base?
Conversation
| * @param client OpenSearch Client | ||
| * @param localIndexExporter the exporter to handle the local index operations | ||
| */ | ||
| void deleteAllTopNIndices(final Client client, final LocalIndexExporter localIndexExporter) { |
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 you think we should add an API endpoint to do this?
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.
No, admins can delete indices manually I believe and retention policy will still apply
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.
makes sense.
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 think one caveat here is, if there are issues with local index exporters, we won't have a quick solution to solve it. like, for the local index reader performance issue we encountered this year, we can simply disable this setting to remove all local index.
If any similar unknown issue happens later, we will need to delete user's indices manually (without the validation logic in our code), or wait for 1 day until the retention job kicks in.
That's the reason I feel it's better to have an API to delete all indices with correct validation logic would make sense. Another alternative is to lower the min value of the delete_after setting to say 1 hour. but the deletion logic will be more complicated since we will need to delete the documents instead of the indices.
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.
That is a good point. I added the ability to immediately delete all local indices by setting delete_after_days = 0. Previously the min value was 1. 0 means no retention period so I think it makes sense to use as a "delete now" option.
|
Let's also create a documentation PR for this, we missed adding the expectation for disabling the local index (i.e. warning: local index will be deleted after you disable local index). We should call this out now in the doc: your index will not be deleted, if you need to delete, do it manually. |
src/test/java/org/opensearch/plugin/insights/core/service/QueryInsightsServiceTests.java
Show resolved
Hide resolved
| * @param client OpenSearch Client | ||
| * @param localIndexExporter the exporter to handle the local index operations | ||
| */ | ||
| void deleteAllTopNIndices(final Client client, final LocalIndexExporter localIndexExporter) { |
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 think one caveat here is, if there are issues with local index exporters, we won't have a quick solution to solve it. like, for the local index reader performance issue we encountered this year, we can simply disable this setting to remove all local index.
If any similar unknown issue happens later, we will need to delete user's indices manually (without the validation logic in our code), or wait for 1 day until the retention job kicks in.
That's the reason I feel it's better to have an API to delete all indices with correct validation logic would make sense. Another alternative is to lower the min value of the delete_after setting to say 1 hour. but the deletion logic will be more complicated since we will need to delete the documents instead of the indices.
|
I have some deeper concerns on the retention policy behavior after this change.
Let's think about even more scenarios: like
IMO we should always enforce the retention job, regardless whether features are enabled, or what type of exporter is enabled. we can also consider adding "none" to delete after , so that people can also disable this retention job. |
409261f to
86e5fe4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #465 +/- ##
============================================
+ Coverage 78.60% 78.85% +0.25%
- Complexity 620 625 +5
============================================
Files 52 53 +1
Lines 2346 2341 -5
Branches 228 226 -2
============================================
+ Hits 1844 1846 +2
+ Misses 381 378 -3
+ Partials 121 117 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I decoupled the logic between the daily deletion job and the active exporter. The daily job now runs every day, regardless of which exporter is enabled. Previously, |
Signed-off-by: David Zane <davizane@amazon.com>
86e5fe4 to
3b178ca
Compare
Description
LocalIndexLifecycleManagerto hold all delete-after state and logicIssues Resolved
Resolves #453
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.