summaryrefslogtreecommitdiff
path: root/sql/log_event.cc
diff options
context:
space:
mode:
authorunknown <lars@mysql.com>2004-11-15 17:03:54 +0100
committerunknown <lars@mysql.com>2004-11-15 17:03:54 +0100
commit58f984add28bba67add38efb0c19d67a154b47ea (patch)
tree9cabe4ed38a9aa909b2016e45e2488b4066b8558 /sql/log_event.cc
parentfe37a1472c22b0a48244b932664925cad68f3e96 (diff)
downloadmariadb-git-58f984add28bba67add38efb0c19d67a154b47ea.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. mysql-test/r/rpl_rewrite_db.result: New tests mysql-test/t/rpl_rewrite_db-slave.opt: New tests mysql-test/t/rpl_rewrite_db.test: New tests sql/log_event.cc: Added db to set_fields function so that current db is used. sql/log_event.h: Added db to set_fields function so that current db is used.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r--sql/log_event.cc26
1 files changed, 16 insertions, 10 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;