fixed bug that young-seok found in LSM BTree insert that allowed duplicate key insertion

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1863 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
index d8dcbef..d2200fe 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
@@ -476,6 +476,7 @@
                 restartOp = updateLeaf(tuple, targetTupleIndex, pageId, ctx);
             }
         } else {
+            targetTupleIndex = ctx.leafFrame.findInsertTupleIndex(tuple);
             restartOp = insertLeaf(tuple, targetTupleIndex, pageId, ctx);
         }
         return restartOp;
@@ -996,7 +997,7 @@
                 throw new BTreeUnsortedInputException("Input stream given to BTree bulk load is not sorted.");
             }
         }
-        
+
         protected void handleException() throws HyracksDataException {
             // Unlatch and unpin pages.
             for (NodeFrontier nodeFrontier : nodeFrontiers) {
@@ -1004,7 +1005,7 @@
                 bufferCache.unpin(nodeFrontier.page);
             }
         }
-        
+
         protected void propagateBulk(int level) throws HyracksDataException {
             if (splitKey.getBuffer() == null)
                 return;