Skip to content

Commit fb4f876

Browse files
hsun324facebook-github-bot
authored andcommitted
Fix disable reason not being persisted on fatal append errors
Summary: Fix the disabled state and reason not being persisted to the durable state file when a fatal append error is detected. Reviewed By: SarahDesouky Differential Revision: D80180399 fbshipit-source-id: 9d837045b7b799c21998e21ded73a9f2f954aeec
1 parent 14d28a5 commit fb4f876

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/wa_raft_server.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,9 @@ follower(
15391539
?RAFT_COUNT('raft.follower.handover.fatal'),
15401540
?SERVER_LOG_WARNING(State0, "failing handover request because append was fatal due to ~0P.", [Reason, 30]),
15411541
send_rpc(Sender, ?HANDOVER_FAILED(Ref), State0),
1542-
{next_state, disabled, State0#raft_state{disable_reason = Reason}}
1542+
State1 = State0#raft_state{disable_reason = Reason},
1543+
wa_raft_durable_state:store(State1),
1544+
{next_state, disabled, State1}
15431545
end;
15441546
false ->
15451547
?SERVER_LOG_NOTICE(State0, "not considering handover RPC due to being inelgibile for leadership.", []),
@@ -3075,7 +3077,9 @@ handle_heartbeat(
30753077
{next_state, NewState, Data3, ?ELECTION_TIMEOUT(Data3)}
30763078
end;
30773079
{fatal, Reason} ->
3078-
{next_state, disabled, Data0#raft_state{disable_reason = Reason}}
3080+
Data1 = Data0#raft_state{disable_reason = Reason},
3081+
wa_raft_durable_state:store(Data1),
3082+
{next_state, disabled, Data1}
30793083
end.
30803084

30813085
%% Append the provided range of the log entries to the local log only if the

0 commit comments

Comments
 (0)