瀏覽代碼

Fix ShardGenerations in RepositoryData in BwC Case (#48920)

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`.
Armin Braun 6 年之前
父節點
當前提交
13fc45d37f
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

+ 3 - 0
server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

@@ -581,6 +581,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));