Skip to content

Commit db394e5

Browse files
committed
WL#7491: GTID-based replication applier recovery and positioning
Step 4: Persistent configuration: Save the configuration in replication repositories. Step 5: Upgrades: Add the column to mysql.slave_master_info during upgrade. ReviewBoard: 26589
1 parent 017f998 commit db394e5

24 files changed

+705
-148
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# ==== Purpose ====
2+
#
3+
# This file restarts a server after replacing its connection info repository file
4+
#
5+
# ==== Usage ====
6+
#
7+
# --let $sub_testcase= <sub testcase name>
8+
#
9+
# Parameters:
10+
# $replica_server_num
11+
# The number of the replica server for which operations in this script
12+
# are to be performed.
13+
# $repo_info_file_path
14+
# The repository file with path included
15+
# $rpl_server_restart_parameters
16+
# The parameters passed to the server on start
17+
# $sub_testcase
18+
# The test case name for which file repo is to be prepared.
19+
20+
--write_file $MYSQL_TMP_DIR/create_file_repo_with_no_gitd_only.inc END_OF_PROCEDURE
21+
--write_file $repo_info_file_path
22+
32
23+
master-bin.000001
24+
156
25+
127.0.0.1
26+
root
27+
28+
13000
29+
1
30+
0
31+
32+
33+
34+
35+
36+
0
37+
30.000
38+
39+
0
40+
6b3ce8fe-81b7-11eb-b24e-001cbfe2e6a4
41+
10
42+
43+
44+
0
45+
46+
47+
48+
0
49+
50+
uncompressed
51+
3
52+
53+
0
54+
EOF
55+
END_OF_PROCEDURE
56+
57+
--let $rpl_server_number = $slave_server_num
58+
--let $rpl_force_stop=1
59+
--source include/rpl_stop_server.inc
60+
--remove_file $repo_info_file_path
61+
62+
if ($sub_testcase == no_gtid_only) {
63+
--source $MYSQL_TMP_DIR/create_file_repo_with_no_gitd_only.inc
64+
}
65+
66+
--let $rpl_server_parameters= $rpl_server_restart_parameters
67+
68+
--let $explicit_default_wait_counter = 15000
69+
--source include/rpl_start_server.inc
70+
71+
--remove_file $MYSQL_TMP_DIR/create_file_repo_with_no_gitd_only.inc

mysql-test/extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# ==== Usage ====
66
#
7-
# --sub_testcase= <sub testcase name>
7+
# --let $sub_testcase= <sub testcase name>
88
#
99
# Parameters:
1010
# $slave_server_num

mysql-test/r/information_schema_keywords.result

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ GROUP 1
230230
GROUPING 1
231231
GROUPS 1
232232
GROUP_REPLICATION 0
233+
GTID_ONLY 0
233234
HANDLER 0
234235
HASH 0
235236
HAVING 1

mysql-test/r/mysqldump.result

+1
Original file line numberDiff line numberDiff line change
@@ -5328,6 +5328,7 @@ CREATE TABLE IF NOT EXISTS `slave_master_info` (
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.',
5331+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
53315332
PRIMARY KEY (`Channel_name`)
53325333
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information';
53335334
/*!40101 SET character_set_client = @saved_cs_client */;

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

+49-4
Original file line numberDiff line numberDiff line change
@@ -39164,6 +39164,44 @@
3916439164
"collation_id": X,
3916539165
"is_explicit_collation": false
3916639166
},
39167+
{
39168+
"name": "Gtid_only",
39169+
"type": 2,
39170+
"is_nullable": false,
39171+
"is_zerofill": false,
39172+
"is_unsigned": false,
39173+
"is_auto_increment": false,
39174+
"is_virtual": false,
39175+
"hidden": 1,
39176+
"ordinal_position": 33,
39177+
"char_length": 1,
39178+
"numeric_precision": 3,
39179+
"numeric_scale": 0,
39180+
"numeric_scale_null": false,
39181+
"datetime_precision": 0,
39182+
"datetime_precision_null": 1,
39183+
"has_no_default": false,
39184+
"default_value_null": false,
39185+
"srs_id_null": true,
39186+
"srs_id": 0,
39187+
"default_value": "",
39188+
"default_value_utf8_null": false,
39189+
"default_value_utf8": "0",
39190+
"default_option": "",
39191+
"update_option": "",
39192+
"comment": "Indicates if this channel only uses GTIDs and does not persist positions.",
39193+
"generation_expression": "",
39194+
"generation_expression_utf8": "",
39195+
"options": "interval_count=0;",
39196+
"se_private_data": "table_id=X",
39197+
"engine_attribute": "",
39198+
"secondary_engine_attribute": "",
39199+
"column_key": 1,
39200+
"column_type_utf8": "tinyint(1)",
39201+
"elements": [],
39202+
"collation_id": X,
39203+
"is_explicit_collation": false
39204+
},
3916739205
{
3916839206
"name": "DB_TRX_ID",
3916939207
"type": 10,
@@ -39173,7 +39211,7 @@
3917339211
"is_auto_increment": false,
3917439212
"is_virtual": false,
3917539213
"hidden": 2,
39176-
"ordinal_position": 33,
39214+
"ordinal_position": 34,
3917739215
"char_length": 6,
3917839216
"numeric_precision": 0,
3917939217
"numeric_scale": 0,
@@ -39211,7 +39249,7 @@
3921139249
"is_auto_increment": false,
3921239250
"is_virtual": false,
3921339251
"hidden": 2,
39214-
"ordinal_position": 34,
39252+
"ordinal_position": 35,
3921539253
"char_length": 7,
3921639254
"numeric_precision": 0,
3921739255
"numeric_scale": 0,
@@ -39287,14 +39325,14 @@
3928739325
"length": 4294967295,
3928839326
"order": 2,
3928939327
"hidden": true,
39290-
"column_opx": 32
39328+
"column_opx": 33
3929139329
},
3929239330
{
3929339331
"ordinal_position": 3,
3929439332
"length": 4294967295,
3929539333
"order": 2,
3929639334
"hidden": true,
39297-
"column_opx": 33
39335+
"column_opx": 34
3929839336
},
3929939337
{
3930039338
"ordinal_position": 4,
@@ -39512,6 +39550,13 @@
3951239550
"order": 2,
3951339551
"hidden": true,
3951439552
"column_opx": 31
39553+
},
39554+
{
39555+
"ordinal_position": 35,
39556+
"length": 4294967295,
39557+
"order": 2,
39558+
"hidden": true,
39559+
"column_opx": 32
3951539560
}
3951639561
],
3951739562
"tablespace_ref": "mysql"

mysql-test/suite/funcs_1/r/is_columns_mysql.result

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def mysql slave_master_info Master_compression_algorithm 29 NULL NO char 64 192
183183
def mysql slave_master_info Master_zstd_compression_level 30 NULL NO int NULL NULL 10 0 NULL NULL NULL int unsigned select,insert,update,references Compression level associated with zstd compression algorithm. NULL
184184
def mysql slave_master_info Tls_ciphersuites 31 NULL YES text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references Ciphersuites used for TLS 1.3 communication with the master server. NULL
185185
def mysql slave_master_info Source_connection_auto_failover 32 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references Indicates whether the channel connection failover is enabled. NULL
186+
def mysql slave_master_info Gtid_only 33 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references Indicates if this channel only uses GTIDs and does not persist positions. NULL
186187
def mysql slave_relay_log_info Number_of_lines 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int unsigned select,insert,update,references Number of lines in the file or rows in the table. Used to version table definitions. NULL
187188
def mysql slave_relay_log_info Relay_log_name 2 NULL YES text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references The name of the current relay log file. NULL
188189
def mysql slave_relay_log_info Relay_log_pos 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select,insert,update,references The relay log position of the last executed event. NULL
@@ -545,6 +546,7 @@ NULL mysql slave_master_info Get_public_key tinyint NULL NULL NULL NULL tinyint(
545546
NULL mysql slave_master_info Master_zstd_compression_level int NULL NULL NULL NULL int unsigned
546547
1.0000 mysql slave_master_info Tls_ciphersuites text 65535 65535 utf8 utf8_bin text
547548
NULL mysql slave_master_info Source_connection_auto_failover tinyint NULL NULL NULL NULL tinyint(1)
549+
NULL mysql slave_master_info Gtid_only tinyint NULL NULL NULL NULL tinyint(1)
548550
NULL mysql slave_relay_log_info Number_of_lines int NULL NULL NULL NULL int unsigned
549551
1.0000 mysql slave_relay_log_info Relay_log_name text 65535 65535 utf8 utf8_bin text
550552
NULL mysql slave_relay_log_info Relay_log_pos bigint NULL NULL NULL NULL bigint unsigned

mysql-test/suite/rpl/r/rpl_row_mts_rec_crash_safe.result

+2
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
356356
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
357357
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
358358
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
359+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
359360
PRIMARY KEY (`Channel_name`)
360361
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
361362
SHOW CREATE TABLE mysql.slave_relay_log_info;
@@ -434,6 +435,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
434435
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
435436
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
436437
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
438+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
437439
PRIMARY KEY (`Channel_name`)
438440
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
439441
SHOW CREATE TABLE mysql.slave_relay_log_info;

mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe.result

+2
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
356356
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
357357
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
358358
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
359+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
359360
PRIMARY KEY (`Channel_name`)
360361
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
361362
SHOW CREATE TABLE mysql.slave_relay_log_info;
@@ -434,6 +435,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
434435
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
435436
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
436437
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
438+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
437439
PRIMARY KEY (`Channel_name`)
438440
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
439441
SHOW CREATE TABLE mysql.slave_relay_log_info;

mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe_checksum.result

+2
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
356356
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
357357
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
358358
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
359+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
359360
PRIMARY KEY (`Channel_name`)
360361
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
361362
SHOW CREATE TABLE mysql.slave_relay_log_info;
@@ -434,6 +435,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
434435
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
435436
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
436437
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
438+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
437439
PRIMARY KEY (`Channel_name`)
438440
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
439441
SHOW CREATE TABLE mysql.slave_relay_log_info;

mysql-test/suite/rpl/r/rpl_stm_mixed_mts_rec_crash_safe_small.result

+2
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
463463
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
464464
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
465465
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
466+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
466467
PRIMARY KEY (`Channel_name`)
467468
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
468469
SHOW CREATE TABLE mysql.slave_relay_log_info;
@@ -541,6 +542,7 @@ slave_master_info CREATE TABLE `slave_master_info` (
541542
`Master_zstd_compression_level` int unsigned NOT NULL COMMENT 'Compression level associated with zstd compression algorithm.',
542543
`Tls_ciphersuites` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Ciphersuites used for TLS 1.3 communication with the master server.',
543544
`Source_connection_auto_failover` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates whether the channel connection failover is enabled.',
545+
`Gtid_only` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if this channel only uses GTIDs and does not persist positions.',
544546
PRIMARY KEY (`Channel_name`)
545547
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Master Information'
546548
SHOW CREATE TABLE mysql.slave_relay_log_info;

mysql-test/suite/rpl/t/rpl_log_info_repository_persistence_assign_gtids_to_anonymous_transactions.test

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
# WL#12819:GTIDs: Replicate from GTID disabled source to GTID enabled replica directly
6969

7070
--source include/big_test.inc
71-
--source include/have_debug.inc
7271
--source include/not_group_replication_plugin.inc
7372
# This test is unrelated to log format
7473
--source include/have_binlog_format_row.inc

mysql-test/suite/rpl_gtid/r/rpl_group_replication_channel_defaults_on_creation.result

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CREATE USER 'u1'@'localhost';
77
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = 'u1'@'localhost' FOR CHANNEL "group_replication_applier";
88
include/assert.inc [Auto_position is set to 1 for GR applier channel]
99
include/assert.inc [Require_row_format is set to 1 for GR applier channel]
10+
include/assert.inc [Gtid_only is set to 1 for GR applier channel]
1011
#
1112
# 3. For the group replication applier channel
1213
# Verify SOURCE_AUTO_POSITION, REQUIRE_ROW_FORMAT and GTID_ONLY can't be modified
@@ -24,12 +25,14 @@ CHANGE REPLICATION SOURCE TO GTID_ONLY = 1 FOR CHANNEL "group_replication_applie
2425
ERROR HY000: CHANGE MASTER with the given parameters cannot be performed on channel 'group_replication_applier'.
2526
include/assert.inc [Auto_position is set to 1 for GR applier channel]
2627
include/assert.inc [Require_row_format is set to 1 for GR applier channel]
28+
include/assert.inc [Gtid_only is set to 1 for GR applier channel]
2729
#
2830
# 4. Create a group replication recovery channel
2931
# Verify SOURCE_AUTO_POSITION, REQUIRE_ROW_FORMAT and GTID_ONLY are enabled
3032
CHANGE REPLICATION SOURCE TO PRIVILEGE_CHECKS_USER = 'u1'@'localhost' FOR CHANNEL "group_replication_recovery";
3133
include/assert.inc [Auto_position is set to 1 for GR recovery channel]
3234
include/assert.inc [Require_row_format is set to 1 for GR recovery channel]
35+
include/assert.inc [Gtid_only is set to 1 for GR recovery channel]
3336
#
3437
# 5. For the group replication recovery channel
3538
# Verify SOURCE_AUTO_POSITION, REQUIRE_ROW_FORMAT and GTID_ONLY can't be modified
@@ -47,6 +50,7 @@ CHANGE REPLICATION SOURCE TO GTID_ONLY = 1 FOR CHANNEL "group_replication_recove
4750
ERROR HY000: CHANGE MASTER with the given parameters cannot be performed on channel 'group_replication_recovery'.
4851
include/assert.inc [Auto_position is set to 1 for GR recovery channel]
4952
include/assert.inc [Require_row_format is set to 1 for GR recovery channel]
53+
include/assert.inc [Gtid_only is set to 1 for GR recovery channel]
5054
#
5155
# 6. Delete the channels
5256
# Verify they cannot be created when GTID_MODE != ON

0 commit comments

Comments
 (0)