Skip to content

Commit 7b127bf

Browse files
committed
Comments
1 parent 6ccd8ab commit 7b127bf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,13 @@ private void finalizeSnapshotEntry(Snapshot snapshot, Metadata metadata, Reposit
14031403
threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(new SnapshotFinalization(snapshot, metadata, repositoryData));
14041404
}
14051405

1406+
/**
1407+
* Implements the finalization process for a snapshot: does some preparatory calculations, builds a {@link SnapshotInfo} and a
1408+
* {@link FinalizeSnapshotContext}, calls {@link Repository#finalizeSnapshot} and handles the outcome by notifying waiting listeners
1409+
* and triggering the next snapshot-related activity.
1410+
*/
1411+
// This only really makes sense to run against a BlobStoreRepository, and the division of work between this class and
1412+
// BlobStoreRepository#finalizeSnapshot is kind of awkward and artificial; TODO consolidate all this stuff into one place and simplify
14061413
private class SnapshotFinalization extends AbstractRunnable {
14071414

14081415
private final Snapshot snapshot;
@@ -1448,6 +1455,7 @@ protected void doRun() {
14481455
final ListenableFuture<Metadata> metadataListener = new ListenableFuture<>();
14491456
final Repository repo = repositoriesService.repository(snapshot.getRepository());
14501457
if (entry.isClone()) {
1458+
// TODO no need to fork here any more, we're already on a SNAPSHOT thread
14511459
threadPool.executor(ThreadPool.Names.SNAPSHOT).execute(ActionRunnable.supply(metadataListener, () -> {
14521460
final Metadata existing = repo.getSnapshotGlobalMetadata(entry.source());
14531461
final Metadata.Builder metaBuilder = Metadata.builder(existing);

0 commit comments

Comments
 (0)