diff options
| author | Daniil Fedotov <dfedotov@pivotal.io> | 2017-07-31 11:23:22 +0100 |
|---|---|---|
| committer | Daniil Fedotov <dfedotov@pivotal.io> | 2017-07-31 16:48:21 +0100 |
| commit | d39d7e09b2deca27a774da18540f07afb79ded01 (patch) | |
| tree | 2eaf0b68dfa5928e9a21ca83cee8bd861f566805 /src | |
| parent | 98566cdd9c22f556c732b8c91059ca44f5a5ed34 (diff) | |
| download | rabbitmq-server-git-d39d7e09b2deca27a774da18540f07afb79ded01.tar.gz | |
Start slave queues after vhost recover, instead of node start.
Vhost supervisors can crash and restart without crashing the
node, so the slave queues on this vhosts should be started
after the vhsot recovery instead of node boot process.
Fixes #1314
[#149484151]
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 6 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_misc.erl | 11 | ||||
| -rw-r--r-- | src/rabbit_vhost.erl | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index b166e079f4..0a0eb6b71a 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -168,12 +168,6 @@ {requires, recovery}, {enables, routing_ready}]}). --rabbit_boot_step({mirrored_queues, - [{description, "adding mirrors to queues"}, - {mfa, {rabbit_mirror_queue_misc, on_node_up, []}}, - {requires, recovery}, - {enables, routing_ready}]}). - -rabbit_boot_step({routing_ready, [{description, "message delivery logic ready"}, {requires, core_initialized}]}). diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index 59522da4a9..dab98c740e 100644 --- a/src/rabbit_mirror_queue_misc.erl +++ b/src/rabbit_mirror_queue_misc.erl @@ -17,7 +17,7 @@ -module(rabbit_mirror_queue_misc). -behaviour(rabbit_policy_validator). --export([remove_from_queue/3, on_node_up/0, add_mirrors/3, +-export([remove_from_queue/3, on_vhost_up/1, add_mirrors/3, report_deaths/4, store_updated_slaves/1, initial_queue_node/2, suggested_queue_nodes/1, is_mirrored/1, update_mirrors/2, update_mirrors/1, validate_policy/1, @@ -53,7 +53,6 @@ -spec remove_from_queue (rabbit_amqqueue:name(), pid(), [pid()]) -> {'ok', pid(), [pid()], [node()]} | {'error', 'not_found'}. --spec on_node_up() -> 'ok'. -spec add_mirrors(rabbit_amqqueue:name(), [node()], 'sync' | 'async') -> 'ok'. -spec store_updated_slaves(rabbit_types:amqqueue()) -> @@ -167,12 +166,16 @@ slaves_to_start_on_failure(Q, DeadGMPids) -> {_, NewNodes} = suggested_queue_nodes(Q, ClusterNodes), NewNodes -- OldNodes. -on_node_up() -> +on_vhost_up(VHost) -> QNames = rabbit_misc:execute_mnesia_transaction( fun () -> mnesia:foldl( - fun (Q = #amqqueue{name = QName, + fun + (#amqqueue{name = #resource{virtual_host = OtherVhost}}, + QNames0) when OtherVhost =/= VHost -> + QNames0; + (Q = #amqqueue{name = QName, pid = Pid, slave_pids = SPids}, QNames0) -> %% We don't want to pass in the whole diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl index 30557fc7be..c6ee2bf08f 100644 --- a/src/rabbit_vhost.erl +++ b/src/rabbit_vhost.erl @@ -71,6 +71,8 @@ recover(VHost) -> ok = rabbit_binding:recover(rabbit_exchange:recover(VHost), [QName || #amqqueue{name = QName} <- Qs]), ok = rabbit_amqqueue:start(Qs), + %% Start slaves. + ok = rabbit_mirror_queue_misc:on_vhost_up(VHost), ok. %%---------------------------------------------------------------------------- |
