diff options
author | unknown <istruewing@stella.local> | 2008-03-26 10:27:00 +0100 |
---|---|---|
committer | unknown <istruewing@stella.local> | 2008-03-26 10:27:00 +0100 |
commit | 03c110ea217b89c308b7f08c8eb400f47a074b2e (patch) | |
tree | 69df040c98a9edd26de9be04066dff14eb50319e /sql/slave.cc | |
parent | 2daa01682775d42bbe00d3fb41e0865079240de8 (diff) | |
parent | a1de91e7082816f05bcafc2b321e5f82eb66054b (diff) | |
download | mariadb-git-03c110ea217b89c308b7f08c8eb400f47a074b2e.tar.gz |
Merge stella.local:/home2/mydev/mysql-5.1-amain
into stella.local:/home2/mydev/mysql-5.1-axmrg
mysql-test/r/ctype_big5.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/suite/binlog/r/binlog_row_ctype_cp932.result:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/rpl_rli.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/lib/mtr_report.pl:
SCCS merged
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index cce139a9238..837ae89294b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2019,28 +2019,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); - DBUG_RETURN(1); - } Log_event * ev = next_event(rli); @@ -2054,7 +2032,30 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) } if (ev) { - int exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE); + 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((rli->is_in_group() || !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; + DBUG_RETURN(1); + } + exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE); /* Format_description_log_event should not be deleted because it will be @@ -2690,6 +2691,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)) |