private void cleanServerCache(ServerName server, Throwable regionException) { if (ClientExceptionsUtil.isMetaClearingException(regionException)) { // We want to make sure to clear the cache in case there were location-related exceptions. // We don't to clear the cache for every possible exception that comes through, however. asyncProcess.connection.clearCaches(server); } }
@Test public void testRetryWithExceptionClearsMetaCache() throws Exception { ClusterConnection conn = createHConnection(); Configuration myConf = conn.getConfiguration(); myConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 0); AsyncProcessWithFailure ap = new AsyncProcessWithFailure(conn, myConf, new RegionOpeningException("test")); BufferedMutatorParams bufferParam = createBufferedMutatorParams(ap, DUMMY_TABLE); BufferedMutatorImpl mutator = new BufferedMutatorImpl(conn, bufferParam, ap); Assert.assertNotNull(mutator.getAsyncProcess().createServerErrorTracker()); Assert.assertEquals( conn.locateRegion(DUMMY_TABLE, DUMMY_BYTES_1, true, true).toString(), new RegionLocations(loc1).toString()); Mockito.verify(conn, Mockito.times(0)).clearCaches(Mockito.any()); Put p = createPut(1, true); mutator.mutate(p); try { mutator.flush(); Assert.fail(); } catch (RetriesExhaustedWithDetailsException expected) { assertEquals(1, expected.getNumExceptions()); assertTrue(expected.getRow(0) == p); } Mockito.verify(conn, Mockito.times(1)).clearCaches(loc1.getServerName()); }
private void cleanServerCache(ServerName server, Throwable regionException) { if (tableName == null && ClientExceptionsUtil.isMetaClearingException(regionException)) { // For multi-actions, we don't have a table name, but we want to make sure to clear the // cache in case there were location-related exceptions. We don't to clear the cache // for every possible exception that comes through, however. asyncProcess.connection.clearCaches(server); } }
@Override public void clearCaches(ServerName sn) { wrappedConnection.clearCaches(sn); }
private void cleanServerCache(ServerName server, Throwable regionException) { if (tableName == null && ClientExceptionsUtil.isMetaClearingException(regionException)) { // For multi-actions, we don't have a table name, but we want to make sure to clear the // cache in case there were location-related exceptions. We don't to clear the cache // for every possible exception that comes through, however. asyncProcess.connection.clearCaches(server); } }
connection.clearCaches(server);