| 1 |
# |
| 2 |
# MDEV-24667 LOAD DATA INFILE/inserted rows not written to binlog |
| 3 |
# |
| 4 |
# In this test we will have a replication configuration like 1->2->3 |
| 5 |
# 1 will have statement format |
| 6 |
# 2 and 3 will have mixed format |
| 7 |
# We will make some updates on temporary table which are unsafe , So 2 must |
| 8 |
# Log these queries in row format, Since it is on tmp table , It wont be logged |
| 9 |
# So the next query which copies the data from tmp table to normal must be logged |
| 10 |
# into the row format. Instead of checking for the binlog We will compare the |
| 11 |
# results on the 3, If no binlog is lost(ie it is logged into row format), There |
| 12 |
# should not be any data loss. |
| 13 |
--let $rpl_topology=1->2->3 |
| 14 |
--source include/rpl_init.inc |
| 15 |
--source include/have_binlog_format_mixed.inc |
| 16 |
call mtr.add_suppression('Unsafe statement written to the binary log using '); |
| 17 |
--connection server_1 |
| 18 |
|
| 19 |
set binlog_format=statement; |
| 20 |
--echo #first bug |
| 21 |
create table t1 (a int); |
| 22 |
create temporary table tmp like t1; |
| 23 |
--write_file $MYSQLTEST_VARDIR/load_data |
| 24 |
1 |
| 25 |
2 |
| 26 |
EOF |
| 27 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 28 |
eval load data local infile '$MYSQLTEST_VARDIR/load_data' INTO TABLE tmp; |
| 29 |
insert into t1 select * from tmp; |
| 30 |
|
| 31 |
--echo #second bug |
| 32 |
create table t2 (a int); |
| 33 |
#insert into t2 values(10); |
| 34 |
create temporary table tmp2 like t2; |
| 35 |
insert into tmp2 values(10); |
| 36 |
update tmp2 set a = 20 limit 1; |
| 37 |
insert into t2 select * from tmp2; |
| 38 |
--save_master_pos |
| 39 |
|
| 40 |
--connection server_2 |
| 41 |
--sync_with_master |
| 42 |
--save_master_pos |
| 43 |
|
| 44 |
--connection server_3 |
| 45 |
--sync_with_master |
| 46 |
--echo #t1 should have 2 rows |
| 47 |
select count(*) = 2 from t1; |
| 48 |
--echo #t2 should have 1 rows with a = 20 |
| 49 |
select * from t2; |
| 50 |
|
| 51 |
|
| 52 |
# cleanup |
| 53 |
--connection server_1 |
| 54 |
drop table t1, t2, tmp, tmp2; |
| 55 |
--remove_file $MYSQLTEST_VARDIR/load_data |
| 56 |
--source include/rpl_end.inc |