private void retryOrThrow(RetryCounter retryCounter, KeeperException e, String opName) throws KeeperException { if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxAttempts() + " attempts"); throw e; } LOG.debug("Retry, connectivity issue (JVM Pause?); quorum=" + quorumServers + "," + "exception=" + e); }
private FSDataOutputStream createFileWithRetries(final FileSystem fs, final Path hbckLockFilePath, final FsPermission defaultPerms) throws IOException { IOException exception = null; do { try { return FSUtils.create(fs, hbckLockFilePath, defaultPerms, false); } catch (IOException ioe) { LOG.info("Failed to create lock file " + hbckLockFilePath.getName() + ", try=" + (retryCounter.getAttemptTimes() + 1) + " of " + retryCounter.getMaxAttempts()); LOG.debug("Failed to create lock file " + hbckLockFilePath.getName(), ioe); try { exception = ioe; retryCounter.sleepUntilNextRetry(); } catch (InterruptedException ie) { throw (InterruptedIOException) new InterruptedIOException( "Can't create lock file " + hbckLockFilePath.getName()) .initCause(ie); } } } while (retryCounter.shouldRetry()); throw exception; } }
private void unlockHbck() { if (isExclusive() && hbckLockCleanup.compareAndSet(true, false)) { RetryCounter retryCounter = lockFileRetryCounterFactory.create(); do { try { IOUtils.closeQuietly(hbckOutFd); FSUtils.delete(FSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true); LOG.info("Finishing hbck"); return; } catch (IOException ioe) { LOG.info("Failed to delete " + HBCK_LOCK_PATH + ", try=" + (retryCounter.getAttemptTimes() + 1) + " of " + retryCounter.getMaxAttempts()); LOG.debug("Failed to delete " + HBCK_LOCK_PATH, ioe); try { retryCounter.sleepUntilNextRetry(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); LOG.warn("Interrupted while deleting lock file" + HBCK_LOCK_PATH); return; } } } while (retryCounter.shouldRetry()); } }
private <E extends Exception> void retryOrThrow(RetryCounter retryCounter, E ex, String hostname, String[] cmd) throws E { if (retryCounter.shouldRetry()) { LOG.warn("Remote command: " + StringUtils.join(cmd, " ") + " , hostname:" + hostname + " failed at attempt " + retryCounter.getAttemptTimes() + ". Retrying until maxAttempts: " + retryCounter.getMaxAttempts() + ". Exception: " + ex.getMessage()); return; } throw ex; }
if (retryCounter.getAttemptTimes() >= retryCounter.getMaxAttempts()) { throw new IOException("Can't create znode " + hbckEphemeralNodePath, e); (retryCounter.getAttemptTimes() + 1) + " of " + retryCounter.getMaxAttempts());
private void retryOrThrow(RetryCounter retryCounter, KeeperException e, String opName) throws KeeperException { LOG.warn("Possibly transient ZooKeeper, quorum=" + quorumServers + ", exception=" + e); if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxAttempts() + " attempts"); throw e; } }
private void retryOrThrow(RetryCounter retryCounter, KeeperException e, String opName) throws KeeperException { if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxAttempts() + " attempts"); throw e; } LOG.debug("Retry, connectivity issue (JVM Pause?); quorum=" + quorumServers + "," + "exception=" + e); }
private void retryOrThrow(RetryCounter retryCounter, KeeperException e, String opName) throws KeeperException { LOG.debug("Possibly transient ZooKeeper, quorum=" + quorumServers + ", exception=" + e); if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxAttempts() + " attempts"); throw e; } }
private FSDataOutputStream createFileWithRetries(final FileSystem fs, final Path hbckLockFilePath, final FsPermission defaultPerms) throws IOException { IOException exception = null; do { try { return FSUtils.create(fs, hbckLockFilePath, defaultPerms, false); } catch (IOException ioe) { LOG.info("Failed to create lock file " + hbckLockFilePath.getName() + ", try=" + (retryCounter.getAttemptTimes() + 1) + " of " + retryCounter.getMaxAttempts()); LOG.debug("Failed to create lock file " + hbckLockFilePath.getName(), ioe); try { exception = ioe; retryCounter.sleepUntilNextRetry(); } catch (InterruptedException ie) { throw (InterruptedIOException) new InterruptedIOException( "Can't create lock file " + hbckLockFilePath.getName()) .initCause(ie); } } } while (retryCounter.shouldRetry()); throw exception; } }
private <E extends Exception> void retryOrThrow(RetryCounter retryCounter, E ex, String hostname, String[] cmd) throws E { if (retryCounter.shouldRetry()) { LOG.warn("Remote command: " + StringUtils.join(cmd, " ") + " , hostname:" + hostname + " failed at attempt " + retryCounter.getAttemptTimes() + ". Retrying until maxAttempts: " + retryCounter.getMaxAttempts() + ". Exception: " + ex.getMessage()); return; } throw ex; }
private void unlockHbck() { if (isExclusive() && hbckLockCleanup.compareAndSet(true, false)) { RetryCounter retryCounter = lockFileRetryCounterFactory.create(); do { try { IOUtils.closeQuietly(hbckOutFd); FSUtils.delete(FSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true); LOG.info("Finishing hbck"); return; } catch (IOException ioe) { LOG.info("Failed to delete " + HBCK_LOCK_PATH + ", try=" + (retryCounter.getAttemptTimes() + 1) + " of " + retryCounter.getMaxAttempts()); LOG.debug("Failed to delete " + HBCK_LOCK_PATH, ioe); try { retryCounter.sleepUntilNextRetry(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); LOG.warn("Interrupted while deleting lock file" + HBCK_LOCK_PATH); return; } } } while (retryCounter.shouldRetry()); } }
if (LOG.isDebugEnabled()) { LOG.debug("Couldn't reach " + server + ", try=" + retryCounter.getAttemptTimes() + " of " + retryCounter.getMaxAttempts(), ioe);