Luo Chen has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/2637
Change subject: [NO ISSUE][STO] Eliminate S Lock for Disk Components ...................................................................... [NO ISSUE][STO] Eliminate S Lock for Disk Components - user model changes: no - storage format changes: no - interface changes: no Details: - Eliminate S lock for tuples returned from disk components, since LSM disk components only contain committed data and S lock is not needed to prevent from reading uncommitted data. Change-Id: Id6ec999b131cd6609d588966d7ae7788f429ab9d --- M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeSearchCursor.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java 4 files changed, 14 insertions(+), 6 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/37/2637/1 diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java index 81f4a83..d84a778 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java @@ -106,8 +106,8 @@ if (!outputPriorityQueue.isEmpty()) { PriorityQueueElement queueHead = outputPriorityQueue.peek(); if (canCallProceed) { - resultOfSearchCallbackProceed = searchCallback.proceed(queueHead.getTuple()); - if (includeMutableComponent) { + if (includeMutableComponent && queueHead.getCursorIndex() == 0) { + resultOfSearchCallbackProceed = searchCallback.proceed(queueHead.getTuple()); if (!resultOfSearchCallbackProceed) { // In case proceed() fails and there is an in-memory component, // we can't simply use this element since there might be a change. @@ -150,6 +150,10 @@ includeMutableComponent = false; } } + } else { + // only perform locking for tuples from memory components. + // all tuples from disk components have already been committed, and we're safe to proceed + resultOfSearchCallbackProceed = true; } } diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java index 4d444b9..d39c601 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexSearchCursor.java @@ -59,6 +59,7 @@ private List<IIndexAccessor> deletedKeysBTreeAccessors; private RangePredicate keySearchPred; private ILSMIndexOperationContext opCtx; + private boolean includeMemoryComponents; private List<ILSMComponent> operationalComponents; private ITupleReference currentTuple = null; @@ -76,7 +77,7 @@ accessorIndex = 0; this.searchPred = searchPred; this.searchCallback = lsmInitState.getSearchOperationCallback(); - + includeMemoryComponents = false; // For searching the deleted-keys BTrees. deletedKeysBTreeAccessors = lsmInitState.getDeletedKeysBTreeAccessors(); deletedKeysBTreeCursors = new IIndexCursor[deletedKeysBTreeAccessors.size()]; @@ -87,6 +88,7 @@ if (component.getType() == LSMComponentType.MEMORY) { // No need for a bloom filter for the in-memory BTree. deletedKeysBTreeBloomFilters[i] = null; + includeMemoryComponents = true; } else { deletedKeysBTreeBloomFilters[i] = ((LSMInvertedIndexDiskComponent) component).getBloomFilter(); } @@ -121,7 +123,8 @@ while (currentCursor.hasNext()) { currentCursor.next(); currentTuple = currentCursor.getTuple(); - resultOfSearchCallBackProceed = searchCallback.proceed(currentTuple); + resultOfSearchCallBackProceed = + includeMemoryComponents && accessorIndex == 0 ? searchCallback.proceed(currentTuple) : true; if (!resultOfSearchCallBackProceed) { // We assume that the underlying cursors materialize their results such that diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeSearchCursor.java index c79735f..b9e174f 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeSearchCursor.java @@ -98,7 +98,8 @@ rtreeCursors[currentCursor].next(); ITupleReference currentTuple = rtreeCursors[currentCursor].getTuple(); // Call proceed() to do necessary operations before returning this tuple. - resultOfsearchCallbackProceed = searchCallback.proceed(currentTuple); + resultOfsearchCallbackProceed = + currentCursor == 0 && includeMutableComponent ? searchCallback.proceed(currentTuple) : true; btreeTuple.reset(rtreeCursors[currentCursor].getTuple()); boolean killerTupleFound = false; for (int i = 0; i < currentCursor && !killerTupleFound; i++) { diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java index 7db65bd..05dc3ef 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesSearchCursor.java @@ -177,7 +177,7 @@ // reconcile() and complete() can be added later after considering the semantics. // Call proceed() to do necessary operations before returning this tuple. - resultOfsearchCallBackProceed = searchCallback.proceed(diskRTreeTuple); + resultOfsearchCallBackProceed = true; if (searchMemBTrees(diskRTreeTuple, numMemoryComponents)) { // anti-matter tuple is NOT found foundNext = true; -- To view, visit https://asterix-gerrit.ics.uci.edu/2637 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id6ec999b131cd6609d588966d7ae7788f429ab9d Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Luo Chen <cl...@uci.edu>