SOLR-9365: Reduce noise in solr logs during graceful shutdown

This commit is contained in:
Shalin Shekhar Mangar 2016-09-13 00:36:12 +05:30
parent b39fcc1202
commit 3fe1486683
5 changed files with 29 additions and 8 deletions

View File

@ -158,6 +158,7 @@ Other Changes
* SOLR-9498: Remove HDFS properties from DIH solrconfig.xml, as started in SOLR-6943 (Alexandre Rafalovitch) * SOLR-9498: Remove HDFS properties from DIH solrconfig.xml, as started in SOLR-6943 (Alexandre Rafalovitch)
* SOLR-9365: Reduce noise in solr logs during graceful shutdown. (Cao Manh Dat via shalin)
================== 6.2.1 ================== ================== 6.2.1 ==================

View File

@ -289,8 +289,12 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
ActionThrottle lt; ActionThrottle lt;
try (SolrCore core = cc.getCore(coreName)) { try (SolrCore core = cc.getCore(coreName)) {
if (core == null ) { if (core == null ) {
if (cc.isShutDown()) {
return;
} else {
throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore not found:" + coreName + " in " + cc.getCoreNames()); throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
} }
}
MDCLoggingContext.setCore(core); MDCLoggingContext.setCore(core);
lt = core.getUpdateHandler().getSolrCoreState().getLeaderThrottle(); lt = core.getUpdateHandler().getSolrCoreState().getLeaderThrottle();
} }
@ -325,9 +329,13 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
try (SolrCore core = cc.getCore(coreName)) { try (SolrCore core = cc.getCore(coreName)) {
if (core == null) { if (core == null) {
if (!zkController.getCoreContainer().isShutDown()) {
cancelElection(); cancelElection();
throw new SolrException(ErrorCode.SERVER_ERROR, throw new SolrException(ErrorCode.SERVER_ERROR,
"SolrCore not found:" + coreName + " in " + cc.getCoreNames()); "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
} else {
return;
}
} }
// should I be leader? // should I be leader?

View File

@ -347,10 +347,12 @@ public class LeaderElector {
// am I the next leader? // am I the next leader?
checkIfIamLeader(context, true); checkIfIamLeader(context, true);
} catch (Exception e) { } catch (Exception e) {
if (!zkClient.isClosed()) {
log.warn("", e); log.warn("", e);
} }
} }
} }
}
/** /**
* Set up any ZooKeeper nodes needed for leader election. * Set up any ZooKeeper nodes needed for leader election.

View File

@ -176,8 +176,10 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
try { try {
prioritizer.prioritizeOverseerNodes(myId); prioritizer.prioritizeOverseerNodes(myId);
} catch (Exception e) { } catch (Exception e) {
if (!zkStateReader.getZkClient().isClosed()) {
log.error("Unable to prioritize overseer ", e); log.error("Unable to prioritize overseer ", e);
} }
}
// TODO: Make maxThreads configurable. // TODO: Make maxThreads configurable.

View File

@ -32,6 +32,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -263,7 +264,14 @@ public class SolrZkClient implements Closeable {
@Override @Override
public void process(final WatchedEvent event) { public void process(final WatchedEvent event) {
log.debug("Submitting job to respond to event " + event); log.debug("Submitting job to respond to event " + event);
try {
zkCallbackExecutor.submit(() -> watcher.process(event)); zkCallbackExecutor.submit(() -> watcher.process(event));
} catch (RejectedExecutionException e) {
// If not a graceful shutdown
if (!isClosed()) {
throw e;
}
}
} }
}; };
} }