Murtadha Hubail has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/2489
Change subject: [ASTERIXDB-2308][STO] Prevent Race To Allocate Memory Components ...................................................................... [ASTERIXDB-2308][STO] Prevent Race To Allocate Memory Components - user model changes: no - storage format changes: no - interface changes: no Details: - Ensure concurrent threads will not attempt to allocate memory components twice. - Synchronize index lifecycle operations. - Remove unused methods. Change-Id: Ibd424ba6a2a68939f6ab8a4338c2f6c0c8057ed1 --- M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java 1 file changed, 4 insertions(+), 17 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/89/2489/1 diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java index af8c702..2db2f79 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java @@ -41,7 +41,6 @@ import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.ComponentState; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentId; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentId.IdCompareResult; @@ -97,7 +96,7 @@ protected final boolean durable; protected boolean isActive; protected final AtomicBoolean[] flushRequests; - protected boolean memoryComponentsAllocated = false; + protected volatile boolean memoryComponentsAllocated = false; protected ITracer tracer; // Factory for creating on-disk index components during flush and merge. protected final ILSMDiskComponentFactory componentFactory; @@ -219,7 +218,7 @@ isActive = false; } - protected void flushMemoryComponent() throws HyracksDataException { + private void flushMemoryComponent() throws HyracksDataException { BlockingIOOperationCallbackWrapper cb = new BlockingIOOperationCallbackWrapper(ioOpCallback); ILSMIndexAccessor accessor = createAccessor(NoOpIndexAccessParameters.INSTANCE); accessor.scheduleFlush(cb); @@ -247,7 +246,7 @@ } @Override - public void destroy() throws HyracksDataException { + public synchronized void destroy() throws HyracksDataException { if (isActive) { throw HyracksDataException.create(ErrorCode.CANNOT_DESTROY_ACTIVE_INDEX); } @@ -262,7 +261,7 @@ } @Override - public void clear() throws HyracksDataException { + public synchronized void clear() throws HyracksDataException { if (!isActive) { throw HyracksDataException.create(ErrorCode.CANNOT_CLEAR_INACTIVE_INDEX); } @@ -570,18 +569,6 @@ public boolean isCurrentMutableComponentEmpty() throws HyracksDataException { //check if the current memory component has been modified return !memoryComponents.get(currentMutableComponentId.get()).isModified(); - } - - public void setCurrentMutableComponentState(ComponentState componentState) { - memoryComponents.get(currentMutableComponentId.get()).setState(componentState); - } - - public ComponentState getCurrentMutableComponentState() { - return memoryComponents.get(currentMutableComponentId.get()).getState(); - } - - public int getCurrentMutableComponentWriterCount() { - return memoryComponents.get(currentMutableComponentId.get()).getWriterCount(); } @Override -- To view, visit https://asterix-gerrit.ics.uci.edu/2489 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibd424ba6a2a68939f6ab8a4338c2f6c0c8057ed1 Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Murtadha Hubail <mhub...@apache.org>