Skip to content

Commit 0992956

Browse files
authored
(cherry picked from commit 3ec1d12)
1 parent 3e4a417 commit 0992956

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
@@ -1129,20 +1129,14 @@ private void runWithUniqueShardMetadataNaming(ActionListener<RepositoryData> rep
11291129
);
11301130
})
11311131

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

11471141
.addListener(repositoryDataUpdateListener);
11481142
}

0 commit comments

Comments
 (0)