Skip to content

Commit b0a706d

Browse files
committed
Convergence check loop minimal fix
This patch fixes the convergence check busy loop problem by letting the check time out rather than aborting it and restarting it immediately. Also, server error replies like LOADING are skipped so we don't crash on these in the convergence check. This is a minimal rewrite of the convergence check fix: #146 Signed-off-by: Viktor Söderqvist <[email protected]>
1 parent 7d8ef7f commit b0a706d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/ered_cluster.erl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,8 @@ handle_info({converged, Result, FromAddr, Version},
353353
{noreply, update_cluster_state(State1)}
354354
end;
355355
false ->
356-
cancel_convergence_check(State),
357-
State1 = State#st{convergence_check = nok},
358-
{noreply, update_cluster_state(State1)}
356+
%% Ignore and let the convergence check time out.
357+
{noreply, State}
359358
end;
360359

361360
handle_info({timeout, TimerRef, {time_to_update_slots,PreferredNodes}}, State) ->
@@ -374,7 +373,7 @@ handle_info({timeout, TimerRef, start_convergence_check},
374373
{noreply, start_convergence_check(State)};
375374

376375
handle_info({timeout, TimerRef, cancel_convergence_check},
377-
State = #st{convergence_check = {scheduled, TimerRef}}) ->
376+
State = #st{convergence_check = {ongoing, _, TimerRef}}) ->
378377
cancel_convergence_check(State),
379378
State1 = State#st{convergence_check = nok},
380379
{noreply, update_cluster_state(State1)};
@@ -547,7 +546,7 @@ start_convergence_check(State) ->
547546
Expected = ered_lib:slotmap_master_slots(State#st.slot_map),
548547
lists:foreach(fun (Addr) ->
549548
ClientPid = maps:get(Addr, State#st.nodes),
550-
Cb = fun ({ok, Reply}) ->
549+
Cb = fun ({ok, Reply = [_|_]}) ->
551550
IsMatch = ered_lib:slotmap_master_slots(Reply) =:= Expected,
552551
ClusterPid ! {converged, IsMatch, Addr, Version};
553552
(_) ->

0 commit comments

Comments
 (0)