SOLR-7385: The clusterstatus API now returns the config set used to create a collection inside a 'configName' key

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1673360 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-04-14 05:25:12 +00:00
parent 0e54a26d18
commit 53c80b10cf
3 changed files with 14 additions and 1 deletions

View File

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

View File

@ -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);
}
}

View File

@ -162,8 +162,10 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
assertNotNull("Cluster state should not be null", cluster);
NamedList<Object> collections = (NamedList<Object>) cluster.get("collections");
assertNotNull("Collections should not be null in cluster state", collections);
assertNotNull(collections.get(COLLECTION_NAME));
assertEquals(1, collections.size());
Map<String, Object> collection = (Map<String, Object>) 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<String, Object> collection = (Map<String, Object>) collections.get(DEFAULT_COLLECTION);
assertEquals("conf1", collection.get("configName"));
Map<String, Object> shardStatus = (Map<String, Object>) collection.get("shards");
assertEquals(1, shardStatus.size());
Map<String, Object> selectedShardStatus = (Map<String, Object>) 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<String, Object> collection = (Map<String, Object>) collections.get(DEFAULT_COLLECTION);
assertEquals("conf1", collection.get("configName"));
List<String> collAlias = (List<String>) collection.get("aliases");
assertEquals("Aliases not found", Lists.newArrayList("myalias"), collAlias);
}