28

Server version in the binary log

 5 years ago
source link: https://www.tuicool.com/articles/hit/IZZnia7
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Replication topologies, whether master-slave or group replication setups, may be composed of servers using different MySQL versions.

In MySQL 8.0.14, each transaction’s immediate and original server versions are now visible in the binary log as session variables. These two new variables, fully managed by the replication infrastructure, are used to support cross-version replication by transmitting the MySQL server release numbers associated with each transaction through the replication topology:

  • original_server_version stores the MySQL Server release number of the server where a transaction was originally committed (for example, 80014 for a MySQL 8.0.14 server instance).
  • immediate_server_version stores the MySQL Server release number of the server that is the immediate master in the replication topology (i.e., the last server where the transaction was applied).

Below is an excerpt on a binary log showing the Gtid log event of a transaction in which both original and immediate masters’ MySQL Server versions were 8.0.14.

#190117 13:02:24 server id 1 end_log_pos 1250 CRC32 0xd7c0725c GTID last_committed=4 sequence_number=5 rbr_only=no original_committed_timestamp=1547730144863243 immediate_commit_timestamp=1547730144863243 transaction_length=203
# original_commit_timestamp=1547730144863243 (2019-01-17 13:02:24.863243 WET)
# immediate_commit_timestamp=1547730144863243 (2019-01-17 13:02:24.863243 WET)
/*!80001 SET @@session.original_commit_timestamp=1547730144863243*//*!*/;
/*!80014 SET @@session.original_server_version=80014*//*!*/;
/*!80014 SET @@session.immediate_server_version=80014*//*!*/;
SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:5'/*!*/;
# at 1250

The new variables improve the auditing and debugging of replication issues in topologies with servers of different versions. They also improve the support of replication from servers running older MySQL releases.

If there is a server in the replication topology that does not support this feature (its version number is older than 8.0.14), then all transactions replicated from that server will have original and immediate server versions set to ‘000000’.

We look forward to hearing your feedback on this new feature!

185 total views, 120 views today


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK