Bug #6353 Replication using replicate-rewrite-db and LOAD DATA INFILE rewrite missing
Submitted: 31 Oct 2004 23:22 Modified: 15 Nov 2004 16:23
Reporter: Scott Nursten Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:4.1.7 OS:Linux (Linux x86 2.6.7, Mac OS X.3 Pant)
Assigned to: Lars Thalmann CPU Architecture:Any

[31 Oct 2004 23:22] Scott Nursten
Description:
When replicating a db using the replicate-rewrite-db option to change the db name that the slave 
uses, if you use the 'LOAD DATA INFILE' syntax on the master the client tries to load the data into 
the original db name.

The SQL_LOAD-x.x.x.info file in /tmp shows: 

----snip 'strings /tmp/SQL_LOAD-2-1-6.info'----
table_name
orig_db_name
/tmp/SQL_LOAD-2-1-6.data
----snip----

and the mysql.err log shows: 

----snip 'mysql.err log output'----
041031 23:10:25 [ERROR] Slave: Error 'Unknown table 'orig_db_name.table_name' in field list' 
running LOAD DATA INFILE on table 'table_name'. Default database: 'rewrite_db_name', 
Error_code: 1109
----snip----

How to repeat:
Setup a master/slave relationship using replicate-rewrite-db, use LOAD DATA INFILE on the 
master and shazam - at least thats what happens with me :) Setting up orig_db_name on the 
slave fixes the problem and the data actually gets loaded into there instead :) 

Suggested fix:
No idea. Sorry - not my thing really, however, it would seem that whatever writes the 
SQL_LOAD-x.x.x.info doesn't do the rewrite-db step.
[1 Nov 2004 12:36] MySQL Verification Team
Verified with  4.1.8-debug-log
[11 Nov 2004 16:32] Lars Thalmann
Thanks for letting us know, Scott.

I have now created a bug patch that is being reviewed.
The report will be closed when this is pushed into the development tree.
[15 Nov 2004 16:23] Lars Thalmann
Patch now pushed into repository and will be part of next release.