@Test public void copySnapshotToLeader() throws Exception { createSnapshotFile(mFollowerStore); Assert.assertNull(mLeaderStore.getLatestSnapshot()); mLeaderSnapshotManager.maybeCopySnapshotFromFollower(); CommonUtils.waitFor("leader snapshot to complete", () -> mLeaderSnapshotManager.maybeCopySnapshotFromFollower() != -1, mWaitOptions); validateSnapshotFile(mLeaderStore); }
public long maybeCopySnapshotFromFollower() { if (mDownloadState.get() == DownloadState.DOWNLOADED) { return installDownloadedSnapshot(); } if (mDownloadState.get() == DownloadState.REQUEST_DATA) { checkRequestTimeout(); } if (mDownloadState.get() == DownloadState.IDLE) { CompletableFuture.runAsync(this::requestSnapshotFromFollowers); } return RaftLog.INVALID_LOG_INDEX; }
SnapshotReplicationManager { public long maybeCopySnapshotFromFollower() { if (mDownloadState.get() == DownloadState.DOWNLOADED) { return installDownloadedSnapshot(); } if (mDownloadState.get() == DownloadState.REQUEST_DATA) { checkRequestTimeout(); } if (mDownloadState.get() == DownloadState.IDLE) { CompletableFuture.runAsync(this::requestSnapshotFromFollowers); } return RaftLog.INVALID_LOG_INDEX; } }
SnapshotReplicationManager { public long maybeCopySnapshotFromFollower() { if (mDownloadState.get() == DownloadState.DOWNLOADED) { return installDownloadedSnapshot(); } if (mDownloadState.get() == DownloadState.REQUEST_DATA) { checkRequestTimeout(); } if (mDownloadState.get() == DownloadState.IDLE) { CompletableFuture.runAsync(this::requestSnapshotFromFollowers); } return RaftLog.INVALID_LOG_INDEX; } SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage); @VisibleForTesting  SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage, RaftJournalServiceClient client); }
SnapshotReplicationManager { public long maybeCopySnapshotFromFollower() { if (mDownloadState.get() == DownloadState.DOWNLOADED) { return installDownloadedSnapshot(); } if (mDownloadState.get() == DownloadState.REQUEST_DATA) { checkRequestTimeout(); } if (mDownloadState.get() == DownloadState.IDLE) { CompletableFuture.runAsync(this::requestSnapshotFromFollowers); } return RaftLog.INVALID_LOG_INDEX; } SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage); @VisibleForTesting  SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage, RaftJournalServiceClient client); CompletableFuture<TermIndex> installSnapshotFromLeader(); void sendSnapshotToLeader(); long maybeCopySnapshotFromFollower(); StreamObserver<UploadSnapshotPRequest> receiveSnapshotFromFollower(
      StreamObserver<UploadSnapshotPResponse> responseStreamObserver); Message handleRequest(JournalQueryRequest queryRequest); StreamObserver<DownloadSnapshotPRequest> sendSnapshotToFollower(
      StreamObserver<DownloadSnapshotPResponse> responseObserver); synchronized void close(); }
SnapshotReplicationManager { public long maybeCopySnapshotFromFollower() { if (mDownloadState.get() == DownloadState.DOWNLOADED) { return installDownloadedSnapshot(); } if (mDownloadState.get() == DownloadState.REQUEST_DATA) { checkRequestTimeout(); } if (mDownloadState.get() == DownloadState.IDLE) { CompletableFuture.runAsync(this::requestSnapshotFromFollowers); } return RaftLog.INVALID_LOG_INDEX; } SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage); @VisibleForTesting  SnapshotReplicationManager(RaftJournalSystem journalSystem,
      SimpleStateMachineStorage storage, RaftJournalServiceClient client); CompletableFuture<TermIndex> installSnapshotFromLeader(); void sendSnapshotToLeader(); long maybeCopySnapshotFromFollower(); StreamObserver<UploadSnapshotPRequest> receiveSnapshotFromFollower(
      StreamObserver<UploadSnapshotPResponse> responseStreamObserver); Message handleRequest(JournalQueryRequest queryRequest); StreamObserver<DownloadSnapshotPRequest> sendSnapshotToFollower(
      StreamObserver<DownloadSnapshotPResponse> responseObserver); synchronized void close();  }