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

Fix stale read in ra:consistent_query/2 #340

Closed kjnilsson closed 1 year ago

kjnilsson commented 1 year ago

Certain leader change scenarios could occasionally result in a stale result being returned from ra:consisten_query/2. This PR fixes this by ensuring all members reset their query_index each time a new term is detected.

This issue also could result in poor read availability see https://github.com/rabbitmq/ra/discussions/337

This also introduces a fix in the ra registery when a member with the same registered name is declared it now overwrites the prior durable entry to match the transient state.

This also includes a slightly odd 2.4.4 commit which is something I missed to push after releasing 2.4.4.