mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#8306 - TRUNCATE leads to index corruption
Added a check, if the table, which we are going to create, is open. This can happen if a MERGE mapped table is TRUNCATEd. myisam/mi_open.c: Bug#8306 - TRUNCATE leads to index corruption Made test_if_reopen() globally available. myisam/myisamdef.h: Bug#8306 - TRUNCATE leads to index corruption Declared test_if_reopen() as globally available. mysql-test/r/myisam.result: Bug#8306 - TRUNCATE leads to index corruption The test result. mysql-test/t/myisam.test: Bug#8306 - TRUNCATE leads to index corruption The test case.
This commit is contained in:
@ -524,3 +524,29 @@ explain select count(*) from t1 where a is null;
|
||||
select count(*) from t1 where a is null;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #8306: TRUNCATE leads to index corruption
|
||||
#
|
||||
create table t1 (c1 int, index(c1));
|
||||
create table t2 (c1 int, index(c1)) engine=merge union=(t1);
|
||||
insert into t1 values (1);
|
||||
# Close all tables.
|
||||
flush tables;
|
||||
# Open t2 and (implicitly) t1.
|
||||
select * from t2;
|
||||
# Truncate after flush works (unless another threads reopens t2 in between).
|
||||
flush tables;
|
||||
truncate table t1;
|
||||
insert into t1 values (1);
|
||||
# Close all tables.
|
||||
flush tables;
|
||||
# Open t2 and (implicitly) t1.
|
||||
select * from t2;
|
||||
# Truncate t1, wich was not recognized as open without the bugfix.
|
||||
# Now, it should fail with a table-in-use error message.
|
||||
--error 1105
|
||||
truncate table t1;
|
||||
# The insert used to fail on the crashed table.
|
||||
insert into t1 values (1);
|
||||
drop table t1,t2;
|
||||
|
||||
|
Reference in New Issue
Block a user