- private void onApplySnapshot(Snapshot snapshot) {
- if(log.isDebugEnabled()) {
- log.debug("{}: ApplySnapshot called on Follower Actor " +
- "snapshotIndex:{}, snapshotTerm:{}", context.getId(), snapshot.getLastAppliedIndex(),
- snapshot.getLastAppliedTerm());
- }
+ private void onApplySnapshot(ApplySnapshot message) {
+ log.info("{}: Applying snapshot on follower with snapshotIndex: {}, snapshotTerm: {}", context.getId(),
+ message.getSnapshot().getLastAppliedIndex(), message.getSnapshot().getLastAppliedTerm());
+
+ context.getSnapshotManager().apply(message);
+ }
+
+ private void onGetSnapshot(ActorRef sender) {
+ log.debug("{}: onGetSnapshot", context.getId());
+
+ if(context.getPersistenceProvider().isRecoveryApplicable()) {
+ CaptureSnapshot captureSnapshot = context.getSnapshotManager().newCaptureSnapshot(
+ context.getReplicatedLog().last(), -1, false);
+
+ ActorRef snapshotReplyActor = context.actorOf(GetSnapshotReplyActor.props(captureSnapshot,
+ ImmutableElectionTerm.copyOf(context.getTermInformation()), sender,
+ snapshotReplyActorTimeout, context.getId(), context.getPeerServerInfo(true)));