[ML] Switch ModelRegistry to return ResourceyAlreadyExistsException instead of ElasticsearchStatusException #137525
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.
This PR is to address an issue where we're seeing an increased number of error logs when storing persisting default inference endpoints.
The issue is that the exception that was returned in this PR: https://github.com/elastic/elasticsearch/pull/136569/files#diff-65fa96c525e72184c64209a9b6fd0f8130a7faf883464cbb21824996837c424cR674
Was causing an error to be logged here: https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/registry/ModelRegistry.java#L452 because we were no longer returning a
ResourceAlreadyExistsException.Testing
I can reproduce this by making multiple calls to
GET _inference/_allat the same time on a newly created cluster. There should be an error log with something like:After the fix, that shouldn't exist anymore (it'll be at a debug level).
You should still see warnings though (I verified that these exist prior to my changes) if you send a bunch of the GET requests at the same time when a cluster is first started.