You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/02/16 22:01:47 UTC

[GitHub] [lucene-solr] thelabdude commented on a change in pull request #2383: SOLR-15135: Use DocCollection to generate state.json format expected by UI to work with perReplicaState collections.

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



##########
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:
       The TODO is a question for those that understand the `perReplicaState` code better to comment on ;-)
   
   @chatman or @noblepaul I tried just using `dc.getProperties()` but the state of the collection did not render correctly in the UI for `perReplicaState=true` collections. But, as you can see ... a ser to JSON and back to a Map ends up having the correct state in the UI for test collections. Any thoughts on that?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org