fixed processing of COM_BINLOG_DUMP to use in mysqlbinlog

parent 74077c79
...@@ -929,7 +929,8 @@ bool do_command(THD *thd) ...@@ -929,7 +929,8 @@ bool do_command(THD *thd)
pos = uint4korr(packet + 1); pos = uint4korr(packet + 1);
flags = uint2korr(packet + 5); flags = uint2korr(packet + 5);
pthread_mutex_lock(&LOCK_server_id); pthread_mutex_lock(&LOCK_server_id);
kill_zombie_dump_threads(slave_server_id = uint4korr(packet+7)); if ((slave_server_id = uint4korr(packet+7)))
kill_zombie_dump_threads(slave_server_id);
thd->server_id = slave_server_id; thd->server_id = slave_server_id;
pthread_mutex_unlock(&LOCK_server_id); pthread_mutex_unlock(&LOCK_server_id);
mysql_binlog_send(thd, thd->strdup(packet + 11), pos, flags); mysql_binlog_send(thd, thd->strdup(packet + 11), pos, flags);
......
...@@ -442,6 +442,11 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) ...@@ -442,6 +442,11 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
break; break;
case LOG_READ_EOF: case LOG_READ_EOF:
DBUG_PRINT("wait",("waiting for data on binary log")); DBUG_PRINT("wait",("waiting for data on binary log"));
if (thd->server_id==0)
{
pthread_mutex_unlock(log_lock);
goto end;
}
if (!thd->killed) if (!thd->killed)
pthread_cond_wait(&COND_binlog_update, log_lock); pthread_cond_wait(&COND_binlog_update, log_lock);
break; break;
...@@ -523,6 +528,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) ...@@ -523,6 +528,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
} }
} }
end:
end_io_cache(&log); end_io_cache(&log);
(void)my_close(file, MYF(MY_WME)); (void)my_close(file, MYF(MY_WME));
...@@ -532,7 +538,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags) ...@@ -532,7 +538,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
thd->current_linfo = 0; thd->current_linfo = 0;
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
err: err:
thd->proc_info = "waiting to finalize termination"; thd->proc_info = "waiting to finalize termination";
end_io_cache(&log); end_io_cache(&log);
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment