lni / dragonboat

A feature complete and high performance multi-group Raft library in Go.
Apache License 2.0
5.08k stars 541 forks source link

Support manual Raft log compaction #190

Closed lni closed 2 years ago

lni commented 3 years ago

In the current implementation, Dragonboat automatically compact Raft logs whenever it is possible. It is automatically triggered whenever a new snapshot is created as that implies all logs included in the snapshot is no longer required.

A potential Dragonboat user mentioned the requirement that they would like to be able to manually trigger such log compaction by using the specified raft log range to be compacted as the input.

lni commented 2 years ago

This has been added to the master branch. SnapshotOption now contains a field called CompactionIndex.

This is an advanced feature, misusing it would cause the cluster to be permanently damaged.