Commit 71196720 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/my/mysql-4.1


sql/handler.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
parents 8eae81ba 5205078e
...@@ -923,3 +923,4 @@ Docs/Images/mydsn-trace.txt ...@@ -923,3 +923,4 @@ Docs/Images/mydsn-trace.txt
Docs/Images/mydsn.txt Docs/Images/mydsn.txt
Docs/Images/myflowchart.txt Docs/Images/myflowchart.txt
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
ndb/tools/ndb_test_platform
...@@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */ ...@@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */
static struct state *stack=0; static struct state *stack=0;
typedef struct st_code_state { typedef struct st_code_state {
int lineno; /* Current debugger output line number */
int level; /* Current function nesting level */
const char *func; /* Name of current user function */ const char *func; /* Name of current user function */
const char *file; /* Name of current user file */ const char *file; /* Name of current user file */
char **framep; /* Pointer to current frame */ char **framep; /* Pointer to current frame */
int jmplevel; /* Remember nesting level at setjmp () */
const char *jmpfunc; /* Remember current function for setjmp */ const char *jmpfunc; /* Remember current function for setjmp */
const char *jmpfile; /* Remember current file for setjmp */ const char *jmpfile; /* Remember current file for setjmp */
int lineno; /* Current debugger output line number */
int level; /* Current function nesting level */
int disable_output; /* Set to it if output is disabled */
int jmplevel; /* Remember nesting level at setjmp () */
/* /*
* The following variables are used to hold the state information * The following variables are used to hold the state information
...@@ -247,8 +248,8 @@ typedef struct st_code_state { ...@@ -247,8 +248,8 @@ typedef struct st_code_state {
*/ */
uint u_line; /* User source code line number */ uint u_line; /* User source code line number */
const char *u_keyword; /* Keyword for current macro */
int locked; /* If locked with _db_lock_file */ int locked; /* If locked with _db_lock_file */
const char *u_keyword; /* Keyword for current macro */
} CODE_STATE; } CODE_STATE;
/* Parse a debug command string */ /* Parse a debug command string */
...@@ -370,8 +371,10 @@ static CODE_STATE *code_state(void) ...@@ -370,8 +371,10 @@ static CODE_STATE *code_state(void)
#define code_state() (&static_code_state) #define code_state() (&static_code_state)
#define pthread_mutex_lock(A) {} #define pthread_mutex_lock(A) {}
#define pthread_mutex_unlock(A) {} #define pthread_mutex_unlock(A) {}
static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL, static CODE_STATE static_code_state=
NULL,0,"?",0}; {
"?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS
};
#endif #endif
...@@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused))) ...@@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused)))
if (DoProfile ()) if (DoProfile ())
{ {
long stackused; long stackused;
if (*state->framep == NULL) { if (*state->framep == NULL)
{
stackused = 0; stackused = 0;
} else { }
else
{
stackused = ((long)(*state->framep)) - ((long)(state->framep)); stackused = ((long)(*state->framep)) - ((long)(state->framep));
stackused = stackused > 0 ? stackused : -stackused; stackused = stackused > 0 ? stackused : -stackused;
} }
...@@ -744,7 +750,7 @@ char ***_sframep_ __attribute__((unused))) ...@@ -744,7 +750,7 @@ char ***_sframep_ __attribute__((unused)))
(void) fflush (_db_pfp_); (void) fflush (_db_pfp_);
} }
#endif #endif
if (DoTrace (state)) if (DoTrace(state))
{ {
if (!state->locked) if (!state->locked)
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
...@@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused))) ...@@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused)))
dbug_flush (state); /* This does a unlock */ dbug_flush (state); /* This does a unlock */
} }
#ifdef SAFEMALLOC #ifdef SAFEMALLOC
if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output)
if (_sanity(_file_,_line_)) /* Check of safemalloc */ if (_sanity(_file_,_line_)) /* Check of safemalloc */
stack -> flags &= ~SANITY_CHECK_ON; stack -> flags &= ~SANITY_CHECK_ON;
#endif #endif
...@@ -809,9 +815,11 @@ uint *_slevel_) ...@@ -809,9 +815,11 @@ uint *_slevel_)
else else
{ {
#ifdef SAFEMALLOC #ifdef SAFEMALLOC
if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output)
{
if (_sanity(*_sfile_,_line_)) if (_sanity(*_sfile_,_line_))
stack->flags &= ~SANITY_CHECK_ON; stack->flags &= ~SANITY_CHECK_ON;
}
#endif #endif
#ifndef THREAD #ifndef THREAD
if (DoProfile ()) if (DoProfile ())
...@@ -954,7 +962,6 @@ uint length) ...@@ -954,7 +962,6 @@ uint length)
int pos; int pos;
char dbuff[90]; char dbuff[90];
CODE_STATE *state; CODE_STATE *state;
/* Sasha: pre-my_thread_init() safety */
if (!(state=code_state())) if (!(state=code_state()))
return; return;
...@@ -994,6 +1001,25 @@ uint length) ...@@ -994,6 +1001,25 @@ uint length)
} }
} }
/*
Enable/Disable output for this thread
SYNOPSIS
_db_output_()
flag 1 = enable output, 0 = disable_output
*/
void _db_output_(uint flag)
{
CODE_STATE *state;
if (!(state=code_state()))
return;
state->disable_output= !flag;
}
/* /*
* FUNCTION * FUNCTION
* *
...@@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state) ...@@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state)
{ {
reg2 BOOLEAN trace=FALSE; reg2 BOOLEAN trace=FALSE;
if (TRACING && if (TRACING && !state->disable_output &&
state->level <= stack -> maxdepth && state->level <= stack -> maxdepth &&
InList (stack -> functions, state->func) && InList (stack -> functions, state->func) &&
InList (stack -> processes, _db_process_)) InList (stack -> processes, _db_process_))
...@@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile () ...@@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile ()
state=code_state(); state=code_state();
profile = FALSE; profile = FALSE;
if (PROFILING && if (PROFILING && !state->disable_output &&
state->level <= stack -> maxdepth && state->level <= stack -> maxdepth &&
InList (stack -> p_functions, state->func) && InList (stack -> p_functions, state->func) &&
InList (stack -> processes, _db_process_)) InList (stack -> processes, _db_process_))
...@@ -1242,7 +1268,7 @@ const char *keyword) ...@@ -1242,7 +1268,7 @@ const char *keyword)
if (!(state=code_state())) if (!(state=code_state()))
return FALSE; return FALSE;
result = FALSE; result = FALSE;
if (DEBUGGING && if (DEBUGGING && !state->disable_output &&
state->level <= stack -> maxdepth && state->level <= stack -> maxdepth &&
InList (stack -> functions, state->func) && InList (stack -> functions, state->func) &&
InList (stack -> keywords, keyword) && InList (stack -> keywords, keyword) &&
......
...@@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); ...@@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory, extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length); uint length);
extern void _db_output_();
extern void _db_lock_file(); extern void _db_lock_file();
extern void _db_unlock_file(); extern void _db_unlock_file();
...@@ -66,6 +67,7 @@ extern void _db_unlock_file(); ...@@ -66,6 +67,7 @@ extern void _db_unlock_file();
#define DEBUGGER_ON _no_db_=0 #define DEBUGGER_ON _no_db_=0
#define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_OUTPUT(A) { _db_output_(A); }
#define DBUG_ASSERT(A) assert(A) #define DBUG_ASSERT(A) assert(A)
#else /* No debugger */ #else /* No debugger */
...@@ -86,6 +88,7 @@ extern void _db_unlock_file(); ...@@ -86,6 +88,7 @@ extern void _db_unlock_file();
#define DEBUGGER_ON #define DEBUGGER_ON
#define DBUG_LOCK_FILE #define DBUG_LOCK_FILE
#define DBUG_UNLOCK_FILE #define DBUG_UNLOCK_FILE
#define DBUG_OUTPUT(A)
#define DBUG_ASSERT(A) {} #define DBUG_ASSERT(A) {}
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -370,6 +370,12 @@ int __void__; ...@@ -370,6 +370,12 @@ int __void__;
#define LINT_INIT(var) #define LINT_INIT(var)
#endif #endif
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify)
#define PURIFY_OR_LINT_INIT(var) var=0
#else
#define PURIFY_OR_LINT_INIT(var)
#endif
/* Define some useful general macros */ /* Define some useful general macros */
#if defined(__cplusplus) && defined(__GNUC__) #if defined(__cplusplus) && defined(__GNUC__)
#define max(a, b) ((a) >? (b)) #define max(a, b) ((a) >? (b))
......
...@@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests, ...@@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests,
my_cache_read; my_cache_read;
extern ulong my_blocks_used, my_blocks_changed; extern ulong my_blocks_used, my_blocks_changed;
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
extern uint mysys_usage_id;
extern my_bool my_init_done; extern my_bool my_init_done;
/* Point to current my_message() */ /* Point to current my_message() */
......
...@@ -42,8 +42,8 @@ static void netware_init(); ...@@ -42,8 +42,8 @@ static void netware_init();
#define netware_init() #define netware_init()
#endif #endif
my_bool my_init_done= 0;
my_bool my_init_done=0; uint mysys_usage_id= 0; /* Incremented for each my_init() */
static ulong atoi_octal(const char *str) static ulong atoi_octal(const char *str)
{ {
...@@ -51,7 +51,7 @@ static ulong atoi_octal(const char *str) ...@@ -51,7 +51,7 @@ static ulong atoi_octal(const char *str)
while (*str && my_isspace(&my_charset_latin1, *str)) while (*str && my_isspace(&my_charset_latin1, *str))
str++; str++;
str2int(str, str2int(str,
(*str == '0' ? 8 : 10), /* Octalt or decimalt */ (*str == '0' ? 8 : 10), /* Octalt or decimalt */
0, INT_MAX, &tmp); 0, INT_MAX, &tmp);
return (ulong) tmp; return (ulong) tmp;
} }
...@@ -74,6 +74,7 @@ my_bool my_init(void) ...@@ -74,6 +74,7 @@ my_bool my_init(void)
if (my_init_done) if (my_init_done)
return 0; return 0;
my_init_done=1; my_init_done=1;
mysys_usage_id++;
#if defined(THREAD) && defined(SAFE_MUTEX) #if defined(THREAD) && defined(SAFE_MUTEX)
safe_mutex_global_init(); /* Must be called early */ safe_mutex_global_init(); /* Must be called early */
#endif #endif
......
...@@ -5941,8 +5941,14 @@ Field *make_field(char *ptr, uint32 field_length, ...@@ -5941,8 +5941,14 @@ Field *make_field(char *ptr, uint32 field_length,
if (f_is_alpha(pack_flag)) if (f_is_alpha(pack_flag))
{ {
if (!f_is_packed(pack_flag)) if (!f_is_packed(pack_flag))
return new Field_string(ptr,field_length,null_pos,null_bit, {
unireg_check, field_name, table, field_charset); if (field_type == FIELD_TYPE_STRING ||
field_type == FIELD_TYPE_VAR_STRING)
return new Field_string(ptr,field_length,null_pos,null_bit,
unireg_check, field_name, table,
field_charset);
return 0; // Error
}
uint pack_length=calc_pack_length((enum_field_types) uint pack_length=calc_pack_length((enum_field_types)
f_packtype(pack_flag), f_packtype(pack_flag),
......
...@@ -110,6 +110,7 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", ...@@ -110,6 +110,7 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
tx_isolation_names, NULL}; tx_isolation_names, NULL};
static TYPELIB known_extensions= {0,"known_exts", NULL, NULL}; static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
uint known_extensions_id= 0;
enum db_type ha_resolve_by_name(const char *name, uint namelen) enum db_type ha_resolve_by_name(const char *name, uint namelen)
{ {
...@@ -1660,6 +1661,7 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, ...@@ -1660,6 +1661,7 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
return error; return error;
} }
/* /*
Returns a list of all known extensions. Returns a list of all known extensions.
...@@ -1668,20 +1670,24 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, ...@@ -1668,20 +1670,24 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
NOTES NOTES
No mutexes, worst case race is a minor surplus memory allocation No mutexes, worst case race is a minor surplus memory allocation
We have to recreate the extension map if mysqld is restarted (for example
within libmysqld)
RETURN VALUE RETURN VALUE
pointer pointer to TYPELIB structure pointer pointer to TYPELIB structure
*/ */
TYPELIB *ha_known_exts(void) TYPELIB *ha_known_exts(void)
{ {
if (!known_extensions.type_names) if (!known_extensions.type_names || mysys_usage_id != known_extensions_id)
{ {
show_table_type_st *types; show_table_type_st *types;
List<char> found_exts; List<char> found_exts;
List_iterator_fast<char> it(found_exts); List_iterator_fast<char> it(found_exts);
const char *e, **ext; const char **ext, *old_ext;
found_exts.push_back(".db"); known_extensions_id= mysys_usage_id;
found_exts.push_back((char*) ".db");
for (types= sys_table_types; types->type; types++) for (types= sys_table_types; types->type; types++)
{ {
if (*types->value == SHOW_OPTION_YES) if (*types->value == SHOW_OPTION_YES)
...@@ -1689,28 +1695,30 @@ TYPELIB *ha_known_exts(void) ...@@ -1689,28 +1695,30 @@ TYPELIB *ha_known_exts(void)
handler *file= get_new_handler(0,(enum db_type) types->db_type); handler *file= get_new_handler(0,(enum db_type) types->db_type);
for (ext= file->bas_ext(); *ext; ext++) for (ext= file->bas_ext(); *ext; ext++)
{ {
while (e=it++) while ((old_ext= it++))
if (e == *ext) {
if (!strcmp(old_ext, *ext))
break; break;
}
if (!e) if (!old_ext)
found_exts.push_back((char *)*ext); found_exts.push_back((char *) *ext);
it.rewind(); it.rewind();
} }
delete file; delete file;
} }
} }
ext= (const char **)my_once_alloc(sizeof(char *)* ext= (const char **) my_once_alloc(sizeof(char *)*
(found_exts.elements+1), MYF(MY_WME)); (found_exts.elements+1),
MYF(MY_WME | MY_FAE));
DBUG_ASSERT(ext); DBUG_ASSERT(ext);
for (uint i=0; e=it++; i++)
ext[i]= e;
ext[found_exts.elements]= 0;
known_extensions.count= found_exts.elements; known_extensions.count= found_exts.elements;
known_extensions.type_names= ext; known_extensions.type_names= ext;
while ((old_ext= it++))
*ext++= old_ext;
*ext= 0;
} }
return &known_extensions; return &known_extensions;
} }
...@@ -161,21 +161,24 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, ...@@ -161,21 +161,24 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
{ {
int weekday= 0, yearday= 0, daypart= 0; int weekday= 0, yearday= 0, daypart= 0;
int week_number= -1; int week_number= -1;
CHARSET_INFO *cs= &my_charset_bin;
int error= 0; int error= 0;
bool usa_time= 0;
bool sunday_first_n_first_week_non_iso= -2;
bool strict_week_number;
int strict_week_number_year= -1; int strict_week_number_year= -1;
bool strict_week_number_year_type= -1;
int frac_part; int frac_part;
bool usa_time= 0;
bool sunday_first_n_first_week_non_iso;
bool strict_week_number;
bool strict_week_number_year_type;
const char *val_begin= val; const char *val_begin= val;
const char *val_end= val + length; const char *val_end= val + length;
const char *ptr= format->format.str; const char *ptr= format->format.str;
const char *end= ptr + format->format.length; const char *end= ptr + format->format.length;
CHARSET_INFO *cs= &my_charset_bin;
DBUG_ENTER("extract_date_time"); DBUG_ENTER("extract_date_time");
LINT_INIT(strict_week_number); LINT_INIT(strict_week_number);
/* Remove valgrind varnings when using gcc 3.3 and -O1 */
PURIFY_OR_LINT_INIT(strict_week_number_year_type);
PURIFY_OR_LINT_INIT(sunday_first_n_first_week_non_iso);
if (!sub_pattern_end) if (!sub_pattern_end)
bzero((char*) l_time, sizeof(*l_time)); bzero((char*) l_time, sizeof(*l_time));
......
...@@ -1703,6 +1703,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, ...@@ -1703,6 +1703,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
time_t current_time; time_t current_time;
if (!is_open()) if (!is_open())
return 0; return 0;
DBUG_ENTER("MYSQL_LOG::write");
VOID(pthread_mutex_lock(&LOCK_log)); VOID(pthread_mutex_lock(&LOCK_log));
if (is_open()) if (is_open())
{ // Safety agains reopen { // Safety agains reopen
...@@ -1712,7 +1714,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, ...@@ -1712,7 +1714,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
if (!(thd->options & OPTION_UPDATE_LOG)) if (!(thd->options & OPTION_UPDATE_LOG))
{ {
VOID(pthread_mutex_unlock(&LOCK_log)); VOID(pthread_mutex_unlock(&LOCK_log));
return 0; DBUG_RETURN(0);
} }
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg) if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg)
{ {
...@@ -1812,7 +1814,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, ...@@ -1812,7 +1814,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
} }
} }
VOID(pthread_mutex_unlock(&LOCK_log)); VOID(pthread_mutex_unlock(&LOCK_log));
return error; DBUG_RETURN(error);
} }
...@@ -1832,16 +1834,19 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, ...@@ -1832,16 +1834,19 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
THD::enter_cond() (see NOTES in sql_class.h). THD::enter_cond() (see NOTES in sql_class.h).
*/ */
void MYSQL_LOG:: wait_for_update(THD* thd, bool master_or_slave) void MYSQL_LOG::wait_for_update(THD* thd, bool master_or_slave)
{ {
const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log, const char *old_msg;
master_or_slave ? DBUG_ENTER("wait_for_update");
"Has read all relay log; waiting for \ old_msg= thd->enter_cond(&update_cond, &LOCK_log,
the slave I/O thread to update it" : master_or_slave ?
"Has sent all binlog to slave; \ "Has read all relay log; waiting for the slave I/O "
waiting for binlog to be updated"); "thread to update it" :
"Has sent all binlog to slave; waiting for binlog "
"to be updated");
pthread_cond_wait(&update_cond, &LOCK_log); pthread_cond_wait(&update_cond, &LOCK_log);
thd->exit_cond(old_msg); thd->exit_cond(old_msg);
DBUG_VOID_RETURN;
} }
...@@ -2198,6 +2203,15 @@ void MYSQL_LOG::report_pos_in_innodb() ...@@ -2198,6 +2203,15 @@ void MYSQL_LOG::report_pos_in_innodb()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void MYSQL_LOG::signal_update()
{
DBUG_ENTER("MYSQL_LOG::signal_update");
pthread_cond_broadcast(&update_cond);
DBUG_VOID_RETURN;
}
#ifdef __NT__ #ifdef __NT__
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
uint length, int buffLen) uint length, int buffLen)
......
...@@ -540,7 +540,7 @@ static void close_connections(void) ...@@ -540,7 +540,7 @@ static void close_connections(void)
struct timespec abstime; struct timespec abstime;
int error; int error;
LINT_INIT(error); LINT_INIT(error);
DBUG_PRINT("info",("Waiting for select_thread")); DBUG_PRINT("info",("Waiting for select thread"));
#ifndef DONT_USE_THR_ALARM #ifndef DONT_USE_THR_ALARM
if (pthread_kill(select_thread,THR_CLIENT_ALARM)) if (pthread_kill(select_thread,THR_CLIENT_ALARM))
......
...@@ -2635,7 +2635,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi, ...@@ -2635,7 +2635,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
DBUG_ENTER("request_dump"); DBUG_ENTER("request_dump");
// TODO if big log files: Change next to int8store() // TODO if big log files: Change next to int8store()
int4store(buf, (longlong) mi->master_log_pos); int4store(buf, (ulong) mi->master_log_pos);
int2store(buf + 4, binlog_flags); int2store(buf + 4, binlog_flags);
int4store(buf + 6, server_id); int4store(buf + 6, server_id);
len = (uint) strlen(logname); len = (uint) strlen(logname);
......
...@@ -131,7 +131,7 @@ class MYSQL_LOG ...@@ -131,7 +131,7 @@ class MYSQL_LOG
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void set_max_size(ulong max_size_arg); void set_max_size(ulong max_size_arg);
void signal_update() { pthread_cond_broadcast(&update_cond);} void signal_update();
void wait_for_update(THD* thd, bool master_or_slave); void wait_for_update(THD* thd, bool master_or_slave);
void set_need_start_event() { need_start_event = 1; } void set_need_start_event() { need_start_event = 1; }
void init(enum_log_type log_type_arg, void init(enum_log_type log_type_arg,
......
...@@ -1610,15 +1610,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1610,15 +1610,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
case COM_BINLOG_DUMP: case COM_BINLOG_DUMP:
{ {
ulong pos;
ushort flags;
uint32 slave_server_id;
statistic_increment(com_other,&LOCK_status); statistic_increment(com_other,&LOCK_status);
thd->slow_command = TRUE; thd->slow_command = TRUE;
if (check_global_access(thd, REPL_SLAVE_ACL)) if (check_global_access(thd, REPL_SLAVE_ACL))
break; break;
mysql_log.write(thd,command, 0);
ulong pos;
ushort flags;
uint32 slave_server_id;
/* TODO: The following has to be changed to an 8 byte integer */ /* TODO: The following has to be changed to an 8 byte integer */
pos = uint4korr(packet); pos = uint4korr(packet);
flags = uint2korr(packet + 4); flags = uint2korr(packet + 4);
...@@ -1626,6 +1626,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1626,6 +1626,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0 if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0
kill_zombie_dump_threads(slave_server_id); kill_zombie_dump_threads(slave_server_id);
thd->server_id = slave_server_id; thd->server_id = slave_server_id;
mysql_log.write(thd, command, "Log: '%s' Pos: %ld", packet+10,
(long) pos);
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags); mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
unregister_slave(thd,1,1); unregister_slave(thd,1,1);
// fake COM_QUIT -- if we get here, the thread needs to terminate // fake COM_QUIT -- if we get here, the thread needs to terminate
......
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