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 <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()); } }
"Can't create znode " + hbckEphemeralNodePath).initCause(ie); } while (retryCounter.shouldRetry()); return hbckZodeCreated;
HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); RetryCounter retrier = new RetryCounter(numRetries+1, (int)pause, TimeUnit.MICROSECONDS); while(retrier.shouldRetry()) { int index = getMiniHBaseCluster().getServerWith(firstRegionName); if (index != -1) {
@Test public void testBasics() throws InterruptedException { int maxAttempts = 10; RetryCounterFactory factory = new RetryCounterFactory(maxAttempts, 10, 1000); RetryCounter retryCounter = factory.create(); while (retryCounter.shouldRetry()) { LOG.info("Attempt={}, backoffTime={}", retryCounter.getAttemptTimes(), retryCounter.getBackoffTime()); retryCounter.sleepUntilNextRetry(); } assertTrue(retryCounter.getAttemptTimes() == maxAttempts); } }
while (CompactionState.NONE != admin .getCompactionStateForRegion(region.getRegionInfo().getRegionName()) && retrier.shouldRetry()) { retrier.sleepUntilNextRetry();
if (!counter.shouldRetry()) { throw new IOException("Cannot cause primary to flush or drop a wal marker after " + "retries. Failing opening of this region replica "
while (CompactionState.NONE != admin.getCompactionState(tableName) && retrier.shouldRetry()) { retrier.sleepUntilNextRetry();
RetryCounter retrier = new RetryCounter(30, 1, TimeUnit.SECONDS); while (CompactionState.NONE != admin.getCompactionStateForRegion(daughter.getRegionName()) && retrier.shouldRetry()) { retrier.sleepUntilNextRetry();
while (CompactionState.NONE != admin .getCompactionStateForRegion(daughter.getRegionInfo().getRegionName()) && retrier.shouldRetry()) { retrier.sleepUntilNextRetry();
private void retryOrThrow(RetryCounter retryCounter, KeeperException e, String opName) throws KeeperException { LOG.warn("Possibly transient ZooKeeper exception: " + e); if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxRetries() + " retries"); throw e; } }
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.warn("Possibly transient ZooKeeper exception: " + e); if (!retryCounter.shouldRetry()) { LOG.error("ZooKeeper " + opName + " failed after " + retryCounter.getMaxRetries() + " retries"); throw 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 <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()); } }
@Test public void testBasics() throws InterruptedException { int maxAttempts = 10; RetryCounterFactory factory = new RetryCounterFactory(maxAttempts, 10, 1000); RetryCounter retryCounter = factory.create(); while (retryCounter.shouldRetry()) { LOG.info("Attempt={}, backoffTime={}", retryCounter.getAttemptTimes(), retryCounter.getBackoffTime()); retryCounter.sleepUntilNextRetry(); } assertTrue(retryCounter.getAttemptTimes() == maxAttempts); } }