From 8e702bce66a2fb9ed911800f87e75509ae963e8c Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Thu, 8 Dec 2016 17:05:01 +0200 Subject: [PATCH] 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 --- ...crypted_master_switch_to_unencrypted.result | 2 ++ ...encrypted_master_switch_to_unencrypted.test | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result index ec7bc4c79d6..f9a063724ca 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.result @@ -56,6 +56,8 @@ INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; ##################################################### connection server_2; start slave; +connection server_1; +connection server_2; include/wait_for_slave_io_error.inc [errno=1236] connection server_2; connection server_2; diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test index 3f4289dcb4e..91231f89307 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted.test @@ -56,6 +56,10 @@ INSERT INTO table1_no_encryption SELECT NULL,NOW(),b FROM table1_no_encryption; --let SEARCH_PATTERN= table1_no_encryption --source include/search_pattern_in_file.inc +# We are storing the position now, because up to this point the slave +# should be able to synchronize with master +--save_master_pos + --echo ##################################################### --echo # Part 2: restart master, now with binlog encryption --echo ##################################################### @@ -102,14 +106,22 @@ INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption'); INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; ---save_master_pos - --echo ##################################################### --echo # Check: resume replication and check how it goes --echo ##################################################### ---connection server_2 +--connection server_2 start slave; +# The slave should be able to synchronize with master up to +# the previously saved position (when the log was still unencrypted) +--sync_with_master + +--connection server_1 +# Now save the current position and make slave to try to syncrhonize. +# It shouldn't work, the slave IO thread is expected to abort with an error +--save_master_pos + +--connection server_2 --let slave_io_errno=1236 --source include/wait_for_slave_io_error.inc