diff options
author | unknown <ingo@mysql.com> | 2005-03-02 10:35:00 +0100 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2005-03-02 10:35:00 +0100 |
commit | 26f75ffc83e39ee915e8d4973955c950ddabb35b (patch) | |
tree | 26e67311fd029bf9026836ac8fe24ecb83ac29e1 /mysql-test/t/myisam.test | |
parent | 22e0b300a47321ec8dfef0bb8bc5f7c0f1449ce1 (diff) | |
download | mariadb-git-26f75ffc83e39ee915e8d4973955c950ddabb35b.tar.gz |
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.
Diffstat (limited to 'mysql-test/t/myisam.test')
-rw-r--r-- | mysql-test/t/myisam.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index c8ed7910b76..0babd1f9401 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -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; + |