Debian Codegraph @

mysql-test/suite/encryption/t/upgrade.test

raw
1 --source include/big_test.inc
2 --source include/have_debug.inc
3 --source include/not_valgrind.inc
4 --source include/have_case_sensitive_file_system.inc
5 --source include/mysql_upgrade_preparation.inc
6
7 --echo # This test upgrades schema from 5.7, 8.0 to 8.0.15 where we
8 --echo # introduce serveral ENCRYPTION control capabilities in MySQL
9 --echo # (WL#12261). Specifically this test upgrades from,
10 --echo #
11 --echo # a) 5.7.25 where, we support file-per-tablespace
12 --echo # encryption and not general tablespace encryption. We upgrade from
13 --echo # FRM to DD.
14 --echo # b) 8.0.12 where, we support file-per-tablespace
15 --echo # encryption and not general tablespace encryption. We upgrade from
16 --echo # DD to DD.
17 --echo # c) 8.0.13 where, we support file-per-tablespace
18 --echo # encryption and general tablespace encryption. We upgrade from
19 --echo # DD to DD.
20 --echo #
21 --echo # The schema used is during upgrade is as described in
22 --echo # upgrade_schema.test placed in respective *.zip file. The expectation
23 --echo # is that the encryption clause for tables and tablespaces are
24 --echo # stored as designed by wl12261 after the upgrade is completed.. The
25 --echo # results are verified by querying the mysql.tables.options and
26 --echo # mysql.tablespaces.options.
27
28 --echo ########################################################################
29 --echo # Stop the running server.
30 --echo ########################################################################
31 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
32 --shutdown_server 300
33 --source include/wait_until_disconnected.inc
34
35 --echo ########################################################################
36 --echo # Unzip a 5.7.25 datadir with bug data, start the server against it
37 --echo ########################################################################
38
39 --echo ########################################################################
40 --echo # Copy and unzip the datadir.
41 --echo ########################################################################
42 --copy_file $MYSQLTEST_VARDIR/std_data/upgrade/wl12261_upgrade_57025.zip $MYSQL_TMP_DIR/wl12261_upgrade_57025.zip
43 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_57025.zip
44 --exec unzip -qo $MYSQL_TMP_DIR/wl12261_upgrade_57025.zip -d $MYSQL_TMP_DIR
45 let $BUGDATA_57025_DATADIR = $MYSQL_TMP_DIR/data_57025;
46
47 --echo ########################################################################
48 --echo # Restart the server against the unzipped datadir.
49 --echo ########################################################################
50 let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_57025.log;
51 --exec echo "restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$BUGDATA_57025_DATADIR/mysecret_keyring $KEYRING_PLUGIN_OPT --datadir=$BUGDATA_57025_DATADIR --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
52 --enable_reconnect
53 --let $wait_counter= 10000
54 --source include/wait_until_connected_again.inc
55
56 --source include/mysql_upgrade_cleanup.inc
57
58 SET DEBUG='+d,skip_dd_table_access_check';
59 SELECT schema_id, t.name, t.options, t.tablespace_id
60 FROM mysql.tables t JOIN mysql.schemata sch
61 ON t.schema_id = sch.id WHERE sch.name LIKE 'db1' ORDER BY t.name;
62 SELECT id, name, options FROM mysql.tablespaces
63 WHERE name LIKE 'ts%' OR name LIKE '%db1%';
64 SET DEBUG='-d,skip_dd_table_access_check';
65
66 --echo Check if upgrade root gets TABLE_ENCRYPTION_ADMIN privilege.
67 SHOW GRANTS FOR 'root'@'localhost';
68
69 --echo ########################################################################
70 --echo # Remove copied files and stop the server.
71 --echo ########################################################################
72 --let $shutdown_server_timeout = 300
73 --source include/shutdown_mysqld.inc
74 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_57025.zip
75 --force-rmdir $MYSQL_TMP_DIR/data_57025
76 --remove_file $MYSQL_TMP_DIR/wl12261_upgrade_57025.zip
77
78 --echo ########################################################################
79 --echo # Unzip a 8.0.12 datadir with bug data, start the server against it
80 --echo ########################################################################
81
82 --echo ########################################################################
83 --echo # Copy and unzip the datadir.
84 --echo ########################################################################
85 --copy_file $MYSQLTEST_VARDIR/std_data/upgrade/wl12261_upgrade_80012.zip $MYSQL_TMP_DIR/wl12261_upgrade_80012.zip
86 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_80012.zip
87 --exec unzip -qo $MYSQL_TMP_DIR/wl12261_upgrade_80012.zip -d $MYSQL_TMP_DIR
88 let $BUGDATA_80012_DATADIR = $MYSQL_TMP_DIR/data_80012;
89
90 --echo ########################################################################
91 --echo # Restart the server against the unzipped datadir.
92 --echo ########################################################################
93 let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_80012.log;
94
95 --exec echo "restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$BUGDATA_80012_DATADIR/mysecret_keyring $KEYRING_PLUGIN_OPT --datadir=$BUGDATA_80012_DATADIR --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
96 --enable_reconnect
97 --let $wait_counter= 10000
98 --source include/wait_until_connected_again.inc
99
100 --source include/mysql_upgrade_cleanup.inc
101
102 SET DEBUG='+d,skip_dd_table_access_check';
103 SELECT schema_id, t.name, t.options, t.tablespace_id
104 FROM mysql.tables t JOIN mysql.schemata sch
105 ON t.schema_id = sch.id WHERE sch.name LIKE 'db1' ORDER BY t.name;
106 SELECT id, name, options FROM mysql.tablespaces
107 WHERE name LIKE 'ts%' OR name LIKE '%db1%';
108 SET DEBUG='-d,skip_dd_table_access_check';
109
110 --echo Check if upgrade root gets TABLE_ENCRYPTION_ADMIN privilege.
111 SHOW GRANTS FOR 'root'@'localhost';
112
113 --echo ########################################################################
114 --echo # Remove copied files and stop the server.
115 --echo ########################################################################
116 --let $shutdown_server_timeout = 300
117 --source include/shutdown_mysqld.inc
118 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_80012.zip
119 --force-rmdir $MYSQL_TMP_DIR/data_80012
120 --remove_file $MYSQL_TMP_DIR/wl12261_upgrade_80012.zip
121
122 --echo ########################################################################
123 --echo # Unzip a 8.0.13 datadir with bug data, start the server against it
124 --echo ########################################################################
125
126 --echo ########################################################################
127 --echo # Copy and unzip the datadir.
128 --echo ########################################################################
129 --copy_file $MYSQLTEST_VARDIR/std_data/upgrade/wl12261_upgrade_80013.zip $MYSQL_TMP_DIR/wl12261_upgrade_80013.zip
130 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_80013.zip
131 --exec unzip -qo $MYSQL_TMP_DIR/wl12261_upgrade_80013.zip -d $MYSQL_TMP_DIR
132 let $BUGDATA_80013_DATADIR = $MYSQL_TMP_DIR/data_80013;
133
134 --echo ########################################################################
135 --echo # Restart the server against the unzipped datadir.
136 --echo ########################################################################
137 let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_80013.log;
138 --exec echo "restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$BUGDATA_80013_DATADIR/mysecret_keyring $KEYRING_PLUGIN_OPT --datadir=$BUGDATA_80013_DATADIR --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
139 --enable_reconnect
140 --let $wait_counter= 10000
141 --source include/wait_until_connected_again.inc
142
143 --source include/mysql_upgrade_cleanup.inc
144
145 SET DEBUG='+d,skip_dd_table_access_check';
146 SELECT schema_id, t.name, t.options, t.tablespace_id
147 FROM mysql.tables t JOIN mysql.schemata sch
148 ON t.schema_id = sch.id WHERE sch.name LIKE 'db1' ORDER BY t.name;
149 SELECT id, name, options FROM mysql.tablespaces
150 WHERE name LIKE 'ts%' OR name LIKE '%db1%';
151 SET DEBUG='-d,skip_dd_table_access_check';
152
153 --echo Check if upgrade root gets TABLE_ENCRYPTION_ADMIN privilege.
154 SHOW GRANTS FOR 'root'@'localhost';
155
156 --echo ########################################################################
157 --echo # Remove copied files and stop the server.
158 --echo ########################################################################
159 --let $shutdown_server_timeout = 300
160 --source include/shutdown_mysqld.inc
161 --file_exists $MYSQL_TMP_DIR/wl12261_upgrade_80013.zip
162 --force-rmdir $MYSQL_TMP_DIR/data_80013
163 --remove_file $MYSQL_TMP_DIR/wl12261_upgrade_80013.zip
164
165 --echo ########################################################################
166 --echo # Cleanup: Restart with default options.
167 --echo ########################################################################
168 let $restart_parameters =;
169 --source include/start_mysqld.inc
170
171 --echo ########################################################################
172 --echo # Bug #29447073: UPGRADE FROM 8.0.16 TO TRUNK FAILS WHEN MYSQL TABLESPACE IS ENCRYPTED
173 --echo ########################################################################
174
175 alter tablespace mysql encryption='Y';
176
177 --replace_result $KEYRING_PLUGIN_OPT KEYRING_PLUGIN_OPT
178 --let $restart_parameters = restart: --upgrade=FORCE --early-plugin-load=keyring_file=$KEYRING_PLUGIN $KEYRING_PLUGIN_OPT
179 --let $wait_counter=10000
180 --source include/restart_mysqld.inc
181 --source include/wait_until_connected_again.inc
182
183 --source include/mysql_upgrade_cleanup.inc
184
185 alter tablespace mysql encryption='N';
186
187 --echo ########################################################################
188 --echo # Cleanup: Restart with default options.
189 --echo ########################################################################
190 let $restart_parameters =;
191 --source include/restart_mysqld.inc
192