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