diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-03-05 16:49:48 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-03-05 16:49:48 +0100 |
| commit | 60821729247e6fe6ac66fdeec88a7d188de0d6e9 (patch) | |
| tree | e4869481e16485f8f0de0f341bb620728a25c437 /src | |
| parent | 3efe9390419c3a842b74423387a621897fc0b820 (diff) | |
| download | rabbitmq-server-git-60821729247e6fe6ac66fdeec88a7d188de0d6e9.tar.gz | |
Partial partition: Don't act if pause_if_all_down is about to pause
At least, this fixes the following crash, when the partial partition
detection tries to close the connection while RabbitMQ is stopping:
** Reason for termination ==
** {timeout,{gen_server,call,
[application_controller,
{set_env,kernel,dist_auto_connect,never}]}}
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_node_monitor.erl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 0eb0882316..2b5a911c19 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -446,12 +446,22 @@ handle_cast({partial_partition, NotReallyDown, Proxy, MyGUID}, ArgsBase), await_cluster_recovery(fun all_nodes_up/0), {noreply, State}; + {ok, {pause_if_all_down, PreferredNodes, _}} -> + case in_preferred_partition(PreferredNodes) of + true -> rabbit_log:error( + FmtBase ++ "We will therefore intentionally " + "disconnect from ~s~n", ArgsBase ++ [Proxy]), + upgrade_to_full_partition(Proxy); + false -> rabbit_log:info( + FmtBase ++ "We are about to pause, no need " + "for further actions~n", ArgsBase) + end, + {noreply, State}; {ok, _} -> rabbit_log:error( FmtBase ++ "We will therefore intentionally disconnect from ~s~n", ArgsBase ++ [Proxy]), - cast(Proxy, {partial_partition_disconnect, node()}), - disconnect(Proxy), + upgrade_to_full_partition(Proxy), {noreply, State} end; @@ -762,6 +772,10 @@ del_node(Node, Nodes) -> Nodes -- [Node]. cast(Node, Msg) -> gen_server:cast({?SERVER, Node}, Msg). +upgrade_to_full_partition(Proxy) -> + cast(Proxy, {partial_partition_disconnect, node()}), + disconnect(Proxy). + %% When we call this, it's because we want to force Mnesia to detect a %% partition. But if we just disconnect_node/1 then Mnesia won't %% detect a very short partition. So we want to force a slightly |
