asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [01/10] incubator-asterixdb git commit: Temp dataset support: 1. DDLs for creating a temporary dataset 2. Garbage collection for temporary dataset 3. Reading, inserting, and deleting data from (to) a temporary dataset is locking-free (except metadata loc
Date Wed, 20 May 2015 01:25:42 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master f61bdb807 -> 7de6f4eb8


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ccd67fe8/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogPage.java
----------------------------------------------------------------------
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogPage.java
b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogPage.java
index f3e8f77..10fe1e2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogPage.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/logging/LogPage.java
@@ -55,8 +55,8 @@ public class LogPage implements ILogPage {
 
     private FileChannel fileChannel;
     private boolean stop;
-    private DatasetId reusableDsId;
-    private JobId reusableJobId;
+    private final DatasetId reusableDsId;
+    private final JobId reusableJobId;
 
     public LogPage(TransactionSubsystem txnSubsystem, int logPageSize, MutableLong flushLSN)
{
         this.txnSubsystem = txnSubsystem;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ccd67fe8/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
----------------------------------------------------------------------
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
index b28964a..77c66a2 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/transaction/TransactionContext.java
@@ -30,8 +30,8 @@ import edu.uci.ics.asterix.common.transactions.ITransactionManager;
 import edu.uci.ics.asterix.common.transactions.JobId;
 import edu.uci.ics.asterix.common.transactions.LogRecord;
 import edu.uci.ics.asterix.common.transactions.MutableLong;
-import edu.uci.ics.asterix.transaction.management.opcallbacks.PrimaryIndexModificationOperationCallback;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
 import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
 import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMOperationType;
 
@@ -44,7 +44,7 @@ import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMOperationType;
 public class TransactionContext implements ITransactionContext, Serializable {
 
     private static final long serialVersionUID = -6105616785783310111L;
-    private TransactionSubsystem transactionSubsystem;
+    private final TransactionSubsystem transactionSubsystem;
 
     // jobId is set once and read concurrently.
     private final JobId jobId;
@@ -54,18 +54,18 @@ public class TransactionContext implements ITransactionContext, Serializable
{
     // But readers and writers can be different threads,
     // so both LSNs are atomic variables in order to be read and written
     // atomically.
-    private AtomicLong firstLSN;
-    private AtomicLong lastLSN;
+    private final AtomicLong firstLSN;
+    private final AtomicLong lastLSN;
 
     // txnState is read and written concurrently.
-    private AtomicInteger txnState;
+    private final AtomicInteger txnState;
 
     // isTimeout is read and written under the lockMgr's tableLatch
     // Thus, no other synchronization is required separately.
     private boolean isTimeout;
 
     // isWriteTxn can be set concurrently by multiple threads.
-    private AtomicBoolean isWriteTxn;
+    private final AtomicBoolean isWriteTxn;
 
     // isMetadataTxn is accessed by a single thread since the metadata is not
     // partitioned
@@ -73,21 +73,21 @@ public class TransactionContext implements ITransactionContext, Serializable
{
 
     // indexMap is concurrently accessed by multiple threads,
     // so those threads are synchronized on indexMap object itself
-    private Map<MutableLong, AbstractLSMIOOperationCallback> indexMap;
+    private final Map<MutableLong, AbstractLSMIOOperationCallback> indexMap;
 
     // TODO: fix ComponentLSNs' issues.
     // primaryIndex, primaryIndexCallback, and primaryIndexOptracker will be
     // modified accordingly
     // when the issues of componentLSNs are fixed.
     private ILSMIndex primaryIndex;
-    private PrimaryIndexModificationOperationCallback primaryIndexCallback;
+    private AbstractOperationCallback primaryIndexCallback;
     private PrimaryIndexOperationTracker primaryIndexOpTracker;
 
     // The following three variables are used as temporary variables in order to
     // avoid object creations.
     // Those are used in synchronized methods.
-    private MutableLong tempResourceIdForRegister;
-    private LogRecord logRecord;
+    private final MutableLong tempResourceIdForRegister;
+    private final LogRecord logRecord;
 
     // TODO: implement transactionContext pool in order to avoid object
     // creations.
@@ -108,12 +108,13 @@ public class TransactionContext implements ITransactionContext, Serializable
{
         logRecord = new LogRecord();
     }
 
+    @Override
     public void registerIndexAndCallback(long resourceId, ILSMIndex index, AbstractOperationCallback
callback,
             boolean isPrimaryIndex) {
         synchronized (indexMap) {
             if (isPrimaryIndex && primaryIndex == null) {
                 primaryIndex = index;
-                primaryIndexCallback = (PrimaryIndexModificationOperationCallback) callback;
+                primaryIndexCallback = callback;
                 primaryIndexOpTracker = (PrimaryIndexOperationTracker) index.getOperationTracker();
             }
             tempResourceIdForRegister.set(resourceId);
@@ -138,18 +139,20 @@ public class TransactionContext implements ITransactionContext, Serializable
{
             if (isJobLevelCommit && isMetadataTxn) {
                 primaryIndexOpTracker.exclusiveJobCommitted();
             } else if (!isJobLevelCommit) {
-                primaryIndexOpTracker
-                        .completeOperation(null, LSMOperationType.MODIFICATION, null, primaryIndexCallback);
+                primaryIndexOpTracker.completeOperation(null, LSMOperationType.MODIFICATION,
null,
+                        (IModificationOperationCallback) primaryIndexCallback);
             }
         } catch (HyracksDataException e) {
             throw new IllegalStateException(e);
         }
     }
 
+    @Override
     public void setWriteTxn(boolean isWriteTxn) {
         this.isWriteTxn.set(isWriteTxn);
     }
 
+    @Override
     public boolean isWriteTxn() {
         return isWriteTxn.get();
     }
@@ -164,22 +167,27 @@ public class TransactionContext implements ITransactionContext, Serializable
{
         return lastLSN.get();
     }
 
+    @Override
     public JobId getJobId() {
         return jobId;
     }
 
+    @Override
     public void setTimeout(boolean isTimeout) {
         this.isTimeout = isTimeout;
     }
 
+    @Override
     public boolean isTimeout() {
         return isTimeout;
     }
 
+    @Override
     public void setTxnState(int txnState) {
         this.txnState.set(txnState);
     }
 
+    @Override
     public int getTxnState() {
         return txnState.get();
     }
@@ -204,6 +212,7 @@ public class TransactionContext implements ITransactionContext, Serializable
{
         return isMetadataTxn;
     }
 
+    @Override
     public String prettyPrint() {
         StringBuilder sb = new StringBuilder();
         sb.append("\n" + jobId + "\n");


Mime
View raw message