Skip to content

Apache Lucene open-source search software

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

Anshum Gupta0dca964a5d9d
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java
index 03c7bd47d1c..093524d2642 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java
@@ -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);