You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2017/03/24 03:56:33 UTC

asterixdb git commit: ASTERIXDB-1857: Fix leaked open (deleted) txn log files.

Repository: asterixdb
Updated Branches:
  refs/heads/master cb2b443ea -> 8231288f6


ASTERIXDB-1857: Fix leaked open (deleted) txn log files.

Change-Id: I0d19601e39950c1b5310dcf2ecfcd5f50bc44455
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1614
Reviewed-by: Michael Blow <mb...@apache.org>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/8231288f
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/8231288f
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/8231288f

Branch: refs/heads/master
Commit: 8231288f6be6b357e4ba16a08859067cc5491246
Parents: cb2b443
Author: Yingyi Bu <yi...@couchbase.com>
Authored: Thu Mar 23 17:35:21 2017 -0700
Committer: Yingyi Bu <bu...@gmail.com>
Committed: Thu Mar 23 20:56:04 2017 -0700

----------------------------------------------------------------------
 .../asterix/transaction/management/service/logging/LogBuffer.java | 3 +--
 .../transaction/management/service/logging/LogManager.java        | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8231288f/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogBuffer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogBuffer.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogBuffer.java
index 7b5d8ee..033cbe4 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogBuffer.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogBuffer.java
@@ -38,7 +38,6 @@ import org.apache.asterix.common.transactions.LogRecord;
 import org.apache.asterix.common.transactions.LogSource;
 import org.apache.asterix.common.transactions.LogType;
 import org.apache.asterix.common.transactions.MutableLong;
-import org.apache.asterix.common.utils.TransactionUtil;
 import org.apache.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 
@@ -201,7 +200,7 @@ public class LogBuffer implements ILogBuffer {
                             }
                             if (stop) {
                                 fileChannel.close();
-                                break;
+                                return;
                             }
                             this.wait();
                         } catch (InterruptedException e) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8231288f/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java
index 613808f..d0f49db 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java
@@ -215,6 +215,8 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
     }
 
     protected void prepareNextLogFile() {
+        // Mark the page as the last page so that it will close the output file channel.
+        appendPage.isLastPage(true);
         // Make sure to flush whatever left in the log tail.
         appendPage.isFull(true);
         //wait until all log records have been flushed in the current file
@@ -236,7 +238,6 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
             LOGGER.info("Created new txn log file with id(" + getLogFileId(appendLSN.get()) + ") starting with LSN = "
                     + appendLSN.get());
         }
-        appendPage.isLastPage(true);
         //[Notice]
         //the current log file channel is closed if
         //LogBuffer.flush() completely flush the last page of the file.