diff options
author | unknown <istruewing@stella.local> | 2008-03-26 09:33:55 +0100 |
---|---|---|
committer | unknown <istruewing@stella.local> | 2008-03-26 09:33:55 +0100 |
commit | 0d6f9bad705cc24d259be0dbb480c8a2b3fe89a5 (patch) | |
tree | 9e49dc365cd12b2b683b2ee916710fbeeb67f31c /sql/slave.cc | |
parent | 4097ee7ffa2f8eea143977a2238b016a1c99b3ca (diff) | |
parent | 0cb21ac297cd5fd8d933224272e9534ecd22f3c4 (diff) | |
download | mariadb-git-0d6f9bad705cc24d259be0dbb480c8a2b3fe89a5.tar.gz |
Merge stella.local:/home2/mydev/mysql-5.0-amain
into stella.local:/home2/mydev/mysql-5.0-axmrg
mysql-test/r/ctype_big5.result:
Auto merged
mysql-test/r/ctype_cp932.result:
Auto merged
mysql-test/r/ctype_euckr.result:
Auto merged
mysql-test/r/ctype_gb2312.result:
Auto merged
mysql-test/r/ctype_gbk.result:
Auto merged
mysql-test/r/ctype_uca.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
sql/slave.cc:
Auto merged
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 5488b3c312a..e8bdf655115 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3138,6 +3138,11 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) Check if condition stated in UNTIL clause of START SLAVE is reached. SYNOPSYS st_relay_log_info::is_until_satisfied() + master_beg_pos position of the beginning of to be executed event + (not log_pos member of the event that points to the + beginning of the following event) + + DESCRIPTION Checks if UNTIL condition is reached. Uses caching result of last comparison of current log file name and target log file name. So cached @@ -3162,7 +3167,7 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) false - condition not met */ -bool st_relay_log_info::is_until_satisfied() +bool st_relay_log_info::is_until_satisfied(my_off_t master_beg_pos) { const char *log_name; ulonglong log_pos; @@ -3172,7 +3177,7 @@ bool st_relay_log_info::is_until_satisfied() if (until_condition == UNTIL_MASTER_POS) { log_name= group_master_log_name; - log_pos= group_master_log_pos; + log_pos= master_beg_pos; } else { /* until_condition == UNTIL_RELAY_POS */ @@ -3251,28 +3256,6 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) wait for something for example inside of next_event(). */ pthread_mutex_lock(&rli->data_lock); - /* - This tests if the position of the end of the last previous executed event - hits the UNTIL barrier. - We would prefer to test if the position of the start (or possibly) end of - the to-be-read event hits the UNTIL barrier, this is different if there - was an event ignored by the I/O thread just before (BUG#13861 to be - fixed). - */ - if (rli->until_condition!=RELAY_LOG_INFO::UNTIL_NONE && - rli->is_until_satisfied()) - { - char buf[22]; - sql_print_information("Slave SQL thread stopped because it reached its" - " UNTIL position %s", llstr(rli->until_pos(), buf)); - /* - Setting abort_slave flag because we do not want additional message about - error in query execution to be printed. - */ - rli->abort_slave= 1; - pthread_mutex_unlock(&rli->data_lock); - return 1; - } Log_event * ev = next_event(rli); @@ -3290,6 +3273,27 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) int exec_res; /* + This tests if the position of the beginning of the current event + hits the UNTIL barrier. + */ + if (rli->until_condition != RELAY_LOG_INFO::UNTIL_NONE && + rli->is_until_satisfied((thd->options & OPTION_BEGIN || !ev->log_pos) ? + rli->group_master_log_pos : + ev->log_pos - ev->data_written)) + { + char buf[22]; + sql_print_information("Slave SQL thread stopped because it reached its" + " UNTIL position %s", llstr(rli->until_pos(), buf)); + /* + Setting abort_slave flag because we do not want additional message about + error in query execution to be printed. + */ + rli->abort_slave= 1; + pthread_mutex_unlock(&rli->data_lock); + delete ev; + return 1; + } + /* Queries originating from this server must be skipped. Low-level events (Format_desc, Rotate, Stop) from this server must also be skipped. But for those we don't want to modify @@ -4000,6 +4004,22 @@ Slave SQL thread aborted. Can't execute init_slave query"); } } + /* + First check until condition - probably there is nothing to execute. We + do not want to wait for next event in this case. + */ + pthread_mutex_lock(&rli->data_lock); + if (rli->until_condition != RELAY_LOG_INFO::UNTIL_NONE && + rli->is_until_satisfied(rli->group_master_log_pos)) + { + char buf[22]; + sql_print_information("Slave SQL thread stopped because it reached its" + " UNTIL position %s", llstr(rli->until_pos(), buf)); + pthread_mutex_unlock(&rli->data_lock); + goto err; + } + pthread_mutex_unlock(&rli->data_lock); + /* Read queries from the IO/THREAD until this thread is killed */ while (!sql_slave_killed(thd,rli)) |