MDEV-37608: Increase default binlog_row_event_max_size to 64k#4697
MDEV-37608: Increase default binlog_row_event_max_size to 64k#4697KhaledSayed04 wants to merge 1 commit intoMariaDB:mainfrom
Conversation
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Good job on the performance evaluation!
Several things to fix here:
- Please use a single commit
- Make sure the commit message complies to CODING_STANDARDS.md
- Re-record mysql--help to reflect the new value
- (optional) Consider adding a specialized test for this variable, similar to e.g. binlog_cache_size_basic.test
415de5c to
34a7d3c
Compare
|
Hi @gkodinov, I've implemented the default change to 64k and added the basic system variable tests. These failures occur because of some environment conditions that I couldn't catch. I have ran the failing tests locally and they passed. Regarding expectations based on the legacy 8k event boundaries for some other tests, I have investigated two ways to resolve this:
Given that this task was marked as 'beginner-friendly,' the second option (pinning) seems more localized, but I'm happy to perform the full refactor if you prefer the first. |
|
Yes, I think pinning should be OK. |
|
The embedded failure occurs because of the following: Note how the rest of the variables in the .opt file that are unknown are prefixed with --loose? Although they're not really dynamic. It's because of the embedded case where these are (apparently) not sourced. |
gkodinov
left a comment
There was a problem hiding this comment.
We're very close. Let's just fix the failing buildbot tests. The rest is fine.
mysql-test/main/vector.opt
Outdated
| @@ -0,0 +1 @@ | |||
| --binlog-row-event-max-size=8192 | |||
There was a problem hiding this comment.
prefix with --loose here because it's run in embedded mode.
0c772a7 to
a8e4f45
Compare
|
@gkodinov These tests don't fail all at once when running CI to group them all. They appear one by one. Is modifying |
|
To build on my previous comment, I’ve performed a deeper static analysis to identify why some tests (like the Windows bootstrap) fail in CI despite passing in my local environment. The 64k default creates a "physics shift" in event packing and memory overhead that the legacy test suite is highly sensitive to. I’ve identified the following candidate affected tests that likely require pinning to maintain stability across different architectures (Linux, Windows, etc.):
Given that nearly 200 tests are potentially affected by these implicit environment dependencies, I think the single-line addition to I understand that individual .opt files make requirements explicit. However, given that these 200+ candidates are 'implicitly' dependent on the old default, Path A (global pin) provides a cleaner baseline. A possible compromise: We could use default_mysqld.cnf for the general stability of the suite, and I can add specific .opt files only for the primary 'Replication' and 'Vector' tests that are most critical for documenting these boundaries. This avoids PR bloat while maintaining documentation where it matters most. Looking forward to your guidance on which approach aligns best with the MariaDB testing philosophy. |
|
Hi @KhaledSayed04 ! It is good to update tests for new configurations, as this makes it obvious what problems users may run into when upgrading. Future tests will also more closely resemble our users behaviors. I'd suggest the following:
The above three cases don't seem to rely on
These tests seem to rely on behavior from Otherwise it looks good! If you can fix the tests by March 10, we can get this patch into the upcoming |
3bbebd1 to
6f2308f
Compare
e0b48e2 to
8530623
Compare
|
Hi @bnestere !
The PR is ready for review. |
gkodinov
left a comment
There was a problem hiding this comment.
Very close!
Just please remove or explain seemingly unrelated changes.
bnestere
left a comment
There was a problem hiding this comment.
Thanks for getting the test fixups started, @KhaledSayed04 !
I've left some additional notes / questions.
| @@ -0,0 +1,2 @@ | |||
| --loose-binlog-row-event-max-size=8192 | |||
| --innodb-lock-wait-timeout=30 No newline at end of file | |||
There was a problem hiding this comment.
Please add a new line. Also, I saw @gkodinov had already asked about why the non binlog-* option exists, so I won't re-ask. But the convention for .opt files is to keep options on the same line separated by spaces. .cnf files are different however, with new options on separate lines.
There was a problem hiding this comment.
Is 'Line lengths' convention applied in .opt files too?
Lines should be no more than 80 characters.
mysql-test/suite/sys_vars/t/binlog_row_event_max_size_basic.test
Outdated
Show resolved
Hide resolved
mysql-test/suite/sys_vars/t/binlog_row_event_max_size_basic.test
Outdated
Show resolved
Hide resolved
55ce0ee to
6392d2a
Compare
6392d2a to
ceabc06
Compare
| @@ -0,0 +1 @@ | |||
| --loose-binlog-row-event-max-size=8192 | |||
There was a problem hiding this comment.
Cache Boundary & Overflow Handling
These tests utilize a 4KB binlog_cache_size (the server minimum). The 8KB pin ensures that events exceed the memory buffer, forcing the server into the incremental flush-to-disk and overflow logic.
With the 64KB upgrade, the scale between the event size and the 4KB cache is so large (16x) that the server may trigger an "Event too large" rejection during the initial memory allocation phase. Retaining the 8KB limit ensures the server actually attempts to write a partial event to the cache, so that exercising the IO_CACHE spill-to-disk code paths.
Affected Files:
mysql-test/main/alter_table_online_debug.optmysql-test/suite/binlog/t/binlog_bug23533.optmysql-test/suite/galera/t/galera_binlog_cache_size.optmysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.optmysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.optmysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.optmysql-test/suite/rpl/t/rpl_create_select_row-master.opt
| !include ../my.cnf | ||
|
|
||
| [mysqld] | ||
| binlog-row-event-max-size=8192 |
There was a problem hiding this comment.
Event Fragmentation & Protocol Integrity
These tests verify that large rows are correctly sliced into multiple Rows_log_event fragments. A 64KB default would allow the test payloads to fit into a single event, neutralizing the validation of reassembly and protocol flags.
Affected Files:
mysql-test/suite/rpl/t/rpl_fragment_row_event_main.cnfmysql-test/suite/rpl/t/rpl_loaddata_map-master.optmysql-test/suite/rpl/t/rpl_loaddata_map-slave.optmysql-test/suite/rpl/t/rpl_checksum_cache.optmysql-test/suite/binlog_encryption/rpl_packet.cnf
| @@ -0,0 +1 @@ | |||
| --loose-binlog-row-event-max-size=8192 | |||
There was a problem hiding this comment.
Engine Spills & Recovery (OOB/ENOSPC)
These tests exercise Out-of-Band (OOB) offloading to the storage engine or verify server resilience during Disk Full (ENOSPC) scenarios while flushing the binary log cache.
The 8KB pin is required to maintain the "Small World" math where even a single statement forces a transition from memory to storage. At 64KB, these transactions would remain "in-line" in memory, failing to trigger the temporary file creation, disk-full error injection, and encryption logic that these tests are specifically designed to measure.
Affected Files:
mysql-test/suite/binlog_in_engine/rpl_oob.optmysql-test/suite/binlog_in_engine/xa.optmysql-test/suite/binlog_in_engine/rpl_dual_cache-master.optmysql-test/suite/rpl/t/rpl_row_binlog_tmp_file_flush_enospc-master.optmysql-test/suite/rpl/t/rpl_mdev-11092.optmysql-test/suite/encryption/t/tempfiles.optmysql-test/suite/perfschema/t/io_cache-master.opt
| --max-binlog-size=4096 | ||
| --binlog-format=row | ||
| --slave_connections_needed_for_purge=1 | ||
| --log-bin=binary --max-binlog-total-size=1500 --max-binlog-size=4096 --binlog-format=row --slave_connections_needed_for_purge=1 --loose-binlog-row-event-max-size=8192 |
There was a problem hiding this comment.
Micro-Rotation & Space Limits
These tests validate how MariaDB purges binary logs or manages temporary space under strict constraints. They utilize limits ranging from "Micro-Thresholds" (e.g., max-binlog-total-size=1500) to moderate session quotas (e.g., max_tmp_session_space_usage=512K).
The 8KB pin is retained to maintain the mathematical proportionality between event size and space limits.
Affected Files:
mysql-test/suite/rpl/t/max_binlog_total_size-master.optmysql-test/main/tmp_space_usage-master.optmysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row-master.optmysql-test/suite/binlog/include/binlog_cache_stat.opt
bnestere
left a comment
There was a problem hiding this comment.
This looks great, @KhaledSayed04 , thank you!
I have three last very minor requests;
- A left a comment to add a final line to your new
.testfile - To the git commit message: your PR has great comments to document what tests changed and why, can you add these descriptions to the git commit message? Just copy pasting is fine.
- Also to the git commit message, please add your reviewers :)
Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
Reviewed-by: Georgi Kodinov <joro@mariadb.org>
Thanks for the great work!
| --source include/restart_mysqld.inc | ||
|
|
||
| --echo # Should be clipped to the maximum (4294967040 on 64-bit) | ||
| SELECT @@global.binlog_row_event_max_size; |
There was a problem hiding this comment.
Please add one last line to specify the end of the test:
| SELECT @@global.binlog_row_event_max_size; | |
| SELECT @@global.binlog_row_event_max_size; | |
| --echo # End of sys_vars.binlog_row_event_max_size_basic |
|
@KhaledSayed04 also, just to set your expectations to our internal process, I've approved this to be in 13.0. It won't yet be merged to the |
Increase default binlog_row_event_max_size to 64k to reduce event header overhead and improve performance on modern networks. Summary of changes: - Updated sql/sys_vars.cc for the new 64k default. - Added binlog_row_event_max_size_basic.test to verify min/max boundaries and read-only property. - Audited MTR suite; retained pins only for tests requiring specific byte-math for cache spills and event fragmentation logic. - Standardized some affected .opt files to a single line format to follow MTR best practices. # Affected Tests Grouping ## Cache Boundary & Overflow Handling These tests utilize a 4KB binlog_cache_size (the server minimum). The 8KB pin ensures that events exceed the memory buffer, forcing the server into the incremental flush-to-disk and overflow logic. With 64KB, the 16x scale disparity may trigger 'Event too large' rejections during allocation, bypassing IO_CACHE spill code paths. Affected Files: - mysql-test/main/alter_table_online_debug.opt - mysql-test/suite/binlog/t/binlog_bug23533.opt - mysql-test/suite/galera/t/galera_binlog_cache_size.opt - mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt - mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt - mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt - mysql-test/suite/rpl/t/rpl_create_select_row-master.opt ## Engine Spills & Recovery (OOB/ENOSPC) These tests exercise Out-of-Band (OOB) offloading or verify resilience during Disk Full (ENOSPC) scenarios while flushing the binary log cache. The 8KB pin is required to maintain the 'Small World' math where even a single statement forces a transition from memory to storage. At 64KB, these transactions would remain 'in-line' in memory, failing to trigger the temporary file creation, disk-full error injection, and encryption logic that these tests are specifically designed to measure. Affected Files: - mysql-test/suite/binlog_in_engine/rpl_oob.opt - mysql-test/suite/binlog_in_engine/xa.opt - mysql-test/suite/binlog_in_engine/rpl_dual_cache-master.opt - mysql-test/suite/rpl/t/rpl_row_binlog_tmp_file_flush_enospc-master.opt - mysql-test/suite/rpl/t/rpl_mdev-11092.opt - mysql-test/suite/encryption/t/tempfiles.opt - mysql-test/suite/perfschema/t/io_cache-master.opt ## Micro-Rotation & Space Limits These tests validate how MariaDB purges binary logs or manages temporary space under strict constraints. They utilize limits ranging from 'Micro-Thresholds' (e.g., max-binlog-total-size=1.5k) to moderate session quotas (e.g., max_tmp_session_space_usage=512K). The 8KB pin is retained to maintain the mathematical proportionality between event size and space limits. Affected Files: - mysql-test/suite/rpl/t/max_binlog_total_size-master.opt - mysql-test/main/tmp_space_usage-master.opt - mysql-test/suite/rpl/t/rpl_binlog_cache_disk_full_row-master.opt - mysql-test/suite/binlog/include/binlog_cache_stat.opt ## Event Fragmentation & Protocol Integrity These tests verify that large rows are correctly sliced into multiple Rows_log_event fragments. A 64KB default would allow the test payloads to fit into a single event, neutralizing the validation of reassembly and protocol flags. Affected Files: - mysql-test/suite/rpl/t/rpl_fragment_row_event_main.cnf - mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt - mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt - mysql-test/suite/rpl/t/rpl_checksum_cache.opt - mysql-test/suite/binlog_encryption/rpl_packet.cnf Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com> Reviewed-by: Georgi Kodinov <joro@mariadb.org>
ceabc06 to
e3d7ecf
Compare
|
Hi @bnestere, I've pushed the updated commit with the expanded audit in the message and the reviewers added. I also added the final line to the test file as requested:
Quick note on a small cleanup: I removed the general Thank you for the feedback and approval! |
Summary:
This PR updates the default value of
binlog_row_event_max_sizefrom 8,192 bytes (8k) to 65,536 bytes (64k).Technical Rationale:
The legacy 8k default causes extreme fragmentation in the binary log when handling modern workloads with large row payloads. By increasing this limit to 64k, the engine can aggregate more rows into fewer
Write_rowsevents.My benchmarks show that for a transaction involving 1,000 rows (5KB each), the 64k default reduces the number of binary log events from 1,000 to 77—a 92.3% reduction in header and metadata overhead. While 128k offers slightly better aggregation (39 events), 64k represents the optimal balance for memory allocation and network MTU efficiency.
Benchmark Results
Test Case: 1,000 rows inserted in a single transaction (5KB payload per row).
Test Environment
Verification
mtr binlog.binlog_row_binlog.Click to view Benchmark Script