abdullah alamoudi has submitted this change and it was merged.

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
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2633
Reviewed-by: Murtadha Hubail <[email protected]>
Sonar-Qube: Jenkins <[email protected]>
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Contrib: Jenkins <[email protected]>
---
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(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Murtadha Hubail: Looks good to me, approved



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: merged
Gerrit-Change-Id: If20cc671974485bf73ad05e95d681424805611d3
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: abdullah alamoudi <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Murtadha Hubail <[email protected]>
Gerrit-Reviewer: abdullah alamoudi <[email protected]>

Reply via email to