| 1 |
# A "body" for rpl.rpl_parallel_29322 that runs having as input |
| 2 |
# the master and slave @@global.explicit_defaults_for_timestamp. |
| 3 |
# |
| 4 |
# The Key notes |
| 5 |
# ------------- |
| 6 |
# On master: a sequence of binlog files is composed with |
| 7 |
# different server versions. |
| 8 |
# On slave: to first try enqueuing all master events. |
| 9 |
# Due to binlog files are from different version |
| 10 |
# servers when the new (of binlog 2) FD shows up the enqueuing |
| 11 |
# will hiccup as workers have to |
| 12 |
# process all events already scheduled (see wait_condition below). |
| 13 |
# This part proves of the different server version the binlogs |
| 14 |
# indeed are. |
| 15 |
# After the worker is unblocked the exection proceeds. |
| 16 |
# |
| 17 |
# In the end compare table definitions and print table data |
| 18 |
# to prove correctness. |
| 19 |
|
| 20 |
--connection slave |
| 21 |
--source include/stop_slave.inc |
| 22 |
--let $master_use_gtid_option=No |
| 23 |
--source include/reset_slave.inc |
| 24 |
|
| 25 |
--connection master |
| 26 |
--let $datadir= `SELECT @@datadir` |
| 27 |
|
| 28 |
reset master; # Master starts a new serious of binlog files |
| 29 |
|
| 30 |
create table t2 (a timestamp, b int); |
| 31 |
show create table t2; |
| 32 |
--save_master_pos |
| 33 |
|
| 34 |
--connection slave |
| 35 |
--source include/start_slave.inc |
| 36 |
--sync_with_master |
| 37 |
--source include/stop_slave.inc |
| 38 |
|
| 39 |
# load for two $same_version_binlogs branches |
| 40 |
--connection master |
| 41 |
if (!$same_version_binlogs) |
| 42 |
{ |
| 43 |
insert into t2 values (null, 1); |
| 44 |
flush binary logs; |
| 45 |
flush binary logs; |
| 46 |
insert into t2 values (null, 2); |
| 47 |
} |
| 48 |
if ($same_version_binlogs) |
| 49 |
{ |
| 50 |
--disable_query_log |
| 51 |
--let $count=8 |
| 52 |
while ($count) |
| 53 |
{ |
| 54 |
--let $queries=4 |
| 55 |
while ($queries) |
| 56 |
{ |
| 57 |
insert into t2 values (null, 1); |
| 58 |
--dec $queries |
| 59 |
} |
| 60 |
flush binary logs; |
| 61 |
flush binary logs; |
| 62 |
--dec $count |
| 63 |
} |
| 64 |
--enable_query_log |
| 65 |
} |
| 66 |
--save_master_pos |
| 67 |
|
| 68 |
if (!$same_version_binlogs) |
| 69 |
{ |
| 70 |
# Make sure the dump thread is gone before moving around binlog files. Else |
| 71 |
# it might see an empty file and give error (MDEV-29816). |
| 72 |
--let $dump_thrid= `Select id FROM information_schema.processlist WHERE Command='Binlog Dump'` |
| 73 |
if ($dump_thrid) { |
| 74 |
--disable_query_log |
| 75 |
--error 0,ER_NO_SUCH_THREAD |
| 76 |
eval KILL CONNECTION $dump_thrid; |
| 77 |
--enable_query_log |
| 78 |
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE Command='Binlog Dump' |
| 79 |
--source include/wait_condition.inc |
| 80 |
} |
| 81 |
--move_file $datadir/master-bin.000002 $datadir/master-bin.000002.sav |
| 82 |
--copy_file $MYSQL_TEST_DIR/std_data/mdev29078-mysql-bin.000001 $datadir/master-bin.000002 |
| 83 |
--exec $MYSQL_BINLOG --short-form $datadir/master-bin.000002 |
| 84 |
|
| 85 |
# To demonstrate different version binlogs, hold back worker |
| 86 |
# until the SQL thread state shows waiting. |
| 87 |
--connection slave1 |
| 88 |
lock table t2 write; |
| 89 |
} |
| 90 |
|
| 91 |
--connection slave |
| 92 |
--source include/start_slave.inc |
| 93 |
|
| 94 |
if (!$same_version_binlogs) |
| 95 |
{ |
| 96 |
--let $slave_waits_for=Waiting for worker threads to be idle |
| 97 |
--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state = "$slave_waits_for" |
| 98 |
--source include/wait_condition.inc |
| 99 |
|
| 100 |
--connection slave1 |
| 101 |
unlock tables; |
| 102 |
|
| 103 |
--connection slave |
| 104 |
--sync_with_master |
| 105 |
show create table t1; |
| 106 |
set statement time_zone='+2:00' for select * from t1; |
| 107 |
drop table t1; |
| 108 |
|
| 109 |
--connection master |
| 110 |
--remove_file $datadir/master-bin.000002 |
| 111 |
--move_file $datadir/master-bin.000002.sav $datadir/master-bin.000002 |
| 112 |
} |
| 113 |
|
| 114 |
--connection slave |
| 115 |
--sync_with_master |
| 116 |
show create table t2; |
| 117 |
--let $diff_tables=master:t2,slave:t2 |
| 118 |
--source include/diff_tables.inc |
| 119 |
|
| 120 |
--connection master |
| 121 |
drop table t2; |
| 122 |
|
| 123 |
--sync_slave_with_master |