X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardSnapshotCohort.java;h=e49aa1e4f37d484d25439fd009affdeeba3a3cd8;hp=600509a26b87b480156f4baf843f2b887ed4f655;hb=8ec73bf853a9b6708b455c0321a585992e02b125;hpb=ba3433c7bf94e551a4ea520c95165a9358bf9227 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java index 600509a26b..e49aa1e4f3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java @@ -7,8 +7,8 @@ */ package org.opendaylight.controller.cluster.datastore; -import com.google.common.base.Preconditions; import akka.actor.ActorRef; +import com.google.common.base.Preconditions; import java.util.concurrent.ExecutionException; import org.opendaylight.controller.cluster.datastore.identifiers.ShardTransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.CreateSnapshot; @@ -24,14 +24,12 @@ import org.slf4j.Logger; * @author Thomas Pantelis */ class ShardSnapshotCohort implements RaftActorSnapshotCohort { - - private static final YangInstanceIdentifier DATASTORE_ROOT = YangInstanceIdentifier.builder().build(); - - private int createSnapshotTransactionCounter; private final ShardTransactionActorFactory transactionActorFactory; private final ShardDataTree store; - private final Logger log; private final String logId; + private final Logger log; + + private int createSnapshotTransactionCounter; ShardSnapshotCohort(ShardTransactionActorFactory transactionActorFactory, ShardDataTree store, Logger log, String logId) { @@ -51,7 +49,7 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort { "createSnapshot" + ++createSnapshotTransactionCounter); ActorRef createSnapshotTransaction = transactionActorFactory.newShardTransaction( - TransactionProxy.TransactionType.READ_ONLY, transactionID, "", DataStoreVersions.CURRENT_VERSION); + TransactionType.READ_ONLY, transactionID, ""); createSnapshotTransaction.tell(CreateSnapshot.INSTANCE, actorRef); } @@ -70,10 +68,10 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort { NormalizedNode node = SerializationUtils.deserializeNormalizedNode(snapshotBytes); // delete everything first - transaction.getSnapshot().delete(DATASTORE_ROOT); + transaction.getSnapshot().delete(YangInstanceIdentifier.EMPTY); // Add everything from the remote node back - transaction.getSnapshot().write(DATASTORE_ROOT, node); + transaction.getSnapshot().write(YangInstanceIdentifier.EMPTY, node); syncCommitTransaction(transaction); } catch (InterruptedException | ExecutionException e) { log.error("{}: An exception occurred when applying snapshot", logId, e);