Skip to content

Commit 701cf90

Browse files
committed
BUG#33213841: MySQL crashes while executing RESET REPLICA ALL
When the replica SQL mode includes the mode 'PAD_CHAR_TO_FULL_LENGTH', the channel name can be read from the repository with trailing spaces what can lead to errors in operations that use that name to identify the channel. To solve this issue all CHAR columns in replication repository tables will be converted to VARCHAR making the table behavior always the same despite what the server SQL mode is. Merge branch 'mysql-5.7' into mysql-8.0 with a different patch ReviewBoard: 27008 ReviewBoard: 27047
2 parents 14e11b3 + 0e15863 commit 701cf90

20 files changed

+232
-201
lines changed

mysql-test/r/mysql_upgrade_slave_master_info.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ CREATE TABLE `mysql`.`slave_master_info` (
4141
`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
4242
`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.',
4343
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
44-
`Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
44+
`Host` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the source.',
4545
`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
4646
`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
4747
`Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
@@ -113,7 +113,7 @@ DROP TABLE test.upgraded;
113113
TRUNCATE TABLE mysql.slave_master_info;
114114
INSERT INTO mysql.slave_master_info SELECT * FROM test.slave_master_info_backup;
115115
ALTER TABLE mysql.slave_master_info
116-
MODIFY Host CHAR(255) CHARACTER SET ASCII NULL COMMENT 'The host name of the master.',
116+
MODIFY Host VARCHAR(255) CHARACTER SET ASCII NULL COMMENT 'The host name of the source.',
117117
ALTER COLUMN Channel_name DROP DEFAULT;
118118
DROP TABLE test.slave_master_info_backup;
119119
DROP TABLE test.original;

mysql-test/r/mysqldump.result

+6-6
Original file line numberDiff line numberDiff line change
@@ -5299,7 +5299,7 @@ CREATE TABLE IF NOT EXISTS `slave_master_info` (
52995299
`Number_of_lines` int unsigned NOT NULL COMMENT 'Number of lines in the file.',
53005300
`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.',
53015301
`Master_log_pos` bigint unsigned NOT NULL COMMENT 'The master log position of the last read event.',
5302-
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'The host name of the master.',
5302+
`Host` varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'The host name of the source.',
53035303
`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
53045304
`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
53055305
`Port` int unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
@@ -5319,12 +5319,12 @@ CREATE TABLE IF NOT EXISTS `slave_master_info` (
53195319
`Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
53205320
`Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
53215321
`Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
5322-
`Channel_name` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'The channel on which the slave is connected to a source. Used in Multisource Replication',
5322+
`Channel_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'The channel on which the replica is connected to a source. Used in Multisource Replication',
53235323
`Tls_version` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Tls version',
53245324
`Public_key_path` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file containing public key of master server.',
53255325
`Get_public_key` tinyint(1) NOT NULL COMMENT 'Preference to get public key from master.',
53265326
`Network_namespace` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Network namespace used for communication with the master server.',
5327-
`Master_compression_algorithm` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'Compression algorithm supported for data transfer between master and slave.',
5327+
`Master_compression_algorithm` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'Compression algorithm supported for data transfer between source and replica.',
53285328
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
53295329
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
53305330
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
@@ -5343,9 +5343,9 @@ CREATE TABLE IF NOT EXISTS `slave_relay_log_info` (
53435343
`Sql_delay` int DEFAULT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
53445344
`Number_of_workers` int unsigned DEFAULT NULL,
53455345
`Id` int unsigned DEFAULT NULL COMMENT 'Internal Id that uniquely identifies this record.',
5346-
`Channel_name` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'The channel on which the slave is connected to a source. Used in Multisource Replication',
5347-
`Privilege_checks_username` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Username part of PRIVILEGE_CHECKS_USER.',
5348-
`Privilege_checks_hostname` char(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'Hostname part of PRIVILEGE_CHECKS_USER.',
5346+
`Channel_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'The channel on which the replica is connected to a source. Used in Multisource Replication',
5347+
`Privilege_checks_username` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Username part of PRIVILEGE_CHECKS_USER.',
5348+
`Privilege_checks_hostname` varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'Hostname part of PRIVILEGE_CHECKS_USER.',
53495349
`Require_row_format` tinyint(1) NOT NULL COMMENT 'Indicates whether the channel shall only accept row based events.',
53505350
`Require_table_primary_key_check` enum('STREAM','ON','OFF') NOT NULL DEFAULT 'STREAM' COMMENT 'Indicates what is the channel policy regarding tables having primary keys on create and alter table queries',
53515351
`Assign_gtids_to_anonymous_transactions_type` enum('OFF','LOCAL','UUID') NOT NULL DEFAULT 'OFF' COMMENT 'Indicates whether the channel will generate a new GTID for anonymous transactions. OFF means that anonymous transactions will remain anonymous. LOCAL means that anonymous transactions will be assigned a newly generated GTID based on server_uuid. UUID indicates that anonymous transactions will be assigned a newly generated GTID based on Assign_gtids_to_anonymous_transactions_value',

mysql-test/std_data/dd/sdi/innodb_sdi/mysql.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -37398,7 +37398,7 @@
3739837398
},
3739937399
{
3740037400
"name": "Channel_name",
37401-
"type": 29,
37401+
"type": 16,
3740237402
"is_nullable": false,
3740337403
"is_zerofill": false,
3740437404
"is_unsigned": false,
@@ -37421,22 +37421,22 @@
3742137421
"default_value_utf8": "",
3742237422
"default_option": "",
3742337423
"update_option": "",
37424-
"comment": "The channel on which the slave is connected to a source. Used in Multisource Replication",
37424+
"comment": "The channel on which the replica is connected to a source. Used in Multisource Replication",
3742537425
"generation_expression": "",
3742637426
"generation_expression_utf8": "",
3742737427
"options": "interval_count=0;",
3742837428
"se_private_data": "table_id=X",
3742937429
"engine_attribute": "",
3743037430
"secondary_engine_attribute": "",
3743137431
"column_key": 2,
37432-
"column_type_utf8": "char(64)",
37432+
"column_type_utf8": "varchar(64)",
3743337433
"elements": [],
3743437434
"collation_id": X,
3743537435
"is_explicit_collation": true
3743637436
},
3743737437
{
3743837438
"name": "Privilege_checks_username",
37439-
"type": 29,
37439+
"type": 16,
3744037440
"is_nullable": true,
3744137441
"is_zerofill": false,
3744237442
"is_unsigned": false,
@@ -37467,14 +37467,14 @@
3746737467
"engine_attribute": "",
3746837468
"secondary_engine_attribute": "",
3746937469
"column_key": 1,
37470-
"column_type_utf8": "char(32)",
37470+
"column_type_utf8": "varchar(32)",
3747137471
"elements": [],
3747237472
"collation_id": X,
3747337473
"is_explicit_collation": true
3747437474
},
3747537475
{
3747637476
"name": "Privilege_checks_hostname",
37477-
"type": 29,
37477+
"type": 16,
3747837478
"is_nullable": true,
3747937479
"is_zerofill": false,
3748037480
"is_unsigned": false,
@@ -37505,7 +37505,7 @@
3750537505
"engine_attribute": "",
3750637506
"secondary_engine_attribute": "",
3750737507
"column_key": 1,
37508-
"column_type_utf8": "char(255)",
37508+
"column_type_utf8": "varchar(255)",
3750937509
"elements": [],
3751037510
"collation_id": X,
3751137511
"is_explicit_collation": true
@@ -38064,7 +38064,7 @@
3806438064
},
3806538065
{
3806638066
"name": "Host",
38067-
"type": 29,
38067+
"type": 16,
3806838068
"is_nullable": true,
3806938069
"is_zerofill": false,
3807038070
"is_unsigned": false,
@@ -38087,15 +38087,15 @@
3808738087
"default_value_utf8": "",
3808838088
"default_option": "",
3808938089
"update_option": "",
38090-
"comment": "The host name of the master.",
38090+
"comment": "The host name of the source.",
3809138091
"generation_expression": "",
3809238092
"generation_expression_utf8": "",
3809338093
"options": "interval_count=0;",
3809438094
"se_private_data": "table_id=X",
3809538095
"engine_attribute": "",
3809638096
"secondary_engine_attribute": "",
3809738097
"column_key": 1,
38098-
"column_type_utf8": "char(255)",
38098+
"column_type_utf8": "varchar(255)",
3809938099
"elements": [],
3810038100
"collation_id": X,
3810138101
"is_explicit_collation": true
@@ -38824,7 +38824,7 @@
3882438824
},
3882538825
{
3882638826
"name": "Channel_name",
38827-
"type": 29,
38827+
"type": 16,
3882838828
"is_nullable": false,
3882938829
"is_zerofill": false,
3883038830
"is_unsigned": false,
@@ -38847,15 +38847,15 @@
3884738847
"default_value_utf8": "",
3884838848
"default_option": "",
3884938849
"update_option": "",
38850-
"comment": "The channel on which the slave is connected to a source. Used in Multisource Replication",
38850+
"comment": "The channel on which the replica is connected to a source. Used in Multisource Replication",
3885138851
"generation_expression": "",
3885238852
"generation_expression_utf8": "",
3885338853
"options": "interval_count=0;",
3885438854
"se_private_data": "table_id=X",
3885538855
"engine_attribute": "",
3885638856
"secondary_engine_attribute": "",
3885738857
"column_key": 2,
38858-
"column_type_utf8": "char(64)",
38858+
"column_type_utf8": "varchar(64)",
3885938859
"elements": [],
3886038860
"collation_id": X,
3886138861
"is_explicit_collation": true
@@ -39014,7 +39014,7 @@
3901439014
},
3901539015
{
3901639016
"name": "Master_compression_algorithm",
39017-
"type": 29,
39017+
"type": 16,
3901839018
"is_nullable": false,
3901939019
"is_zerofill": false,
3902039020
"is_unsigned": false,
@@ -39037,15 +39037,15 @@
3903739037
"default_value_utf8": "",
3903839038
"default_option": "",
3903939039
"update_option": "",
39040-
"comment": "Compression algorithm supported for data transfer between master and slave.",
39040+
"comment": "Compression algorithm supported for data transfer between source and replica.",
3904139041
"generation_expression": "",
3904239042
"generation_expression_utf8": "",
3904339043
"options": "interval_count=0;",
3904439044
"se_private_data": "table_id=X",
3904539045
"engine_attribute": "",
3904639046
"secondary_engine_attribute": "",
3904739047
"column_key": 1,
39048-
"column_type_utf8": "char(64)",
39048+
"column_type_utf8": "varchar(64)",
3904939049
"elements": [],
3905039050
"collation_id": X,
3905139051
"is_explicit_collation": true
@@ -40046,7 +40046,7 @@
4004640046
},
4004740047
{
4004840048
"name": "Channel_name",
40049-
"type": 29,
40049+
"type": 16,
4005040050
"is_nullable": false,
4005140051
"is_zerofill": false,
4005240052
"is_unsigned": false,
@@ -40069,15 +40069,15 @@
4006940069
"default_value_utf8": "",
4007040070
"default_option": "",
4007140071
"update_option": "",
40072-
"comment": "The channel on which the slave is connected to a source. Used in Multisource Replication",
40072+
"comment": "The channel on which the replica is connected to a source. Used in Multisource Replication",
4007340073
"generation_expression": "",
4007440074
"generation_expression_utf8": "",
4007540075
"options": "interval_count=0;",
4007640076
"se_private_data": "table_id=X",
4007740077
"engine_attribute": "",
4007840078
"secondary_engine_attribute": "",
4007940079
"column_key": 2,
40080-
"column_type_utf8": "char(64)",
40080+
"column_type_utf8": "varchar(64)",
4008140081
"elements": [],
4008240082
"collation_id": X,
4008340083
"is_explicit_collation": true

0 commit comments

Comments
 (0)