diff options
author | Tim Watson <watson.timothy@gmail.com> | 2012-11-13 11:46:59 +0000 |
---|---|---|
committer | Tim Watson <watson.timothy@gmail.com> | 2012-11-13 11:46:59 +0000 |
commit | c6e0ca5ed0c5a0c75bf004d316bf87a15053bcbc (patch) | |
tree | ac51e6a9a4fc482da2e7504bfe7bd3273be57911 | |
parent | e6098fa2bc32b10883c79fe1772fe9a4c24c1ee1 (diff) | |
download | rabbitmq-server-c6e0ca5ed0c5a0c75bf004d316bf87a15053bcbc.tar.gz |
roll back to (almost) default - keeping the extra error information when
corrupt cluster status files are found
-rw-r--r-- | src/rabbit.erl | 8 | ||||
-rw-r--r-- | src/rabbit_node_monitor.erl | 33 |
2 files changed, 9 insertions, 32 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index f3d31b22..ef9f5f56 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -174,16 +174,10 @@ [{mfa, {rabbit_networking, boot, []}}, {requires, log_relay}]}). --rabbit_boot_step({app_running, - [{description, "cluster membership"}, - {mfa, {rabbit_sup, start_restartable_child, - [rabbit_app_marker]}}, - {requires, networking}]}). - -rabbit_boot_step({notify_cluster, [{description, "notify cluster nodes"}, {mfa, {rabbit_node_monitor, notify_node_up, []}}, - {requires, app_running}]}). + {requires, networking}]}). %%--------------------------------------------------------------------------- diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index b89d4dc4..97feb2f2 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -112,7 +112,7 @@ prepare_cluster_status_files() -> true -> ThisNode; false -> [] end, - write_cluster_status({AllNodes2, DiscNodes, RunningNodes2}). + ok = write_cluster_status({AllNodes2, DiscNodes, RunningNodes2}). write_cluster_status({All, Disc, Running}) -> ClusterStatusFN = cluster_status_filename(), @@ -199,7 +199,7 @@ handle_call(_Request, _From, State) -> %% mnesia propagation. handle_cast({node_up, Node, NodeType}, State = #state{monitors = Monitors}) -> - case pmon:is_monitored({rabbit_running, Node}, Monitors) of + case pmon:is_monitored({rabbit, Node}, Monitors) of true -> {noreply, State}; false -> rabbit_log:info("rabbit on node ~p up~n", [Node]), {AllNodes, DiscNodes, RunningNodes} = read_cluster_status(), @@ -210,12 +210,8 @@ handle_cast({node_up, Node, NodeType}, end, add_node(Node, RunningNodes)}), ok = handle_live_rabbit(Node), - State1 = mon({rabbit_running, Node}, State), - State2 = case pmon:is_monitored({rabbit, Node}, Monitors) of - true -> State1; - false -> mon({rabbit, Node}, State1) - end, - {noreply, State2} + {noreply, State#state{ + monitors = pmon:monitor({rabbit, Node}, Monitors)}} end; handle_cast({joined_cluster, Node, NodeType}, State) -> {AllNodes, DiscNodes, RunningNodes} = read_cluster_status(), @@ -234,20 +230,13 @@ handle_cast({left_cluster, Node}, State) -> handle_cast(_Msg, State) -> {noreply, State}. -handle_info({'DOWN', _MRef, process, {rabbit_running, Node}, _Reason}, State) -> - %% The node has started to stop, remove it from the cluster status - %% file. We want to do this "early" to stand a better chance of - %% recording anything when all the nodes are shut down - %% simultaneously. +handle_info({'DOWN', _MRef, process, {rabbit, Node}, _Reason}, + State = #state{monitors = Monitors}) -> + rabbit_log:info("rabbit on node ~p down~n", [Node]), {AllNodes, DiscNodes, RunningNodes} = read_cluster_status(), write_cluster_status({AllNodes, DiscNodes, del_node(Node, RunningNodes)}), - {noreply, unmon({rabbit_running, Node}, State)}; - -handle_info({'DOWN', _MRef, process, {rabbit, Node}, _Reason}, State) -> - %% The node has finished stopping (rabbit anyway), treat it as dead. - rabbit_log:info("rabbit on node ~p down~n", [Node]), ok = handle_dead_rabbit(Node), - {noreply, unmon({rabbit, Node}, State)}; + {noreply, State#state{monitors = pmon:erase({rabbit, Node}, Monitors)}}; handle_info({mnesia_system_event, {inconsistent_database, running_partitioned_network, Node}}, @@ -305,9 +294,3 @@ legacy_should_be_disc_node(DiscNodes) -> add_node(Node, Nodes) -> lists:usort([Node | Nodes]). del_node(Node, Nodes) -> Nodes -- [Node]. - -mon(Item, State = #state{monitors = Monitors}) -> - State#state{monitors = pmon:monitor(Item, Monitors)}. - -unmon(Item, State = #state{monitors = Monitors}) -> - State#state{monitors = pmon:erase(Item, Monitors)}. |