[ML] Check if the anomaly results index has been rolled over#125404
Merged
davidkyle merged 4 commits intoelastic:8.18from Mar 27, 2025
Merged
[ML] Check if the anomaly results index has been rolled over#125404davidkyle merged 4 commits intoelastic:8.18from
davidkyle merged 4 commits intoelastic:8.18from
Conversation
# Conflicts: # x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAnomaliesIndexUpdate.java
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
Collaborator
|
Hi @davidkyle, I've created a changelog YAML for you. |
valeriy42
approved these changes
Mar 21, 2025
Contributor
valeriy42
left a comment
There was a problem hiding this comment.
Looks good. I have primarily cosmetic comments.
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAnomaliesIndexUpdate.java
Show resolved
Hide resolved
Comment on lines
+258
to
+260
| * 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. |
Contributor
There was a problem hiding this comment.
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
Comment on lines
+185
to
+187
| 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"))); |
Contributor
There was a problem hiding this comment.
Maybe you can refactor and extract the method here to reduce code duplication.
davidkyle
added a commit
to davidkyle/elasticsearch
that referenced
this pull request
Mar 27, 2025
…#125404) If the v7 index has already been rolled over don't try again
This was referenced Mar 27, 2025
davidkyle
added a commit
to davidkyle/elasticsearch
that referenced
this pull request
Mar 27, 2025
…#125404) If the v7 index has already been rolled over don't try again
Collaborator
davidkyle
added a commit
to davidkyle/elasticsearch
that referenced
this pull request
Mar 27, 2025
…#125404) If the v7 index has already been rolled over don't try again
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 27, 2025
#125786) If the v7 index has already been rolled over don't try again
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 27, 2025
#125785) If the v7 index has already been rolled over don't try again
omricohenn
pushed a commit
to omricohenn/elasticsearch
that referenced
this pull request
Mar 28, 2025
…#125404) (elastic#125786) If the v7 index has already been rolled over don't try again
elasticsearchmachine
pushed a commit
that referenced
this pull request
Apr 3, 2025
#125784) If the v7 index has already been rolled over don't try again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
ResourceAlreadyExistsexceptions (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.