Skip to content

Commit 48825ac

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 48825ac

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
@@ -741,6 +741,10 @@
741741
# raft.wal_max_batch_size = 4096
742742
# raft.snapshot_chunk_size = 1000000
743743

744+
## Quorum queue settings
745+
##
746+
# quorum_queue.segment_max_size_bytes = 64000000
747+
744748
## Metadata store (Khepri) operation timeout in milliseconds.
745749
##
746750
# metadata_store.khepri.default_timeout = 30000

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
@@ -1071,6 +1071,13 @@ credential_validator.regexp = ^abc\\d+",
10711071
]}],
10721072
[]},
10731073

1074+
{quorum_queue_segment_max_size_bytes,
1075+
"quorum_queue.segment_max_size_bytes = 64000000",
1076+
[{rabbit, [
1077+
{quorum_segment_max_size_bytes, 64000000}
1078+
]}],
1079+
[]},
1080+
10741081
{raft_wal_max_size_bytes,
10751082
"raft.wal_max_size_bytes = 1048576",
10761083
[{ra, [

0 commit comments

Comments
 (0)