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