This issue is already fixed as part of MDEV:18300's fix.
Analysis: During the execution of stored procedure the table map event gets
written twice in the binlog as shown below. Observe that table map event is
written for INSERT statement as shown below. Because of this additional
table_map event slave reports an assert.
### UPDATE `test`.`t1`
|
### WHERE
|
### @1=1
|
### SET
|
### @1=0
|
# Number of rows: 1
|
# at 1461
|
# at 1512
|
#190610 13:40:01 server id 1 end_log_pos 1512 CRC32 0x047a074c Annotate_rows:
|
#Q> INSERT INTO t3 VALUES (NULL)
|
#190610 13:40:01 server id 1 end_log_pos 1557 CRC32 0x5213bc91 Table_map: `test`.`t1` mapped to number 33 (has triggers)
|
# at 1557
|
#190610 13:40:01 server id 1 end_log_pos 1602 CRC32 0x42051901 Table_map: `test`.`t2` mapped to number 35
|
# at 1602
|
#190610 13:40:01 server id 1 end_log_pos 1675 CRC32 0x79539423 Query thread_id=14 exec_time=0 error_code=0
|
SET TIMESTAMP=1560154201/*!*/;
|
COMMIT
|
/*!*/;
|
# at 1675
|
#190610 13:40:01 server id 1 end_log_pos 1717 CRC32 0x4d9da44c GTID 0-1-7 trans
|
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
|
BEGIN
|
/*!*/;
|
# at 1717
|
#190610 13:40:01 server id 1 end_log_pos 1762 CRC32 0x72308344 Table_map: `test`.`t3` mapped to number 34
|
# at 1762
|
#190610 13:40:01 server id 1 end_log_pos 1807 CRC32 0x974f13e4 Table_map: `test`.`t3` mapped to number 34
|
# at 1807
|
#190610 13:40:01 server id 1 end_log_pos 1841 CRC32 0x9c5e0f41 Write_rows: table id 34 flags: STMT_END_F
|
At the time of execution of INSERT statement on the master, code tries to read
the statistics of the table. Since the statistics are not available, system
tables are opened for reading stats and then they are closed. During this
process the pending events get written into binlog and they also clear
existing table_maps that were prepared during update statement. Hence when
code reaches a place where it has to write insert into the binary log it finds
no table maps and re-writes them once again. This leads to an assert on slave.
As part of MDEV-18300 patch 'read_statistics_for_tables_if_needed' is added
within "mysql_update" code. Since stats are already calculated during 'update'
statement execution the following 'insert' doesn't have to recalculate stats
and table_maps get retained so no additional table_map event is written.
Binlog is clear.
Hence closing this issue as fixed.
This issue is already fixed as part of MDEV:18300's fix.
Analysis: During the execution of stored procedure the table map event gets
written twice in the binlog as shown below. Observe that table map event is
written for INSERT statement as shown below. Because of this additional
table_map event slave reports an assert.
### UPDATE `test`.`t1`
### WHERE
### @1=1
### SET
### @1=0
# Number of rows: 1
# at 1461
# at 1512
#190610 13:40:01 server id 1 end_log_pos 1512 CRC32 0x047a074c Annotate_rows:
#Q> INSERT INTO t3 VALUES (NULL)
#190610 13:40:01 server id 1 end_log_pos 1557 CRC32 0x5213bc91 Table_map: `test`.`t1` mapped to number 33 (has triggers)
# at 1557
#190610 13:40:01 server id 1 end_log_pos 1602 CRC32 0x42051901 Table_map: `test`.`t2` mapped to number 35
# at 1602
#190610 13:40:01 server id 1 end_log_pos 1675 CRC32 0x79539423 Query thread_id=14 exec_time=0 error_code=0
SET TIMESTAMP=1560154201/*!*/;
COMMIT
/*!*/;
# at 1675
#190610 13:40:01 server id 1 end_log_pos 1717 CRC32 0x4d9da44c GTID 0-1-7 trans
/*!100001 SET @@session.gtid_seq_no=7*//*!*/;
BEGIN
/*!*/;
# at 1717
#190610 13:40:01 server id 1 end_log_pos 1762 CRC32 0x72308344 Table_map: `test`.`t3` mapped to number 34
# at 1762
#190610 13:40:01 server id 1 end_log_pos 1807 CRC32 0x974f13e4 Table_map: `test`.`t3` mapped to number 34
# at 1807
#190610 13:40:01 server id 1 end_log_pos 1841 CRC32 0x9c5e0f41 Write_rows: table id 34 flags: STMT_END_F
At the time of execution of INSERT statement on the master, code tries to read
the statistics of the table. Since the statistics are not available, system
tables are opened for reading stats and then they are closed. During this
process the pending events get written into binlog and they also clear
existing table_maps that were prepared during update statement. Hence when
code reaches a place where it has to write insert into the binary log it finds
no table maps and re-writes them once again. This leads to an assert on slave.
As part of
MDEV-18300patch 'read_statistics_for_tables_if_needed' is addedwithin "mysql_update" code. Since stats are already calculated during 'update'
statement execution the following 'insert' doesn't have to recalculate stats
and table_maps get retained so no additional table_map event is written.
Binlog is clear.
Hence closing this issue as fixed.