You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2018/01/26 18:01:27 UTC

asterixdb git commit: [ASTERIXDB-2266][TX] Set Max Txn Log Record Size

Repository: asterixdb
Updated Branches:
  refs/heads/master 15d9e0299 -> 61cb03102


[ASTERIXDB-2266][TX] Set Max Txn Log Record Size

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Prevent log records that exceed the max
  log file size from being logged to avoid
  breaking recovery logic.

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


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

Branch: refs/heads/master
Commit: 61cb0310237fa80ceac5e9aadcae2d5149815510
Parents: 15d9e02
Author: Murtadha Hubail <mh...@apache.org>
Authored: Fri Jan 26 04:36:57 2018 +0300
Committer: Murtadha Hubail <mh...@apache.org>
Committed: Fri Jan 26 10:00:54 2018 -0800

----------------------------------------------------------------------
 .../management/service/logging/LogManager.java    | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/61cb0310/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 c226886..00c6c13 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
@@ -61,16 +61,11 @@ import org.apache.logging.log4j.Logger;
 
 public class LogManager implements ILogManager, ILifeCycleComponent {
 
-    /*
-     * Constants
-     */
     private static final Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
     private static final long SMALLEST_LOG_FILE_ID = 0;
     private static final int INITIAL_LOG_SIZE = 0;
-    public static final boolean IS_DEBUG_MODE = false;// true
-    /*
-     * Finals
-     */
+    private static final boolean IS_DEBUG_MODE = false;
+
     private final ITransactionSubsystem txnSubsystem;
     private final LogManagerProperties logManagerProperties;
     private final int numLogPages;
@@ -82,9 +77,8 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
     private final long logFileSize;
     private final int logPageSize;
     private final AtomicLong appendLSN;
-    /*
-     * Mutables
-     */
+    private final long maxLogRecordSize;
+
     private LinkedBlockingQueue<ILogBuffer> emptyQ;
     private LinkedBlockingQueue<ILogBuffer> flushQ;
     private LinkedBlockingQueue<ILogBuffer> stashQ;
@@ -100,6 +94,7 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
         logManagerProperties =
                 new LogManagerProperties(this.txnSubsystem.getTransactionProperties(), this.txnSubsystem.getId());
         logFileSize = logManagerProperties.getLogPartitionSize();
+        maxLogRecordSize = logFileSize - 1;
         logPageSize = logManagerProperties.getLogPageSize();
         numLogPages = logManagerProperties.getNumLogPages();
         logDir = logManagerProperties.getLogDir();
@@ -193,6 +188,9 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
     }
 
     private boolean fileHasSpace(int logSize) {
+        if (logSize > maxLogRecordSize) {
+            throw new ACIDException("Maximum log record size of (" + maxLogRecordSize + ") exceeded");
+        }
         /*
          * To eliminate the case where the modulo of the next appendLSN = 0 (the next
          * appendLSN = the first LSN of the next log file), we do not allow a log to be