Debian Codegraph @

mysql-test/suite/ndb/t/ndb_global_schema_lock_error.test

raw
1 -- source include/have_ndb.inc
2
3 --disable_query_log
4 # Test will produce this error in server log file -> ignore
5 call mtr.add_suppression("Failed to acquire global schema lock");
6 # Ignore the warning generated by ndbcluster's binlog thread
7 # when cluster is restarted
8 call mtr.add_suppression("cluster disconnect An incident event has been written");
9 --enable_query_log
10
11 # Ignore the warning generated by ndbcluster's binlog thread
12 # when cluster is restarted - also on the second mysqld
13 connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1);
14 connection mysqld2;
15 --disable_query_log ONCE
16 call mtr.add_suppression("cluster disconnect An incident event has been written");
17 connection default;
18
19 #
20 # Run all the commands which should take the global schema lock
21 # against a mysqld "connected" to stopped NDB nodes
22 #
23
24 # Restart NDB nodes into "no start"
25 --source ndb_restart_nostart.inc
26
27 # To get consistent error messages and warnings from the tests below, wait
28 # until the "ndb binlog thread" has detected the cluster failure and is
29 # waiting for cluster to start again.
30 let $wait_condition =
31 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
32 WHERE state = "Waiting for ndbcluster to start";
33 --source include/wait_condition.inc
34
35 # Database DDL, works but generate a warning
36 # about failure to acquire global schema lock
37 CREATE DATABASE test2;
38 ALTER DATABASE test2 CHARACTER SET latin2;
39 DROP DATABASE test2;
40
41 # Table DDL, works since they don't work with NDB tables
42 # but generate warnings about failure to acquire global schema lock
43 # NOTE! The CREATE's all generate three warnings each, ha_discover,
44 # global schema lock and ha_table_exists_in_engine
45 # NOTE2! When using ps protocol a fourth warning pops up due to different
46 # code path -> turn ps off
47 #
48 --disable_ps_protocol
49 CREATE TABLE t1(a int not null primary key);
50 RENAME TABLE t1 TO t2;
51 CREATE TABLE t3 LIKE t2;
52 ALTER TABLE t3 ADD COLUMN b int default NULL;
53 INSERT INTO t2 VALUES(1);
54 TRUNCATE TABLE t2;
55 CREATE TABLE t4 AS SELECT * FROM t2;
56 DROP TABLE t2;
57 DROP TABLE t3, t4;
58
59 # Check if tablespace DDL works as expected i.e. passes with two warnings
60 # generated including one about failure to acquire global schema lock
61 CREATE TABLESPACE ts1
62 ADD DATAFILE 'ts1.ibd';
63 CREATE TABLE t5 (a INT PRIMARY KEY) TABLESPACE ts1;
64 DROP TABLE t5;
65 ALTER TABLESPACE ts1 RENAME TO ts2;
66 DROP TABLESPACE ts2;
67
68 # Check logfile group DDL. This shall fail of course with 3 warnings
69 # generated including one about failure to acquire global schema lock
70 --error ER_GET_ERRNO
71 CREATE LOGFILE GROUP lg1
72 ADD UNDOFILE 'lg1_undofile.dat'
73 ENGINE NDB;
74 SHOW WARNINGS;
75 --enable_ps_protocol
76
77 # Start NDB nodes back up again
78 --source ndb_restart_start.inc
79
80 # Wait until mysqld has connected properly to cluster again
81 source include/ndb_not_readonly.inc;