Package org.apache.hadoop.hbase.client
Class TestAsyncProcess
java.lang.Object
org.apache.hadoop.hbase.client.TestAsyncProcess
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
(package private) static class
(package private) static class
(package private) static class
Used to simulate the case where a RegionServer responds to a multi request, but some or all of the actions have an Exception instead of Result.(package private) static class
(package private) static class
(package private) static class
(package private) static class
(package private) static class
Make the backoff time always different on each call.(package private) static class
Returns our async process.(package private) static class
Returns our async process.(package private) static class
private static interface
private static enum
After reading TheDailyWtf, I always wanted to create a MyBoolean enum like this! -
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private org.apache.hadoop.conf.Configuration
private org.apache.hadoop.hbase.client.ConnectionConfiguration
private static final byte[]
private static final byte[]
private static final byte[]
private static final org.apache.hadoop.hbase.TableName
private static final byte[]
private static Exception
private static final org.apache.hadoop.hbase.HRegionInfo
private static final org.apache.hadoop.hbase.client.RegionInfo
private static final org.apache.hadoop.hbase.client.RegionInfo
private static final org.apache.hadoop.hbase.HRegionInfo
private static final org.apache.hadoop.hbase.client.RegionInfo
private static final org.apache.hadoop.hbase.HRegionInfo
private static final org.apache.hadoop.hbase.RegionLocations
private static final org.apache.hadoop.hbase.RegionLocations
private static final org.apache.hadoop.hbase.RegionLocations
private static final org.apache.hadoop.hbase.HRegionLocation
private static final org.apache.hadoop.hbase.HRegionLocation
private static final org.apache.hadoop.hbase.HRegionLocation
private static final org.slf4j.Logger
private static final int
private int
private int
private static final org.apache.hadoop.hbase.ServerName
private static final org.apache.hadoop.hbase.ServerName
private static final org.apache.hadoop.hbase.ServerName
private static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
private static long
calculateRequestCount
(long putSizePerServer, long maxHeapSizePerRequest) private void
checkPeriodicFlushParameters
(org.apache.hadoop.hbase.client.ClusterConnection conn, TestAsyncProcess.MyAsyncProcess ap, long setTO, long expectTO, long setTT, long expectTT) private org.apache.hadoop.hbase.client.BufferedMutatorParams
createBufferedMutatorParams
(TestAsyncProcess.MyAsyncProcess ap, org.apache.hadoop.hbase.TableName name) private org.apache.hadoop.hbase.client.ClusterConnection
private org.apache.hadoop.hbase.client.ClusterConnection
createHConnection
(org.apache.hadoop.hbase.client.ConnectionConfiguration configuration) private org.apache.hadoop.hbase.client.ClusterConnection
createHConnectionCommon
(org.apache.hadoop.hbase.client.ConnectionConfiguration connectionConfiguration) private org.apache.hadoop.hbase.client.ClusterConnection
createHConnectionWithReplicas
(org.apache.hadoop.hbase.client.ConnectionConfiguration configuration) (package private) static org.apache.hadoop.hbase.client.MultiResponse
createMultiResponse
(org.apache.hadoop.hbase.client.MultiAction multi, AtomicInteger nbMultiResponse, AtomicInteger nbActions, TestAsyncProcess.ResponseGenerator gen) private org.apache.hadoop.hbase.client.Put
createPut
(int regCnt, boolean success) createReplicaAp
(int replicaAfterMs, int primaryMs, int replicaMs) createReplicaAp
(int replicaAfterMs, int primaryMs, int replicaMs, int retries) private void
doSubmitRequest
(long maxHeapSizePerRequest, long putsHeapSize) private static List<org.apache.hadoop.hbase.client.Get>
makeTimelineGets
(byte[]... rows) private static void
setMockLocation
(org.apache.hadoop.hbase.client.ClusterConnection hc, byte[] row, org.apache.hadoop.hbase.RegionLocations result) void
void
void
void
void
void
void
testFail()
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
private void
testRetryPause
(org.apache.hadoop.conf.Configuration testConf, long expectedPause, org.apache.hadoop.hbase.HBaseIOException exception) void
private void
testRetryPauseWhenServerIsOverloaded
(org.apache.hadoop.hbase.HBaseServerException exception) void
void
Below tests make sure we could use a special pause setting when retry an exception whereHBaseServerException.isServerOverloaded(Throwable)
is true, see HBASE-17114private void
testRetryWithExceptionClearsMetaCache
(boolean useRegionException) void
Tests that we properly recover from exceptions that DO NOT go through receiveGlobalFailure, due to updating the meta cache for the region which failed.void
Tests that we properly recover from exceptions that go through receiveGlobalFailure, due to updating the meta cache for the region which failed.void
void
void
void
void
void
void
void
void
void
void
private void
void
void
void
This test simulates multiple regions on 2 servers.void
void
private void
verifyReplicaResult
(org.apache.hadoop.hbase.client.AsyncRequestFuture ars, TestAsyncProcess.RR... expecteds) private void
verifyResult
(org.apache.hadoop.hbase.client.AsyncRequestFuture ars, boolean... expected)
-
Field Details
-
CLASS_RULE
-
LOG
-
DUMMY_TABLE
-
DUMMY_BYTES_1
-
DUMMY_BYTES_2
-
DUMMY_BYTES_3
-
FAILS
-
CONF
-
CONNECTION_CONFIG
-
sn
-
sn2
-
sn3
-
hri1
-
hri2
-
hri3
-
loc1
-
loc2
-
loc3
-
hri1r1
-
hri1r2
-
hri2r1
-
hrls1
-
hrls2
-
hrls3
-
success
- See Also:
-
failure
-
NB_RETRIES
- See Also:
-
RPC_TIMEOUT
-
OPERATION_TIMEOUT
-
-
Constructor Details
-
TestAsyncProcess
public TestAsyncProcess()
-
-
Method Details
-
beforeEach
-
createMultiResponse
static org.apache.hadoop.hbase.client.MultiResponse createMultiResponse(org.apache.hadoop.hbase.client.MultiAction multi, AtomicInteger nbMultiResponse, AtomicInteger nbActions, TestAsyncProcess.ResponseGenerator gen) -
testListRowAccess
-
calculateRequestCount
-
testSubmitSameSizeOfRequest
- Throws:
Exception
-
testSubmitLargeRequestWithUnlimitedSize
- Throws:
Exception
-
testSubmitRandomSizeRequest
- Throws:
Exception
-
testSubmitSmallRequest
- Throws:
Exception
-
testSubmitLargeRequest
- Throws:
Exception
-
doSubmitRequest
- Throws:
Exception
-
testSubmit
- Throws:
Exception
-
testSubmitWithCB
- Throws:
Exception
-
testSubmitBusyRegion
- Throws:
Exception
-
testSubmitBusyRegionServer
- Throws:
Exception
-
testFail
- Throws:
Exception
-
testSubmitTrue
- Throws:
IOException
-
testFailAndSuccess
- Throws:
Exception
-
testFlush
- Throws:
Exception
-
testTaskCountWithoutClientBackoffPolicy
- Throws:
IOException
InterruptedException
-
testTaskCountWithClientBackoffPolicy
- Throws:
IOException
InterruptedException
-
testTaskCount
private void testTaskCount(TestAsyncProcess.MyAsyncProcess ap) throws InterruptedIOException, InterruptedException -
testMaxTask
- Throws:
Exception
-
createHConnection
- Throws:
IOException
-
createHConnection
private org.apache.hadoop.hbase.client.ClusterConnection createHConnection(org.apache.hadoop.hbase.client.ConnectionConfiguration configuration) throws IOException - Throws:
IOException
-
createHConnectionWithReplicas
private org.apache.hadoop.hbase.client.ClusterConnection createHConnectionWithReplicas(org.apache.hadoop.hbase.client.ConnectionConfiguration configuration) throws IOException - Throws:
IOException
-
setMockLocation
private static void setMockLocation(org.apache.hadoop.hbase.client.ClusterConnection hc, byte[] row, org.apache.hadoop.hbase.RegionLocations result) throws IOException - Throws:
IOException
-
createHConnectionCommon
private org.apache.hadoop.hbase.client.ClusterConnection createHConnectionCommon(org.apache.hadoop.hbase.client.ConnectionConfiguration connectionConfiguration) -
testHTablePutSuccess
- Throws:
Exception
-
testSettingWriteBufferPeriodicFlushParameters
- Throws:
Exception
-
checkPeriodicFlushParameters
private void checkPeriodicFlushParameters(org.apache.hadoop.hbase.client.ClusterConnection conn, TestAsyncProcess.MyAsyncProcess ap, long setTO, long expectTO, long setTT, long expectTT) -
testWriteBufferPeriodicFlushTimeoutMs
- Throws:
Exception
-
testFailedPutAndNewPut
- Throws:
Exception
-
testAction
-
testBatch
- Throws:
IOException
InterruptedException
-
testErrorsServers
- Throws:
IOException
-
testReadAndWriteTimeout
- Throws:
IOException
-
testErrors
- Throws:
IOException
-
testCallQueueTooLarge
- Throws:
IOException
-
testThreadCreation
This test simulates multiple regions on 2 servers. We should have 2 multi requests and 2 threads: 1 per server, this whatever the number of regions.- Throws:
Exception
-
testReplicaReplicaSuccess
- Throws:
Exception
-
testReplicaPrimarySuccessWoReplicaCalls
- Throws:
Exception
-
testReplicaParallelCallsSucceed
- Throws:
Exception
-
testReplicaPartialReplicaCall
- Throws:
Exception
-
testReplicaMainFailsBeforeReplicaCalls
- Throws:
Exception
-
testReplicaReplicaSuccessWithParallelFailures
- Throws:
Exception
-
testReplicaAllCallsFailForOneRegion
- Throws:
Exception
-
createReplicaAp
private TestAsyncProcess.MyAsyncProcessWithReplicas createReplicaAp(int replicaAfterMs, int primaryMs, int replicaMs) throws Exception - Throws:
Exception
-
createReplicaAp
private TestAsyncProcess.MyAsyncProcessWithReplicas createReplicaAp(int replicaAfterMs, int primaryMs, int replicaMs, int retries) throws Exception - Throws:
Exception
-
createBufferedMutatorParams
private org.apache.hadoop.hbase.client.BufferedMutatorParams createBufferedMutatorParams(TestAsyncProcess.MyAsyncProcess ap, org.apache.hadoop.hbase.TableName name) -
makeTimelineGets
-
verifyResult
private void verifyResult(org.apache.hadoop.hbase.client.AsyncRequestFuture ars, boolean... expected) throws Exception - Throws:
Exception
-
verifyReplicaResult
private void verifyReplicaResult(org.apache.hadoop.hbase.client.AsyncRequestFuture ars, TestAsyncProcess.RR... expecteds) throws Exception - Throws:
Exception
-
createPut
- Parameters:
regCnt
- the region: 1 to 3.success
- if true, the put will succeed.- Returns:
- a put
-
testUncheckedException
- Throws:
Exception
-
testRetryPauseWhenServerOverloadedDueToCQTBE
Below tests make sure we could use a special pause setting when retry an exception whereHBaseServerException.isServerOverloaded(Throwable)
is true, see HBASE-17114- Throws:
Exception
-
testRetryPauseWhenServerOverloadedDueToCDE
- Throws:
Exception
-
testRetryPauseForRpcThrottling
- Throws:
IOException
-
testRetryPauseWhenServerIsOverloaded
private void testRetryPauseWhenServerIsOverloaded(org.apache.hadoop.hbase.HBaseServerException exception) throws IOException - Throws:
IOException
-
testRetryPause
private void testRetryPause(org.apache.hadoop.conf.Configuration testConf, long expectedPause, org.apache.hadoop.hbase.HBaseIOException exception) throws IOException - Throws:
IOException
-
testFastFailIfBackoffGreaterThanRemaining
- Throws:
IOException
-
testRetryWithExceptionClearsMetaCacheUsingRegionException
Tests that we properly recover from exceptions that DO NOT go through receiveGlobalFailure, due to updating the meta cache for the region which failed. Successful multigets can include region exceptions in the MultiResponse. In that case, it skips receiveGlobalFailure and instead handles in receiveMultiAction- Throws:
Exception
-
testRetryWithExceptionClearsMetaCacheUsingServerException
Tests that we properly recover from exceptions that go through receiveGlobalFailure, due to updating the meta cache for the region which failed.- Throws:
Exception
-
testRetryWithExceptionClearsMetaCache
- Throws:
IOException
-
testQueueRowAccess
- Throws:
Exception
-