BUG-5280: add {Create,Close,Purge}LocalHistoryPayload
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardDataTreeTransactionChain.java
index 9a8e89eb422c4b4f909e6a6c3ea97366d1ab01f2..2554151dd73c6e4a0442169474530f21d0bcd586 100644 (file)
@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
 @NotThreadSafe
 final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
         implements Identifiable<LocalHistoryIdentifier> {
+
     private static final Logger LOG = LoggerFactory.getLogger(ShardDataTreeTransactionChain.class);
     private final LocalHistoryIdentifier chainId;
     private final ShardDataTree dataTree;
@@ -42,10 +43,12 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
         Preconditions.checkState(openTransaction == null, "Transaction %s is open", openTransaction);
 
         if (previousTx == null) {
+            LOG.debug("Opening an unchained snapshot in {}", chainId);
             return dataTree.takeSnapshot();
-        } else {
-            return previousTx.getSnapshot();
         }
+
+        LOG.debug("Reusing a chained snapshot in {}", chainId);
+        return previousTx.getSnapshot();
     }
 
     ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(final TransactionIdentifier txId) {
@@ -65,6 +68,7 @@ final class ShardDataTreeTransactionChain extends ShardDataTreeTransactionParent
 
     void close() {
         closed = true;
+        LOG.debug("Closing chain {}", chainId);
     }
 
     @Override