Skip to content

Commit f73d2d4

Browse files
authored
(cherry picked from commit 3ec1d12)
1 parent 21c2c30 commit f73d2d4

File tree

4 files changed

+7
-26
lines changed

4 files changed

+7
-26
lines changed

docs/changelog/122047.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

server/src/internalClusterTest/java/org/elasticsearch/snapshots/RepositoriesIT.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,6 @@ public void taskSucceeded(ClusterStateTaskListener clusterStateTaskListener, Obj
508508
.orElseThrow()
509509
.queue();
510510

511-
// There is one task in the queue for computing and forking the cleanup work.
512-
assertThat(queueLength.getAsInt(), equalTo(1));
513-
514-
safeAwait(barrier); // unblock the barrier thread and let it process the queue
515-
safeAwait(barrier); // wait for the queue to be processed
516-
517511
// There are indexCount (=3*snapshotPoolSize) index-deletion tasks, plus one for cleaning up the root metadata. However, the
518512
// throttled runner only enqueues one task per SNAPSHOT thread to start with, and then the eager runner adds another one. This shows
519513
// we are not spamming the threadpool with all the tasks at once, which means that other snapshot activities can run alongside this

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.snapshots.SnapshotInfo;
3030
import org.elasticsearch.snapshots.SnapshotState;
3131
import org.elasticsearch.snapshots.SnapshotsService;
32-
import org.elasticsearch.threadpool.ThreadPool;
3332
import org.elasticsearch.xcontent.XContentBuilder;
3433
import org.elasticsearch.xcontent.XContentParser;
3534

@@ -378,7 +377,6 @@ private static boolean isIndexToUpdateAfterRemovingSnapshots(
378377
* @return map of index to index metadata blob id to delete
379378
*/
380379
public Map<IndexId, Collection<String>> indexMetaDataToRemoveAfterRemovingSnapshots(Collection<SnapshotId> snapshotIds) {
381-
assert ThreadPool.assertCurrentThreadPool(ThreadPool.Names.SNAPSHOT);
382380
Iterator<IndexId> indicesForSnapshot = indicesToUpdateAfterRemovingSnapshot(snapshotIds);
383381
final Set<String> allRemainingIdentifiers = indexMetaDataGenerations.lookup.entrySet()
384382
.stream()

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,20 +1134,14 @@ private void runWithUniqueShardMetadataNaming(ActionListener<RepositoryData> rep
11341134
);
11351135
})
11361136

1137-
.<RepositoryData>andThen(
1138-
// writeIndexGen finishes on master-service thread so must fork here.
1139-
snapshotExecutor,
1140-
threadPool.getThreadContext(),
1141-
(l, newRepositoryData) -> {
1142-
l.onResponse(newRepositoryData);
1143-
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot
1144-
// deletion
1145-
try (var refs = new RefCountingRunnable(onCompletion)) {
1146-
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1147-
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
1148-
}
1137+
.<RepositoryData>andThen((l, newRepositoryData) -> {
1138+
l.onResponse(newRepositoryData);
1139+
// Once we have updated the repository, run the unreferenced blobs cleanup in parallel to shard-level snapshot deletion
1140+
try (var refs = new RefCountingRunnable(onCompletion)) {
1141+
cleanupUnlinkedRootAndIndicesBlobs(newRepositoryData, refs.acquireListener());
1142+
cleanupUnlinkedShardLevelBlobs(refs.acquireListener());
11491143
}
1150-
)
1144+
})
11511145

11521146
.addListener(repositoryDataUpdateListener);
11531147
}

0 commit comments

Comments
 (0)