Debian Codegraph @

mysql-test/suite/ndb_ddl/dist_priv_migration.test

raw
1 --source include/have_debug.inc
2 --source connect.inc
3
4 --echo *** TEST CASE 1 ***
5 --echo *** Positive test that a table named mtr__acl_test_table exhibits
6 --echo *** the special behavior used for upgrading ACL tables into 8.0
7
8 --connection mysqld1
9 --echo At MySQL Server 1
10 # This test relies on a special hard-coded table name mysql.mtr__acl_test_table
11 USE mysql;
12 CREATE TABLE mtr__acl_test_table (i int not null primary key, j int)
13 ENGINE=ndb;
14
15 # Supress errors provoked by the "shadow table" on first mysqld
16 --disable_query_log
17 call mtr.add_suppression("Local table 'mysql.mtr__acl_test_table' .* shadows");
18 call mtr.add_suppression("Failed to remove table definition");
19 --enable_query_log
20
21 # Populate the table with some data
22 INSERT INTO mtr__acl_test_table values(1,2);
23 INSERT INTO mtr__acl_test_table values(2,3);
24 INSERT INTO mtr__acl_test_table values(3,4);
25
26 # Test the "NDB to InnoDB" upgrade migration of WL#12711
27 #
28 # On one server, migrate the table to InnoDB
29 ALTER TABLE mtr__acl_test_table ENGINE=InnoDB;
30
31 # The data still exists
32 SELECT * FROM mtr__acl_test_table ORDER BY i;
33
34 # The table is in InnoDB
35 SELECT engine FROM INFORMATION_SCHEMA.TABLES
36 WHERE table_name='mtr__acl_test_table';
37
38 # From a different MySQL server, we see the server still existing in NDB
39 --connection mysqld2
40 --echo At MySQL Server 2
41
42 USE mysql;
43 SELECT engine FROM INFORMATION_SCHEMA.TABLES
44 WHERE table_name='mtr__acl_test_table';
45
46 # And the original data remains
47 SELECT * FROM mtr__acl_test_table ORDER BY i;
48
49 # Add a record:
50 INSERT INTO mtr__acl_test_table values(4,5);
51
52 # From mysqld1 where the table is in InnoDB the new record does not appear
53 --connection mysqld1
54 --echo At MySQL Server 1
55 SELECT * FROM mtr__acl_test_table ORDER BY i;
56
57 --connection mysqld3
58 --echo At MySQL Server 3 also migrate the table to InnoDB
59 SELECT engine FROM INFORMATION_SCHEMA.TABLES
60 WHERE table_name='mtr__acl_test_table';
61 ALTER TABLE mysql.mtr__acl_test_table ENGINE=InnoDB;
62
63 # Supress errors provoked by the "shadow table" on third mysqld
64 --disable_query_log
65 call mtr.add_suppression("Local table 'mysql.mtr__acl_test_table' .* shadows");
66 call mtr.add_suppression("Failed to remove table definition");
67 --enable_query_log
68
69 --connection mysqld2
70 --echo At MySQL Server 2, DROP the NDB table:
71
72 # This will not drop the shadow tables in both mysqld1 and mysqld3
73 --replace_regex /Node [0-9]+:/Node <nodeid>/
74 DROP TABLE mysql.mtr__acl_test_table;
75
76 --connection mysqld4
77 --echo At MySQL Server 4, Confirm that the NDB table has been dropped
78 SELECT engine FROM INFORMATION_SCHEMA.TABLES
79 WHERE table_name='mtr__acl_test_table';
80
81 # Back at mysqld1 the InnoDB table still exists
82 --connection mysqld1
83 --echo At MySQL Server 1
84 SELECT COUNT(*) FROM mtr__acl_test_table;
85
86 # Finally drop the InnoDB table
87 DROP TABLE mtr__acl_test_table;
88
89 --connection mysqld3
90 --echo At MySQL Server 3 Drop the local InnoDB table
91 DROP TABLE mysql.mtr__acl_test_table;
92
93
94 --echo *** TEST CASE 2 ***
95 --echo *** Negative test that a table *not* named mtr__acl_test_table
96 --echo *** does not exhibit the special behavior
97
98 --connection mysqld1
99
100 CREATE TABLE mtr__acl_test_table_2 (i int not null primary key, j int)
101 ENGINE=ndb;
102
103 # Populate the table with some data
104 INSERT INTO mtr__acl_test_table_2 values(1,2);
105 INSERT INTO mtr__acl_test_table_2 values(2,3);
106 INSERT INTO mtr__acl_test_table_2 values(3,4);
107
108 # This ALTER TABLE changes the table to a *local* InnoDB table.
109 # It will be dropped from NDB
110 ALTER TABLE mtr__acl_test_table_2 ENGINE=InnoDB;
111
112 SELECT * FROM mtr__acl_test_table_2 ORDER BY i;
113
114 # The table is in InnoDB
115 SELECT engine FROM INFORMATION_SCHEMA.TABLES
116 WHERE table_name='mtr__acl_test_table_2';
117
118 --connection mysqld2
119 --echo At MySQL 2 we expect the table does not exist
120 SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
121 WHERE table_name='mtr__acl_test_table_2';
122
123 --connection mysqld1
124 --echo Back at mysqld1 drop the negative test table
125 DROP TABLE mtr__acl_test_table_2;
126
127