diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-08-15 15:41:52 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-08-15 15:41:52 -0600 |
commit | 1f4334652f703d21c254e2b9dcca64538a0bc898 (patch) | |
tree | f80ff6a7e307b47fb9ab596e0929cbd50a50d0b7 /sql/mini_client.cc | |
parent | acc79d65c6ff9d5b3cf57d080ab0a2f5987f32b4 (diff) | |
download | mariadb-git-1f4334652f703d21c254e2b9dcca64538a0bc898.tar.gz |
improvements for stopping the slave in SLAVE STOP and on shutdown
sql/mini_client.cc:
alarm around mc_mysql_connect()
sql/mysqld.cc:
move end_slave() to the earlier part of shutdown
sql/sql_repl.cc:
retry thr_alarm_kill() in case slave thread missed the signal in SLAVE STOP
Diffstat (limited to 'sql/mini_client.cc')
-rw-r--r-- | sql/mini_client.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/mini_client.cc b/sql/mini_client.cc index 38180c0c6c8..2886b6e02d2 100644 --- a/sql/mini_client.cc +++ b/sql/mini_client.cc @@ -39,6 +39,8 @@ #include "errmsg.h" #include <violite.h> +extern ulong net_read_timeout; + extern "C" { // Because of SCO 3.2V4.2 #include <sys/stat.h> #include <signal.h> @@ -62,6 +64,7 @@ extern "C" { // Because of SCO 3.2V4.2 #endif #if defined(THREAD) && !defined(__WIN__) #include <my_pthread.h> /* because of signal() */ +#include <thr_alarm.h> #endif #ifndef INADDR_NONE #define INADDR_NONE -1 @@ -479,18 +482,25 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, struct sockaddr_in sock_addr; uint pkt_length; NET *net= &mysql->net; + thr_alarm_t alarmed; +#if !defined(__WIN__) + ALARM alarm_buff; +#endif + #ifdef __WIN__ HANDLE hPipe=INVALID_HANDLE_VALUE; #endif #ifdef HAVE_SYS_UN_H struct sockaddr_un UNIXaddr; #endif - DBUG_ENTER("mysql_real_connect"); + DBUG_ENTER("mc_mysql_connect"); DBUG_PRINT("enter",("host: %s db: %s user: %s", host ? host : "(Null)", db ? db : "(Null)", user ? user : "(Null)")); + thr_alarm_init(&alarmed); + thr_alarm(&alarmed,(uint) net_read_timeout,&alarm_buff); bzero((char*) &mysql->options,sizeof(mysql->options)); net->vio = 0; /* If something goes wrong */ @@ -625,8 +635,12 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, DBUG_PRINT("error",("Got error %d on connect to '%s'",ERRNO,host)); net->last_errno= CR_CONN_HOST_ERROR; sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, ERRNO); + if (thr_alarm_in_use(&alarmed)) + thr_end_alarm(&alarmed); goto error; } + if (thr_alarm_in_use(&alarmed)) + thr_end_alarm(&alarmed); } if (!net->vio || my_net_init(net, net->vio)) |