You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/29 12:11:58 UTC
[lucene-solr] 03/22: @606 Fix race.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 03f6b8e7e691afa7221db986575ca974efa957ef
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Aug 28 09:15:48 2020 -0500
@606 Fix race.
---
solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java | 3 ++-
solr/core/src/java/org/apache/solr/update/UpdateLog.java | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
index 89c3829..68262eb 100644
--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
@@ -1020,7 +1020,8 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
}
private long getCurrentTLogSize() {
- return ulog != null && ulog.hasUncommittedChanges() ? ulog.getCurrentLogSizeFromStream() : -1;
+ UpdateLog fulog = ulog;
+ return fulog != null && fulog.hasUncommittedChanges() ? fulog.getCurrentLogSizeFromStream() : -1;
}
// allow access for tests
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 f170262..a9e319e 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -308,9 +308,11 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
* @return the current transaction log's size (based on its output stream)
*/
public long getCurrentLogSizeFromStream() {
- // if we sync this, it's a bad block and it's not critical its up to date
+ // if we sync this, it's a bad block and it's not critical its up to date (it's used to check
+ // if we should commit/flush in mem buffer)
// if we want it up to date, we should make a fastinputstream with volatile size field
- return tlog == null ? 0 : tlog.getLogSizeFromStream();
+ TransactionLog ftlog = tlog;
+ return ftlog == null ? 0 : ftlog.getLogSizeFromStream();
}
public long getTotalLogsNumber() {