Commit 107d6ca0 authored by anozdrin/alik@alik's avatar anozdrin/alik@alik

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime

into  alik.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
parents 00c54ad5 ba96c5ae
...@@ -2,4 +2,6 @@ ...@@ -2,4 +2,6 @@
44ec850ac2k4y2Omgr92GiWPBAVKGQ 44ec850ac2k4y2Omgr92GiWPBAVKGQ
44edb86b1iE5knJ97MbliK_3lCiAXA 44edb86b1iE5knJ97MbliK_3lCiAXA
44f33f3aj5KW5qweQeekY1LU0E9ZCg 44f33f3aj5KW5qweQeekY1LU0E9ZCg
45001f7c3b2hhCXDKfUvzkX9TNe6VA
45002051rHJfMEXAIMiAZV0clxvKSA
4513d8e4Af4dQWuk13sArwofRgFDQw 4513d8e4Af4dQWuk13sArwofRgFDQw
This diff is collapsed.
This diff is collapsed.
...@@ -88,6 +88,7 @@ use strict; ...@@ -88,6 +88,7 @@ use strict;
#use diagnostics; #use diagnostics;
require "lib/mtr_cases.pl"; require "lib/mtr_cases.pl";
require "lib/mtr_im.pl";
require "lib/mtr_process.pl"; require "lib/mtr_process.pl";
require "lib/mtr_timer.pl"; require "lib/mtr_timer.pl";
require "lib/mtr_io.pl"; require "lib/mtr_io.pl";
...@@ -1040,6 +1041,7 @@ sub command_line_setup () { ...@@ -1040,6 +1041,7 @@ sub command_line_setup () {
path_datadir => "$opt_vardir/im_mysqld_1.data", path_datadir => "$opt_vardir/im_mysqld_1.data",
path_sock => "$sockdir/mysqld_1.sock", path_sock => "$sockdir/mysqld_1.sock",
path_pid => "$opt_vardir/run/mysqld_1.pid", path_pid => "$opt_vardir/run/mysqld_1.pid",
start_timeout => 400, # enough time create innodb tables
old_log_format => 1 old_log_format => 1
}; };
...@@ -1051,6 +1053,7 @@ sub command_line_setup () { ...@@ -1051,6 +1053,7 @@ sub command_line_setup () {
path_sock => "$sockdir/mysqld_2.sock", path_sock => "$sockdir/mysqld_2.sock",
path_pid => "$opt_vardir/run/mysqld_2.pid", path_pid => "$opt_vardir/run/mysqld_2.pid",
nonguarded => 1, nonguarded => 1,
start_timeout => 400, # enough time create innodb tables
old_log_format => 1 old_log_format => 1
}; };
...@@ -1665,11 +1668,7 @@ sub kill_running_server () { ...@@ -1665,11 +1668,7 @@ sub kill_running_server () {
# started from ths run of the script, this is terminating # started from ths run of the script, this is terminating
# leftovers from previous runs. # leftovers from previous runs.
mtr_report("Killing Possible Leftover Processes");
mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers(); mtr_kill_leftovers();
} }
} }
...@@ -2657,7 +2656,10 @@ sub run_testcase ($) { ...@@ -2657,7 +2656,10 @@ sub run_testcase ($) {
if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' ) if ( ! $glob_use_running_server and $tinfo->{'component_id'} eq 'im' )
{ {
mtr_im_stop($instance_manager, $tinfo->{'name'}); unless ( mtr_im_stop($instance_manager, $tinfo->{'name'}) )
{
mtr_error("Failed to stop Instance Manager.")
}
} }
} }
...@@ -3195,7 +3197,10 @@ sub stop_all_servers () { ...@@ -3195,7 +3197,10 @@ sub stop_all_servers () {
print "Stopping All Servers\n"; print "Stopping All Servers\n";
print "Shutting-down Instance Manager\n"; print "Shutting-down Instance Manager\n";
mtr_im_stop($instance_manager, "stop_all_servers"); unless (mtr_im_stop($instance_manager, "stop_all_servers"))
{
mtr_error("Failed to stop Instance Manager.")
}
my %admin_pids; # hash of admin processes that requests shutdown my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill my @kill_pids; # list of processes to shutdown/kill
...@@ -3601,7 +3606,13 @@ sub run_testcase_start_servers($) { ...@@ -3601,7 +3606,13 @@ sub run_testcase_start_servers($) {
im_create_defaults_file($instance_manager); im_create_defaults_file($instance_manager);
mtr_im_start($instance_manager, $tinfo->{im_opts}); unless ( mtr_im_start($instance_manager, $tinfo->{im_opts}) )
{
report_failure_and_restart($tinfo);
mtr_report("Failed to start Instance Manager. " .
"The test '$tname' is marked as failed.");
return;
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
...@@ -8,3 +8,17 @@ mysqld2 offline ...@@ -8,3 +8,17 @@ mysqld2 offline
Killing the process... Killing the process...
Sleeping... Sleeping...
Success: the process was restarted. 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 state version_number version mysqld_compatible
mysqld1 online VERSION_NUMBER VERSION no
STOP INSTANCE mysqld2;
Success: the process has been stopped.
...@@ -14,3 +14,47 @@ ...@@ -14,3 +14,47 @@
# process. # process.
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 --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_NUMBER 4 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
...@@ -49,7 +49,7 @@ if [ -z "$pid_path" ]; then ...@@ -49,7 +49,7 @@ if [ -z "$pid_path" ]; then
exit 0 exit 0
fi fi
if [ $expected_result = 'killed' -a ! -r "$pid_path" ]; then if [ ! -r "$pid_path" ]; then
echo "Error: PID file ($pid_path) does not exist." echo "Error: PID file ($pid_path) does not exist."
exit 0 exit 0
fi fi
......
...@@ -38,6 +38,27 @@ ...@@ -38,6 +38,27 @@
#include "thread_registry.h" #include "thread_registry.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 Listener_thread - incapsulates listening functionality
*/ */
...@@ -158,6 +179,8 @@ void Listener_thread::run() ...@@ -158,6 +179,8 @@ void Listener_thread::run()
/* accept may return -1 (failure or spurious wakeup) */ /* accept may return -1 (failure or spurious wakeup) */
if (client_fd >= 0) // connection established if (client_fd >= 0) // connection established
{ {
set_no_inherit(client_fd);
Vio *vio= vio_new(client_fd, socket_index == 0 ? Vio *vio= vio_new(client_fd, socket_index == 0 ?
VIO_TYPE_SOCKET : VIO_TYPE_TCPIP, VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
socket_index == 0 ? 1 : 0); socket_index == 0 ? 1 : 0);
...@@ -199,25 +222,6 @@ void Listener_thread::run() ...@@ -199,25 +222,6 @@ void Listener_thread::run()
return; 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() int Listener_thread::create_tcp_socket()
{ {
/* value to be set by setsockopt */ /* value to be set by setsockopt */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment