Minor changes in the direction of getting transactions working.
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@817 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
index 1635191..182079f 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/IndexOperationTracker.java
@@ -28,6 +28,7 @@
// Number of active operations on a ILSMIndex instance.
private int numActiveOperations = 0;
+ private long lastLsn;
private final ILSMIndex index;
private final ILSMIndexAccessor accessor;
private final FlushOperationCallback FLUSHCALLBACK_INSTANCE = new FlushOperationCallback();
@@ -90,7 +91,15 @@
}
}
- private class FlushOperationCallback implements ILSMIOOperationCallback {
+ public long getLastLSN() {
+ return lastLsn;
+ }
+
+ public void setLastLSN(long lastLsn) {
+ this.lastLsn = lastLsn;
+ }
+
+ private class FlushOperationCallback implements ILSMIOOperationCallback {
@Override
public void callback() {
IndexOperationTracker.this.notifyAll();
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 d3b3b36..52d766d 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
@@ -15,14 +15,18 @@
package edu.uci.ics.asterix.transaction.management.service.transaction;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.transaction.management.opcallbacks.AbstractOperationCallback;
import edu.uci.ics.asterix.transaction.management.resource.ICloseable;
import edu.uci.ics.asterix.transaction.management.service.logging.LogUtil;
import edu.uci.ics.asterix.transaction.management.service.logging.LogicalLogLocator;
import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionManager.TransactionState;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIndex;
/**
* Represents a holder object that contains all information related to a
@@ -53,6 +57,34 @@
private TransactionType transactionType = TransactionType.READ;
private JobId jobId;
+ // List of indexes on which operations were performed on behalf of this transaction.
+ private final List<ILSMIndex> indexes = new ArrayList<ILSMIndex>();
+
+ // List of operation callbacks corresponding to the operand indexes. In particular, needed to track
+ // the number of active operations contributed by this transaction.
+ private final List<AbstractOperationCallback> callbacks = new ArrayList<AbstractOperationCallback>();
+
+ public TransactionContext(JobId jobId, TransactionSubsystem transactionSubsystem) throws ACIDException {
+ this.jobId = jobId;
+ this.transactionSubsystem = transactionSubsystem;
+ init();
+ }
+
+ private void init() throws ACIDException {
+ lastLogLocator = LogUtil.getDummyLogicalLogLocator(transactionSubsystem.getLogManager());
+ txnState = TransactionState.ACTIVE;
+ startWaitTime = INVALID_TIME;
+ status = ACTIVE_STATUS;
+ }
+
+ public void registerIndex(ILSMIndex index) {
+ indexes.add(index);
+ }
+
+ public void registerCallback(AbstractOperationCallback callback) {
+ callbacks.add(callback);
+ }
+
public void setTransactionType(TransactionType transactionType) {
this.transactionType = transactionType;
}
@@ -65,19 +97,6 @@
resources.add(resource);
}
- public TransactionContext(JobId jobId, TransactionSubsystem transactionProvider) throws ACIDException {
- this.jobId = jobId;
- this.transactionSubsystem = transactionProvider;
- init();
- }
-
- private void init() throws ACIDException {
- lastLogLocator = LogUtil.getDummyLogicalLogLocator(transactionSubsystem.getLogManager());
- txnState = TransactionState.ACTIVE;
- startWaitTime = INVALID_TIME;
- status = ACTIVE_STATUS;
- }
-
public LogicalLogLocator getLastLogLocator() {
return lastLogLocator;
}