Skip to content

Commit 7e543d8

Browse files
Sarah Hassanfacebook-github-bot
authored andcommitted
Add bootstrap command handler for non-stalled nodes
Summary: Add fallback bootstrap command handling to reject bootstrap requests on already-initialized RAFT replicas Reviewed By: jaher Differential Revision: D77689348 fbshipit-source-id: 0d1b4bb7cedcfa32dc2de7dbc8f666fe59bd4714
1 parent 9f58d04 commit 7e543d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/wa_raft_server.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,10 @@ command(
21452145
wa_raft_durable_state:store(Data2),
21462146
{next_state, disabled, Data2, {reply, From, ok}};
21472147

2148+
%% [Bootstrap] Non-stalled nodes are already bootstrapped.
2149+
command(_State, {call, From}, ?BOOTSTRAP_COMMAND(_Position, _Config, _Data), #raft_state{}) ->
2150+
{keep_state_and_data, {reply, From, {error, already_bootstrapped}}};
2151+
21482152
%% [Fallback] Drop unknown command calls.
21492153
command(State, Type, Event, #raft_state{} = Data) ->
21502154
?RAFT_LOG_NOTICE(State, Data, "dropping unhandled ~0p command ~0P", [Type, Event, 20]),

0 commit comments

Comments
 (0)