You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2018/05/31 21:43:41 UTC

[16/43] asterixdb git commit: [NO ISSUE][STO] Fix component switch in LSMBTreeRangeSearchCursor

[NO ISSUE][STO] Fix component switch in LSMBTreeRangeSearchCursor

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- switchRequest array is used for switching memory components
  with disk components. It has the size = maximum number of
  memory components which can be greater than all the number of
  components size in certain cases (0 disk component,
  1 memory component for example). To avoid index out of bound,
  we end the loop early in this corner case.

Change-Id: If20cc671974485bf73ad05e95d681424805611d3
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2633
Reviewed-by: Murtadha Hubail <mh...@apache.org>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/e29ecfb6
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/e29ecfb6
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/e29ecfb6

Branch: refs/heads/release-0.9.4-pre-rc
Commit: e29ecfb6a053f95b1b262b99d0cd0650c6eef658
Parents: 6cbb8da
Author: Abdullah Alamoudi <ba...@gmail.com>
Authored: Thu May 3 19:45:50 2018 +0300
Committer: abdullah alamoudi <ba...@gmail.com>
Committed: Thu May 3 23:03:11 2018 -0700

----------------------------------------------------------------------
 .../storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e29ecfb6/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java
----------------------------------------------------------------------
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 a675047..361612e 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
@@ -212,7 +212,10 @@ public class LSMBTreeRangeSearchCursor extends LSMIndexSearchCursor {
         }
         opCtx.getIndex().getHarness().replaceMemoryComponentsWithDiskComponents(getOpCtx(), replaceFrom);
         // redo the search on the new component
-        for (int i = replaceFrom; i < switchRequest.length; i++) {
+        // switchRequest array has the size = number of memory components. which can be greater
+        // than operationalComponents size in certain cases (0 disk component, 1 memory component for example)
+        // To avoid index out of bound, we end the loop at the first of the two conditions
+        for (int i = replaceFrom; i < switchRequest.length && i < operationalComponents.size(); i++) {
             if (switchRequest[i]) {
                 ILSMComponent component = operationalComponents.get(i);
                 BTree btree = (BTree) component.getIndex();