summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <kaa@polly.(none)>2007-11-22 19:22:54 +0300
committerunknown <kaa@polly.(none)>2007-11-22 19:22:54 +0300
commit67522fcb9f92f8286060eeac3b5f054576b16735 (patch)
tree0e96a241b9988b9299e02308267d13a3f0a9b390 /sql/slave.cc
parent619bb76ba7a15b813548595c0454f858d6536323 (diff)
downloadmariadb-git-67522fcb9f92f8286060eeac3b5f054576b16735.tar.gz
Fix for bug #29976: Excessive Slave I/O errors in replication tests
Problem: The "Slave I/O thread couldn't register on master" error sporadically occurred in replication tests because the slave I/O thread got killed by STOP SLAVE before or while registering on master. Fixed by checking the state of the I/O thread, and issueing the error only if it was not explicitely killed by a user. sql/slave.cc: When the slave I/O thread fails to register on master, issue an error message only if it is not explicitely killed by a user with STOP SLAVE.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index fcbd4eb841b..9d8b0dc95eb 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -137,6 +137,7 @@ static int terminate_slave_thread(THD *thd,
pthread_cond_t* term_cond,
volatile uint *slave_running,
bool skip_lock);
+static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info);
/*
Find out which replications threads are running
@@ -821,7 +822,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
mi->clock_diff_with_master=
(long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10));
}
- else
+ else if (!check_io_slave_killed(mi->io_thd, mi, NULL))
{
mi->clock_diff_with_master= 0; /* The "most sensible" value */
sql_print_warning("\"SELECT UNIX_TIMESTAMP()\" failed on master, "
@@ -1223,7 +1224,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
{
*suppress_warnings= TRUE; // Suppress reconnect warning
}
- else
+ else if (!check_io_slave_killed(mi->io_thd, mi, NULL))
{
char buf[256];
my_snprintf(buf, sizeof(buf), "%s (Errno: %d)", mysql_error(mysql),
@@ -1985,7 +1986,7 @@ static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info)
{
if (io_slave_killed(thd, mi))
{
- if (global_system_variables.log_warnings)
+ if (info && global_system_variables.log_warnings)
sql_print_information(info);
return TRUE;
}
@@ -2170,11 +2171,15 @@ connected:
thd->proc_info = "Registering slave on master";
if (register_slave_on_master(mysql, mi, &suppress_warnings))
{
- sql_print_error("Slave I/O thread couldn't register on master");
- if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \
-registering slave on master") ||
- try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
- reconnect_messages[SLAVE_RECON_ACT_REG]))
+ if (!check_io_slave_killed(thd, mi, "Slave I/O thread killed "
+ "while registering slave on master"))
+ {
+ sql_print_error("Slave I/O thread couldn't register on master");
+ if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
+ reconnect_messages[SLAVE_RECON_ACT_REG]))
+ goto err;
+ }
+ else
goto err;
goto connected;
}