2424
2525-define (COORD_WAL_MAX_SIZE_B , 64_000_000 ).
2626-define (QUORUM_AER_MAX_RPC_SIZE , 16 ).
27- -define (QUORUM_DEFAULT_WAL_MAX_ENTRIES , 500_000 ).
27+ -define (QUORUM_DEFAULT_WAL_MAX_SIZE_B , 536_870_912 ).
28+ -define (QUORUM_DEFAULT_WAL_MAX_BATCH_SIZE , 4096 ).
2829% % the default min bin vheap value in OTP 26
2930-define (MIN_BIN_VHEAP_SIZE_DEFAULT , 46422 ).
3031-define (MIN_BIN_VHEAP_SIZE_MULT , 64 ).
@@ -112,18 +113,13 @@ ensure_ra_system_started(RaSystem) ->
112113
113114-spec get_config (ra_system_name ()) -> ra_system :config ().
114115get_config (quorum_queues = RaSystem ) ->
115- DefaultConfig = get_default_config (),
116+ DefaultConfig = ra_system : default_config (),
116117 Checksums = application :get_env (rabbit , quorum_compute_checksums , true ),
117118 WalChecksums = application :get_env (rabbit , quorum_wal_compute_checksums , Checksums ),
118119 SegmentChecksums = application :get_env (rabbit , quorum_segment_compute_checksums ,
119120 Checksums ),
120- WalMaxEntries = case DefaultConfig of
121- #{wal_max_entries := MaxEntries }
122- when is_integer (MaxEntries ) ->
123- MaxEntries ;
124- _ ->
125- ? QUORUM_DEFAULT_WAL_MAX_ENTRIES
126- end ,
121+ WalMaxEntries = application :get_env (rabbit , quorum_wal_max_entries ,
122+ maps :get (wal_max_entries , DefaultConfig )),
127123 AERBatchSize = application :get_env (rabbit , quorum_max_append_entries_rpc_batch_size ,
128124 ? QUORUM_AER_MAX_RPC_SIZE ),
129125 CompressMemTables = application :get_env (rabbit , quorum_compress_mem_tables , true ),
@@ -133,6 +129,16 @@ get_config(quorum_queues = RaSystem) ->
133129 _ ->
134130 ? MIN_BIN_VHEAP_SIZE_DEFAULT
135131 end ,
132+ SegmentMaxSizeBytes = application :get_env (rabbit , quorum_segment_max_size_bytes ,
133+ maps :get (segment_max_size_bytes , DefaultConfig )),
134+ SegmentMaxEntries = application :get_env (rabbit , quorum_segment_max_entries ,
135+ maps :get (segment_max_entries , DefaultConfig )),
136+ WalMaxSizeBytes = application :get_env (rabbit , quorum_wal_max_size_bytes ,
137+ ? QUORUM_DEFAULT_WAL_MAX_SIZE_B ),
138+ WalMaxBatchSize = application :get_env (rabbit , quorum_wal_max_batch_size ,
139+ ? QUORUM_DEFAULT_WAL_MAX_BATCH_SIZE ),
140+ SnapshotChunkSize = application :get_env (rabbit , quorum_snapshot_chunk_size ,
141+ maps :get (snapshot_chunk_size , DefaultConfig )),
136142
137143 DefaultConfig #{name => RaSystem ,
138144 wal_min_bin_vheap_size => MinBinVheapSize ,
@@ -142,10 +148,15 @@ get_config(quorum_queues = RaSystem) ->
142148 wal_max_entries => WalMaxEntries ,
143149 segment_compute_checksums => SegmentChecksums ,
144150 compress_mem_tables => CompressMemTables ,
151+ segment_max_size_bytes => SegmentMaxSizeBytes ,
152+ segment_max_entries => SegmentMaxEntries ,
153+ wal_max_size_bytes => WalMaxSizeBytes ,
154+ wal_max_batch_size => WalMaxBatchSize ,
155+ snapshot_chunk_size => SnapshotChunkSize ,
145156 server_recovery_strategy => {rabbit_quorum_queue ,
146157 system_recover , []}};
147158get_config (coordination = RaSystem ) ->
148- DefaultConfig = get_default_config (),
159+ DefaultConfig = ra_system : default_config (),
149160 CoordDataDir = filename :join (
150161 [rabbit :data_dir (), " coordination" , node ()]),
151162 DefaultConfig #{name => RaSystem ,
@@ -154,13 +165,7 @@ get_config(coordination = RaSystem) ->
154165 wal_max_size_bytes => ? COORD_WAL_MAX_SIZE_B ,
155166 names => ra_system :derive_names (RaSystem )}.
156167
157- -spec get_default_config () -> ra_system :config ().
158-
159- get_default_config () ->
160- ra_system :default_config ().
161-
162168-spec ensure_stopped () -> ok | no_return ().
163-
164169ensure_stopped () ->
165170 ? LOG_DEBUG (
166171 " Stopping Ra systems" ,
0 commit comments