diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index f6af38faa67..85a315e4a1b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -264,6 +264,8 @@ Bug Fixes * SOLR-15138: Collection creation for PerReplicaStates does not scale to large collections as well as regular collections (Mike Drob, Ilan Ginzburg, noble, Ishan Chattopadhyaya) +* SOLR-15135: Admin UI display collections with perReplicaState=true in graph view (Timothy Potter) + ================== 8.8.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java index a3cb81d325f..1c54f106e53 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java @@ -42,6 +42,8 @@ import org.apache.lucene.util.BytesRef; import org.apache.solr.cloud.ZkController; import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException.ErrorCode; +import org.apache.solr.common.cloud.ClusterState; +import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.OnReconnect; import org.apache.solr.common.cloud.Replica; import org.apache.solr.common.cloud.SolrZkClient; @@ -516,31 +518,17 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase { pagingSupport.fetchPage(page, zkClient); // keep track of how many collections match the filter boolean applyStatusFilter = (page.filterType == FilterType.status && page.filter != null); - List matchesStatusFilter = applyStatusFilter ? new ArrayList() : null; - Set liveNodes = applyStatusFilter ? - zkController.getZkStateReader().getClusterState().getLiveNodes() : null; + List matchesStatusFilter = applyStatusFilter ? new ArrayList<>() : null; + ClusterState cs = zkController.getZkStateReader().getClusterState(); + Set 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 extColl = (Map) 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? @SuppressWarnings("unchecked") - Map collectionState = (Map)extColl.get(collection); - + Map collectionState = dc.isPerReplicaState() ? (Map)Utils.fromJSONString(Utils.toJSONString(dc)) : dc.getProperties(); if (applyStatusFilter) { // verify this collection matches the filtered state if (page.matchesStatusFilter(collectionState, liveNodes)) {