summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-08-09 08:56:11 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-08-09 08:56:11 +0300
commit56b03e308fb4c0feee166ddf6a707d855affa3c3 (patch)
treefc4e16093800cf4cbf1cc54fceb0b7280c4212ba /sql/slave.cc
parent4f40f87c48a9ee252f797b5d760a6b6f07cc3815 (diff)
parenta346a5613ee7c0b17b0b4ce377659c996ef6bb75 (diff)
downloadmariadb-git-56b03e308fb4c0feee166ddf6a707d855affa3c3.tar.gz
Merge tag 'mariadb-10.0.32' into 10.0-galera
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc39
1 files changed, 33 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index b1cda1129bd..f785e4f345c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -388,6 +388,7 @@ int init_slave()
{
delete active_mi;
active_mi= 0;
+ sql_print_error("Failed to allocate memory for the Master Info structure");
goto err;
}
@@ -449,7 +450,6 @@ end:
DBUG_RETURN(error);
err:
- sql_print_error("Failed to allocate memory for the Master Info structure");
error= 1;
goto end;
}
@@ -2369,6 +2369,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi)
}
if (rli->ign_gtids.count())
{
+ DBUG_ASSERT(!rli->is_in_group()); // Ensure no active transaction
glev= new Gtid_list_log_event(&rli->ign_gtids,
Gtid_list_log_event::FLAG_IGN_GTIDS);
rli->ign_gtids.reset();
@@ -5405,7 +5406,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
bool gtid_skip_enqueue= false;
bool got_gtid_event= false;
rpl_gtid event_gtid;
-
+#ifndef DBUG_OFF
+ static uint dbug_rows_event_count= 0;
+#endif
/*
FD_q must have been prepared for the first R_a event
inside get_master_version_and_clock()
@@ -5472,6 +5475,26 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
(uchar)buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
DBUG_RETURN(queue_old_event(mi,buf,event_len));
+#ifdef ENABLED_DEBUG_SYNC
+ /*
+ A (+d,dbug.rows_events_to_delay_relay_logging)-test is supposed to
+ create a few Write_log_events and after receiving the 1st of them
+ the IO thread signals to launch the SQL thread, and sets itself to
+ wait for a release signal.
+ */
+ DBUG_EXECUTE_IF("dbug.rows_events_to_delay_relay_logging",
+ if ((buf[EVENT_TYPE_OFFSET] == WRITE_ROWS_EVENT_V1 ||
+ buf[EVENT_TYPE_OFFSET] == WRITE_ROWS_EVENT) &&
+ ++dbug_rows_event_count == 2)
+ {
+ const char act[]=
+ "now SIGNAL start_sql_thread "
+ "WAIT_FOR go_on_relay_logging";
+ DBUG_ASSERT(debug_sync_service);
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
+#endif
mysql_mutex_lock(&mi->data_lock);
switch ((uchar)buf[EVENT_TYPE_OFFSET]) {
@@ -6089,6 +6112,7 @@ void end_relay_log_info(Relay_log_info* rli)
mysql_mutex_t *log_lock;
DBUG_ENTER("end_relay_log_info");
+ rli->error_on_rli_init_info= false;
if (!rli->inited)
DBUG_VOID_RETURN;
if (rli->info_fd >= 0)
@@ -6676,9 +6700,12 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size)
DBUG_RETURN(ev);
}
- if (rli->ign_gtids.count())
+ if (rli->ign_gtids.count() && !rli->is_in_group())
{
- /* We generate and return a Gtid_list, to update gtid_slave_pos. */
+ /*
+ We generate and return a Gtid_list, to update gtid_slave_pos,
+ unless being in the middle of a group.
+ */
DBUG_PRINT("info",("seeing ignored end gtids"));
ev= new Gtid_list_log_event(&rli->ign_gtids,
Gtid_list_log_event::FLAG_IGN_GTIDS);