Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-6918: No need to log exceptions (as warn) generated when creating MBean stats if core is shutting down

Timothy Potter812e0c6e6f81
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8e12f573dba..fa04f3bb56a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -650,6 +650,9 @@ Other Changes
* SOLR-6830: Update Woodstox to 4.4.1 and StAX to 3.1.4. (ab)
+* SOLR-6918: No need to log exceptions (as warn) generated when creating MBean stats if
+ the core is shutting down (Timothy Potter)
+
================== 4.10.3 ==================
Bug Fixes
diff --git a/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java b/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
index cea97688165..840cb0d8466 100644
--- a/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
+++ b/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
@@ -16,6 +16,7 @@
*/
package org.apache.solr.core;
+import org.apache.lucene.store.AlreadyClosedException;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrConfig.JmxConfiguration;
@@ -279,7 +280,9 @@ public class JmxMonitoredMap<K, V> extends
}
}
} catch (Exception e) {
- LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
+ // don't log issue if the core is closing
+ if (!(SolrException.getRootCause(e) instanceof AlreadyClosedException))
+ LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
}
MBeanAttributeInfo[] attrInfoArr = attrInfoList
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index 6237561a242..ec4bc67824e 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -572,7 +572,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
NamedList list = super.getStatistics();
if (core != null) {
list.add("indexSize", NumberUtils.readableSize(getIndexSize()));
- CommitVersionInfo vInfo = getIndexVersion();
+ CommitVersionInfo vInfo = (core != null && !core.isClosed()) ? getIndexVersion(): null;
list.add("indexVersion", null == vInfo ? 0 : vInfo.version);
list.add(GENERATION, null == vInfo ? 0 : vInfo.generation);