summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-02-26 22:32:06 -0700
committerunknown <sasha@mysql.sashanet.com>2001-02-26 22:32:06 -0700
commit6532b525f70ad5ed363fdb5b190e87eb58320b76 (patch)
treee2f5a03ebfa5e9759515c4bf19419e1413b69922 /sql/slave.cc
parent145dedcde5a23a66139e9ca7d5961a69ca5ae164 (diff)
parent9e459e16d259d4cae5446dcad2e4e7cc5314da34 (diff)
downloadmariadb-git-6532b525f70ad5ed363fdb5b190e87eb58320b76.tar.gz
sql/slave.cc
merged sql/slave.cc: merged BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc50
1 files changed, 39 insertions, 11 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index ebf757420a3..474ce55d802 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -588,7 +588,7 @@ int show_master_info(THD* thd)
net_store_data(packet, (uint32) glob_mi.port);
net_store_data(packet, (uint32) glob_mi.connect_retry);
net_store_data(packet, glob_mi.log_file_name);
- net_store_data(packet, (longlong) glob_mi.pos);
+ net_store_data(packet, (uint32) glob_mi.pos);
pthread_mutex_unlock(&glob_mi.lock);
pthread_mutex_lock(&LOCK_slave);
net_store_data(packet, slave_running ? "Yes":"No");
@@ -1150,7 +1150,7 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
int error = 1;
bool retried_once = 0;
- ulonglong last_failed_pos = 0;
+ uint32 last_failed_pos = 0;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init();
@@ -1160,7 +1160,10 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
pthread_detach_this_thread();
if (init_slave_thread(thd) || init_master_info(&glob_mi))
- goto err;
+ {
+ sql_print_error("Failed during slave thread initialization");
+ goto err;
+ }
thd->thread_stack = (char*)&thd; // remember where our stack is
thd->temporary_tables = save_temporary_tables; // restore temp tables
threads.append(thd);
@@ -1175,7 +1178,7 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
goto err;
}
- thd->proc_info = "Connecting to master";
+ thd->proc_info = "connecting to master";
#ifndef DBUG_OFF
sql_print_error("Slave thread initialized");
#endif
@@ -1187,18 +1190,25 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
RPL_LOG_NAME,
glob_mi.pos);
else
- goto err;
+ {
+ sql_print_error("Slave thread killed while connecting to master");
+ goto err;
+ }
while (!slave_killed(thd))
{
- thd->proc_info = "Requesting binlog dump";
+ thd->proc_info = "requesting binlog dump";
if(request_dump(mysql, &glob_mi))
{
sql_print_error("Failed on request_dump()");
if(slave_killed(thd))
goto err;
+ sql_print_error("Slave thread killed while requesting master \
+dump");
+ goto err;
+ }
- thd->proc_info = "Waiting to reconnect after a failed dump request";
+ thd->proc_info = "waiting to reconnect after a failed dump request";
if(mysql->net.vio)
vio_close(mysql->net.vio);
// first time retry immediately, assuming that we can recover
@@ -1210,14 +1220,21 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
retried_once = 1;
if(slave_killed(thd))
+ {
+ sql_print_error("Slave thread killed while retrying master \
+dump");
goto err;
+ }
thd->proc_info = "Reconnecting after a failed dump request";
sql_print_error("Slave: failed dump request, reconnecting to \
try again, log '%s' at postion %ld", RPL_LOG_NAME,
last_failed_pos = glob_mi.pos );
if(safe_reconnect(thd, mysql, &glob_mi) || slave_killed(thd))
+ {
+ sql_print_error("Slave thread killed during or after reconnect");
goto err;
+ }
continue;
}
@@ -1228,7 +1245,10 @@ try again, log '%s' at postion %ld", RPL_LOG_NAME,
thd->proc_info = "Reading master update";
uint event_len = read_event(mysql, &glob_mi);
if(slave_killed(thd))
- goto err;
+ {
+ sql_print_error("Slave thread killed while reading event");
+ goto err;
+ }
if (event_len == packet_error)
{
@@ -1241,13 +1261,21 @@ try again, log '%s' at postion %ld", RPL_LOG_NAME,
retried_once = 1;
if(slave_killed(thd))
- goto err;
- thd->proc_info = "Reconnecting after a failed read";
+ {
+ sql_print_error("Slave thread killed while waiting to \
+reconnect after a failed read");
+ goto err;
+ }
+ thd->proc_info = "reconnecting after a failed read";
sql_print_error("Slave: Failed reading log event, \
reconnecting to retry, log '%s' position %ld", RPL_LOG_NAME,
last_failed_pos = glob_mi.pos);
if(safe_reconnect(thd, mysql, &glob_mi) || slave_killed(thd))
- goto err;
+ {
+ sql_print_error("Slave thread killed during or after a \
+reconnect done to recover from failed read");
+ goto err;
+ }
break;
}