Class TestScannerHeartbeatMessages
java.lang.Object
org.apache.hadoop.hbase.regionserver.TestScannerHeartbeatMessages
Here we test to make sure that scans return the expected Results when the server is sending the
 Client heartbeat messages. Heartbeat messages are essentially keep-alive messages (they prevent
 the scanner on the client side from timing out). A heartbeat message is sent from the server to
 the client when the server has exceeded the time limit during the processing of the scan. When
 the time limit is reached, the server will return to the Client whatever Results it has
 accumulated (potentially empty).
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprivate static classCustom HRegion class that instantiatesRegionScanners with configurable sleep times between fetches of row Results and/or column family cells.private static classCustom HRegionServer instance that instantiatesTestScannerHeartbeatMessages.HeartbeatRPCServicesin place ofRSRpcServicesto allow us to toggle support for heartbeat messagesprivate static final classCustom KV Heap that can be configured to sleep/wait in between retrievals of column family cells.private static classCustom RegionScanner that can be configured to sleep between retrievals of row Results and/or column family cellsprivate static final classCustom reversed KV Heap that can be configured to sleep in between retrievals of column family cells.private static classCustom ReversedRegionScanner that can be configured to sleep between retrievals of row Results and/or column family cellsprivate static classCustom RSRpcServices instance that allows heartbeat support to be toggledstatic classstatic class
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static intprivate static org.apache.hadoop.hbase.client.AsyncConnectionprivate static intprivate static intprivate static byte[][]private static byte[]private static intprivate static intprivate static intprivate static byte[]private static byte[][]private static byte[]private static byte[][]private static intprivate static org.apache.hadoop.hbase.TableNameTable configurationprivate static final HBaseTestingUtilprivate static byte[]private static int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate static voidconfigureSleepTime(int rowSleepTime, int cfSleepTime, boolean sleepBeforeCf) Helper method for setting the time to sleep between rows and column families.(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 voidcreateTestTable(org.apache.hadoop.hbase.TableName name, byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] cellValue) private static voidDisable the sleeping mechanism server side.static voidvoidstatic voidvoidprivate voidtestEquivalenceOfScanWithHeartbeats(org.apache.hadoop.hbase.client.Scan scan, int rowSleepTime, int cfSleepTime, boolean sleepBeforeCf) Test the equivalence of a scan versus the same scan executed when heartbeat messages are necessaryvoidTest the case that the time limit for scans is reached in between column familiesvoidTest the case that the time limit for the scan is reached after each full row of cells is fetched.voidTest the case that there is a filter which filters most of cellsvoidTest the case that there is a filter which filters most of rowsprivate voidtestImportanceOfHeartbeats(Callable<Void> testCallable) Run the test callable when heartbeats are enabled/disabled.void
- 
Field Details- 
CLASS_RULE
- 
TEST_UTIL
- 
CONN
- 
TABLE_NAMETable configuration
- 
NUM_ROWS
- 
ROW
- 
ROWS
- 
NUM_FAMILIES
- 
FAMILY
- 
FAMILIES
- 
NUM_QUALIFIERS
- 
QUALIFIER
- 
QUALIFIERS
- 
VALUE_SIZE
- 
VALUE
- 
SERVER_TIMEOUT
- 
CLIENT_TIMEOUT
- 
DEFAULT_ROW_SLEEP_TIME
- 
DEFAULT_CF_SLEEP_TIME
 
- 
- 
Constructor Details- 
TestScannerHeartbeatMessagespublic TestScannerHeartbeatMessages()
 
- 
- 
Method Details- 
setUpBeforeClass- Throws:
- Exception
 
- 
testTimeLimitAccountsForQueueTime- Throws:
- IOException
- InterruptedException
 
- 
createTestTablestatic void createTestTable(org.apache.hadoop.hbase.TableName name, byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] cellValue) throws IOException - Throws:
- IOException
 
- 
createPutsstatic ArrayList<org.apache.hadoop.hbase.client.Put> createPuts(byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] value) throws IOException Make puts to put the input value into each combination of row, family, and qualifier- Throws:
- IOException
 
- 
tearDownAfterClass- Throws:
- Exception
 
- 
setupBeforeTest- Throws:
- Exception
 
- 
teardownAfterTest- Throws:
- Exception
 
- 
testImportanceOfHeartbeatsRun the test callable when heartbeats are enabled/disabled. We expect all tests to only pass when heartbeat messages are enabled (otherwise the test is pointless). When heartbeats are disabled, the test should throw an exception.- Throws:
- InterruptedException
 
- 
testHeartbeatBetweenRowsTest the case that the time limit for the scan is reached after each full row of cells is fetched.- Throws:
- Exception
 
- 
testHeartbeatBetweenColumnFamiliesTest the case that the time limit for scans is reached in between column families- Throws:
- Exception
 
- 
testHeartbeatWithSparseCellFilterTest the case that there is a filter which filters most of cells- Throws:
- Exception
 
- 
testHeartbeatWithSparseRowFilterTest the case that there is a filter which filters most of rows- Throws:
- Exception
 
- 
testEquivalenceOfScanWithHeartbeatsprivate void testEquivalenceOfScanWithHeartbeats(org.apache.hadoop.hbase.client.Scan scan, int rowSleepTime, int cfSleepTime, boolean sleepBeforeCf) throws Exception Test the equivalence of a scan versus the same scan executed when heartbeat messages are necessary- Parameters:
- scan- The scan configuration being tested
- rowSleepTime- The time to sleep between fetches of row cells
- cfSleepTime- The time to sleep between fetches of column family cells
- sleepBeforeCf- set to true when column family sleeps should occur before the cells for that column family are fetched
- Throws:
- Exception
 
- 
configureSleepTimeHelper method for setting the time to sleep between rows and column families. If a sleep time is negative then that sleep will be disabled
- 
disableSleepingDisable the sleeping mechanism server side.
 
-