107
107
-define (TICK_TIMEOUT , 5000 ). % % the ra server tick time
108
108
-define (DELETE_TIMEOUT , 5000 ).
109
109
-define (ADD_MEMBER_TIMEOUT , 5000 ).
110
+ -define (SNAPSHOT_INTERVAL , 8192 ). % % the ra default is 4096
110
111
111
112
% %----------- rabbit_queue_type ---------------------------------------------
112
113
@@ -189,7 +190,9 @@ start_cluster(Q) ->
189
190
{created , NewQ } ->
190
191
TickTimeout = application :get_env (rabbit , quorum_tick_interval ,
191
192
? TICK_TIMEOUT ),
192
- RaConfs = [make_ra_conf (NewQ , ServerId , TickTimeout )
193
+ SnapshotInterval = application :get_env (rabbit , quorum_snapshot_interval ,
194
+ ? SNAPSHOT_INTERVAL ),
195
+ RaConfs = [make_ra_conf (NewQ , ServerId , TickTimeout , SnapshotInterval )
193
196
|| ServerId <- members (NewQ )],
194
197
case ra :start_cluster (? RA_SYSTEM , RaConfs ) of
195
198
{ok , _ , _ } ->
@@ -1058,7 +1061,9 @@ add_member(Q, Node, Timeout) when ?amqqueue_is_quorum(Q) ->
1058
1061
Members = members (Q ),
1059
1062
TickTimeout = application :get_env (rabbit , quorum_tick_interval ,
1060
1063
? TICK_TIMEOUT ),
1061
- Conf = make_ra_conf (Q , ServerId , TickTimeout ),
1064
+ SnapshotInterval = application :get_env (rabbit , quorum_snapshot_interval ,
1065
+ ? SNAPSHOT_INTERVAL ),
1066
+ Conf = make_ra_conf (Q , ServerId , TickTimeout , SnapshotInterval ),
1062
1067
case ra :start_server (? RA_SYSTEM , Conf ) of
1063
1068
ok ->
1064
1069
case ra :add_member (Members , ServerId , Timeout ) of
@@ -1621,7 +1626,7 @@ members(Q) when ?amqqueue_is_quorum(Q) ->
1621
1626
format_ra_event (ServerId , Evt , QRef ) ->
1622
1627
{'$gen_cast' , {queue_event , QRef , {ServerId , Evt }}}.
1623
1628
1624
- make_ra_conf (Q , ServerId , TickTimeout ) ->
1629
+ make_ra_conf (Q , ServerId , TickTimeout , SnapshotInterval ) ->
1625
1630
QName = amqqueue :get_name (Q ),
1626
1631
RaMachine = ra_machine (Q ),
1627
1632
[{ClusterName , _ } | _ ] = Members = members (Q ),
@@ -1634,7 +1639,8 @@ make_ra_conf(Q, ServerId, TickTimeout) ->
1634
1639
friendly_name => FName ,
1635
1640
metrics_key => QName ,
1636
1641
initial_members => Members ,
1637
- log_init_args => #{uid => UId },
1642
+ log_init_args => #{uid => UId ,
1643
+ snapshot_interval => SnapshotInterval },
1638
1644
tick_timeout => TickTimeout ,
1639
1645
machine => RaMachine ,
1640
1646
ra_event_formatter => Formatter }.
0 commit comments