Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.11, 11.4
-
None
Description
Something appears to have gone very wrong with the patch in MDEV-37356. It changed the way how annotate event is written, and now it appears it can be written in a way that is completely wrong. Tested on 11.4:
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
--source include/have_binlog_format_mixed.inc
|
|
|
CREATE SEQUENCE s;
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT DEFAULT (NEXTVAL(s)), c LONGBLOB) ENGINE=InnoDB;
|
CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c LONGBLOB) ENGINE=MyISAM;
|
|
|
BEGIN;
|
INSERT INTO t1 VALUES (1, 0, '');
|
INSERT INTO t2 VALUES (2, 0, '');
|
INSERT INTO t1 VALUES (3, 0, '');
|
COMMIT;
|
SHOW BINLOG EVENTS;
|
|
|
DROP TABLE t1;
|
DROP TABLE t2;
|
DROP SEQUENCE s;
|
The annotate event and table map event ends up in the GTID 0-1-4 which doesn't even have a row event, it's a Query event. And the annotate event for second INSERT of the GTID 0-1-5 is lost:
SHOW BINLOG EVENTS;
|
Log_name Pos Event_type Server_id End_log_pos Info
|
master-bin.000001 4 Format_desc 1 256 Server ver: 11.4.9-MariaDB-debug-log, Binlog ver: 4
|
master-bin.000001 256 Gtid_list 1 285 []
|
master-bin.000001 285 Binlog_checkpoint 1 329 master-bin.000001
|
master-bin.000001 329 Gtid 1 371 GTID 0-1-1
|
master-bin.000001 371 Query 1 464 use `test`; CREATE SEQUENCE s
|
master-bin.000001 464 Gtid 1 506 GTID 0-1-2
|
master-bin.000001 506 Query 1 671 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b INT DEFAULT (NEXTVAL(s)), c LONGBLOB) ENGINE=InnoDB
|
master-bin.000001 671 Gtid 1 713 GTID 0-1-3
|
master-bin.000001 713 Query 1 857 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c LONGBLOB) ENGINE=MyISAM
|
master-bin.000001 857 Gtid 1 899 BEGIN GTID 0-1-4
|
master-bin.000001 899 Annotate_rows 1 0 INSERT INTO t1 VALUES (1, 0, '')
|
master-bin.000001 954 Table_map 1 0 table_id: 33 (test.s)
|
master-bin.000001 1005 Query 1 0 use `test`; INSERT INTO t2 VALUES (2, 0, '')
|
master-bin.000001 1104 Query 1 1177 COMMIT
|
master-bin.000001 1177 Gtid 1 1219 BEGIN GTID 0-1-5
|
master-bin.000001 1219 Table_map 1 0 table_id: 34 (test.t1)
|
master-bin.000001 1267 Write_rows_v1 1 0 table_id: 34 flags: STMT_END_F
|
master-bin.000001 1313 Table_map 1 0 table_id: 34 (test.t1)
|
master-bin.000001 1361 Write_rows_v1 1 0 table_id: 34 flags: STMT_END_F
|
master-bin.000001 1407 Xid 1 1438 COMMIT /* xid=36 */
|
I believe there will be other consequences from the MDEV-37356. The rules for when and how the stmt cache is used with trx cache are very complex, and there are likely other corner cases as well where code like this will incorrectly put things in the stmt cache:
/*
|
We write the Annotate_rows to the non_transactional cache if there
|
is a single non-transactional table and OPTION_GTID_BEGIN is not
|
set. If not we write to the transactional cache. This ensures
|
that the Annotate_rows events are written before any table maps
|
events to the binary log.
|
*/
|
|
|
if (binlog_write_annotated_row(binlog_using_only_trans_tables ||
|
variables.option_bits & OPTION_GTID_BEGIN))
|
DBUG_RETURN(1);
|
Attachments
Issue Links
- is caused by
-
MDEV-37356 Annotate_rows written in a 'random' position
-
- Closed
-