mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER
don't simply set tdc->flushed, use flush_unused(1) that removes opened but unused TABLE instances (that would otherwise prevent TABLE_SHARE from being closed by keeping the ref_count>0).
This commit is contained in:
56
mysql-test/main/alter_table_online.result
Normal file
56
mysql-test/main/alter_table_online.result
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#
|
||||||
|
# MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER
|
||||||
|
#
|
||||||
|
create table t (a char(1));
|
||||||
|
insert into t values ('a'),('b');
|
||||||
|
select * from t join t as t2 join t as t3;
|
||||||
|
a a a
|
||||||
|
a a a
|
||||||
|
b a a
|
||||||
|
a b a
|
||||||
|
b b a
|
||||||
|
a a b
|
||||||
|
b a b
|
||||||
|
a b b
|
||||||
|
b b b
|
||||||
|
alter table t modify a int;
|
||||||
|
ERROR 22007: Truncated incorrect INTEGER value: 'a'
|
||||||
|
select * from t;
|
||||||
|
a
|
||||||
|
a
|
||||||
|
b
|
||||||
|
drop table t;
|
||||||
|
create table t (c double precision key,c2 char,c3 year);
|
||||||
|
insert into t values (7,3,1);
|
||||||
|
select a from t where a=all (select a from t where b=2 union select a from t where b=2);
|
||||||
|
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||||
|
insert into t values (3,1,1);
|
||||||
|
alter table t change c c date,add key(c);
|
||||||
|
ERROR 22007: Incorrect date value: '7' for column `test`.`t`.`c` at row 1
|
||||||
|
select * from t;
|
||||||
|
c c2 c3
|
||||||
|
7 3 2001
|
||||||
|
3 1 2001
|
||||||
|
drop table t;
|
||||||
|
set sql_mode='';
|
||||||
|
create table t (c char unique,c2 int,stamp timestamp);
|
||||||
|
insert into t values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
|
||||||
|
Warnings:
|
||||||
|
Warning 1265 Data truncated for column 'stamp' at row 1
|
||||||
|
Warning 1265 Data truncated for column 'stamp' at row 2
|
||||||
|
Warning 1265 Data truncated for column 'stamp' at row 3
|
||||||
|
Warning 1265 Data truncated for column 'stamp' at row 4
|
||||||
|
Warning 1265 Data truncated for column 'stamp' at row 5
|
||||||
|
update t set c=(select * from t) where c in (select * from t);
|
||||||
|
ERROR 21000: Operand should contain 1 column(s)
|
||||||
|
alter table t modify c date;
|
||||||
|
ERROR 23000: Duplicate entry '0000-00-00' for key 'c'
|
||||||
|
select * from t;
|
||||||
|
c c2 stamp
|
||||||
|
1 1 0000-00-00 00:00:00
|
||||||
|
2 2 0000-00-00 00:00:00
|
||||||
|
3 3 0000-00-00 00:00:00
|
||||||
|
4 4 0000-00-00 00:00:00
|
||||||
|
5 5 0000-00-00 00:00:00
|
||||||
|
drop table t;
|
||||||
|
set sql_mode=default;
|
35
mysql-test/main/alter_table_online.test
Normal file
35
mysql-test/main/alter_table_online.test
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
--source include/binlog_combinations.inc
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t (a char(1));
|
||||||
|
insert into t values ('a'),('b');
|
||||||
|
select * from t join t as t2 join t as t3;
|
||||||
|
--error ER_TRUNCATED_WRONG_VALUE
|
||||||
|
alter table t modify a int;
|
||||||
|
select * from t;
|
||||||
|
drop table t;
|
||||||
|
|
||||||
|
create table t (c double precision key,c2 char,c3 year);
|
||||||
|
insert into t values (7,3,1);
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
select a from t where a=all (select a from t where b=2 union select a from t where b=2);
|
||||||
|
insert into t values (3,1,1);
|
||||||
|
--error ER_TRUNCATED_WRONG_VALUE
|
||||||
|
alter table t change c c date,add key(c);
|
||||||
|
select * from t;
|
||||||
|
drop table t;
|
||||||
|
|
||||||
|
set sql_mode='';
|
||||||
|
create table t (c char unique,c2 int,stamp timestamp);
|
||||||
|
insert into t values (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5);
|
||||||
|
--error ER_OPERAND_COLUMNS
|
||||||
|
update t set c=(select * from t) where c in (select * from t);
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
alter table t modify c date;
|
||||||
|
select * from t;
|
||||||
|
drop table t;
|
||||||
|
set sql_mode=default;
|
@ -12014,7 +12014,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
|||||||
}
|
}
|
||||||
else if (online) // error was on copy stage
|
else if (online) // error was on copy stage
|
||||||
{
|
{
|
||||||
from->s->tdc->flushed= 1; // to free the binlog
|
from->s->tdc->flush_unused(1); // to free the binlog
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user