~vadim-tk/percona-server/percona-5.5.15-galera

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_ssl.test

  • Committer: root
  • Date: 2011-09-10 16:37:18 UTC
  • Revision ID: root@r815.office.percona.com-20110910163718-ydh4zj8hcdgoyavb
Porting Galera to 5.5.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
source include/have_ssl_communication.inc;
 
2
source include/master-slave.inc;
 
3
 
 
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));
 
8
 
 
9
sync_slave_with_master;
 
10
 
 
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;
 
22
 
 
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;
 
27
 
 
28
# The record should now be on slave
 
29
select * from t1;
 
30
 
 
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;
 
36
 
 
37
# Stop the slave, as reported in bug#21871 it would hang
 
38
STOP SLAVE;
 
39
 
 
40
select * from t1;
 
41
 
 
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)
 
51
{
 
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;
 
60
}
 
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`;
 
70
 
 
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;
 
75
 
 
76
let $slave_count= `select count(*) from t1`;
 
77
 
 
78
if ($slave_count != $master_count)
 
79
{
 
80
  echo master and slave differed in number of rows;
 
81
  echo master: $master_count;
 
82
  echo slave: $slave_count;
 
83
 
 
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;
 
93
}
 
94
 
 
95
connection master;
 
96
drop user replssl@localhost;
 
97
drop table t1;
 
98
sync_slave_with_master;
 
99
 
 
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 = '';
 
107
 
 
108
--echo End of 5.0 tests
 
109
--let $rpl_only_running_threads= 1
 
110
--source include/rpl_end.inc