3 # Start the server given by $rpl_server_number. This should normally
4 # be invoked after rpl_stop_server.inc.
8 # --let $rpl_server_number= N
9 # [--let $rpl_start_with_gtids= 1]
10 # [--let $rpl_server_parameters= --flag1 --flag2 ...]
11 # [--let $rpl_omit_print_server_parameters= 0]
12 # [--let $rpl_debug_trace= 1]
13 # [--let $rpl_debug= 1]
14 # [--let $rpl_server_error= 0]
15 # --source include/rpl_start_server.inc
20 # Number to identify the server that needs to reconnect. 1 is the
21 # master server, 2 the slave server, 3 the 3rd server, and so on.
22 # Cf. include/rpl_init.inc
24 # $rpl_start_with_gtids
25 # If set, the server will start with GTIDs on, i.e.:
26 # --gtid-mode=on --enforce-gtid-consistency
27 # --log-bin --log-slave-updates
28 # --default-storage-engine=InnoDB --default-tmp-storage-engine=InnoDB
30 # $rpl_server_parameters
31 # If set, extra parameters given by this variable are passed to
34 # $rpl_omit_print_server_parameters
35 # If set, server parameters are not printed.
38 # Start the server with debug traces enabled, as with mtr --debug.
39 # Normally, you can just pass --debug to mtr. However, mtr --debug
40 # will cancel the effect of any --debug parameters specified in
41 # $rpl_server_parameters. If $rpl_server_parameters contains
42 # --debug, set $rpl_debug_trace=1 instead of passing --debug to
46 # See include/rpl_init.inc
49 # If set, failure of the server startup is expected.
54 # rpl_restart_server.inc
57 --let $_rpl_start_server_info= server_number=$rpl_server_number
58 # Actual arguments sent to mysqld
59 --let _RPL_START_SERVER_PARAMETERS= $rpl_server_parameters
61 if ($rpl_start_with_gtids)
63 --let $_rpl_start_server_info= $_rpl_start_server_info gtids=on
64 --let _RPL_START_SERVER_PARAMETERS= $_RPL_START_SERVER_PARAMETERS --log-bin --log-slave-updates --enforce-gtid-consistency --gtid-
mode=on --
default-storage-engine=InnoDB --
default-tmp-storage-engine=InnoDB
66 if ($rpl_server_parameters !=
'')
68 if (!$rpl_omit_print_server_parameters)
70 --let $_rpl_start_server_info= $_rpl_start_server_info parameters: $rpl_server_parameters
75 --echo # debug: rpl_server_number=
'$rpl_server_number' rpl_start_with_gtids=
'$rpl_start_with_gtids' rpl_server_parameters=
'$rpl_server_parameters' _RPL_START_SERVER_PARAMETERS=
'$_RPL_START_SERVER_PARAMETERS'
78 --let $include_filename= rpl_start_server.inc [$_rpl_start_server_info]
79 --source include/begin_include_file.inc
81 --let $rpl_connection_name= server_$rpl_server_number
82 --source include/rpl_connection.inc
84 --let _RPL_DEBUG_TRACE= $rpl_debug_trace
85 --let _RPL_SERVER_NUMBER= $rpl_server_number
86 --let _RPL_DEBUG= $rpl_debug
88 # Write file to make mysql-test-run.pl start up the server again
89 # Because mysqltest is such a wonderful language, we use perl instead.
91 my $vardir= $ENV{
'MYSQLTEST_VARDIR'};
92 my $params= $ENV{
'_RPL_START_SERVER_PARAMETERS'};
93 my $server_number= $ENV{
'_RPL_SERVER_NUMBER'};
94 my $trace_file=
"$vardir/log/mysqld.$server_number.trace";
95 my $expect_file=
"$vardir/tmp/mysqld.$server_number.expect";
96 if ($ENV{
'_RPL_DEBUG_TRACE'})
98 my $flags=
"d:i:a$trace_file:t";
99 ($params =~ s/(?<=--debug=)/$flags:/) or ($params .=
" --debug=$flags");
101 if ($ENV{
'_RPL_DEBUG'})
103 print
"# debug: params='$params'\n";
106 open FILE,
">> $trace_file" or die
"Error opening trace file '$trace_file': $!";
107 print FILE
"\n======== SERVER START \[" . scalar(localtime()) .
"\] ========\n"
108 or die
"Error printing to trace file '$trace_file': $!";
109 close FILE or die
"Error closing trace file '$trace_file': $!";
111 open FILE,
"> $expect_file" or die
"Error opening $expect_file: $!";
112 print FILE ($params eq
'' ?
'restart' :
"restart:$params")
113 or die
"Error printing to $expect_file: $!";
114 close FILE or die
"Error closing $expect_file: $!";
117 #--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
119 if (!$rpl_server_error)
121 --source include/rpl_reconnect.inc
123 --let $include_filename= rpl_start_server.inc [$_rpl_start_server_info]
124 --source include/end_include_file.inc