Skip to content

Commit

Permalink
Snapshot status api: make sure headers and request context are handed…
Browse files Browse the repository at this point in the history
… over to inner nodes request

Closes #9409
  • Loading branch information
javanna committed Jan 26, 2015
1 parent 974fafb commit aa6bf5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Expand Up @@ -22,20 +22,18 @@
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.*;
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;
Expand All @@ -61,10 +59,6 @@ public TransportNodesSnapshotsStatus(Settings settings, ClusterName clusterName,
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;
Expand Down Expand Up @@ -155,8 +149,8 @@ static class Request extends NodesOperationRequest<Request> {
public Request() {
}

public Request(String[] nodesIds) {
super(nodesIds);
public Request(ActionRequest request, String[] nodesIds) {
super(request, nodesIds);
}

public Request snapshotIds(SnapshotId[] snapshotIds) {
Expand Down
Expand Up @@ -21,7 +21,6 @@

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;
Expand Down Expand Up @@ -111,8 +110,9 @@ protected void masterOperation(final SnapshotsStatusRequest request,
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 {
Expand Down
Expand Up @@ -43,6 +43,11 @@ protected NodesOperationRequest() {

}

protected NodesOperationRequest(ActionRequest request, String... nodesIds) {
super(request);
this.nodesIds = nodesIds;
}

protected NodesOperationRequest(String... nodesIds) {
this.nodesIds = nodesIds;
}
Expand Down

0 comments on commit aa6bf5f

Please sign in to comment.