Skip to content

Commit ce88b2c

Browse files
committed
tweak
1 parent efdeaed commit ce88b2c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,9 +1457,9 @@ protected void doRun() {
14571457
SnapshotsInProgress.Entry entry = SnapshotsInProgress.get(clusterService.state()).snapshot(snapshot);
14581458
final String failure = entry.failure();
14591459
logger.trace("[{}] finalizing snapshot in repository, state: [{}], failure[{}]", snapshot, entry.state(), failure);
1460-
final var snapshotShardGenerations = buildGenerations(entry, metadata);
1461-
final ShardGenerations updatedShardGenerations = snapshotShardGenerations.liveIndices();
1462-
final List<String> finalIndices = updatedShardGenerations.indices().stream().map(IndexId::getName).toList();
1460+
final var updatedShardGenerations = buildGenerations(entry, metadata);
1461+
final ShardGenerations updatedShardGensForLiveIndices = updatedShardGenerations.liveIndices();
1462+
final List<String> finalIndices = updatedShardGensForLiveIndices.indices().stream().map(IndexId::getName).toList();
14631463
final Set<String> indexNames = new HashSet<>(finalIndices);
14641464
ArrayList<SnapshotShardFailure> shardFailures = new ArrayList<>();
14651465
for (Map.Entry<RepositoryShardId, ShardSnapshotStatus> shardStatus : entry.shardSnapshotStatusByRepoShardId().entrySet()) {
@@ -1556,7 +1556,7 @@ protected void doRun() {
15561556
entry.partial() ? onlySuccessfulFeatureStates(entry, finalIndices) : entry.featureStates(),
15571557
failure,
15581558
threadPool.absoluteTimeInMillis(),
1559-
entry.partial() ? updatedShardGenerations.totalShards() : entry.shardSnapshotStatusByRepoShardId().size(),
1559+
entry.partial() ? updatedShardGensForLiveIndices.totalShards() : entry.shardSnapshotStatusByRepoShardId().size(),
15601560
shardFailures,
15611561
entry.includeGlobalState(),
15621562
entry.userMetadata(),
@@ -1566,7 +1566,7 @@ protected void doRun() {
15661566
final ListenableFuture<List<ActionListener<SnapshotInfo>>> snapshotListeners = new ListenableFuture<>();
15671567
repo.finalizeSnapshot(
15681568
new FinalizeSnapshotContext(
1569-
snapshotShardGenerations,
1569+
updatedShardGenerations,
15701570
repositoryData.getGenId(),
15711571
metaForSnapshot,
15721572
snapshotInfo,
@@ -1583,7 +1583,7 @@ protected void doRun() {
15831583
snapshot,
15841584
repositoryData,
15851585
// we might have written the new root blob before failing here, so we must use the updated shardGenerations
1586-
snapshotShardGenerations
1586+
updatedShardGenerations
15871587
)
15881588
),
15891589
() -> snapshotListeners.addListener(new ActionListener<>() {
@@ -1608,7 +1608,7 @@ public void onFailure(Exception e) {
16081608
repositoryData,
16091609
// a failure here means the root blob was not updated, but the updated shard generation blobs are all in place so we can
16101610
// use the updated shardGenerations for all pending shard snapshots
1611-
snapshotShardGenerations
1611+
updatedShardGenerations
16121612
)
16131613
));
16141614
}

0 commit comments

Comments
 (0)