In AbstractLeader#handleInstallSnapshotReply, after the last snapshot
chunk has been sent and acknowledged by the follower and, since install
snapshot *should* only happen for a lagging follower, the follower
is most likely caught up at this point so we can be greedy and try
to trim the log and advance replicatedToAllIndex.
Change-Id: Id22dfbcb6e459e3d3f6801d1c6c850bdd42989fa
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
followerToSnapshot.markSendStatus(false);
}
followerToSnapshot.markSendStatus(false);
}
- if (!wasLastChunk && followerToSnapshot.canSendNextChunk()) {
+ if (wasLastChunk && !context.isSnapshotCaptureInitiated()) {
+ // Since the follower is now caught up try to purge the log.
+ purgeInMemoryLog();
+ } else if (!wasLastChunk && followerToSnapshot.canSendNextChunk()) {
ActorSelection followerActor = context.getPeerActorSelection(followerId);
if(followerActor != null) {
sendSnapshotChunk(followerActor, followerId);
ActorSelection followerActor = context.getPeerActorSelection(followerId);
if(followerActor != null) {
sendSnapshotChunk(followerActor, followerId);