summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@work.mysql.com>2001-10-02 21:33:47 +0200
committerunknown <monty@work.mysql.com>2001-10-02 21:33:47 +0200
commit2e0dc69895280f3b407e56dace32ad9cf25ce356 (patch)
treed9089456ab1e47d6aaaaf6706de408fea79fe87e /sql
parent9b3d608ea7de5da60bd88765b4a52d316dffa708 (diff)
parentabf1b80cf457702fd883c3a17b1d9eaed1c7c6b6 (diff)
downloadmariadb-git-2e0dc69895280f3b407e56dace32ad9cf25ce356.tar.gz
merge
BitKeeper/etc/logging_ok: auto-union client/Makefile.am: Auto merged client/mysql.cc: Auto merged myisam/mi_check.c: Auto merged sql/slave.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_show.cc: Auto merged strings/strmake.c: Auto merged mysql-test/t/rpl000017-slave.sh: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sql_insert.cc11
2 files changed, 13 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index a1b5045efd4..01938a52153 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -307,7 +307,7 @@ static int init_strvar_from_file(char* var, int max_size, IO_CACHE* f,
}
else if (default_val)
{
- strmake(var, default_val, max_size);
+ strmake(var, default_val, max_size-1);
return 0;
}
return 1;
@@ -548,14 +548,14 @@ int init_master_info(MASTER_INFO* mi)
}
mi->log_file_name[length-1]= 0; // kill \n
- char buf[FN_REFLEN];
- if(!my_b_gets(&mi->file, buf, sizeof(buf)))
+ /* Reuse fname buffer */
+ if(!my_b_gets(&mi->file, fname, sizeof(fname)))
{
msg="Error reading log file position from master info file";
goto error;
}
+ mi->pos = strtoull(fname,(char**) 0, 10);
- mi->pos = strtoull(buf,(char**) 0, 10);
mi->fd = fd;
if(init_strvar_from_file(mi->host, sizeof(mi->host), &mi->file,
master_host) ||
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 54c3e91bcc3..7a89a3d38dd 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -868,6 +868,7 @@ void kill_delayed_threads(void)
delayed_insert *tmp;
while ((tmp=it++))
{
+ /* Ensure that the thread doesn't kill itself while we are looking at it */
pthread_mutex_lock(&tmp->mutex);
tmp->thd.killed=1;
if (tmp->thd.mysys_var)
@@ -875,9 +876,15 @@ void kill_delayed_threads(void)
pthread_mutex_lock(&tmp->thd.mysys_var->mutex);
if (tmp->thd.mysys_var->current_cond)
{
- pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
+ /*
+ We need the following test because the main mutex may be locked
+ in handle_delayed_insert()
+ */
+ if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
+ pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
pthread_cond_broadcast(tmp->thd.mysys_var->current_cond);
- pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex);
+ if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
+ pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex);
}
pthread_mutex_unlock(&tmp->thd.mysys_var->mutex);
}