static void updateCachedLocationOnError(HRegionLocation loc, Throwable exception, Function<HRegionLocation, HRegionLocation> cachedLocationSupplier, Consumer<HRegionLocation> addToCache, Consumer<HRegionLocation> removeFromCache) { HRegionLocation oldLoc = cachedLocationSupplier.apply(loc); LOG.debug("Try updating {} , the old value is {}", loc, oldLoc, exception); if (!canUpdateOnError(loc, oldLoc)) { return; } Throwable cause = findException(exception); LOG.debug("The actual exception when updating {}", loc, cause); if (cause == null || !isMetaClearingException(cause)) { LOG.debug("Will not update {} because the exception is null or not the one we care about", loc); return; } if (cause instanceof RegionMovedException) { RegionMovedException rme = (RegionMovedException) cause; HRegionLocation newLoc = new HRegionLocation(loc.getRegion(), rme.getServerName(), rme.getLocationSeqNum()); LOG.debug("Try updating {} with the new location {} constructed by {}", loc, newLoc, rme); addToCache.accept(newLoc); } else { LOG.debug("Try removing {} from cache", loc); removeFromCache.accept(loc); } }
public void handleThrowable(Throwable t1, ServerName serverName, MutableBoolean couldNotCommunicateWithServer, MutableBoolean guaranteedClientSideOnly) throws IOException { Throwable t2 = ClientExceptionsUtil.translatePFFE(t1); boolean isLocalException = !(t2 instanceof RemoteException); if ((isLocalException && ClientExceptionsUtil.isConnectionException(t2))) { couldNotCommunicateWithServer.setValue(true); guaranteedClientSideOnly.setValue(!(t2 instanceof CallTimeoutException)); handleFailureToServer(serverName, t2); } }
public static boolean isMetaClearingException(Throwable cur) { cur = findException(cur); if (cur == null) { return true; } return !isSpecialException(cur) || (cur instanceof RegionMovedException) || cur instanceof NotServingRegionException; }
/** * Checks if the exception is CallQueueTooBig exception (maybe wrapped * into some RemoteException). * @param t exception to check * @return true if it's a CQTBE, false otherwise */ public static boolean isCallQueueTooBigException(Throwable t) { t = findException(t); return (t instanceof CallQueueTooBigException); }
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); } }
if (isSpecialException(cur)) { return cur;
final boolean retry = !hold && (ClientExceptionsUtil.isConnectionException(e) && master.getServerManager().isServerOnline(serverName)); if (retry) {
/** * Checks if the exception is CallDroppedException (maybe wrapped * into some RemoteException). * @param t exception to check * @return true if it's a CQTBE, false otherwise */ public static boolean isCallDroppedException(Throwable t) { t = findException(t); return (t instanceof CallDroppedException); }
ClientExceptionsUtil.isMetaClearingException(t) ? null : t); for (Action action : e.getValue()) { Retry retry = manageError(
if (isSpecialException(cur)) { return cur;
Throwable cause = ClientExceptionsUtil.findException(exception); if (cause != null) { if (!ClientExceptionsUtil.isMetaClearingException(cause)) {
protected static Throwable unwrap(Throwable t) { if (t == null) { return t; } if (t instanceof TIOError || t instanceof IOError) { t = t.getCause(); } return ClientExceptionsUtil.findException(t); } }
public static boolean isMetaClearingException(Throwable cur) { cur = findException(cur); if (cur == null) { return true; } return !isSpecialException(cur) || (cur instanceof RegionMovedException) || cur instanceof NotServingRegionException; }
} catch (IOException ex) { if (ClientExceptionsUtil.isMetaClearingException(ex) || success) { exp = ex; if (exp != null && ClientExceptionsUtil.isMetaClearingException(exp)) { assertNull(conn.getCachedLocation(TABLE_NAME, row)); } else if (success) {
public void handleThrowable(Throwable t1, ServerName serverName, MutableBoolean couldNotCommunicateWithServer, MutableBoolean guaranteedClientSideOnly) throws IOException { Throwable t2 = ClientExceptionsUtil.translatePFFE(t1); boolean isLocalException = !(t2 instanceof RemoteException); if ((isLocalException && ClientExceptionsUtil.isConnectionException(t2))) { couldNotCommunicateWithServer.setValue(true); guaranteedClientSideOnly.setValue(!(t2 instanceof CallTimeoutException)); handleFailureToServer(serverName, t2); } }
if (isSpecialException(cur)) { return cur;
return; Throwable cause = findException(exception); if (LOG.isDebugEnabled()) { LOG.debug("The actual exception when updating " + loc, cause); if (cause == null || !isMetaClearingException(cause)) { if (LOG.isDebugEnabled()) { LOG.debug(
@Test public void testFindException() throws Exception { IOException ioe = new IOException("Tesst"); ServiceException se = new ServiceException(ioe); assertEquals(ioe, ClientExceptionsUtil.findException(se)); } }
public static boolean isMetaClearingException(Throwable cur) { cur = findException(cur); if (cur == null) { return true; } return !isSpecialException(cur) || (cur instanceof RegionMovedException); }
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); } }