anshumg commented on a change in pull request #2383:
URL: https://github.com/apache/lucene-solr/pull/2383#discussion_r577152606



##########
File path: 
solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
##########
@@ -516,31 +518,17 @@ void printPaginatedCollections() throws IOException {
         pagingSupport.fetchPage(page, zkClient);
         // keep track of how many collections match the filter
         boolean applyStatusFilter = (page.filterType == FilterType.status && 
page.filter != null);
-        List<String> matchesStatusFilter = applyStatusFilter ? new 
ArrayList<String>() : null;
-        Set<String> liveNodes = applyStatusFilter ?
-            zkController.getZkStateReader().getClusterState().getLiveNodes() : 
null;
+        List<String> matchesStatusFilter = applyStatusFilter ? new 
ArrayList<>() : null;
+        ClusterState cs = zkController.getZkStateReader().getClusterState();
+        Set<String> liveNodes = applyStatusFilter ? cs.getLiveNodes() : null;
 
         collectionStates = new TreeMap<>(pagingSupport);
         for (String collection : page.selected) {
-          // Get collection state from ZK
-          String collStatePath = String.format(Locale.ROOT, 
"/collections/%s/state.json", collection);
-          String childDataStr = null;
-          try {
-            byte[] childData = zkClient.getData(collStatePath, null, null, 
true);
-            if (childData != null)
-              childDataStr = (new BytesRef(childData)).utf8ToString();
-          } catch (KeeperException.NoNodeException nne) {
-            log.warn("State for collection {} not found.", collection);
-          } catch (Exception childErr) {
-            log.error("Failed to get {} due to", collStatePath, childErr);
-          }
-
-          if (childDataStr != null) {
-            Map<String, Object> extColl = (Map<String, Object>) 
Utils.fromJSONString(childDataStr);
-            // add the base_url to replica props
+          DocCollection dc = cs.getCollectionOrNull(collection);
+          if (dc != null) {
+            // TODO: for collections with perReplicaState, a ser/deser to JSON 
was needed to get the state to render correctly for the UI?

Review comment:
       I can't understand what the TODO here is. Code cleanup in the future?

##########
File path: 
solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
##########
@@ -516,31 +518,17 @@ void printPaginatedCollections() throws IOException {
         pagingSupport.fetchPage(page, zkClient);
         // keep track of how many collections match the filter
         boolean applyStatusFilter = (page.filterType == FilterType.status && 
page.filter != null);
-        List<String> matchesStatusFilter = applyStatusFilter ? new 
ArrayList<String>() : null;
-        Set<String> liveNodes = applyStatusFilter ?
-            zkController.getZkStateReader().getClusterState().getLiveNodes() : 
null;
+        List<String> matchesStatusFilter = applyStatusFilter ? new 
ArrayList<>() : null;

Review comment:
       should we just move this all into an `if(applyStatusFilter) {...}` block 
for readability? I understand it's not something you changed but while we are 
at it, might make sense?
   




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

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