X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbehaviors%2FCandidate.java;h=196456440b468794b21b60380934d705bfbf3234;hb=766df8b58cc1decd7b40e0adbf41d3657fc21f2c;hp=74bede171f1f6e6ad6b33feef6806d3c77321581;hpb=994dbb10de67c0d9fd5f78a216ea372326609a49;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java index 74bede171f..196456440b 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java @@ -75,6 +75,14 @@ public class Candidate extends AbstractRaftActorBehavior { LOG.debug("{}: handleAppendEntries: {}", logName(), appendEntries); } + // Some other candidate for the same term became a leader and sent us an append entry + if(currentTerm() == appendEntries.getTerm()){ + LOG.debug("{}: New Leader sent an append entry to Candidate for term {} will switch to Follower", + logName(), currentTerm()); + + return switchBehavior(new Follower(context)); + } + return this; }