Skip to content

Commit

Permalink
Logging index name on unfound mapping hash (elastic#101499)
Browse files Browse the repository at this point in the history
  • Loading branch information
ywangd authored Oct 30, 2023
1 parent 26fcb82 commit 43ed676
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,9 @@ public static IndexMetadata fromXContent(XContentParser parser, Map<String, Mapp
case KEY_MAPPINGS_HASH -> {
assert mappingsByHash != null : "no deduplicated mappings given";
if (mappingsByHash.containsKey(parser.text()) == false) {
throw new IllegalArgumentException("mapping with hash [" + parser.text() + "] not found");
throw new IllegalArgumentException(
"mapping of index [" + builder.index + "] with hash [" + parser.text() + "] not found"
);
}
builder.putMapping(mappingsByHash.get(parser.text()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ public void testFailsIfMappingIsMissing() throws IOException {
final String message = expectThrows(CorruptStateException.class, () -> persistedClusterStateService.loadBestOnDiskState())
.getCause()
.getMessage();
assertEquals("java.lang.IllegalArgumentException: mapping with hash [" + hash + "] not found", message);
assertEquals("java.lang.IllegalArgumentException: mapping of index [test-1] with hash [" + hash + "] not found", message);
}
}

Expand Down

0 comments on commit 43ed676

Please sign in to comment.