Bug 3376: Add debug context for CDS transactions
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DatastoreContext.java
index 2f323aafd35694b0d9c496d9eed58742a10b1aaa..4140d3323b33be4955b720eb8238644ebb3f305e 100644 (file)
@@ -66,6 +66,7 @@ public class DatastoreContext {
     private int shardBatchedModificationCount = DEFAULT_SHARD_BATCHED_MODIFICATION_COUNT;
     private boolean writeOnlyTransactionOptimizationsEnabled = true;
     private long shardCommitQueueExpiryTimeoutInMillis = DEFAULT_SHARD_COMMIT_QUEUE_EXPIRY_TIMEOUT_IN_MS;
+    private boolean transactionDebugContextEnabled = false;
 
     public static Set<String> getGlobalDatastoreTypes() {
         return globalDatastoreTypes;
@@ -96,6 +97,7 @@ public class DatastoreContext {
         this.shardBatchedModificationCount = other.shardBatchedModificationCount;
         this.writeOnlyTransactionOptimizationsEnabled = other.writeOnlyTransactionOptimizationsEnabled;
         this.shardCommitQueueExpiryTimeoutInMillis = other.shardCommitQueueExpiryTimeoutInMillis;
+        this.transactionDebugContextEnabled = other.transactionDebugContextEnabled;
 
         setShardJournalRecoveryLogBatchSize(other.raftConfig.getJournalRecoveryLogBatchSize());
         setSnapshotBatchCount(other.raftConfig.getSnapshotBatchCount());
@@ -208,6 +210,10 @@ public class DatastoreContext {
         return shardCommitQueueExpiryTimeoutInMillis;
     }
 
+    public boolean isTransactionDebugContextEnabled() {
+        return transactionDebugContextEnabled;
+    }
+
     public static class Builder {
         private final DatastoreContext datastoreContext;
         private int maxShardDataChangeExecutorPoolSize =
@@ -364,6 +370,11 @@ public class DatastoreContext {
             return this;
         }
 
+        public Builder transactionDebugContextEnabled(boolean value) {
+            datastoreContext.transactionDebugContextEnabled = value;
+            return this;
+        }
+
         public Builder maxShardDataChangeExecutorPoolSize(int maxShardDataChangeExecutorPoolSize) {
             this.maxShardDataChangeExecutorPoolSize = maxShardDataChangeExecutorPoolSize;
             return this;