PS-10321 fix: binlog-server fails to read the new events after upgrading server from 8.0 to 8.4#101
Merged
percona-ysorokin merged 1 commit intomainfrom Mar 11, 2026
Merged
Conversation
…ing server from 8.0 to 8.4 https://perconadev.atlassian.net/browse/PS-10321 Fixed an issue with Binlog Server utility not being able to process FORMAT_DESCRIPTION events generated by previous versions of MySQL Server (e.g. 8.0 FDEs coming from 8.4 server). This may happen when user performs an in-place upgrade of his data directory and has old binlog files with 8.0 FDEs along with new binlog files with 8.4 FDEs, which are 1 byte larger. Reworked the way how 'binsrv::events::event_view' class determines the boundaries of event sections (common_header / post_header / body / footer) for FORMAT_DESCRIPTION event. Because of this, it is now possible to parse FDEs generated on different versions of the MySQL Server (which are different in size). Simplified 'binsrv::events::event:' class byte span constructor - it no longer requires 'reader_context' as a parameter. Reworked FORMAT_DESCRIPTION post header class constructor - it no longer expects a data span of pre-defined length. Instead it checks the length dynamically based on the 'server_version' extracted on the way. In 'binsrv::events::reader_context' class we now differentiate between encoded server version specified during object construction and coming from the MySQL connection object ('get_connection_encoded_server_version()' method) and encoded server version encountered in the last processed FORMAT_DESCRIPTION event ('get_current_encoded_server_version()' method). Added 'binlog_streaming.data_directory_8_0_to_8_4_upgrade' MTR test case that checks if the Binlog Server utility can properly download events from an instance of MySQL Server after 8.0 -> 8.4 upgrade. The following script was used to generate original 8.0 binlog files: CREATE TABLE t1(id SERIAL, PRIMARY KEY(id)); INSERT INTO t1 VALUES(); INSERT INTO t1 VALUES(); START TRANSACTION; INSERT INTO t1 VALUES(); INSERT INTO t1 VALUES(); INSERT INTO t1 VALUES(); INSERT INTO t1 VALUES(); COMMIT; FLUSH BINARY LOGS; UPDATE t1 SET id = id + 100 WHERE id <= 3; DELETE FROM t1 WHERE id < 100; The test has 2 combinations: 'position' and 'gtid'. For each of them an individual data directory archive was created.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
https://perconadev.atlassian.net/browse/PS-10321
Fixed an issue with Binlog Server utility not being able to process FORMAT_DESCRIPTION events generated by previous versions of MySQL Server (e.g. 8.0 FDEs coming from 8.4 server). This may happen when user performs an in-place upgrade of his data directory and has old binlog files with 8.0 FDEs along with new binlog files with 8.4 FDEs, which are 1 byte larger.
Reworked the way how 'binsrv::events::event_view' class determines the boundaries of event sections (common_header / post_header / body / footer) for FORMAT_DESCRIPTION event. Because of this, it is now possible to parse FDEs generated on different versions of the MySQL Server (which are different in size).
Simplified 'binsrv::events::event:' class byte span constructor - it no longer requires 'reader_context' as a parameter.
Reworked FORMAT_DESCRIPTION post header class constructor - it no longer expects a data span of pre-defined length. Instead it checks the length dynamically based on the 'server_version' extracted on the way.
In 'binsrv::events::reader_context' class we now differentiate between encoded server version specified during object construction and coming from the MySQL connection object ('get_connection_encoded_server_version()' method) and encoded server version encountered in the last processed FORMAT_DESCRIPTION event ('get_current_encoded_server_version()' method).
Added 'binlog_streaming.data_directory_8_0_to_8_4_upgrade' MTR test case that checks if the Binlog Server utility can properly download events from an instance of MySQL Server after 8.0 -> 8.4 upgrade. The following script was used to generate original 8.0 binlog files: CREATE TABLE t1(id SERIAL, PRIMARY KEY(id));
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES();
START TRANSACTION;
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES();
COMMIT;
FLUSH BINARY LOGS;
UPDATE t1 SET id = id + 100 WHERE id <= 3;
DELETE FROM t1 WHERE id < 100;
The test has 2 combinations: 'position' and 'gtid'. For each of them an individual data directory archive was created.