You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2016/09/12 19:07:03 UTC
lucene-solr:branch_6x: SOLR-9365: Reduce noise in solr logs during
graceful shutdown
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 89f03655e -> 47a855020
SOLR-9365: Reduce noise in solr logs during graceful shutdown
(cherry picked from commit 3fe1486)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/47a85502
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/47a85502
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/47a85502
Branch: refs/heads/branch_6x
Commit: 47a85502085e75493576bb805d62d493c9025ed8
Parents: 89f0365
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Tue Sep 13 00:36:12 2016 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Tue Sep 13 00:36:50 2016 +0530
----------------------------------------------------------------------
solr/CHANGES.txt | 1 +
.../org/apache/solr/cloud/ElectionContext.java | 18 +++++++++++++-----
.../java/org/apache/solr/cloud/LeaderElector.java | 4 +++-
.../apache/solr/cloud/OverseerTaskProcessor.java | 4 +++-
.../apache/solr/common/cloud/SolrZkClient.java | 10 +++++++++-
5 files changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/47a85502/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8deaf72..89a672a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -128,6 +128,7 @@ Other Changes
* 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 ==================
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/47a85502/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
index 8560d3a..644ad22 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java
@@ -288,8 +288,12 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
String coreName = leaderProps.getStr(ZkStateReader.CORE_NAME_PROP);
ActionThrottle lt;
try (SolrCore core = cc.getCore(coreName)) {
- if (core == null) {
- throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
+ if (core == null ) {
+ if (cc.isShutDown()) {
+ return;
+ } else {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
+ }
}
MDCLoggingContext.setCore(core);
lt = core.getUpdateHandler().getSolrCoreState().getLeaderThrottle();
@@ -325,9 +329,13 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
try (SolrCore core = cc.getCore(coreName)) {
if (core == null) {
- cancelElection();
- throw new SolrException(ErrorCode.SERVER_ERROR,
- "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
+ if (!zkController.getCoreContainer().isShutDown()) {
+ cancelElection();
+ throw new SolrException(ErrorCode.SERVER_ERROR,
+ "SolrCore not found:" + coreName + " in " + cc.getCoreNames());
+ } else {
+ return;
+ }
}
// should I be leader?
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/47a85502/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
index e71ddf0..719bc5f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -347,7 +347,9 @@ public class LeaderElector {
// am I the next leader?
checkIfIamLeader(context, true);
} catch (Exception e) {
- log.warn("", e);
+ if (!zkClient.isClosed()) {
+ log.warn("", e);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/47a85502/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
index 074cf16..b736d1b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskProcessor.java
@@ -176,7 +176,9 @@ public class OverseerTaskProcessor implements Runnable, Closeable {
try {
prioritizer.prioritizeOverseerNodes(myId);
} 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.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/47a85502/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
index 516b7b9..f2b67ee 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
@@ -32,6 +32,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.RejectedExecutionException;
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
@@ -263,7 +264,14 @@ public class SolrZkClient implements Closeable {
@Override
public void process(final WatchedEvent 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;
+ }
+ }
}
};
}