diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 3aedf015f25..a9c6a11706f 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -108,6 +108,9 @@ Bug Fixes * SOLR-7380: SearchHandler should not try to load runtime components in inform() (Noble Paul) +* SOLR-7385: The clusterstatus API now returns the config set used to create a collection + inside a 'configName' key. (Shai Erera, shalin) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java index 8367f37177d..fe8aac3a051 100644 --- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java +++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java @@ -823,6 +823,8 @@ public class OverseerCollectionProcessor implements Runnable, Closeable { 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); } } else { @@ -839,6 +841,8 @@ public class OverseerCollectionProcessor implements Runnable, Closeable { if (collectionVsAliases.containsKey(collection) && !collectionVsAliases.get(collection).isEmpty()) { collectionStatus.put("aliases", collectionVsAliases.get(collection)); } + String configName = zkStateReader.readConfigName(collection); + collectionStatus.put("configName", configName); collectionProps.add(collection, collectionStatus); } else { DocCollection coll = clusterState.getCollection(collection); @@ -855,6 +859,8 @@ public class OverseerCollectionProcessor implements Runnable, Closeable { if (collectionVsAliases.containsKey(collection) && !collectionVsAliases.get(collection).isEmpty()) { collectionStatus.put("aliases", collectionVsAliases.get(collection)); } + String configName = zkStateReader.readConfigName(collection); + collectionStatus.put("configName", configName); collectionProps.add(collection, collectionStatus); } } diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java index 0de7e761afa..19187a7a24c 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java @@ -162,8 +162,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase { assertNotNull("Cluster state should not be null", cluster); NamedList collections = (NamedList) cluster.get("collections"); assertNotNull("Collections should not be null in cluster state", collections); - assertNotNull(collections.get(COLLECTION_NAME)); assertEquals(1, collections.size()); + Map collection = (Map) collections.get(COLLECTION_NAME); + assertNotNull(collection); + assertEquals("conf1", collection.get("configName")); } } @@ -189,6 +191,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase { assertNotNull(collections.get(DEFAULT_COLLECTION)); assertEquals(1, collections.size()); Map collection = (Map) collections.get(DEFAULT_COLLECTION); + assertEquals("conf1", collection.get("configName")); Map shardStatus = (Map) collection.get("shards"); assertEquals(1, shardStatus.size()); Map selectedShardStatus = (Map) shardStatus.get(SHARD2); @@ -225,6 +228,7 @@ public class TestCollectionAPI extends ReplicaPropertiesBase { assertNotNull("Collections should not be null in cluster state", collections); assertNotNull(collections.get(DEFAULT_COLLECTION)); Map collection = (Map) collections.get(DEFAULT_COLLECTION); + assertEquals("conf1", collection.get("configName")); List collAlias = (List) collection.get("aliases"); assertEquals("Aliases not found", Lists.newArrayList("myalias"), collAlias); }