1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
include/rpl_init.inc [topology=1->2->3]
connection server_3;
include/stop_slave.inc
connection server_1;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
alter table mysql.gtid_slave_pos engine=innodb;
create table t1 (a int) engine=aria;
create table t2 (a int) engine=innodb;
include/save_master_gtid.inc
# Sleep 1 to ensure setup DDL and test statements have different binlog timestamps
connection server_2;
set @old_par_thds= @@global.slave_parallel_threads;
#
# Ensure that the slave doesn't overwrite exec_time when binlogging
#
connection server_2;
include/sync_with_master_gtid.inc
include/stop_slave.inc
change master to master_delay=SLAVE_DELAY;
include/start_slave.inc
connection server_2;
include/stop_slave.inc
set @@global.slave_parallel_threads= 0;
include/start_slave.inc
connection server_2;
flush logs;
connection server_1;
# Only sleep on master so the real execution time on the slave is less
insert into t1 values (sleep(if(@@global.server_id=1, 2, 0)));
include/save_master_gtid.inc
# Waiting for slave to delay and commit transaction..
connection server_2;
include/sync_with_master_gtid.inc
# MYSQL_BINLOG slave_local_binlog > slave_outfile
include/assert_grep.inc [Ensure serial slave doesn't overwrite exec_time in the binlog event (0s)]
include/assert_grep.inc [Ensure serial slave doesn't overwrite exec_time in the binlog event (1s)]
#
# Test that changes are properly applied by server_2 and server_3
#
connection server_1;
include/save_master_pos.inc
connection server_2;
include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
include/save_master_pos.inc
# Show that the server_2 received the insert from master
select * from t1;
a
0
master <> NULL; Should be 1
1
master_time == slave_time ; Should be 1
1
connection server_3;
include/start_slave.inc
include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
# Show that the server_3 received the insert from master
select * from t1;
a
0
master <> NULL; Should be 1
1
master_time == slave_time ; Should be 1
1
include/stop_slave.inc
connection server_1;
connection server_2;
include/stop_slave.inc
set @@global.slave_parallel_threads= @old_par_thds;
include/start_slave.inc
connection server_2;
include/stop_slave.inc
set @@global.slave_parallel_threads= 1;
include/start_slave.inc
connection server_2;
flush logs;
connection server_1;
# Only sleep on master so the real execution time on the slave is less
insert into t1 values (sleep(if(@@global.server_id=1, 2, 0)));
include/save_master_gtid.inc
# Waiting for slave to delay and commit transaction..
connection server_2;
include/sync_with_master_gtid.inc
# MYSQL_BINLOG slave_local_binlog > slave_outfile
include/assert_grep.inc [Ensure parallel slave doesn't overwrite exec_time in the binlog event (0s)]
include/assert_grep.inc [Ensure parallel slave doesn't overwrite exec_time in the binlog event (1s)]
#
# Test that changes are properly applied by server_2 and server_3
#
connection server_1;
include/save_master_pos.inc
connection server_2;
include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
include/save_master_pos.inc
# Show that the server_2 received the insert from master
select * from t1;
a
0
0
master <> NULL; Should be 1
1
master_time == slave_time ; Should be 1
1
connection server_3;
include/start_slave.inc
include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
# Show that the server_3 received the insert from master
select * from t1;
a
0
0
master <> NULL; Should be 1
1
master_time == slave_time ; Should be 1
1
include/stop_slave.inc
connection server_1;
connection server_2;
include/stop_slave.inc
set @@global.slave_parallel_threads= @old_par_thds;
include/start_slave.inc
#
# Cleanup
connection server_2;
include/stop_slave.inc
change master to master_delay=0;
include/start_slave.inc
connection server_3;
include/start_slave.inc
connection server_1;
drop table t1;
drop table t2;
include/rpl_end.inc
# End of master_last_event_time_stmt
|