summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-05-31 11:08:14 +0200
committerunknown <ingo@mysql.com>2005-05-31 11:08:14 +0200
commitcf2188ca398e12d4a10c50b069c2243825f9dced (patch)
treea57814a50ac22d55c9f811df170159eea1b1eb3c /mysql-test
parente1e1e3a8498160d988e7ea5be7ef0646021e5817 (diff)
downloadmariadb-git-cf2188ca398e12d4a10c50b069c2243825f9dced.tar.gz
Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement.
1.) Added a new option to mysql_lock_tables() for ignoring FLUSH TABLES. Used the new option in create_table_from_items(). It is necessary to prevent the SELECT table from being reopend. It would get new storage assigned for its fields, while the SELECT part of the command would still use the old (freed) storage. 2.) Protected the CREATE TABLE and CREATE TABLE ... SELECT commands against a global read lock. This prevents a deadlock in CREATE TABLE ... SELECT in conjunction with FLUSH TABLES WITH READ LOCK and avoids the creation of new tables during a global read lock. 3.) Replaced set_protect_against_global_read_lock() and unset_protect_against_global_read_lock() by wait_if_global_read_lock() and start_waiting_global_read_lock() in the INSERT DELAYED handling. mysql-test/r/create.result: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Added test results. mysql-test/t/create.test: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Added tests which do not require concurrency. sql/lock.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Added a new option to mysql_lock_tables() for ignoring FLUSH TABLES. Changed the parameter list. Removed two unnecessary functions. Their functionality is included in wait_if_global_read_lock() and start_waiting_global_read_lock(). sql/mysql_priv.h: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Changed the declaration of mysql_lock_tables(). Added definitions for the new options. sql/sql_acl.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Adjusted mysql_lock_tables() calls to the new argument list. sql/sql_base.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Adjusted mysql_lock_tables() calls to the new argument list. sql/sql_handler.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Adjusted mysql_lock_tables() calls to the new argument list. sql/sql_insert.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Replaced set_protect_against_global_read_lock() and unset_protect_against_global_read_lock() by wait_if_global_read_lock() and start_waiting_global_read_lock() in the INSERT DELAYED handling. Adjusted mysql_lock_tables() calls to the new argument list. sql/sql_parse.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Protected the CREATE TABLE and CREATE TABLE ... SELECT commands against a global read lock. This prevents a deadlock in CREATE TABLE ... SELECT in conjunction with FLUSH TABLES WITH READ LOCK and avoids the creation of new tables during a global read lock. sql/sql_table.cc: Bug#10224 - ANALYZE TABLE crashing with simultaneous CREATE ... SELECT statement. Adjusted mysql_lock_tables() calls to the new argument list. Used the new option in create_table_from_items().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/create.result8
-rw-r--r--mysql-test/t/create.test15
2 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 7cb79d5a990..c99ad8960dc 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -228,3 +228,11 @@ create table t1 (a int,,b int);
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
create table t1 (,b int);
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1
+create table t1 (a int);
+create table t1 select * from t1;
+INSERT TABLE 't1' isn't allowed in FROM table list
+create table t2 union = (t1) select * from t1;
+INSERT TABLE 't1' isn't allowed in FROM table list
+flush tables with read lock;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index c71a1e0c177..ed2c76932da 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -203,3 +203,18 @@ create table t1 (a int,);
create table t1 (a int,,b int);
--error 1064
create table t1 (,b int);
+
+#
+# Bug#10224 - ANALYZE TABLE crashing with simultaneous
+# CREATE ... SELECT statement.
+# This tests two additional possible errors and a hang if
+# an improper fix is present.
+#
+create table t1 (a int);
+--error 1093
+create table t1 select * from t1;
+--error 1093
+create table t2 union = (t1) select * from t1;
+flush tables with read lock;
+unlock tables;
+drop table t1;