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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6b6ba582
Commit
6b6ba582
authored
Sep 05, 2006
by
anozdrin/alik@alik
Browse files
Options
Browse Files
Download
Plain Diff
Merge alik.:/mnt/raid/alik/MySQL/devel/5.0-tree
into alik.:/mnt/raid/alik/MySQL/devel/5.0-rt
parents
4d0430c8
e0670a06
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
26 deletions
+87
-26
mysql-test/lib/mtr_process.pl
mysql-test/lib/mtr_process.pl
+5
-6
mysql-test/r/im_daemon_life_cycle.result
mysql-test/r/im_daemon_life_cycle.result
+14
-0
mysql-test/t/im_daemon_life_cycle.imtest
mysql-test/t/im_daemon_life_cycle.imtest
+44
-0
mysql-test/t/kill_n_check.sh
mysql-test/t/kill_n_check.sh
+1
-1
server-tools/instance-manager/listener.cc
server-tools/instance-manager/listener.cc
+23
-19
No files found.
mysql-test/lib/mtr_process.pl
View file @
6b6ba582
...
...
@@ -31,7 +31,7 @@ sub mtr_im_check_alive ($);
sub
mtr_im_check_main_alive
($);
sub
mtr_im_check_angel_alive
($);
sub
mtr_im_check_mysqlds_alive
($);
sub
mtr_im_check_mysqld_alive
($
$
);
sub
mtr_im_check_mysqld_alive
($);
sub
mtr_im_cleanup
($);
sub
mtr_im_rm_file
($);
sub
mtr_im_errlog
($);
...
...
@@ -1282,21 +1282,20 @@ sub mtr_im_check_mysqlds_alive($) {
mtr_debug
("
Checking mysqld[
$idx
]...
");
return
1
if
mtr_im_check_mysqld_alive
(
$instance
_manager
,
$instance
s
->
[
$idx
]);
if
mtr_im_check_mysqld_alive
(
$instances
->
[
$idx
]);
}
}
###########################################################################
sub
mtr_im_check_mysqld_alive
($$)
{
my
$instance_manager
=
shift
;
sub
mtr_im_check_mysqld_alive
($)
{
my
$mysqld_instance
=
shift
;
# Check that the process is dead.
if
(
defined
$
instance_manager
->
{'
pid
'})
if
(
defined
$
mysqld_instance
->
{'
pid
'})
{
if
(
kill
(
0
,
$
instance_manager
->
{'
pid
'}))
if
(
kill
(
0
,
$
mysqld_instance
->
{'
pid
'}))
{
mtr_debug
("
Mysqld instance (PID:
$mysqld_instance
->{pid}) is alive.
");
return
1
;
...
...
mysql-test/r/im_daemon_life_cycle.result
View file @
6b6ba582
...
...
@@ -8,3 +8,17 @@ mysqld2 offline
Killing the process...
Sleeping...
Success: the process was restarted.
--------------------------------------------------------------------
-- Test for BUG#12751
--------------------------------------------------------------------
START INSTANCE mysqld2;
Success: the process has been started.
Killing the process...
Sleeping...
Success: the process was restarted.
SHOW INSTANCE STATUS mysqld1;
instance_name status version
mysqld1 online VERSION
STOP INSTANCE mysqld2;
Success: the process has been stopped.
mysql-test/t/im_daemon_life_cycle.imtest
View file @
6b6ba582
...
...
@@ -14,3 +14,47 @@
# process.
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30
###########################################################################
#
# BUG#12751: Instance Manager: client hangs
#
--echo
--echo --------------------------------------------------------------------
--echo -- Test for BUG#12751
--echo --------------------------------------------------------------------
# Give some time to begin accepting connections after restart.
# FIXME: race condition here.
--sleep 3
# 1. Start mysqld;
START INSTANCE mysqld2;
# FIXME: START INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
# 2. Restart IM-main: kill it and IM-angel will restart it.
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30
# 3. Issue some statement -- connection should be re-established.
# Give some time to begin accepting connections after restart.
# FIXME: race condition here.
--sleep 3
--replace_column 3 VERSION
SHOW INSTANCE STATUS mysqld1;
# 4. Stop mysqld2, because it will not be stopped by IM, as it is nonguarded.
# So, if it we do not stop it, it will be stopped by mysql-test-run.pl with
# warning.
STOP INSTANCE mysqld2;
# FIXME: STOP INSTANCE should be synchronous.
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
mysql-test/t/kill_n_check.sh
View file @
6b6ba582
...
...
@@ -49,7 +49,7 @@ if [ -z "$pid_path" ]; then
exit
0
fi
if
[
$expected_result
=
'killed'
-a
!
-r
"
$pid_path
"
]
;
then
if
[
!
-r
"
$pid_path
"
]
;
then
echo
"Error: PID file (
$pid_path
) does not exist."
exit
0
fi
...
...
server-tools/instance-manager/listener.cc
View file @
6b6ba582
...
...
@@ -36,6 +36,27 @@
#include "portability.h"
static
void
set_non_blocking
(
int
socket
)
{
#ifndef __WIN__
int
flags
=
fcntl
(
socket
,
F_GETFL
,
0
);
fcntl
(
socket
,
F_SETFL
,
flags
|
O_NONBLOCK
);
#else
u_long
arg
=
1
;
ioctlsocket
(
socket
,
FIONBIO
,
&
arg
);
#endif
}
static
void
set_no_inherit
(
int
socket
)
{
#ifndef __WIN__
int
flags
=
fcntl
(
socket
,
F_GETFD
,
0
);
fcntl
(
socket
,
F_SETFD
,
flags
|
FD_CLOEXEC
);
#endif
}
/*
Listener_thread - incapsulates listening functionality
*/
...
...
@@ -157,6 +178,8 @@ void Listener_thread::run()
/* accept may return -1 (failure or spurious wakeup) */
if
(
client_fd
>=
0
)
// connection established
{
set_no_inherit
(
client_fd
);
Vio
*
vio
=
vio_new
(
client_fd
,
socket_index
==
0
?
VIO_TYPE_SOCKET
:
VIO_TYPE_TCPIP
,
socket_index
==
0
?
1
:
0
);
...
...
@@ -198,25 +221,6 @@ void Listener_thread::run()
return
;
}
void
set_non_blocking
(
int
socket
)
{
#ifndef __WIN__
int
flags
=
fcntl
(
socket
,
F_GETFL
,
0
);
fcntl
(
socket
,
F_SETFL
,
flags
|
O_NONBLOCK
);
#else
u_long
arg
=
1
;
ioctlsocket
(
socket
,
FIONBIO
,
&
arg
);
#endif
}
void
set_no_inherit
(
int
socket
)
{
#ifndef __WIN__
int
flags
=
fcntl
(
socket
,
F_GETFD
,
0
);
fcntl
(
socket
,
F_SETFD
,
flags
|
FD_CLOEXEC
);
#endif
}
int
Listener_thread
::
create_tcp_socket
()
{
/* value to be set by setsockopt */
...
...
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