Skip to content

Commit

Permalink
MDEV-28550 improper handling of replication event group that contains
Browse files Browse the repository at this point in the history
GTID_LIST_EVENT or INCIDENT_EVENT.

It's legal to have either of the two inside a group. E.g
  Gtid_event, Gtid_log_list_event, Query_1, ... Xid_log_event
is permitted.
However, the slave IO thread treated both
as the terminal even when the group represents a DDL query.
That causes a premature Gtid state update so the slave IO would think
the whole group has been collected while in fact Query_1 etc are yet to process.

Fixed with correcting a condition to compute the terminal event
of the group.
Tested with rpl_mysqlbinlog_slave_consistency (of 10.9) and
rpl_gtid_errorlog.test.
  • Loading branch information
andrelkin authored and vuvova committed May 13, 2022
1 parent a5dc12e commit 726bd8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sql/slave.cc
Expand Up @@ -6586,8 +6586,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
mi->using_gtid != Master_info::USE_GTID_NO &&
mi->events_queued_since_last_gtid > 0 &&
( (mi->last_queued_gtid_standalone &&
!Log_event::is_part_of_group((Log_event_type)(uchar)
buf[EVENT_TYPE_OFFSET])) ||
(LOG_EVENT_IS_QUERY((Log_event_type)(uchar)
buf[EVENT_TYPE_OFFSET]) ||
(uchar)buf[EVENT_TYPE_OFFSET] == INCIDENT_EVENT)) ||
(!mi->last_queued_gtid_standalone &&
((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT ||
((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && /* QUERY_COMPRESSED_EVENT would never be commmit or rollback */
Expand Down

0 comments on commit 726bd8c

Please sign in to comment.