Bug:3260-Recovery misses flows installed on single node 70/21570/2
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 19:06:05 +0000 (19:06 +0000)
commit214ba02ca4400d88e494fa27a44c30531f68968e
tree5c3b5d21f64980cd1cdd2e95a022ee4792b23df6
parentc04117c66b63366a2f402a06d20f9980bb7283cb
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>
(cherry picked from commit 1c4abd5ad29d3200929275cf0030c0e4f35c3886)
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