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
813 stars 96 forks source link

Do not overwrite the config file in place #381

Closed kjnilsson closed 1 year ago

kjnilsson commented 1 year ago

When the config file for a given Ra member needs to be updated we overwrite it in place. Instead we should take the safer option of writing it to a temp file then moving in place.

This should avoid a possible corruption path that would stop members from being restarted.

See https://github.com/rabbitmq/ra/blob/0422ef4520c5ea08decd8da09e7d7078261df9fc/src/ra_log.erl#L725