Bug #94332 Contribution by Facebook: Added optional commenting of the @@GLOBAL.GTID_PU ...
Submitted: 14 Feb 2019 22:43 Modified: 25 Jun 2019 12:29
Reporter: FBContrib Admin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[14 Feb 2019 22:43] FBContrib Admin
Background innformation provided by Facebook:

Added a new allowed value for --set-gtid-purged command line argument for mysqldump. --set-gtid-purged=COMMENTED will output the SET @GLOBAL.GTID_PURGED information in a comment.

Also, changed the logic of extracting the GTIDS. They are now extracted from the results of START TRANSACTION.

Use case:

This change allows us to record the gtid_purged values as a comment into the dump file and allows replay of the file without executing the set gtid_purged line. The recorded dump files can have different applications for us and our dump files typically consists of a single database. When we migrate data from one physical server to another server (completely different gtid sets) that already contain other active databases, we would restore the dump files, but we also want the purged value without risking the restore process execute "set gtid_purged" variable. The value of gtid_purged is still available within the dump file for our automation to retrieve and make certain decisions on.

Repo: https://github.com/mysql/mysql-server
Patch on top of 8.0.13: https://github.com/mysql/mysql-server/commit/e4924f36486f971f8a04252e01c803457a2c72f7

How to repeat:
See description

Suggested fix:
See contribution code attached
[14 Feb 2019 22:43] FBContrib Admin
Added optional commenting of the @@GLOBAL.GTID_PURGED line in mysqldump 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_100.txt (text/plain), 9.21 KiB.

[25 Jun 2019 7:02] Georgi Kodinov
Posted by developer:
Implemented as WL#12959
[25 Jun 2019 12:29] Margaret Fisher
Posted by developer:
Changelog entry added for MySQL 8.0.17 (WL #12959):

The mysqldump option --set-gtid-purged controls whether or not a SET @@GLOBAL.gtid_purged statement is added to the mysqldump output. The statement updates the value of gtid_purged on a server where the dump file is reloaded, to add the GTID set from the source server's gtid_executed system variable. A new choice --set-gtid-purged=COMMENTED is now available. When this value is set, if GTIDs are enabled on the server you are backing up, SET @@GLOBAL.gtid_purged is added to the output (unless gtid_executed is empty), but it is commented out. This means that the value of gtid_executed is available in the output, but no action is taken automatically when the dump file is reloaded. With COMMENTED, you can control the use of the gtid_executed set manually or through automation. For example, you might prefer to do this if you are migrating data to another server that already has different active databases. Thanks to Facebook for this contribution.
[2 Jul 2019 23:04] Omer Barnir
Thanks to Facebook for the contribution