| 1 |
--source include/not_group_replication_plugin.inc |
| 2 |
let $rpl_privilege_checks_user_grant_option = 1; |
| 3 |
source include/master-slave.inc; |
| 4 |
|
| 5 |
# Default replication setup at master-slave.inc does not set MASTER_SSL |
| 6 |
--connection slave |
| 7 |
--let $current_master_ssl= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1) |
| 8 |
--let $assert_text= Master_SSL_Allowed should be NO by default |
| 9 |
--let $assert_cond= "$current_master_ssl" = "NO" |
| 10 |
--source include/assert.inc |
| 11 |
|
| 12 |
|
| 13 |
# The slave should be initially connected to the master without SSL/TLS |
| 14 |
--connection master |
| 15 |
--let $connection_type= `SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_COMMAND LIKE "Binlog Dump%"` |
| 16 |
--let $assert_text= Without MASTER_SSL, the slave should be connected to the master without SSL/TLS |
| 17 |
--let $assert_cond= "$connection_type" <> "SSL/TLS" AND "$connection_type" <> "" |
| 18 |
--source include/assert.inc |
| 19 |
|
| 20 |
# create a user for replication that requires ssl encryption |
| 21 |
connection master; |
| 22 |
create user replssl@localhost require ssl; |
| 23 |
grant replication slave on *.* to replssl@localhost; |
| 24 |
create table t1 (t int auto_increment, KEY(t)); |
| 25 |
|
| 26 |
--source include/sync_slave_sql_with_master.inc |
| 27 |
|
| 28 |
# Set slave to use SSL for connection to master |
| 29 |
stop slave; |
| 30 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 31 |
--replace_column 2 #### |
| 32 |
eval CHANGE REPLICATION SOURCE to |
| 33 |
SOURCE_USER='replssl', |
| 34 |
SOURCE_PASSWORD='', |
| 35 |
SOURCE_SSL=1, |
| 36 |
SOURCE_SSL_CA ='$MYSQL_TEST_DIR/std_data/cacert.pem', |
| 37 |
SOURCE_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem', |
| 38 |
SOURCE_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem'; |
| 39 |
start slave; |
| 40 |
|
| 41 |
# Switch to master and insert one record, then sync it to slave |
| 42 |
connection master; |
| 43 |
insert into t1 values(1); |
| 44 |
--source include/sync_slave_sql_with_master.inc |
| 45 |
|
| 46 |
# The record should now be on slave |
| 47 |
select * from t1; |
| 48 |
|
| 49 |
# The slave is synced and waiting/reading from master |
| 50 |
# SHOW SLAVE STATUS will show "Waiting for source to send event" |
| 51 |
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key; |
| 52 |
source include/show_slave_status.inc; |
| 53 |
source include/check_slave_is_running.inc; |
| 54 |
|
| 55 |
# Stop the slave, as reported in bug#21871 it would hang |
| 56 |
STOP SLAVE; |
| 57 |
|
| 58 |
select * from t1; |
| 59 |
|
| 60 |
# Do the same thing a number of times |
| 61 |
disable_query_log; |
| 62 |
disable_result_log; |
| 63 |
# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows |
| 64 |
# After discussions with Engineering, I'm disabling this part of the test to avoid it causing |
| 65 |
# red trees. |
| 66 |
disable_testcase BUG#32756; |
| 67 |
let $i= 100; |
| 68 |
while ($i) |
| 69 |
{ |
| 70 |
start slave; |
| 71 |
connection master; |
| 72 |
insert into t1 values (NULL); |
| 73 |
select * from t1; # Some variance |
| 74 |
connection slave; |
| 75 |
select * from t1; # Some variance |
| 76 |
stop slave; |
| 77 |
dec $i; |
| 78 |
} |
| 79 |
enable_testcase; |
| 80 |
START SLAVE; |
| 81 |
enable_query_log; |
| 82 |
enable_result_log; |
| 83 |
connection master; |
| 84 |
# INSERT one more record to make sure |
| 85 |
# the sync has something to do |
| 86 |
insert into t1 values (NULL); |
| 87 |
let $master_count= `select count(*) from t1`; |
| 88 |
|
| 89 |
--source include/sync_slave_sql_with_master.inc |
| 90 |
--source include/wait_for_slave_to_start.inc |
| 91 |
source include/show_slave_status.inc; |
| 92 |
source include/check_slave_is_running.inc; |
| 93 |
|
| 94 |
let $slave_count= `select count(*) from t1`; |
| 95 |
|
| 96 |
if ($slave_count != $master_count) |
| 97 |
{ |
| 98 |
echo master and slave differed in number of rows; |
| 99 |
echo master: $master_count; |
| 100 |
echo slave: $slave_count; |
| 101 |
|
| 102 |
connection master; |
| 103 |
echo === master ===; |
| 104 |
select count(*) t1; |
| 105 |
select * from t1; |
| 106 |
connection slave; |
| 107 |
echo === slave ===; |
| 108 |
select count(*) t1; |
| 109 |
select * from t1; |
| 110 |
query_vertical show slave status; |
| 111 |
} |
| 112 |
|
| 113 |
connection master; |
| 114 |
drop user replssl@localhost; |
| 115 |
drop table t1; |
| 116 |
--source include/sync_slave_sql_with_master.inc |
| 117 |
|
| 118 |
# ==== BUG#18165937: HITTING CRASH WHEN SETTING SSL OPTIONS THROUGH CHANGE MASTER COMMAND ==== |
| 119 |
|
| 120 |
--source include/stop_slave.inc |
| 121 |
--replace_column 2 #### |
| 122 |
CHANGE REPLICATION SOURCE TO |
| 123 |
SOURCE_USER = 'root', |
| 124 |
SOURCE_SSL = 0, |
| 125 |
SOURCE_SSL_CA = '', |
| 126 |
SOURCE_SSL_CERT = '', |
| 127 |
SOURCE_SSL_KEY = '', |
| 128 |
SOURCE_SSL_CRL='', |
| 129 |
SOURCE_SSL_CRLPATH=''; |
| 130 |
|
| 131 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 132 |
eval CHANGE REPLICATION SOURCE TO SOURCE_SSL= 1, SOURCE_SSL_CRL='$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl', SOURCE_SSL_CRLPATH='$MYSQL_TEST_DIR/std_data/crldir'; |
| 133 |
--source include/start_slave.inc |
| 134 |
|
| 135 |
|
| 136 |
--source include/stop_slave.inc |
| 137 |
--replace_column 2 #### |
| 138 |
CHANGE REPLICATION SOURCE TO |
| 139 |
SOURCE_USER = 'root', |
| 140 |
SOURCE_SSL = 0, |
| 141 |
SOURCE_SSL_CA = '', |
| 142 |
SOURCE_SSL_CERT = '', |
| 143 |
SOURCE_SSL_KEY = '', |
| 144 |
SOURCE_SSL_CRL='', |
| 145 |
SOURCE_SSL_CRLPATH=''; |
| 146 |
|
| 147 |
--echo End of 5.0 tests |
| 148 |
--let $rpl_only_running_threads= 1 |
| 149 |
--source include/rpl_end.inc |