Skip to content

Commit

Permalink
Avoid growing notifications map during recovery
Browse files Browse the repository at this point in the history
As this could negatively affect recovery performance of long logs.
  • Loading branch information
kjnilsson committed Jun 27, 2023
1 parent 9e5d437 commit 8b767b2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/ra_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,11 @@ recover(#{cfg := #cfg{log_id = LogId,
{#{log := Log0,
cfg := #cfg{effective_machine_version = EffMacVerAfter}} = State, _} =
apply_to(CommitIndex,
fun(E, S) ->
%% Clear out the effects to avoid building
%% up a long list of effects than then
%% we throw away
%% on server startup (queue recovery)
setelement(5, apply_with(E, S), [])
fun(E, S0) ->
%% Clear out the effects and notifies map
%% to avoid memory explosion
{Mod, LastAppl, S, MacSt, _E, _N, LastTs} = apply_with(E, S0),
{Mod, LastAppl, S, MacSt, [], #{}, LastTs}
end,
State0, []),
After = erlang:system_time(millisecond),
Expand Down

0 comments on commit 8b767b2

Please sign in to comment.