NuRaft icon indicating copy to clipboard operation
NuRaft copied to clipboard

How to force a snapshot?

Open kishorekrd opened this issue 3 years ago • 2 comments

Currently snapshot will be taken at the configured snapshot distance. How can force a snapshot at will? creatsnapshot() requires snapshot "s". How to get this? void create_snapshot(snapshot& s, async_result::handler_type& when_done)

kishorekrd avatar May 10 '22 19:05 kishorekrd

Hi @kishorekrd

Currently, there is no way to create a snapshot at will. Your state machine can create snapshots anytime though, but those non-regular ones won't be used by NuRaft. It will be useful if there is an API like raft_server::create_snapshot(uint64_t log_idx). I will put it into the backlog.

greensky00 avatar May 16 '22 16:05 greensky00

I kind of solved it by setting snapshot distance to 1 and add my logic to chk_create_snapshot() to take decision on the snapshot at will. But API should be good. Thanks

kishorekrd avatar May 16 '22 23:05 kishorekrd