diff options
author | unknown <ingo@mysql.com> | 2005-11-03 18:24:12 +0100 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2005-11-03 18:24:12 +0100 |
commit | 7d183320b0e9b271efe6017986b904b694d32310 (patch) | |
tree | c3ca1a40df1fd7e30f368b25968541b4f333b1a2 /mysql-test/t/handler.test | |
parent | a1d92b8a1b289bbb6a983ba58034b6df5c1f91b9 (diff) | |
download | mariadb-git-7d183320b0e9b271efe6017986b904b694d32310.tar.gz |
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Version for 4.0.
It fixes two problems:
1. The cause of the bug was that we did not check the table version for
the HANDLER ... READ commands. We did not notice when a table was
replaced by a new one. This can happen during ALTER TABLE, REPAIR
TABLE, and OPTIMIZE TABLE (there might be more cases). I call the fix
for this problem "the primary bug fix".
2. mysql_ha_flush() was not always called with a locked LOCK_open.
Though the function comment clearly said it must.
I changed the code so that the locking is done when required. I call
the fix for this problem "the secondary fix".
mysql-test/r/handler.result:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The test result.
mysql-test/t/handler.test:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The test case.
sql/mysql_priv.h:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed a definition for the secondary fix.
sql/sql_base.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed function calls for the secondary fix.
sql/sql_class.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed a function call for the secondary fix.
sql/sql_handler.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
The first two diffs make the primary bug fix.
The rest is for the secondary fix.
sql/sql_table.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Changed function calls for the secondary fix.
Diffstat (limited to 'mysql-test/t/handler.test')
-rw-r--r-- | mysql-test/t/handler.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 53fe8c0a059..d91587b8070 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -339,3 +339,32 @@ drop table t2; drop table t3; drop table t4; drop table t5; + +# +# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash +# +create table t1 (c1 int); +insert into t1 values (1); +# client 1 +handler t1 open; +handler t1 read first; +# client 2 +connect (con2,localhost,root,,); +connection con2; +--exec echo send the below to another connection, do not wait for the result +send optimize table t1; +--sleep 1 +# client 1 +--exec echo proceed with the normal connection +connection default; +handler t1 read next; +handler t1 close; +# client 2 +--exec echo read the result from the other connection +connection con2; +reap; +# client 1 +--exec echo proceed with the normal connection +connection default; +drop table t1; + |