Commit d1e4c5d1 authored by Aleksey Midenkov's avatar Aleksey Midenkov Committed by Eugene Kosov

MDEV-14748 Assertion in ha_myisammrg::attach_children() [fixes #434]

parent 9daf583a
......@@ -345,7 +345,7 @@ partition by system_time interval 1 day (
partition p1 history,
partition pc current);
create or replace table t2 (f int);
create trigger tr before insert on t2
create or replace 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);
......@@ -355,7 +355,7 @@ 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
create or replace trigger tr before insert on t2
for each row select count(*) from t1 into @a;
insert into t2 values (1);
# MDEV-14741 Assertion `(trx)->start_file == 0' failed in row_truncate_table_for_mysql()
......@@ -366,11 +366,22 @@ partition pn current);
set autocommit= off;
truncate table t1;
set autocommit= on;
MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
# MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
create or replace table t1 (x int) with system versioning;
lock table t1 write;
alter table t1 partition by system_time interval 1 week (
partition p1 history,
partition pn current);
drop table t1;
drop table t2;
unlock tables;
# MDEV-14748 Assertion in ha_myisammrg::attach_children()
create or replace table t1 (x int) engine=myisam with system versioning
partition by system_time interval 1 month (partition p1 history, partition pn current);
create or replace table t2 (x int) engine=myisam;
create or replace table t3 (x int) engine=merge union=(t2);
create or replace table t4 (x int) engine=myisam;
create or replace trigger tr after insert on t4 for each row insert into t2
( select x from t3 ) union ( select x from t1 );
insert into t4 values (1);
# Test cleanup
drop database test;
create database test;
......@@ -290,7 +290,7 @@ partition by system_time interval 1 day (
partition p1 history,
partition pc current);
create or replace table t2 (f int);
create trigger tr before insert on t2
create or replace 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);
......@@ -301,7 +301,7 @@ 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
create or replace trigger tr before insert on t2
for each row select count(*) from t1 into @a;
insert into t2 values (1);
......@@ -314,14 +314,24 @@ set autocommit= off;
truncate table t1;
set autocommit= on;
--echo MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
--echo # MDEV-14747 ALTER PARTITION BY SYSTEM_TIME after LOCK TABLES
create or replace table t1 (x int) with system versioning;
lock table t1 write;
alter table t1 partition by system_time interval 1 week (
partition p1 history,
partition pn current);
drop table t1;
drop table t2;
-- source suite/versioning/common_finish.inc
unlock tables;
--echo # MDEV-14748 Assertion in ha_myisammrg::attach_children()
create or replace table t1 (x int) engine=myisam with system versioning
partition by system_time interval 1 month (partition p1 history, partition pn current);
create or replace table t2 (x int) engine=myisam;
create or replace table t3 (x int) engine=merge union=(t2);
create or replace table t4 (x int) engine=myisam;
create or replace trigger tr after insert on t4 for each row insert into t2
( select x from t3 ) union ( select x from t1 );
insert into t4 values (1);
--echo # Test cleanup
drop database test;
create database test;
......@@ -1038,6 +1038,7 @@ class Table_locker
thr_lock_type saved_type;
MYSQL_LOCK *saved_lock;
enum_locked_tables_mode saved_mode;
TABLE_LIST **saved_query_tables_own_last;
TABLE_LIST table_list;
bool locked;
......@@ -1048,6 +1049,7 @@ class Table_locker
saved_type(table.reginfo.lock_type),
saved_lock(_thd->lock),
saved_mode(_thd->locked_tables_mode),
saved_query_tables_own_last(_thd->lex->query_tables_own_last),
table_list(_table, lock_type),
locked(false)
{
......@@ -1064,6 +1066,7 @@ class Table_locker
}
thd->lock= NULL;
thd->locked_tables_mode= LTM_NONE;
thd->lex->query_tables_own_last= NULL;
bool res= lock_tables(thd, &table_list, 1, 0);
locked= !res;
return res;
......@@ -1075,6 +1078,7 @@ class Table_locker
table.reginfo.lock_type= saved_type;
thd->lock= saved_lock;
thd->locked_tables_mode= saved_mode;
thd->lex->query_tables_own_last= saved_query_tables_own_last;
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