| 1 |
# |
| 2 |
# This include file is used by more than one test suite |
| 3 |
# (currently rpl and binlog_encryption). |
| 4 |
# Please check all dependent tests after modifying it |
| 5 |
# |
| 6 |
|
| 7 |
source include/no_valgrind_without_big.inc; |
| 8 |
source include/have_ssl_communication.inc; |
| 9 |
source include/master-slave.inc; |
| 10 |
|
| 11 |
# create a user for replication that requires ssl encryption |
| 12 |
connection master; |
| 13 |
create user replssl@localhost; |
| 14 |
grant replication slave on *.* to replssl@localhost require ssl; |
| 15 |
create table t1 (t int auto_increment, KEY(t)); |
| 16 |
|
| 17 |
sync_slave_with_master; |
| 18 |
|
| 19 |
# Set slave to use SSL for connection to master |
| 20 |
stop slave; |
| 21 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 22 |
eval change master to |
| 23 |
master_user='replssl', |
| 24 |
master_password='', |
| 25 |
master_ssl=1, |
| 26 |
master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem', |
| 27 |
master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem', |
| 28 |
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem'; |
| 29 |
start slave; |
| 30 |
|
| 31 |
# Switch to master and insert one record, then sync it to slave |
| 32 |
connection master; |
| 33 |
insert into t1 values(1); |
| 34 |
sync_slave_with_master; |
| 35 |
|
| 36 |
# The record should now be on slave |
| 37 |
select * from t1; |
| 38 |
|
| 39 |
# The slave is synced and waiting/reading from master |
| 40 |
# SHOW SLAVE STATUS will show "Waiting for master to send event" |
| 41 |
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key; |
| 42 |
source include/show_slave_status.inc; |
| 43 |
source include/check_slave_is_running.inc; |
| 44 |
|
| 45 |
# Stop the slave, as reported in bug#21871 it would hang |
| 46 |
STOP SLAVE; |
| 47 |
|
| 48 |
select * from t1; |
| 49 |
|
| 50 |
# Do the same thing a number of times |
| 51 |
disable_query_log; |
| 52 |
disable_result_log; |
| 53 |
# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows |
| 54 |
# After discussions with Engineering, I'm disabling this part of the test to avoid it causing |
| 55 |
# red trees. |
| 56 |
disable_parsing; |
| 57 |
let $i= 100; |
| 58 |
while ($i) |
| 59 |
{ |
| 60 |
start slave; |
| 61 |
connection master; |
| 62 |
insert into t1 values (NULL); |
| 63 |
select * from t1; # Some variance |
| 64 |
connection slave; |
| 65 |
select * from t1; # Some variance |
| 66 |
stop slave; |
| 67 |
dec $i; |
| 68 |
} |
| 69 |
enable_parsing; |
| 70 |
START SLAVE; |
| 71 |
enable_query_log; |
| 72 |
enable_result_log; |
| 73 |
connection master; |
| 74 |
# INSERT one more record to make sure |
| 75 |
# the sync has something to do |
| 76 |
insert into t1 values (NULL); |
| 77 |
let $master_count= `select count(*) from t1`; |
| 78 |
|
| 79 |
sync_slave_with_master; |
| 80 |
--source include/wait_for_slave_to_start.inc |
| 81 |
source include/show_slave_status.inc; |
| 82 |
source include/check_slave_is_running.inc; |
| 83 |
|
| 84 |
let $slave_count= `select count(*) from t1`; |
| 85 |
|
| 86 |
if ($slave_count != $master_count) |
| 87 |
{ |
| 88 |
echo master and slave differed in number of rows; |
| 89 |
echo master: $master_count; |
| 90 |
echo slave: $slave_count; |
| 91 |
|
| 92 |
connection master; |
| 93 |
select count(*) t1; |
| 94 |
select * from t1; |
| 95 |
connection slave; |
| 96 |
select count(*) t1; |
| 97 |
select * from t1; |
| 98 |
query_vertical show slave status; |
| 99 |
} |
| 100 |
|
| 101 |
connection master; |
| 102 |
drop user replssl@localhost; |
| 103 |
drop table t1; |
| 104 |
sync_slave_with_master; |
| 105 |
|
| 106 |
--source include/stop_slave.inc |
| 107 |
CHANGE MASTER TO |
| 108 |
master_user = 'root', |
| 109 |
master_ssl = 1, |
| 110 |
master_ssl_ca = '', |
| 111 |
master_ssl_cert = '', |
| 112 |
master_ssl_key = ''; |
| 113 |
|
| 114 |
--echo End of 5.0 tests |
| 115 |
--let $rpl_only_running_threads= 1 |
| 116 |
--source include/rpl_end.inc |