SOLR-8135: SolrCloudExampleTest.testLoadDocsIntoGettingStartedCollection reproducible failure

This commit is contained in:
Noble Paul 2016-03-11 00:49:49 +05:30
parent d35d5694d8
commit 8cc978b53b
4 changed files with 18 additions and 7 deletions

View File

@ -62,6 +62,7 @@ import org.apache.solr.security.AuthorizationPlugin;
import org.apache.solr.security.HttpClientInterceptorPlugin;
import org.apache.solr.security.PKIAuthenticationPlugin;
import org.apache.solr.security.SecurityPluginHolder;
import org.apache.solr.update.SolrCoreState;
import org.apache.solr.update.UpdateShardHandler;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.apache.zookeeper.KeeperException;
@ -916,8 +917,9 @@ public class CoreContainer {
log.info("Reloading SolrCore '{}' using configuration from {}", cd.getName(), coreConfig.getName());
SolrCore newCore = core.reload(coreConfig);
registerCore(name, newCore, false);
}
catch (Exception e) {
} catch (SolrCoreState.CoreIsClosedException e) {
throw e;
} catch (Exception e) {
coreInitFailures.put(cd.getName(), new CoreLoadFailure(cd, e));
throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to reload core [" + cd.getName() + "]", e);
}

View File

@ -534,8 +534,8 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
// Create the index if it doesn't exist.
if(!indexExists) {
log.warn(logid+"Solr index directory '" + new File(indexDir) + "' doesn't exist."
+ " Creating new index...");
log.warn(logid + "Solr index directory '" + new File(indexDir) + "' doesn't exist."
+ " Creating new index...");
SolrIndexWriter writer = SolrIndexWriter.create(this, "SolrCore.initIndex", indexDir, getDirectoryFactory(), true,
getLatestSchema(), solrConfig.indexConfig, solrDelPolicy, codec);
@ -2501,7 +2501,11 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
checkStale(zkClient, solrConfigPath, overlayVersion) ||
checkStale(zkClient, managedSchmaResourcePath, managedSchemaVersion)) {
log.info("core reload {}", coreName);
cc.reload(coreName);
try {
cc.reload(coreName);
} catch (SolrCoreState.CoreIsClosedException e) {
/*no problem this core is already closed*/
}
return;
}
//some files in conf directory may have other than managedschema, overlay, params

View File

@ -51,7 +51,7 @@ public abstract class SolrCoreState {
public void increfSolrCoreState() {
synchronized (this) {
if (solrCoreStateRefCnt == 0) {
throw new IllegalStateException("IndexWriter has been closed");
throw new CoreIsClosedException("IndexWriter has been closed");
}
solrCoreStateRefCnt++;
}
@ -157,4 +157,10 @@ public abstract class SolrCoreState {
public abstract boolean getLastReplicateIndexSuccess();
public abstract void setLastReplicateIndexSuccess(boolean success);
public static class CoreIsClosedException extends IllegalStateException {
public CoreIsClosedException(String s) {
super(s);
}
}
}

View File

@ -43,7 +43,6 @@ import org.slf4j.LoggerFactory;
* this test is useful for catching regressions in indexing the example docs in collections that
* use data-driven schema and managed schema features provided by configsets/data_driven_schema_configs.
*/
@LuceneTestCase.BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-8135")
public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());