Skip to content
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

Return empty version instead of blowing up if we cannot find it #85244

Merged

Conversation

masseyke
Copy link
Member

In SystemIndexManager.readMappingVersion(), we currently throw an exception in a few cases if we cannot find a valid version. For example in some really old versions of certain system indices we see version numbers like 7090399. This causes a stack trace like:

[2022-03-21T00:15:08,643][ERROR][o.e.i.SystemIndexManager ] [mxfuobey] Cannot parse the mapping for index [.ml-meta]
java.lang.IllegalArgumentException: the version needs to contain major, minor, and revision, and optionally the build: 7090399
        at org.elasticsearch.Version.fromStringSlow(Version.java:293) ~[elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.Version.fromString(Version.java:283) ~[elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.indices.SystemIndexManager.readMappingVersion(SystemIndexManager.java:331) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.indices.SystemIndexManager.checkIndexMappingUpToDate(SystemIndexManager.java:284) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.indices.SystemIndexManager.calculateIndexState(SystemIndexManager.java:253) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.indices.SystemIndexManager.getUpgradeStatus(SystemIndexManager.java:163) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.indices.SystemIndexManager.clusterChanged(SystemIndexManager.java:105) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateListener(ClusterApplierService.java:573) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService.callClusterStateListeners(ClusterApplierService.java:559) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService.applyChanges(ClusterApplierService.java:519) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService.runTask(ClusterApplierService.java:428) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService.access$000(ClusterApplierService.java:56) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.cluster.service.ClusterApplierService$UpdateTask.run(ClusterApplierService.java:154) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:718) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:262) [elasticsearch-7.17.1.jar:7.17.1]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:225) [elasticsearch-7.17.1.jar:7.17.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]

This exception causes downstream failures. This PR changes it to just return an empty version (which is what we already do in several other places).

@masseyke masseyke added >bug :Core/Infra/Core Core issues without another label auto-backport-and-merge Automatically create backport pull requests and merge when ready v8.2.0 v8.0.2 v7.17.2 v8.1.2 labels Mar 22, 2022
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Mar 22, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @masseyke, I've created a changelog YAML for you.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@masseyke masseyke merged commit 571f4f8 into elastic:master Mar 23, 2022
@masseyke masseyke deleted the fix/avoid-exceptions-on-bad-mappings branch March 23, 2022 13:04
masseyke added a commit to masseyke/elasticsearch that referenced this pull request Mar 23, 2022
…tic#85244)

SystemIndexManager.readMappingVersion() throws an exception in a few cases if we cannot find a valid version. For example in some really old versions of certain system indices we see version numbers like 7090399. This commit changes that method to return an empty version instead.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
7.17
8.1

masseyke added a commit to masseyke/elasticsearch that referenced this pull request Mar 23, 2022
…tic#85244)

SystemIndexManager.readMappingVersion() throws an exception in a few cases if we cannot find a valid version. For example in some really old versions of certain system indices we see version numbers like 7090399. This commit changes that method to return an empty version instead.
elasticsearchmachine pushed a commit that referenced this pull request Mar 23, 2022
…) (#85272)

SystemIndexManager.readMappingVersion() throws an exception in a few cases if we cannot find a valid version. For example in some really old versions of certain system indices we see version numbers like 7090399. This commit changes that method to return an empty version instead.
elasticsearchmachine pushed a commit that referenced this pull request Mar 23, 2022
…) (#85271)

SystemIndexManager.readMappingVersion() throws an exception in a few cases if we cannot find a valid version. For example in some really old versions of certain system indices we see version numbers like 7090399. This commit changes that method to return an empty version instead.
@williamrandolph
Copy link
Contributor

Looks good! Thanks for catching this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready >bug :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team v7.17.2 v8.1.2 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants