mirror of
https://github.com/MariaDB/server.git
synced 2025-10-24 16:38:14 +02:00
close_thread_tables() would not flush pending row events to the binlog cache in certain conditions if LOCK TABLES was active. This could result in the row events being binlogged without STMT_END_F flag, and eventually leave the THD in an invalid state that triggered assertions later. Reviewed-by: Monty <monty@mariadb.org> Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
33 lines
996 B
Text
33 lines
996 B
Text
--source include/have_innodb.inc
|
|
--source include/have_binlog_format_row.inc
|
|
|
|
RESET MASTER;
|
|
|
|
# This sequence of statements triggered a bug, where the pending LOCK TABLES
|
|
# would skip flusing the pending row event for INSERT to the trx cache. And
|
|
# Then the pending event would be overwritten by the SAVEPOINT, leaving an
|
|
# invalid state in the THD. And then a later connection would pick the THD
|
|
# with invalid state and trigger an assertion.
|
|
--connect (con1,localhost,root,,)
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
|
CREATE TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END;
|
|
LOCK TABLES t1 WRITE;
|
|
--error ER_TABLE_NOT_LOCKED
|
|
LOAD DATA INFILE 'x' INTO TABLE x;
|
|
SET AUTOCOMMIT= OFF;
|
|
INSERT INTO t1 VALUES (1);
|
|
SAVEPOINT A;
|
|
COMMIT;
|
|
--disconnect con1
|
|
|
|
--connect (con2,localhost,root,,)
|
|
SELECT 1;
|
|
|
|
# Cleanup
|
|
--disconnect con2
|
|
--connection default
|
|
# Show the binlog events.
|
|
# When the bug occurs, the Write_rows event is missing STMT_END_F.
|
|
--source include/show_binlog_events.inc
|
|
|
|
DROP TABLE t1;
|