ensure decrement is called in complete operation
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexOperationTracker.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexOperationTracker.java
index 7a35473..68713d8 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexOperationTracker.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexOperationTracker.java
@@ -64,7 +64,7 @@
@Override
public void completeOperation(LSMOperationType opType, ISearchOperationCallback searchCallback,
IModificationOperationCallback modificationCallback) throws HyracksDataException {
-
+ int nActiveOps = numActiveOperations.decrementAndGet();
// Decrement transactor-local active operations count.
AbstractOperationCallback opCallback = getOperationCallback(searchCallback, modificationCallback);
if (opCallback != null) {
@@ -72,7 +72,7 @@
}
// If we need a flush, and this is the last completing operation, then schedule the flush.
// Once the flush has completed notify all waiting operations.
- if (index.getFlushStatus() && numActiveOperations.decrementAndGet() == 0 && opType != LSMOperationType.FLUSH) {
+ if (index.getFlushStatus() && nActiveOps == 0 && opType != LSMOperationType.FLUSH) {
if (accessor == null) {
accessor = (ILSMIndexAccessor) index.createAccessor(NoOpOperationCallback.INSTANCE,
NoOpOperationCallback.INSTANCE);