Skip to content

Apache Lucene open-source search software

SOLR-11277: Synchronize UpdateLog.getCurrentLogSizeFromStream and return size of tlog as 0 to avoid NPE

Anshum Gupta27c6275c484f
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() {