~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/r/rpl_view_multi.result

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
stop slave;
 
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
3
reset master;
 
4
reset slave;
 
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
6
start slave;
 
7
#
 
8
# Bug #25144 "replication / binlog with view breaks".
 
9
# Statements that used views didn't ensure that view were not modified
 
10
# during their execution. Indeed this led to incorrect binary log with
 
11
# statement based logging and as result to broken replication.
 
12
#
 
13
drop tables if exists t1, t2;
 
14
drop view if exists v1;
 
15
# Syncing slave with master and switching to connection 'slave'
 
16
# Switching to connection 'master'
 
17
create table t1 (i int);
 
18
create table t2 (i int);
 
19
create view v1 as select * from t1;
 
20
# First we try to concurrently execute statement that uses view
 
21
# and statement that drops it. We use "user" locks as means to
 
22
# suspend execution of first statement once it opens our view.
 
23
select get_lock("lock_bg25144", 1);
 
24
get_lock("lock_bg25144", 1)
 
25
1
 
26
# Switching to connection 'master1'
 
27
insert into v1 values (get_lock("lock_bg25144", 100));
 
28
# Switching to connection 'master2'
 
29
drop view v1;
 
30
# Switching to connection 'master'
 
31
select release_lock("lock_bg25144");
 
32
release_lock("lock_bg25144")
 
33
1
 
34
# Switching to connection 'master1'
 
35
select release_lock("lock_bg25144");
 
36
release_lock("lock_bg25144")
 
37
1
 
38
# Switching to connection 'master2'
 
39
# Switching to connection 'master'
 
40
# Check that insertion through view did happen.
 
41
select * from t1;
 
42
i
 
43
1
 
44
# Syncing slave with master and switching to connection 'slave'
 
45
# Check that slave was able to replicate this sequence
 
46
# which means that we got correct binlog order.
 
47
select * from t1;
 
48
i
 
49
1
 
50
# Switching to connection 'master'
 
51
# Now we will repeat the test by trying concurrently execute
 
52
# statement that uses a view and statement that alters it.
 
53
create view v1 as select * from t1;
 
54
select get_lock("lock_bg25144", 1);
 
55
get_lock("lock_bg25144", 1)
 
56
1
 
57
# Switching to connection 'master1'
 
58
insert into v1 values (get_lock("lock_bg25144", 100));
 
59
# Switching to connection 'master2'
 
60
alter view v1 as select * from t2;
 
61
# Switching to connection 'master'
 
62
select release_lock("lock_bg25144");
 
63
release_lock("lock_bg25144")
 
64
1
 
65
# Switching to connection 'master1'
 
66
select release_lock("lock_bg25144");
 
67
release_lock("lock_bg25144")
 
68
1
 
69
# Switching to connection 'master2'
 
70
# Switching to connection 'master'
 
71
# Second insertion should go to t1 as well.
 
72
select * from t1;
 
73
i
 
74
1
 
75
1
 
76
select * from t2;
 
77
i
 
78
# Syncing slave with master and switching to connection 'slave'
 
79
# Now let us check that statements were logged in proper order
 
80
# So we have same result on slave.
 
81
select * from t1;
 
82
i
 
83
1
 
84
1
 
85
select * from t2;
 
86
i
 
87
# Switching to connection 'master'
 
88
drop table t1, t2;
 
89
drop view v1;
 
90
# Syncing slave with master and switching to connection 'slave'