Bug 2948: Perform create snapshot synchronously 14/18114/4
authorTom Pantelis <tpanteli@brocade.com>
Wed, 8 Apr 2015 07:32:15 +0000 (03:32 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 14 Apr 2015 00:53:15 +0000 (20:53 -0400)
commit4a60a637941ccf77ab7b32484cbc4128eaf3ea7c
tree355a5142cce504ce162cd94092e3b190fb8646d3
parentc190bfc14468c9ad954201a53326df941161c470
Bug 2948: Perform create snapshot synchronously

Performing the create snapshot phase asynchronously via sending
the CaptureSnapshot message may result in subsequent modifications
that are applied after the CaptureSnapshot message is sent but before
it's received to be included in the snapshot and also included as
unapplied entries in the snapshot. On recovery, the modifications
would be redundantly applied. This could result in data tree errors,
eg if a modification was a delete, the redundant apply would cause an
exception due to the non-existent node.

To avoid this, the SnapshotManager was changed to immediately call the
create procedure in the capture method instead of sending the
CaptureSnapshot message. The create procedure is now set in the
SnapshotManager by the RaftActorSnapshotMessageSupport. The Capturing
state was removed.

Change-Id: I0efe8966d83e019c9dd8a82799193ea7ac49ba65
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
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/RaftActorSnapshotMessageSupport.java
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/SnapshotState.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/RaftActorSnapshotMessageSupportTest.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/ReplicationAndSnapshotsIntegrationTest.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