Skip to content

Commit

Permalink
Return empty version instead of blowing up if we cannot find it (#85244
Browse files Browse the repository at this point in the history
…) (#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.
  • Loading branch information
masseyke committed Mar 23, 2022
1 parent 85435a1 commit f7138ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/85244.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 85244
summary: Return empty version instead of blowing up if we cannot find it
area: Infra/Core
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,9 @@ private Version readMappingVersion(SystemIndexDescriptor descriptor, MappingMeta
return Version.V_EMPTY;
}
return Version.fromString(versionString);
} catch (ElasticsearchParseException e) {
} catch (ElasticsearchParseException | IllegalArgumentException e) {
logger.error(new ParameterizedMessage("Cannot parse the mapping for index [{}]", indexName), e);
throw new ElasticsearchException("Cannot parse the mapping for index [{}]", e, indexName);
} catch (IllegalArgumentException e) {
logger.error(new ParameterizedMessage("Cannot parse the mapping for index [{}]", indexName), e);
throw e;
return Version.V_EMPTY;
}
}

Expand Down

0 comments on commit f7138ac

Please sign in to comment.