Commit 3011060b authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-7145: Delayed slave.

Extend to work also for parallel replication.
Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent 09136ec3
...@@ -2418,8 +2418,17 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev, ...@@ -2418,8 +2418,17 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
!(unlikely(rli->gtid_skip_flag != GTID_SKIP_NOT) && is_group_event)) !(unlikely(rli->gtid_skip_flag != GTID_SKIP_NOT) && is_group_event))
return -1; return -1;
/* ToDo: what to do with this lock?!? */ /* Note: rli->data_lock is released by sql_delay_event(). */
mysql_mutex_unlock(&rli->data_lock); if (sql_delay_event(ev, rli->sql_driver_thd, serial_rgi))
{
/*
If sql_delay_event() returns non-zero, it means that the wait timed out
due to slave stop. We should not queue the event in this case, it must
not be applied yet.
*/
delete ev;
return 1;
}
if (unlikely(typ == FORMAT_DESCRIPTION_EVENT)) if (unlikely(typ == FORMAT_DESCRIPTION_EVENT))
{ {
......
...@@ -3424,7 +3424,8 @@ has_temporary_error(THD *thd) ...@@ -3424,7 +3424,8 @@ has_temporary_error(THD *thd)
@retval nonzero If the delay was interrupted and the event shall be skipped. @retval nonzero If the delay was interrupted and the event shall be skipped.
*/ */
static int sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi) int
sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi)
{ {
Relay_log_info* rli= rgi->rli; Relay_log_info* rli= rgi->rli;
long sql_delay= rli->get_sql_delay(); long sql_delay= rli->get_sql_delay();
......
...@@ -251,6 +251,7 @@ void set_slave_thread_options(THD* thd); ...@@ -251,6 +251,7 @@ void set_slave_thread_options(THD* thd);
void set_slave_thread_default_charset(THD *thd, rpl_group_info *rgi); void set_slave_thread_default_charset(THD *thd, rpl_group_info *rgi);
int rotate_relay_log(Master_info* mi); int rotate_relay_log(Master_info* mi);
int has_temporary_error(THD *thd); int has_temporary_error(THD *thd);
int sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi);
int apply_event_and_update_pos(Log_event* ev, THD* thd, int apply_event_and_update_pos(Log_event* ev, THD* thd,
struct rpl_group_info *rgi); struct rpl_group_info *rgi);
int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd, int apply_event_and_update_pos_for_parallel(Log_event* ev, THD* thd,
......
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