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=2b6b39684a271976be496cd366eda3ef0797b7c9;hb=86e398bb1e1a60f7516b398a0f27268bf232049d;hp=9f22ce8a73e2380625f2f03c0e1ab5e7b35a2c29;hpb=608760751ce7fcf4e84e86a8b33d43bc1d9984d6;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..2b6b39684a 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,8 +37,8 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { @Override public ListenableFuture canCommit() { try { - dataTree.getDataTree().validate(transaction); - LOG.debug("Transaction {} validated", transaction); + dataTree.getDataTree().validate(dataTreeModification()); + LOG.trace("Transaction {} validated", transaction); return TRUE_FUTURE; } catch (Exception e) { return Futures.immediateFailedFuture(e); @@ -47,12 +48,12 @@ 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). */ - LOG.debug("Transaction {} prepared candidate {}", transaction, candidate); + LOG.trace("Transaction {} prepared candidate {}", transaction, candidate); return VOID_FUTURE; } catch (Exception e) { LOG.debug("Transaction {} failed to prepare", transaction, e); @@ -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 @@ -75,7 +84,7 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { return Futures.immediateFailedFuture(e); } - LOG.debug("Transaction {} committed, proceeding to notify", transaction); + LOG.trace("Transaction {} committed, proceeding to notify", transaction); dataTree.notifyListeners(candidate); return VOID_FUTURE; }