@@ -1428,20 +1428,20 @@ do_add_member(Q0, Node, Membership, Timeout)
1428
1428
% % TODO parallel calls might crash this, or add a duplicate in quorum_nodes
1429
1429
ServerId = {RaName , Node },
1430
1430
Members = members (Q0 ),
1431
- QTypeState0 = #{nodes := _Nodes } = amqqueue :get_type_state (Q0 ),
1431
+ QTypeState0 = #{nodes := Nodes } = amqqueue :get_type_state (Q0 ),
1432
1432
NewRaUId = ra :new_uid (ra_lib :to_binary (RaName )),
1433
- % QTypeState = case Nodes of
1434
- % L when is_list(L) ->
1435
- % %% Queue is not aware of node to uid mapping, just add the new node
1436
- % QTypeState0#{nodes := lists:usort([Node | Nodes])};
1437
- % #{Node := _} ->
1438
- % %% Queue is aware and uid for targeted node exists, do nothing
1439
- % QTypeState0;
1440
- % _ ->
1441
- % %% Queue is aware but current node has no UId, regen uid
1442
- % QTypeState0#{nodes := Nodes#{Node => NewRaUId}}
1443
- % end,
1444
- Q = amqqueue :set_type_state (Q0 , QTypeState0 ),
1433
+ QTypeState = case Nodes of
1434
+ L when is_list (L ) ->
1435
+ % % Queue is not aware of node to uid mapping, just add the new node
1436
+ QTypeState0 #{nodes => lists :usort ([Node | Nodes ])};
1437
+ #{Node := _ } ->
1438
+ % % Queue is aware and uid for targeted node exists, do nothing
1439
+ QTypeState0 ;
1440
+ _ ->
1441
+ % % Queue is aware but current node has no UId, regen uid
1442
+ QTypeState0 #{nodes => Nodes #{Node => NewRaUId }}
1443
+ end ,
1444
+ Q = amqqueue :set_type_state (Q0 , QTypeState ),
1445
1445
MachineVersion = erpc_call (Node , rabbit_fifo , version , [], infinity ),
1446
1446
Conf = make_ra_conf (Q , ServerId , Membership , MachineVersion ),
1447
1447
case ra :start_server (? RA_SYSTEM , Conf ) of
@@ -1459,7 +1459,7 @@ do_add_member(Q0, Node, Membership, Timeout)
1459
1459
Q2 = update_type_state (
1460
1460
Q1 , fun (#{nodes := NodesList } = Ts ) when is_list (NodesList ) ->
1461
1461
Ts #{nodes => lists :usort ([Node | NodesList ])};
1462
- (#{nodes := #{Node := _ } = _NodesMap } = Ts ) ->
1462
+ (#{nodes := #{Node := _ }} = Ts ) ->
1463
1463
Ts ;
1464
1464
(#{nodes := NodesMap } = Ts ) when is_map (NodesMap ) ->
1465
1465
Ts #{nodes => maps :put (Node , NewRaUId , NodesMap )}
@@ -2047,7 +2047,7 @@ make_ra_conf(Q, ServerId, TickTimeout,
2047
2047
[{ClusterName , _ } | _ ] = Members = members (Q ),
2048
2048
{_ , Node } = ServerId ,
2049
2049
UId = case amqqueue :get_type_state (Q ) of
2050
- #{uids := #{Node := Id }} ->
2050
+ #{nodes := #{Node := Id }} ->
2051
2051
Id ;
2052
2052
_ ->
2053
2053
% % Queue was declared on an older version of RabbitMQ
0 commit comments