mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
061adae9a2
On Windows systems, occurrences of ERROR_SHARING_VIOLATION due to conflicting share modes between processes accessing the same file can result in CreateFile failures. mysys' my_open() already incorporates a workaround by implementing wait/retry logic on Windows. But this does not help if files are opened using shell redirection like mysqltest traditionally did it, i.e via --echo exec "some text" > output_file In such cases, it is cmd.exe, that opens the output_file, and it won't do any sharing-violation retries. This commit addresses the issue by introducing a new built-in command, 'write_line', in mysqltest. This new command serves as a brief alternative to 'write_file', with a single line output, that also resolves variables like "exec" would. Internally, this command will use my_open(), and therefore retry-on-error logic. Hopefully this will eliminate the very sporadic "can't open file because it is used by another process" error on CI.
65 lines
2.1 KiB
PHP
65 lines
2.1 KiB
PHP
# ==== Purpose ====
|
|
#
|
|
# Stop the server given by $rpl_server_number.
|
|
#
|
|
# ==== Usage ====
|
|
#
|
|
# --let $rpl_server_number= N
|
|
# [--let $rpl_debug= 1]
|
|
# --source include/rpl_stop_server.inc
|
|
#
|
|
# Parameters:
|
|
#
|
|
# $rpl_server_number
|
|
# Number to identify the server that needs to reconnect. 1 is the
|
|
# master server, 2 the slave server, 3 the 3rd server, and so on.
|
|
# Cf. include/rpl_init.inc
|
|
#
|
|
# $rpl_debug
|
|
# See include/rpl_init.inc
|
|
#
|
|
# ==== See also ====
|
|
#
|
|
# rpl_start_server.inc
|
|
# rpl_restart_server.inc
|
|
|
|
|
|
# Can't use begin_include_file / end_include_file because they require
|
|
# executing on a server and the server will go down after this script.
|
|
if (!$_include_file_depth)
|
|
{
|
|
--echo include/rpl_stop_server.inc [server_number=$rpl_server_number]
|
|
}
|
|
--inc $_include_file_depth
|
|
--let $_rpl_stop_server_old_connection= $CURRENT_CONNECTION
|
|
if ($rpl_debug)
|
|
{
|
|
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
|
|
--echo $_include_file_indent==== BEGIN include/$include_filename ====
|
|
}
|
|
|
|
|
|
--let $rpl_connection_name= server_$rpl_server_number
|
|
--source include/rpl_connection.inc
|
|
|
|
# Write file to make mysql-test-run.pl expect the "crash", but don't start
|
|
# it until it's told to
|
|
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
|
|
|
|
# Send shutdown to the connected server and give
|
|
# it 60 seconds (of mysqltest's default) to die before zapping it
|
|
let $rpl_shutdown_timeout= `select 60*(1+9*count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`;
|
|
|
|
shutdown_server $rpl_shutdown_timeout;
|
|
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
|
|
--let $rpl_connection_name= $_rpl_stop_server_old_connection
|
|
--source include/rpl_connection.inc
|
|
--dec $_include_file_depth
|
|
if ($rpl_debug)
|
|
{
|
|
--echo $_include_file_indent==== END include/rpl_stop_server.inc [server_number=$rpl_server_number] ====
|
|
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
|
|
}
|