WL#12959: Contribution by Facebook: Added optional commenting of the @@GLOBAL.GTID_PURGED by dump

Affects: Server-8.0   —   Status: Complete

Background innformation :

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

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.

Thus is a contribution by Facebook, see BUG#94332
FR1: the --set-gtid-purged mysqldump option will take a new value called COMMENTED
FR2: when COMMENTED is supplied it will output the SET @GLOBAL.GTID_PURGED
command as it does now (for ON/AUTO), but in an unconditional comment.
NF3: only the mysqldump tool will be affected.