|
|
@@ -173,6 +173,11 @@ type Config struct {
|
|
|
// MemoryLogCapacity is the maximum number of log entries to keep in memory
|
|
|
MemoryLogCapacity int
|
|
|
|
|
|
+ // LogCompactionEnabled determines if log compaction is enabled
|
|
|
+ // If false, the log will grow indefinitely (safest for data, but consumes disk)
|
|
|
+ // Default: false
|
|
|
+ LogCompactionEnabled bool
|
|
|
+
|
|
|
// SnapshotThreshold triggers snapshot when log grows beyond this
|
|
|
SnapshotThreshold uint64
|
|
|
|
|
|
@@ -269,7 +274,8 @@ func DefaultConfig() *Config {
|
|
|
HeartbeatInterval: 50 * time.Millisecond,
|
|
|
MaxLogEntriesPerRequest: 5000,
|
|
|
MemoryLogCapacity: 10000,
|
|
|
- SnapshotThreshold: ^uint64(0), // 默认不启用压缩 (MaxUint64)
|
|
|
+ LogCompactionEnabled: false, // 默认不启用压缩
|
|
|
+ SnapshotThreshold: 100000, // 默认阈值(仅在 LogCompactionEnabled=true 时生效)
|
|
|
SnapshotMinRetention: 10000, // 保留1万条用于 follower 追赶
|
|
|
SnapshotChunkSize: 1024 * 1024, // 1MB chunks
|
|
|
RPCTimeout: 500 * time.Millisecond,
|