From 6b2d176e4837e1969956d65de1f5279322d362d7 Mon Sep 17 00:00:00 2001 From: Varun Thacker Date: Thu, 3 Mar 2016 16:31:10 +0530 Subject: [PATCH] SOLR-8780: Remove unused OverseerCollectionMessageHandler#getClusterStatus method --- solr/CHANGES.txt | 2 + .../OverseerCollectionMessageHandler.java | 108 ------------------ 2 files changed, 2 insertions(+), 108 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 41aa0c969ed..c48ebc57009 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -371,6 +371,8 @@ Other Changes * SOLR-8764: Remove all deprecated methods and classes from master prior to the 6.0 release. (Steve Rowe) +* SOLR-8780: Remove unused OverseerCollectionMessageHandler#getClusterStatus method. (Varun Thacker) + ================== 5.5.1 ================== Bug Fixes diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java index 401409ad942..2f7a14edf8d 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionMessageHandler.java @@ -451,114 +451,6 @@ public class OverseerCollectionMessageHandler implements OverseerMessageHandler } - @SuppressWarnings("unchecked") - private void getClusterStatus(ClusterState clusterState, ZkNodeProps message, NamedList results) throws KeeperException, InterruptedException { - String collection = message.getStr(ZkStateReader.COLLECTION_PROP); - - // read aliases - Aliases aliases = zkStateReader.getAliases(); - Map> collectionVsAliases = new HashMap<>(); - Map aliasVsCollections = aliases.getCollectionAliasMap(); - if (aliasVsCollections != null) { - for (Map.Entry entry : aliasVsCollections.entrySet()) { - List colls = StrUtils.splitSmart(entry.getValue(), ','); - String alias = entry.getKey(); - for (String coll : colls) { - if (collection == null || collection.equals(coll)) { - List list = collectionVsAliases.get(coll); - if (list == null) { - list = new ArrayList<>(); - collectionVsAliases.put(coll, list); - } - list.add(alias); - } - } - } - } - - Map roles = null; - if (zkStateReader.getZkClient().exists(ZkStateReader.ROLES, true)) { - roles = (Map) Utils.fromJSON(zkStateReader.getZkClient().getData(ZkStateReader.ROLES, null, null, true)); - } - - // convert cluster state into a map of writable types - byte[] bytes = Utils.toJSON(clusterState); - Map stateMap = (Map) Utils.fromJSON(bytes); - - Set collections = new HashSet<>(); - String routeKey = message.getStr(ShardParams._ROUTE_); - String shard = message.getStr(ZkStateReader.SHARD_ID_PROP); - if (collection == null) { - collections = new HashSet<>(clusterState.getCollections()); - } else { - collections = Collections.singleton(collection); - } - - NamedList collectionProps = new SimpleOrderedMap(); - - for (String name : collections) { - Map collectionStatus = null; - DocCollection clusterStateCollection = clusterState.getCollection(name); - - Set requestedShards = new HashSet<>(); - if (routeKey != null) { - DocRouter router = clusterStateCollection.getRouter(); - Collection slices = router.getSearchSlices(routeKey, null, clusterStateCollection); - for (Slice slice : slices) { - requestedShards.add(slice.getName()); - } - } - if (shard != null) { - requestedShards.add(shard); - } - - if (clusterStateCollection.getStateFormat() > 1) { - bytes = Utils.toJSON(clusterStateCollection); - Map docCollection = (Map) Utils.fromJSON(bytes); - collectionStatus = getCollectionStatus(docCollection, name, requestedShards); - } else { - collectionStatus = getCollectionStatus((Map) stateMap.get(name), name, requestedShards); - } - - collectionStatus.put("znodeVersion", clusterStateCollection.getZNodeVersion()); - if (collectionVsAliases.containsKey(name) && !collectionVsAliases.get(name).isEmpty()) { - collectionStatus.put("aliases", collectionVsAliases.get(name)); - } - String configName = zkStateReader.readConfigName(name); - collectionStatus.put("configName", configName); - collectionProps.add(name, collectionStatus); - } - - List liveNodes = zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null, true); - - // now we need to walk the collectionProps tree to cross-check replica state with live nodes - crossCheckReplicaStateWithLiveNodes(liveNodes, collectionProps); - - NamedList clusterStatus = new SimpleOrderedMap<>(); - clusterStatus.add("collections", collectionProps); - - // read cluster properties - Map clusterProps = zkStateReader.getClusterProps(); - if (clusterProps != null && !clusterProps.isEmpty()) { - clusterStatus.add("properties", clusterProps); - } - - // add the alias map too - if (aliasVsCollections != null && !aliasVsCollections.isEmpty()) { - clusterStatus.add("aliases", aliasVsCollections); - } - - // add the roles map - if (roles != null) { - clusterStatus.add("roles", roles); - } - - // add live_nodes - clusterStatus.add("live_nodes", liveNodes); - - results.add("cluster", clusterStatus); - } - /** * Walks the tree of collection status to verify that any replicas not reporting a "down" status is * on a live node, if any replicas reporting their status as "active" but the node is not live is