Skip to content

Commit a4c8ed9

Browse files
Pedro Figueiredodahlerlend
authored andcommitted
BUG#30445128 PRIVILEGE_CHECKS_USER MUST NOT FORCE REQUIRE_ROW_FORMAT TO BE SET
[post-push] Description/Fix --------------- 1) A condition tying `PRIVILEGE_CHECKS_USER` value with `REQUIRE_ROW_FORMAT` was forgotten in `Relay_log_info::read_info` method. 2) The `rpl.rpl_log_info_repository_persistence_require_row` test started to fail due to errors exposed by the change in _1)_: a) Some of the test-cases were still linking the both options, that is fixed. b) A use case testing for the proper value of `REQUIRE_ROW_FORMAT` when `PRIVILEGE_CHECKS_USER` is set, was removed. Is now reinstated. 3) Other tests had result content mismatch due to the change in _1)_, fixed now. RB: 23456 Reviewed-by: Pedro Gomes <[email protected]> Reviewed-by: Luis Soares <[email protected]>
1 parent 31e69d1 commit a4c8ed9

File tree

4 files changed

+39
-42
lines changed

4 files changed

+39
-42
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ l@calhost
9595
Occurrences of 'l@calhost' in the input file: 1
9696
SELECT * FROM performance_schema.replication_applier_configuration;
9797
CHANNEL_NAME DESIRED_DELAY PRIVILEGE_CHECKS_USER REQUIRE_ROW_FORMAT
98-
0 <INVALID> YES
98+
0 <INVALID> NO
9999
include/assert.inc [Check entry for default channel "" in performance_schema.replication_applier_configuration]
100100
START SLAVE FOR CHANNEL "";
101101
ERROR HY000: Slave failed to initialize relay log info structure from the repository
@@ -131,7 +131,7 @@ localhost
131131
Occurrences of 'localhost' in the input file: 1
132132
SELECT * FROM performance_schema.replication_applier_configuration;
133133
CHANNEL_NAME DESIRED_DELAY PRIVILEGE_CHECKS_USER REQUIRE_ROW_FORMAT
134-
0 <INVALID> YES
134+
0 <INVALID> NO
135135
include/assert.inc [Check entry for default channel "" in performance_schema.replication_applier_configuration]
136136
START SLAVE FOR CHANNEL "";
137137
ERROR HY000: Slave failed to initialize relay log info structure from the repository

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ CREATE USER 'replication_applier'@'localhost' IDENTIFIED BY 'password';
1111
GRANT REPLICATION_APPLIER ON * . * TO 'replication_applier'@'localhost';
1212
FLUSH PRIVILEGES;
1313

14-
# 1.1. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
14+
# 1.1. Set REQUIRE_ROW_FORMAT to 1
1515
# Check the performance_schema table and file repository are correct
1616
STOP SLAVE;
17-
CHANGE MASTER TO MASTER_HOST="localhost", REQUIRE_ROW_FORMAT = 1, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost';
17+
CHANGE MASTER TO MASTER_HOST="localhost", REQUIRE_ROW_FORMAT = 1;
1818
include/assert.inc [Check that mysql.slave_relay_log_info does not have any entry]
1919
include/assert.inc [REQUIRE_ROW_FORMAT enabled for default channel "" in performance_schema.replication_applier_configuration]
2020
include/assert_grep.inc [In the file the field is set to 1]
2121

22-
# 1.2. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
22+
# 1.2. Set REQUIRE_ROW_FORMAT to 0
2323
# Check the performance_schema table and file repository are correct
24-
CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT = 0;
24+
CHANGE MASTER TO REQUIRE_ROW_FORMAT = 0;
2525
include/assert.inc [Check that mysql.slave_relay_log_info does not have any entry]
2626
include/assert.inc [REQUIRE_ROW_FORMAT disabled for default channel "" in performance_schema.replication_applier_configuration]
2727

@@ -35,12 +35,11 @@ include/assert.inc [REQUIRE_ROW_FORMAT disabled for default channel "" in perfor
3535

3636
# 2.2 Upgrade the server while using File repositories
3737
# Start the server using a file repository that has a privileged user
38-
# REQUIRE_ROW_FORMAT must be 1
38+
# REQUIRE_ROW_FORMAT must be 0
3939
include/rpl_stop_server.inc [server_number=2]
4040
include/rpl_start_server.inc [server_number=2 parameters: --skip_slave_start]
4141
include/assert.inc [Check that mysql.slave_relay_log_info does not have any entry]
42-
include/assert.inc [REQUIRE_ROW_FORMAT enabled for default channel "" in performance_schema.replication_applier_configuration]
43-
include/assert_grep.inc [In the file the field is set to 1]
42+
include/assert.inc [REQUIRE_ROW_FORMAT disabled for default channel "" in performance_schema.replication_applier_configuration]
4443
# Reset the repository to default values
4544
CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT = 0;
4645
include/assert.inc [Check that mysql.slave_relay_log_info does not have any entry]
@@ -57,28 +56,29 @@ include/assert.inc [Check entry for default channel "" in performance_schema.rep
5756

5857
# 3.2 Upgrade the server to Table repositories from File repositories
5958
# Start the server using a file repository that has a privileged user
60-
# REQUIRE_ROW_FORMAT must be 1
59+
# REQUIRE_ROW_FORMAT must be 0
6160
include/rpl_restart_server.inc [server_number=2 parameters: --relay-log-info-repository=FILE]
6261
ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
6362
include/rpl_stop_server.inc [server_number=2]
6463
include/rpl_start_server.inc [server_number=2 parameters: --skip_slave_start --relay-log-info-repository=TABLE --upgrade=FORCE]
65-
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1]
64+
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 0]
6665
include/assert.inc [Check entry for default channel "" in performance_schema.replication_applier_configuration]
6766

6867
# 4.1 Upgrade the server while using Table repositories
6968
# Have 3 channels:
7069
# 1. A channel with no privileged user (ch1)
7170
# 2. A group_replication channel (group_replication_recovery)
7271
# 3. A channel with a privileged user (default channel)
73-
# REQUIRE_ROW_FORMAT must be 0 for 1). It must be 1 for 2) and 3)
72+
# REQUIRE_ROW_FORMAT must be 0 for 1) and 3). It must be 1 for 2)
7473
CHANGE MASTER TO MASTER_HOST="localhost", MASTER_PORT=12 FOR CHANNEL "ch1" ;
7574
CHANGE MASTER TO MASTER_USER="root" FOR CHANNEL "group_replication_recovery";
75+
CHANGE MASTER TO MASTER_HOST="localhost", MASTER_PORT=12, PRIVILEGE_CHECKS_USER = 'replication_applier'@'localhost' FOR CHANNEL "";
7676
ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
7777
UPDATE mysql.slave_relay_log_info SET Number_of_lines = 10;
7878
include/rpl_restart_server.inc [server_number=2 parameters: --skip_slave_start --relay-log-info-repository=TABLE --upgrade=FORCE]
7979
include/assert.inc [Check the number of channels with enabled REQUIRE_ROW_FORMAT]
8080
include/assert.inc [Check the number of channels with disabled REQUIRE_ROW_FORMAT]
81-
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1]
81+
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 0]
8282
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1]
8383
include/assert.inc [Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 0]
8484

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

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
# ==== Requirements ====
77
#
88
# TC1: Verify that the column is added when doing an upgrade
9-
# TC2: On upgrade verify that the value for REQUIRE_ROW_FORMAT is 0 for
10-
# channels with no PRIVILEGE_CHECKS_USER
9+
# TC2: On upgrade verify that the value for REQUIRE_ROW_FORMAT is 0
1110
# TC3: On upgrade verify that the value for REQUIRE_ROW_FORMAT is 1 for
12-
# channels with a defined PRIVILEGE_CHECKS_USER
13-
# TC4: On upgrade verify that the value for REQUIRE_ROW_FORMAT is 1 for
1411
# group replication channels
15-
# TC5: Verify that TC2 and TC3 are true when upgrading from/to
12+
# TC4: Verify that TC2 and TC3 are true when upgrading from/to
1613
# File repositories
17-
# TC6: Verify that TC2, TC3 and TC4 are true when upgrading from/to
14+
# TC5: Verify that TC2, TC3 and TC4 are true when upgrading from/to
1815
# Table repositories
1916
#
2017
# ==== Implementation ====
@@ -24,9 +21,9 @@
2421
#
2522
# 1. Basic operations with REQUIRE_ROW_FORMAT
2623
#
27-
# 1.1. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
24+
# 1.1. Set REQUIRE_ROW_FORMAT to 1
2825
# Check the performance_schema table and file repository are correct
29-
# 1.2. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
26+
# 1.2. Set REQUIRE_ROW_FORMAT to 0
3027
# Check the performance_schema table and file repository are correct
3128
#
3229
# 2. File to File upgrades
@@ -36,7 +33,7 @@
3633
# REQUIRE_ROW_FORMAT must be 0
3734
# 2.2 Upgrade the server while using File repositories
3835
# Start the server using a file repository that has a privileged user
39-
# REQUIRE_ROW_FORMAT must be 1
36+
# REQUIRE_ROW_FORMAT must be 0
4037
#
4138
# 3. File to Table upgrades
4239
#
@@ -45,7 +42,7 @@
4542
# REQUIRE_ROW_FORMAT must be 0
4643
# 3.2 Upgrade the server to Table repositories from File repositories
4744
# Start the server using a file repository that has a privileged user
48-
# REQUIRE_ROW_FORMAT must be 1
45+
# REQUIRE_ROW_FORMAT must be 0
4946
#
5047
# 4. Table to Table upgrades
5148
#
@@ -54,7 +51,7 @@
5451
# 1. A channel with no privileged user (ch1)
5552
# 2. A group_replication channel (group_replication_recovery)
5653
# 3. A channel with a privileged user (default channel)
57-
# REQUIRE_ROW_FORMAT must be 0 for 1). It must be 1 for 2) and 3)
54+
# REQUIRE_ROW_FORMAT must be 0 for 1) and 3). It must be 1 for 2)
5855
#
5956
# 5. Cleanup
6057
#
@@ -97,7 +94,7 @@ FLUSH PRIVILEGES;
9794

9895
--let $assert_text = In the file the field is set to 1
9996
--let $assert_file = $MYSQLD_DATADIR/$rl_info_filename
100-
--let $assert_only_after = localhost
97+
--let $assert_only_after = ^1\$
10198
--let $assert_select = 1
10299
--let $assert_count = 1
103100
--source include/assert_grep.inc
@@ -123,20 +120,20 @@ END_OF_PROCEDURE
123120
# 1. Basic operations with REQUIRE_ROW_FORMAT
124121

125122
--echo
126-
--echo # 1.1. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
123+
--echo # 1.1. Set REQUIRE_ROW_FORMAT to 1
127124
--echo # Check the performance_schema table and file repository are correct
128125

129126
STOP SLAVE;
130127

131-
CHANGE MASTER TO MASTER_HOST="localhost", REQUIRE_ROW_FORMAT = 1, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost';
128+
CHANGE MASTER TO MASTER_HOST="localhost", REQUIRE_ROW_FORMAT = 1;
132129

133130
--source $MYSQL_TMP_DIR/check_require_row_format_enabled_in_file_repo.inc
134131

135132
--echo
136-
--echo # 1.2. Set REQUIRE_ROW_FORMAT and REQUIRE_ROW_FORMAT to valid values
133+
--echo # 1.2. Set REQUIRE_ROW_FORMAT to 0
137134
--echo # Check the performance_schema table and file repository are correct
138135

139-
CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT = 0;
136+
CHANGE MASTER TO REQUIRE_ROW_FORMAT = 0;
140137

141138
--source $MYSQL_TMP_DIR/check_require_row_format_disabled_in_file_repo.inc
142139

@@ -157,14 +154,14 @@ CHANGE MASTER TO PRIVILEGE_CHECKS_USER=NULL, REQUIRE_ROW_FORMAT = 0;
157154
--echo
158155
--echo # 2.2 Upgrade the server while using File repositories
159156
--echo # Start the server using a file repository that has a privileged user
160-
--echo # REQUIRE_ROW_FORMAT must be 1
157+
--echo # REQUIRE_ROW_FORMAT must be 0
161158

162159
--let $sub_testcase = no_flag_with_priv_user
163160
--let $rpl_server_restart_parameters = --skip_slave_start
164161
--let $slave_server_num = 2
165162
--source extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc
166163

167-
--source $MYSQL_TMP_DIR/check_require_row_format_enabled_in_file_repo.inc
164+
--source $MYSQL_TMP_DIR/check_require_row_format_disabled_in_file_repo.inc
168165

169166
--echo # Reset the repository to default values
170167

@@ -198,7 +195,7 @@ ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
198195
--echo
199196
--echo # 3.2 Upgrade the server to Table repositories from File repositories
200197
--echo # Start the server using a file repository that has a privileged user
201-
--echo # REQUIRE_ROW_FORMAT must be 1
198+
--echo # REQUIRE_ROW_FORMAT must be 0
202199

203200
--let $rpl_server_number = 2
204201
--let $rpl_server_parameters = --relay-log-info-repository=FILE
@@ -212,11 +209,11 @@ ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
212209
--let $slave_server_num = 2
213210
--source extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc
214211

215-
--let $assert_text = Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1
216-
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME="" AND REQUIRE_ROW_FORMAT = 1] = 1
212+
--let $assert_text = Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 0
213+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME="" AND REQUIRE_ROW_FORMAT = 0] = 1
217214
--source include/assert.inc
218215

219-
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE REQUIRE_ROW_FORMAT = 'YES'`
216+
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE REQUIRE_ROW_FORMAT = 'NO'`
220217
--let $assert_text = Check entry for default channel "" in performance_schema.replication_applier_configuration
221218
--let $assert_cond = $count = 1
222219
--source include/assert.inc
@@ -229,12 +226,13 @@ ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
229226
--echo # 1. A channel with no privileged user (ch1)
230227
--echo # 2. A group_replication channel (group_replication_recovery)
231228
--echo # 3. A channel with a privileged user (default channel)
232-
--echo # REQUIRE_ROW_FORMAT must be 0 for 1). It must be 1 for 2) and 3)
229+
--echo # REQUIRE_ROW_FORMAT must be 0 for 1) and 3). It must be 1 for 2)
233230

234231
CHANGE MASTER TO MASTER_HOST="localhost", MASTER_PORT=12 FOR CHANNEL "ch1" ;
235232
--disable_warnings
236233
CHANGE MASTER TO MASTER_USER="root" FOR CHANNEL "group_replication_recovery";
237234
--enable_warnings
235+
CHANGE MASTER TO MASTER_HOST="localhost", MASTER_PORT=12, PRIVILEGE_CHECKS_USER = 'replication_applier'@'localhost' FOR CHANNEL "";
238236

239237
# Revert the table to 10 lines (pre upgrade)
240238
ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Require_row_format;
@@ -248,16 +246,16 @@ UPDATE mysql.slave_relay_log_info SET Number_of_lines = 10;
248246
# We have only 1 table here as group_replication_recovery does not show up
249247
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE REQUIRE_ROW_FORMAT = 'YES'`
250248
--let $assert_text = Check the number of channels with enabled REQUIRE_ROW_FORMAT
251-
--let $assert_cond = $count = 1
249+
--let $assert_cond = $count = 0
252250
--source include/assert.inc
253251

254252
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE REQUIRE_ROW_FORMAT = 'NO'`
255253
--let $assert_text = Check the number of channels with disabled REQUIRE_ROW_FORMAT
256-
--let $assert_cond = $count = 1
254+
--let $assert_cond = $count = 2
257255
--source include/assert.inc
258256

259-
--let $assert_text = Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1
260-
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME="" AND REQUIRE_ROW_FORMAT = 1] = 1
257+
--let $assert_text = Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 0
258+
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME="" AND REQUIRE_ROW_FORMAT = 0] = 1
261259
--source include/assert.inc
262260

263261
--let $assert_text = Check that mysql.slave_relay_log_info has an entry with REQUIRE_ROW_FORMAT set to 1

sql/rpl_rli.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,8 +2134,7 @@ bool Relay_log_info::read_info(Rpl_info_handler *from) {
21342134
if (lines >= LINES_IN_RELAY_LOG_INFO_WITH_REQUIRE_ROW_FORMAT) {
21352135
if (!!from->get_info(&temp_require_row_format, 0)) return true;
21362136
} else {
2137-
if (username != nullptr ||
2138-
channel_map.is_group_replication_channel_name(channel))
2137+
if (channel_map.is_group_replication_channel_name(channel))
21392138
temp_require_row_format = 1;
21402139
}
21412140
m_require_row_format = temp_require_row_format;

0 commit comments

Comments
 (0)