summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorlars@mysql.com <>2004-11-15 17:03:54 +0100
committerlars@mysql.com <>2004-11-15 17:03:54 +0100
commitb7cfe5ecad5d224fe9fcc36a1241ea9864533ce6 (patch)
tree9cabe4ed38a9aa909b2016e45e2488b4066b8558 /sql
parenta2177a2f351c8d2892f8e4202c2ef45118bdfe86 (diff)
downloadmariadb-git-b7cfe5ecad5d224fe9fcc36a1241ea9864533ce6.tar.gz
BUG#6353 V2:
Replication using replicate-rewrite-db did not work for LOAD DATA INFILE. Now is does. There was one place in the code that used current database instead of the rewrite database.
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc26
-rw-r--r--sql/log_event.h2
2 files changed, 17 insertions, 11 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 091566c5d90..301c8ec222c 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1655,16 +1655,22 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
/*
Load_log_event::set_fields()
+
+ Note that this function can not use the member variable
+ for the database, since LOAD DATA INFILE on the slave
+ can be for a different database than the current one.
+ This is the reason for the affected_db argument to this method.
*/
#ifndef MYSQL_CLIENT
-void Load_log_event::set_fields(List<Item> &field_list)
+void Load_log_event::set_fields(const char* affected_db,
+ List<Item> &field_list)
{
uint i;
const char* field = fields;
for (i= 0; i < num_fields; i++)
{
- field_list.push_back(new Item_field(db, table_name, field));
+ field_list.push_back(new Item_field(affected_db, table_name, field));
field+= field_lens[i] + 1;
}
}
@@ -1820,7 +1826,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
ex.skip_lines = skip_lines;
List<Item> field_list;
- set_fields(field_list);
+ set_fields(thd->db,field_list);
thd->variables.pseudo_thread_id= thread_id;
if (net)
{
@@ -1837,13 +1843,13 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if (thd->cuted_fields)
{
/* log_pos is the position of the LOAD event in the master log */
- sql_print_error("\
-Slave: load data infile on table '%s' at log position %s in log \
-'%s' produced %ld warning(s). Default database: '%s'",
- (char*) table_name,
- llstr(log_pos,llbuff), RPL_LOG_NAME,
- (ulong) thd->cuted_fields,
- print_slave_db_safe(thd->db));
+ sql_print_warning("Slave: load data infile on table '%s' at "
+ "log position %s in log '%s' produced %ld "
+ "warning(s). Default database: '%s'",
+ (char*) table_name,
+ llstr(log_pos,llbuff), RPL_LOG_NAME,
+ (ulong) thd->cuted_fields,
+ print_slave_db_safe(thd->db));
}
if (net)
net->pkt_nr= thd->net.pkt_nr;
diff --git a/sql/log_event.h b/sql/log_event.h
index 8070c334d8b..1606659e21e 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -587,7 +587,7 @@ public:
const char* table_name_arg,
List<Item>& fields_arg, enum enum_duplicates handle_dup,
bool using_trans);
- void set_fields(List<Item> &fields_arg);
+ void set_fields(const char* db, List<Item> &fields_arg);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);