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
Modifier and TypeClassDescriptionprivate static class
Custom HRegion class that instantiatesRegionScanner
s with configurable sleep times between fetches of row Results and/or column family cells.private static class
Custom HRegionServer instance that instantiatesTestScannerHeartbeatMessages.HeartbeatRPCServices
in place ofRSRpcServices
to allow us to toggle support for heartbeat messagesprivate static final class
Custom KV Heap that can be configured to sleep/wait in between retrievals of column family cells.private static class
Custom RegionScanner that can be configured to sleep between retrievals of row Results and/or column family cellsprivate static final class
Custom reversed KV Heap that can be configured to sleep in between retrievals of column family cells.private static class
Custom ReversedRegionScanner that can be configured to sleep between retrievals of row Results and/or column family cellsprivate static class
Custom RSRpcServices instance that allows heartbeat support to be toggledstatic class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private static int
private static org.apache.hadoop.hbase.client.AsyncConnection
private static int
private static int
private static byte[][]
private static byte[]
private static int
private static int
private static int
private static byte[]
private static byte[][]
private static byte[]
private static byte[][]
private static int
private static org.apache.hadoop.hbase.TableName
Table configurationprivate static final HBaseTestingUtil
private static byte[]
private static int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
configureSleepTime
(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 void
createTestTable
(org.apache.hadoop.hbase.TableName name, byte[][] rows, byte[][] families, byte[][] qualifiers, byte[] cellValue) private static void
Disable the sleeping mechanism server side.static void
void
static void
void
private void
testEquivalenceOfScanWithHeartbeats
(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 necessaryvoid
Test the case that the time limit for scans is reached in between column familiesvoid
Test the case that the time limit for the scan is reached after each full row of cells is fetched.void
Test the case that there is a filter which filters most of cellsvoid
Test the case that there is a filter which filters most of rowsprivate void
testImportanceOfHeartbeats
(Callable<Void> testCallable) Run the test callable when heartbeats are enabled/disabled.void
-
Field Details
-
CLASS_RULE
-
TEST_UTIL
-
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:
IOException
InterruptedException
-
createTestTable
static void 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.
-