BUG 2509 : Removing all journal entries from a Followers in-memory journal causes... 75/13675/1
authorMoiz Raja <moraja@cisco.com>
Tue, 16 Dec 2014 05:59:13 +0000 (21:59 -0800)
committerMoiz Raja <moraja@cisco.com>
Tue, 16 Dec 2014 05:59:13 +0000 (21:59 -0800)
commitdff59a3b6775db8e7215254d3c5da65388221949
treea1104f5348f4501414f05d9be74ecbf9cf4276c1
parent672ac242bf3acc6c9eaf80071be5f74cab8c9b3b
BUG 2509 : Removing all journal entries from a Followers in-memory journal causes Leader to send an InstallSnapshot

This patch simply checks if an AppendEntries#prevLogIndex is equal to the followers ReplicatedLog#snapshotIndex. If
both are the same it also verifies that the AppendEntries#prevLogTerm is equal to the followers ReplicatedLog#snapshotTerm.
This is sufficient in most cases to prevent a re-installation of a snapshot when the AppendEntries message is supposed
to immediately follow the snapshot.

Change-Id: Iab9b493455538544efd06334329f91cc426d61f8
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java