summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2015-02-02 12:00:49 +0000
committerSimon MacMullen <simon@rabbitmq.com>2015-02-02 12:00:49 +0000
commite11a6d2daf2c0e66dda61af3cf34b3e4217f1b84 (patch)
tree80593347e53414a1596cb522614f0c7dc99564ca
parentc364864a29592215ca331ffd7db19b660ddeeccf (diff)
parent797bf891f92ea7968c21c71d78ce7132519f2fb7 (diff)
downloadrabbitmq-server-git-e11a6d2daf2c0e66dda61af3cf34b3e4217f1b84.tar.gz
Merge bug26467
-rw-r--r--.hgignore2
-rw-r--r--src/rabbit_limiter.erl2
-rw-r--r--src/rabbit_mirror_queue_coordinator.erl11
-rw-r--r--src/rabbit_mirror_queue_slave.erl3
4 files changed, 16 insertions, 2 deletions
diff --git a/.hgignore b/.hgignore
index 05850b030e..a427f6120f 100644
--- a/.hgignore
+++ b/.hgignore
@@ -20,6 +20,8 @@ syntax: regexp
^ebin/rabbit\.(app|rel|boot|script)$
^plugins/
^priv/plugins/
+^#
+^\.#
^packaging/RPMS/Fedora/(BUILD|RPMS|SOURCES|SPECS|SRPMS)$
^packaging/debs/Debian/rabbitmq-server_.*\.(dsc|(diff|tar)\.gz|deb|changes)$
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl
index f32a187d32..82f4275a3e 100644
--- a/src/rabbit_limiter.erl
+++ b/src/rabbit_limiter.erl
@@ -22,7 +22,7 @@
%%
%% Each channel has an associated limiter process, created with
%% start_link/1, which it passes to queues on consumer creation with
-%% rabbit_amqqueue:basic_consume/9, and rabbit_amqqueue:basic_get/4.
+%% rabbit_amqqueue:basic_consume/10, and rabbit_amqqueue:basic_get/4.
%% The latter isn't strictly necessary, since basic.get is not
%% subject to limiting, but it means that whenever a queue knows about
%% a channel, it also knows about its limiter, which is less fiddly.
diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl
index a8f5e74899..38273e1c28 100644
--- a/src/rabbit_mirror_queue_coordinator.erl
+++ b/src/rabbit_mirror_queue_coordinator.erl
@@ -19,7 +19,7 @@
-export([start_link/4, get_gm/1, ensure_monitoring/2]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
- code_change/3]).
+ code_change/3, handle_pre_hibernate/1]).
-export([joined/2, members_changed/3, handle_msg/3, handle_terminate/2]).
@@ -390,6 +390,15 @@ terminate(_Reason, #state{}) ->
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
+handle_pre_hibernate(State = #state { gm = GM }) ->
+ %% Since GM notifications of deaths are lazy we might not get a
+ %% timely notification of slave death if policy changes when
+ %% everything is idle. So cause some activity just before we
+ %% sleep. This won't cause us to go into perpetual motion as the
+ %% heartbeat does not wake up coordinator or slaves.
+ gm:broadcast(GM, hibernate_heartbeat),
+ {hibernate, State}.
+
%% ---------------------------------------------------------------------------
%% GM
%% ---------------------------------------------------------------------------
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index 45167706b4..96515f5c35 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -428,6 +428,9 @@ members_changed([ SPid], _Births, Deaths) ->
{promote, CPid} -> {become, rabbit_mirror_queue_coordinator, [CPid]}
end.
+handle_msg([_SPid], _From, hibernate_heartbeat) ->
+ %% See rabbit_mirror_queue_coordinator:handle_pre_hibernate/1
+ ok;
handle_msg([_SPid], _From, request_depth) ->
%% This is only of value to the master
ok;