2

I would like to know where the gtid_executed and gtid_purged variables are stored in the database engine. If these are just runtime variables how exactly are they initialized?

Philᵀᴹ
  • 31,952
  • 10
  • 86
  • 108
Jeff
  • 123
  • 1
  • 3

2 Answers2

3

They are not part of any particular storage engine. GTID variables can be seen by running:

SHOW GLOBAL VARIABLES LIKE 'gtid%';

or

SELECT * FROM information_schema.global_variables
WHERE variable_name LIKE 'gtid%';

When you run RESET MASTER on the DB Server, these values are blanked out.

MySQL Documentation says about gtid_executed

Issuing RESET MASTER causes the global value (but not the session value) of this variable to be reset to an empty string. GTIDs are not otherwise removed from this set other than when the set is cleared due to RESET MASTER. The set is also cleared if the server is shut down and all binary logs are removed.

MySQL Documentation says about gtid_purged

Issuing RESET MASTER causes the value of this variable to be reset to an empty string.

When SQL statements are executed, gtid_executed is updated with the GTID Set value.

MySQL Documentation says about gtid_executed

When the server starts, @@global.gtid_executed is initialized to the union of the following two sets:

  • The GTIDs listed in the Previous_gtids_log_event of the newest binary log

  • The GTIDs found in every Gtid_log_event in the newest binary log.

Thereafter, GTIDs are added to the set as transactions are executed.

gtid_purged can only be set when it is blank. Usually, you will set this variable set during the reload of a mysqldump whose source had GTID enabled.

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
0
  1. You need to start here: A Guided Tour Of The MySQL Source Code
  2. Then you can search the MySQL source code on GitHub for gtid_executed and gtid_purged

You most likely will need to do some digging, but thats as far as I wanted to go, good luck.

Dave
  • 101
  • 1