~ubuntu-branches/ubuntu/karmic/mysql-dfsg-5.1/karmic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (0.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090625125545-v27uqh8rlsj8uh2y
Tags: upstream-5.1.34
ImportĀ upstreamĀ versionĀ 5.1.34

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
-- source include/have_binlog_format_row.inc
3
3
-- source include/master-slave.inc
4
4
 
5
 
# Test is dependent on binlog positions
 
5
# Note: The test is dependent on binlog positions
6
6
 
7
7
# prepare version for substitutions
8
8
let $VERSION=`select version()`;
9
9
 
10
 
# stop slave before he will start replication also sync with master
11
 
# for avoiding undetermenistic behaviour
12
 
save_master_pos;
13
 
connection slave;
14
 
sync_with_master;
15
 
stop slave;
16
 
# Make sure the slave sql and io thread has stopped
17
 
--source include/wait_for_slave_to_stop.inc
18
 
 
19
 
connection master;
20
 
# create some events on master
21
 
create table t1(n int not null auto_increment primary key);
22
 
insert into t1 values (1),(2),(3),(4);
23
 
drop table t1;
24
 
create table t2(n int not null auto_increment primary key);
25
 
insert into t2 values (1),(2);
26
 
insert into t2 values (3),(4);
27
 
drop table t2;
28
 
 
29
 
# try to replicate all queries until drop of t1
30
 
connection slave;
31
 
start slave until master_log_file='master-bin.000001', master_log_pos=311;
 
10
# Create some events on master
 
11
connection master;
 
12
CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
 
13
INSERT INTO t1 VALUES (1),(2),(3),(4);
 
14
DROP TABLE t1;
 
15
# Save master log postion for query DROP TABLE t1
 
16
save_master_pos;
 
17
let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
 
18
 
 
19
CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
 
20
# Save master log postion for query CREATE TABLE t2
 
21
save_master_pos;
 
22
let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
 
23
 
 
24
INSERT INTO t2 VALUES (1),(2);
 
25
save_master_pos;
 
26
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
 
27
let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
 
28
sync_slave_with_master;
 
29
 
 
30
# Save relay log postion for query INSERT INTO t2 VALUES (1),(2);
 
31
let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
 
32
 
 
33
connection master;
 
34
INSERT INTO t2 VALUES (3),(4);
 
35
DROP TABLE t2;
 
36
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
 
37
let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
 
38
sync_slave_with_master;
 
39
 
 
40
--source include/stop_slave.inc
 
41
# Reset slave.
 
42
RESET SLAVE;
 
43
--disable_query_log
 
44
eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
 
45
--enable_query_log
 
46
 
 
47
# Try to replicate all queries until drop of t1
 
48
connection slave;
 
49
echo START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
 
50
--disable_query_log
 
51
eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_drop_t1;
 
52
--enable_query_log
32
53
--source include/wait_for_slave_sql_to_stop.inc
33
 
# here table should be still not deleted
34
 
select * from t1;
35
 
source include/show_slave_status.inc;
36
 
 
37
 
# this should fail right after start
38
 
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 
54
 
 
55
# Here table should be still not deleted
 
56
SELECT * FROM t1;
 
57
--replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
 
58
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
 
59
query_vertical SHOW SLAVE STATUS;
 
60
 
 
61
# This should fail right after start
 
62
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
39
63
--source include/wait_for_slave_sql_to_stop.inc
40
64
# again this table should be still not deleted
41
 
select * from t1;
42
 
source include/show_slave_status.inc;
 
65
SELECT * FROM t1;
 
66
--replace_result $master_pos_drop_t1 MASTER_POS_DROP_T1
 
67
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
 
68
query_vertical SHOW SLAVE STATUS;
43
69
 
44
 
# try replicate all up to and not including the second insert to t2;
45
 
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=1014;
 
70
# Try replicate all up to and not including the second insert to t2;
 
71
echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
 
72
--disable_query_log
 
73
eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
 
74
--enable_query_log
46
75
--source include/wait_for_slave_sql_to_stop.inc
47
 
select * from t2;
48
 
source include/show_slave_status.inc;
 
76
SELECT * FROM t2;
 
77
--replace_result $relay_pos_insert1_t2 RELAY_POS_INSERT1_T2 $master_pos_insert1_t2 MASTER_POS_INSERT1_T2
 
78
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
 
79
query_vertical SHOW SLAVE STATUS;
49
80
 
50
81
# clean up
51
 
start slave;
 
82
START SLAVE;
 
83
--source include/wait_for_slave_to_start.inc
52
84
connection master;
53
 
save_master_pos;
54
 
connection slave;
55
 
sync_with_master;
56
 
stop slave;
57
 
# Make sure the slave sql and io thread has stopped
58
 
--source include/wait_for_slave_to_stop.inc
 
85
sync_slave_with_master;
 
86
--source include/stop_slave.inc
59
87
 
60
 
# this should stop immediately as we are already there
61
 
start slave until master_log_file='master-bin.000001', master_log_pos=740;
 
88
# This should stop immediately as we are already there
 
89
echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
 
90
--disable_query_log
 
91
eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_pos_create_t2;
 
92
--enable_query_log
 
93
let $slave_param= Until_Log_Pos;
 
94
let $slave_param_value= $master_pos_create_t2;
 
95
--source include/wait_for_slave_param.inc
62
96
--source include/wait_for_slave_sql_to_stop.inc
63
97
# here the sql slave thread should be stopped
64
98
--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
65
 
source include/show_slave_status.inc;
 
99
--replace_result $master_pos_create_t2 MASTER_POS_CREATE_T2 $master_pos_drop_t2 MASTER_POS_DROP_T2
 
100
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 23 # 33 # 35 # 36 #
 
101
query_vertical SHOW SLAVE STATUS;
66
102
 
67
103
#testing various error conditions
68
104
--error 1277
69
 
start slave until master_log_file='master-bin', master_log_pos=561;
70
 
--error 1277
71
 
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
72
 
--error 1277
73
 
start slave until master_log_file='master-bin.000001';
74
 
--error 1277
75
 
start slave until relay_log_file='slave-relay-bin.000002';
76
 
--error 1277
77
 
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
 
105
START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
 
106
--error 1277
 
107
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
 
108
--error 1277
 
109
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
 
110
--error 1277
 
111
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
 
112
--error 1277
 
113
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
78
114
# Warning should be given for second command
79
 
start slave sql_thread;
80
 
start slave until master_log_file='master-bin.000001', master_log_pos=740;
 
115
START SLAVE;
 
116
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;