#
# Bug#12982188 MTS: SBR ABORTS WITH ERROR 1742 ON LOAD DATA WITH TRIGGER MYISAM TO INNODB
#

--source include/master-slave.inc
--source include/have_binlog_format_statement.inc
--source include/not_gtid_enabled.inc

let $max_workers= 4;

--write_file $MYSQLTEST_VARDIR/load_bug12982188.txt
1
2
3
4
5
6
7
8
9
10
EOF

--connection slave
--source include/stop_slave.inc
SET @save_slave_parallel_workers= @@slave_parallel_workers;
eval SET @@global.slave_parallel_workers=$max_workers;
--source include/start_slave.inc

--connection master
--disable_warnings
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
--enable_warnings
CREATE DATABASE db1;
CREATE DATABASE db2;
CREATE TABLE db1.tb1 (f1 int) ENGINE=MyISAM;
CREATE TABLE db2.tb2 (f1 int) ENGINE=InnoDB;
CREATE TRIGGER db1.tr AFTER INSERT ON tb1 FOR EACH ROW INSERT INTO db2.tb2
(f1) VALUES (new.f1);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/load_bug12982188.txt' INTO TABLE db1.tb1;
--sync_slave_with_master
SELECT COUNT(*) FROM db2.tb2;

# cleanup
--connection master
DROP DATABASE db1;
DROP DATABASE db2;
--remove_file $MYSQLTEST_VARDIR/load_bug12982188.txt

--sync_slave_with_master
--source include/stop_slave.inc
SET @@global.slave_parallel_workers= @save_slave_parallel_workers;
