import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerRegistrationNode;
+import org.opendaylight.controller.md.sal.dom.store.impl.tree.ModificationType;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.NodeModification;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode;
import org.opendaylight.controller.md.sal.dom.store.impl.tree.TreeNodeUtils;
}
private synchronized DOMStoreThreePhaseCommitCohort submit(
- final SnaphostBackedWriteTransaction snaphostBackedWriteTransaction) {
- return new ThreePhaseCommitImpl(snaphostBackedWriteTransaction);
+ final SnaphostBackedWriteTransaction writeTx) {
+ LOG.debug("Tx: {} is submitted. Modifications: {}",writeTx.getIdentifier(),writeTx.getMutatedView());
+ return new ThreePhaseCommitImpl(writeTx);
}
private Object nextIdentifier() {
private synchronized void commit(final DataAndMetadataSnapshot currentSnapshot,
final StoreMetadataNode newDataTree, final Iterable<ChangeListenerNotifyTask> listenerTasks) {
LOG.debug("Updating Store snaphot version: {} with version:{}",currentSnapshot.getMetadataTree().getSubtreeVersion(),newDataTree.getSubtreeVersion());
+ if(LOG.isTraceEnabled()) {
+ LOG.trace("Data Tree is {}",StoreUtils.toStringTree(newDataTree));
+ }
checkState(snapshot == currentSnapshot, "Store snapshot and transaction snapshot differs");
snapshot = DataAndMetadataSnapshot.builder() //
.setMetadataTree(newDataTree) //
public SnapshotBackedReadTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot) {
this.identifier = identifier;
this.stableSnapshot = snapshot;
+ LOG.debug("ReadOnly Tx: {} allocated with snapshot {}",identifier,snapshot.getMetadataTree().getSubtreeVersion());
+
}
@Override
this.identifier = identifier;
mutableTree = MutableDataTree.from(snapshot, applyOper);
this.store = store;
+ LOG.debug("Write Tx: {} allocated with snapshot {}",identifier,snapshot.getMetadataTree().getSubtreeVersion());
}
@Override
@Override
public ListenableFuture<Void> preCommit() {
storeSnapshot = snapshot;
+ if(modification.getModificationType() == ModificationType.UNMODIFIED) {
+ return Futures.immediateFuture(null);
+ }
return executor.submit(new Callable<Void>() {
@Override
public ListenableFuture<Void> commit() {
- checkState(proposedSubtree != null);
- checkState(storeSnapshot != null);
+ if(modification.getModificationType() == ModificationType.UNMODIFIED) {
+ return Futures.immediateFuture(null);
+ }
+
+ checkState(proposedSubtree != null,"Proposed subtree must be computed");
+ checkState(storeSnapshot != null,"Proposed subtree must be computed");
// return ImmediateFuture<>;
InMemoryDOMDataStore.this.commit(storeSnapshot, proposedSubtree.get(),listenerTasks);
return Futures.<Void> immediateFuture(null);