Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
3 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters