| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_multi_ndb.inc |
| 3 |
--source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
# |
| 6 |
# Test metadata upgrade of a disk data table when the tablespace |
| 7 |
# doesn't exist in DD. The 7.6 backup used for testing is: |
| 8 |
# |
| 9 |
# CREATE LOGFILE GROUP lg1 |
| 10 |
# ADD UNDOFILE 'lg1_undofile.dat' |
| 11 |
# INITIAL_SIZE 1M |
| 12 |
# UNDO_BUFFER_SIZE = 1M |
| 13 |
# ENGINE NDB; |
| 14 |
# |
| 15 |
# CREATE TABLESPACE ts1 |
| 16 |
# ADD DATAFILE 'ts1_datafile.dat' |
| 17 |
# USE LOGFILE GROUP lg1 |
| 18 |
# INITIAL_SIZE 2M |
| 19 |
# ENGINE NDB; |
| 20 |
# |
| 21 |
# CREATE TABLE t1 ( |
| 22 |
# a INT PRIMARY KEY, |
| 23 |
# b VARCHAR(255) |
| 24 |
# ) ENGINE NDB |
| 25 |
# TABLESPACE ts1 |
| 26 |
# STORAGE DISK; |
| 27 |
# |
| 28 |
# INSERT INTO t1 VALUES (1,'Sad Cypress'); |
| 29 |
# |
| 30 |
|
| 31 |
# Case 1: Test that the metadata upgrade of the table installs the |
| 32 |
# missing tablespace automatically during schema synchronization |
| 33 |
|
| 34 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -m -r --disable-indexes $NDB_SAVED_BACKUPS/metadata_upgrade_disk_data_backup >> $NDB_TOOLS_OUTPUT |
| 35 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 2 -r $NDB_SAVED_BACKUPS/metadata_upgrade_disk_data_backup >> $NDB_TOOLS_OUTPUT |
| 36 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 --rebuild-indexes $NDB_SAVED_BACKUPS/metadata_upgrade_disk_data_backup >> $NDB_TOOLS_OUTPUT |
| 37 |
--echo Backup from 7.6 restored |
| 38 |
|
| 39 |
--echo Restart server 1 to trigger schema synchronization |
| 40 |
--disable_query_log ONCE |
| 41 |
CALL mtr.add_suppression("Failed to synchronize tablespace"); |
| 42 |
--let $mysqld_name=mysqld.1.1 |
| 43 |
--let $restart_parameters="restart: --debug=d,ndb_install_tablespace_fail" |
| 44 |
--source include/restart_mysqld.inc |
| 45 |
--connection server2 |
| 46 |
--disable_query_log ONCE |
| 47 |
CALL mtr.add_suppression("Failed to synchronize tablespace"); |
| 48 |
--echo Restart server 2 to trigger schema synchronization |
| 49 |
--let $mysqld_name=mysqld.2.1 |
| 50 |
--source include/restart_mysqld.inc |
| 51 |
--connection server1 |
| 52 |
|
| 53 |
# Check schema and then perform DML and DDL on the tables |
| 54 |
SHOW TABLES; |
| 55 |
SHOW CREATE TABLE t1; |
| 56 |
SELECT * FROM t1; |
| 57 |
|
| 58 |
--connection server2 |
| 59 |
SHOW TABLES; |
| 60 |
SHOW CREATE TABLE t1; |
| 61 |
SELECT * FROM t1; |
| 62 |
|
| 63 |
--connection server1 |
| 64 |
ALTER TABLE t1 DROP COLUMN b; |
| 65 |
INSERT INTO t1 VALUES(2); |
| 66 |
--sorted_result |
| 67 |
SELECT * FROM t1; |
| 68 |
DROP TABLE t1; |
| 69 |
ALTER TABLESPACE ts1 |
| 70 |
DROP DATAFILE 'ts1_datafile.dat'; |
| 71 |
DROP TABLESPACE ts1; |
| 72 |
DROP LOGFILE GROUP lg1 |
| 73 |
ENGINE NDB; |
| 74 |
|
| 75 |
# Case 2: Test that "regular" synchronization of the table i.e. |
| 76 |
# without upgrade installs the missing tablespace automatically |
| 77 |
# during schema synchronization |
| 78 |
CREATE LOGFILE GROUP lg1 |
| 79 |
ADD UNDOFILE 'lg1_undofile.dat' |
| 80 |
INITIAL_SIZE 1M |
| 81 |
UNDO_BUFFER_SIZE = 1M |
| 82 |
ENGINE NDB; |
| 83 |
|
| 84 |
CREATE TABLESPACE ts1 |
| 85 |
ADD DATAFILE 'ts1_datafile.dat' |
| 86 |
USE LOGFILE GROUP lg1 |
| 87 |
INITIAL_SIZE 2M |
| 88 |
ENGINE NDB; |
| 89 |
|
| 90 |
CREATE TABLE t1 ( |
| 91 |
a INT PRIMARY KEY, |
| 92 |
b VARCHAR(255) |
| 93 |
) ENGINE NDB |
| 94 |
TABLESPACE ts1 |
| 95 |
STORAGE DISK; |
| 96 |
|
| 97 |
INSERT INTO t1 VALUES (1,'And Then There Were None'); |
| 98 |
|
| 99 |
# Backup |
| 100 |
--disable_query_log ONCE |
| 101 |
--source include/ndb_backup.inc |
| 102 |
|
| 103 |
DROP TABLE t1; |
| 104 |
ALTER TABLESPACE ts1 |
| 105 |
DROP DATAFILE 'ts1_datafile.dat'; |
| 106 |
DROP TABLESPACE ts1; |
| 107 |
DROP LOGFILE GROUP lg1 |
| 108 |
ENGINE NDB; |
| 109 |
|
| 110 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -m -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 111 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 112 |
|
| 113 |
--echo Restart server 1 to trigger schema synchronization |
| 114 |
--let $mysqld_name=mysqld.1.1 |
| 115 |
--source include/restart_mysqld.inc |
| 116 |
--connection server2 |
| 117 |
--echo Restart server 2 to trigger schema synchronization |
| 118 |
--let $mysqld_name=mysqld.2.1 |
| 119 |
--source include/restart_mysqld.inc |
| 120 |
--connection server1 |
| 121 |
|
| 122 |
# Check schema and then perform DML and DDL on the tables |
| 123 |
SHOW TABLES; |
| 124 |
SHOW CREATE TABLE t1; |
| 125 |
SELECT * FROM t1; |
| 126 |
|
| 127 |
--connection server2 |
| 128 |
SHOW TABLES; |
| 129 |
SHOW CREATE TABLE t1; |
| 130 |
SELECT * FROM t1; |
| 131 |
|
| 132 |
--connection server1 |
| 133 |
ALTER TABLE t1 DROP COLUMN b; |
| 134 |
INSERT INTO t1 VALUES(2); |
| 135 |
--sorted_result |
| 136 |
SELECT * FROM t1; |
| 137 |
DROP TABLE t1; |
| 138 |
ALTER TABLESPACE ts1 |
| 139 |
DROP DATAFILE 'ts1_datafile.dat'; |
| 140 |
DROP TABLESPACE ts1; |
| 141 |
DROP LOGFILE GROUP lg1 |
| 142 |
ENGINE NDB; |
| 143 |
|
| 144 |
--let $restart_parameters= |
| 145 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 146 |
--remove_file $NDB_TOOLS_OUTPUT |