Bug #183 Replication of temporary tables not working
Submitted: 23 Mar 2003 8:36 Modified: 3 Apr 2003 1:38
Reporter: Noam Freedman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:4.0.12 OS:FreeBSD (FreeBSD 4.5/4.7)
Assigned to: Bugs System CPU Architecture:Any

[23 Mar 2003 8:36] Noam Freedman
Description:
I'm having a problem with replicating temporary tables.  When I try to create a temporary table and then load data into it, my slave processes stop.  The error I get is:

030323 11:09:33  Slave: Slave: Error 'Table '%-.64s.%-.64s' doesn't exist' running load data infile , error_code=1146
030323 11:09:33  Slave: Failed executing load from '/var/tmp/SQL_LOAD-2-1-396.info', error_code=2

How to repeat:
Create a data file /tmp/data.load:

'2003-02-21' 637128 'a' 121.708796296296 2
'2003-02-22' 2161 'a' 449.481388888889 16

Then try to do:

CREATE TEMPORARY TABLE t1 (
  day date,
  id int(9),
  name enum('a','b','c'),
  rate1 int(10),
  rate2 int(10)
);

LOAD DATA INFILE "/tmp/data.load" INTO TABLE t1 FIELDS TERMINATED BY ' ';
[1 Apr 2003 5:39] Victor Vagin
This is the suggested fix:

===== sql/log_event.cc 1.100 vs edited =====
--- 1.100/sql/log_event.cc	Tue Mar 25 19:58:37 2003
+++ edited/sql/log_event.cc	Wed Mar 26 15:17:48 2003
@@ -1881,7 +1881,7 @@
       ex.skip_lines = skip_lines;
       List<Item> field_list;
       set_fields(field_list);
-      thd->slave_proxy_id = thd->thread_id;
+      thd->slave_proxy_id = thread_id;
       if (net)
       {
 	// mysql_load will use thd->net to read the file
[3 Apr 2003 1:38] Victor Vagin
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html