diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2015-12-14 20:06:53 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2015-12-14 20:06:53 +0300 |
| commit | 869640358a3e269704c0a6338f2014d9265a72c3 (patch) | |
| tree | f07bbc5965b6dcf9b5e20ee4dc838a2259e2e3dd /src | |
| parent | d90a5ead3dd848af51e2673e81c14bbb96b37c2b (diff) | |
| parent | de9f60af016198973ed163b1586b9838eb194228 (diff) | |
| download | rabbitmq-server-git-869640358a3e269704c0a6338f2014d9265a72c3.tar.gz | |
Merge branch 'master' into rabbitmq-server-255
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 11 | ||||
| -rw-r--r-- | src/rabbit_channel_sup.erl | 10 | ||||
| -rw-r--r-- | src/rabbit_channel_sup_sup.erl | 5 | ||||
| -rw-r--r-- | src/rabbit_connection_helper_sup.erl | 9 | ||||
| -rw-r--r-- | src/rabbit_connection_sup.erl | 9 | ||||
| -rw-r--r-- | src/rabbit_mnesia.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_priority_queue.erl | 6 | ||||
| -rw-r--r-- | src/rabbit_upgrade.erl | 9 | ||||
| -rw-r--r-- | src/tcp_listener.erl | 30 | ||||
| -rw-r--r-- | src/tcp_listener_sup.erl | 7 |
10 files changed, 94 insertions, 4 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 2b9237a15b..8d5dbb0260 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -285,12 +285,21 @@ hipe_compile() -> %% happens when RabbitMQ is stopped (just the %% application, not the entire node) and started %% again. - HM:module_info(native) =:= false], + already_hipe_compiled(HM)], case HipeModules of [] -> {ok, already_compiled}; _ -> do_hipe_compile(HipeModules) end. +already_hipe_compiled(Mod) -> + try + %% OTP 18.x or later + Mod:module_info(native) =:= false + %% OTP prior to 18.x + catch error:badarg -> + code:is_module_native(Mod) =:= false + end. + do_hipe_compile(HipeModules) -> Count = length(HipeModules), io:format("~nHiPE compiling: |~s|~n |", diff --git a/src/rabbit_channel_sup.erl b/src/rabbit_channel_sup.erl index e8f45f7305..66f6a81697 100644 --- a/src/rabbit_channel_sup.erl +++ b/src/rabbit_channel_sup.erl @@ -16,6 +16,16 @@ -module(rabbit_channel_sup). +%% Supervises processes that implement AMQP 0-9-1 channels: +%% +%% * Channel process itself +%% * Network writer (for network connections) +%% * Limiter (handles channel QoS and flow control) +%% +%% Every rabbit_channel_sup is supervised by rabbit_channel_sup_sup. +%% +%% See also rabbit_channel, rabbit_writer, rabbit_limiter. + -behaviour(supervisor2). -export([start_link/1]). diff --git a/src/rabbit_channel_sup_sup.erl b/src/rabbit_channel_sup_sup.erl index 2be2af91a7..9cfbb78a2b 100644 --- a/src/rabbit_channel_sup_sup.erl +++ b/src/rabbit_channel_sup_sup.erl @@ -16,6 +16,11 @@ -module(rabbit_channel_sup_sup). +%% Supervisor for AMQP 0-9-1 channels. Every AMQP 0-9-1 connection has +%% one of these. +%% +%% See also rabbit_channel_sup, rabbit_connection_helper_sup, rabbit_reader. + -behaviour(supervisor2). -export([start_link/0, start_channel/2]). diff --git a/src/rabbit_connection_helper_sup.erl b/src/rabbit_connection_helper_sup.erl index d3c05ee416..d6492331ef 100644 --- a/src/rabbit_connection_helper_sup.erl +++ b/src/rabbit_connection_helper_sup.erl @@ -16,6 +16,15 @@ -module(rabbit_connection_helper_sup). +%% Supervises auxiliary processes of AMQP 0-9-1 connections: +%% +%% * Channel supervisor +%% * Heartbeat receiver +%% * Heartbeat sender +%% * Exclusive queue collector +%% +%% See also rabbit_heartbeat, rabbit_channel_sup_sup, rabbit_queue_collector. + -behaviour(supervisor2). -export([start_link/0]). diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl index a64a2217da..09cddb0247 100644 --- a/src/rabbit_connection_sup.erl +++ b/src/rabbit_connection_sup.erl @@ -16,6 +16,15 @@ -module(rabbit_connection_sup). +%% Supervisor for a (network) AMQP 0-9-1 client connection. +%% +%% Supervises +%% +%% * rabbit_reader +%% * Auxiliary process supervisor +%% +%% See also rabbit_reader, rabbit_connection_helper_sup. + -behaviour(supervisor2). -behaviour(ranch_protocol). diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 974a910d49..9ef37d3c48 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -102,7 +102,7 @@ init() -> ensure_mnesia_dir(), case is_virgin_node() of true -> - rabbit_log:info("Database directory at ~s is empty. Initialising from scratch... ~n", + rabbit_log:info("Database directory at ~s is empty. Initialising from scratch...~n", [dir()]), init_from_config(); false -> diff --git a/src/rabbit_priority_queue.erl b/src/rabbit_priority_queue.erl index 7439b5bc32..b58a8c535e 100644 --- a/src/rabbit_priority_queue.erl +++ b/src/rabbit_priority_queue.erl @@ -647,6 +647,12 @@ combine_status(P, New, Old) -> cse(infinity, _) -> infinity; cse(_, infinity) -> infinity; +%% queue modes +cse(_, default) -> default; +cse(default, _) -> default; +cse(_, lazy) -> lazy; +cse(lazy, _) -> lazy; +%% numerical stats cse(A, B) when is_number(A) -> A + B; cse({delta, _, _, _}, _) -> {delta, todo, todo, todo}; cse(A, B) -> exit({A, B}). diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl index daf39b8acc..0a85ef3e7d 100644 --- a/src/rabbit_upgrade.erl +++ b/src/rabbit_upgrade.erl @@ -100,7 +100,12 @@ ensure_backup_taken() -> false -> ok = take_backup(); _ -> ok end; - true -> throw({error, previous_upgrade_failed}) + true -> + error("Found lock file at ~s. + Either previous upgrade is in progress or has failed. + Database backup path: ~s", + [lock_filename(), backup_dir()]), + throw({error, previous_upgrade_failed}) end. take_backup() -> @@ -108,7 +113,7 @@ take_backup() -> case rabbit_mnesia:copy_db(BackupDir) of ok -> info("upgrades: Mnesia dir backed up to ~p~n", [BackupDir]); - {error, E} -> throw({could_not_back_up_mnesia_dir, E}) + {error, E} -> throw({could_not_back_up_mnesia_dir, E, BackupDir}) end. ensure_backup_removed() -> diff --git a/src/tcp_listener.erl b/src/tcp_listener.erl index 571622c80d..dcb607ccdd 100644 --- a/src/tcp_listener.erl +++ b/src/tcp_listener.erl @@ -16,6 +16,36 @@ -module(tcp_listener). +%% Represents a running TCP listener (a process that listens for inbound +%% TCP or TLS connections). Every protocol supported typically has one +%% or two listeners, plain TCP and (optionally) TLS, but there can +%% be more, e.g. when multiple network interfaces are involved. +%% +%% A listener has 6 properties (is a tuple of 6): +%% +%% * IP address +%% * Port +%% * Node +%% * Label (human-friendly name, e.g. AMQP 0-9-1) +%% * Startup callback +%% * Shutdown callback +%% +%% Listeners use Ranch in embedded mode to accept and "bridge" client +%% connections with protocol entry points such as rabbit_reader. +%% +%% Listeners are tracked in a Mnesia table so that they can be +%% +%% * Shut down +%% * Listed (e.g. in the management UI) +%% +%% Every tcp_listener process has callbacks that are executed on start +%% and termination. Those must take care of listener registration +%% among other things. +%% +%% Listeners are supervised by tcp_listener_sup (one supervisor per protocol). +%% +%% See also rabbit_networking and tcp_listener_sup. + -behaviour(gen_server). -export([start_link/5]). diff --git a/src/tcp_listener_sup.erl b/src/tcp_listener_sup.erl index 54da154d8d..4df8a45ac1 100644 --- a/src/tcp_listener_sup.erl +++ b/src/tcp_listener_sup.erl @@ -16,6 +16,13 @@ -module(tcp_listener_sup). +%% Supervises TCP listeners. There is a separate supervisor for every +%% protocol. In case of AMQP 0-9-1, it resides under rabbit_sup. Plugins +%% that provide protocol support (e.g. STOMP) have an instance of this supervisor in their +%% app supervision tree. +%% +%% See also rabbit_networking and tcp_listener. + -behaviour(supervisor). -export([start_link/9, start_link/10]). |
