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 Summary
Nested 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static intprivate static org.apache.hadoop.hbase.client.Connectionprivate 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.client.Tableprivate static org.apache.hadoop.hbase.TableNameTable configurationprivate static final HBaseTestingUtilityprivate static byte[]private static int -
Constructor Summary
Constructors -
Method Summary
Modifier 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 org.apache.hadoop.hbase.client.TablecreateTestTable(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
-
TABLE
-
CONN
-
TABLE_NAME
Table 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
-
TestScannerHeartbeatMessages
public TestScannerHeartbeatMessages()
-
-
Method Details
-
setUpBeforeClass
- Throws:
Exception
-
testTimeLimitAccountsForQueueTime
- Throws:
IOExceptionInterruptedException
-
createTestTable
static org.apache.hadoop.hbase.client.Table createTestTable(org.apache.hadoop.hbase.TableName name, byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] cellValue) throws IOException - Throws:
IOException
-
createPuts
static 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
-
testImportanceOfHeartbeats
Run 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
-
testHeartbeatBetweenRows
Test the case that the time limit for the scan is reached after each full row of cells is fetched.- Throws:
Exception
-
testHeartbeatBetweenColumnFamilies
Test the case that the time limit for scans is reached in between column families- Throws:
Exception
-
testHeartbeatWithSparseCellFilter
Test the case that there is a filter which filters most of cells- Throws:
Exception
-
testHeartbeatWithSparseRowFilter
Test the case that there is a filter which filters most of rows- Throws:
Exception
-
testEquivalenceOfScanWithHeartbeats
private 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 testedrowSleepTime- The time to sleep between fetches of row cellscfSleepTime- The time to sleep between fetches of column family cellssleepBeforeCf- set to true when column family sleeps should occur before the cells for that column family are fetched- Throws:
Exception
-
configureSleepTime
Helper method for setting the time to sleep between rows and column families. If a sleep time is negative then that sleep will be disabled -
disableSleeping
Disable the sleeping mechanism server side.
-