Bug 3570: Use SnapShot lastAppliedIndex for install snapshot 68/22368/1
authorTom Pantelis <tpanteli@brocade.com>
Wed, 10 Jun 2015 06:17:21 +0000 (02:17 -0400)
committerMoiz Raja <moraja@cisco.com>
Thu, 11 Jun 2015 14:48:56 +0000 (14:48 +0000)
commited7166c5ba3a378f46640bb479464580c2b167ba
treedc0003ddc8bbeaccdb6b27ee12686cbfa71a9c56
parent90e6ebaad47aa4c53ea48bd3d2070e502bf6b0a2
Bug 3570: Use SnapShot lastAppliedIndex for install snapshot

Follow-up patch for https://git.opendaylight.org/gerrit/#/c/21904/ to
use the captured Snapshot's lastAppliedIndex for the lastIncludedIndex
field in the InstallSnapshot message and the follower's matchIndex/nextIndex
once the install completes. This is in lieu of using the leader's snapshotIndex
which typically lags behind the lastAppliedIndex by 1 due to the trimming of
the in-memory log. This avoids the leader sending its last log entry
redundantly after the install completes as the last entry was included
in the snapshot.

Change-Id: Ie821078b4316641b67e1b853b9264353dde6bfae
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit 1dfb0b9105e9eb352ff2263434e79a5433e59e91)
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendInstallSnapshot.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/RecoveryIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicationAndSnapshotsWithLaggingFollowerIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotManagerTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java