1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines

into  mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.1-engines
This commit is contained in:
svoj@june.mysql.com
2008-02-27 17:43:54 +04:00
5 changed files with 123 additions and 43 deletions

View File

@ -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))