Commit 1e8eae40 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14740 Locking assertion for system_time partitioning

Assertion `thd->locked_tables_mode <= LTM_LOCK_TABLES ||
!thd->lex->requires_prelocking()' failed in lock_tables().
parent d6b68b0e
......@@ -345,5 +345,14 @@ create trigger tr before insert on t2
for each row select table_rows from information_schema.tables
where table_name = 't1' into @a;
insert into t2 values (1);
# MDEV-14740 Locking assertion for system_time partitioning
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 week (
partition p1 history,
partition pn current);
create or replace table t2 (f int);
create trigger tr before insert on t2
for each row select count(*) from t1 into @a;
insert into t2 values (1);
drop table t1;
drop table t2;
......@@ -293,6 +293,16 @@ for each row select table_rows from information_schema.tables
where table_name = 't1' into @a;
insert into t2 values (1);
--echo # MDEV-14740 Locking assertion for system_time partitioning
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 week (
partition p1 history,
partition pn current);
create or replace table t2 (f int);
create trigger tr before insert on t2
for each row select count(*) from t1 into @a;
insert into t2 values (1);
drop table t1;
drop table t2;
......
......@@ -1035,18 +1035,20 @@ class Table_locker
{
THD *thd;
TABLE &table;
thr_lock_type saved_mode;
TABLE_LIST table_list;
thr_lock_type saved_type;
MYSQL_LOCK *saved_lock;
enum_locked_tables_mode saved_mode;
TABLE_LIST table_list;
bool locked;
public:
Table_locker(THD *_thd, TABLE &_table, thr_lock_type lock_type) :
thd(_thd),
table(_table),
saved_mode(table.reginfo.lock_type),
table_list(_table, lock_type),
saved_type(table.reginfo.lock_type),
saved_lock(_thd->lock),
saved_mode(_thd->locked_tables_mode),
table_list(_table, lock_type),
locked(false)
{
table.reginfo.lock_type= lock_type;
......@@ -1066,8 +1068,9 @@ class Table_locker
{
if (locked)
mysql_unlock_tables(thd, thd->lock);
table.reginfo.lock_type= saved_mode;
table.reginfo.lock_type= saved_type;
thd->lock= saved_lock;
thd->locked_tables_mode= saved_mode;
if (locked && !thd->in_sub_stmt)
ha_commit_trans(thd, false);
}
......
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