Luo Chen has submitted this change and it was merged. Change subject: [NO ISSUE][STO] Fix object creations during LSM operations ......................................................................
[NO ISSUE][STO] Fix object creations during LSM operations - user model changes: no - storage format changes: no - interface changes: no Details: - Replace LinkedList to ArrayList to avoid object creation everytime when we enter a LSM index - A small fix of LSMBTreePointSearchCursor to avoid object creation as well Change-Id: I4e796d1184a2d060a9514362cfc210f40393465f Reviewed-on: https://asterix-gerrit.ics.uci.edu/2189 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: abdullah alamoudi <bamou...@gmail.com> --- M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreePointSearchCursor.java M hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java 2 files changed, 6 insertions(+), 6 deletions(-) Approvals: Anon. E. Moose #1000171: abdullah alamoudi: Looks good to me, approved Jenkins: Verified; No violations found; Verified diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreePointSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreePointSearchCursor.java index b84a172..211a233 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreePointSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreePointSearchCursor.java @@ -163,7 +163,7 @@ searchCallback = lsmInitialState.getSearchOperationCallback(); predicate = (RangePredicate) lsmInitialState.getSearchPredicate(); numBTrees = operationalComponents.size(); - if (rangeCursors == null || rangeCursors.length != numBTrees) { + if (rangeCursors == null || rangeCursors.length < numBTrees) { // object creation: should be relatively low rangeCursors = new BTreeRangeSearchCursor[numBTrees]; btreeAccessors = new BTreeAccessor[numBTrees]; @@ -270,7 +270,7 @@ private void closeCursors() throws HyracksDataException { if (rangeCursors != null) { - for (int i = 0; i < rangeCursors.length; ++i) { + for (int i = 0; i < numBTrees; ++i) { if (rangeCursors[i] != null) { rangeCursors[i].close(); } diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java index 0818b08..1b540b7 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndexOperationContext.java @@ -18,7 +18,7 @@ */ package org.apache.hyracks.storage.am.lsm.common.impls; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; @@ -61,9 +61,9 @@ this.index = index; this.searchCallback = searchCallback; this.modificationCallback = modificationCallback; - this.componentHolder = new LinkedList<>(); - this.componentsToBeMerged = new LinkedList<>(); - this.componentsToBeReplicated = new LinkedList<>(); + this.componentHolder = new ArrayList<>(); + this.componentsToBeMerged = new ArrayList<>(); + this.componentsToBeReplicated = new ArrayList<>(); if (filterFields != null) { indexTuple = new PermutingTupleReference(treeFields); filterCmp = MultiComparator.create(filterCmpFactories); -- To view, visit https://asterix-gerrit.ics.uci.edu/2189 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4e796d1184a2d060a9514362cfc210f40393465f Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Luo Chen <cl...@uci.edu> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-Reviewer: Luo Chen <cl...@uci.edu> Gerrit-Reviewer: abdullah alamoudi <bamou...@gmail.com>