mirror of https://github.com/apache/lucene.git
SOLR-8969: Fix static cloud check
This commit is contained in:
parent
b00f10916b
commit
7660dde458
|
@ -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<String> 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue