diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-01-17 05:47:33 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-01-17 05:47:33 -0700 |
commit | 4ac091636b0f366282a8a1c2ad2ff448a5c4a6f8 (patch) | |
tree | 6d77ea3fb9cae4b29069ce7d9ad832a29cd4e0b3 /sql/slave.cc | |
parent | 22f568dc0d8e27442b1c0b2c5a0b6bf35c88401c (diff) | |
download | mariadb-git-4ac091636b0f366282a8a1c2ad2ff448a5c4a6f8.tar.gz |
rpl000016.test sync
rpl000001.result BitKeeper file /home/sasha/src/bk/mysql/mysql-test/r/rpl000001.result
ignore Added BitKeeper/tmp/bkr3sAHD to the ignore list
slave.h MASTER_POS_WAIT
lex.h MASTER_POS_WAIT
slave.cc MASTER_POS_WAIT, do automagic restart on debugging abort, skip rotate events in
slave.cc debug abort count
sql_repl.cc announce the log name at the start of the log with a fake rotate event
item_create.h MASTER_POS_WAIT
item_func.cc MASTER_POS_WAIT
item_func.h MASTER_POS_WAIT
sql_class.h enter_cond(), exit_cond() helper inliners
item_create.cc added MASTER_POS_WAIT
mysql-test-run.sh speed improvement fixes
rpl000007.test sync
rpl000003.test sleep -> sync
rpl000004.test sleep -> sync, fixed clean up bug
rpl000014.test sync
rpl000009.test sync
rpl000013.test sync
rpl000001.test sleep -> sync
rpl000008.test sync
rpl000006.test sync on cleanup
rpl000011.test sync
rpl000012.test sync
rpl000005.test sleep -> sync
rpl000010.test sync
rpl000015.test sync
rpl000002.test sleep -> sync
rpl000014.result we now know the master log name as soon as we connect
mysql.cc added optional agrument to --wait
mysqltest.c added save_master_pos and sync_with_master commands
client/mysql.cc:
added optional agrument to --wait
client/mysqltest.c:
added save_master_pos and sync_with_master commands
mysql-test/mysql-test-run.sh:
speed improvement fixes
mysql-test/r/rpl000014.result:
we now know the master log name as soon as we connect
mysql-test/t/rpl000001.test:
sleep -> sync
mysql-test/t/rpl000002.test:
sleep -> sync
mysql-test/t/rpl000003.test:
sleep -> sync
mysql-test/t/rpl000004.test:
sleep -> sync, fixed clean up bug
mysql-test/t/rpl000005.test:
sleep -> sync
mysql-test/t/rpl000006.test:
sync on cleanup
mysql-test/t/rpl000007.test:
sync
mysql-test/t/rpl000008.test:
sync
mysql-test/t/rpl000009.test:
sync
mysql-test/t/rpl000010.test:
sync
mysql-test/t/rpl000011.test:
sync
mysql-test/t/rpl000012.test:
sync
mysql-test/t/rpl000013.test:
sync
mysql-test/t/rpl000014.test:
sync
mysql-test/t/rpl000015.test:
sync
BitKeeper/etc/ignore:
Added BitKeeper/tmp/bkr3sAHD to the ignore list
mysql-test/t/rpl000016.test:
sync
sql/item_create.cc:
added MASTER_POS_WAIT
sql/item_create.h:
MASTER_POS_WAIT
sql/item_func.cc:
MASTER_POS_WAIT
sql/item_func.h:
MASTER_POS_WAIT
sql/lex.h:
MASTER_POS_WAIT
sql/slave.cc:
MASTER_POS_WAIT, do automagic restart on debugging abort, skip rotate events in
debug abort count
sql/slave.h:
MASTER_POS_WAIT
sql/sql_class.h:
enter_cond(), exit_cond() helper inliners
sql/sql_repl.cc:
announce the log name at the start of the log with a fake rotate event
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 246dbdde93d..d27bb76c065 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -616,6 +616,46 @@ int flush_master_info(MASTER_INFO* mi) return 0; } +int st_master_info::wait_for_pos(THD* thd, String* log_name, ulong log_pos) +{ + if(!inited) return -1; + bool pos_reached = 0; + int event_count = 0; + for(;!pos_reached && !thd->killed;) + { + int cmp_result; + char* basename; + pthread_mutex_lock(&lock); + if(*log_file_name) + { + basename = strrchr(log_file_name, FN_LIBCHAR); + if(basename) + ++basename; + else + basename = log_file_name; + cmp_result = strncmp(basename, log_name->ptr(), + log_name->length()); + } + else + cmp_result = 0; + + pos_reached = ((!cmp_result && pos >= log_pos) || cmp_result > 0); + if(!pos_reached && !thd->killed) + { + const char* msg = thd->enter_cond(&cond, &lock, + "Waiting for master update"); + pthread_cond_wait(&cond, &lock); + thd->exit_cond(msg); + event_count++; + } + pthread_mutex_unlock(&lock); + if(thd->killed) + return -1; + } + + return event_count; +} + static int init_slave_thread(THD* thd) { @@ -1003,10 +1043,17 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) { Rotate_log_event* rev = (Rotate_log_event*)ev; int ident_len = rev->ident_len; + pthread_mutex_lock(&mi->lock); memcpy(mi->log_file_name, rev->new_log_ident,ident_len ); mi->log_file_name[ident_len] = 0; mi->pos = 4; // skip magic number + pthread_cond_broadcast(&mi->cond); + pthread_mutex_unlock(&mi->lock); flush_master_info(mi); +#ifndef DBUG_OFF + if(abort_slave_event_count) + ++events_till_abort; +#endif delete ev; break; } @@ -1045,6 +1092,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) pthread_handler_decl(handle_slave,arg __attribute__((unused))) { +#ifndef DBUG_OFF + slave_begin: +#endif THD *thd; // needs to be first for thread_stack MYSQL *mysql = NULL ; @@ -1068,8 +1118,8 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused))) #ifndef DBUG_OFF events_till_abort = abort_slave_event_count; #endif - pthread_cond_broadcast(&COND_slave_start); - pthread_mutex_unlock(&LOCK_slave); + pthread_cond_broadcast(&COND_slave_start); + pthread_mutex_unlock(&LOCK_slave); int error = 1; bool retried_once = 0; @@ -1241,6 +1291,10 @@ position %ld", net_end(&thd->net); // destructor will not free it, because we are weird delete thd; my_thread_end(); +#ifndef DBUG_OFF + if(abort_slave_event_count && !events_till_abort) + goto slave_begin; +#endif pthread_exit(0); DBUG_RETURN(0); // Can't return anything here } |