Bug #78051 LOAD DATA INFILE is not replicated correctly if master uses relay-log-info-repos
Submitted: 13 Aug 2015 8:01 Modified: 13 Aug 2015 10:31
Reporter: Nikolai Ikhalainen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.6 5.5, 5.6.26 OS:Linux
Assigned to: CPU Architecture:Any
Tags: LOAD DATA INFILE, lrelay_log_info_repository

[13 Aug 2015 8:01] Nikolai Ikhalainen
Description:
"LOAD DATA CONCURRENT LOCAL INFILE" is not replicated correctly
relay-log-info-repository=TABLE
max-relay-log-size=6990506

There is a master db1.
db2 is  a slave for db1 and master for db3.

db2 uses --log-slave-updates --log-bin=mysqld-bin --binlog-format=MIXED  --max-relay-log-size=6990506 --relay-log-info-repository=TABLE

If relay-log-info-repository is not equal TABLE,  the query "LOAD DATA INFILE" is replicated correctly.

If relay-log-info-repository=TABLE, not all rows are replicated.

How to repeat:
#!/bin/bash
docker run -d --name db1 -e MYSQL_ROOT_PASSWORD=Ohsh7Zae1d mysql:5.6  --server-id=55 --log-bin=mysqld-bin --binlog-format=MIXED
docker run --link db1:db1 -d --name db2 -e MYSQL_ROOT_PASSWORD=Ohsh7Zae1d mysql:5.6 --server-id=56 --log-slave-updates --log-bin=mysqld-bin --binlog-format=MIXED  --max-relay-log-size=6990506 --relay-log-info-repository=TABLE
docker run --link db2 -d --name db3 -e MYSQL_ROOT_PASSWORD=Ohsh7Zae1d mysql:5.6 --server-id=562

# docker exec -it db2 mysql -pOhsh7Zae1d
echo "waiting for mysql start"
while ! docker exec -it db3 mysqladmin -pOhsh7Zae1d ping &>/dev/null ; do sleep 1 ; done
while ! docker exec -it db2 mysqladmin -pOhsh7Zae1d ping &>/dev/null ; do sleep 1 ; done
while ! docker exec -it db1 mysqladmin -pOhsh7Zae1d ping &>/dev/null ; do sleep 1 ; done

sleep 20
echo "loading database data"
docker exec -it db1 mysql -pOhsh7Zae1d -e "create database test_db"

docker exec -it db1 mysql -pOhsh7Zae1d test_db -e "CREATE TABLE a ( a int) ENGINE=InnoDB"
docker exec -it db1 /bin/bash -c 'seq 2000000 > /root/test.csv'
docker exec -it db1 mysql -pOhsh7Zae1d test_db -e "LOAD DATA CONCURRENT LOCAL INFILE '/root/test.csv' INTO TABLE a FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'";

docker exec -it  db2 mysql -pOhsh7Zae1d -e "change master to master_host='db1', master_user='root', master_password='Ohsh7Zae1d',master_log_file='mysqld-bin.000001', master_log_pos=120; start slave"
docker exec -it  db3 mysql -pOhsh7Zae1d -e "change master to master_host='db2', master_user='root', master_password='Ohsh7Zae1d',master_log_file='mysqld-bin.000001', master_log_pos=120; start slave"

echo "Waiting before checksum"
sleep 150
echo -n "Last slave MD5:      "
docker exec -it db3 mysql -N -pOhsh7Zae1d -e "select * from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'|md5sum
sleep 30
echo -n "Rep: Last slave MD5: "
docker exec -it db3 mysql -N -pOhsh7Zae1d -e "select * from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'|md5sum
echo -n "Master MD5:          "
docker exec -it db1 mysql -N -pOhsh7Zae1d -e "select * from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'|md5sum

echo -n "5.6 Master MD5       "
docker exec -it db2 mysql -N -pOhsh7Zae1d -e "select * from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'|md5sum

echo -n "Count on slave:  "
docker exec -it db3 mysql --batch -N -pOhsh7Zae1d -e "select count(*) from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'
echo -n "Count on master: "
docker exec -it db1 mysql --batch -N -pOhsh7Zae1d -e "select count(*) from test_db.a;" |grep -v 'Using a password on the command line interface can be insecure'

The output:
Last slave MD5:      f71a7d0314572eea7cfa08a6104a2f1d  -
Rep: Last slave MD5: f71a7d0314572eea7cfa08a6104a2f1d  -
Master MD5:          8eb5b59b82e619c153a0af2a22b22572  -
5.6 Master MD5       8eb5b59b82e619c153a0af2a22b22572  -
Count on slave:  1392236
Count on master: 2000000
[13 Aug 2015 10:31] MySQL Verification Team
Hello Nikolai Ikhalainen,

Thank you for the report and test case.
Observed this with 5.6.26 builds.

Thanks,
Umesh
[13 Aug 2015 10:31] MySQL Verification Team
test results

Attachment: 78051.5_6_26.results (application/octet-stream, text), 18.08 KiB.