104
104
-define (TICK_TIMEOUT , 5000 ). % % the ra server tick time
105
105
-define (DELETE_TIMEOUT , 5000 ).
106
106
-define (ADD_MEMBER_TIMEOUT , 5000 ).
107
+ -define (SNAPSHOT_INTERVAL , 8192 ). % % the ra default is 4096
107
108
108
109
% %----------- rabbit_queue_type ---------------------------------------------
109
110
@@ -186,7 +187,9 @@ start_cluster(Q) ->
186
187
{created , NewQ } ->
187
188
TickTimeout = application :get_env (rabbit , quorum_tick_interval ,
188
189
? TICK_TIMEOUT ),
189
- RaConfs = [make_ra_conf (NewQ , ServerId , TickTimeout )
190
+ SnapshotInterval = application :get_env (rabbit , quorum_snapshot_interval ,
191
+ ? SNAPSHOT_INTERVAL ),
192
+ RaConfs = [make_ra_conf (NewQ , ServerId , TickTimeout , SnapshotInterval )
190
193
|| ServerId <- members (NewQ )],
191
194
case ra :start_cluster (? RA_SYSTEM , RaConfs ) of
192
195
{ok , _ , _ } ->
@@ -1047,7 +1050,9 @@ add_member(Q, Node, Timeout) when ?amqqueue_is_quorum(Q) ->
1047
1050
Members = members (Q ),
1048
1051
TickTimeout = application :get_env (rabbit , quorum_tick_interval ,
1049
1052
? TICK_TIMEOUT ),
1050
- Conf = make_ra_conf (Q , ServerId , TickTimeout ),
1053
+ SnapshotInterval = application :get_env (rabbit , quorum_snapshot_interval ,
1054
+ ? SNAPSHOT_INTERVAL ),
1055
+ Conf = make_ra_conf (Q , ServerId , TickTimeout , SnapshotInterval ),
1051
1056
case ra :start_server (? RA_SYSTEM , Conf ) of
1052
1057
ok ->
1053
1058
case ra :add_member (Members , ServerId , Timeout ) of
@@ -1552,7 +1557,7 @@ members(Q) when ?amqqueue_is_quorum(Q) ->
1552
1557
format_ra_event (ServerId , Evt , QRef ) ->
1553
1558
{'$gen_cast' , {queue_event , QRef , {ServerId , Evt }}}.
1554
1559
1555
- make_ra_conf (Q , ServerId , TickTimeout ) ->
1560
+ make_ra_conf (Q , ServerId , TickTimeout , SnapshotInterval ) ->
1556
1561
QName = amqqueue :get_name (Q ),
1557
1562
RaMachine = ra_machine (Q ),
1558
1563
[{ClusterName , _ } | _ ] = Members = members (Q ),
@@ -1565,7 +1570,8 @@ make_ra_conf(Q, ServerId, TickTimeout) ->
1565
1570
friendly_name => FName ,
1566
1571
metrics_key => QName ,
1567
1572
initial_members => Members ,
1568
- log_init_args => #{uid => UId },
1573
+ log_init_args => #{uid => UId ,
1574
+ snapshot_interval => SnapshotInterval },
1569
1575
tick_timeout => TickTimeout ,
1570
1576
machine => RaMachine ,
1571
1577
ra_event_formatter => Formatter }.
0 commit comments