Loading sql/mini_client.cc +4 −1 Original line number Diff line number Diff line Loading @@ -386,7 +386,10 @@ my_bool STDCALL mc_mysql_reconnect(MYSQL *mysql) if (!mc_mysql_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, mysql->db, mysql->port, mysql->unix_socket, mysql->client_flag)) { mc_mysql_close(&tmp_mysql); DBUG_RETURN(1); } tmp_mysql.free_me=mysql->free_me; mysql->free_me=0; bzero((char*) &mysql->options,sizeof(&mysql->options)); Loading sql/mysqld.cc +1 −0 Original line number Diff line number Diff line Loading @@ -614,6 +614,7 @@ void clean_up(void) #ifndef __WIN__ (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif end_slave(); my_thread_end(); /* Tell main we are ready */ Loading sql/slave.cc +44 −1 Original line number Diff line number Diff line Loading @@ -167,6 +167,30 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) return 0; } static void free_string_array(DYNAMIC_ARRAY *a) { uint i; for(i = 0; i < a->elements; i++) { char* p; get_dynamic(a, (gptr)&p, i); my_free(p, MYF(MY_WME)); } delete_dynamic(a); } void end_slave() { end_master_info(&glob_mi); if(do_table_inited) hash_free(&replicate_do_table); if(ignore_table_inited) hash_free(&replicate_ignore_table); if(wild_do_table_inited) free_string_array(&replicate_wild_do_table); if(wild_ignore_table_inited) free_string_array(&replicate_wild_ignore_table); } static inline bool slave_killed(THD* thd) { Loading Loading @@ -398,8 +422,21 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi) return error; } void end_master_info(MASTER_INFO* mi) { if(mi->fd >= 0) { end_io_cache(&mi->file); (void)my_close(mi->fd, MYF(MY_WME)); mi->fd = -1; } mi->inited = 0; } int init_master_info(MASTER_INFO* mi) { if(mi->inited) return 0; int fd; MY_STAT stat_area; char fname[FN_REFLEN+128]; Loading Loading @@ -440,7 +477,7 @@ int init_master_info(MASTER_INFO* mi) mi->connect_retry = master_connect_retry; } else else // file exists { if(fd >= 0) reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0); Loading Loading @@ -897,8 +934,11 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) sql_print_error("Slave: error '%s' running load data infile ", ER(sql_error)); delete ev; free_root(&thd->mem_root,0); return 1; } free_root(&thd->mem_root,0); delete ev; if(thd->fatal_error) Loading Loading @@ -932,6 +972,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) mi->log_file_name[ident_len] = 0; mi->pos = 4; // skip magic number flush_master_info(mi); delete ev; break; } Loading @@ -950,6 +991,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) } mi->inc_pending(event_len); delete ev; break; } } Loading Loading @@ -1157,6 +1199,7 @@ position %ld", thd->temporary_tables = 0; // remove tempation from destructor to close them pthread_cond_broadcast(&COND_slave_stopped); // tell the world we are done pthread_mutex_unlock(&LOCK_slave); net_end(&thd->net); // destructor will not free it, because we are weird delete thd; my_thread_end(); pthread_exit(0); Loading sql/slave.h +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ typedef struct st_master_info { pthread_mutex_destroy(&lock); } inline void inc_pending(ulonglong val) { pending += val; Loading Loading @@ -81,7 +80,9 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); void end_slave(); // clean up int init_master_info(MASTER_INFO* mi); void end_master_info(MASTER_INFO* mi); extern bool opt_log_slave_updates ; pthread_handler_decl(handle_slave,arg); extern bool volatile abort_loop, abort_slave; Loading sql/sql_repl.cc +15 −12 Original line number Diff line number Diff line Loading @@ -503,7 +503,10 @@ int start_slave(THD* thd , bool net_report) return 1; pthread_mutex_lock(&LOCK_slave); if(!slave_running) if(glob_mi.inited && glob_mi.host && server_id_supplied) { if(init_master_info(&glob_mi)) err = "Could not initialize master info"; else if(server_id_supplied && *glob_mi.host) { pthread_t hThread; if(pthread_create(&hThread, &connection_attrib, handle_slave, 0)) Loading @@ -512,8 +515,8 @@ int start_slave(THD* thd , bool net_report) } } else err = "Master host not set, master info not initialized, or server id \ not configured"; err = "Master host not set, or server id not configured"; } else err = "Slave already running"; Loading Loading @@ -578,7 +581,7 @@ void reset_slave() if(my_stat(fname, &stat_area, MYF(0))) if(my_delete(fname, MYF(MY_WME))) return; end_master_info(&glob_mi); if(slave_was_running) start_slave(0,0); } Loading sql/sql_class.cc +1 −1 File changed.Contains only whitespace changes. Show changes Loading
sql/mini_client.cc +4 −1 Original line number Diff line number Diff line Loading @@ -386,7 +386,10 @@ my_bool STDCALL mc_mysql_reconnect(MYSQL *mysql) if (!mc_mysql_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, mysql->db, mysql->port, mysql->unix_socket, mysql->client_flag)) { mc_mysql_close(&tmp_mysql); DBUG_RETURN(1); } tmp_mysql.free_me=mysql->free_me; mysql->free_me=0; bzero((char*) &mysql->options,sizeof(&mysql->options)); Loading
sql/mysqld.cc +1 −0 Original line number Diff line number Diff line Loading @@ -614,6 +614,7 @@ void clean_up(void) #ifndef __WIN__ (void) my_delete(pidfile_name,MYF(0)); // This may not always exist #endif end_slave(); my_thread_end(); /* Tell main we are ready */ Loading
sql/slave.cc +44 −1 Original line number Diff line number Diff line Loading @@ -167,6 +167,30 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec) return 0; } static void free_string_array(DYNAMIC_ARRAY *a) { uint i; for(i = 0; i < a->elements; i++) { char* p; get_dynamic(a, (gptr)&p, i); my_free(p, MYF(MY_WME)); } delete_dynamic(a); } void end_slave() { end_master_info(&glob_mi); if(do_table_inited) hash_free(&replicate_do_table); if(ignore_table_inited) hash_free(&replicate_ignore_table); if(wild_do_table_inited) free_string_array(&replicate_wild_do_table); if(wild_ignore_table_inited) free_string_array(&replicate_wild_ignore_table); } static inline bool slave_killed(THD* thd) { Loading Loading @@ -398,8 +422,21 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi) return error; } void end_master_info(MASTER_INFO* mi) { if(mi->fd >= 0) { end_io_cache(&mi->file); (void)my_close(mi->fd, MYF(MY_WME)); mi->fd = -1; } mi->inited = 0; } int init_master_info(MASTER_INFO* mi) { if(mi->inited) return 0; int fd; MY_STAT stat_area; char fname[FN_REFLEN+128]; Loading Loading @@ -440,7 +477,7 @@ int init_master_info(MASTER_INFO* mi) mi->connect_retry = master_connect_retry; } else else // file exists { if(fd >= 0) reinit_io_cache(&mi->file, READ_CACHE, 0L,0,0); Loading Loading @@ -897,8 +934,11 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) sql_print_error("Slave: error '%s' running load data infile ", ER(sql_error)); delete ev; free_root(&thd->mem_root,0); return 1; } free_root(&thd->mem_root,0); delete ev; if(thd->fatal_error) Loading Loading @@ -932,6 +972,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) mi->log_file_name[ident_len] = 0; mi->pos = 4; // skip magic number flush_master_info(mi); delete ev; break; } Loading @@ -950,6 +991,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) } mi->inc_pending(event_len); delete ev; break; } } Loading Loading @@ -1157,6 +1199,7 @@ position %ld", thd->temporary_tables = 0; // remove tempation from destructor to close them pthread_cond_broadcast(&COND_slave_stopped); // tell the world we are done pthread_mutex_unlock(&LOCK_slave); net_end(&thd->net); // destructor will not free it, because we are weird delete thd; my_thread_end(); pthread_exit(0); Loading
sql/slave.h +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ typedef struct st_master_info { pthread_mutex_destroy(&lock); } inline void inc_pending(ulonglong val) { pending += val; Loading Loading @@ -81,7 +80,9 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec); void init_table_rule_hash(HASH* h, bool* h_inited); void init_table_rule_array(DYNAMIC_ARRAY* a, bool* a_inited); void end_slave(); // clean up int init_master_info(MASTER_INFO* mi); void end_master_info(MASTER_INFO* mi); extern bool opt_log_slave_updates ; pthread_handler_decl(handle_slave,arg); extern bool volatile abort_loop, abort_slave; Loading
sql/sql_repl.cc +15 −12 Original line number Diff line number Diff line Loading @@ -503,7 +503,10 @@ int start_slave(THD* thd , bool net_report) return 1; pthread_mutex_lock(&LOCK_slave); if(!slave_running) if(glob_mi.inited && glob_mi.host && server_id_supplied) { if(init_master_info(&glob_mi)) err = "Could not initialize master info"; else if(server_id_supplied && *glob_mi.host) { pthread_t hThread; if(pthread_create(&hThread, &connection_attrib, handle_slave, 0)) Loading @@ -512,8 +515,8 @@ int start_slave(THD* thd , bool net_report) } } else err = "Master host not set, master info not initialized, or server id \ not configured"; err = "Master host not set, or server id not configured"; } else err = "Slave already running"; Loading Loading @@ -578,7 +581,7 @@ void reset_slave() if(my_stat(fname, &stat_area, MYF(0))) if(my_delete(fname, MYF(MY_WME))) return; end_master_info(&glob_mi); if(slave_was_running) start_slave(0,0); } Loading