Merge "Purge in-memory log when install snapshot is done"
authorMoiz Raja <moraja@cisco.com>
Fri, 13 Mar 2015 10:28:37 +0000 (10:28 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 13 Mar 2015 10:28:37 +0000 (10:28 +0000)
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java

index 890d45e8fb664b20a4f27e8996d38b15e27a0120..831f8f9e7088ed2017a81a2ed6911fdfbedb8e5b 100644 (file)
@@ -383,7 +383,10 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
                 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);