-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[ML] Check if the anomaly results index has been rolled over #125404
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
# Conflicts: # x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAnomaliesIndexUpdate.java
Pinging @elastic/ml-core (Team:ML) |
Hi @davidkyle, I've created a changelog YAML for you. |
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.
Looks good. I have primarily cosmetic comments.
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAnomaliesIndexUpdate.java
Show resolved
Hide resolved
* Strip any suffix from the index name and find any other indices | ||
* that match the base name. Then return the latest index from the | ||
* matching ones. |
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 this doesn't have to be in the Javadoc. The name explains well enough what behavior is expected from the function. You can put this comment inside the function implementation.
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAnomaliesIndexUpdate.java
Show resolved
Hide resolved
metadata.put(createSharedResultsIndex(".ml-anomalies-custom-foo", IndexVersion.current(), List.of("job1"))); | ||
metadata.put(createSharedResultsIndex(".ml-anomalies-custom-bar", IndexVersion.current(), List.of("job2"))); | ||
metadata.put(createSharedResultsIndex(".ml-anomalies-custom-bax", IndexVersion.current(), List.of("job3"))); |
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.
Maybe you can refactor and extract the method here to reduce code duplication.
…#125404) If the v7 index has already been rolled over don't try again
…#125404) If the v7 index has already been rolled over don't try again
…#125404) If the v7 index has already been rolled over don't try again
#125786) If the v7 index has already been rolled over don't try again
#125785) If the v7 index has already been rolled over don't try again
…#125404) (elastic#125786) If the v7 index has already been rolled over don't try again
#125784) If the v7 index has already been rolled over don't try again
The ML upgrade code automatically rolls over legacy v7 indices however it should not be rolling over indices that have already been rolled. This PR adds a check against that case and makes the rollover command more robust by handling
ResourceAlreadyExists
exceptions (index has already been rolled over) as not an error.This PR is opened against the 8.18 branch so the upgrade tests will start with a 7.last cluster.