Enhance Data Integrity with Binlog Event Checksum Verification #458
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR add supports for verifying event checksums when the binlog_checksum option is enabled in MySQL/MariaDB(5.7, 8.0). It enhances data integrity and security by validating each event in the binary log.
Changes
Key updates in this PR include:
The reason this method is effective lies in the shared use of the CRC32 algorithm by both MySQL and this method.
Test Code
To ensure the accuracy of the _verify_event method, test code has been designed to handle two main scenarios: valid events and corrupted events. The respective tests can be accessed in this source code file.
Benefits
Comment
Slave already has these features. When slave_sql_verify_checksum is enabled, the replication SQL thread uses checksums read from relay logs to verify data. I believe that incorporating these functionalities into our project would be highly advantageous.