SOLR-7049: LIST Collections API call should be processed directly by the CollectionsHandler instead of the OverseerCollectionProcessor.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1657409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-02-04 21:39:47 +00:00
parent 98abb0ed1b
commit efba0e80b0
3 changed files with 15 additions and 16 deletions

View File

@ -103,6 +103,11 @@ Bug Fixes
* SOLR-7046: NullPointerException when group.function uses query() function.
(Jim Musil via Erick Erickson)
Optimizations
----------------------
* SOLR-7049: Move work done by the LIST Collections API call to the Collections
Handler (Varun Thacker via Anshum Gupta).
Other Changes
----------------------

View File

@ -645,9 +645,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
case OVERSEERSTATUS:
getOverseerStatus(message, results);
break;
case LIST:
listCollections(zkStateReader.getClusterState(), results);
break;
case CLUSTERSTATUS:
getClusterStatus(zkStateReader.getClusterState(), message, results);
break;
@ -1009,16 +1006,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
}
}
@SuppressWarnings("unchecked")
private void listCollections(ClusterState clusterState, NamedList results) {
Set<String> collections = clusterState.getCollections();
List<String> collectionList = new ArrayList<String>();
for (String collection : collections) {
collectionList.add(collection);
}
results.add("collections", collectionList);
}
@SuppressWarnings("unchecked")
private void processRoleCommand(ZkNodeProps message, String operation) throws KeeperException, InterruptedException {
SolrZkClient zkClient = zkStateReader.getZkClient();

View File

@ -1051,9 +1051,16 @@ public class CollectionsHandler extends RequestHandlerBase {
* @throws InterruptedException connection interrupted
*/
private void handleListAction(SolrQueryRequest req, SolrQueryResponse rsp) throws KeeperException, InterruptedException {
Map<String, Object> props = ZkNodeProps.makeMap(
Overseer.QUEUE_OPERATION, CollectionAction.LIST.toString().toLowerCase(Locale.ROOT));
handleResponse(CollectionAction.LIST.toString(), new ZkNodeProps(props), rsp);
NamedList<Object> results = new NamedList<>();
Set<String> collections = coreContainer.getZkController().getZkStateReader().getClusterState().getCollections();
List<String> collectionList = new ArrayList<>();
for (String collection : collections) {
collectionList.add(collection);
}
results.add("collections", collectionList);
SolrResponse response = new OverseerSolrResponse(results);
rsp.getValues().addAll(response.getResponse());
}