Fixed a race condition bug caused that was surfaced when switching to the asynchronous scheduler, which causes the memory component to be deactivated twice and throwing an exception.
diff --git a/hyracks/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java b/hyracks/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
index 1632725..df6d3d5 100644
--- a/hyracks/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
+++ b/hyracks/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
@@ -178,8 +178,8 @@
if (!lsmIndex.scheduleFlush(ctx, callback)) {
callback.beforeOperation();
callback.afterOperation(null, null);
- callback.afterFinalize(null);
exitComponents(ctx, LSMOperationType.FLUSH, false);
+ callback.afterFinalize(null);
}
}
@@ -194,13 +194,13 @@
operation.getCallback().afterOperation(null, newComponent);
lsmIndex.markAsValid(newComponent);
- operation.getCallback().afterFinalize(newComponent);
lsmIndex.addComponent(newComponent);
int numComponents = lsmIndex.getImmutableComponents().size();
mergePolicy.diskComponentAdded(lsmIndex, numComponents);
exitComponents(ctx, LSMOperationType.FLUSH, false);
+ operation.getCallback().afterFinalize(newComponent);
}
@Override
@@ -229,9 +229,9 @@
ctx.getComponentHolder().addAll(mergedComponents);
operation.getCallback().afterOperation(mergedComponents, newComponent);
lsmIndex.markAsValid(newComponent);
- operation.getCallback().afterFinalize(newComponent);
lsmIndex.subsumeMergedComponents(newComponent, mergedComponents);
exitComponents(ctx, LSMOperationType.MERGE, false);
+ operation.getCallback().afterFinalize(newComponent);
}
@Override
@@ -246,4 +246,4 @@
public ILSMOperationTracker getOperationTracker() {
return opTracker;
}
-}
+}
\ No newline at end of file