Fix issue when AE leader differs from prior install snapshot leader 21/44821/1
authorTom Pantelis <tpanteli@brocade.com>
Mon, 29 Aug 2016 21:11:35 +0000 (17:11 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 30 Aug 2016 01:45:26 +0000 (01:45 +0000)
commit6426e65f31e2875bc3656c78b1d36ef01dc1c945
tree5edd8581f64cb5298a3a393b5495da1cd2109e89
parent80f019059ce0ecebbd25d86c69150dfb6f7f62f3
Fix issue when AE leader differs from prior install snapshot leader

When a leader snapshot install is in progress, a follower doesn't process
AppendEntries and merely returns a reply with its last term/index. However,
if an install snapshot is initiated by a leader and there is more than one
chunk to send, it's possible for a leader change to occur prior to completing
sending all the chunks. When this happens, the new leader will begin sending
AppendEntries but the follower won't process them and make progress. We need
to clear the follower's snapshot state if the AppendEntries leaderId doesn't
match the prior install snapshot leaderId.

Change-Id: I4051bd064b6a20f4bcfe38b50656488fcb09274e
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 95d7b8820236d16cb7e37c4a95fcae6f6d55581e)
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SnapshotTracker.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/SnapshotTrackerTest.java