SOLR-11126: Reduce logging to debug, and remove the call to updateLiveNodes on every call

This commit is contained in:
Anshum Gupta 2017-08-07 15:45:38 -07:00
parent bf168ad37e
commit 0dca964a5d
1 changed files with 7 additions and 13 deletions

View File

@ -65,7 +65,7 @@ public class HealthCheckHandler extends RequestHandlerBase {
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
log.info("Invoked HealthCheckHandler on [{}]", coreContainer.getZkController().getNodeName());
log.debug("Invoked HealthCheckHandler on [{}]", coreContainer.getZkController().getNodeName());
CoreContainer cores = getCoreContainer();
if(cores == null) {
@ -73,6 +73,7 @@ public class HealthCheckHandler extends RequestHandlerBase {
return;
}
if(!cores.isZooKeeperAware()) {
//TODO: Support standalone instances
rsp.setException(new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Health check is only available when running in SolrCloud mode"));
return;
}
@ -85,19 +86,12 @@ public class HealthCheckHandler extends RequestHandlerBase {
return;
}
try {
zkStateReader.updateLiveNodes();
// Set status to true if this node is in live_nodes
if (clusterState.getLiveNodes().contains(cores.getZkController().getNodeName())) {
rsp.add(STATUS, OK);
} else {
rsp.add(STATUS, FAILURE);
rsp.setException(new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Host Unavailable: Not in live nodes as per zk"));
}
} catch (KeeperException e) {
// Set status to true if this node is in live_nodes
if (clusterState.getLiveNodes().contains(cores.getZkController().getNodeName())) {
rsp.add(STATUS, OK);
} else {
rsp.add(STATUS, FAILURE);
rsp.setException(new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Host Unavailable: Not connected to zk"));
rsp.setException(new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Host Unavailable: Not in live nodes as per zk"));
}
rsp.setHttpCaching(false);