Bug:3260-Recovery misses flows installed on single node 72/21372/3
authorKamal Rameshan <kramesha@cisco.com>
Thu, 28 May 2015 20:54:48 +0000 (13:54 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 1 Jun 2015 16:17:43 +0000 (16:17 +0000)
commit1c4abd5ad29d3200929275cf0030c0e4f35c3886
treecdf1336f3b9fa71d3d81713e10940a03572d6dd7
parent879a3015b313694d8158e9fec151ce467f18a065
Bug:3260-Recovery misses flows installed on single node

There are 2 bugs which were enountered
1. When akka replays the journal, it replays it from the peristent journal's sequence number present at the time of snapshot success
2. The log entry on which a snapshot capture is triggered does not make it to that snapshot and gets removed from persistent journal as well.
So on recovery, that log entry/data is missing

To fix the first, the snapshotSeqNr() method of UnTypedPersistenActor is overridden, so that akka uses the cached last-sequence-number rather than using its own

To fix the second issue, the capture of snapshot for single node is done after applyState. This ensures that the persistent journal and snapshot are in sync

Also the in-memory journal was replaying all its messages and not honoring the fromSequenceNr, like akka does. So fixed it.

The tests needed to be fixed primarily due to the in-memory journal change.

A new test is added to test out the recovery of single node.

Change-Id: I779d1d6ce9880b19322d831ef5c8696b4c751e3d
Signed-off-by: Kamal Rameshan <kramesha@cisco.com>
12 files changed:
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLog.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractReplicatedLogImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/RecoveryIntegrationSingleNodeTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/InMemoryJournal.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java