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
cbd4e667
Commit
cbd4e667
authored
Aug 22, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in mysqladmin, when it could hang while waiting for
pid file to disappear, when MySQL was already re-started.
parent
2466b5b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
client/mysqladmin.c
client/mysqladmin.c
+26
-6
No files found.
client/mysqladmin.c
View file @
cbd4e667
...
...
@@ -69,7 +69,8 @@ static void print_relative_header();
static
void
print_relative_line
();
static
void
truncate_names
();
static
my_bool
get_pidfile
(
MYSQL
*
mysql
,
char
*
pidfile
);
static
void
wait_pidfile
(
char
*
pidfile
);
static
void
wait_pidfile
(
char
*
pidfile
,
my_bool
check_pidfile_status
,
time_t
last_modified
,
struct
stat
pidfile_status
);
static
void
store_values
(
MYSQL_RES
*
result
);
/*
...
...
@@ -453,13 +454,23 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case
ADMIN_SHUTDOWN
:
{
char
pidfile
[
FN_REFLEN
];
my_bool
got_pidfile
=
0
;
my_bool
got_pidfile
=
0
;
time_t
last_modified
=
0
;
/* to keep compiler happy */
struct
stat
pidfile_status
;
my_bool
check_pidfile_status
=
1
;
/*
Only wait for pidfile on local connections
If pidfile doesn't exist, continue without pid file checking
*/
if
(
mysql
->
unix_socket
)
got_pidfile
=
!
get_pidfile
(
mysql
,
pidfile
);
if
(
got_pidfile
&&
stat
(
pidfile
,
&
pidfile_status
))
check_pidfile_status
=
0
;
else
last_modified
=
pidfile_status
.
st_mtime
;
if
(
mysql_shutdown
(
mysql
))
{
my_printf_error
(
0
,
"shutdown failed; error: '%s'"
,
MYF
(
ME_BELL
),
...
...
@@ -471,7 +482,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
if
(
opt_verbose
)
printf
(
"Shutdown signal sent to server; Waiting for pid file to disappear
\n
"
);
wait_pidfile
(
pidfile
);
/* Wait until pid file is gone */
/* Wait until pid file is gone */
wait_pidfile
(
pidfile
,
check_pidfile_status
,
last_modified
,
pidfile_status
);
}
break
;
}
...
...
@@ -1101,19 +1115,25 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
}
static
void
wait_pidfile
(
char
*
pidfile
)
static
void
wait_pidfile
(
char
*
pidfile
,
my_bool
check_pidfile_status
,
time_t
last_modified
,
struct
stat
pidfile_status
)
{
char
buff
[
FN_REFLEN
];
int
fd
;
uint
count
=
0
;
system_filename
(
buff
,
pidfile
);
system_filename
(
buff
,
pidfile
);
while
((
fd
=
my_open
(
buff
,
O_RDONLY
,
MYF
(
0
)))
>=
0
&&
count
++
<
opt_shutdown_timeout
&&
!
interrupted
)
count
++
<
opt_shutdown_timeout
&&
!
interrupted
&&
(
!
check_pidfile_status
||
(
last_modified
==
pidfile_status
.
st_mtime
)))
{
my_close
(
fd
,
MYF
(
0
));
sleep
(
1
);
if
(
stat
(
pidfile
,
&
pidfile_status
))
check_pidfile_status
=
0
;
}
if
(
check_pidfile_status
&&
(
last_modified
!=
pidfile_status
.
st_mtime
))
printf
(
"Warning; pid file changed while waiting for it to disappear!
\n
"
);
if
(
fd
>=
0
)
{
my_close
(
fd
,
MYF
(
0
));
...
...
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