X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FSimpleShardDataTreeCohort.java;h=bfbfb138a1791ea8dc577e095b0dd38fa5164d14;hb=refs%2Fchanges%2F84%2F21384%2F2;hp=9f22ce8a73e2380625f2f03c0e1ab5e7b35a2c29;hpb=07c40ad2904d0e9aa03828ba0ba9336e1560d0ec;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java index 9f22ce8a73..bfbfb138a1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.cluster.datastore; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.slf4j.Logger; @@ -36,7 +37,7 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { @Override public ListenableFuture canCommit() { try { - dataTree.getDataTree().validate(transaction); + dataTree.getDataTree().validate(dataTreeModification()); LOG.debug("Transaction {} validated", transaction); return TRUE_FUTURE; } catch (Exception e) { @@ -47,7 +48,7 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { @Override public ListenableFuture preCommit() { try { - candidate = dataTree.getDataTree().prepare(transaction); + candidate = dataTree.getDataTree().prepare(dataTreeModification()); /* * FIXME: this is the place where we should be interacting with persistence, specifically by invoking * persist on the candidate (which gives us a Future). @@ -60,6 +61,14 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { } } + private DataTreeModification dataTreeModification() { + DataTreeModification dataTreeModification = transaction; + if(transaction instanceof PruningDataTreeModification){ + dataTreeModification = ((PruningDataTreeModification) transaction).getDelegate(); + } + return dataTreeModification; + } + @Override public ListenableFuture abort() { // No-op, really