Fix ShardGenerations in RepositoryData in BwC Case (#48920) (#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`.
This commit is contained in:
Armin Braun 2019-11-11 18:02:53 +01:00 committed by GitHub
parent 909fbd0015
commit c45470f84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -594,6 +594,9 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
}
private static ShardGenerations buildGenerations(SnapshotsInProgress.Entry snapshot) {
if (snapshot.useShardGenerations() == false) {
return ShardGenerations.EMPTY;
}
ShardGenerations.Builder builder = ShardGenerations.builder();
final Map<String, IndexId> indexLookup = new HashMap<>();
snapshot.indices().forEach(idx -> indexLookup.put(idx.getName(), idx));