Commit 6765cc60 authored by Monty's avatar Monty

Fixed assertion Assertion `!table->pos_in_locked_tables' failed

MDEV-17717
Assertion `!table->pos_in_locked_tables' failed in tc_release_table on
flushing RocksDB table under SERIALIZABLE
MDEV-17998
Deadlock and eventual Assertion `!table->pos_in_locked_tables' failed
in tc_release_table on KILL_TIMEOUT
MDEV-19591
Assertion `!table->pos_in_locked_tables' failed in tc_release_table upon
altering table into S3 under lock.

The problem was that thd->open_tables->pos_in_locked_tables was not reset
when alter table failed to reopen a locked table.
parent dbac2039
......@@ -399,3 +399,20 @@ DROP USER u1@localhost;
SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
set global sql_mode=default;
#
# MDEV-17998
# Deadlock and eventual Assertion `!table->pos_in_locked_tables' failed
# in tc_release_table on KILL_TIMEOUT
#
SET max_statement_time= 2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT, c INT);
LOCK TABLES v1 READ, t2 WRITE, t1 WRITE;
ALTER TABLE t1 CHANGE f1 f2 DOUBLE;
Got one of the listed errors
ALTER TABLE t2 DROP c;
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
UNLOCK TABLES;
DROP VIEW v1;
DROP TABLE t1, t2;
......@@ -642,3 +642,24 @@ SET DEBUG_SYNC = 'RESET';
DROP FUNCTION MY_KILL;
set global sql_mode=default;
--echo #
--echo # MDEV-17998
--echo # Deadlock and eventual Assertion `!table->pos_in_locked_tables' failed
--echo # in tc_release_table on KILL_TIMEOUT
--echo #
SET max_statement_time= 2;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (b INT, c INT);
LOCK TABLES v1 READ, t2 WRITE, t1 WRITE;
--error ER_BAD_FIELD_ERROR,ER_STATEMENT_TIMEOUT
ALTER TABLE t1 CHANGE f1 f2 DOUBLE;
--error ER_STATEMENT_TIMEOUT
ALTER TABLE t2 DROP c;
UNLOCK TABLES;
DROP VIEW v1;
DROP TABLE t1, t2;
......@@ -2371,6 +2371,7 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
DBUG_ASSERT(thd->open_tables == m_reopen_array[reopen_count]);
thd->open_tables->pos_in_locked_tables->table= NULL;
thd->open_tables->pos_in_locked_tables= 0;
close_thread_table(thd, &thd->open_tables);
}
......
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=RocksDB;
LOCK TABLE t1 WRITE;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
FLUSH TABLES;
ERROR HY000: MyRocks supports only READ COMMITTED and REPEATABLE READ isolation levels. Please change from current isolation level SERIALIZABLE
DROP TABLE t1;
--source include/have_binlog_format_row.inc
--source include/have_rocksdb.inc
CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=RocksDB;
LOCK TABLE t1 WRITE;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--error ER_ISOLATION_MODE_NOT_SUPPORTED
FLUSH TABLES;
DROP TABLE t1;
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