aparnasuresh85 commented on code in PR #2599: URL: https://github.com/apache/solr/pull/2599#discussion_r1704678248
########## solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java: ########## @@ -96,39 +96,43 @@ public static Health combine(Collection<Health> states) { public ClusterStatus(ZkStateReader zkStateReader, ZkNodeProps props) { this.zkStateReader = zkStateReader; this.message = props; - collectionParam = props.getStr(ZkStateReader.COLLECTION_PROP); - liveNodesParam = props.getBool(ZkStateReader.LIVENODES_PROP, false); - clusterPropertiesParam = props.getBool(ZkStateReader.CLUSTER_PROP, false); - rolesParam = props.getBool(ZkStateReader.ROLES_PROP, false); - includeAll = props.getBool(ZkStateReader.INCLUDE_ALL, true); + collection = props.getStr(ZkStateReader.COLLECTION_PROP); } public void getClusterStatus(NamedList<Object> results) throws KeeperException, InterruptedException { - List<String> liveNodes = null; NamedList<Object> clusterStatus = new SimpleOrderedMap<>(); - if (includeAll || collectionParam != null || liveNodesParam) { + + boolean includeAll = this.message.getBool(INCLUDE_ALL, true); + boolean withLiveNodes = + this.message.getBool(LIVENODES_PROP, includeAll) || (collection != null); + boolean withClusterProperties = this.message.getBool(CLUSTER_PROP, includeAll); + boolean withRoles = this.message.getBool(ZkStateReader.ROLES_PROP, includeAll); + boolean withCollection = includeAll || (collection != null); + + if (withLiveNodes) { liveNodes = zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true); // add live_nodes clusterStatus.add("live_nodes", liveNodes); } - - if (includeAll || collectionParam != null) + if (withCollection) { fetchClusterStatusForCollOrAlias(clusterStatus, liveNodes); + } - if (includeAll || clusterPropertiesParam) { + Map<String, Object> clusterProps = Collections.emptyMap(); + if (withClusterProperties) { // read cluster properties - Map<String, Object> clusterProps = zkStateReader.getClusterProperties(); - if (clusterProps != null && !clusterProps.isEmpty()) { - clusterStatus.add("properties", clusterProps); + clusterProps = zkStateReader.getClusterProperties(); + if (clusterProps == null || clusterProps.isEmpty()) { + clusterProps = Collections.emptyMap(); } } + clusterStatus.add("properties", clusterProps); Review Comment: Should be visible now -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org