2 # This is a wrapper to help minimize writing of assertions
3 # that resort to rpl_row_img_parts_assertion.inc on a
4 # master-slave scenario.
6 # This script takes a statement to be executed and master
7 # and slave expected images description as parameters. Before
8 # statement execution (on the master only), both servers are
9 # synchronized, and positions explicitly saved. These are
10 # then used as starting position in mysqlbinlog -v (see
11 # suite/rpl/include/rpl_row_img_parts_assertion.inc).
15 # The query to be executed on the master, which will
16 # make master and slave log one or more row events.
18 # - $row_img_expected_master
19 # String representation of the expected images to search
20 # on master's mysqlbinlog -v output
22 # - $row_img_expected_slave
23 # String representation of the expected images to search
24 # on slaves's mysqlbinlog -v output
28 # -- let $row_img_query= INSERT INTO t VALUES (1, 2, 3)
29 # -- let $row_img_expected_master= | 1:1 2:2 3:3
30 # -- let $row_img_expected_slave = | 1:1 2:2 3:3
31 # -- source include/rpl_row_img_parts_master_slave.inc
33 # -- let $row_img_query= UPDATE t SET c2= 4 WHERE c1=1
34 # -- let $row_img_expected_master= 1:1 | 2:4
35 # -- let $row_img_expected_slave = 1:1 2:2 3:3 | 1:1 2:4 3:3
36 # -- source include/rpl_row_img_parts_master_slave.inc
38 # -- let $row_img_query= DELETE FROM t WHERE c2=4
39 # -- let $row_img_expected_master= 1:1 |
40 # -- let $row_img_expected_slave = 1:1 2:4 3:3 |
41 # -- source include/rpl_row_img_parts_master_slave.inc
45 # 1. Both master and slave are synchronized before execution
46 # of the query takes place
48 # 2. original connection - the one in use before including
49 # this script - is restored at the end
51 -- let $old_conn= $CURRENT_CONNECTION
54 -- sync_slave_with_master
56 -- let $row_img_pos_slave= query_get_value(SHOW MASTER
STATUS, Position, 1)
59 -- let $row_img_pos_master= query_get_value(SHOW MASTER
STATUS, Position, 1)
63 -- eval $row_img_query
65 # lets wait until the binary log position changes
66 # we may have just executed an insert delayed
67 -- let $_pos= query_get_value(
"SHOW MASTER STATUS", Position, 1)
70 -- let $iterations=3000
71 while($_pos == $row_img_pos_master)
74 -- let $_pos= query_get_value(
"SHOW MASTER STATUS", Position, 1)
80 -- echo Time out
while waiting
for the
event to be written
to the binary log at the master!
81 -- echo Query: $row_img_query
82 -- source include/show_rpl_debug_info.inc
87 -- sync_slave_with_master
91 -- let $row_img_expected= $row_img_expected_master
92 -- let $row_img_pos= $row_img_pos_master
93 -- source include/rpl_row_img_parts_assertion.inc
97 -- let $row_img_expected= $row_img_expected_slave
98 -- let $row_img_pos= $row_img_pos_slave
99 -- source include/rpl_row_img_parts_assertion.inc
101 -- connection $old_conn