From: Tom Pantelis Date: Wed, 4 Nov 2015 08:59:39 +0000 (-0500) Subject: Bug 4564: Implement datastore restore from backup file X-Git-Tag: release/beryllium~161 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=288a70d15252b3c5fafd202fe7935563f05da9c8 Bug 4564: Implement datastore restore from backup file Added a singleton DatastoreSnapshotRestore class that looks for and reads a restore file in a specific directory and deserializes the datastore snapshots. The restore file is then deleted. The DatastoreSnapshotRestore instance needs to be injected into both DistributedDatastore instances which are created via separate config system Module instances. However the only way to inject the DatastoreSnapshotRestore instance would be to define a yang module and service. I didn't want to go thru the overhead of all that and I didn't want the DatastoreSnapshotRestore advertised as a service. So I made it a static singleton that is created via a new bundle Activator class. The DatastoreSnapshot instance is passed to the ShardManager which passes each ShardSnapshot to the corresponding Shard actor. On recovery complete, the RaftActor takes care of applying the restored snapshot. Change-Id: Ied3db4e49b98320abb34e2acf73b27b29232f8d6 Signed-off-by: Tom Pantelis --- diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java index 4a20e5b3ae..10574e3a02 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java @@ -139,7 +139,7 @@ public class SnapshotManager implements SnapshotState { lastLogEntryIndex = lastLogEntry.getIndex(); lastLogEntryTerm = lastLogEntry.getTerm(); } else { - LOG.warn("Capturing Snapshot : lastLogEntry is null. Using lastAppliedIndex {} and lastAppliedTerm {} instead.", + LOG.debug("Capturing Snapshot : lastLogEntry is null. Using lastAppliedIndex {} and lastAppliedTerm {} instead.", lastAppliedIndex, lastAppliedTerm); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index 74d4ec72b3..ea71351b69 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -174,6 +174,7 @@ ${project.groupId}.${project.artifactId} + org.opendaylight.controller.cluster.datastore.osgi.Activator !*snappy;!org.jboss.*;!com.jcraft.*;!*jetty*;!sun.security.*;*