Binlog Event Checksums

The terms master and slave have historically been used in replication, but the terms terms primary and replica are now preferred. The old terms are used throughout the documentation, and in MariaDB commands, although MariaDB 10.5 has begun the process of renaming. The documentation will follow over time. See MDEV-18777 to follow progress on this effort.

MariaDB includes a feature to include a checksum in binary log events.

Checksums are enabled with the binlog_checksum option. Until MariaDB 10.2.1, this was disabled by default. From MariaDB 10.2.1, the option is set to CRC32.

The variable can be changed dynamically without restarting the server. Setting the variable in any way (even to the existing value) forces a rotation of the binary log (the intention is to avoid having a single binlog where some events are checksummed and others are not).

When checksums are enabled, replication slaves will check events received over the network for checksum errors, and will stop with an error if a corrupt event is detected.

In addition, the server can be configured to verify checksums in two other places.

One is when reading events from the binlog on the master, for example when sending events to a slave or for something like SHOW BINLOG EVENTS. This is controlled by option master_verify_checksum, and is thus used to detect file system corruption of the binlog files.

The other is when the slave SQL thread reads events from the relay log. This is controlled by the slave_sql_verify_checksum option, and is used to detect file system corruption of slave relay log files.

master_verify_checksum

  • Description: Verify binlog checksums when reading events from the binlog on the master.
  • Commandline: --master_verify_checksum=[0|1]
  • Scope: Global
  • Access Type: Can be changed dynamically
  • Data Type: bool
  • Default Value: OFF (0)

slave_sql_verify_checksum

  • Description: Verify binlog checksums when the slave SQL thread reads events from the relay log.
  • Commandline: --slave_sql_verify_checksum=[0|1]
  • Scope: Global
  • Access Type: Can be changed dynamically
  • Data Type: bool
  • Default Value: ON (1)

The mysqlbinlog client program by default does not verify checksums when reading a binlog file, however it can be instructed to do so with the option verify-binlog-checksum:

  • Variable Name: verify-binlog-checksum
  • Data Type: bool
  • Default Value: OFF

See Also

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/binlog-event-checksums/