File: mysql_upgrade_slave_master_info.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (141 lines) | stat: -rw-r--r-- 6,855 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 # === Purpose ===
 #
 # This test case will verify that the mysql_upgrade script
 # corrects the order of the columns Channel_name and Tls_version
 # in the table mysql.slave_master_info if their order was wrong.
 # In case of mysql_upgrade happening from a release where the above
 # two columns are not present in the table, the test case certifies
 # that the upgrade script adds them in the correct order.
 #
 # ==== Related Bugs and Worklogs ====
 #
 # Bug #24384561: 5.7.14 COMPLAINS ABOUT WRONG
 #                SLAVE_MASTER_INFO AFTER UPGRADE FROM 5.7.13
 #
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/mysql_upgrade_preparation.inc

USE test;

# Preserve the original state of the table so that it can be restored at the end of the test.
ALTER TABLE mysql.slave_master_info TABLESPACE innodb_file_per_table;
CREATE TABLE test.slave_master_info_backup LIKE mysql.slave_master_info;
ALTER TABLE mysql.slave_master_info TABLESPACE mysql;
INSERT INTO test.slave_master_info_backup SELECT * FROM mysql.slave_master_info;

CREATE TABLE test.original
SELECT COLUMN_NAME, ORDINAL_POSITION
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_NAME = "slave_master_info"
  AND TABLE_SCHEMA = "mysql";

--echo # Scenario 1:
--echo # Verify that the upgrade script works correctly when upgrading from the same version
--echo # i.e. when both the columns Channel_name and Tls_version are in the correct order.
--disable_result_log
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--enable_result_log

CREATE TABLE test.upgraded
SELECT COLUMN_NAME, ORDINAL_POSITION
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_NAME = "slave_master_info"
  AND TABLE_SCHEMA = "mysql";
--let $diff_tables= test.upgraded, test.original
--source include/diff_tables.inc
DROP TABLE test.upgraded;

--echo # Scenario 2:
--echo # Verify that the upgrade script corrects the order of columns Channel_name
--echo # and Tls_version in mysql.slave_master_info if the order is found to be wrong.

ALTER TABLE mysql.slave_master_info
  MODIFY COLUMN Channel_name char(64) NOT NULL COMMENT
  'The channel on which the slave is connected to a source. Used in Multisource Replication'
  AFTER Tls_version;

--echo # Running mysql_upgrade to update slave_master_info table
--disable_result_log
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--enable_result_log

--echo # Verify that the columns Channel_name and Tls_version are now in correct order.
CREATE TABLE test.upgraded
SELECT COLUMN_NAME, ORDINAL_POSITION
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_NAME = "slave_master_info"
  AND TABLE_SCHEMA = "mysql";
--let $diff_tables= test.upgraded, test.original
--source include/diff_tables.inc
DROP TABLE test.upgraded;

--echo # Scenario 3:
--echo # DROP slave_master_info table and re-create it as of MySQL 5.6.21

DROP table mysql.slave_master_info;

CREATE TABLE `mysql`.`slave_master_info` (
  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
  `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.',
  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
  `Host` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the source.',
  `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
  `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
  `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
  `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
  `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
  `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
  `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
  `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
  `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
  `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
  `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
  `Heartbeat` float NOT NULL,
  `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
  `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',
  `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
  `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
  `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
  `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
  `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
  PRIMARY KEY (`Host`,`Port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';

--echo #Running mysql_upgrade to update slave_master_info table
--disable_result_log
--let $restart_parameters = restart:--upgrade=FORCE
--let $wait_counter= 10000
--source include/restart_mysqld.inc
--enable_result_log

--echo #Verify that the columns Channel_name and Tls_version are added and are in correct order.
CREATE TABLE test.upgraded
SELECT COLUMN_NAME, ORDINAL_POSITION
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_NAME = "slave_master_info"
  AND TABLE_SCHEMA = "mysql";
--let $diff_tables= test.upgraded, test.original
--source include/diff_tables.inc
DROP TABLE test.upgraded;

# Cleanup:
TRUNCATE TABLE mysql.slave_master_info;
INSERT INTO mysql.slave_master_info SELECT * FROM test.slave_master_info_backup;

ALTER TABLE mysql.slave_master_info
  MODIFY Host VARCHAR(255) CHARACTER SET ASCII NULL COMMENT 'The host name of the source.',
  ALTER COLUMN Channel_name DROP DEFAULT;

DROP TABLE test.slave_master_info_backup;
DROP TABLE test.original;

--echo #Restart the server
--let $restart_parameters = restart
--source include/restart_mysqld.inc
--source include/mysql_upgrade_cleanup.inc