iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139176442


##########
solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java:
##########
@@ -143,13 +146,49 @@ public void getClusterStatus(NamedList<Object> results, 
SolrVersion solrVersion)
     results.add("cluster", clusterStatus);
   }
 
-  private void fetchClusterStatusForCollOrAlias(
+  /**
+   * Collections, shards, and replicas selected by this request's {@code 
collection}, {@code shard},
+   * and {@code _route_} parameters.
+   *
+   * <p>Live nodes are read so replica state can be cross-checked, and aliases 
are read so a
+   * collection alias in {@code collection} can be resolved. Each collection 
still lists the aliases
+   * that point at it. The live-node list, the alias map, and cluster 
properties are not returned.
+   */
+  public Map<String, Object> getCollectionStatuses() throws KeeperException, 
InterruptedException {
+    List<String> liveNodes =
+        
zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null);
+    Aliases aliases = zkStateReader.getAliases();
+    Map<String, Object> collections = new LinkedHashMap<>();
+    forEachCollectionStatus(
+        liveNodes, aliases, (name, status) -> collections.put(name, 
copyForJackson(status)));
+    return collections;
+  }
+
+  private void addCollectionStatuses(
       NamedList<Object> clusterStatus,
       List<String> liveNodes,
       Aliases aliases,
       SolrVersion solrVersion) {
+    // Resolve the collection list now so a missing name fails the request, 
rather than during
+    // response writing. The per-collection JSON is still built while the 
response is written.
+    PreparedCollections prepared = prepareCollections(aliases);
+    if (solrVersion == null || 
solrVersion.greaterThanOrEqualTo(SolrVersion.valueOf("9.9.0"))) {

Review Comment:
   thsi is pre-existing, from SOLR-17582.. it streams collections as a 
MapWriter for SolrJ 9.9+, and falls back to a NamedList for older clients. not 
a rolling-upgrade feature of this change... just left that path alone.



-- 
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