From ed3526a67280fe6c2d7ffb8509c1b1c7b0fcf105 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 19 Aug 2024 10:37:01 -0400 Subject: [PATCH] Handle calls and queries in receive_snapshot state --- src/ra_server_proc.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ra_server_proc.erl b/src/ra_server_proc.erl index 94b605bf..af17cb61 100644 --- a/src/ra_server_proc.erl +++ b/src/ra_server_proc.erl @@ -857,6 +857,18 @@ receive_snapshot(enter, OldState, State0 = #state{conf = Conf}) -> | Actions]}; receive_snapshot(_, tick_timeout, State0) -> {keep_state, State0, set_tick_timer(State0, [])}; +receive_snapshot({call, From}, {leader_call, Msg}, State) -> + maybe_redirect(From, Msg, State); +receive_snapshot(EventType, {local_call, Msg}, State) -> + receive_snapshot(EventType, Msg, State); +receive_snapshot({call, _From} = EventType, {local_query, QueryFun}, State) -> + receive_snapshot(EventType, {local_query, QueryFun, #{}}, State); +receive_snapshot({call, From}, {local_query, QueryFun, Options}, State) -> + perform_or_delay_local_query( + await_condition, From, QueryFun, Options, State); +receive_snapshot({call, From}, {state_query, Spec}, State) -> + Reply = {ok, do_state_query(Spec, State), id(State)}, + {keep_state, State, [{reply, From, Reply}]}; receive_snapshot(EventType, Msg, State0) -> case handle_receive_snapshot(Msg, State0) of {receive_snapshot, State1, Effects} ->