-
Sujatha Sivakumar authored
EXECUTED_GTID_SET Problem: ======== Under certain circumstances it is possible that Retrieved_Gtid_Set on slave will contain gaps while actually no gaps will be in Executed_Gtid_Set and slave binary logs. This happens when slave rotates relay log in such a way that last event contains record which sets GTID_NEXT, then following log contains few GTIDs, then slave restarts. After restart GTIDs for Retrieved_Gtid_Set executed wrongly and there are phantom gaps. Analysis: ======== Let us consider a scenario where gtid set 1-3 is written to relay log and we are about to write the 4th GTID event. Existing code first writes the events to relay log and then adds the new GTID to the Retrieved_Gtid_Set. If a rotation happens at this moment after writing the GTID event the newly written relay log will have the Previous_Gtid set as 1-3. If a restart happens at this scenario and few more gtids are present after this event the Retrieved_Gtid_set will have gaps like 1-3:5-6 and 4th GTID will be a gap. Fix: === Add the gtid to the Retrieved_Gtid_Set before writing the actual event to the relay log. If due to some reason writing to relay log fails remove the GTID from the Retrieved_Gtid_Set.
Sujatha Sivakumar authoredEXECUTED_GTID_SET Problem: ======== Under certain circumstances it is possible that Retrieved_Gtid_Set on slave will contain gaps while actually no gaps will be in Executed_Gtid_Set and slave binary logs. This happens when slave rotates relay log in such a way that last event contains record which sets GTID_NEXT, then following log contains few GTIDs, then slave restarts. After restart GTIDs for Retrieved_Gtid_Set executed wrongly and there are phantom gaps. Analysis: ======== Let us consider a scenario where gtid set 1-3 is written to relay log and we are about to write the 4th GTID event. Existing code first writes the events to relay log and then adds the new GTID to the Retrieved_Gtid_Set. If a rotation happens at this moment after writing the GTID event the newly written relay log will have the Previous_Gtid set as 1-3. If a restart happens at this scenario and few more gtids are present after this event the Retrieved_Gtid_set will have gaps like 1-3:5-6 and 4th GTID will be a gap. Fix: === Add the gtid to the Retrieved_Gtid_Set before writing the actual event to the relay log. If due to some reason writing to relay log fails remove the GTID from the Retrieved_Gtid_Set.
Loading