List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:March 28 2011 7:34am
Subject:bzr commit into mysql-5.5-cluster branch (magnus.blaudd:3251)
View as plain text  
#At file:///C:/mysql/5.5-cluster/ based on revid:magnus.blaudd@stripped

 3251 Magnus Blåudd	2011-03-28
      ndb GSl locking
       - add tests for GSL's behaviour combined with LOCK TABLES

    modified:
      mysql-test/suite/ndb/r/ndb_global_schema_lock.result
      mysql-test/suite/ndb/t/ndb_global_schema_lock.test
=== 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 12:12:56 +0000
+++ b/mysql-test/suite/ndb/r/ndb_global_schema_lock.result	2011-03-28 07:34:23 +0000
@@ -32,3 +32,53 @@ DROP TABLE t2;
 DROP TABLE t3, t4;
 @ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
 1
+CREATE TABLE t10(a int primary key) ENGINE ndb;
+LOCK TABLES t10 READ;
+CREATE DATABASE test2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+ALTER DATABASE test2 CHARACTER SET latin2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+DROP DATABASE test2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+UNLOCK TABLES;
+LOCK TABLES t10 WRITE;
+CREATE DATABASE test2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+ALTER DATABASE test2 CHARACTER SET latin2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+DROP DATABASE test2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+UNLOCK TABLES;
+LOCK TABLES t10 READ;
+CREATE TABLE t1(a int not null primary key);
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+RENAME TABLE t10 TO t2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+CREATE TABLE t3 LIKE t10;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+ALTER TABLE t10 ADD COLUMN b int default NULL;
+ERROR HY000: Table 't10' was locked with a READ lock and can't be updated
+TRUNCATE TABLE t10;
+ERROR HY000: Table 't10' was locked with a READ lock and can't be updated
+CREATE TABLE t4 AS SELECT * FROM t10;
+ERROR HY000: Table 't4' was not locked with LOCK TABLES
+DROP TABLE t10;
+ERROR HY000: Table 't10' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+LOCK TABLES t10 WRITE;
+CREATE TABLE t1(a int not null primary key);
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+RENAME TABLE t10 TO t2;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+CREATE TABLE t3 LIKE t10;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+ALTER TABLE t10 ADD COLUMN b int default NULL;
+@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
+1
+TRUNCATE TABLE t10;
+@ndb_schema_locks_count:=VARIABLE_VALUE-@ndb_init_schema_locks_count
+1
+CREATE TABLE t4 AS SELECT * FROM t10;
+ERROR HY000: Table 't4' was not locked with LOCK TABLES
+DROP TABLE t10;
+UNLOCK TABLES;

=== 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 12:12:56 +0000
+++ b/mysql-test/suite/ndb/t/ndb_global_schema_lock.test	2011-03-28 07:34:23 +0000
@@ -50,3 +50,84 @@ DROP TABLE t2;
 --source ndb_init_schema_locks_count.inc
 DROP TABLE t3, t4;
 --source ndb_schema_locks_count.inc
+
+
+#
+# Testing GSL behaviour combined with LOCK TABLES
+#
+# NOTE! Using LOCK TABLES should not be a way to circumvent
+# global schema locking
+#
+
+CREATE TABLE t10(a int primary key) ENGINE ndb;
+
+#
+# Database DDL with READ lock, should return error
+#
+LOCK TABLES t10 READ;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+CREATE DATABASE test2;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+ALTER DATABASE test2 CHARACTER SET latin2;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+DROP DATABASE test2;
+UNLOCK TABLES;
+
+#
+# Database DDL with WRITE lock, should return error
+#
+LOCK TABLES t10 WRITE;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+CREATE DATABASE test2;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+ALTER DATABASE test2 CHARACTER SET latin2;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+DROP DATABASE test2;
+UNLOCK TABLES;
+
+#
+# Table DDL with READ lock
+#
+LOCK TABLES t10 READ;
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t1(a int not null primary key);
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+RENAME TABLE t10 TO t2;
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t3 LIKE t10;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+ALTER TABLE t10 ADD COLUMN b int default NULL;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+TRUNCATE TABLE t10;
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t4 AS SELECT * FROM t10;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+DROP TABLE t10;
+UNLOCK TABLES;
+
+#
+# Table DDL with WRITE lock
+#
+LOCK TABLES t10 WRITE;
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t1(a int not null primary key);
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+RENAME TABLE t10 TO t2;
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t3 LIKE t10;
+--source ndb_init_schema_locks_count.inc
+ALTER TABLE t10 ADD COLUMN b int default NULL;
+--source ndb_schema_locks_count.inc
+--source ndb_init_schema_locks_count.inc
+TRUNCATE TABLE t10;
+--source ndb_schema_locks_count.inc
+# Catch 22, not possible to lock table until created
+--error ER_TABLE_NOT_LOCKED
+CREATE TABLE t4 AS SELECT * FROM t10;
+DROP TABLE t10;
+UNLOCK TABLES;

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20110328073423-32nuu8my99moyvtg.bundle
Thread
bzr commit into mysql-5.5-cluster branch (magnus.blaudd:3251) Magnus Blåudd28 Mar