Skip to content

Commit 8e702bc

Browse files
committed
MDEV-11504 binlog_encryption.encrypted_master_switch_to_unencrypted fails sporadically in buildbot
The reason is a simple race condition. Initially the test was meant to synchronize with master before showing tables, but it turned out that the slave IO thread should fail by this point, and synchronization was removed along with a server bugfix. Now added an intermediate sync instead, to make sure that slave has replicated events before the point of failure
1 parent e1e1fbc commit 8e702bc

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
5656
#####################################################
5757
connection server_2;
5858
start slave;
59+
connection server_1;
60+
connection server_2;
5961
include/wait_for_slave_io_error.inc [errno=1236]
6062
connection server_2;
6163
connection server_2;

mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption;
5656
--let SEARCH_PATTERN= table1_no_encryption
5757
--source include/search_pattern_in_file.inc
5858

59+
# We are storing the position now, because up to this point the slave
60+
# should be able to synchronize with master
61+
--save_master_pos
62+
5963
--echo #####################################################
6064
--echo # Part 2: restart master, now with binlog encryption
6165
--echo #####################################################
@@ -102,14 +106,22 @@ INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
102106
INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
103107
INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
104108

105-
--save_master_pos
106-
107109
--echo #####################################################
108110
--echo # Check: resume replication and check how it goes
109111
--echo #####################################################
110-
--connection server_2
111112

113+
--connection server_2
112114
start slave;
115+
# The slave should be able to synchronize with master up to
116+
# the previously saved position (when the log was still unencrypted)
117+
--sync_with_master
118+
119+
--connection server_1
120+
# Now save the current position and make slave to try to syncrhonize.
121+
# It shouldn't work, the slave IO thread is expected to abort with an error
122+
--save_master_pos
123+
124+
--connection server_2
113125
--let slave_io_errno=1236
114126
--source include/wait_for_slave_io_error.inc
115127

0 commit comments

Comments
 (0)