1 #############################################
4 #Purpose: Generic replication to cluster
5 # and ensuring that the ndb_apply_status
7 #############################################
9 # select_ndb_apply_status.inc
10 # Selects out the log name, start & end pos
11 # from the ndb_apply_status table
13 # include/show_binlog_using_logname.inc
14 # To select out 1 row from offset 1
15 # from the start position in the binlog whose
19 # Creates DATABASE tpcb, the tables and
20 # stored procedures for loading the DB
21 # and for running transactions against DB.
22 ##############################################
30 create
table t1 (a
int key, b
int) engine innodb;
31 create
table t2 (a
int key, b
int) engine innodb;
35 --sync_slave_with_master
36 alter
table t1 engine ndb;
37 alter
table t2 engine ndb;
41 # check binlog position without begin
43 insert into t1 values (1,2);
47 --sync_slave_with_master
48 --source suite/ndb_rpl/t/select_ndb_apply_status.inc
53 --echo # Now check that that is in the apply_status
table is consistant
54 --echo # with what is in the binlog
56 --echo # since insert is done with transactional engine, expect a BEGIN
57 --echo # at <start_pos>
59 --let $binlog_start= $start_pos
60 --let $binlog_limit= 1
61 --source include/show_binlog_events.inc
64 --echo # Now the insert, one step after
66 --let $binlog_start= $start_pos
67 --let $binlog_limit= 1,1
68 --source include/show_binlog_events.inc
71 --echo # and the COMMIT should be at <end_pos>
73 --let $binlog_start= $start_pos
74 --let $binlog_limit= 2,1
75 --source include/show_binlog_events.inc
79 # check binlog position with begin
81 insert into t1 values (2,3);
82 insert into t2 values (3,4);
87 --sync_slave_with_master
88 --source suite/ndb_rpl/t/select_ndb_apply_status.inc
91 --let $binlog_start= $start_pos
92 --let $binlog_limit= 1
93 --source include/show_binlog_events.inc
95 --let $binlog_start= $start_pos
96 --let $binlog_limit= 1,2
97 --source include/show_binlog_events.inc
99 --let $binlog_start= $start_pos
100 --let $binlog_limit= 3,1
101 --source include/show_binlog_events.inc
107 --sync_slave_with_master
110 # Run in some transactions using stored procedures
111 # and ensure that the ndb_apply_status table is
112 # updated to show the transactions
116 --echo ***
Test 2 ***
119 # Create database/tables and stored procdures
121 --source include/tpcb.inc
123 # Switch tables on slave to use NDB
124 --sync_slave_with_master
126 ALTER
TABLE account ENGINE NDB;
127 ALTER
TABLE branch ENGINE NDB;
128 ALTER
TABLE teller ENGINE NDB;
129 ALTER
TABLE history ENGINE NDB;
133 # Load DB tpcb and run some transactions
142 --eval CALL tpcb.trans($rpl_format);
143 eval SET @my_errno= $mysql_errno;
144 let $run_good= `SELECT @my_errno = 0`;
145 let $run_bad= `SELECT @my_errno <> 0`;
160 --sync_slave_with_master
161 --source suite/ndb_rpl/t/select_ndb_apply_status.inc
166 --source include/show_binlog_using_logname.inc
168 # Flush the logs on the master moving all
169 # Transaction to a new binlog and ensure
170 # that the ndb_apply_status table is updated
171 # to show the use of the new binlog.
177 # Flush logs on master which should force it
178 # to switch to binlog #2
182 # Run in some transaction to increase end pos in
191 --eval CALL tpcb.trans($rpl_format);
192 eval SET @my_errno= $mysql_errno;
193 let $run_good= `SELECT @my_errno = 0`;
194 let $run_bad= `SELECT @my_errno <> 0`;
210 --sync_slave_with_master
211 --source suite/ndb_rpl/t/select_ndb_apply_status.inc
216 --source include/show_binlog_using_logname.inc
218 # Now we reset both the master and the slave
219 # Run some more transaction and ensure
220 # that the ndb_apply_status is updated
227 # Reset both slave and master
228 # This should reset binlog to #1
229 --source include/rpl_reset.inc
233 # Run in some transactions and check
241 --eval CALL tpcb.trans($rpl_format);
242 eval SET @my_errno= $mysql_errno;
243 let $run_good= `SELECT @my_errno = 0`;
244 let $run_bad= `SELECT @my_errno <> 0`;
258 --sync_slave_with_master
259 --source suite/ndb_rpl/t/select_ndb_apply_status.inc
264 --source include/show_binlog_using_logname.inc
266 # Since we are doing replication, it is a good
267 # idea to check to make sure all data was
268 # Replicated correctly
271 --echo *** DUMP MASTER & SLAVE FOR COMPARE ********
273 --exec $MYSQL_DUMP -
n -t --compact --order-by-primary --
skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
275 --exec $MYSQL_DUMP_SLAVE -
n -t --compact --order-by-primary --
skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql
280 --sync_slave_with_master
282 ####### Commenting out until decision on Bug#27960 ###########
284 #--source suite/ndb_rpl/t/select_ndb_apply_status.inc
287 #--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos
288 #--source include/show_binlog_using_logname.inc
290 --echo ****** Do dumps
compare ************
293 diff_files $MYSQLTEST_VARDIR/tmp/master_apply_status.sql $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql;
295 ## Note: Ths files should only get removed, if the above diff succeeds.
297 --remove_file $MYSQLTEST_VARDIR/tmp/master_apply_status.sql
298 --remove_file $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql