HBASE-17634 Cleaned up the usage of Result.isPartial
Signed-off-by: zhangduo <zhangduo@apache.org>
This commit is contained in:
parent
4d90425031
commit
84a9eb3f5c
|
@ -324,7 +324,7 @@ class ScannerCallableWithReplicas implements RetryingCallable<Result[]> {
|
||||||
// 2. The last result was not a partial result which means it contained all of the cells for
|
// 2. The last result was not a partial result which means it contained all of the cells for
|
||||||
// that row (we no longer need any information from it). Set the start row to the next
|
// that row (we no longer need any information from it). Set the start row to the next
|
||||||
// closest row that could be seen.
|
// closest row that could be seen.
|
||||||
callable.getScan().withStartRow(this.lastResult.getRow(), this.lastResult.isPartial());
|
callable.getScan().withStartRow(this.lastResult.getRow(), this.lastResult.hasMoreCellsInRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
message = "Ensuring the expected keyValues are present for row " + row;
|
message = "Ensuring the expected keyValues are present for row " + row;
|
||||||
List<Cell> expectedKeyValues = createKeyValuesForRow(ROWS[row], FAMILIES, QUALIFIERS, VALUE);
|
List<Cell> expectedKeyValues = createKeyValuesForRow(ROWS[row], FAMILIES, QUALIFIERS, VALUE);
|
||||||
Result result = partialScanner.next();
|
Result result = partialScanner.next();
|
||||||
assertFalse(result.isPartial());
|
assertFalse(result.hasMoreCellsInRow());
|
||||||
verifyResult(result, expectedKeyValues, message);
|
verifyResult(result, expectedKeyValues, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
Result result = scanner.next();
|
Result result = scanner.next();
|
||||||
|
|
||||||
assertTrue(result != null);
|
assertTrue(result != null);
|
||||||
assertTrue(result.isPartial());
|
assertTrue(result.hasMoreCellsInRow());
|
||||||
assertTrue(result.rawCells() != null);
|
assertTrue(result.rawCells() != null);
|
||||||
assertTrue(result.rawCells().length == 1);
|
assertTrue(result.rawCells().length == 1);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
result = scanner.next();
|
result = scanner.next();
|
||||||
|
|
||||||
assertTrue(result != null);
|
assertTrue(result != null);
|
||||||
assertTrue(!result.isPartial());
|
assertTrue(!result.hasMoreCellsInRow());
|
||||||
assertTrue(result.rawCells() != null);
|
assertTrue(result.rawCells() != null);
|
||||||
assertTrue(result.rawCells().length == NUM_COLS);
|
assertTrue(result.rawCells().length == NUM_COLS);
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
for (Cell c : partialResult.rawCells()) {
|
for (Cell c : partialResult.rawCells()) {
|
||||||
aggregatePartialCells.add(c);
|
aggregatePartialCells.add(c);
|
||||||
}
|
}
|
||||||
} while (partialResult.isPartial());
|
} while (partialResult.hasMoreCellsInRow());
|
||||||
|
|
||||||
assertTrue("Number of cells differs. iteration: " + iterationCount,
|
assertTrue("Number of cells differs. iteration: " + iterationCount,
|
||||||
oneShotResult.rawCells().length == aggregatePartialCells.size());
|
oneShotResult.rawCells().length == aggregatePartialCells.size());
|
||||||
|
@ -353,7 +353,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
// the last group of cells that fit inside the maxResultSize
|
// the last group of cells that fit inside the maxResultSize
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"Result's cell count differed from expected number. result: " + result,
|
"Result's cell count differed from expected number. result: " + result,
|
||||||
result.rawCells().length == expectedNumberOfCells || !result.isPartial()
|
result.rawCells().length == expectedNumberOfCells || !result.hasMoreCellsInRow()
|
||||||
|| !Bytes.equals(prevRow, result.getRow()));
|
|| !Bytes.equals(prevRow, result.getRow()));
|
||||||
prevRow = result.getRow();
|
prevRow = result.getRow();
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
while ((result = scanner.next()) != null) {
|
while ((result = scanner.next()) != null) {
|
||||||
assertTrue(result.rawCells() != null);
|
assertTrue(result.rawCells() != null);
|
||||||
|
|
||||||
if (result.isPartial()) {
|
if (result.hasMoreCellsInRow()) {
|
||||||
final String error =
|
final String error =
|
||||||
"Cells:" + result.rawCells().length + " Batch size:" + batch
|
"Cells:" + result.rawCells().length + " Batch size:" + batch
|
||||||
+ " cellsPerPartialResult:" + cellsPerPartialResult + " rep:" + repCount;
|
+ " cellsPerPartialResult:" + cellsPerPartialResult + " rep:" + repCount;
|
||||||
|
@ -477,7 +477,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
do {
|
do {
|
||||||
partialResult = partialScanner.next();
|
partialResult = partialScanner.next();
|
||||||
partials.add(partialResult);
|
partials.add(partialResult);
|
||||||
} while (partialResult != null && partialResult.isPartial());
|
} while (partialResult != null && partialResult.hasMoreCellsInRow());
|
||||||
|
|
||||||
completeResult = Result.createCompleteResult(partials);
|
completeResult = Result.createCompleteResult(partials);
|
||||||
oneShotResult = oneShotScanner.next();
|
oneShotResult = oneShotScanner.next();
|
||||||
|
@ -538,7 +538,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
|
|
||||||
Result r = null;
|
Result r = null;
|
||||||
while ((r = scanner.next()) != null) {
|
while ((r = scanner.next()) != null) {
|
||||||
assertFalse(r.isPartial());
|
assertFalse(r.hasMoreCellsInRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
scanner.close();
|
scanner.close();
|
||||||
|
@ -588,7 +588,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
// hit before the caching limit and thus partial results may be seen
|
// hit before the caching limit and thus partial results may be seen
|
||||||
boolean expectToSeePartialResults = resultSizeRowLimit < cachingRowLimit;
|
boolean expectToSeePartialResults = resultSizeRowLimit < cachingRowLimit;
|
||||||
while ((r = clientScanner.next()) != null) {
|
while ((r = clientScanner.next()) != null) {
|
||||||
assertTrue(!r.isPartial() || expectToSeePartialResults);
|
assertTrue(!r.hasMoreCellsInRow() || expectToSeePartialResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
scanner.close();
|
scanner.close();
|
||||||
|
@ -853,7 +853,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result1.rawCells().length);
|
assertEquals(1, result1.rawCells().length);
|
||||||
Cell c1 = result1.rawCells()[0];
|
Cell c1 = result1.rawCells()[0];
|
||||||
assertCell(c1, ROWS[0], FAMILIES[NUM_FAMILIES - 1], QUALIFIERS[NUM_QUALIFIERS - 1]);
|
assertCell(c1, ROWS[0], FAMILIES[NUM_FAMILIES - 1], QUALIFIERS[NUM_QUALIFIERS - 1]);
|
||||||
assertFalse(result1.isPartial());
|
assertFalse(result1.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 2);
|
moveRegion(table, 2);
|
||||||
|
|
||||||
|
@ -861,7 +861,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result2.rawCells().length);
|
assertEquals(1, result2.rawCells().length);
|
||||||
Cell c2 = result2.rawCells()[0];
|
Cell c2 = result2.rawCells()[0];
|
||||||
assertCell(c2, ROWS[1], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c2, ROWS[1], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertTrue(result2.isPartial());
|
assertTrue(result2.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 3);
|
moveRegion(table, 3);
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result3.rawCells().length);
|
assertEquals(1, result3.rawCells().length);
|
||||||
Cell c3 = result3.rawCells()[0];
|
Cell c3 = result3.rawCells()[0];
|
||||||
assertCell(c3, ROWS[1], FAMILIES[0], QUALIFIERS[1]);
|
assertCell(c3, ROWS[1], FAMILIES[0], QUALIFIERS[1]);
|
||||||
assertTrue(result3.isPartial());
|
assertTrue(result3.hasMoreCellsInRow());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result1.rawCells().length);
|
assertEquals(1, result1.rawCells().length);
|
||||||
Cell c1 = result1.rawCells()[0];
|
Cell c1 = result1.rawCells()[0];
|
||||||
assertCell(c1, ROWS[NUM_ROWS-1], FAMILIES[NUM_FAMILIES - 1], QUALIFIERS[NUM_QUALIFIERS - 1]);
|
assertCell(c1, ROWS[NUM_ROWS-1], FAMILIES[NUM_FAMILIES - 1], QUALIFIERS[NUM_QUALIFIERS - 1]);
|
||||||
assertFalse(result1.isPartial());
|
assertFalse(result1.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 2);
|
moveRegion(table, 2);
|
||||||
|
|
||||||
|
@ -900,7 +900,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result2.rawCells().length);
|
assertEquals(1, result2.rawCells().length);
|
||||||
Cell c2 = result2.rawCells()[0];
|
Cell c2 = result2.rawCells()[0];
|
||||||
assertCell(c2, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c2, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertTrue(result2.isPartial());
|
assertTrue(result2.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 3);
|
moveRegion(table, 3);
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(1, result3.rawCells().length);
|
assertEquals(1, result3.rawCells().length);
|
||||||
Cell c3 = result3.rawCells()[0];
|
Cell c3 = result3.rawCells()[0];
|
||||||
assertCell(c3, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[1]);
|
assertCell(c3, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[1]);
|
||||||
assertTrue(result3.isPartial());
|
assertTrue(result3.hasMoreCellsInRow());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result1.rawCells().length);
|
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result1.rawCells().length);
|
||||||
Cell c1 = result1.rawCells()[0];
|
Cell c1 = result1.rawCells()[0];
|
||||||
assertCell(c1, ROWS[0], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c1, ROWS[0], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result1.isPartial());
|
assertFalse(result1.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 2);
|
moveRegion(table, 2);
|
||||||
|
|
||||||
|
@ -936,7 +936,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result2.rawCells().length);
|
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result2.rawCells().length);
|
||||||
Cell c2 = result2.rawCells()[0];
|
Cell c2 = result2.rawCells()[0];
|
||||||
assertCell(c2, ROWS[1], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c2, ROWS[1], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result2.isPartial());
|
assertFalse(result2.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 3);
|
moveRegion(table, 3);
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result3.rawCells().length);
|
assertEquals(NUM_FAMILIES * NUM_QUALIFIERS, result3.rawCells().length);
|
||||||
Cell c3 = result3.rawCells()[0];
|
Cell c3 = result3.rawCells()[0];
|
||||||
assertCell(c3, ROWS[2], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c3, ROWS[2], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result3.isPartial());
|
assertFalse(result3.hasMoreCellsInRow());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result1.rawCells().length);
|
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result1.rawCells().length);
|
||||||
Cell c1 = result1.rawCells()[0];
|
Cell c1 = result1.rawCells()[0];
|
||||||
assertCell(c1, ROWS[NUM_ROWS-1], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c1, ROWS[NUM_ROWS-1], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result1.isPartial());
|
assertFalse(result1.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 2);
|
moveRegion(table, 2);
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result2.rawCells().length);
|
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result2.rawCells().length);
|
||||||
Cell c2 = result2.rawCells()[0];
|
Cell c2 = result2.rawCells()[0];
|
||||||
assertCell(c2, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c2, ROWS[NUM_ROWS-2], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result2.isPartial());
|
assertFalse(result2.hasMoreCellsInRow());
|
||||||
|
|
||||||
moveRegion(table, 3);
|
moveRegion(table, 3);
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ public class TestPartialResultsFromClientSide {
|
||||||
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result3.rawCells().length);
|
assertEquals(NUM_FAMILIES*NUM_QUALIFIERS, result3.rawCells().length);
|
||||||
Cell c3 = result3.rawCells()[0];
|
Cell c3 = result3.rawCells()[0];
|
||||||
assertCell(c3, ROWS[NUM_ROWS-3], FAMILIES[0], QUALIFIERS[0]);
|
assertCell(c3, ROWS[NUM_ROWS-3], FAMILIES[0], QUALIFIERS[0]);
|
||||||
assertFalse(result3.isPartial());
|
assertFalse(result3.hasMoreCellsInRow());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue