SOLR-11426: TestLazyCores fails too often, trying to debug

This commit is contained in:
Erick Erickson 2017-10-07 22:12:03 -07:00
parent f0a4b2dafe
commit e92bde1e7e
1 changed files with 16 additions and 1 deletions

View File

@ -19,12 +19,17 @@ package org.apache.solr.core;
import com.google.common.collect.Lists;
import org.apache.http.annotation.Experimental;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.update.CommitUpdateCommand;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collection;
@ -538,7 +543,17 @@ class SolrCores implements Observer {
@Override
public void update(Observable o, Object arg) {
synchronized (modifyLock) {
pendingCloses.add((SolrCore) arg); // Essentially just queue this core up for closing.
SolrCore core = (SolrCore) arg;
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
CommitUpdateCommand cmd = new CommitUpdateCommand(req, false);
cmd.openSearcher = false;
cmd.waitSearcher = false;
try {
core.getUpdateHandler().commit(cmd);
} catch (IOException e) {
log.warn("Caught exception trying to close a transient core, ignoring as it should be benign");
}
pendingCloses.add(core); // Essentially just queue this core up for closing.
modifyLock.notifyAll(); // Wakes up closer thread too
}
}