Bug #100666 Improve GTID information in MySQL Log
Submitted: 28 Aug 2020 1:49 Modified: 24 Sep 2020 12:27
Reporter: Jean Da Silva Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2020 1:49] Jean Da Silva
Description:
Currently, during the CHANGE MASTER configuration using GTID replication, the MySQL Log does not provide any information related to GTID but still providing the binlog information.

With GTID replication, information as GTID_PURGED, GTID_EXECUTED, and MASTER_AUTO_POSITION will be helpful in scenarios of troubleshooting. For example; To understand the state of the replication and its transaction at the time.

Also, either purging the GTID before or applying CHANGE MASTER after a RESET MASTER on the slave, produces a similar output.

How to repeat:
Scenario 1 - Purging the GTID first:

slave1> SET @@GLOBAL.GTID_PURGED='00029630-1111-1111-1111-111111111111:1-15';
Query OK, 0 rows affected (0.00 sec)

slave1> show global variables like 'gtid_executed';
+---------------+-------------------------------------------+
| Variable_name | Value                                     |
+---------------+-------------------------------------------+
| gtid_executed | 00029630-1111-1111-1111-111111111111:1-15 |
+---------------+-------------------------------------------+
1 row in set (0.00 sec)

slave1> CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER="rsandbox", MASTER_PASSWORD="msandbox", MASTER_PORT=29630, MASTER_AUTO_POSITION = 1;

## SLAVE1 LOG ##
2020-08-28T01:31:20.559795Z 6 [Note] @@GLOBAL.GTID_PURGED was changed from '' to '00029630-1111-1111-1111-111111111111:1-15'.

2020-08-28T01:31:20.559828Z 6 [Note] @@GLOBAL.GTID_EXECUTED was changed from '' to '00029630-1111-1111-1111-111111111111:1-15'.

2020-08-28T01:32:21.617724Z 6 [Note] 'CHANGE MASTER TO FOR CHANNEL '' executed'. Previous state master_host='127.0.0.1', master_port= 29630, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='127.0.0.1', master_port= 29630, master_log_file='', master_log_pos= 4, master_bind=''.

========================================================================
Scenario 2 - Configuring after a RESET MASTER on Slave;

slave2> reset master;

slave2> CHANGE MASTER TO MASTER_HOST="127.0.0.1", MASTER_USER="rsandbox", MASTER_PASSWORD="msandbox", MASTER_PORT=29630, MASTER_AUTO_POSITION = 1;

## Slave2 Logs ##
2020-08-28T01:43:13.345228Z 6 [Note] 'CHANGE MASTER TO FOR CHANNEL '' executed'. Previous state master_host='127.0.0.1', master_port= 29630, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='127.0.0.1', master_port= 29630, master_log_file='', master_log_pos= 4, master_bind=''.

Suggested fix:
Improve GTID information in MySQL Log with information regarded to its usability; 

E.g; Appending the GTID information in the current output, letting the information empty according to the replication configuration GTID or BinLog:

2020-08-28T00:46:56.087557Z 6 [Note] 'CHANGE MASTER TO FOR CHANNEL '' executed'. Previous state master_host='127.0.0.1', master_port= 29630, gtid_purged='' , gtid_executed='',master_auto_position=', master_bind='
[24 Sep 2020 12:27] MySQL Verification Team
Hello Mr. Da Silva,

Thank you for your feature request.

I have analysed your proposal and I fully agree with it.

Verified as reported.