Skip to content

Commit

Permalink
Update condition to decide non-voter
Browse files Browse the repository at this point in the history
  • Loading branch information
sile committed Apr 26, 2024
1 parent 1646695 commit 924c024
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ra_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2827,9 +2827,7 @@ query_indexes(#{cfg := #cfg{id = Id},
query_index := QueryIndex}) ->
maps:fold(fun (PeerId, _, Acc) when PeerId == Id ->
Acc;
(_K, #{voter_status := #{membership := non_voter}}, Acc) ->
Acc;
(_K, #{voter_status := #{membership := promotable}}, Acc) ->
(_K, #{voter_status := #{membership := Membership}}, Acc) when Membership =/= voter ->
Acc;
(_K, #{query_index := Idx}, Acc) ->
[Idx | Acc]
Expand All @@ -2841,9 +2839,7 @@ match_indexes(#{cfg := #cfg{id = Id},
{LWIdx, _} = ra_log:last_written(Log),
maps:fold(fun (PeerId, _, Acc) when PeerId == Id ->
Acc;
(_K, #{voter_status := #{membership := non_voter}}, Acc) ->
Acc;
(_K, #{voter_status := #{membership := promotable}}, Acc) ->
(_K, #{voter_status := #{membership := Membership}}, Acc) when Membership =/= voter ->
Acc;
(_K, #{match_index := Idx}, Acc) ->
[Idx | Acc]
Expand Down Expand Up @@ -3153,9 +3149,7 @@ required_quorum(Cluster) ->

count_voters(Cluster) ->
maps:fold(
fun (_, #{voter_status := #{membership := non_voter}}, Count) ->
Count;
(_, #{voter_status := #{membership := promotable}}, Count) ->
fun (_, #{voter_status := #{membership := Membership}}, Count) when Membership =/= voter ->
Count;
(_, _, Count) ->
Count + 1
Expand Down

0 comments on commit 924c024

Please sign in to comment.