mirror of https://github.com/apache/lucene.git
SOLR-1743: Restore the error reporting behavior of 'single core' solr instances. (This was a bug introduced when the default core feature was added after 1.4 was released)
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@923909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f29488d551
commit
92e2e200a3
|
@ -69,9 +69,14 @@ public class CoreContainer
|
||||||
protected boolean shareSchema;
|
protected boolean shareSchema;
|
||||||
protected String solrHome;
|
protected String solrHome;
|
||||||
protected String solrConfigFilenameOverride;
|
protected String solrConfigFilenameOverride;
|
||||||
|
|
||||||
private String defaultCoreName = "";
|
private String defaultCoreName = "";
|
||||||
|
|
||||||
|
// assigned by Initializer
|
||||||
|
private boolean defaultAbortOnConfigError = false;
|
||||||
|
// number of cores that either explicitly, or because of
|
||||||
|
// default, said to abort on config error
|
||||||
|
private int numCoresAbortOnConfigError = 0;
|
||||||
|
|
||||||
public CoreContainer() {
|
public CoreContainer() {
|
||||||
solrHome = SolrResourceLoader.locateSolrHome();
|
solrHome = SolrResourceLoader.locateSolrHome();
|
||||||
}
|
}
|
||||||
|
@ -83,12 +88,18 @@ public class CoreContainer
|
||||||
// Helper class to initialize the CoreContainer
|
// Helper class to initialize the CoreContainer
|
||||||
public static class Initializer {
|
public static class Initializer {
|
||||||
protected String solrConfigFilename = null;
|
protected String solrConfigFilename = null;
|
||||||
|
// default to true for legacy behavior
|
||||||
protected boolean abortOnConfigurationError = true;
|
protected boolean abortOnConfigurationError = true;
|
||||||
|
|
||||||
public boolean isAbortOnConfigurationError() {
|
public boolean isAbortOnConfigurationError() {
|
||||||
return abortOnConfigurationError;
|
return abortOnConfigurationError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Note for no good reason what so ever, this method has only ever
|
||||||
|
* influenced the default behavior of "single core" mode. when using
|
||||||
|
* solr.xml values specified this way are ignored, and false is the default.
|
||||||
|
* initialize() will modify this value.
|
||||||
|
*/
|
||||||
public void setAbortOnConfigurationError(boolean abortOnConfigurationError) {
|
public void setAbortOnConfigurationError(boolean abortOnConfigurationError) {
|
||||||
this.abortOnConfigurationError = abortOnConfigurationError;
|
this.abortOnConfigurationError = abortOnConfigurationError;
|
||||||
}
|
}
|
||||||
|
@ -111,20 +122,17 @@ public class CoreContainer
|
||||||
log.info("looking for solr.xml: " + fconf.getAbsolutePath());
|
log.info("looking for solr.xml: " + fconf.getAbsolutePath());
|
||||||
cores = new CoreContainer();
|
cores = new CoreContainer();
|
||||||
cores.solrConfigFilenameOverride = solrConfigFilename;
|
cores.solrConfigFilenameOverride = solrConfigFilename;
|
||||||
if (fconf.exists())
|
if (fconf.exists()) {
|
||||||
|
// default abortOnConfigurationError ignored in multicore
|
||||||
|
cores.defaultAbortOnConfigError = false;
|
||||||
cores.load(solrHome, fconf);
|
cores.load(solrHome, fconf);
|
||||||
else {
|
} else {
|
||||||
|
cores.defaultAbortOnConfigError = abortOnConfigurationError;
|
||||||
cores.load(solrHome, new ByteArrayInputStream(DEF_SOLR_XML.getBytes()));
|
cores.load(solrHome, new ByteArrayInputStream(DEF_SOLR_XML.getBytes()));
|
||||||
cores.configFile = fconf;
|
cores.configFile = fconf;
|
||||||
}
|
}
|
||||||
abortOnConfigurationError = false;
|
setAbortOnConfigurationError(0 < cores.numCoresAbortOnConfigError);
|
||||||
// if any core aborts on startup, then abort
|
|
||||||
for (SolrCore c : cores.getCores()) {
|
|
||||||
if (c.getSolrConfig().getBool("abortOnConfigurationError", false)) {
|
|
||||||
abortOnConfigurationError = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
solrConfigFilename = cores.getConfigFile().getName();
|
solrConfigFilename = cores.getConfigFile().getName();
|
||||||
|
|
||||||
return cores;
|
return cores;
|
||||||
|
@ -404,6 +412,11 @@ public class CoreContainer
|
||||||
// Initialize the solr config
|
// Initialize the solr config
|
||||||
SolrResourceLoader solrLoader = new SolrResourceLoader(instanceDir, libLoader, getCoreProps(instanceDir, dcore.getPropertiesName(),dcore.getCoreProperties()));
|
SolrResourceLoader solrLoader = new SolrResourceLoader(instanceDir, libLoader, getCoreProps(instanceDir, dcore.getPropertiesName(),dcore.getCoreProperties()));
|
||||||
SolrConfig config = new SolrConfig(solrLoader, dcore.getConfigName(), null);
|
SolrConfig config = new SolrConfig(solrLoader, dcore.getConfigName(), null);
|
||||||
|
|
||||||
|
if (config.getBool("abortOnConfigurationError",defaultAbortOnConfigError)) {
|
||||||
|
numCoresAbortOnConfigError++;
|
||||||
|
}
|
||||||
|
|
||||||
IndexSchema schema = null;
|
IndexSchema schema = null;
|
||||||
if(indexSchemaCache != null){
|
if(indexSchemaCache != null){
|
||||||
//schema sharing is enabled. so check if it already is loaded
|
//schema sharing is enabled. so check if it already is loaded
|
||||||
|
|
Loading…
Reference in New Issue