abdullah alamoudi has submitted this change and it was merged. Change subject: Notify waiting operation on change of component state ......................................................................
Notify waiting operation on change of component state The change fixes a bug in the lsm harness that could lead to an accessor being blocked on an empty component because a flush request used to set the state of all components to unwritable. when the component state was fixed, no notification was sent to the waiting operation. Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1733 Reviewed-by: Yingyi Bu <buyin...@gmail.com> Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> BAD: Jenkins <jenk...@fulliautomatix.ics.uci.edu> --- M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java 2 files changed, 12 insertions(+), 7 deletions(-) Approvals: Yingyi Bu: Looks good to me, approved Jenkins: Verified; No violations found; No violations found; Verified diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java index 7fca039..feeb578 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/PrimaryIndexOperationTracker.java @@ -35,9 +35,9 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.ComponentState; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor; +import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker; import org.apache.hyracks.storage.am.lsm.common.api.LSMOperationType; -import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMIndex; public class PrimaryIndexOperationTracker extends BaseOperationTracker { @@ -110,11 +110,11 @@ if (needsFlush || flushOnExit) { //Make the current mutable components READABLE_UNWRITABLE to stop coming modify operations from entering them until the current flush is scheduled. for (ILSMIndex lsmIndex : indexes) { - AbstractLSMIndex abstractLSMIndex = ((AbstractLSMIndex) lsmIndex); - ILSMOperationTracker opTracker = abstractLSMIndex.getOperationTracker(); + ILSMOperationTracker opTracker = lsmIndex.getOperationTracker(); synchronized (opTracker) { - if (abstractLSMIndex.getCurrentMutableComponentState() == ComponentState.READABLE_WRITABLE) { - abstractLSMIndex.setCurrentMutableComponentState(ComponentState.READABLE_UNWRITABLE); + ILSMMemoryComponent memComponent = lsmIndex.getCurrentMemoryComponent(); + if (memComponent.getState() == ComponentState.READABLE_WRITABLE && memComponent.isModified()) { + memComponent.setState(ComponentState.READABLE_UNWRITABLE); } } } diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java index 494ba27..682e323 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java @@ -88,6 +88,7 @@ .getCurrentMutableComponentState() == ComponentState.READABLE_UNWRITABLE) { ((AbstractLSMIndex) lsmIndex) .setCurrentMutableComponentState(ComponentState.READABLE_WRITABLE); + opTracker.notifyAll(); } return false; } @@ -367,7 +368,9 @@ } getAndEnterComponents(ctx, LSMOperationType.MODIFICATION, false); try { - lsmIndex.getCurrentMemoryComponent().getMetadata().put(key, value); + AbstractLSMMemoryComponent c = (AbstractLSMMemoryComponent) ctx.getComponentHolder().get(0); + c.getMetadata().put(key, value); + c.setModified(); } finally { exitAndComplete(ctx, LSMOperationType.MODIFICATION); } @@ -389,7 +392,9 @@ } getAndEnterComponents(ctx, LSMOperationType.FORCE_MODIFICATION, false); try { - lsmIndex.getCurrentMemoryComponent().getMetadata().put(key, value); + AbstractLSMMemoryComponent c = (AbstractLSMMemoryComponent) ctx.getComponentHolder().get(0); + c.getMetadata().put(key, value); + c.setModified(); } finally { exitAndComplete(ctx, LSMOperationType.FORCE_MODIFICATION); } -- To view, visit https://asterix-gerrit.ics.uci.edu/1733 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6fe0aa0323a70a2702a9310339abc68ab5cf14c7 Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: abdullah alamoudi <bamou...@gmail.com> Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-Reviewer: Yingyi Bu <buyin...@gmail.com> Gerrit-Reviewer: abdullah alamoudi <bamou...@gmail.com>