Skip to content

Commit

Permalink
Merge pull request #806 from basho/develop-3.0-lastgaspring
Browse files Browse the repository at this point in the history
Last gasp check
  • Loading branch information
martinsumner authored Nov 18, 2019
2 parents 8fcc415 + db76bba commit 1960254
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions src/riak_repl_ring_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,31 @@ handle_event({ring_update, Ring}, State=#state{ring=Ring}) ->
{ok, State};
handle_event({ring_update, NewRing}, State=#state{ring=OldRing}) ->
%% Ring has changed.
FinalRing = init_repl_config(OldRing, NewRing),
update_leader(FinalRing),
_ = rt_update_events(FinalRing),
_ = pg_update_events(FinalRing),
riak_repl_listener_sup:ensure_listeners(FinalRing),
case riak_repl_leader:is_leader() of
case riak_core_ring:check_lastgasp(NewRing) of
true ->
riak_repl_leader:ensure_sites();
_ ->
ok
end,
%% Force the cluster manager to connect to the clusters when it
%% learns about an event *after* an election has occurred.
case riak_repl2_leader:is_leader() of
true ->
riak_core_cluster_mgr:connect_to_clusters();
_ ->
ok
end,
{ok, State#state{ring=FinalRing}};
{ok, State};
false ->
FinalRing = init_repl_config(OldRing, NewRing),
update_leader(FinalRing),
_ = rt_update_events(FinalRing),
_ = pg_update_events(FinalRing),
riak_repl_listener_sup:ensure_listeners(FinalRing),
case riak_repl_leader:is_leader() of
true ->
riak_repl_leader:ensure_sites();
_ ->
ok
end,
%% Force the cluster manager to connect to the clusters when it
%% learns about an event *after* an election has occurred.
case riak_repl2_leader:is_leader() of
true ->
riak_core_cluster_mgr:connect_to_clusters();
_ ->
ok
end,
{ok, State#state{ring=FinalRing}}
end;
handle_event(_Event, State) ->
{ok, State}.

Expand Down

0 comments on commit 1960254

Please sign in to comment.