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
cf0f4059
Commit
cf0f4059
authored
Apr 12, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/my51-bug18415
into neptunus.(none):/home/msvensson/mysql/mysql-5.1
parents
ee76a12c
79644595
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
47 deletions
+35
-47
mysql-test/lib/mtr_process.pl
mysql-test/lib/mtr_process.pl
+35
-47
No files found.
mysql-test/lib/mtr_process.pl
View file @
cf0f4059
...
@@ -144,17 +144,6 @@ sub spawn_impl ($$$$$$$$) {
...
@@ -144,17 +144,6 @@ sub spawn_impl ($$$$$$$$) {
$SIG
{
INT
}
=
'
DEFAULT
';
# Parent do some stuff, we don't
$SIG
{
INT
}
=
'
DEFAULT
';
# Parent do some stuff, we don't
if
(
$::glob_cygwin_shell
and
$mode
eq
'
test
'
)
{
# Programs started from mysqltest under Cygwin, are to
# execute them within Cygwin. Else simple things in test
# files like
# --system "echo 1 > file"
# will fail.
# FIXME not working :-(
# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
}
my
$log_file_open_mode
=
'
>
';
my
$log_file_open_mode
=
'
>
';
if
(
$spawn_opts
and
$spawn_opts
->
{'
append_log_file
'})
if
(
$spawn_opts
and
$spawn_opts
->
{'
append_log_file
'})
...
@@ -164,7 +153,15 @@ sub spawn_impl ($$$$$$$$) {
...
@@ -164,7 +153,15 @@ sub spawn_impl ($$$$$$$$) {
if
(
$output
)
if
(
$output
)
{
{
if
(
!
open
(
STDOUT
,
$log_file_open_mode
,
$output
)
)
if
(
$::glob_win32_perl
)
{
# Don't redirect stdout on ActiveState perl since this is
# just another thread in the same process.
# Should be fixed so that the thread that is created with fork
# executes the exe in another process and wait's for it to return.
# In the meanwhile, we get all the output from mysqld's to screen
}
elsif
(
!
open
(
STDOUT
,
$log_file_open_mode
,
$output
)
)
{
{
mtr_child_error
("
can't redirect STDOUT to
\"
$output
\"
: $!
");
mtr_child_error
("
can't redirect STDOUT to
\"
$output
\"
: $!
");
}
}
...
@@ -216,8 +213,7 @@ sub spawn_parent_impl {
...
@@ -216,8 +213,7 @@ sub spawn_parent_impl {
{
{
# Simple run of command, we wait for it to return
# Simple run of command, we wait for it to return
my
$ret_pid
=
waitpid
(
$pid
,
0
);
my
$ret_pid
=
waitpid
(
$pid
,
0
);
if
(
$ret_pid
!=
$pid
)
if
(
$ret_pid
<=
0
)
{
{
mtr_error
("
$path
(
$pid
) got lost somehow
");
mtr_error
("
$path
(
$pid
) got lost somehow
");
}
}
...
@@ -245,7 +241,6 @@ sub spawn_parent_impl {
...
@@ -245,7 +241,6 @@ sub spawn_parent_impl {
# Someone terminated, don't know who. Collect
# Someone terminated, don't know who. Collect
# status info first before $? is lost,
# status info first before $? is lost,
# but not $exit_value, this is flagged from
# but not $exit_value, this is flagged from
#
my
$timer_name
=
mtr_timer_timeout
(
$::glob_timers
,
$ret_pid
);
my
$timer_name
=
mtr_timer_timeout
(
$::glob_timers
,
$ret_pid
);
if
(
$timer_name
)
if
(
$timer_name
)
...
@@ -310,7 +305,7 @@ sub spawn_parent_impl {
...
@@ -310,7 +305,7 @@ sub spawn_parent_impl {
$ret_pid
=
waitpid
(
$pid
,
0
);
$ret_pid
=
waitpid
(
$pid
,
0
);
if
(
$ret_pid
==
-
1
)
if
(
$ret_pid
!=
$pid
)
{
{
mtr_error
("
$path
(
$pid
) got lost somehow
");
mtr_error
("
$path
(
$pid
) got lost somehow
");
}
}
...
@@ -361,7 +356,6 @@ sub mtr_kill_leftovers () {
...
@@ -361,7 +356,6 @@ sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with
# First, kill all masters and slaves that would conflict with
# this run. Make sure to remove the PID file, if any.
# this run. Make sure to remove the PID file, if any.
# FIXME kill IM manager first, else it will restart the servers, how?!
# FIXME kill IM manager first, else it will restart the servers, how?!
my
@args
;
my
@args
;
for
(
my
$idx
;
$idx
<
2
;
$idx
++
)
for
(
my
$idx
;
$idx
<
2
;
$idx
++
)
...
@@ -650,22 +644,10 @@ sub mtr_mysqladmin_shutdown {
...
@@ -650,22 +644,10 @@ sub mtr_mysqladmin_shutdown {
my
$adm_shutdown_tmo
=
shift
;
my
$adm_shutdown_tmo
=
shift
;
my
%
mysql_admin_pids
;
my
%
mysql_admin_pids
;
my
@to_kill_specs
;
# Start one "mysqladmin shutdown" for each server
foreach
my
$srv
(
@$spec
)
foreach
my
$srv
(
@$spec
)
{
{
if
(
mtr_ping_mysqld_server
(
$srv
->
{'
port
'},
$srv
->
{'
sockfile
'})
)
{
push
(
@to_kill_specs
,
$srv
);
}
}
foreach
my
$srv
(
@to_kill_specs
)
{
# FIXME wrong log.....
# FIXME, stderr.....
# Shutdown time must be high as slave may be in reconnect
my
$args
;
my
$args
;
mtr_init_args
(
\
$args
);
mtr_init_args
(
\
$args
);
...
@@ -673,6 +655,7 @@ sub mtr_mysqladmin_shutdown {
...
@@ -673,6 +655,7 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--no-defaults
");
mtr_add_arg
(
$args
,
"
--user=%s
",
$::opt_user
);
mtr_add_arg
(
$args
,
"
--user=%s
",
$::opt_user
);
mtr_add_arg
(
$args
,
"
--password=
");
mtr_add_arg
(
$args
,
"
--password=
");
mtr_add_arg
(
$args
,
"
--silent
");
if
(
-
e
$srv
->
{'
sockfile
'}
)
if
(
-
e
$srv
->
{'
sockfile
'}
)
{
{
mtr_add_arg
(
$args
,
"
--socket=%s
",
$srv
->
{'
sockfile
'});
mtr_add_arg
(
$args
,
"
--socket=%s
",
$srv
->
{'
sockfile
'});
...
@@ -686,26 +669,27 @@ sub mtr_mysqladmin_shutdown {
...
@@ -686,26 +669,27 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg
(
$args
,
"
--protocol=tcp
");
# Needed if no --socket
mtr_add_arg
(
$args
,
"
--protocol=tcp
");
# Needed if no --socket
}
}
mtr_add_arg
(
$args
,
"
--connect_timeout=5
");
mtr_add_arg
(
$args
,
"
--connect_timeout=5
");
# Shutdown time must be high as slave may be in reconnect
mtr_add_arg
(
$args
,
"
--shutdown_timeout=
$adm_shutdown_tmo
");
mtr_add_arg
(
$args
,
"
--shutdown_timeout=
$adm_shutdown_tmo
");
mtr_add_arg
(
$args
,
"
shutdown
");
mtr_add_arg
(
$args
,
"
shutdown
");
#
We don't wait for termination of mysqladmin
#
Start mysqladmin in paralell and wait for termination later
my
$pid
=
mtr_spawn
(
$::exe_mysqladmin
,
$args
,
my
$pid
=
mtr_spawn
(
$::exe_mysqladmin
,
$args
,
"",
$::path_manager_log
,
$::path_manager_log
,
"",
"",
$::path_manager_log
,
$::path_manager_log
,
"",
{
append_log_file
=>
1
});
{
append_log_file
=>
1
});
# Save the pid of the mysqladmin process
$mysql_admin_pids
{
$pid
}
=
1
;
$mysql_admin_pids
{
$pid
}
=
1
;
}
}
# Wait for all the started mysqladmin to exit
# As mysqladmin is such a simple program, we trust it to terminate.
# As mysqladmin is such a simple program, we trust it to terminate.
# I.e. we wait blocking, and wait wait for them all before we go on.
# I.e. we wait blocking, and wait wait for them all before we go on.
while
(
keys
%
mysql_admin_pids
)
foreach
my
$pid
(
keys
%
mysql_admin_pids
)
{
{
foreach
my
$pid
(
keys
%
mysql_admin_pids
)
my
$ret_pid
=
waitpid
(
$pid
,
0
);
{
if
(
waitpid
(
$pid
,
0
)
>
0
)
# If this was any of the mysqladmin's we waited for, delete its
{
# pid from list
delete
$mysql_admin_pids
{
$pid
};
delete
$mysql_admin_pids
{
$ret_pid
}
if
exists
$mysql_admin_pids
{
$ret_pid
};
}
}
}
}
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
...
@@ -720,7 +704,7 @@ sub mtr_mysqladmin_shutdown {
...
@@ -720,7 +704,7 @@ sub mtr_mysqladmin_shutdown {
TIME:
TIME:
while
(
$timeout
--
)
while
(
$timeout
--
)
{
{
foreach
my
$srv
(
@
to_kill_specs
)
foreach
my
$srv
(
@
$spec
)
{
{
$res
=
1
;
# We are optimistic
$res
=
1
;
# We are optimistic
if
(
mtr_ping_mysqld_server
(
$srv
->
{'
port
'},
$srv
->
{'
sockfile
'})
)
if
(
mtr_ping_mysqld_server
(
$srv
->
{'
port
'},
$srv
->
{'
sockfile
'})
)
...
@@ -753,9 +737,9 @@ sub mtr_record_dead_children () {
...
@@ -753,9 +737,9 @@ sub mtr_record_dead_children () {
my
$ret_pid
;
my
$ret_pid
;
#
FIXME the man page says to wait for -1 to terminate,
#
Wait without blockinng to see if any processes had died
#
but on OS X we get '0' all the time...
#
-1 or 0 means there are no more procesess to wait for
while
(
(
$ret_pid
=
waitpid
(
-
1
,
&
WNOHANG
))
>
0
)
while
(
(
$ret_pid
=
waitpid
(
-
1
,
&
WNOHANG
))
!=
0
and
$ret_pid
!=
-
1
)
{
{
mtr_debug
("
waitpid() catched exit of child
$ret_pid
");
mtr_debug
("
waitpid() catched exit of child
$ret_pid
");
foreach
my
$idx
(
0
..
1
)
foreach
my
$idx
(
0
..
1
)
...
@@ -788,7 +772,11 @@ sub start_reap_all {
...
@@ -788,7 +772,11 @@ sub start_reap_all {
# here. If a process terminated before setting $SIG{CHLD} (but after
# here. If a process terminated before setting $SIG{CHLD} (but after
# any attempt to waitpid() it), it will still be a zombie. So we
# any attempt to waitpid() it), it will still be a zombie. So we
# have to handle any such process here.
# have to handle any such process here.
while
(
waitpid
(
-
1
,
&
WNOHANG
)
>
0
)
{
};
my
$pid
;
while
((
$pid
=
waitpid
(
-
1
,
&
WNOHANG
))
!=
0
and
$pid
!=
-
1
)
{
print
"
start_reap_all: pid:
$pid
.
\n
";
};
}
}
sub
stop_reap_all
{
sub
stop_reap_all
{
...
@@ -842,7 +830,7 @@ sub sleep_until_file_created ($$$) {
...
@@ -842,7 +830,7 @@ sub sleep_until_file_created ($$$) {
}
}
# Check if it died after the fork() was successful
# Check if it died after the fork() was successful
if
(
$pid
>
0
&&
waitpid
(
$pid
,
&
WNOHANG
)
==
$pid
)
if
(
$pid
!=
0
&&
waitpid
(
$pid
,
&
WNOHANG
)
==
$pid
)
{
{
return
0
;
return
0
;
}
}
...
@@ -904,8 +892,8 @@ sub mtr_exit ($) {
...
@@ -904,8 +892,8 @@ sub mtr_exit ($) {
# set ourselves as the group leader at startup (with
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
# proper child process cleanup.
kill
('
HUP
',
-
$$
)
if
$$
==
getpgrp
();
kill
('
HUP
',
-
$$
)
if
!
$::glob_win32_perl
and
$$
==
getpgrp
();
sleep
2
;
exit
(
$code
);
exit
(
$code
);
}
}
...
...
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