| 1 |
--source include/not_valgrind.inc |
| 2 |
--source include/have_multi_ndb.inc |
| 3 |
--source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
# Test to check inplace upgrade from 7.6. The initial server upgrade |
| 6 |
# phase i.e. the phase during which InnoDB and other SE tables are |
| 7 |
# upgraded should not upgrade NDB tables. NDB tables are instead |
| 8 |
# upgraded during the schema synchronization phase. |
| 9 |
# |
| 10 |
# For inplace upgrade with NDB tables, another requirement is to |
| 11 |
# ensure that the tables are present in NDB Dictionary. This is |
| 12 |
# done through restoring a 7.6 based backup created using the |
| 13 |
# following SQL statements: |
| 14 |
# |
| 15 |
# CREATE DATABASE test; |
| 16 |
# USE test; |
| 17 |
# CREATE LOGFILE GROUP lg1 |
| 18 |
# ADD UNDOFILE 'lg1_undofile.dat' |
| 19 |
# INITIAL_SIZE 1M |
| 20 |
# UNDO_BUFFER_SIZE = 1M |
| 21 |
# ENGINE NDB; |
| 22 |
# CREATE TABLESPACE ts1 |
| 23 |
# ADD DATAFILE 'ts1_datafile.dat' |
| 24 |
# USE LOGFILE GROUP lg1 |
| 25 |
# INITIAL_SIZE 2M |
| 26 |
# ENGINE NDB; |
| 27 |
# CREATE TABLE t1 ( |
| 28 |
# a int PRIMARY KEY, |
| 29 |
# b varchar(255) |
| 30 |
# ) ENGINE = NDB |
| 31 |
# TABLESPACE ts1 |
| 32 |
# STORAGE DISK; |
| 33 |
# INSERT INTO t1 VALUES (1, "Solskjaer has won it"); |
| 34 |
# CREATE DATABASE db1; |
| 35 |
# USE db1; |
| 36 |
# CREATE TABLE t1 ( |
| 37 |
# a int PRIMARY KEY, |
| 38 |
# b varchar(255) |
| 39 |
# ) ENGINE NDB; |
| 40 |
# INSERT INTO t1 VALUES (1, "Manchester United have"); |
| 41 |
# INSERT INTO t1 VALUES (2, "Reached the promised land"); |
| 42 |
# |
| 43 |
# This test does the following: |
| 44 |
# 1. Stops both MySQL servers |
| 45 |
# 2. Restores the NDB backup |
| 46 |
# 3. Unzips the 7.6 data directories |
| 47 |
# 4. Restarts both MySQL servers (step where the upgrade takes place) |
| 48 |
# 5. Runs test DDL statements and queries |
| 49 |
# 6. Clean up which includes restarting both MySQL servers |
| 50 |
|
| 51 |
--let $MYSQLD_DATADIR = `select @@datadir` |
| 52 |
--echo # Stop MySQL server 1 |
| 53 |
--let $restart_file1 = $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect |
| 54 |
--exec echo "wait" > $restart_file1 |
| 55 |
--shutdown_server |
| 56 |
--source include/wait_until_disconnected.inc |
| 57 |
|
| 58 |
--connection server2 |
| 59 |
--echo # Stop MySQL server 2 |
| 60 |
--let $restart_file2 = $MYSQLTEST_VARDIR/tmp/mysqld.2.1.expect |
| 61 |
--exec echo "wait" > $restart_file2 |
| 62 |
--shutdown_server |
| 63 |
--source include/wait_until_disconnected.inc |
| 64 |
|
| 65 |
--connection server1 |
| 66 |
--echo # Restore 7.6 backup into NDB |
| 67 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -m -r --disable-indexes --include-databases=mysql,test,db1 $NDB_SAVED_BACKUPS/76_inplace_upgrade_backup >> $NDB_TOOLS_OUTPUT |
| 68 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 2 -r --include-databases=mysql,test,db1 $NDB_SAVED_BACKUPS/76_inplace_upgrade_backup >> $NDB_TOOLS_OUTPUT |
| 69 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 --rebuild-indexes --include-databases=mysql,test,db1 $NDB_SAVED_BACKUPS/76_inplace_upgrade_backup >> $NDB_TOOLS_OUTPUT |
| 70 |
|
| 71 |
--echo # Setup the 7.6 data directory |
| 72 |
--echo # Copy zip files to tmp |
| 73 |
--copy_file $MYSQLTEST_VARDIR/std_data/data76.zip $MYSQL_TMP_DIR/data76.zip |
| 74 |
--echo # Check that the file exists in the working folder |
| 75 |
--file_exists $MYSQL_TMP_DIR/data76.zip |
| 76 |
--echo # Unzip the contents |
| 77 |
--exec unzip -qo $MYSQL_TMP_DIR/data76.zip -d $MYSQL_TMP_DIR |
| 78 |
--echo # Rename the extracted root directory for server2 |
| 79 |
--move_file $MYSQL_TMP_DIR/data76_server1 $MYSQL_TMP_DIR/data76_server2 |
| 80 |
--echo # Unzip again for server1 |
| 81 |
--exec unzip -qo $MYSQL_TMP_DIR/data76.zip -d $MYSQL_TMP_DIR |
| 82 |
|
| 83 |
--echo # Test upgrade on 7.6 data directory on MySQL server 1 |
| 84 |
--let $MYSQLD_DATADIR1 = $MYSQL_TMP_DIR/data76_server1 |
| 85 |
--let $MYSQLD_LOG1 = $MYSQLTEST_VARDIR/log/76_upgrade_server1.log |
| 86 |
--replace_result $MYSQLD MYSQLD $MYSQLD_DATADIR1 MYSQLD_DATADIR1 $MYSQLD_LOG1 MYSQLD_LOG1 |
| 87 |
--exec echo "restart: --datadir=$MYSQLD_DATADIR1 --log-error=$MYSQLD_LOG1" > $restart_file1 |
| 88 |
--let $wait_counter= 10000 |
| 89 |
--enable_reconnect |
| 90 |
--source include/wait_until_connected_again.inc |
| 91 |
|
| 92 |
--let SEARCH_FILE= $MYSQLD_LOG1 |
| 93 |
# Server shutdown error can show up during high IO loads |
| 94 |
--let IGNORE_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Event Scheduler\: \[root@localhost\]\[events\.myevent\] (Unknown column \'c1\' in \'field list\'|Server shutdown in progress) |
| 95 |
--let SEARCH_PATTERN= \[ERROR\] |
| 96 |
--source include/search_pattern.inc |
| 97 |
|
| 98 |
--connection server2 |
| 99 |
--echo # Test upgrade on 7.6 data directory on MySQL server 2 |
| 100 |
--let $MYSQLD_DATADIR2 = $MYSQL_TMP_DIR/data76_server2 |
| 101 |
--let $MYSQLD_LOG2 = $MYSQLTEST_VARDIR/log/76_upgrade_server2.log |
| 102 |
--replace_result $MYSQLD MYSQLD $MYSQLD_DATADIR2 MYSQLD_DATADIR2 $MYSQLD_LOG2 MYSQLD_LOG2 |
| 103 |
--exec echo "restart: --datadir=$MYSQLD_DATADIR2 --log-error=$MYSQLD_LOG2" > $restart_file2 |
| 104 |
--let $wait_counter= 10000 |
| 105 |
--enable_reconnect |
| 106 |
--source include/wait_until_connected_again.inc |
| 107 |
|
| 108 |
--let SEARCH_FILE= $MYSQLD_LOG2 |
| 109 |
# Server shutdown error can show up during high IO loads |
| 110 |
--let IGNORE_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Event Scheduler\: \[root@localhost\]\[events\.myevent\] (Unknown column \'c1\' in \'field list\'|Server shutdown in progress) |
| 111 |
--let SEARCH_PATTERN= \[ERROR\] |
| 112 |
--source include/search_pattern.inc |
| 113 |
|
| 114 |
--connection server1 |
| 115 |
# Check if the tables have been upgraded properly in server1 |
| 116 |
SHOW TABLES; |
| 117 |
SELECT engine from information_schema.tables |
| 118 |
WHERE table_schema='mysql' and table_name='user'; |
| 119 |
SHOW TABLES IN db1; |
| 120 |
SHOW CREATE TABLE t1; |
| 121 |
SHOW CREATE TABLE db1.t1; |
| 122 |
--sorted_result |
| 123 |
SELECT * FROM t1; |
| 124 |
--sorted_result |
| 125 |
SELECT * FROM db1.t1; |
| 126 |
|
| 127 |
ALTER TABLE t1 DROP COLUMN b; |
| 128 |
|
| 129 |
--connection server2 |
| 130 |
# Check if the tables have been upgraded properly in server2 |
| 131 |
SHOW TABLES; |
| 132 |
SELECT engine from information_schema.tables |
| 133 |
WHERE table_schema='mysql' and table_name='user'; |
| 134 |
SHOW TABLES IN db1; |
| 135 |
SHOW CREATE TABLE t1; |
| 136 |
SHOW CREATE TABLE db1.t1; |
| 137 |
--sorted_result |
| 138 |
SELECT * FROM t1; |
| 139 |
--sorted_result |
| 140 |
SELECT * FROM db1.t1; |
| 141 |
|
| 142 |
# Clean up |
| 143 |
--connection server1 |
| 144 |
DROP TABLE t1; |
| 145 |
DROP TABLE db1.t1; |
| 146 |
ALTER TABLESPACE ts1 |
| 147 |
DROP DATAFILE 'ts1_datafile.dat'; |
| 148 |
DROP TABLESPACE ts1; |
| 149 |
DROP LOGFILE GROUP lg1 |
| 150 |
ENGINE NDB; |
| 151 |
|
| 152 |
--exec echo "wait" > $restart_file1 |
| 153 |
--shutdown_server |
| 154 |
--source include/wait_until_disconnected.inc |
| 155 |
|
| 156 |
--exec echo "restart" > $restart_file1 |
| 157 |
--let $wait_counter= 10000 |
| 158 |
--enable_reconnect |
| 159 |
--source include/wait_until_connected_again.inc |
| 160 |
|
| 161 |
--connection server2 |
| 162 |
--exec echo "wait" > $restart_file2 |
| 163 |
--shutdown_server |
| 164 |
--source include/wait_until_disconnected.inc |
| 165 |
|
| 166 |
--exec echo "restart" > $restart_file2 |
| 167 |
--let $wait_counter= 10000 |
| 168 |
--enable_reconnect |
| 169 |
--source include/wait_until_connected_again.inc |
| 170 |
|
| 171 |
--force-rmdir $MYSQLD_DATADIR1 |
| 172 |
--force-rmdir $MYSQLD_DATADIR2 |
| 173 |
--remove_file $MYSQL_TMP_DIR/data76.zip |
| 174 |
|
| 175 |
--exec $NDB_DROP_TABLE -d mysql db user tables_priv columns_priv procs_priv proxies_priv >> $NDB_TOOLS_OUTPUT |
| 176 |
|
| 177 |
--remove_file $NDB_TOOLS_OUTPUT |