Skip to content

Commit c45470f

Browse files
Fix ShardGenerations in RepositoryData in BwC Case (elastic#48920) (elastic#48947)
We were tripping the assertion that the makes sure we only have empty `ShardGenerations` in `RepositoryData` in the BwC case because shard generations were passed to the `Repository` in the BwC case. Fixed by only generating empty shard gen for BwC snapshots in `SnapshotsService`.
1 parent 909fbd0 commit c45470f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

+3
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ private void cleanupAfterError(Exception exception) {
594594
}
595595

596596
private static ShardGenerations buildGenerations(SnapshotsInProgress.Entry snapshot) {
597+
if (snapshot.useShardGenerations() == false) {
598+
return ShardGenerations.EMPTY;
599+
}
597600
ShardGenerations.Builder builder = ShardGenerations.builder();
598601
final Map<String, IndexId> indexLookup = new HashMap<>();
599602
snapshot.indices().forEach(idx -> indexLookup.put(idx.getName(), idx));

0 commit comments

Comments
 (0)