Skip to content

Apache Lucene open-source search software

SOLR-4590: Collections API should return a nice error when not in SolrCloud mode.

Mark Robert Miller2cdfc5cd976a
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1b6e72c7ace..70d6b86fc90 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -77,6 +77,11 @@ New Features
* SOLR-5274: Allow JettySolrRunner SSL config to be specified via a constructor.
(Mark Miller)
+Bug Fixes
+----------------------
+* SOLR-4590: Collections API should return a nice error when not in SolrCloud mode.
+ (Anshum Gupta, Mark Miller)
+
Security
----------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
index 962ee77a627..68939e38b75 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java
@@ -111,6 +111,12 @@ public class CollectionsHandler extends RequestHandlerBase {
"Core container instance missing");
}
+ // Make sure that the core is ZKAware
+ if(!cores.isZooKeeperAware()) {
+ throw new SolrException(ErrorCode.BAD_REQUEST,
+ "Solr instance is not running in SolrCloud mode.");
+ }
+
// Pick the action
SolrParams params = req.getParams();
CollectionAction action = null;