BUG#28618 (Skipping into the middle of a group with

SQL_SLAVE_SKIP_COUNTER is possible):

By setting the SQL_SLAVE_SKIP_COUNTER it was possible to start the
from the middle of a group. This patch adds code so that events that
do not end a statement are ignored instead of skip counted when the
slave skip counter is 1.
parent dbf4d1af
...@@ -6127,6 +6127,20 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6127,6 +6127,20 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
Log_event::enum_skip_reason
Rows_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
{
/*
If the slave skip counter is 1 and this event does not end a
statement, then we should not start executing on the next event.
Otherwise, we defer the decision to the normal skipping logic.
*/
if (rli->slave_skip_counter == 1 && !get_flags(STMT_END_F))
return Log_event::EVENT_SKIP_IGNORE;
else
return Log_event::do_shall_skip(rli);
}
int int
Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli) Rows_log_event::do_update_pos(RELAY_LOG_INFO *rli)
{ {
...@@ -6599,6 +6613,19 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6599,6 +6613,19 @@ int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
DBUG_RETURN(error); DBUG_RETURN(error);
} }
Log_event::enum_skip_reason
Table_map_log_event::do_shall_skip(RELAY_LOG_INFO *rli)
{
/*
If the slave skip counter is 1, then we should not start executing
on the next event.
*/
if (rli->slave_skip_counter == 1)
return Log_event::EVENT_SKIP_IGNORE;
else
return Log_event::do_shall_skip(rli);
}
int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli) int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli)
{ {
rli->inc_event_relay_log_pos(); rli->inc_event_relay_log_pos();
......
...@@ -2066,6 +2066,7 @@ class Table_map_log_event : public Log_event ...@@ -2066,6 +2066,7 @@ class Table_map_log_event : public Log_event
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(RELAY_LOG_INFO const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(RELAY_LOG_INFO *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
#endif #endif
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
...@@ -2244,6 +2245,7 @@ class Rows_log_event : public Log_event ...@@ -2244,6 +2245,7 @@ class Rows_log_event : public Log_event
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
virtual int do_apply_event(RELAY_LOG_INFO const *rli); virtual int do_apply_event(RELAY_LOG_INFO const *rli);
virtual int do_update_pos(RELAY_LOG_INFO *rli); virtual int do_update_pos(RELAY_LOG_INFO *rli);
virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
/* /*
Primitive to prepare for a sequence of row executions. Primitive to prepare for a sequence of row executions.
......
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