MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_multi_engine2.inc
1 #############################################################
2 # Author: Rafal
3 # Date: 2007-08-20
4 # based on rpl_multi_engine3.inc
5 #############################################################
6 
7 connection slave;
8 STOP SLAVE;
9 RESET SLAVE;
10 
11 connection master;
12 RESET MASTER;
13 
14 connection slave;
15 START SLAVE;
16 
17 --echo --- Populate t1 with data ---
18 connection master;
19 --disable_query_log
20 INSERT INTO t1 VALUES(42,1,'Testing MySQL databases is a cool ',
21  'Must make it bug free for the customer',
22  654321.4321,15.21,0,1965,"1905-11-14");
23 INSERT INTO t1 VALUES(2,1,'Testing MySQL databases is a cool ',
24  'Must make it bug free for the customer',
25  654321.4321,15.21,0,1965,"1965-11-14");
26 INSERT INTO t1 VALUES(4,1,'Testing MySQL databases is a cool ',
27  'Must make it bug free for the customer',
28  654321.4321,15.21,0,1965,"1985-11-14");
29 INSERT INTO t1 VALUES(142,1,'Testing MySQL databases is a cool ',
30  'Must make it bug free for the customer',
31  654321.4321,15.21,0,1965,"1995-11-14");
32 INSERT INTO t1 VALUES(412,1,'Testing MySQL databases is a cool ',
33  'Must make it bug free for the customer',
34  654321.4321,15.21,0,1965,"2005-11-14");
35 --enable_query_log
36 
37 --echo --- Select from t1 on master ---
38 select *
39 from t1
40 order by id;
41 
42 sync_slave_with_master;
43 --echo --- Select from t1 on slave ---
44 select *
45 from t1
46 order by id;
47 
48 --echo --- Perform basic operation on master ---
49 --echo --- and ensure replicated correctly ---
50 connection master;
51 
52 --echo --- Update t1 on master --
53 UPDATE t1 SET b1 = 0, bc='updated', t="2006-02-22"
54 WHERE id < 100
55 ORDER BY id;
56 
57 --echo --- Check the update on master ---
58 SELECT *
59 FROM t1
60 WHERE id < 100
61 ORDER BY id;
62 
63 # Must give injector thread a little time to get update
64 # into the binlog other wise we will miss the update.
65 
66 sync_slave_with_master;
67 --echo --- Check Update on slave ---
68 SELECT *
69 FROM t1
70 WHERE id < 100
71 ORDER BY id;
72 
73 connection master;
74 --echo --- Remove a record from t1 on master ---
75 # Note: there is an error in replication of Delete_row
76 # from NDB to MyISAM (BUG#28538). However, if there is
77 # only one row in Delete_row event then it works fine,
78 # as this test demonstrates.
79 DELETE FROM t1 WHERE id = 412;
80 
81 --echo --- Show current count on master for t1 ---
82 SELECT COUNT(*) FROM t1;
83 
84 sync_slave_with_master;
85 --echo --- Show current count on slave for t1 ---
86 SELECT COUNT(*) FROM t1;
87 
88 connection master;
89 TRUNCATE TABLE t1;
90 sync_slave_with_master;
91 connection master;