Fix testLeaderAndFollowerEntityOwnersReassignedAfterShutdown failure 47/56847/4
authorTom Pantelis <tompantelis@gmail.com>
Thu, 11 May 2017 11:32:39 +0000 (07:32 -0400)
committerRobert Varga <nite@hq.sk>
Fri, 12 May 2017 14:52:32 +0000 (14:52 +0000)
commitaf7843cb8ff928e5cce9fbd94afd441cdf857dde
treebd898cfee9d54b5e0a4d397f6be0211313181f3f
parentf66efc45eaceafddcc6301b1d6ccfb2263174339
Fix testLeaderAndFollowerEntityOwnersReassignedAfterShutdown failure

14:19:15 Failed tests:
14:19:15   DistributedEntityOwnershipIntegrationTest.testLeaderAndFollowerEntityOwnersReassignedAfterShutdown:439->lambda$testLeaderAndFollowerEntityOwnersReassignedAfterShutdown$1:440 Raft state expected:<[Leader]> but was:<[Candidate]>

After the leader is shut down, member-2 is supposed to be elected leader but,
in this case, it didn't get the vote from member-5 b/c member-2 had not yet
received the MemberUp for member-5 and thus did not have its peer actor address.
So I made changes to ensure member data stores are ready and members are up.

I also saw a failure where member-3 or member5 didn't grant the vote for member-2
b/c it's last log index was greater. This can happen is member-2 didn't was a bit
behind when the leader was shut down. So I changes it to obtain the leader's last
index and verify the remaining follower's last log index is up-to-date.

Change-Id: Ib5ad2e135bb3809e1c62a432a029a5a56109190d
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipIntegrationTest.java