@@ -95,7 +95,8 @@ groups() ->
9595 single_active_consumer_priority ,
9696 force_shrink_member_to_current_member ,
9797 force_all_queues_shrink_member_to_current_member ,
98- force_vhost_queues_shrink_member_to_current_member
98+ force_vhost_queues_shrink_member_to_current_member ,
99+ gh_12635
99100 ]
100101 ++ all_tests ()},
101102 {cluster_size_5 , [], [start_queue ,
@@ -1302,6 +1303,67 @@ force_vhost_queues_shrink_member_to_current_member(Config) ->
13021303 ? assertEqual (3 , length (Nodes0 ))
13031304 end || Q <- QQs , VHost <- VHosts ].
13041305
1306+ gh_12635 (Config ) ->
1307+ % https://github.com/rabbitmq/rabbitmq-server/issues/12635
1308+ [Server0 , _Server1 , Server2 ] =
1309+ rabbit_ct_broker_helpers :get_node_configs (Config , nodename ),
1310+
1311+ ok = rabbit_ct_broker_helpers :rpc (Config , 0 , application , set_env ,
1312+ [rabbit , quorum_min_checkpoint_interval , 1 ]),
1313+
1314+ Ch0 = rabbit_ct_client_helpers :open_channel (Config , Server0 ),
1315+ # 'confirm.select_ok' {} = amqp_channel :call (Ch0 , # 'confirm.select' {}),
1316+ QQ = ? config (queue_name , Config ),
1317+ RaName = ra_name (QQ ),
1318+ ? assertEqual ({'queue.declare_ok' , QQ , 0 , 0 },
1319+ declare (Ch0 , QQ , [{<<" x-queue-type" >>, longstr , <<" quorum" >>}])),
1320+
1321+ % % stop member to simulate slow or down member
1322+ ok = rpc :call (Server2 , ra , stop_server , [quorum_queues , {RaName , Server2 }]),
1323+
1324+ publish_confirm (Ch0 , QQ ),
1325+ publish_confirm (Ch0 , QQ ),
1326+
1327+ % % force a checkpoint on leader
1328+ ok = rpc :call (Server0 , ra , cast_aux_command , [{RaName , Server0 }, force_checkpoint ]),
1329+ rabbit_ct_helpers :await_condition (
1330+ fun () ->
1331+ {ok , #{log := Log }, _ } = rpc :call (Server0 , ra , member_overview , [{RaName , Server0 }]),
1332+ undefined =/= maps :get (latest_checkpoint_index , Log )
1333+ end ),
1334+
1335+ % % publish 1 more message
1336+ publish_confirm (Ch0 , QQ ),
1337+
1338+ Ch2 = rabbit_ct_client_helpers :open_channel (Config , Server2 ),
1339+ % % subscribe then cancel, this will assign the messages against the consumer
1340+ % % but as the member is down they will not be delivered
1341+ qos (Ch2 , 100 , false ),
1342+ subscribe (Ch2 , QQ , false ),
1343+ rabbit_ct_client_helpers :close_channel (Ch2 ),
1344+ flush (100 ),
1345+ % % purge
1346+ # 'queue.purge_ok' {} = amqp_channel :call (Ch0 , # 'queue.purge' {queue = QQ }),
1347+
1348+ rabbit_ct_helpers :await_condition (
1349+ fun () ->
1350+ {ok , #{log := Log }, _ } = rpc :call (Server0 , ra , member_overview , [{RaName , Server0 }]),
1351+ undefined =/= maps :get (snapshot_index , Log )
1352+ end ),
1353+ % % restart the down member
1354+ ok = rpc :call (Server2 , ra , restart_server , [quorum_queues , {RaName , Server2 }]),
1355+ Pid2 = rpc :call (Server2 , erlang , whereis , [RaName ]),
1356+ ? assert (is_pid (Pid2 )),
1357+ Ref = erlang :monitor (process , Pid2 ),
1358+ receive
1359+ {'DOWN' ,Ref , process ,_ , _ } ->
1360+ ct :fail (" unexpected DOWN" )
1361+ after 500 ->
1362+ ok
1363+ end ,
1364+ flush (1 ),
1365+ ok .
1366+
13051367priority_queue_fifo (Config ) ->
13061368 % % testing: if hi priority messages are published before lo priority
13071369 % % messages they are always consumed first (fifo)
0 commit comments