ASTERIXDB-1481: BTree Split ArrayIndexOutOfBounds

Ensure large flag BTree flag is set for large pages.

Change-Id: Icf531f6d63da96d3eb6732249bc9a1968866db5e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/926
Reviewed-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
index 406b494..63f516e 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
@@ -304,8 +304,8 @@
 
     public void growCapacity(IExtraPageBlockHelper extraPageBlockHelper,
             IBufferCache bufferCache, int delta) throws HyracksDataException {
+        setLargeFlag(true);
         if (delta <= 0) {
-            setLargeFlag(true);
             return;
         }
         int deltaPages = (int) Math.ceil((double) delta / bufferCache.getPageSize());