braft icon indicating copy to clipboard operation
braft copied to clipboard

support set truncate_index manually in on_snapshot_save

Open JayiceZ opened this issue 1 year ago • 0 comments

In braft, creating a snapshot will result in the truncation of logs, and users can not decide which logs will be truncated after snapshot_save. But sometimes, user wants to take over it and decides which logs should be retained.

For example, last_index=20 now, And snapshot_save is issued, but I don’t want to truncate all the logs before 20. On the contrary, logs between 11-20 should be kept and only logs before 11 will be truncated. But now, users can't achieve it. : (

I believe it will be a useful feature. By fully controlling the truncate index, users can use raft log as WAL of non-volatile StateMachine or to implement CDC etc.

JayiceZ avatar Jun 05 '24 18:06 JayiceZ