*/
private static final int ELECTION_TIME_MAX_VARIANCE = 100;
- private static final int SNAPSHOT_CHUNK_SIZE = 2048 * 1000; //2MB
+ private static final int SNAPSHOT_CHUNK_SIZE = 480 * 1024; // 480KiB
/**
// 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;
this.snapshotBatchCount = snapshotBatchCount;
}
- public void setRecoverySnapshotIntervalSeconds(int recoverySnapshotInterval) {
+ public void setRecoverySnapshotIntervalSeconds(final int recoverySnapshotInterval) {
checkArgument(recoverySnapshotInterval >= 0);
- this.recoverySnapshotIntervalSeconds = recoverySnapshotInterval;
+ recoverySnapshotIntervalSeconds = recoverySnapshotInterval;
}
public void setSnapshotDataThresholdPercentage(final int snapshotDataThresholdPercentage) {
this.snapshotDataThresholdPercentage = snapshotDataThresholdPercentage;
}
+ public void setSnapshotDataThreshold(final int snapshotDataThreshold) {
+ this.snapshotDataThreshold = snapshotDataThreshold;
+ }
+
public void setSnapshotChunkSize(final int snapshotChunkSize) {
this.snapshotChunkSize = snapshotChunkSize;
}
return snapshotDataThresholdPercentage;
}
+ @Override
+ public int getSnapshotDataThreshold() {
+ return snapshotDataThreshold;
+ }
+
@Override
public int getRecoverySnapshotIntervalSeconds() {
- return this.recoverySnapshotIntervalSeconds;
+ return recoverySnapshotIntervalSeconds;
}
@Override