rabbitmq / ra

A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Other
798 stars 93 forks source link

Add `read` to `file:open/2` options in `ra_lib:sync_file/1` #452

Closed the-mikedavis closed 4 days ago

the-mikedavis commented 4 days ago

This fixes an issue where checkpoints which were promoted to snapshots would become empty. We need to file:open/2 the checkpoint file with the read option as well as write since write without read truncates the file.

We also add another server restart to the checkpoint promotion case which catches the failure - the servers failed to restart since the promoted snapshot is empty.