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 a19f15fdcd2..c30b8d1a9c2 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -197,7 +197,7 @@ public class UpdateLog implements PluginInfoInitialized { public long getTotalLogsSize() { long size = 0; - synchronized (logs) { + synchronized (this) { for (TransactionLog log : logs) { size += log.getLogSize(); } @@ -206,7 +206,9 @@ public class UpdateLog implements PluginInfoInitialized { } public long getTotalLogsNumber() { - return logs.size(); + synchronized (this) { + return logs.size(); + } } public VersionInfo getVersionInfo() { @@ -317,7 +319,7 @@ public class UpdateLog implements PluginInfoInitialized { /* Takes over ownership of the log, keeping it until no longer needed and then decrementing it's reference and dropping it. */ - protected void addOldLog(TransactionLog oldLog, boolean removeOld) { + protected synchronized void addOldLog(TransactionLog oldLog, boolean removeOld) { if (oldLog == null) return; numOldRecords += oldLog.numRecords();