summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <svoj@june.mysql.com>2008-02-27 17:43:54 +0400
committerunknown <svoj@june.mysql.com>2008-02-27 17:43:54 +0400
commiteec647badb68d4f5a2a73471de6ffbdbfb13b0b8 (patch)
tree94cb9c07cb150f99e92b78746f0cb3bde74d6264 /sql/slave.cc
parent2583c281b67ae8cf470266c7438a5852a1bd2265 (diff)
parent432bc1f2599c4408dee991ba4bafc0f622a11077 (diff)
downloadmariadb-git-eec647badb68d4f5a2a73471de6ffbdbfb13b0b8.tar.gz
Merge mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.1-engines mysql-test/suite/rpl/r/rpl_dual_pos_advance.result: Auto merged sql/log_event.cc: Auto merged sql/slave.h: Use local. mysql-test/suite/rpl/t/rpl_dual_pos_advance.test: Manual merge. sql/slave.cc: Manual merge.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc63
1 files changed, 40 insertions, 23 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index ea0dde942da..8bd28c903ae 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1971,28 +1971,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);
@@ -2006,7 +1984,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
@@ -2642,6 +2643,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))