Bug #72314 stop io_thread, start io_thread with GTID may cause data inconsistencies
Submitted: 11 Apr 2014 5:04 Modified: 25 Feb 2015 5:01
Reporter: Santosh Praneeth Banda Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: replication

[11 Apr 2014 5:04] Santosh Praneeth Banda
Description:
This is similar to http://bugs.mysql.com/bug.php?id=69943 but doesn't cause entire transaction to miss.

steps leading to this scenario. Note that sql_thread is not stopped at all during these steps

slave IO_thread writes a partial transaction in the relay log before it restarts

end of relay_log_1

set @@global.gtid_next='master_uid:100';
begin;
insert into t1 values(1);

ROTATE EVENT to relay_log_2

relay_log_2

set @@global.gtid_next='master_uid:100';
begin;
insert into t1 values(1);
insert into t1 values(2);
commit;

The fix for http://bugs.mysql.com/bug.php?id=69943 causes master to resend the gtid master_uuid:100.

But slave sql_thread executes the partial transaction before completely executing the full transaction which may cause data inconsistencies between master and slave

** Rows on master

select * from t1;
1
2

** Rows on slave

select * from t1;
1
1
2

How to repeat:
Explained in description. You may use the script mentioned in bug #69943

Suggested fix:
when using GTID protocol sql_thread must rollback a transaction on seeing a format description event from master.
[5 May 2014 7:00] MySQL Verification Team
Hello Santosh,

Thank you for the bug report.
I cannot repeat described behavior with the old test case provided in Bug #69943.
Do you have simplified test to reproduce this issue?
Also, Is this similar to Bug #72392?

Thanks,
Umesh
[6 Jun 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[25 Feb 2015 5:01] MySQL Verification Team
This issue has been fixed as part of internal Bug #18472603 and with
change log entry as in 5.6.21
http://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-21.html:

"When using GTIDs with MASTER_AUTO_POSITION enabled, if an I/O thread was restarted it failed with an ER_GTID_NEXT_TYPE_UNDEFINED_GROUP error due to a partial transaction not being correctly rolled back before resuming the I/O thread. This fix ensures that the partial transaction is correctly rolled back. (Bug #18472603)".