From e34f201cff9c4be8fff720937aa17e3ed11faacf Mon Sep 17 00:00:00 2001 From: Moiz Raja Date: Wed, 11 Feb 2015 14:31:38 -0800 Subject: [PATCH] Stop scheduling the Install Snapshot check We only schedule it once and even that is unneccessary because we check if a snapshot needs to be triggered in sendUpdatesToFollower and that should be good enough Change-Id: I4da5d3452dbdb261738587f41201611ef891bec1 Signed-off-by: Moiz Raja --- .../cluster/raft/behaviors/Leader.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java index fcfaee3603..7a94c0c158 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java @@ -12,7 +12,6 @@ import akka.actor.Cancellable; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.raft.RaftActorContext; -import org.opendaylight.controller.cluster.raft.base.messages.InitiateInstallSnapshot; import org.opendaylight.controller.cluster.raft.base.messages.IsolatedLeaderCheck; import scala.concurrent.duration.FiniteDuration; @@ -45,8 +44,6 @@ public class Leader extends AbstractLeader { public Leader(RaftActorContext context) { super(context); - scheduleInstallSnapshotCheck(context.getConfigParams().getIsolatedCheckInterval()); - scheduleIsolatedLeaderCheck( new FiniteDuration(context.getConfigParams().getHeartBeatInterval().length() * 10, context.getConfigParams().getHeartBeatInterval().unit())); @@ -66,30 +63,6 @@ public class Leader extends AbstractLeader { return super.handleMessage(sender, originalMessage); } - protected void stopInstallSnapshotSchedule() { - if (installSnapshotSchedule != null && !installSnapshotSchedule.isCancelled()) { - installSnapshotSchedule.cancel(); - } - } - - protected void scheduleInstallSnapshotCheck(FiniteDuration interval) { - if (getFollowerIds().isEmpty()) { - // Optimization - do not bother scheduling a heartbeat as there are - // no followers - return; - } - - stopInstallSnapshotSchedule(); - - // Schedule a message to send append entries to followers that can - // accept an append entries with some data in it - installSnapshotSchedule = - context.getActorSystem().scheduler().scheduleOnce( - interval, - context.getActor(), new InitiateInstallSnapshot(), - context.getActorSystem().dispatcher(), context.getActor()); - } - protected void stopIsolatedLeaderCheckSchedule() { if (isolatedLeaderCheckSchedule != null && !isolatedLeaderCheckSchedule.isCancelled()) { isolatedLeaderCheckSchedule.cancel(); @@ -104,7 +77,6 @@ public class Leader extends AbstractLeader { @Override public void close() throws Exception { - stopInstallSnapshotSchedule(); stopIsolatedLeaderCheckSchedule(); super.close(); } -- 2.36.6