Debian Codegraph @

mysql-test/suite/ndbcluster/hidden_ndb_schema.test

raw
1 #
2 # The ndbcluster plugin creates a table in NDB which is used for
3 # communicating between the MySQL Servers connected to the same cluster
4 # while doing schema changes.
5 #
6 # The table is called ndb_schema and is in the mysql database.
7 #
8 # The table is hidden. It should not show up in information_schema
9 # queries nor SHOW tables. Starting from MySQL Server 8.0 such a hidden
10 # table is also not available in neither DML nor DML queries
11 #
12
13 --source include/have_ndb.inc
14
15 --echo # Check that mysql.ndb_schema does not show up in SHOW TABLES
16 SHOW TABLES FROM mysql LIKE 'ndb_schema';
17
18 --echo # Check that mysql.ndb_schema does not show up in
19 --echo # information_schema queries
20 SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
21 WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'ndb_schema';
22
23 --echo # Check that table does not exist in SHOW CREATE TABLE
24 --error ER_NO_SUCH_TABLE
25 SHOW CREATE TABLE mysql.ndb_schema;
26
27 --echo #
28 --echo # Check that table is not availble in DML queries
29 --echo #
30
31 --error ER_NO_SUCH_TABLE
32 SELECT * FROM mysql.ndb_schema;
33
34 --error ER_NO_SUCH_TABLE
35 INSERT INTO mysql.ndb_schema (db, name)
36 VALUES("","");
37
38 --error ER_NO_SUCH_TABLE
39 REPLACE INTO mysql.ndb_schema (db, name)
40 VALUES("","");
41
42 --error ER_NO_SUCH_TABLE
43 UPDATE mysql.ndb_schema SET node_id = 0
44 WHERE db="" AND name="";
45
46 --error ER_NO_SUCH_TABLE
47 DELETE FROM mysql.ndb_schema
48 WHERE db="" AND name="";
49
50 --error ER_NO_SUCH_TABLE
51 TRUNCATE mysql.ndb_schema;
52
53 --echo #
54 --echo # Check that table is not availble in DDL queries
55 --echo #
56
57 --echo # It's not possible to create mysql.ndb_schema in NDB
58 --echo # (error is slightly confusing)
59 --error ER_NO_SUCH_TABLE
60 CREATE TABLE mysql.ndb_schema(a int primary key) engine = NDB;
61
62 --echo # It's not possible to create mysql.ndb_schema in other engine
63 --echo # (error is slightly confusing)
64 --error ER_NO_SUCH_TABLE
65 CREATE TABLE mysql.ndb_schema(a int primary key);
66
67 --error ER_NO_SUCH_TABLE
68 ALTER TABLE mysql.ndb_schema ALGORITHM=copy, add column b int null;
69
70 --error ER_NO_SUCH_TABLE
71 ALTER TABLE mysql.ndb_schema ALGORITHM=inplace, add column b int null;
72
73 --error ER_NO_SUCH_TABLE
74 DROP TABLE mysql.ndb_schema;
75
76 #
77 # WL#10162 adds another schema distribution table called ndb_schema_result. It
78 # should be hidden in the same way as ndb_schema. Run some selected checks to
79 # verify that ndb_schema_result is also hidden.
80 #
81
82 --echo # Check that mysql.ndb_schema_result does not show up in
83 --echo # information_schema queries
84 SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
85 WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'ndb_schema_result';
86
87 --echo # No reading or modifying data
88 --error ER_NO_SUCH_TABLE
89 SELECT * FROM mysql.ndb_schema_result;
90
91 --error ER_NO_SUCH_TABLE
92 DELETE FROM mysql.ndb_schema_result
93 WHERE nodeid=0;
94
95 --echo # No DDL
96 --error ER_NO_SUCH_TABLE
97 ALTER TABLE mysql.ndb_schema_result ALGORITHM=copy, add column b int null;
98
99 --error ER_NO_SUCH_TABLE
100 DROP TABLE mysql.ndb_schema_result;
101