abdullah alamoudi has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2633

Change subject: [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
---
M 
hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeRangeSearchCursor.java
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/33/2633/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 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 @@
         }
         
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();

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2633
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If20cc671974485bf73ad05e95d681424805611d3
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: abdullah alamoudi <[email protected]>

Reply via email to