Debian Codegraph @

mysql-test/suite/rpl/r/rpl_view_multi.result

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 #
7 # Bug #25144 "replication / binlog with view breaks".
8 # Statements that used views didn't ensure that view were not modified
9 # during their execution. Indeed this led to incorrect binary log with
10 # statement based logging and as result to broken replication.
11 #
12 drop tables if exists t1, t2;
13 drop view if exists v1;
14 # Syncing slave with master and switching to connection 'slave'
15 include/sync_slave_sql_with_master.inc
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 include/sync_slave_sql_with_master.inc
46 # Check that slave was able to replicate this sequence
47 # which means that we got correct binlog order.
48 select * from t1;
49 i
50 1
51 # Switching to connection 'master'
52 # Now we will repeat the test by trying concurrently execute
53 # statement that uses a view and statement that alters it.
54 create view v1 as select * from t1;
55 select get_lock("lock_bg25144", 1);
56 get_lock("lock_bg25144", 1)
57 1
58 # Switching to connection 'master1'
59 insert into v1 values (get_lock("lock_bg25144", 100));
60 # Switching to connection 'master2'
61 alter view v1 as select * from t2;
62 # Switching to connection 'master'
63 select release_lock("lock_bg25144");
64 release_lock("lock_bg25144")
65 1
66 # Switching to connection 'master1'
67 select release_lock("lock_bg25144");
68 release_lock("lock_bg25144")
69 1
70 # Switching to connection 'master2'
71 # Switching to connection 'master'
72 # Second insertion should go to t1 as well.
73 select * from t1;
74 i
75 1
76 1
77 select * from t2;
78 i
79 # Syncing slave with master and switching to connection 'slave'
80 include/sync_slave_sql_with_master.inc
81 # Now let us check that statements were logged in proper order
82 # So we have same result on slave.
83 select * from t1;
84 i
85 1
86 1
87 select * from t2;
88 i
89 # Switching to connection 'master'
90 drop table t1, t2;
91 drop view v1;
92 # Syncing slave with master and switching to connection 'slave'
93 include/sync_slave_sql_with_master.inc
94 include/rpl_end.inc