diff --git a/docs/changelog/90651.yaml b/docs/changelog/90651.yaml new file mode 100644 index 0000000000000..9bbb26772ae4b --- /dev/null +++ b/docs/changelog/90651.yaml @@ -0,0 +1,5 @@ +pr: 90651 +summary: Fork building snapshot status response off of transport thread +area: Snapshot/Restore +type: bug +issues: [] diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java index 5c079d430458e..55e98327a0a47 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java @@ -13,6 +13,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.StepListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.ThreadedActionListener; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.cluster.ClusterState; @@ -90,7 +91,7 @@ public TransportSnapshotsStatusAction( SnapshotsStatusRequest::new, indexNameExpressionResolver, SnapshotsStatusResponse::new, - ThreadPool.Names.SAME + ThreadPool.Names.SNAPSHOT_META // building the response is somewhat expensive for large snapshots so we fork ); this.repositoriesService = repositoriesService; this.client = client; @@ -141,16 +142,22 @@ protected void masterOperation( TransportNodesSnapshotsStatus.TYPE, new TransportNodesSnapshotsStatus.Request(nodesIds.toArray(Strings.EMPTY_ARRAY)).snapshots(snapshots) .timeout(request.masterNodeTimeout()), - ActionListener.wrap( - nodeSnapshotStatuses -> buildResponse( - snapshotsInProgress, - request, - currentSnapshots, - nodeSnapshotStatuses, - cancellableTask, - listener + new ThreadedActionListener<>( + logger, + threadPool, + ThreadPool.Names.SNAPSHOT_META, // fork to snapshot meta since building the response is expensive for large snapshots + ActionListener.wrap( + nodeSnapshotStatuses -> buildResponse( + snapshotsInProgress, + request, + currentSnapshots, + nodeSnapshotStatuses, + cancellableTask, + listener + ), + listener::onFailure ), - listener::onFailure + false ) ); } else {