Class TestClientOperationTimeout

java.lang.Object
org.apache.hadoop.hbase.client.TestClientOperationTimeout

public class TestClientOperationTimeout extends Object
These tests verify that the RPC timeouts ('hbase.client.operation.timeout' and 'hbase.client.scanner.timeout.period') work correctly using a modified Region Server which injects delays to get, scan and mutate operations.

When 'hbase.client.operation.timeout' is set and client operation is not completed in time the client will retry the operation 'hbase.client.retries.number' times. After that SocketTimeoutException will be thrown.

Using 'hbase.client.scanner.timeout.period' configuration property similar behavior can be specified for scan related operations such as openScanner(), next(). If that times out RetriesExhaustedException will be thrown.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
    static class 
    This RSRpcServices class injects delay for Rpc calls and after executes super methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final HBaseClassTestRule
     
    private static org.apache.hadoop.hbase.client.Connection
     
    private static int
     
    private static int
     
    private static int
     
    private static int
     
    private static int
     
    private static boolean
     
    private static final byte[]
     
    private static final byte[]
     
    private static final byte[]
     
    private static org.apache.hadoop.hbase.client.Table
     
    private static final org.apache.hadoop.hbase.TableName
     
    private static final HBaseTestingUtility
     
    private static final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    assertMultiException(org.junit.function.ThrowingRunnable runnable)
    AsyncProcess has an overall waitUntilDone with a timeout, and if all callables dont finish by then it throws a SocketTimeoutException.
    void
     
    static void
     
    static void
     
    void
    Tests that a get on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.operation.timeout'.
    void
    Tests that a batch get on a table throws OperationTimeoutExceededException when the region lookup takes longer than the 'hbase.client.operation.timeout'.
    void
    Tests that a batch get on a table throws OperationTimeoutExceededException when retries are tuned too high to be able to be processed within the operation timeout.
    void
    Tests that a batch mutate and batch get on a table throws SocketTimeoutException or OperationTimeoutExceededException when the operation takes longer than 'hbase.client.operation.timeout'.
    void
    Tests that a put on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.operation.timeout'.
    void
    Tests that scan on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.scanner.timeout.period'.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • setUpClass

      public static void setUpClass() throws Exception
      Throws:
      Exception
    • setUp

      public void setUp() throws Exception
      Throws:
      Exception
    • tearDown

      public static void tearDown() throws Exception
      Throws:
      Exception
    • testGetTimeout

      public void testGetTimeout()
      Tests that a get on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.operation.timeout'.
    • testPutTimeout

      public void testPutTimeout()
      Tests that a put on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.operation.timeout'.
    • testMultiTimeout

      public void testMultiTimeout()
      Tests that a batch mutate and batch get on a table throws SocketTimeoutException or OperationTimeoutExceededException when the operation takes longer than 'hbase.client.operation.timeout'.
    • assertMultiException

      private void assertMultiException(org.junit.function.ThrowingRunnable runnable)
      AsyncProcess has an overall waitUntilDone with a timeout, and if all callables dont finish by then it throws a SocketTimeoutException. The callables themselves also try to honor the operation timeout and result in OperationTimeoutExceededException (wrapped in RetriesExhausted). The latter is the more user-friendly exception because it contains details about which server has issues, etc. For now we need to account for both because it's sort of a race to see which timeout exceeds first. Maybe we can replace the waitUntilDone behavior with an interrupt in the future so we can further unify.
    • testMultiGetMetaTimeout

      public void testMultiGetMetaTimeout() throws IOException
      Tests that a batch get on a table throws OperationTimeoutExceededException when the region lookup takes longer than the 'hbase.client.operation.timeout'. This specifically tests that when meta is slow, the fetching of region locations for a batch is not allowed to itself exceed the operation timeout. In a batch size of 100, it's possible to need to make 100 meta calls in sequence. If meta is slow, we should abort the request once the operation timeout is exceeded, even if we haven't finished locating all regions. See HBASE-27490
      Throws:
      IOException
    • testMultiGetRetryTimeout

      public void testMultiGetRetryTimeout()
      Tests that a batch get on a table throws OperationTimeoutExceededException when retries are tuned too high to be able to be processed within the operation timeout. In this case, the final OperationTimeoutExceededException should not trigger a cache clear (but the individual failures may, if appropriate). This test skirts around the timeout checks during meta lookups from HBASE-27490, because we want to test for the case where meta lookups were able to succeed in time but did not leave enough time for the actual calls to occur. See HBASE-27487
    • testScanTimeout

      public void testScanTimeout()
      Tests that scan on a table throws RetriesExhaustedException when the operation takes longer than 'hbase.client.scanner.timeout.period'.