Skip to content

Commit 6d148e5

Browse files
committed
also inline
1 parent 1852486 commit 6d148e5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,13 @@ public RepositoryData addSnapshot(
425425
// the new master, so we make the operation idempotent
426426
return this;
427427
}
428-
final var shardGenerations = updatedShardGenerations.liveIndices();
428+
final var liveIndexIds = updatedShardGenerations.liveIndices().indices();
429429
Map<String, SnapshotId> snapshots = new HashMap<>(snapshotIds);
430430
snapshots.put(snapshotId.getUUID(), snapshotId);
431431
Map<String, SnapshotDetails> newSnapshotDetails = new HashMap<>(snapshotsDetails);
432432
newSnapshotDetails.put(snapshotId.getUUID(), details);
433433
Map<IndexId, List<SnapshotId>> allIndexSnapshots = new HashMap<>(indexSnapshots);
434-
for (final IndexId indexId : shardGenerations.indices()) {
434+
for (final IndexId indexId : liveIndexIds) {
435435
final List<SnapshotId> snapshotIds = allIndexSnapshots.get(indexId);
436436
if (snapshotIds == null) {
437437
allIndexSnapshots.put(indexId, List.of(snapshotId));
@@ -447,11 +447,8 @@ public RepositoryData addSnapshot(
447447
: "Index meta generations should have been empty but was [" + indexMetaDataGenerations + "]";
448448
newIndexMetaGenerations = IndexMetaDataGenerations.EMPTY;
449449
} else {
450-
assert indexMetaBlobs.isEmpty() || shardGenerations.indices().equals(indexMetaBlobs.keySet())
451-
: "Shard generations contained indices "
452-
+ shardGenerations.indices()
453-
+ " but indexMetaData was given for "
454-
+ indexMetaBlobs.keySet();
450+
assert indexMetaBlobs.isEmpty() || liveIndexIds.equals(indexMetaBlobs.keySet())
451+
: "Shard generations contained indices " + liveIndexIds + " but indexMetaData was given for " + indexMetaBlobs.keySet();
455452
newIndexMetaGenerations = indexMetaDataGenerations.withAddedSnapshot(snapshotId, indexMetaBlobs, newIdentifiers);
456453
}
457454

0 commit comments

Comments
 (0)