From 7660dde458fd6f10cc7481d54a52ad7519b1a545 Mon Sep 17 00:00:00 2001 From: Kevin Risden Date: Tue, 11 Oct 2016 14:48:25 -0500 Subject: [PATCH] SOLR-8969: Fix static cloud check --- .../java/org/apache/solr/handler/SQLHandler.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/SQLHandler.java b/solr/core/src/java/org/apache/solr/handler/SQLHandler.java index 5fcf93828e3..3074d9bb59d 100644 --- a/solr/core/src/java/org/apache/solr/handler/SQLHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/SQLHandler.java @@ -78,25 +78,22 @@ import com.facebook.presto.sql.parser.SqlParser; public class SQLHandler extends RequestHandlerBase implements SolrCoreAware , PermissionNameProvider { + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static String defaultZkhost = null; private static String defaultWorkerCollection = null; - private static List remove; - static { - remove = new ArrayList(); - remove.add("count(*)"); - } - - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); static final String sqlNonCloudErrorMsg = "/sql handler only works in Solr Cloud mode"; - public void inform(SolrCore core) { + private boolean isCloud = false; + public void inform(SolrCore core) { CoreContainer coreContainer = core.getCoreDescriptor().getCoreContainer(); if(coreContainer.isZooKeeperAware()) { defaultZkhost = core.getCoreDescriptor().getCoreContainer().getZkController().getZkServerAddress(); defaultWorkerCollection = core.getCoreDescriptor().getCollectionName(); + isCloud = true; } } @@ -121,7 +118,7 @@ public class SQLHandler extends RequestHandlerBase implements SolrCoreAware , Pe try { - if(workerZkhost == null) { + if(!isCloud) { throw new IllegalStateException(sqlNonCloudErrorMsg); }