asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Murtadha Hubail (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: [ASTERIXDB-2266][TX] Set Max Txn Log Record Size
Date Fri, 26 Jan 2018 18:00:55 GMT
Murtadha Hubail has submitted this change and it was merged.

Change subject: [ASTERIXDB-2266][TX] Set Max Txn Log Record Size
......................................................................


[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 <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
---
M asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManager.java
1 file changed, 8 insertions(+), 10 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Michael Blow: Looks good to me, approved



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 @@
 
 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 @@
     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 @@
         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 @@
     }
 
     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

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2325
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9d353369c84aa6a5b364ebaef1083a423e54856
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <mhubail@apache.org>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Murtadha Hubail <mhubail@apache.org>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message