summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-09-07 21:30:28 +0200
committerunknown <serg@serg.mylan>2004-09-07 21:30:28 +0200
commit2f96e073d287fdf58f03eca3bf20f7467f757f81 (patch)
treee1cbd7bc7ac5fa0739864e430b898343bdfa631e /sql/slave.cc
parent49d90b09f558b30adf1578dfcaf7d094e51609bd (diff)
parent419ca7152f30c6cbb8c8e8c4920a3d6e90e076a8 (diff)
downloadmariadb-git-2f96e073d287fdf58f03eca3bf20f7467f757f81.tar.gz
merged
mysql-test/r/rpl_set_charset.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/t/rpl_set_charset.test: Auto merged mysql-test/t/select.test: Auto merged sql/slave.cc: Auto merged
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 96b484a3965..a45c5c62322 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1290,6 +1290,7 @@ be equal for replication to work";
Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD
DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it
from the dump. Honours replication inclusion/exclusion rules.
+ db must be non-zero (guarded by assertion).
RETURN VALUES
0 success
@@ -1300,8 +1301,8 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
const char* table_name, bool overwrite)
{
ulong packet_len;
- char *query;
- char* save_db;
+ char *query, *save_db;
+ uint32 save_db_length;
Vio* save_vio;
HA_CHECK_OPT check_opt;
TABLE_LIST tables;
@@ -1357,9 +1358,13 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
thd->proc_info = "Creating table from master dump";
// save old db in case we are creating in a different database
save_db = thd->db;
+ save_db_length= thd->db_length;
thd->db = (char*)db;
+ DBUG_ASSERT(thd->db);
+ thd->db_length= strlen(thd->db);
mysql_parse(thd, thd->query, packet_len); // run create table
thd->db = save_db; // leave things the way the were before
+ thd->db_length= save_db_length;
thd->options = save_options;
if (thd->query_error)
@@ -3225,7 +3230,7 @@ err:
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
- thd->query_length = 0;
+ thd->query_length= thd->db_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
@@ -3391,7 +3396,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
err:
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
- thd->query_length = 0;
+ thd->query_length= thd->db_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->proc_info = "Waiting for slave mutex on exit";
pthread_mutex_lock(&rli->run_lock);