aparnasuresh85 commented on code in PR #2599:
URL: https://github.com/apache/solr/pull/2599#discussion_r1704511273


##########
solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java:
##########
@@ -976,7 +980,17 @@ public Map<String, Object> execute(
         CLUSTERSTATUS,
         (req, rsp, h) -> {
           Map<String, Object> all =
-              copy(req.getParams(), null, COLLECTION_PROP, SHARD_ID_PROP, 
_ROUTE_, "prs");
+              copy(

Review Comment:
   Removed the copy, reading params from SolrRequest.getParams in ClusterStatus 
instead.



##########
solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java:
##########
@@ -97,6 +101,55 @@ public ClusterStatus(ZkStateReader zkStateReader, 
ZkNodeProps props) {
 
   public void getClusterStatus(NamedList<Object> results)
       throws KeeperException, InterruptedException {
+    List<String> liveNodes = null;
+    NamedList<Object> clusterStatus = new SimpleOrderedMap<>();
+
+    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 (withCollection) {
+      fetchClusterStatusForCollOrAlias(clusterStatus, liveNodes);
+    }
+
+    Map<String, Object> clusterProps = Collections.emptyMap();
+    if (withClusterProperties) {
+      // read cluster properties
+      clusterProps = zkStateReader.getClusterProperties();
+      if (clusterProps == null || clusterProps.isEmpty()) {
+        clusterProps = Collections.emptyMap();
+      }
+    }
+    clusterStatus.add("properties", clusterProps);
+
+    // add the roles map
+    if (withRoles) {
+      Map<?, ?> roles = null;
+      if (zkStateReader.getZkClient().exists(ZkStateReader.ROLES, true)) {
+        roles =
+            (Map<?, ?>)
+                Utils.fromJSON(
+                    zkStateReader.getZkClient().getData(ZkStateReader.ROLES, 
null, null, true));
+      }
+      if (roles != null) {

Review Comment:
   Updated.



##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java:
##########
@@ -413,4 +412,11 @@ public String getQuorumHosts() {
     }
     return String.join(",", this.liveNodes);
   }
+
+  public enum ClusterStateRequestType {

Review Comment:
   Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to