asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhub...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-1462: Remove previous LSN from txn log record
Date Sun, 22 May 2016 23:35:54 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master cbd475b4b -> 794aa38ed


ASTERIXDB-1462: Remove previous LSN from txn log record

Change-Id: I32509ebe476e5993609f6fd73d2227a7d5219558
Reviewed-on: https://asterix-gerrit.ics.uci.edu/879
Reviewed-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


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

Branch: refs/heads/master
Commit: 794aa38ed3c007fee99343620fcaa6be4f351ff6
Parents: cbd475b
Author: Murtadha Hubail <mhubail@uci.edu>
Authored: Sun May 22 14:52:37 2016 -0700
Committer: Murtadha Hubail <hubailmor@gmail.com>
Committed: Sun May 22 16:35:50 2016 -0700

----------------------------------------------------------------------
 .../asterix/common/transactions/ILogRecord.java  |  6 +-----
 .../asterix/common/transactions/LogRecord.java   | 17 +----------------
 .../management/service/logging/LogManager.java   |  7 +------
 .../logging/LogManagerWithReplication.java       | 19 +++++--------------
 4 files changed, 8 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/794aa38e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
index abc1211..3738cd1 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/ILogRecord.java
@@ -34,7 +34,7 @@ public interface ILogRecord {
 
     public static final int JOB_TERMINATE_LOG_SIZE = 14; //JOB_COMMIT or ABORT log type
     public static final int ENTITY_COMMIT_LOG_BASE_SIZE = 30;
-    public static final int UPDATE_LOG_BASE_SIZE = 59;
+    public static final int UPDATE_LOG_BASE_SIZE = 51;
     public static final int FLUSH_LOG_SIZE = 18;
     public static final int WAIT_LOG_SIZE = 14;
 
@@ -66,10 +66,6 @@ public interface ILogRecord {
 
     public void setPKHashValue(int PKHashValue);
 
-    public long getPrevLSN();
-
-    public void setPrevLSN(long prevLsn);
-
     public long getResourceId();
 
     public void setResourceId(long resourceId);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/794aa38e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
index a16eef8..fd56913 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/transactions/LogRecord.java
@@ -80,7 +80,6 @@ public class LogRecord implements ILogRecord {
     private int PKHashValue;
     private int PKValueSize;
     private ITupleReference PKValue;
-    private long prevLSN;
     private long resourceId;
     private int resourcePartition;
     private int logSize;
@@ -124,7 +123,6 @@ public class LogRecord implements ILogRecord {
     private final static int TYPE_LEN = Byte.BYTES;
     public final static int PKHASH_LEN = Integer.BYTES;
     public final static int PKSZ_LEN = Integer.BYTES;
-    private final static int PRVLSN_LEN = Long.BYTES;
     private final static int RS_PARTITION_LEN = Integer.BYTES;
     private final static int RSID_LEN = Long.BYTES;
     private final static int LOGRCD_SZ_LEN = Integer.BYTES;
@@ -136,7 +134,7 @@ public class LogRecord implements ILogRecord {
     private final static int ALL_RECORD_HEADER_LEN = LOG_SOURCE_LEN + TYPE_LEN + JobId.BYTES;
     private final static int ENTITYCOMMIT_UPDATE_HEADER_LEN = RS_PARTITION_LEN + DatasetId.BYTES
+ PKHASH_LEN
             + PKSZ_LEN;
-    private final static int UPDATE_LSN_HEADER = PRVLSN_LEN + RSID_LEN + LOGRCD_SZ_LEN;
+    private final static int UPDATE_LSN_HEADER = RSID_LEN + LOGRCD_SZ_LEN;
     private final static int UPDATE_BODY_HEADER = FLDCNT_LEN + NEWOP_LEN + NEWVALSZ_LEN;
     private final static int REMOTE_FLUSH_LOG_EXTRA_FIELDS_LEN = Long.BYTES + Integer.BYTES
+ Integer.BYTES;
 
@@ -155,7 +153,6 @@ public class LogRecord implements ILogRecord {
             writePKValue(buffer);
         }
         if (logType == LogType.UPDATE) {
-            buffer.putLong(prevLSN);
             buffer.putLong(resourceId);
             buffer.putInt(logSize);
             buffer.putInt(fieldCnt);
@@ -305,7 +302,6 @@ public class LogRecord implements ILogRecord {
                 if (buffer.remaining() < UPDATE_LSN_HEADER + UPDATE_BODY_HEADER) {
                     return RecordReadStatus.TRUNCATED;
                 }
-                prevLSN = buffer.getLong();
                 resourceId = buffer.getLong();
                 logSize = buffer.getInt();
                 fieldCnt = buffer.getInt();
@@ -444,7 +440,6 @@ public class LogRecord implements ILogRecord {
             builder.append(" PKSize: ").append(PKValueSize);
         }
         if (logType == LogType.UPDATE) {
-            builder.append(" PrevLSN : ").append(prevLSN);
             builder.append(" ResourceId : ").append(resourceId);
         }
         return builder.toString();
@@ -525,16 +520,6 @@ public class LogRecord implements ILogRecord {
     }
 
     @Override
-    public long getPrevLSN() {
-        return prevLSN;
-    }
-
-    @Override
-    public void setPrevLSN(long prevLSN) {
-        this.prevLSN = prevLSN;
-    }
-
-    @Override
     public long getResourceId() {
         return resourceId;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/794aa38e/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 d5ad038..94d2a8c 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
@@ -142,10 +142,8 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
     }
 
     protected synchronized void syncAppendToLogTail(ILogRecord logRecord) throws ACIDException
{
-        ITransactionContext txnCtx = null;
-
         if (logRecord.getLogType() != LogType.FLUSH) {
-            txnCtx = logRecord.getTxnCtx();
+            ITransactionContext txnCtx = logRecord.getTxnCtx();
             if (txnCtx.getTxnState() == ITransactionManager.ABORTED && logRecord.getLogType()
!= LogType.ABORT) {
                 throw new ACIDException(
                         "Aborted job(" + txnCtx.getJobId() + ") tried to write non-abort
type log record.");
@@ -169,9 +167,6 @@ public class LogManager implements ILogManager, ILifeCycleComponent {
                 getAndInitNewPage();
             }
         }
-        if (logRecord.getLogType() == LogType.UPDATE) {
-            logRecord.setPrevLSN(txnCtx.getLastLSN());
-        }
         appendPage.append(logRecord, appendLSN.get());
 
         if (logRecord.getLogType() == LogType.FLUSH) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/794aa38e/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
index 951bbbd..cacd036 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/logging/LogManagerWithReplication.java
@@ -90,15 +90,11 @@ public class LogManagerWithReplication extends LogManager {
 
     @Override
     protected synchronized void syncAppendToLogTail(ILogRecord logRecord) throws ACIDException
{
-        ITransactionContext txnCtx = null;
-
-        if (logRecord.getLogSource() == LogSource.LOCAL) {
-            if (logRecord.getLogType() != LogType.FLUSH) {
-                txnCtx = logRecord.getTxnCtx();
-                if (txnCtx.getTxnState() == ITransactionManager.ABORTED && logRecord.getLogType()
!= LogType.ABORT) {
-                    throw new ACIDException(
-                            "Aborted job(" + txnCtx.getJobId() + ") tried to write non-abort
type log record.");
-                }
+        if (logRecord.getLogSource() == LogSource.LOCAL && logRecord.getLogType()
!= LogType.FLUSH) {
+            ITransactionContext txnCtx = logRecord.getTxnCtx();
+            if (txnCtx.getTxnState() == ITransactionManager.ABORTED && logRecord.getLogType()
!= LogType.ABORT) {
+                throw new ACIDException(
+                        "Aborted job(" + txnCtx.getJobId() + ") tried to write non-abort
type log record.");
             }
         }
 
@@ -114,11 +110,6 @@ public class LogManagerWithReplication extends LogManager {
                 getAndInitNewPage();
             }
         }
-        if (logRecord.getLogSource() == LogSource.LOCAL) {
-            if (logRecord.getLogType() == LogType.UPDATE) {
-                logRecord.setPrevLSN(txnCtx.getLastLSN());
-            }
-        }
         appendPage.appendWithReplication(logRecord, appendLSN.get());
 
         if (logRecord.getLogType() == LogType.FLUSH) {


Mime
View raw message