diff options
author | sasha@mysql.sashanet.com <> | 2000-12-11 12:06:34 -0700 |
---|---|---|
committer | sasha@mysql.sashanet.com <> | 2000-12-11 12:06:34 -0700 |
commit | c8a915880bfbd9443cda18bd39e801795edb5cc8 (patch) | |
tree | 06aa933eac99f585851460d08dbc8105cd1e456b | |
parent | a4f853e22b59ae50ae221264428ef8ca45af0248 (diff) | |
download | mariadb-git-c8a915880bfbd9443cda18bd39e801795edb5cc8.tar.gz |
I hope I've fixed all the bugs by now, let's test it
-rw-r--r-- | sql/log_event.h | 10 | ||||
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/slave.cc | 12 | ||||
-rw-r--r-- | sql/sql_repl.cc | 7 |
5 files changed, 27 insertions, 7 deletions
diff --git a/sql/log_event.h b/sql/log_event.h index 3d307000b13..babf76aa428 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -65,6 +65,16 @@ public: int valid_exec_time; // if false, the exec time setting is bogus uint32 server_id; + static void *operator new(size_t size) + { + return (void*) my_malloc((uint)size, MYF(MY_WME|MY_FAE)); + } + + static void operator delete(void *ptr, size_t size) + { + my_free((byte*)ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + } + int write(IO_CACHE* file); int write_header(IO_CACHE* file); virtual int write_data(IO_CACHE* file __attribute__((unused))) { return 0; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 7c3b1cfadef..e4641d1a0b7 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -486,7 +486,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, LOCK_binlog_update, LOCK_slave, LOCK_server_id; extern pthread_cond_t COND_refresh,COND_thread_count, COND_binlog_update, - COND_slave_stopped; + COND_slave_stopped, COND_slave_start; extern pthread_attr_t connection_attrib; extern bool opt_endinfo,using_udf_functions, locked_in_memory; extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f10b367e36a..8ebda66ffdb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -263,7 +263,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count, LOCK_binlog_update, LOCK_slave, LOCK_server_id; pthread_cond_t COND_refresh,COND_thread_count,COND_binlog_update, - COND_slave_stopped; + COND_slave_stopped, COND_slave_start; pthread_cond_t COND_thread_cache,COND_flush_thread_cache; pthread_t signal_thread; pthread_attr_t connection_attrib; @@ -1414,6 +1414,7 @@ int main(int argc, char **argv) (void) pthread_mutex_init(&LOCK_server_id, NULL); (void) pthread_cond_init(&COND_binlog_update, NULL); (void) pthread_cond_init(&COND_slave_stopped, NULL); + (void) pthread_cond_init(&COND_slave_start, NULL); if (set_default_charset_by_name(default_charset, MYF(MY_WME))) unireg_abort(1); diff --git a/sql/slave.cc b/sql/slave.cc index e6262ba15c3..2545745e7ea 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -938,8 +938,8 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) return 1; } - free_root(&thd->mem_root,0); delete ev; + free_root(&thd->mem_root,0); if(thd->fatal_error) { @@ -957,12 +957,14 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) close_temporary_tables(thd); mi->inc_pos(event_len); flush_master_info(mi); + delete ev; break; case STOP_EVENT: close_temporary_tables(thd); mi->inc_pos(event_len); flush_master_info(mi); + delete ev; break; case ROTATE_EVENT: { @@ -1013,15 +1015,18 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused))) THD *thd; // needs to be first for thread_stack MYSQL *mysql = NULL ; + pthread_mutex_lock(&LOCK_slave); if(!server_id) { + pthread_cond_broadcast(&COND_slave_start); + pthread_mutex_unlock(&LOCK_slave); sql_print_error("Server id not set, will not start slave"); pthread_exit((void*)1); } - pthread_mutex_lock(&LOCK_slave); if(slave_running) { + pthread_cond_broadcast(&COND_slave_start); pthread_mutex_unlock(&LOCK_slave); pthread_exit((void*)1); // safety just in case } @@ -1030,7 +1035,8 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused))) #ifndef DBUG_OFF events_till_abort = abort_slave_event_count; #endif - pthread_mutex_unlock(&LOCK_slave); + pthread_cond_broadcast(&COND_slave_start); + pthread_mutex_unlock(&LOCK_slave); int error = 1; bool retried_once = 0; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 6dd9d805183..27523a18481 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -34,7 +34,7 @@ static int send_file(THD *thd) char fname[FN_REFLEN+1]; char *buf; const char *errmsg = 0; - int old_timeout; + int old_timeout,fname_len; DBUG_ENTER("send_file"); // the client might be slow loading the data, give him wait_timeout to do @@ -51,12 +51,14 @@ static int send_file(THD *thd) // we need net_flush here because the client will not know it needs to send // us the file name until it has processed the load event entry - if (net_flush(net) || my_net_read(net) == packet_error) + if (net_flush(net) || (fname_len = my_net_read(net)) == packet_error) { errmsg = "Failed reading file name"; goto err; } + *((char*)net->read_pos + 1 + fname_len) = 0; // terminate with \0 + //for fn_format fn_format(fname, (char*)net->read_pos + 1, "", "", 4); // this is needed to make replicate-ignore-db if (!strcmp(fname,"/dev/null")) @@ -513,6 +515,7 @@ int start_slave(THD* thd , bool net_report) { err = "cannot create slave thread"; } + pthread_cond_wait(&COND_slave_start, &LOCK_slave); } else err = "Master host not set, or server id not configured"; |