Permalink
Browse files

HBASEWD-17: Wrong interval pairs when end key is empty in original scan

  • Loading branch information...
1 parent 2c677e5 commit 3bc49c9f6e5a75b19719793e13c24dc969d3c291 @abaranau abaranau committed Mar 7, 2013
@@ -49,9 +49,10 @@
byte[][] stopKeys;
if (Arrays.equals(originalStopKey, HConstants.EMPTY_END_ROW)) {
Arrays.sort(startKeys, Bytes.BYTES_RAWCOMPARATOR);
- stopKeys = new byte[startKeys.length][];
+ // stop keys are the start key of the next interval
+ stopKeys = getAllDistributedKeys(HConstants.EMPTY_BYTE_ARRAY);
for (int i = 0; i < stopKeys.length - 1; i++) {
- stopKeys[i] = startKeys[i + 1];
+ stopKeys[i] = stopKeys[i + 1];
}
stopKeys[stopKeys.length - 1] = HConstants.EMPTY_END_ROW;
} else {
@@ -106,6 +106,15 @@ public void testSimpleScanUnbounded() throws IOException {
testSimpleScanInternal(origKeyPrefix, new Scan(), 500, 500, 0, 999);
}
+ /** Test scan without stop key. */
+ @Test
+ public void testSimpleScanWithoutStopKey() throws IOException {
+ long origKeyPrefix = System.currentTimeMillis();
+ int seekIntervalMinValue = 100;
+ byte[] startKey = Bytes.toBytes(origKeyPrefix + seekIntervalMinValue);
+ testSimpleScanInternal(origKeyPrefix, new Scan(startKey), 500, 500, 100, 999);
+ }
+
/** Test scan with start and stop key. */
@Test
public void testMapReduceBounded() throws IOException, InterruptedException, ClassNotFoundException {

0 comments on commit 3bc49c9

Please sign in to comment.