|
| 1 | +# ==== Purpose ==== |
| 2 | +# |
| 3 | +# While upgrading from "mysql" to "mariadb" if slave info repositories are |
| 4 | +# configured to be tables then appropriate warnings should be reported. |
| 5 | +# |
| 6 | +# ==== Implementation ==== |
| 7 | +# |
| 8 | +# Steps: |
| 9 | +# 1 - On MariaDB server create `mysql`.`slave_master_info` and |
| 10 | +# `mysql.slave_relay_log_info` tables to simulate upgrade from "mysql" |
| 11 | +# to "mariadb" server. Insert data into these tables. |
| 12 | +# 2 - Execute "mysql_upgrade" script and verify that appropriate warning |
| 13 | +# is reported. i.e Warning is to alert user that the data present in |
| 14 | +# repository tables will be ignored. |
| 15 | +# 3 - Truncate these tables. This simulates repositories being file and |
| 16 | +# the tables are empty. |
| 17 | +# 4 - Execute "mysql_upgrade" script and verify that no warnings are |
| 18 | +# reported. |
| 19 | +# |
| 20 | +# ==== References ==== |
| 21 | +# |
| 22 | +# MDEV-10047: table-based master info repository |
| 23 | +# |
| 24 | + |
| 25 | +--source include/have_innodb.inc |
| 26 | +--source include/mysql_upgrade_preparation.inc |
| 27 | +--source include/have_binlog_format_mixed.inc |
| 28 | +--source include/master-slave.inc |
| 29 | + |
| 30 | +--write_file $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql |
| 31 | +--disable_query_log |
| 32 | +--disable_result_log |
| 33 | +SET SQL_LOG_BIN=0; |
| 34 | +# Table structure extracted from MySQL-5.6.47 |
| 35 | +CREATE TABLE `mysql`.`slave_master_info` ( |
| 36 | + `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.', |
| 37 | + `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.', |
| 38 | + `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.', |
| 39 | + `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.', |
| 40 | + `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.', |
| 41 | + `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.', |
| 42 | + `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.', |
| 43 | + `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.', |
| 44 | + `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.', |
| 45 | + `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.', |
| 46 | + `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.', |
| 47 | + `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.', |
| 48 | + `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.', |
| 49 | + `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.', |
| 50 | + `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.', |
| 51 | + `Heartbeat` float NOT NULL, |
| 52 | + `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server', |
| 53 | + `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', |
| 54 | + `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.', |
| 55 | + `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.', |
| 56 | + `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)', |
| 57 | + `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files', |
| 58 | + `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.', |
| 59 | + PRIMARY KEY (`Host`,`Port`) |
| 60 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information'; |
| 61 | + |
| 62 | +INSERT INTO `mysql`.`slave_master_info` VALUES (23,'master-bin.000001', 120, 'localhost', 'root'," ", 13000, 60, 0," "," "," "," "," ",0 , 60," ", " ", '28e10fdd-6289-11ea-aab9-207918567a34',10," "," ", 0 ); |
| 63 | + |
| 64 | +# Table structure extracted from MySQL-5.6.47 |
| 65 | +CREATE TABLE `mysql`.`slave_relay_log_info` ( |
| 66 | + `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.', |
| 67 | + `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.', |
| 68 | + `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.', |
| 69 | + `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.', |
| 70 | + `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.', |
| 71 | + `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.', |
| 72 | + `Number_of_workers` int(10) unsigned NOT NULL, |
| 73 | + `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.', |
| 74 | + PRIMARY KEY (`Id`) |
| 75 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'; |
| 76 | + |
| 77 | +INSERT INTO `mysql`.`slave_relay_log_info` VALUES (7,'./slave-relay-bin.000001',4 ," ",0, 0 ,0 , 1); |
| 78 | +SET SQL_LOG_BIN=1; |
| 79 | +--enable_query_log |
| 80 | +--enable_result_log |
| 81 | +EOF |
| 82 | + |
| 83 | +--echo ******************************************************************** |
| 84 | +--echo * Test case1: Upgrade when repository tables have data. * |
| 85 | +--echo * mysql_upgrade script should report warnings. * |
| 86 | +--echo ******************************************************************** |
| 87 | +--connection master |
| 88 | +--source $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql |
| 89 | +--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log 2>&1 |
| 90 | +--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log |
| 91 | + |
| 92 | +--connection slave |
| 93 | +--source $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql |
| 94 | +--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log 2>&1 |
| 95 | +--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log |
| 96 | + |
| 97 | +--connection master |
| 98 | +let $datadir= `select @@datadir`; |
| 99 | +remove_file $datadir/mysql_upgrade_info; |
| 100 | +TRUNCATE TABLE `mysql`.`slave_master_info`; |
| 101 | +TRUNCATE TABLE `mysql`.`slave_relay_log_info`; |
| 102 | +--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log |
| 103 | +--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log |
| 104 | + |
| 105 | +--echo ******************************************************************** |
| 106 | +--echo * Test case2: Upgrade when repository tables are empty. * |
| 107 | +--echo * mysql_upgrade script should not report any warning. * |
| 108 | +--echo ******************************************************************** |
| 109 | +--connection master |
| 110 | +--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log 2>&1 |
| 111 | +--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log |
| 112 | + |
| 113 | +--connection slave |
| 114 | +--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log 2>&1 |
| 115 | +--cat_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log |
| 116 | + |
| 117 | +--echo "====== Clean up ======" |
| 118 | +--connection master |
| 119 | +let $datadir= `select @@datadir`; |
| 120 | +remove_file $datadir/mysql_upgrade_info; |
| 121 | +DROP TABLE `mysql`.`slave_master_info`, `mysql`.`slave_relay_log_info`; |
| 122 | + |
| 123 | +--remove_file $MYSQLTEST_VARDIR/tmp/slave_table_repo_init.sql |
| 124 | +--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_master.log |
| 125 | +--remove_file $MYSQLTEST_VARDIR/log/mysql_upgrade_slave.log |
| 126 | + |
| 127 | +--source include/rpl_end.inc |
0 commit comments