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/07/14 22:17:40 UTC

[lucene-solr] branch reference_impl updated: #157 - Spray spackle towards this TransactionLog leak.

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 9670164  #157 - Spray spackle towards this TransactionLog leak.
9670164 is described below

commit 9670164238c23afd9038371d213287e911f5a377
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 17:17:23 2020 -0500

    #157 - Spray spackle towards this TransactionLog leak.
---
 solr/core/src/java/org/apache/solr/update/UpdateLog.java | 7 +++++++
 1 file changed, 7 insertions(+)

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 fef81cc..f695e1b 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -51,6 +51,7 @@ import com.codahale.metrics.Gauge;
 import com.codahale.metrics.Meter;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.lucene.util.BytesRef;
+import org.apache.solr.common.AlreadyClosedException;
 import org.apache.solr.common.ParWork;
 import org.apache.solr.common.SolrDocumentBase;
 import org.apache.solr.common.SolrException;
@@ -101,6 +102,8 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
   public static String TLOG_NAME="tlog";
   public static String BUFFER_TLOG_NAME="buffer.tlog";
 
+  private volatile boolean isClosed = false;
+
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   private boolean debug = log.isDebugEnabled();
   private boolean trace = log.isTraceEnabled();
@@ -485,6 +488,9 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
    * change the implementation of the transaction log.
    */
   public TransactionLog newTransactionLog(File tlogFile, Collection<String> globalStrings, boolean openExisting, byte[] buffer) {
+    if (isClosed) {
+      throw new AlreadyClosedException();
+    }
     return new TransactionLog(tlogFile, globalStrings, openExisting);
   }
 
@@ -1380,6 +1386,7 @@ public class UpdateLog implements PluginInfoInitialized, SolrMetricProducer {
   }
 
   public void close(boolean committed, boolean deleteOnClose) {
+    this.isClosed = true;
     recoveryExecutor.shutdown(); // no new tasks
 
     synchronized (this) {