Hi Monty, Here's the implementation of MDEV-31273, pre-compute binlog checksums. The main patch to review is the last one, number 4. This is the actual implementation of binlog checksum pre-computation, and the only patch that changes the behaviour of the code. Most of the work (and most of the changes) are cleanups of the old checksum code that don't change the functionality but removes a lot of complex and hard-to-modify logic (and I think actually fixes a bug or two). I have kept this cleanup separate in the first 3 patches to make it easier to review and not get mixed up with the actual implementation of the new functionality. With this patch series, calculation of binlog checksum will happen when writing events into the stmt/trx caches. Later, when writing the binlog file under LOCK_log, only a direct copy of the bytes is done, which should improve binlog scalability with checksums enabled. The patch series is also available on github: https://github.com/MariaDB/server/commits/knielsen_mdev31273 - Kristian. Kristian Nielsen (4): MDEV-31273: Replace Log_event::writer with function parameter MDEV-31273: Eliminate Log_event::checksum_alg MDEV-31273: Refactor MYSQL_BIN_LOG::write_cache() MDEV-31273: Precompute binlog checksums include/my_atomic.h | 41 +- include/my_sys.h | 2 + .../main/mysqlbinlog_row_compressed.result | 48 +- .../main/mysqlbinlog_row_minimal.result | 48 +- .../main/mysqlbinlog_stmt_compressed.result | 16 +- mysql-test/main/mysqld--help.result | 7 + .../suite/binlog/include/binlog_ioerr.inc | 3 + mysql-test/suite/binlog/r/binlog_ioerr.result | 2 + .../r/binlog_mysqlbinlog_raw_flush.result | 1 + mysql-test/suite/binlog/t/binlog_killed.test | 2 +- .../t/binlog_mysqlbinlog_raw_flush.test | 2 + .../t/binlog_table_map_optional_metadata.test | 4 +- .../binlog_encryption/binlog_ioerr.result | 2 + .../suite/rpl/r/rpl_checksum_cache.result | 43 +- .../suite/rpl/t/rpl_checksum_cache.test | 98 +++- .../r/sysvars_server_notembedded.result | 10 + mysys/mf_iocache2.c | 34 ++ sql/log.cc | 468 ++++++++++-------- sql/log.h | 14 +- sql/log_event.cc | 27 +- sql/log_event.h | 158 +++--- sql/log_event_client.cc | 22 +- sql/log_event_old.cc | 14 +- sql/log_event_old.h | 4 +- sql/log_event_server.cc | 395 ++++++--------- sql/mysqld.cc | 1 + sql/mysqld.h | 1 + sql/privilege.h | 3 + sql/slave.cc | 60 +-- sql/sql_repl.cc | 2 +- sql/sys_vars.cc | 13 + sql/wsrep_binlog.cc | 6 +- sql/wsrep_mysqld.cc | 12 +- 33 files changed, 922 insertions(+), 641 deletions(-) -- 2.30.2