Commit fff6f427 authored by Sergei Golubchik's avatar Sergei Golubchik

Revert f1abd015, make a smaller fix

commit f1abd015
Author: Andrei Elkin <aelkin@mysql.com>
Date:   Thu Nov 12 17:10:19 2009 +0200

    Bug #47210   first execution of "start slave until" stops too early
parent 1720fcdc
......@@ -1207,27 +1207,20 @@ err:
false - condition not met
*/
bool Relay_log_info::is_until_satisfied(THD *thd, Log_event *ev)
bool Relay_log_info::is_until_satisfied(my_off_t master_beg_pos)
{
const char *log_name;
ulonglong log_pos;
DBUG_ENTER("Relay_log_info::is_until_satisfied");
DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
until_condition == UNTIL_RELAY_POS);
if (until_condition == UNTIL_MASTER_POS)
{
if (ev && ev->server_id == (uint32) global_system_variables.server_id &&
!replicate_same_server_id)
DBUG_RETURN(FALSE);
log_name= group_master_log_name;
log_pos= ((!ev)? group_master_log_pos :
(get_flag(IN_TRANSACTION) || !ev->log_pos) ?
group_master_log_pos : ev->log_pos - ev->data_written);
log_pos= master_beg_pos;
}
else
{ /* until_condition == UNTIL_RELAY_POS */
{
DBUG_ASSERT(until_condition == UNTIL_RELAY_POS);
log_name= group_relay_log_name;
log_pos= group_relay_log_pos;
}
......
......@@ -394,7 +394,7 @@ public:
void close_temporary_tables();
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
bool is_until_satisfied(THD *thd, Log_event *ev);
bool is_until_satisfied(my_off_t);
inline ulonglong until_pos()
{
DBUG_ASSERT(until_condition == UNTIL_MASTER_POS ||
......
......@@ -3604,7 +3604,11 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
*/
if ((rli->until_condition == Relay_log_info::UNTIL_MASTER_POS ||
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
rli->is_until_satisfied(thd, ev))
(ev->server_id != global_system_variables.server_id ||
rli->replicate_same_server_id) &&
rli->is_until_satisfied((rli->get_flag(Relay_log_info::IN_TRANSACTION) || !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"
......@@ -4726,7 +4730,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
}
if ((rli->until_condition == Relay_log_info::UNTIL_MASTER_POS ||
rli->until_condition == Relay_log_info::UNTIL_RELAY_POS) &&
rli->is_until_satisfied(thd, NULL))
rli->is_until_satisfied(rli->group_master_log_pos))
{
char buf[22];
sql_print_information("Slave SQL thread stopped because it reached its"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment