Skip to content

Commit 0cd55eb

Browse files
committed
Stop master in receiving sync_start from another master after partition
1 parent 3906b1b commit 0cd55eb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/rabbit_amqqueue_process.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,13 @@ handle_cast(policy_changed, State = #q{q = #amqqueue{name = Name}}) ->
13001300
%% This also has the side effect of waking us up so we emit a
13011301
%% stats event - so event consumers see the changed policy.
13021302
{ok, Q} = rabbit_amqqueue:lookup(Name),
1303-
noreply(process_args_policy(State#q{q = Q})).
1303+
noreply(process_args_policy(State#q{q = Q}));
1304+
1305+
handle_cast({sync_start, _, _}, State = #q{q = #amqqueue{name = Name}}) ->
1306+
%% Only a slave should receive this, it means we are a duplicated master
1307+
rabbit_mirror_queue_misc:log_warning(
1308+
Name, "Stopping after receiving sync_start from another master", []),
1309+
stop(State).
13041310

13051311
handle_info({maybe_expire, Vsn}, State = #q{args_policy_version = Vsn}) ->
13061312
case is_unused(State) of

0 commit comments

Comments
 (0)