From 27c6275c484f2dcb73cc64a06fb42ba2c4eefcbf Mon Sep 17 00:00:00 2001 From: Anshum Gupta Date: Fri, 18 May 2018 09:56:52 -0700 Subject: [PATCH] SOLR-11277: Synchronize UpdateLog.getCurrentLogSizeFromStream and return size of tlog as 0 to avoid NPE --- solr/core/src/java/org/apache/solr/update/UpdateLog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index 09ff1467c5d..ef0e73e5f83 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -295,8 +295,8 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer { /** * @return the current transaction log's size (based on its output stream) */ - public long getCurrentLogSizeFromStream() { - return tlog.getLogSizeFromStream(); + public synchronized long getCurrentLogSizeFromStream() { + return tlog == null ? 0 : tlog.getLogSizeFromStream(); } public long getTotalLogsNumber() {