Skip to content

Commit fef481c

Browse files
Fork building snapshot status response off of transport thread (#90651) (#90664)
This can take O(10s) for tens of thousands of shards, we have to fork it. relates #77466
1 parent 04094e1 commit fef481c

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

docs/changelog/90651.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 90651
2+
summary: Fork building snapshot status response off of transport thread
3+
area: Snapshot/Restore
4+
type: bug
5+
issues: []

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.action.ActionListener;
1414
import org.elasticsearch.action.StepListener;
1515
import org.elasticsearch.action.support.ActionFilters;
16+
import org.elasticsearch.action.support.ThreadedActionListener;
1617
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
1718
import org.elasticsearch.client.internal.node.NodeClient;
1819
import org.elasticsearch.cluster.ClusterState;
@@ -90,7 +91,7 @@ public TransportSnapshotsStatusAction(
9091
SnapshotsStatusRequest::new,
9192
indexNameExpressionResolver,
9293
SnapshotsStatusResponse::new,
93-
ThreadPool.Names.SAME
94+
ThreadPool.Names.SNAPSHOT_META // building the response is somewhat expensive for large snapshots so we fork
9495
);
9596
this.repositoriesService = repositoriesService;
9697
this.client = client;
@@ -141,16 +142,22 @@ protected void masterOperation(
141142
TransportNodesSnapshotsStatus.TYPE,
142143
new TransportNodesSnapshotsStatus.Request(nodesIds.toArray(Strings.EMPTY_ARRAY)).snapshots(snapshots)
143144
.timeout(request.masterNodeTimeout()),
144-
ActionListener.wrap(
145-
nodeSnapshotStatuses -> buildResponse(
146-
snapshotsInProgress,
147-
request,
148-
currentSnapshots,
149-
nodeSnapshotStatuses,
150-
cancellableTask,
151-
listener
145+
new ThreadedActionListener<>(
146+
logger,
147+
threadPool,
148+
ThreadPool.Names.SNAPSHOT_META, // fork to snapshot meta since building the response is expensive for large snapshots
149+
ActionListener.wrap(
150+
nodeSnapshotStatuses -> buildResponse(
151+
snapshotsInProgress,
152+
request,
153+
currentSnapshots,
154+
nodeSnapshotStatuses,
155+
cancellableTask,
156+
listener
157+
),
158+
listener::onFailure
152159
),
153-
listener::onFailure
160+
false
154161
)
155162
);
156163
} else {

0 commit comments

Comments
 (0)