@Test
  public void testCacheClearingOnCallQueueTooBig() throws Exception {
    ((FakeRSRpcServices) badRS.getRSRpcServices())
      .setExceptionInjector(new CallQueueTooBigExceptionInjector());
    setupConnection(2);
    Table table = conn.getTable(TABLE_NAME);
    byte[] row = Bytes.toBytes("row1");

    Put put = new Put(row);
    put.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10));
    table.put(put);

    // obtain the client metrics
    long preGetRegionClears = metrics.getMetaCacheNumClearRegion().getCount();
    long preGetServerClears = metrics.getMetaCacheNumClearServer().getCount();

    // attempt a get on the test table
    Get get = new Get(row);
    try {
      table.get(get);
      fail("Expected CallQueueTooBigException");
    } catch (RetriesExhaustedException ree) {
      // expected
    }

    // verify that no cache clearing took place
    long postGetRegionClears = metrics.getMetaCacheNumClearRegion().getCount();
    long postGetServerClears = metrics.getMetaCacheNumClearServer().getCount();
    assertEquals(preGetRegionClears, postGetRegionClears);
    assertEquals(preGetServerClears, postGetServerClears);
  }
Test that our cleanOverlappingRegions doesn't incorrectly remove regions from cache. Originally
encountered when using floorEntry rather than lowerEntry.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java