Commit 9b5d1d98 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Bug #53757 assert in mysql_truncate_by_delete

The assert was triggered if a connection executing TRUNCATE
on a InnoDB table was killed during open_tables.

This bug was fixed in the scope of Bug #45643
"InnoDB does not support replication of TRUNCATE TABLE".

This patch adds test coverage to innodb_mysql_sync.test.
parent a1c6a39a
......@@ -48,3 +48,21 @@ Warnings:
Error 1146 Table 'test.t1' doesn't exist
# Connection default
SET DEBUG_SYNC= "RESET";
#
# Bug#53757 assert in mysql_truncate_by_delete
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(a INT) Engine=InnoDB;
CREATE TABLE t2(id INT);
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES(connection_id());
SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
# Sending: (not reaped since connection is killed later)
TRUNCATE t1;
SET DEBUG_SYNC= "now WAIT_FOR opening";
SELECT ((@id := id) - id) FROM t2;
((@id := id) - id)
0
KILL @id;
SET DEBUG_SYNC= "now SIGNAL killed";
DROP TABLE t1, t2;
......@@ -80,6 +80,32 @@ disconnect con1;
SET DEBUG_SYNC= "RESET";
--echo #
--echo # Bug#53757 assert in mysql_truncate_by_delete
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1(a INT) Engine=InnoDB;
CREATE TABLE t2(id INT);
INSERT INTO t1 VALUES (1), (2);
connect (con1, localhost, root);
INSERT INTO t2 VALUES(connection_id());
SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
--echo # Sending: (not reaped since connection is killed later)
--send TRUNCATE t1
connection default;
SET DEBUG_SYNC= "now WAIT_FOR opening";
SELECT ((@id := id) - id) FROM t2;
KILL @id;
SET DEBUG_SYNC= "now SIGNAL killed";
DROP TABLE t1, t2;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
......@@ -4429,6 +4429,7 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
bool error= FALSE;
bool safe_to_ignore_table= FALSE;
DBUG_ENTER("open_and_process_table");
DEBUG_SYNC(thd, "open_and_process_table");
/*
Ignore placeholders for derived tables. After derived tables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment