Reverts #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 #48983
This commit is contained in:
parent
1903505a3f
commit
0e1035241d
|
@ -315,9 +315,6 @@ public final class RepositoryData {
|
|||
* Writes the snapshots metadata and the related indices metadata to x-content.
|
||||
*/
|
||||
public XContentBuilder snapshotsToXContent(final XContentBuilder builder, final boolean shouldWriteShardGens) throws IOException {
|
||||
assert shouldWriteShardGens || shardGenerations.indices().isEmpty() :
|
||||
"Should not build shard generations in BwC mode but saw generations [" + shardGenerations + "]";
|
||||
|
||||
builder.startObject();
|
||||
// write the snapshots list
|
||||
builder.startArray(SNAPSHOTS);
|
||||
|
|
|
@ -594,9 +594,6 @@ 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));
|
||||
|
|
Loading…
Reference in New Issue