Skip to content

Commit

Permalink
Revert f1abd01, make a smaller fix
Browse files Browse the repository at this point in the history
commit f1abd01
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
  • Loading branch information
vuvova committed Sep 4, 2015
1 parent 1720fcd commit fff6f42
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
15 changes: 4 additions & 11 deletions sql/rpl_rli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1207,27 +1207,20 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
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;
}
Expand Down
2 changes: 1 addition & 1 deletion sql/rpl_rli.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class Relay_log_info : public Slave_reporting_capability
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 ||
Expand Down
8 changes: 6 additions & 2 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fff6f42

Please sign in to comment.