im_daemon_life_cycle.imtest 3.78 KB
Newer Older
1 2
let $UTIL=$MYSQL_TEST_DIR/suite/im/t;

3 4 5 6 7 8 9 10
###########################################################################
#
# This file contains test for (1.2) test suite.
#
# Consult WL#2789 for more information.
#
###########################################################################

11
--exec $UTIL/log.sh im_daemon_life_cycle im_daemon_life_cycle.imtest started.
12 13 14

###########################################################################

15
--source suite/im/t/im_check_env.inc
16

17
# Turn on reconnect, not on by default anymore.
unknown's avatar
unknown committed
18 19
--enable_reconnect

20 21 22 23 24 25 26 27
###########################################################################
#
# The main daemon-life-cycle test case -- check that IM-angel will restart
# IM-main if it got killed:
#   - kill IM-main and check that IM-angel will restart it;
#   - wait for IM-main to start accepting connections before continue test
#     case;
#
28 29 30 31 32
# NOTE: timeout is 55 seconds. Timeout should be more than shutdown-delay
# specified for managed MySQL instance. Now shutdown-delay is 10 seconds
# (set in mysql-test-run.pl). So, 55 seconds should be enough to make 5
# attempts.
#
33 34
###########################################################################

35
--exec $UTIL/log.sh im_daemon_life_cycle Main-test: starting...
36

37 38
--exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
--exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
39

40 41
--exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
42

43
--exec $UTIL/log.sh im_daemon_life_cycle Main-test: done.
44 45

###########################################################################
46 47
#
# BUG#12751: Instance Manager: client hangs
48 49 50 51
#   - start nonguarded instance (mysqld2);
#   - kill IM-main and get it restarted by IM-angel;
#   - check that guarded instance (mysqld1) is accepting connections.
#   - check that non-guarded instance (mysqld2) were not stopped.
52
#
53
###########################################################################
54 55 56 57 58 59

--echo
--echo --------------------------------------------------------------------
--echo -- Test for BUG#12751
--echo --------------------------------------------------------------------

60
--exec $UTIL/log.sh im_daemon_life_cycle BUG12751: starting...
61 62 63

# 1. Start mysqld;

64
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: starting...
65 66
START INSTANCE mysqld2;

67 68
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to start...
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
69

70
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: started.
71

72
# 2. Restart IM-main;
73

74 75
--exec $UTIL/log.sh im_daemon_life_cycle Killing IM-main...
--exec $UTIL/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
76

77 78
--exec $UTIL/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
--exec $UTIL/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
79 80

# 3. Issue some statement -- connection should be re-established.
81

82
--exec $UTIL/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
83

84
--replace_column 2 STATE 3 VERSION_NUMBER 4 VERSION
85 86 87 88 89 90
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.

91
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopping...
92
STOP INSTANCE mysqld2;
93

94 95 96
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
--exec $UTIL/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
--exec $UTIL/log.sh im_daemon_life_cycle mysqld2: stopped.
97 98 99

###########################################################################

100
--exec $UTIL/log.sh im_daemon_life_cycle BUG12751: done.