Source:
private LayoutTransferSegments performStateTransfer(CorfuRuntime runtime, StateTransferManager transferManager) throws InterruptedException { Consumer<ExponentialBackoffRetry> retrySettings = settings -> { settings.setBase(retryBase); settings.setExtraWait(extraWait.toMillis()); settings.setBackoffDuration(backoffDuration); settings.setRandomPortion(randomPart); }; AtomicInteger retries = new AtomicInteger(restoreRetries); return IRetry.build(ExponentialBackoffRetry.class, RetryExhaustedException.class, () -> { try { runtime.invalidateLayout(); Layout currentLayout = runtime.getLayoutView().getLayout(); if (currentLayout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("Node is in the unresponsive list."); } log.info("State transfer on {}: Layout before transfer: {}", currentNode, currentLayout); long trimMark = trimLog(runtime); Optional<Long> committedTail = tryGetCommittedTail(runtime); ImmutableList<TransferSegment> transferSegments = ImmutableList.copyOf( getTransferSegments(transferManager, currentLayout, trimMark, committedTail)); LayoutTransferSegments layoutTransferSegments = new LayoutTransferSegments(currentLayout, transferSegments); layoutTransferSegments.getTransferSegments() .stream() .map(TransferSegment::getEndAddress) .max(Long::compare) .ifPresent(addr -> transferCommittedTail(runtime, currentLayout, addr)); return layoutTransferSegments; } catch (TimeoutException | NetworkException | WrongEpochException | UnknownAddressInRangeException e) { log.warn("Got: {}. Retrying: times.", e.getMessage(), retries.get()); if (retries.decrementAndGet() < 0) { throw new RetryExhaustedException("Retries exhausted.", e); } else { throw new RetryNeededException(); } } catch (TransferSegmentException e) { throw new RetryExhaustedException("Transfer segment exception occurred.", e); } catch (IllegalStateException e) { throw new RetryExhaustedException("The current node is in the unresponsive list.", e); } }).setOptions(retrySettings).run(); }

Target:
private LayoutTransferSegments performStateTransfer(CorfuRuntime runtime, StateTransferManager transferManager) throws InterruptedException { Consumer<ExponentialBackoffRetry> retrySettings = settings -> { settings.setBase(retryBase); settings.setExtraWait(extraWait.toMillis()); settings.setBackoffDuration(backoffDuration); settings.setRandomPortion(randomPart); }; AtomicInteger retries = new AtomicInteger(restoreRetries); return IRetry.build(ExponentialBackoffRetry.class, RetryExhaustedException.class, () -> { try { runtime.invalidateLayout(); Layout currentLayout = runtime.getLayoutView().getLayout(); if (currentLayout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("Node is in the unresponsive list."); } log.info("State transfer on {}: Layout before transfer: {}", currentNode, currentLayout); long trimMark = trimLog(runtime, currentLayout); Optional<Long> committedTail = tryGetCommittedTail(runtime.getLayoutView().getRuntimeLayout()); ImmutableList<TransferSegment> transferSegments = ImmutableList.copyOf( getTransferSegments(transferManager, currentLayout, trimMark, committedTail)); LayoutTransferSegments layoutTransferSegments = new LayoutTransferSegments(currentLayout, transferSegments); layoutTransferSegments.getTransferSegments() .stream() .map(TransferSegment::getEndAddress) .max(Long::compare) .ifPresent(addr -> transferCommittedTail(runtime, currentLayout, addr)); return layoutTransferSegments; } catch (IllegalStateException e) { throw new RetryExhaustedException(e); } catch (RuntimeException re) { log.warn("performStateTransfer: Retrying: times after exception: {}.", retries.get(), re); if (retries.decrementAndGet() < 0) { throw new RetryExhaustedException("Retries exhausted.", re); } else { throw new RetryNeededException(); } } }).setOptions(retrySettings).run(); }