BUG 2849 : Reduce sending of duplicate replication messages 23/16723/2
authorMoiz Raja <moraja@cisco.com>
Wed, 11 Mar 2015 20:22:31 +0000 (13:22 -0700)
committerMoiz Raja <moraja@cisco.com>
Tue, 17 Mar 2015 23:02:39 +0000 (16:02 -0700)
commit859ad8ac73dab8064013a95ab4962eecbfb6d346
tree176c1d067de9e4f50ebbce5a3c6fa2bd84cec87d
parent432bac36271971fcf91a006423d4d4dc27398ba5
BUG 2849 : Reduce sending of duplicate replication messages

With Raft not all append entries are expected to reach the followers
so it is a requirement that when acknowledgement of an append entries
is not received we send a duplicate append entries.

In replication scenarios where a lot of rapid replication messages
are being generated the lack of equally rapid acknowledgement results
in a lot of duplicate messages being generated. This later results in
a cycle when the replies for those duplicate replication messages start
arriving and result in even more duplicate replication messages being
sent.

This patch addresses this problem by disallowing a replication message
to be generated for a follower is the nextIndex for that follower
has not changed or the time since the last replication message exceeds
the heartbeat interval. This allows us to reduce duplicates but still
allows duplicates to get generated for legitimate reasons.

Change-Id: I0918672468f4fc1da935c45c7b46c750cde619f4
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java