Skip to content

Commit eacdd0c

Browse files
committed
Make Ra segment_max_size_bytes configurable for quorum queues
Add support for configuring Ra's segment_max_size_bytes parameter via rabbitmq.conf as raft.segment_max_size_bytes. This allows operators to control the maximum size of Raft log segment files for quorum queues. The configuration: - Maps quorum_queue.segment_max_size_bytes in rabbitmq.conf to rabbit.quorum_segment_max_size_bytes in the application environment - Defaults to Ra's built-in default of 64 MB when not configured - Is explicitly applied to the quorum_queues Ra system configuration for transparency and maintainability Also add a macro QUORUM_DEFAULT_SEGMENT_MAX_SIZE_B to align with Ra's default value.
1 parent 46431b4 commit eacdd0c

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

deps/rabbit/docs/rabbitmq.conf.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,10 @@
487487
## when there are multiple publishers sending to the same quorum queue.
488488
# quorum_queue.commands_soft_limit = 32
489489

490+
## Sets the maximum size of Raft log segment files for quorum queues.
491+
##
492+
# quorum_queue.segment_max_size_bytes = 64000000
493+
490494
## Changes classic queue storage implementation version.
491495
## As of 4.0.0, version 2 is the default and this is a forward compatibility setting,
492496
## that is, it will be useful when a new version is developed.

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,20 @@ end}.
27542754
{validators, ["non_zero_positive_integer"]}
27552755
]}.
27562756

2757+
{mapping, "quorum_queue.segment_max_size_bytes", "rabbit.quorum_segment_max_size_bytes", [
2758+
{datatype, integer},
2759+
{validators, ["non_zero_positive_integer"]}
2760+
]}.
2761+
2762+
{translation, "rabbit.quorum_segment_max_size_bytes",
2763+
fun(Conf) ->
2764+
case cuttlefish:conf_get("quorum_queue.segment_max_size_bytes", Conf, undefined) of
2765+
undefined -> cuttlefish:unset();
2766+
Val -> Val
2767+
end
2768+
end
2769+
}.
2770+
27572771
%%
27582772
%% Quorum Queue membership reconciliation
27592773
%%

deps/rabbit/src/rabbit_ra_systems.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
-define(COORD_WAL_MAX_SIZE_B, 64_000_000).
2626
-define(QUORUM_AER_MAX_RPC_SIZE, 16).
2727
-define(QUORUM_DEFAULT_WAL_MAX_ENTRIES, 500_000).
28+
-define(QUORUM_DEFAULT_SEGMENT_MAX_SIZE_B, 64_000_000).
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).
@@ -133,6 +134,8 @@ get_config(quorum_queues = RaSystem) ->
133134
_ ->
134135
?MIN_BIN_VHEAP_SIZE_DEFAULT
135136
end,
137+
SegmentMaxSizeBytes = application:get_env(rabbit, quorum_segment_max_size_bytes,
138+
?QUORUM_DEFAULT_SEGMENT_MAX_SIZE_B),
136139

137140
DefaultConfig#{name => RaSystem,
138141
wal_min_bin_vheap_size => MinBinVheapSize,
@@ -142,6 +145,7 @@ get_config(quorum_queues = RaSystem) ->
142145
wal_max_entries => WalMaxEntries,
143146
segment_compute_checksums => SegmentChecksums,
144147
compress_mem_tables => CompressMemTables,
148+
segment_max_size_bytes => SegmentMaxSizeBytes,
145149
server_recovery_strategy => {rabbit_quorum_queue,
146150
system_recover, []}};
147151
get_config(coordination = RaSystem) ->

deps/rabbit/test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,13 @@ credential_validator.regexp = ^abc\\d+",
11601160
]}],
11611161
[]},
11621162

1163+
{quorum_queue_segment_max_size_bytes,
1164+
"quorum_queue.segment_max_size_bytes = 64000000",
1165+
[{rabbit, [
1166+
{quorum_segment_max_size_bytes, 64000000}
1167+
]}],
1168+
[]},
1169+
11631170
%%
11641171
%% Runtime parameters
11651172
%%

0 commit comments

Comments
 (0)