~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
source include/have_ssl.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
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
 
34
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
 
35
query_vertical show slave status;
 
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
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
 
74
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
 
75
query_vertical show slave status;
 
76
 
 
77
let $slave_count= `select count(*) from t1`;
 
78
 
 
79
if (`select $slave_count != $master_count`)
 
80
{
 
81
  echo master and slave differed in number of rows;
 
82
  echo master: $master_count;
 
83
  echo slave: $slave_count;
 
84
 
 
85
  connection master;
 
86
  echo === master ===;
 
87
  select count(*) t1;
 
88
  select * from t1;
 
89
  connection slave;
 
90
  echo === slave ===;
 
91
  select count(*) t1;
 
92
  select * from t1;
 
93
  query_vertical show slave status;
 
94
}
 
95
 
 
96
connection master;
 
97
drop user replssl@localhost;
 
98
drop table t1;
 
99
sync_slave_with_master;
 
100
 
 
101
--echo End of 5.0 tests