Skip to content

Commit 6934934

Browse files
Fix Broken Snapshots in Mixed Clusters (elastic#48993)
Reverts elastic#48947 and fixes the issue orginally addressed by removing the assertion. It turns out we can't simply pass empty shard generations to the snapshot finalization in the BwC case as that results in no indices being added to the meta for the given snapshot since we take the indices from the shard generations (even in the BwC case the `null` generations work fine for this). Closes elastic#48983
1 parent 561351d commit 6934934

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

server/src/main/java/org/elasticsearch/repositories/RepositoryData.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,6 @@ public List<IndexId> resolveNewIndices(final List<String> indicesToResolve) {
315315
* Writes the snapshots metadata and the related indices metadata to x-content.
316316
*/
317317
public XContentBuilder snapshotsToXContent(final XContentBuilder builder, final boolean shouldWriteShardGens) throws IOException {
318-
assert shouldWriteShardGens || shardGenerations.indices().isEmpty() :
319-
"Should not build shard generations in BwC mode but saw generations [" + shardGenerations + "]";
320-
321318
builder.startObject();
322319
// write the snapshots list
323320
builder.startArray(SNAPSHOTS);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,6 @@ 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-
}
600597
ShardGenerations.Builder builder = ShardGenerations.builder();
601598
final Map<String, IndexId> indexLookup = new HashMap<>();
602599
snapshot.indices().forEach(idx -> indexLookup.put(idx.getName(), idx));

0 commit comments

Comments
 (0)