public class TestPartialResultsFromClientSide extends Object
Result
s that contain only a portion of a row's complete list of cells. Partial results
are formed when the server breaches its maximum result size when trying to service a client's RPC
request. It is the responsibility of the scanner on the client side to recognize when partial
results have been returned and to take action to form the complete results.
Unless the flag Scan.setAllowPartialResults(boolean)
has been set to true, the caller of
ResultScanner.next()
should never see partial results.
Modifier and Type | Field and Description |
---|---|
private static long |
CELL_HEAP_SIZE |
static HBaseClassTestRule |
CLASS_RULE |
private static byte[][] |
FAMILIES |
private static byte[] |
FAMILY |
private static org.slf4j.Logger |
LOG |
private static int |
MINICLUSTER_SIZE |
org.junit.rules.TestName |
name |
private static int |
NUM_COLS |
private static int |
NUM_FAMILIES |
private static int |
NUM_QUALIFIERS |
private static int |
NUM_ROWS |
private static byte[] |
QUALIFIER |
private static byte[][] |
QUALIFIERS |
private static byte[] |
ROW |
private static byte[][] |
ROWS |
private static org.apache.hadoop.hbase.client.Table |
TABLE |
private static org.apache.hadoop.hbase.TableName |
TABLE_NAME
Table configuration
|
private static HBaseTestingUtility |
TEST_UTIL |
private static long |
timeout |
private static byte[] |
VALUE |
private static int |
VALUE_SIZE |
Constructor and Description |
---|
TestPartialResultsFromClientSide() |
Modifier and Type | Method and Description |
---|---|
private void |
assertCell(org.apache.hadoop.hbase.Cell cell,
byte[] row,
byte[] cf,
byte[] cq) |
(package private) static void |
compareResults(org.apache.hadoop.hbase.client.Result r1,
org.apache.hadoop.hbase.client.Result r2,
String message)
Compares two results and fails the test if the results are different nnn
|
private int |
countCellsFromScanner(org.apache.hadoop.hbase.client.ResultScanner scanner)
Exhausts the scanner by calling next repetitively.
|
(package private) static ArrayList<org.apache.hadoop.hbase.Cell> |
createKeyValuesForRow(byte[] row,
byte[][] families,
byte[][] qualifiers,
byte[] value)
Make key values to represent each possible combination of family and qualifier in the specified
row.
|
(package private) static ArrayList<org.apache.hadoop.hbase.client.Put> |
createPuts(byte[][] rows,
byte[][] families,
byte[][] qualifiers,
byte[] value)
Make puts to put the input value into each combination of row, family, and qualifier
|
(package private) static org.apache.hadoop.hbase.client.Table |
createTestTable(org.apache.hadoop.hbase.TableName name,
byte[][] rows,
byte[][] families,
byte[][] qualifiers,
byte[] cellValue) |
private long |
getCellHeapSize() |
private long |
getResultSizeForNumberOfCells(int numberOfCells)
n * @return the result size that should be used in
Scan.setMaxResultSize(long) if you
want the server to return exactly numberOfCells cells n |
private void |
moveRegion(org.apache.hadoop.hbase.client.Table table,
int index) |
static void |
setUpBeforeClass() |
static void |
tearDownAfterClass() |
void |
testAllowPartialResults()
Ensure that we only see Results marked as partial when the allowPartial flag is set n
|
void |
testBatchingResultWhenRegionMove() |
void |
testCompleteResultWhenRegionMove() |
void |
testDontThrowUnknowScannerExceptionToClient() |
void |
testEquivalenceOfScanResults()
Ensure that the results returned from a scanner that retrieves all results in a single RPC call
matches the results that are returned from a scanner that must incrementally combine partial
results into complete results.
|
void |
testEquivalenceOfScanResults(org.apache.hadoop.hbase.client.Table table,
org.apache.hadoop.hbase.client.Scan scan1,
org.apache.hadoop.hbase.client.Scan scan2) |
void |
testExceptionThrownOnMismatchedPartialResults()
When reconstructing the complete result from its partials we ensure that the row of each
partial result is the same.
|
void |
testExpectedNumberOfCellsPerPartialResult()
Setting the max result size allows us to control how many cells we expect to see on each call
to next on the scanner.
|
void |
testExpectedNumberOfCellsPerPartialResult(org.apache.hadoop.hbase.client.Scan baseScan) |
void |
testExpectedNumberOfCellsPerPartialResult(org.apache.hadoop.hbase.client.Scan baseScan,
int expectedNumberOfCells) |
void |
testExpectedValuesOfPartialResults()
Ensure that the expected key values appear in a result returned from a scanner that is
combining partial results into complete results n
|
void |
testExpectedValuesOfPartialResults(boolean reversed) |
void |
testMayHaveMoreCellsInRowReturnsTrueAndSetBatch() |
void |
testNoPartialResultsWhenRowFilterPresent()
When a scan has a filter where
Filter.hasFilterRow() is
true, the scanner should not return partial results. |
void |
testOrderingOfCellsInPartialResults()
Order of cells in partial results matches the ordering of cells from complete results n
|
void |
testOrderingOfCellsInPartialResults(org.apache.hadoop.hbase.client.Scan basePartialScan) |
void |
testPartialResultsAndBatch()
Test various combinations of batching and partial results for correctness
|
void |
testPartialResultsAndBatch(int batch,
int cellsPerPartialResult) |
void |
testPartialResultsAndCaching()
Examine the interaction between the maxResultSize and caching.
|
void |
testPartialResultsAndCaching(int resultSizeRowLimit,
int cachingRowLimit) |
void |
testPartialResultsReassembly()
Test the method
Result.createCompleteResult(Iterable) n |
void |
testPartialResultsReassembly(org.apache.hadoop.hbase.client.Scan scanBase) |
void |
testPartialResultsWithColumnFilter()
Test partial Result re-assembly in the presence of different filters.
|
void |
testPartialResultsWithColumnFilter(org.apache.hadoop.hbase.filter.Filter filter) |
void |
testPartialResultWhenRegionMove() |
void |
testReadPointAndPartialResults() |
void |
testReversedCompleteResultWhenRegionMove() |
void |
testReversedPartialResultWhenRegionMove() |
(package private) static void |
verifyResult(org.apache.hadoop.hbase.client.Result result,
List<org.apache.hadoop.hbase.Cell> expKvList,
String msg)
Verifies that result contains all the key values within expKvList.
|
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static final HBaseTestingUtility TEST_UTIL
private static final int MINICLUSTER_SIZE
private static org.apache.hadoop.hbase.client.Table TABLE
private static org.apache.hadoop.hbase.TableName TABLE_NAME
private static int NUM_ROWS
private static byte[] ROW
private static byte[][] ROWS
private static int NUM_FAMILIES
private static byte[] FAMILY
private static byte[][] FAMILIES
private static int NUM_QUALIFIERS
private static byte[] QUALIFIER
private static byte[][] QUALIFIERS
private static int VALUE_SIZE
private static byte[] VALUE
private static int NUM_COLS
private static long CELL_HEAP_SIZE
private static long timeout
public org.junit.rules.TestName name
public TestPartialResultsFromClientSide()
public static void setUpBeforeClass() throws Exception
Exception
static org.apache.hadoop.hbase.client.Table createTestTable(org.apache.hadoop.hbase.TableName name, byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] cellValue) throws IOException
IOException
public static void tearDownAfterClass() throws Exception
Exception
public void testExpectedValuesOfPartialResults() throws Exception
Exception
public void testExpectedValuesOfPartialResults(boolean reversed) throws Exception
Exception
public void testAllowPartialResults() throws Exception
Exception
public void testEquivalenceOfScanResults() throws Exception
Exception
public void testEquivalenceOfScanResults(org.apache.hadoop.hbase.client.Table table, org.apache.hadoop.hbase.client.Scan scan1, org.apache.hadoop.hbase.client.Scan scan2) throws Exception
Exception
public void testOrderingOfCellsInPartialResults() throws Exception
Exception
public void testOrderingOfCellsInPartialResults(org.apache.hadoop.hbase.client.Scan basePartialScan) throws Exception
Exception
public void testExpectedNumberOfCellsPerPartialResult() throws Exception
Exception
public void testExpectedNumberOfCellsPerPartialResult(org.apache.hadoop.hbase.client.Scan baseScan) throws Exception
Exception
public void testExpectedNumberOfCellsPerPartialResult(org.apache.hadoop.hbase.client.Scan baseScan, int expectedNumberOfCells) throws Exception
Exception
private long getCellHeapSize() throws Exception
Exception
private long getResultSizeForNumberOfCells(int numberOfCells) throws Exception
Scan.setMaxResultSize(long)
if you
want the server to return exactly numberOfCells cells nException
public void testPartialResultsAndBatch() throws Exception
Exception
public void testPartialResultsAndBatch(int batch, int cellsPerPartialResult) throws Exception
Exception
public void testPartialResultsReassembly() throws Exception
Result.createCompleteResult(Iterable)
nException
public void testPartialResultsReassembly(org.apache.hadoop.hbase.client.Scan scanBase) throws Exception
Exception
public void testExceptionThrownOnMismatchedPartialResults() throws IOException
IOException
public void testNoPartialResultsWhenRowFilterPresent() throws Exception
Filter.hasFilterRow()
is
true, the scanner should not return partial results. The scanner cannot return partial results
because the entire row needs to be read for the include/exclude decision to be madeException
public void testPartialResultsAndCaching() throws Exception
Exception
public void testPartialResultsAndCaching(int resultSizeRowLimit, int cachingRowLimit) throws Exception
resultSizeRowLimit
- The row limit that will be enforced through maxResultSizecachingRowLimit
- The row limit that will be enforced through caching nException
static ArrayList<org.apache.hadoop.hbase.client.Put> createPuts(byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] value) throws IOException
rows
- the rows to usefamilies
- the families to usequalifiers
- the qualifiers to usevalue
- the values to useIOException
- if there is a problem creating one of the Put objectsstatic ArrayList<org.apache.hadoop.hbase.Cell> createKeyValuesForRow(byte[] row, byte[][] families, byte[][] qualifiers, byte[] value)
row
- the row to usefamilies
- the families to usequalifiers
- the qualifiers to usevalue
- the values to usestatic void verifyResult(org.apache.hadoop.hbase.client.Result result, List<org.apache.hadoop.hbase.Cell> expKvList, String msg)
static void compareResults(org.apache.hadoop.hbase.client.Result r1, org.apache.hadoop.hbase.client.Result r2, String message)
public void testReadPointAndPartialResults() throws Exception
Exception
private int countCellsFromScanner(org.apache.hadoop.hbase.client.ResultScanner scanner) throws Exception
scanner
- the scanner to exhaustException
- if there is a problem retrieving cells from the scannerpublic void testPartialResultsWithColumnFilter() throws Exception
Exception
public void testPartialResultsWithColumnFilter(org.apache.hadoop.hbase.filter.Filter filter) throws Exception
Exception
private void moveRegion(org.apache.hadoop.hbase.client.Table table, int index) throws IOException
IOException
private void assertCell(org.apache.hadoop.hbase.Cell cell, byte[] row, byte[] cf, byte[] cq)
public void testPartialResultWhenRegionMove() throws IOException
IOException
public void testReversedPartialResultWhenRegionMove() throws IOException
IOException
public void testCompleteResultWhenRegionMove() throws IOException
IOException
public void testReversedCompleteResultWhenRegionMove() throws IOException
IOException
public void testBatchingResultWhenRegionMove() throws IOException
IOException
public void testDontThrowUnknowScannerExceptionToClient() throws Exception
Exception
public void testMayHaveMoreCellsInRowReturnsTrueAndSetBatch() throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.