|
| 1 | +USE test; |
| 2 | +CREATE TABLE test.slave_master_info_backup LIKE mysql.slave_master_info; |
| 3 | +INSERT INTO test.slave_master_info_backup SELECT * FROM mysql.slave_master_info; |
| 4 | +USE mysql; |
| 5 | +CREATE TABLE test.original |
| 6 | +SELECT COLUMN_NAME, ORDINAL_POSITION |
| 7 | +FROM INFORMATION_SCHEMA.COLUMNS |
| 8 | +WHERE TABLE_NAME = "slave_master_info" |
| 9 | + AND TABLE_SCHEMA = "mysql"; |
| 10 | +# Scenario 1: |
| 11 | +# Verify that the upgrade script works correctly when upgrading from the same version |
| 12 | +# i.e. when both the columns Channel_name and Tls_version are in the correct order. |
| 13 | +mysql.columns_priv OK |
| 14 | +mysql.db OK |
| 15 | +mysql.engine_cost OK |
| 16 | +mysql.event OK |
| 17 | +mysql.func OK |
| 18 | +mysql.general_log OK |
| 19 | +mysql.gtid_executed OK |
| 20 | +mysql.help_category OK |
| 21 | +mysql.help_keyword OK |
| 22 | +mysql.help_relation OK |
| 23 | +mysql.help_topic OK |
| 24 | +mysql.innodb_index_stats OK |
| 25 | +mysql.innodb_table_stats OK |
| 26 | +mysql.ndb_binlog_index OK |
| 27 | +mysql.plugin OK |
| 28 | +mysql.proc OK |
| 29 | +mysql.procs_priv OK |
| 30 | +mysql.proxies_priv OK |
| 31 | +mysql.server_cost OK |
| 32 | +mysql.servers OK |
| 33 | +mysql.slave_master_info OK |
| 34 | +mysql.slave_relay_log_info OK |
| 35 | +mysql.slave_worker_info OK |
| 36 | +mysql.slow_log OK |
| 37 | +mysql.tables_priv OK |
| 38 | +mysql.time_zone OK |
| 39 | +mysql.time_zone_leap_second OK |
| 40 | +mysql.time_zone_name OK |
| 41 | +mysql.time_zone_transition OK |
| 42 | +mysql.time_zone_transition_type OK |
| 43 | +mysql.user OK |
| 44 | +mtr.global_suppressions OK |
| 45 | +mtr.test_suppressions OK |
| 46 | +sys.sys_config OK |
| 47 | +test.original OK |
| 48 | +test.slave_master_info_backup OK |
| 49 | +CREATE TABLE test.upgraded |
| 50 | +SELECT COLUMN_NAME, ORDINAL_POSITION |
| 51 | +FROM INFORMATION_SCHEMA.COLUMNS |
| 52 | +WHERE TABLE_NAME = "slave_master_info" |
| 53 | + AND TABLE_SCHEMA = "mysql"; |
| 54 | +include/diff_tables.inc [test.upgraded, test.original] |
| 55 | +DROP TABLE test.upgraded; |
| 56 | +# Scenario 2: |
| 57 | +# Verify that the upgrade script corrects the order of columns Channel_name |
| 58 | +# and Tls_version in mysql.slave_master_info if the order is found to be wrong. |
| 59 | +ALTER TABLE slave_master_info |
| 60 | +MODIFY COLUMN Channel_name char(64) NOT NULL COMMENT |
| 61 | +'The channel on which the slave is connected to a source. Used in Multisource Replication' |
| 62 | + AFTER Tls_version; |
| 63 | +# Running mysql_upgrade to update slave_master_info table |
| 64 | +mysql.columns_priv OK |
| 65 | +mysql.db OK |
| 66 | +mysql.engine_cost OK |
| 67 | +mysql.event OK |
| 68 | +mysql.func OK |
| 69 | +mysql.general_log OK |
| 70 | +mysql.gtid_executed OK |
| 71 | +mysql.help_category OK |
| 72 | +mysql.help_keyword OK |
| 73 | +mysql.help_relation OK |
| 74 | +mysql.help_topic OK |
| 75 | +mysql.innodb_index_stats OK |
| 76 | +mysql.innodb_table_stats OK |
| 77 | +mysql.ndb_binlog_index OK |
| 78 | +mysql.plugin OK |
| 79 | +mysql.proc OK |
| 80 | +mysql.procs_priv OK |
| 81 | +mysql.proxies_priv OK |
| 82 | +mysql.server_cost OK |
| 83 | +mysql.servers OK |
| 84 | +mysql.slave_master_info OK |
| 85 | +mysql.slave_relay_log_info OK |
| 86 | +mysql.slave_worker_info OK |
| 87 | +mysql.slow_log OK |
| 88 | +mysql.tables_priv OK |
| 89 | +mysql.time_zone OK |
| 90 | +mysql.time_zone_leap_second OK |
| 91 | +mysql.time_zone_name OK |
| 92 | +mysql.time_zone_transition OK |
| 93 | +mysql.time_zone_transition_type OK |
| 94 | +mysql.user OK |
| 95 | +mtr.global_suppressions OK |
| 96 | +mtr.test_suppressions OK |
| 97 | +sys.sys_config OK |
| 98 | +test.original OK |
| 99 | +test.slave_master_info_backup OK |
| 100 | +# Verify that the columns Channel_name and Tls_version are now in correct order. |
| 101 | +CREATE TABLE test.upgraded |
| 102 | +SELECT COLUMN_NAME, ORDINAL_POSITION |
| 103 | +FROM INFORMATION_SCHEMA.COLUMNS |
| 104 | +WHERE TABLE_NAME = "slave_master_info" |
| 105 | + AND TABLE_SCHEMA = "mysql"; |
| 106 | +include/diff_tables.inc [test.upgraded, test.original] |
| 107 | +DROP TABLE test.upgraded; |
| 108 | +# Scenario 3: |
| 109 | +# DROP slave_master_info table and re-create it as of MySQL 5.6.21 |
| 110 | +DROP table slave_master_info; |
| 111 | +CREATE TABLE `slave_master_info` ( |
| 112 | +`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.', |
| 113 | +`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.', |
| 114 | +`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.', |
| 115 | +`Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.', |
| 116 | +`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.', |
| 117 | +`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.', |
| 118 | +`Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.', |
| 119 | +`Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.', |
| 120 | +`Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.', |
| 121 | +`Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.', |
| 122 | +`Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.', |
| 123 | +`Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.', |
| 124 | +`Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.', |
| 125 | +`Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.', |
| 126 | +`Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.', |
| 127 | +`Heartbeat` float NOT NULL, |
| 128 | +`Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server', |
| 129 | +`Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs', |
| 130 | +`Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.', |
| 131 | +`Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.', |
| 132 | +`Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)', |
| 133 | +`Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files', |
| 134 | +`Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.', |
| 135 | +PRIMARY KEY (`Host`,`Port`) |
| 136 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information'; |
| 137 | +#Running mysql_upgrade to update slave_master_info table |
| 138 | +mysql.columns_priv OK |
| 139 | +mysql.db OK |
| 140 | +mysql.engine_cost OK |
| 141 | +mysql.event OK |
| 142 | +mysql.func OK |
| 143 | +mysql.general_log OK |
| 144 | +mysql.gtid_executed OK |
| 145 | +mysql.help_category OK |
| 146 | +mysql.help_keyword OK |
| 147 | +mysql.help_relation OK |
| 148 | +mysql.help_topic OK |
| 149 | +mysql.innodb_index_stats OK |
| 150 | +mysql.innodb_table_stats OK |
| 151 | +mysql.ndb_binlog_index OK |
| 152 | +mysql.plugin OK |
| 153 | +mysql.proc OK |
| 154 | +mysql.procs_priv OK |
| 155 | +mysql.proxies_priv OK |
| 156 | +mysql.server_cost OK |
| 157 | +mysql.servers OK |
| 158 | +mysql.slave_master_info OK |
| 159 | +mysql.slave_relay_log_info OK |
| 160 | +mysql.slave_worker_info OK |
| 161 | +mysql.slow_log OK |
| 162 | +mysql.tables_priv OK |
| 163 | +mysql.time_zone OK |
| 164 | +mysql.time_zone_leap_second OK |
| 165 | +mysql.time_zone_name OK |
| 166 | +mysql.time_zone_transition OK |
| 167 | +mysql.time_zone_transition_type OK |
| 168 | +mysql.user OK |
| 169 | +mtr.global_suppressions OK |
| 170 | +mtr.test_suppressions OK |
| 171 | +sys.sys_config OK |
| 172 | +test.original OK |
| 173 | +test.slave_master_info_backup OK |
| 174 | +#Verify that the columns Channel_name and Tls_version are added and are in correct order. |
| 175 | +CREATE TABLE test.upgraded |
| 176 | +SELECT COLUMN_NAME, ORDINAL_POSITION |
| 177 | +FROM INFORMATION_SCHEMA.COLUMNS |
| 178 | +WHERE TABLE_NAME = "slave_master_info" |
| 179 | + AND TABLE_SCHEMA = "mysql"; |
| 180 | +include/diff_tables.inc [test.upgraded, test.original] |
| 181 | +DROP TABLE test.upgraded; |
| 182 | +DROP TABLE mysql.slave_master_info; |
| 183 | +RENAME TABLE test.slave_master_info_backup TO mysql.slave_master_info; |
| 184 | +DROP TABLE test.original; |
0 commit comments