summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKentoku SHIBA <kentokushiba@gmail.com>2019-11-13 00:32:27 +0900
committerGitHub <noreply@github.com>2019-11-13 00:32:27 +0900
commit83a0eaec080b21e1dff5a66b6d880bded74085f6 (patch)
tree5bf6eefc2b8d253f373d8ce77e3c1ad45b404657
parent33cb10d4e9793d1b6800be22e8eb9ceffdd8af4a (diff)
downloadmariadb-git-83a0eaec080b21e1dff5a66b6d880bded74085f6.tar.gz
MDEV-18987 bug in "load data local infile xxx replace into " (#1408)
It's just added regression tests.
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc11
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc25
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result84
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result104
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result104
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result75
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc76
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc3
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc4
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc14
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc52
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result114
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result103
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result114
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result123
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result123
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result95
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc100
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test8
-rw-r--r--storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test8
62 files changed, 2747 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc
new file mode 100644
index 00000000000..f1899d1576a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc
new file mode 100644
index 00000000000..24f0dc9820e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi0_init.inc
@@ -0,0 +1,4 @@
+--source load_data_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc
new file mode 100644
index 00000000000..f1899d1576a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc
new file mode 100644
index 00000000000..50ef8d47696
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_ddi1_init.inc
@@ -0,0 +1,4 @@
+--source load_data_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc
new file mode 100644
index 00000000000..f8405973768
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_deinit.inc
@@ -0,0 +1,11 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc
new file mode 100644
index 00000000000..5f4104382dc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/include/load_data_init.inc
@@ -0,0 +1,25 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a", srv "s_2_1"';
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result
new file mode 100644
index 00000000000..2244b176b31
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi0.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result
new file mode 100644
index 00000000000..6d0d29cd4bd
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result
new file mode 100644
index 00000000000..1bdd1470faa
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi0.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result
new file mode 100644
index 00000000000..4d64840e85d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_ignore_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result
new file mode 100644
index 00000000000..9156c838e09
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi0.result
@@ -0,0 +1,84 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result
new file mode 100644
index 00000000000..761ce71dc02
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result
new file mode 100644
index 00000000000..81d0fdbf785
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi0.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result
new file mode 100644
index 00000000000..737cccc42cb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_ignore_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result
new file mode 100644
index 00000000000..7d8fb034544
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi0.result
@@ -0,0 +1,104 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result
new file mode 100644
index 00000000000..f3e272c1cd1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_local_replace_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result
new file mode 100644
index 00000000000..3ce058a9fc8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi0.result
@@ -0,0 +1,104 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result
new file mode 100644
index 00000000000..86124b9c5c6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/r/load_data_replace_ddi1.result
@@ -0,0 +1,75 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc
new file mode 100644
index 00000000000..8c1aa4e651f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc
@@ -0,0 +1,76 @@
+--echo
+--echo this test is for MDEV-18987
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+--disable_query_log
+--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--enable_query_log
+eval $COMMAND_BEFORE_LOAD_DATA;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--enable_query_log
+--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test
new file mode 100644
index 00000000000..d43a944d5e1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test
new file mode 100644
index 00000000000..a73d1ef03b2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test
new file mode 100644
index 00000000000..6fee83e7b43
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test
new file mode 100644
index 00000000000..1c8827911b2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test
new file mode 100644
index 00000000000..dadd02245ba
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test
new file mode 100644
index 00000000000..95b065050b5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test
new file mode 100644
index 00000000000..2243f8924a8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test
new file mode 100644
index 00000000000..2ab7307e3af
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test
new file mode 100644
index 00000000000..1821a9ef730
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test
new file mode 100644
index 00000000000..3d53feca372
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_local_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test
new file mode 100644
index 00000000000..4bc402a40f1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test
new file mode 100644
index 00000000000..9dafd24a15e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data.inc
+--source ../include/load_data_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc
new file mode 100644
index 00000000000..c41917340b0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_part_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc
new file mode 100644
index 00000000000..8e69f52cc58
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi0_init.inc
@@ -0,0 +1,4 @@
+--source load_data_part_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc
new file mode 100644
index 00000000000..c41917340b0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_deinit.inc
@@ -0,0 +1,3 @@
+--connection master_1
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+--source load_data_part_deinit.inc
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc
new file mode 100644
index 00000000000..b9194ccd51c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_ddi1_init.inc
@@ -0,0 +1,4 @@
+--source load_data_part_init.inc
+--connection master_1
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc
new file mode 100644
index 00000000000..2248eef3650
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_deinit.inc
@@ -0,0 +1,14 @@
+--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
+--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP
+--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP
+--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP
+--let $CHILD2_2_DROP_TABLES= $CHILD2_2_DROP_TABLES_BACKUP
+--let $CHILD2_2_CREATE_TABLES= $CHILD2_2_CREATE_TABLES_BACKUP
+--let $CHILD2_2_SELECT_TABLES= $CHILD2_2_SELECT_TABLES_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc
new file mode 100644
index 00000000000..42a0ea72539
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/include/load_data_part_init.inc
@@ -0,0 +1,52 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+if (!$HAVE_PARTITION)
+{
+ --source load_data_part_deinit.inc
+ --enable_result_log
+ --enable_query_log
+ --enable_warnings
+ skip Test requires partitioning;
+}
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
+let $MASTER_1_COMMENT_2_1=
+ COMMENT='table "tbl_a"'
+ PARTITION BY KEY(pkey) (
+ PARTITION pt1 COMMENT='srv "s_2_1"',
+ PARTITION pt2 COMMENT='srv "s_2_2"'
+ );
+--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES
+let $CHILD2_1_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES
+let $CHILD2_1_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES
+let $CHILD2_1_SELECT_TABLES=
+ SELECT pkey, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+--let $CHILD2_2_DROP_TABLES_BACKUP= $CHILD2_2_DROP_TABLES
+let $CHILD2_2_DROP_TABLES=
+ DROP TABLE IF EXISTS tbl_a;
+--let $CHILD2_2_CREATE_TABLES_BACKUP= $CHILD2_2_CREATE_TABLES
+let $CHILD2_2_CREATE_TABLES=
+ CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+ ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
+--let $CHILD2_2_SELECT_TABLES_BACKUP= $CHILD2_2_SELECT_TABLES
+let $CHILD2_2_SELECT_TABLES=
+ SELECT pkey, val FROM tbl_a ORDER BY pkey;
+let $CHILD2_2_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result
new file mode 100644
index 00000000000..23753239054
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi0.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result
new file mode 100644
index 00000000000..c30a5c037a7
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result
new file mode 100644
index 00000000000..0071042cd58
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi0.result
@@ -0,0 +1,114 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+2 3
+4 5
+6 7
+8 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result
new file mode 100644
index 00000000000..9f2e8dec535
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_ignore_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+2 3
+4 5
+6 7
+8 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result
new file mode 100644
index 00000000000..7ec2b5b0b9e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi0.result
@@ -0,0 +1,103 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result
new file mode 100644
index 00000000000..f908ce1c1d5
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+TRUNCATE tbl_a;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result
new file mode 100644
index 00000000000..c0a8f653fee
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi0.result
@@ -0,0 +1,114 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+Warnings:
+Warning 1062 Duplicate entry '0' for key 'PRIMARY'
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+Warning 1062 Duplicate entry '3' for key 'PRIMARY'
+Warning 1062 Duplicate entry '4' for key 'PRIMARY'
+Warning 1062 Duplicate entry '5' for key 'PRIMARY'
+Warning 1062 Duplicate entry '6' for key 'PRIMARY'
+Warning 1062 Duplicate entry '7' for key 'PRIMARY'
+Warning 1062 Duplicate entry '8' for key 'PRIMARY'
+Warning 1062 Duplicate entry '9' for key 'PRIMARY'
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+insert high_priority into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+2 3
+4 5
+6 7
+8 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result
new file mode 100644
index 00000000000..619dd789d9a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_ignore_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' IGNORE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 2
+3 4
+5 6
+7 8
+9 10
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert high_priority ignore into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 1
+2 3
+4 5
+6 7
+8 9
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result
new file mode 100644
index 00000000000..e12e380bb93
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi0.result
@@ -0,0 +1,123 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result
new file mode 100644
index 00000000000..d367cbfd0ad
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_local_replace_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result
new file mode 100644
index 00000000000..039a8dd4fad
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi0.result
@@ -0,0 +1,123 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 0;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 1,`val` = 1 where `pkey` = 1 and `val` = 2 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(3,3)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 3 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 3,`val` = 3 where `pkey` = 3 and `val` = 4 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(5,5)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 5 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 5,`val` = 5 where `pkey` = 5 and `val` = 6 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(7,7)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 7 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 7,`val` = 7 where `pkey` = 7 and `val` = 8 limit 1
+insert into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(9,9)
+select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 9 for update
+update ignore `auto_test_remote`.`tbl_a` set `pkey` = 9,`val` = 9 where `pkey` = 9 and `val` = 10 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 0 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 0,`val` = 0 where `pkey` = 0 and `val` = 1 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(2,2)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 2,`val` = 2 where `pkey` = 2 and `val` = 3 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(4,4)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 4 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 4,`val` = 4 where `pkey` = 4 and `val` = 5 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(6,6)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 6 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 6,`val` = 6 where `pkey` = 6 and `val` = 7 limit 1
+insert into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(8,8)
+select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 8 for update
+update ignore `auto_test_remote2`.`tbl_a` set `pkey` = 8,`val` = 8 where `pkey` = 8 and `val` = 9 limit 1
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result
new file mode 100644
index 00000000000..c8155be9910
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/r/load_data_part_replace_ddi1.result
@@ -0,0 +1,95 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection master_1;
+set @old_spider_direct_dup_insert= @@spider_direct_dup_insert;
+set session spider_direct_dup_insert= 1;
+
+this test is for MDEV-18987
+
+drop and create databases
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+connection child2_2;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+
+create table and insert
+connection child2_1;
+CHILD2_1_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+CHILD2_2_CREATE_TABLES
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE TABLE tbl_a (
+pkey int NOT NULL,
+val int NOT NULL,
+PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+UPDATE tbl_a SET val = val + 1;
+
+select test 1
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection child2_2;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' REPLACE INTO TABLE tbl_a;
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote`.`tbl_a`(`pkey`,`val`)values(1,1),(3,3),(5,5),(7,7),(9,9)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+1 1
+3 3
+5 5
+7 7
+9 9
+connection child2_2;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%';
+argument
+replace into `auto_test_remote2`.`tbl_a`(`pkey`,`val`)values(0,0),(2,2),(4,4),(6,6),(8,8)
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%`tbl_a`%'
+SELECT pkey, val FROM tbl_a ORDER BY pkey;
+pkey val
+0 0
+2 2
+4 4
+6 6
+8 8
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+connection child2_2;
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+connection master_1;
+set session spider_direct_dup_insert= @old_spider_direct_dup_insert;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc
new file mode 100644
index 00000000000..e66550f9a90
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc
@@ -0,0 +1,100 @@
+--echo
+--echo this test is for MDEV-18987
+--echo
+--echo drop and create databases
+
+--connection master_1
+--disable_warnings
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--connection child2_1
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+--connection child2_2
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+CREATE DATABASE auto_test_remote2;
+USE auto_test_remote2;
+--enable_warnings
+
+--echo
+--echo create table and insert
+
+--connection child2_1
+--disable_query_log
+echo CHILD2_1_CREATE_TABLES;
+eval $CHILD2_1_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+--disable_query_log
+echo CHILD2_2_CREATE_TABLES;
+eval $CHILD2_2_CREATE_TABLES;
+--enable_query_log
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ pkey int NOT NULL,
+ val int NOT NULL,
+ PRIMARY KEY (pkey)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+--disable_query_log
+--echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey;
+--enable_query_log
+eval $COMMAND_BEFORE_LOAD_DATA;
+
+--echo
+--echo select test 1
+
+--connection child2_1
+TRUNCATE TABLE mysql.general_log;
+
+--connection child2_2
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+--disable_query_log
+--echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a;
+--enable_query_log
+--remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv
+
+--connection child2_1
+eval $CHILD2_1_SELECT_ARGUMENT1;
+eval $CHILD2_1_SELECT_TABLES;
+
+--connection child2_2
+eval $CHILD2_2_SELECT_ARGUMENT1;
+eval $CHILD2_2_SELECT_TABLES;
+
+--echo
+--echo deinit
+--disable_warnings
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+
+--connection child2_2
+DROP DATABASE IF EXISTS auto_test_remote2;
+SET GLOBAL log_output = @old_log_output;
+
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test
new file mode 100644
index 00000000000..b78529095a4
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test
new file mode 100644
index 00000000000..a2540077639
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL=
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test
new file mode 100644
index 00000000000..a6fb58d69d1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test
new file mode 100644
index 00000000000..b9f75894c60
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test
new file mode 100644
index 00000000000..f44f7ae936d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test
new file mode 100644
index 00000000000..4c806096ad1
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= TRUNCATE tbl_a
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD=
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test
new file mode 100644
index 00000000000..179bab5b4aa
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test
new file mode 100644
index 00000000000..cd7d8215b7a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_ignore_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= IGNORE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test
new file mode 100644
index 00000000000..5df3f420e09
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test
new file mode 100644
index 00000000000..bf3c7c93be8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_local_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL= LOCAL
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test
new file mode 100644
index 00000000000..910b7e813da
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi0.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi0_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi0_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test
new file mode 100644
index 00000000000..fc84bf14487
--- /dev/null
+++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part_replace_ddi1.test
@@ -0,0 +1,8 @@
+--source ../include/load_data_part_ddi1_init.inc
+--let COMMAND_BEFORE_LOAD_DATA= UPDATE tbl_a SET val = val + 1
+--let OPTION_LOCAL=
+--let OPTION_WORD= REPLACE
+--source load_data_part.inc
+--source ../include/load_data_part_ddi1_deinit.inc
+--echo
+--echo end of test