Skip to content

Commit a9d87ee

Browse files
author
Pedro Figueiredo
committed
BUG#30311908 RESTARTING SERVER POST 'RESET SLAVE', CLEANS UP SLAVE_RELAY_LOG_INFO SETTINGS
Description ----------- While implementing WL#12966 and WL#12968, decision was made to not clear `PRIVILEGE_CHECKS_USER` and `REQUIRES_ROW_FORMAT` options values when performing a `RESET SLAVE`. The state of such options is not kept if after a `RESET SLAVE` the server is restarted. Analysis -------- Although the option values are kept in memory after a `RESET SLAVE`, the same values are not persisted into the configured repository in order to be reloaded into memory after a server restart. Fix --- 1) Make `Relay_log_info` fields nullable. 2) Make `RESET SLAVE` clear all field values except for `PRIVILEGE_CHECKS_USER` and `REQUIRE_ROW_FORMAT`. 3) Persist the cleared record into the relay-log repositories. 4) Change boot logic so that the cleared record is used to instantiate `PRIVILEGE_CHECKS_USER` and `REQUIRE_ROW_FORMAT` and then relay log is initialized as before. RB: 23376 Reviewed-by: Pedro Gomes <pedro.gomes@oracle.com> Reviewed-by: Luís Soares <luis.soares@oracle.com>
1 parent ab8c662 commit a9d87ee

29 files changed

+618
-287
lines changed

mysql-test/include/rpl_end.inc

+10-1
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,22 @@ while ($_rpl_server)
206206
--enable_query_log
207207
}
208208

209-
# Drop created privileged database
209+
# Restore state for PRIVILEGE_CHECKS_USER
210210
if ($rpl_privilege_checks_user)
211211
{
212212
--disable_query_log
213213
SET @@sql_log_bin = 0;
214+
# Drop created privileged database
214215
DROP DATABASE rpl_priv;
215216
SET @@sql_log_bin = 1;
217+
CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL;
218+
--enable_query_log
219+
}
220+
# Restore state for REQUIRE_ROW_FORMAT
221+
if ($rpl_require_row_format)
222+
{
223+
--disable_query_log
224+
CHANGE MASTER TO REQUIRE_ROW_FORMAT=0;
216225
--enable_query_log
217226
}
218227

mysql-test/include/rpl_reset_slave_helper.inc

+16-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,26 @@ if (!$rpl_reset_slave_all)
55
{
66
if (!$rpl_multi_source)
77
{
8+
if ($rpl_privilege_checks_user)
9+
{
10+
CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL;
11+
}
12+
if ($rpl_require_row_format)
13+
{
14+
CHANGE MASTER TO REQUIRE_ROW_FORMAT=0;
15+
}
816
RESET SLAVE;
917
}
1018
if ($rpl_multi_source)
1119
{
20+
if ($rpl_privilege_checks_user)
21+
{
22+
eval CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL FOR CHANNEL $rpl_channel_name;
23+
}
24+
if ($rpl_require_row_format)
25+
{
26+
eval CHANGE MASTER TO REQUIRE_ROW_FORMAT=0 FOR CHANNEL $rpl_channel_name;
27+
}
1228
eval RESET SLAVE FOR CHANNEL $rpl_channel_name;
1329
}
1430
}
@@ -24,4 +40,3 @@ if ($rpl_reset_slave_all)
2440
eval RESET SLAVE ALL FOR CHANNEL $rpl_channel_name;
2541
}
2642
}
27-

mysql-test/r/mysqldump.result

+7-7
Original file line numberDiff line numberDiff line change
@@ -5334,13 +5334,13 @@ CREATE TABLE IF NOT EXISTS `slave_master_info` (
53345334
/*!50503 SET character_set_client = utf8mb4 */;
53355335
CREATE TABLE IF NOT EXISTS `slave_relay_log_info` (
53365336
`Number_of_lines` int unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
5337-
`Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
5338-
`Relay_log_pos` bigint unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
5339-
`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.',
5340-
`Master_log_pos` bigint unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
5341-
`Sql_delay` int NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
5342-
`Number_of_workers` int unsigned NOT NULL,
5343-
`Id` int unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
5337+
`Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the current relay log file.',
5338+
`Relay_log_pos` bigint unsigned DEFAULT NULL COMMENT 'The relay log position of the last executed event.',
5339+
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
5340+
`Master_log_pos` bigint unsigned DEFAULT NULL COMMENT 'The master log position of the last executed event.',
5341+
`Sql_delay` int DEFAULT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
5342+
`Number_of_workers` int unsigned DEFAULT NULL,
5343+
`Id` int unsigned DEFAULT NULL COMMENT 'Internal Id that uniquely identifies this record.',
53445344
`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',
53455345
`Privilege_checks_username` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Username part of PRIVILEGE_CHECKS_USER.',
53465346
`Privilege_checks_hostname` char(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL COMMENT 'Hostname part of PRIVILEGE_CHECKS_USER.',

0 commit comments

Comments
 (0)