@@ -259,11 +259,16 @@ start_cluster(Q) ->
259259 NewQ1 = amqqueue :set_type_state (NewQ0 ,
260260 #{nodes => [LeaderNode | FollowerNodes ]}),
261261
262- rabbit_log :debug (" Will start up to ~w replicas for quorum ~ts with leader on node '~ts '" ,
263- [QuorumSize , rabbit_misc :rs (QName ), LeaderNode ]),
262+ Versions = [V || {ok , V } <- erpc :multicall (FollowerNodes ,
263+ rabbit_fifo , version , [])],
264+ MinVersion = lists :min ([rabbit_fifo :version () | Versions ]),
265+
266+ rabbit_log :debug (" Will start up to ~w replicas for quorum queue ~ts with "
267+ " leader on node '~ts ', initial machine version ~b " ,
268+ [QuorumSize , rabbit_misc :rs (QName ), LeaderNode , MinVersion ]),
264269 case rabbit_amqqueue :internal_declare (NewQ1 , false ) of
265270 {created , NewQ } ->
266- RaConfs = [make_ra_conf (NewQ , ServerId )
271+ RaConfs = [make_ra_conf (NewQ , ServerId , voter , MinVersion )
267272 || ServerId <- members (NewQ )],
268273
269274 % % khepri projections on remote nodes are eventually consistent
@@ -544,6 +549,10 @@ spawn_deleter(QName) ->
544549 delete (Q , false , false , <<" expired" >>)
545550 end ).
546551
552+ spawn_notify_decorators (QName , startup = Fun , Args ) ->
553+ spawn (fun () ->
554+ notify_decorators (QName , Fun , Args )
555+ end );
547556spawn_notify_decorators (QName , Fun , Args ) ->
548557 % % run in ra process for now
549558 catch notify_decorators (QName , Fun , Args ).
@@ -860,7 +869,7 @@ delete(Q, _IfUnused, _IfEmpty, ActingUser) when ?amqqueue_is_quorum(Q) ->
860869 notify_decorators (QName , shutdown ),
861870 case delete_queue_data (Q , ActingUser ) of
862871 ok ->
863- _ = erpc : call (LeaderNode , rabbit_core_metrics , queue_deleted , [QName ],
872+ _ = erpc_call (LeaderNode , rabbit_core_metrics , queue_deleted , [QName ],
864873 ? RPC_TIMEOUT ),
865874 {ok , ReadyMsgs };
866875 {error , timeout } = Err ->
@@ -1339,7 +1348,9 @@ add_member(Q, Node, Membership, Timeout) when ?amqqueue_is_quorum(Q) ->
13391348 % % TODO parallel calls might crash this, or add a duplicate in quorum_nodes
13401349 ServerId = {RaName , Node },
13411350 Members = members (Q ),
1342- Conf = make_ra_conf (Q , ServerId , Membership ),
1351+
1352+ MachineVersion = erpc_call (Node , rabbit_fifo , version , [], infinity ),
1353+ Conf = make_ra_conf (Q , ServerId , Membership , MachineVersion ),
13431354 case ra :start_server (? RA_SYSTEM , Conf ) of
13441355 ok ->
13451356 ServerIdSpec =
@@ -1383,8 +1394,9 @@ add_member(Q, Node, Membership, Timeout) when ?amqqueue_is_quorum(Q) ->
13831394 E
13841395 end ;
13851396 E ->
1386- rabbit_log :warning (" Could not add a replica of quorum ~ts on node ~ts : ~p " , [rabbit_misc :rs (QName ), Node , E ]),
1387- E
1397+ rabbit_log :warning (" Could not add a replica of quorum ~ts on node ~ts : ~p " ,
1398+ [rabbit_misc :rs (QName ), Node , E ]),
1399+ E
13881400 end .
13891401
13901402delete_member (VHost , Name , Node ) ->
@@ -1912,9 +1924,10 @@ format_ra_event(ServerId, Evt, QRef) ->
19121924 {'$gen_cast' , {queue_event , QRef , {ServerId , Evt }}}.
19131925
19141926make_ra_conf (Q , ServerId ) ->
1915- make_ra_conf (Q , ServerId , voter ).
1927+ make_ra_conf (Q , ServerId , voter , rabbit_fifo : version () ).
19161928
1917- make_ra_conf (Q , ServerId , Membership ) ->
1929+ make_ra_conf (Q , ServerId , Membership , MacVersion )
1930+ when is_integer (MacVersion ) ->
19181931 TickTimeout = application :get_env (rabbit , quorum_tick_interval ,
19191932 ? TICK_INTERVAL ),
19201933 SnapshotInterval = application :get_env (rabbit , quorum_snapshot_interval ,
@@ -1923,10 +1936,12 @@ make_ra_conf(Q, ServerId, Membership) ->
19231936 quorum_min_checkpoint_interval ,
19241937 ? MIN_CHECKPOINT_INTERVAL ),
19251938 make_ra_conf (Q , ServerId , TickTimeout ,
1926- SnapshotInterval , CheckpointInterval , Membership ).
1939+ SnapshotInterval , CheckpointInterval ,
1940+ Membership , MacVersion ).
19271941
19281942make_ra_conf (Q , ServerId , TickTimeout ,
1929- SnapshotInterval , CheckpointInterval , Membership ) ->
1943+ SnapshotInterval , CheckpointInterval ,
1944+ Membership , MacVersion ) ->
19301945 QName = amqqueue :get_name (Q ),
19311946 RaMachine = ra_machine (Q ),
19321947 [{ClusterName , _ } | _ ] = Members = members (Q ),
@@ -1947,6 +1962,7 @@ make_ra_conf(Q, ServerId, TickTimeout,
19471962 log_init_args => LogCfg ,
19481963 tick_timeout => TickTimeout ,
19491964 machine => RaMachine ,
1965+ initial_machine_version => MacVersion ,
19501966 ra_event_formatter => Formatter }).
19511967
19521968make_mutable_config (Q ) ->
0 commit comments