Debian Codegraph @

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

raw
1 include/master-slave.inc
2 [connection master]
3 #
4 # MDEV-15530 Variable replicate_rewrite_db cannot be found
5 # in "show global variables"
6 #
7 # Create DBs and verify that slave has to be stopped before setting sys var
8 connection slave;
9 select @@session.server_id;
10 @@session.server_id
11 2
12 create database replica_db1;
13 create database y;
14 create database test_replica;
15 SELECT @@GLOBAL.replicate_rewrite_db, 'primary_db1->replica_db1,x->y' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS';
16 @@GLOBAL.replicate_rewrite_db Replicate_Rewrite_DB from SHOW SLAVE STATUS
17 primary_db1->replica_db1,x->y primary_db1->replica_db1,x->y
18 # Create DBs and tables on primary
19 connection master;
20 create database primary_db1;
21 create database x;
22 use primary_db1;
23 create table my_table (t int);
24 insert into my_table values (2),(4);
25 use x;
26 create table my_table (t int);
27 insert into my_table values (654),(532);
28 include/save_master_gtid.inc
29 # Check replica
30 connection slave;
31 include/sync_with_master_gtid.inc
32 include/diff_tables.inc [master:primary_db1.my_table,slave:replica_db1.my_table]
33 include/diff_tables.inc [master:x.my_table,slave:y.my_table]
34 SELECT @@GLOBAL.replicate_rewrite_db;
35 @@GLOBAL.replicate_rewrite_db
36 primary_db1->replica_db1,x->y
37 show tables from replica_db1;
38 Tables_in_replica_db1
39 my_table
40 select * from replica_db1.my_table;
41 t
42 2
43 4
44 show tables from y;
45 Tables_in_y
46 my_table
47 select * from y.my_table;
48 t
49 654
50 532
51 # Set replica sys var replicate_rewrite_db
52 connection slave;
53 SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica";
54 ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
55 include/stop_slave.inc
56 SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db;
57 SELECT @@GLOBAL.replicate_rewrite_db;
58 @@GLOBAL.replicate_rewrite_db
59 primary_db1->replica_db1,x->y
60 SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica";
61 SHOW DATABASES like 'test_replica';
62 Database (test_replica)
63 test_replica
64 include/start_slave.inc
65 SELECT @@GLOBAL.replicate_rewrite_db, 'test_master->test_replica' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS';
66 @@GLOBAL.replicate_rewrite_db Replicate_Rewrite_DB from SHOW SLAVE STATUS
67 test_master->test_replica test_master->test_replica
68 # Create DB and tables on primary
69 connection master;
70 create database test_master;
71 use test_master;
72 create table my_table (t int);
73 insert into my_table values (1),(3);
74 include/save_master_gtid.inc
75 # Ensure that the replica receives all of the primary's events without
76 # error
77 connection slave;
78 include/sync_with_master_gtid.inc
79 Last_SQL_Error =
80 Last_SQL_Errno = 0
81 SELECT @@GLOBAL.replicate_rewrite_db;
82 @@GLOBAL.replicate_rewrite_db
83 test_master->test_replica
84 SHOW tables from test_replica;
85 Tables_in_test_replica
86 my_table
87 select * from test_replica.my_table;
88 t
89 1
90 3
91 include/diff_tables.inc [master:test_master.my_table,slave:test_replica.my_table]
92 # Update of values on primary for DB not set in replication_rewrite_db
93 include/stop_slave.inc
94 include/reset_slave.inc
95 connection master;
96 use x;
97 insert into my_table values (314);
98 select * from my_table;
99 t
100 654
101 532
102 314
103 include/save_master_gtid.inc
104 connection slave;
105 include/start_slave.inc
106 SELECT @@GLOBAL.replicate_rewrite_db;
107 @@GLOBAL.replicate_rewrite_db
108 test_master->test_replica
109 include/sync_with_master_gtid.inc
110 select * from y.my_table;
111 t
112 654
113 532
114 # Dynamic updates to the replication filter should be lost after server restart
115 connection slave;
116 SELECT @@GLOBAL.replicate_rewrite_db;
117 @@GLOBAL.replicate_rewrite_db
118 test_master->test_replica
119 connection master;
120 use x;
121 insert into my_table values (1000);
122 select * from my_table;
123 t
124 654
125 532
126 314
127 1000
128 include/save_master_gtid.inc
129 connection slave;
130 include/stop_slave.inc
131 include/reset_slave.inc
132 include/rpl_restart_server.inc [server_number=2]
133 CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0;
134 connection slave;
135 include/start_slave.inc
136 SELECT @@GLOBAL.replicate_rewrite_db;
137 @@GLOBAL.replicate_rewrite_db
138 primary_db1->replica_db1,x->y
139 include/sync_with_master_gtid.inc
140 select * from y.my_table;
141 t
142 654
143 532
144 314
145 1000
146 # Cleanup
147 connection master;
148 drop database test_master;
149 drop database primary_db1;
150 drop database x;
151 include/save_master_gtid.inc
152 connection slave;
153 include/sync_with_master_gtid.inc
154 drop database test_replica;
155 drop database replica_db1;
156 drop database y;
157 include/stop_slave.inc
158 include/start_slave.inc
159 include/rpl_end.inc