3241 Magnus Blåudd 2011-03-09
ndb
- add MCP patch for global schema lock of CREATE TABLE ... SELECT
- add testcase to ndb_global_schema_lock.test
modified:
mysql-test/suite/ndb/r/ndb_global_schema_lock.result
mysql-test/suite/ndb/t/ndb_global_schema_lock.test
sql/sql_parse.cc
3240 Magnus Blåudd 2011-03-09
ndb
- add ndb_schema_locks_count session variable which counts the number
of times that a thread takes the "ndb global schema lock"
- add test to show that all the commands that are configured to take the global schema lock
updates the counter
added:
mysql-test/suite/ndb/r/ndb_global_schema_lock.result
mysql-test/suite/ndb/t/ndb_global_schema_lock.test
mysql-test/suite/ndb/t/ndb_init_schema_locks_count.inc
mysql-test/suite/ndb/t/ndb_schema_locks_count.inc
modified:
mysql-test/suite/ndb/r/ndb_basic.result
sql/ha_ndbcluster.cc
sql/ndb_global_schema_lock.cc
sql/ndb_thd_ndb.h
=== modified file 'mysql-test/suite/ndb/r/ndb_global_schema_lock.result'
--- a/mysql-test/suite/ndb/r/ndb_global_schema_lock.result 2011-03-09 10:18:50 +0000
+++ b/mysql-test/suite/ndb/r/ndb_global_schema_lock.result 2011-03-09 12:12:56 +0000
@@ -23,9 +23,12 @@ INSERT INTO t2 VALUES(1);
TRUNCATE TABLE t2;
@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
1
+CREATE TABLE t4 ENGINE=NDB AS SELECT * FROM t2;
+@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
+1
DROP TABLE t2;
@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
1
-DROP TABLE t3;
+DROP TABLE t3, t4;
@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
1
=== modified file 'mysql-test/suite/ndb/t/ndb_global_schema_lock.test'
--- a/mysql-test/suite/ndb/t/ndb_global_schema_lock.test 2011-03-09 10:18:50 +0000
+++ b/mysql-test/suite/ndb/t/ndb_global_schema_lock.test 2011-03-09 12:12:56 +0000
@@ -40,9 +40,13 @@ TRUNCATE TABLE t2;
--source ndb_schema_locks_count.inc
--source ndb_init_schema_locks_count.inc
+CREATE TABLE t4 ENGINE=NDB AS SELECT * FROM t2;
+--source ndb_schema_locks_count.inc
+
+--source ndb_init_schema_locks_count.inc
DROP TABLE t2;
--source ndb_schema_locks_count.inc
--source ndb_init_schema_locks_count.inc
-DROP TABLE t3;
+DROP TABLE t3, t4;
--source ndb_schema_locks_count.inc
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-02-20 20:56:24 +0000
+++ b/sql/sql_parse.cc 2011-03-09 12:12:56 +0000
@@ -2321,6 +2321,14 @@ case SQLCOM_PREPARE:
{
select_result *result;
+#ifndef MCP_GLOBAL_SCHEMA_LOCK
+ Ndb_global_schema_lock_guard global_schema_lock_guard(thd);
+
+ if (!(create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+ !thd->locked_tables_mode)
+ global_schema_lock_guard.lock();
+#endif
+
/*
If:
a) we inside an SP and there was NAME_CONST substitution,
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (magnus.blaudd:3240 to 3241) | Magnus Blåudd | 9 Mar |