Source:
<code><START> private void verifyStatusOfSnapshotSyncApply() { <END> try { log.debug("Verify snapshot sync apply status, sync={}", transitionEventId); CompletableFuture<LogReplicationMetadataResponse> metadataResponseCompletableFuture = dataSender.sendMetadataRequest(); LogReplicationMetadataResponse metadataResponse = metadataResponseCompletableFuture.get(CorfuLogReplicationRuntime.DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); if (metadataResponse.getLastLogProcessed() == metadataResponse.getSnapshotApplied() && metadataResponse.getSnapshotApplied() == baseSnapshotTimestamp) { log.info("Snapshot sync apply is complete appliedTs={}, baseTs={}", metadataResponse.getSnapshotApplied(), baseSnapshotTimestamp); fsm.input(new LogReplicationEvent(LogReplicationEvent.LogReplicationEventType.SNAPSHOT_APPLY_COMPLETE, new LogReplicationEventMetadata(transitionEventId, baseSnapshotTimestamp, baseSnapshotTimestamp))); } else { log.debug("Snapshot sync apply is still in progress, appliedTs={}, baseTs={}, sync_id={}", metadataResponse.getSnapshotApplied(), baseSnapshotTimestamp, transitionEventId); this.snapshotSyncApplyMonitorExecutor.schedule(this::scheduleSnapshotApplyVerification, SCHEDULE_APPLY_MONITOR_DELAY, TimeUnit.MILLISECONDS); } } catch (TimeoutException te) { log.error("Snapshot sync apply verification timed out.", te); } catch (ExecutionException ee) { log.error("Snapshot sync apply verification failed.", ee); } catch (Exception e) { log.error("Snapshot sync apply verification failed.", e); } }</code><technical_language>a timeout here, retry verify if standby's apply phase is stuck? In this case, need a user enforce snapshot sync</technical_language>

Target:
private void verifyStatusOfSnapshotSyncApply() { try { log.debug("Verify snapshot sync apply status, sync={}", transitionEventId); CompletableFuture<LogReplicationMetadataResponse> metadataResponseCompletableFuture = dataSender.sendMetadataRequest(); LogReplicationMetadataResponse metadataResponse = metadataResponseCompletableFuture.get(CorfuLogReplicationRuntime.DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS); if (metadataResponse.getLastLogProcessed() == metadataResponse.getSnapshotApplied() && metadataResponse.getSnapshotApplied() == baseSnapshotTimestamp) { log.info("Snapshot sync apply is complete appliedTs={}, baseTs={}", metadataResponse.getSnapshotApplied(), baseSnapshotTimestamp); fsm.input(new LogReplicationEvent(LogReplicationEvent.LogReplicationEventType.SNAPSHOT_APPLY_COMPLETE, new LogReplicationEventMetadata(transitionEventId, baseSnapshotTimestamp, baseSnapshotTimestamp))); } else { log.debug("Snapshot sync apply is still in progress, appliedTs={}, baseTs={}, sync_id={}", metadataResponse.getSnapshotApplied(), baseSnapshotTimestamp, transitionEventId); this.snapshotSyncApplyMonitorExecutor.schedule(this::scheduleSnapshotApplyVerification, SCHEDULE_APPLY_MONITOR_DELAY, TimeUnit.MILLISECONDS); } } catch (TimeoutException te) { log.error("Snapshot sync apply verification timed out.", te); this.snapshotSyncApplyMonitorExecutor.schedule(this::scheduleSnapshotApplyVerification, SCHEDULE_APPLY_MONITOR_DELAY, TimeUnit.MILLISECONDS); } catch (ExecutionException ee) { log.error("Snapshot sync apply verification failed.", ee); this.snapshotSyncApplyMonitorExecutor.schedule(this::scheduleSnapshotApplyVerification, SCHEDULE_APPLY_MONITOR_DELAY, TimeUnit.MILLISECONDS); } catch (Exception e) { log.error("Snapshot sync apply verification failed.", e); this.snapshotSyncApplyMonitorExecutor.schedule(this::scheduleSnapshotApplyVerification, SCHEDULE_APPLY_MONITOR_DELAY, TimeUnit.MILLISECONDS); } }