Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f6099e53
Commit
f6099e53
authored
Aug 15, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements for stopping the slave in SLAVE STOP and on shutdown
parent
8c432605
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
sql/mini_client.cc
sql/mini_client.cc
+15
-1
sql/mysqld.cc
sql/mysqld.cc
+1
-1
sql/sql_repl.cc
sql/sql_repl.cc
+20
-2
No files found.
sql/mini_client.cc
View file @
f6099e53
...
...
@@ -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
(
"m
ysql_rea
l_connect"
);
DBUG_ENTER
(
"m
c_mysq
l_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
))
...
...
sql/mysqld.cc
View file @
f6099e53
...
...
@@ -487,6 +487,7 @@ static void close_connections(void)
}
#endif
end_thr_alarm
();
// Don't allow alarms
end_slave
();
/* First signal all threads that it's time to die */
...
...
@@ -694,7 +695,6 @@ void clean_up(bool print_message)
x_free
(
opt_bin_logname
);
bitmap_free
(
&
temp_pool
);
free_max_user_conn
();
end_slave
();
#ifndef __WIN__
if
(
!
opt_bootstrap
)
(
void
)
my_delete
(
pidfile_name
,
MYF
(
0
));
// This may not always exist
...
...
sql/sql_repl.cc
View file @
f6099e53
...
...
@@ -611,7 +611,25 @@ int stop_slave(THD* thd, bool net_report )
// thd->killed for the slave thread
thd
->
proc_info
=
"waiting for slave to die"
;
while
(
slave_running
)
pthread_cond_wait
(
&
COND_slave_stopped
,
&
LOCK_slave
);
{
/* there is a small change that slave thread might miss the first
alarm. To protect againts it, resend the signal until it reacts
*/
struct
timespec
abstime
;
#ifdef HAVE_TIMESPEC_TS_SEC
abstime
.
ts_sec
=
time
(
NULL
)
+
2
;
abstime
.
ts_nsec
=
0
;
#else
struct
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
abstime
.
tv_sec
=
tv
.
tv_sec
+
2
;
abstime
.
tv_nsec
=
tv
.
tv_usec
*
1000
;
#endif
pthread_cond_timedwait
(
&
COND_slave_stopped
,
&
LOCK_slave
,
&
abstime
);
if
(
slave_running
)
thr_alarm_kill
(
slave_real_id
);
}
}
else
slave_errno
=
ER_SLAVE_NOT_RUNNING
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment