Bug #90334 slave Retrieved_Gtid_Set is empty,slave unable to Retrieve next gtid set
Submitted: 7 Apr 2018 21:09 Modified: 28 May 2018 16:07
Reporter: mohamed atef Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S1 (Critical)
Version:5.7.21 OS:Windows
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: slave unable to Retrieve next gtid set

[7 Apr 2018 21:09] mohamed atef
Description:
i have replication between master and slave
when executing show slave status it show that slave is reading master bin file 000002 but master now had reached to bin 000009
Slave_IO_Running yes
Slave_SQL_Running yes
Seconds_Behind_Master 0
Master_Log_File ph12-bin.000002

the gtid_executed in slave was 173531a7-1623-11e8-b5fd-64006a514930:19293 
i inject the next gtid
STOP SLAVE;
SET GTID_NEXT="173531a7-1623-11e8-b5fd-64006a514930:19294";
BEGIN; COMMIT;
SET GTID_NEXT="AUTOMATIC";
START SLAVE;
after that 
Retrieved_Gtid_Set
173531a7-1623-11e8-b5fd-64006a514930:19295

slave unable to Retrieve next gtid set

show master status on slave show that the executed gtid is
173531a7-1623-11e8-b5fd-64006a514930:1-19295

show master status on master show that the executed gtid is
173531a7-1623-11e8-b5fd-64006a514930:1-68608

on master show binary logs;

Log_name  File_size
ph12-bin.000001	674570
ph12-bin.000002	52081040
ph12-bin.000003	28089212
ph12-bin.000004	42215390
ph12-bin.000005	50111518
ph12-bin.000006	5678341
ph12-bin.000007	100228
ph12-bin.000008	60530037
ph12-bin.000009	6847051

the next gtid from master binlog file 
# at 10778216
#180322 13:01:37 server id 1012  end_log_pos 10778281 CRC32 0x4807702e 	GTID	last_committed=15599	sequence_number=15600	rbr_only=yes
/*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/;
SET @@SESSION.GTID_NEXT= '173531a7-1623-11e8-b5fd-64006a514930:19296'/*!*/;
# at 10778281
#180322 13:01:37 server id 1012  end_log_pos 10778362 CRC32 0xd16dff77 	Query	thread_id=155	exec_time=0	error_code=0
SET TIMESTAMP=1521712897/*!*/;
SET @@session.sql_mode=1344274432/*!*/;
BEGIN
/*!*/;
# at 10778362
#180322 13:01:37 server id 1012  end_log_pos 10778502 CRC32 0x639cec29 	Table_map: `abc`.`receipts_no` mapped to number 880
# at 10778502
#180322 13:01:37 server id 1012  end_log_pos 10779114 CRC32 0x3ef898e7 	Update_rows: table id 880 flags: STMT_END_F
### UPDATE `abc`.`receipts_no`
### WHERE
###   @1=12180000000001637
###   @2='POINT 12'
###   @3=1521711821
###   @4=NULL
###   @5='OMAHDY'
###   @6=0
###   @7=0
###   @8=0
###   @9=0
###   @10=0
###   @11=0
###   @12=0
###   @13=0
###   @14=0
###   @15=1
###   @16='2018:03:22'
###   @17=0
###   @18=0
###   @19=0
###   @20=23
###   @21=1
###   @22='798KH62'
###   @23=0
###   @24=1
###   @25=0
###   @26=1
###   @27='A4490B24A4134B74ADB36BD756368651'
###   @28=NULL
###   @29=0
###   @30=0
###   @31=0
###   @32=0
###   @33=400
###   @34=100
###   @35=2
###   @36=NULL
###   @37=0
###   @38=NULL
###   @39=0
### SET
###   @1=12180000000001637
###   @2='POINT 12'
###   @3=1521711821
###   @4=1521712897
###   @5='OMAHDY'
###   @6=5
###   @7=5
###   @8=5
###   @9=0
###   @10=0
###   @11=0
###   @12=0
###   @13=0
###   @14=0
###   @15=1
###   @16='2018:03:22'
###   @17=0
###   @18=0
###   @19=0
###   @20=23
###   @21=1
###   @22='798KH62'
###   @23=0
###   @24=1
###   @25=0
###   @26=1
###   @27='A4490B24A4134B74ADB36BD756368651'
###   @28=NULL
###   @29=0
###   @30=0
###   @31=0
###   @32=0
###   @33=400
###   @34=100
###   @35=2
###   @36=NULL
###   @37=0
###   @38=NULL
###   @39=0
# at 10779114

How to repeat:
mysql replication between two servers on windows 

using 

change master to master_host='192.168.12.100',
master_port=3306,
master_user='bahrisync',
master_password ='218b',
master_auto_position =1 FOR channel 'pt112';

start slave FOR channel 'pt112'
[22 May 2018 13:52] MySQL Verification Team
Hi,

I don't believe this is a bug.

Instead of:

> SET GTID_NEXT="AUTOMATIC";
> START SLAVE;

you should, as documented do:

mysql> SET GTID_NEXT=automatic;
mysql> RESET SLAVE;
mysql> START SLAVE;

as documented https://dev.mysql.com/doc/refman/5.7/en/reset-slave.html

Note that all relay log files will be deleted, even if they have not been completely executed by the slave SQL thread. (This is a condition likely to exist on a replication slave if you have issued a STOP SLAVE statement or if the slave is highly loaded.)
[28 May 2018 16:07] MySQL Verification Team
I cannot reproduce this behavior.

After this "injection" of the GTID did the slave continue to work as expected?

all best
Bogdan