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

@ -288,8 +288,12 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
String coreName = leaderProps.getStr(ZkStateReader.CORE_NAME_PROP); String coreName = leaderProps.getStr(ZkStateReader.CORE_NAME_PROP);
ActionThrottle lt; ActionThrottle lt;
try (SolrCore core = cc.getCore(coreName)) { try (SolrCore core = cc.getCore(coreName)) {
if (core == null) { if (core == null ) {
throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore not found:" + coreName + " in " + cc.getCoreNames()); if (cc.isShutDown()) {
return;
} else {
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) {
cancelElection(); if (!zkController.getCoreContainer().isShutDown()) {
throw new SolrException(ErrorCode.SERVER_ERROR, cancelElection();
"SolrCore not found:" + coreName + " in " + cc.getCoreNames()); throw new SolrException(ErrorCode.SERVER_ERROR,
"SolrCore not found:" + coreName + " in " + cc.getCoreNames());
} else {
return;
}
} }
// should I be leader? // should I be leader?

View File

@ -347,7 +347,9 @@ 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) {
log.warn("", e); if (!zkClient.isClosed()) {
log.warn("", e);
}
} }
} }
} }

View File

@ -176,7 +176,9 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
try { try {
prioritizer.prioritizeOverseerNodes(myId); prioritizer.prioritizeOverseerNodes(myId);
} catch (Exception e) { } catch (Exception e) {
log.error("Unable to prioritize overseer ", e); if (!zkStateReader.getZkClient().isClosed()) {
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);
zkCallbackExecutor.submit(() -> watcher.process(event)); try {
zkCallbackExecutor.submit(() -> watcher.process(event));
} catch (RejectedExecutionException e) {
// If not a graceful shutdown
if (!isClosed()) {
throw e;
}
}
} }
}; };
} }