summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-01-29 15:22:38 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-01-29 15:22:38 +0000
commit9f753c642452a46dcfc968244b4e67a1db953f70 (patch)
tree24649ac18f732294d702b1c7c7e41bd51cb751fd
parentc5f449a5e3ab6c7c546b098cb8a4bd555a5f7221 (diff)
parent55d011e343b94a74d782d6b1075b271c3889de93 (diff)
downloadrabbitmq-server-9f753c642452a46dcfc968244b4e67a1db953f70.tar.gz
Merge default
-rw-r--r--src/rabbit.erl11
-rw-r--r--src/rabbit_mnesia.erl55
-rw-r--r--src/rabbit_variable_queue.erl3
3 files changed, 35 insertions, 34 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index c9cf7ea4..6b730fda 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -716,10 +716,13 @@ erts_version_check() ->
print_banner() ->
{ok, Product} = application:get_key(id),
{ok, Version} = application:get_key(vsn),
- io:format("~n## ## ~s ~s. ~s~n## ## ~s~n########## ~n",
- [Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE]),
- io:format("###### ## Logs: ~s~n########## ~s~n",
- [log_location(kernel), log_location(sasl)]).
+ io:format("~n## ## ~s ~s. ~s"
+ "~n## ## ~s"
+ "~n##########"
+ "~n###### ## Logs: ~s"
+ "~n########## ~s~n",
+ [Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE,
+ log_location(kernel), log_location(sasl)]).
log_banner() ->
{ok, Product} = application:get_key(id),
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index f295c47c..010fd9ac 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -41,10 +41,7 @@
]).
%% Used internally in rpc calls
--export([node_info/0,
- remove_node_if_mnesia_running/1,
- is_running_remote/0
- ]).
+-export([node_info/0, remove_node_if_mnesia_running/1]).
-include("rabbit.hrl").
@@ -278,16 +275,16 @@ forget_cluster_node(Node, RemoveWhenOffline) ->
true -> ok;
false -> e(not_a_cluster_node)
end,
- case {RemoveWhenOffline, mnesia:system_info(is_running)} of
- {true, no} -> remove_node_offline_node(Node);
- {true, yes} -> e(online_node_offline_flag);
- {false, no} -> e(offline_node_no_offline_flag);
- {false, yes} -> rabbit_misc:local_info_msg(
- "Removing node ~p from cluster~n", [Node]),
- case remove_node_if_mnesia_running(Node) of
- ok -> ok;
- {error, _} = Err -> throw(Err)
- end
+ case {RemoveWhenOffline, is_running()} of
+ {true, false} -> remove_node_offline_node(Node);
+ {true, true} -> e(online_node_offline_flag);
+ {false, false} -> e(offline_node_no_offline_flag);
+ {false, true} -> rabbit_misc:local_info_msg(
+ "Removing node ~p from cluster~n", [Node]),
+ case remove_node_if_mnesia_running(Node) of
+ ok -> ok;
+ {error, _} = Err -> throw(Err)
+ end
end.
remove_node_offline_node(Node) ->
@@ -334,11 +331,11 @@ status() ->
end,
[{nodes, (IfNonEmpty(disc, cluster_nodes(disc)) ++
IfNonEmpty(ram, cluster_nodes(ram)))}] ++
- case mnesia:system_info(is_running) of
- yes -> RunningNodes = cluster_nodes(running),
- [{running_nodes, cluster_nodes(running)},
- {partitions, mnesia_partitions(RunningNodes)}];
- no -> []
+ case is_running() of
+ true -> RunningNodes = cluster_nodes(running),
+ [{running_nodes, RunningNodes},
+ {partitions, mnesia_partitions(RunningNodes)}];
+ false -> []
end.
mnesia_partitions(Nodes) ->
@@ -346,6 +343,8 @@ mnesia_partitions(Nodes) ->
Nodes, rabbit_node_monitor, partitions, []),
[Reply || Reply = {_, R} <- Replies, R =/= []].
+is_running() -> mnesia:system_info(is_running) =:= yes.
+
is_clustered() -> AllNodes = cluster_nodes(all),
AllNodes =/= [] andalso AllNodes =/= [node()].
@@ -355,10 +354,10 @@ cluster_nodes(WhichNodes) -> cluster_status(WhichNodes).
%% the data from mnesia. Obviously it'll work only when mnesia is
%% running.
cluster_status_from_mnesia() ->
- case mnesia:system_info(is_running) of
- no ->
+ case is_running() of
+ false ->
{error, mnesia_not_running};
- yes ->
+ true ->
%% If the tables are not present, it means that
%% `init_db/3' hasn't been run yet. In other words, either
%% we are a virgin node or a restarted RAM node. In both
@@ -669,8 +668,10 @@ move_db() ->
ok.
remove_node_if_mnesia_running(Node) ->
- case mnesia:system_info(is_running) of
- yes ->
+ case is_running() of
+ false ->
+ {error, mnesia_not_running};
+ true ->
%% Deleting the the schema copy of the node will result in
%% the node being removed from the cluster, with that
%% change being propagated to all nodes
@@ -680,9 +681,7 @@ remove_node_if_mnesia_running(Node) ->
ok;
{aborted, Reason} ->
{error, {failed_to_remove_node, Node, Reason}}
- end;
- no ->
- {error, mnesia_not_running}
+ end
end.
leave_cluster() ->
@@ -732,8 +731,6 @@ change_extra_db_nodes(ClusterNodes0, CheckOtherNodes) ->
Nodes
end.
-is_running_remote() -> {mnesia:system_info(is_running) =:= yes, node()}.
-
check_consistency(OTP, Rabbit) ->
rabbit_misc:sequence_error(
[check_otp_consistency(OTP), check_rabbit_consistency(Rabbit)]).
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index ec267a32..18cab48b 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -830,7 +830,8 @@ status(#vqstate {
{avg_ack_ingress_rate, AvgAckIngressRate},
{avg_ack_egress_rate , AvgAckEgressRate} ].
-invoke(?MODULE, Fun, State) -> Fun(?MODULE, State).
+invoke(?MODULE, Fun, State) -> Fun(?MODULE, State);
+invoke( _, _, State) -> State.
is_duplicate(_Msg, State) -> {false, State}.