Snapshot status api: make sure headers and request context are handed over to inner nodes request
Closes #9409
This commit is contained in:
parent
974fafb2da
commit
aa6bf5fd1d
|
@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.FailedNodeException;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.nodes.*;
|
||||
|
@ -30,12 +30,10 @@ import org.elasticsearch.cluster.ClusterName;
|
|||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.metadata.SnapshotId;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus;
|
||||
import org.elasticsearch.snapshots.SnapshotsService;
|
||||
|
@ -61,10 +59,6 @@ public class TransportNodesSnapshotsStatus extends TransportNodesOperationAction
|
|||
this.snapshotsService = snapshotsService;
|
||||
}
|
||||
|
||||
public void status(String[] nodesIds, SnapshotId[] snapshotIds, @Nullable TimeValue timeout, ActionListener<NodesSnapshotStatus> listener) {
|
||||
execute(new Request(nodesIds).snapshotIds(snapshotIds).timeout(timeout), listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String executor() {
|
||||
return ThreadPool.Names.GENERIC;
|
||||
|
@ -155,8 +149,8 @@ public class TransportNodesSnapshotsStatus extends TransportNodesOperationAction
|
|||
public Request() {
|
||||
}
|
||||
|
||||
public Request(String[] nodesIds) {
|
||||
super(nodesIds);
|
||||
public Request(ActionRequest request, String[] nodesIds) {
|
||||
super(request, nodesIds);
|
||||
}
|
||||
|
||||
public Request snapshotIds(SnapshotId[] snapshotIds) {
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -111,8 +110,9 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeOperation
|
|||
snapshotIds[i] = currentSnapshots.get(i).snapshotId();
|
||||
}
|
||||
|
||||
transportNodesSnapshotsStatus.status(nodesIds.toArray(new String[nodesIds.size()]),
|
||||
snapshotIds, request.masterNodeTimeout(), new ActionListener<TransportNodesSnapshotsStatus.NodesSnapshotStatus>() {
|
||||
TransportNodesSnapshotsStatus.Request nodesRequest = new TransportNodesSnapshotsStatus.Request(request, nodesIds.toArray(new String[nodesIds.size()]))
|
||||
.snapshotIds(snapshotIds).timeout(request.masterNodeTimeout());
|
||||
transportNodesSnapshotsStatus.execute(nodesRequest, new ActionListener<TransportNodesSnapshotsStatus.NodesSnapshotStatus>() {
|
||||
@Override
|
||||
public void onResponse(TransportNodesSnapshotsStatus.NodesSnapshotStatus nodeSnapshotStatuses) {
|
||||
try {
|
||||
|
|
|
@ -43,6 +43,11 @@ public abstract class NodesOperationRequest<T extends NodesOperationRequest> ext
|
|||
|
||||
}
|
||||
|
||||
protected NodesOperationRequest(ActionRequest request, String... nodesIds) {
|
||||
super(request);
|
||||
this.nodesIds = nodesIds;
|
||||
}
|
||||
|
||||
protected NodesOperationRequest(String... nodesIds) {
|
||||
this.nodesIds = nodesIds;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue