Add direct in-memory journal threshold
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / DefaultConfigParamsImpl.java
index 97838b03212f8ea8b3fbd6201995b398a9b61977..37ed729bed3e4edaf8f5f013c6a497edb8ba7eb6 100644 (file)
@@ -68,6 +68,10 @@ public class DefaultConfigParamsImpl implements ConfigParams {
     // in-memory journal can use before it needs to snapshot
     private int snapshotDataThresholdPercentage = 12;
 
+    // max size of in-memory journal in MB
+    // 0 means direct threshold if disabled
+    private int snapshotDataThreshold = 0;
+
     private int snapshotChunkSize = SNAPSHOT_CHUNK_SIZE;
 
     private long electionTimeoutFactor = 2;
@@ -100,6 +104,10 @@ public class DefaultConfigParamsImpl implements ConfigParams {
         this.snapshotDataThresholdPercentage = snapshotDataThresholdPercentage;
     }
 
+    public void setSnapshotDataThreshold(final int snapshotDataThreshold) {
+        this.snapshotDataThreshold = snapshotDataThreshold;
+    }
+
     public void setSnapshotChunkSize(final int snapshotChunkSize) {
         this.snapshotChunkSize = snapshotChunkSize;
     }
@@ -148,6 +156,11 @@ public class DefaultConfigParamsImpl implements ConfigParams {
         return snapshotDataThresholdPercentage;
     }
 
+    @Override
+    public int getSnapshotDataThreshold() {
+        return snapshotDataThreshold;
+    }
+
     @Override
     public int getRecoverySnapshotIntervalSeconds() {
         return this.recoverySnapshotIntervalSeconds;