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