Allow health to be executed on a local node instead of the master

This commit is contained in:
Igor Motov 2013-01-24 18:24:37 -05:00
parent 3c9541dd14
commit ca635deb36
2 changed files with 14 additions and 0 deletions

View File

@ -48,6 +48,8 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
private String waitForNodes = "";
private boolean local = false;
ClusterHealthRequest() {
}
@ -127,6 +129,15 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
return this;
}
public ClusterHealthRequest local(boolean local) {
this.local = local;
return this;
}
public boolean local() {
return this.local;
}
@Override
public ActionRequestValidationException validate() {
return null;
@ -151,6 +162,7 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
waitForRelocatingShards = in.readInt();
waitForActiveShards = in.readInt();
waitForNodes = in.readString();
local = in.readBoolean();
}
@Override
@ -174,5 +186,6 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
out.writeInt(waitForRelocatingShards);
out.writeInt(waitForActiveShards);
out.writeString(waitForNodes);
out.writeBoolean(local);
}
}

View File

@ -51,6 +51,7 @@ public class RestClusterHealthAction extends BaseRestHandler {
@Override
public void handleRequest(final RestRequest request, final RestChannel channel) {
ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(RestActions.splitIndices(request.param("index")));
clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
clusterHealthRequest.listenerThreaded(false);
int level = 0;
try {