Commit 061adae9 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-16944 Fix file sharing issues on Windows in mysqltest

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.
parent b48de973
......@@ -398,7 +398,7 @@ enum enum_commands {
Q_IF,
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_WRITE_FILE, Q_WRITE_LINE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
......@@ -501,6 +501,7 @@ const char *command_names[]=
"remove_file",
"file_exists",
"write_file",
"write_line",
"copy_file",
"perl",
"die",
......@@ -4302,6 +4303,49 @@ void do_write_file(struct st_command *command)
do_write_file_command(command, FALSE);
}
/**
Write a line to the start of the file.
Truncates existing file, creates new one if it doesn't exist.
Usage
write_line <line> <filename>;
Example
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@note Both the file and the line parameters are evaluated
(can be variables).
@note This is a better alternative to
exec echo > file, as it doesn't depend on shell,
and can better handle sporadic file access errors caused
by antivirus or backup software on Windows.
*/
void do_write_line(struct st_command *command)
{
DYNAMIC_STRING ds_line;
DYNAMIC_STRING ds_filename;
struct command_arg write_line_args[] = {
{ "line", ARG_STRING, FALSE, &ds_line, "line to add" },
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to write to" },
};
DBUG_ENTER("do_write_line");
check_command_args(command,
command->first_argument,
write_line_args,
sizeof(write_line_args)/sizeof(struct command_arg),
' ');
if (bad_path(ds_filename.str))
DBUG_VOID_RETURN;
dynstr_append_mem(&ds_line, "\n", 1);
str_to_file2(ds_filename.str, ds_line.str, ds_line.length, FALSE);
dynstr_free(&ds_filename);
dynstr_free(&ds_line);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
......@@ -7423,7 +7467,7 @@ void str_to_file2(const char *fname, char *str, size_t size, my_bool append)
die("Could not open '%s' for writing, errno: %d", buff, errno);
if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)
die("Could not find end of file '%s', errno: %d", buff, errno);
if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
if (size > 0 && my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed, errno: %d", errno);
my_close(fd, MYF(0));
}
......@@ -10160,6 +10204,7 @@ int main(int argc, char **argv)
break;
case Q_FILE_EXIST: do_file_exist(command); break;
case Q_WRITE_FILE: do_write_file(command); break;
case Q_WRITE_LINE: do_write_line(command); break;
case Q_APPEND_FILE: do_append_file(command); break;
case Q_DIFF_FILES: do_diff_files(command); break;
case Q_SEND_QUIT: do_send_quit(command); break;
......
......@@ -4,7 +4,7 @@
--source include/not_embedded.inc
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Setup the mysqld to crash at shutdown
SET debug_dbug="d,crash_shutdown";
......
......@@ -2,4 +2,4 @@
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
# There should be a debug crash after using this .inc file
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
......@@ -7,7 +7,7 @@ if (!$restart_parameters)
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--echo # Kill and $restart_parameters
--exec echo "$restart_parameters" > $_expect_file_name
--write_line "$restart_parameters" $_expect_file_name
--shutdown_server 0
--source include/wait_until_disconnected.inc
--enable_reconnect
......
......@@ -3,7 +3,7 @@
# Write file to make mysql-test-run.pl expect the crash, but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
# Kill the connected server
--disable_reconnect
......
......@@ -2,6 +2,6 @@
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--echo # Kill the server
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
--shutdown_server 0
--source include/wait_until_disconnected.inc
......@@ -49,7 +49,7 @@ if ($rpl_server_parameters)
--source include/rpl_connection.inc
# Write file to make mysql-test-run.pl start up the server again
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
if (!$rpl_server_error)
{
......
......@@ -44,7 +44,7 @@ if ($rpl_debug)
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--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
......
......@@ -38,7 +38,7 @@
# let SEARCH_FILE= $error_log;
# # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file
# --write_line wait $restart_file
# --shutdown_server
# --source include/wait_until_disconnected.inc
#
......
......@@ -24,7 +24,7 @@ if ($rpl_inited)
# Write file to make mysql-test-run.pl expect the "crash", but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
# Avoid warnings from connection threads that does not have time to exit
--disable_query_log
......
......@@ -21,7 +21,7 @@ if ($restart_bindir)
if ($restart_parameters)
{
--exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name
--write_line "$restart_cmd: $restart_parameters" $_expect_file_name
if (!$restart_noprint)
{
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
......@@ -34,7 +34,7 @@ if ($restart_parameters)
}
if (!$restart_parameters)
{
--exec echo "$restart_cmd" > $_expect_file_name
--write_line "$restart_cmd" $_expect_file_name
if ($restart_noprint < 2)
{
--exec echo "# $restart_cmd"
......
......@@ -17,7 +17,7 @@ insert into t1 values(9);
SET GLOBAL debug_dbug="d,crash_commit_before";
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Run the crashing query
--error 2013
......
......@@ -3,10 +3,10 @@
#
--source include/not_embedded.inc
create server '' foreign data wrapper w2 options (host '127.0.0.1');
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
......
......@@ -43,10 +43,10 @@ select @@global.Host_Cache_Size > 0;
--echo # Restart server with Host_Cache_Size 1
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--shutdown_server
--source include/wait_until_disconnected.inc
-- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--host_cache_size=1 " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
......@@ -142,10 +142,10 @@ SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
#--remove_file $MYSQL_TMP_DIR/bind_ip
#let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
#--exec echo "wait" > $restart_file
#--write_line wait $restart_file
#--shutdown_server
#--source include/wait_until_disconnected.inc
#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#-- write_line "restart:--bind-address=$bind_ip " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#-- enable_reconnect
#-- source include/wait_until_connected_again.inc
......
......@@ -15,12 +15,12 @@ EOF
--enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--init-file=$MYSQLTEST_VARDIR/init.file " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
......
......@@ -30,12 +30,12 @@
--echo # Case 2: Starting server with fifo file as general log file
--echo # and slow query log file.
# Restart server with fifo file as general log file.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
# Error 6 is reported, because the other end is closed
......
......@@ -16,7 +16,7 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
--remove_file $SEARCH_FILE
#Shutdown the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -30,7 +30,7 @@ let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is co
--source include/search_pattern_in_file.inc
#Restart the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
#Cleanup
......
......@@ -26,14 +26,14 @@ INSERT INTO t1 VALUES (1,2),(2,3),(3,4),(4,5),(5,6);
SET SESSION debug_dbug="d,crash_before_flush_keys";
--echo # Write file to make mysql-test-run.pl expect crash
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo # Run the crashing query
--error 2013
FLUSH TABLE t1;
--echo # Write file to make mysql-test-run.pl start the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo # Turn on reconnect
--enable_reconnect
......
......@@ -25,7 +25,7 @@ call mtr.add_suppression(" IP address .* could not be resolved");
# server or run mysql-test-run --debug mysql_client_test and check
# var/log/mysql_client_test.trace
--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
--write_line "$MYSQL_CLIENT_TEST" $MYSQLTEST_VARDIR/log/mysql_client_test.out.log
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
# End of 4.1 tests
......
......@@ -12,7 +12,7 @@ SET @old_slow_query_log= @@global.slow_query_log;
call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
call mtr.add_suppression(" IP address .* could not be resolved");
--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1
--write_line "$MYSQL_CLIENT_TEST" $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1
# End of test
......
......@@ -19,7 +19,7 @@ call mtr.add_suppression(" IP address .* could not be resolved");
# server or run mysql-test-run --debug mysql_client_test and check
# var/log/mysql_client_test.trace
--exec echo "$MYSQL_CLIENT_TEST --non-blocking-api" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---write_line "$MYSQL_CLIENT_TEST --non-blocking-api" $MYSQLTEST_VARDIR/log/mysql_client_test.out.log
--exec $MYSQL_CLIENT_TEST --non-blocking-api --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
# End of 4.1 tests
......
......@@ -68,7 +68,7 @@ drop table t1;
# Test that we can't open connection to server if we are using
# a different cacert
#
--exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql
--write_line "this query should not execute;" $MYSQLTEST_VARDIR/tmp/test.sql
# Handle that openssl gives different error messages from YaSSL.
--replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/
--error 1
......
......@@ -13,14 +13,14 @@ FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb';
--echo #
--echo # MDEV-6351 --plugin=force has no effect for built-in plugins
--echo #
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--error 1
--exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 --disable-log-error
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
......@@ -20,13 +20,13 @@ drop procedure try_shutdown;
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
--send shutdown
--connection default
--source include/wait_until_disconnected.inc
--exec echo "restart" > $_expect_file_name
--write_line restart $_expect_file_name
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -98,7 +98,7 @@ reset master;
--echo # crash_purge_before_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_purge_before_update_index";
--source include/wait_for_binlog_checkpoint.inc
--error 2013
......@@ -119,7 +119,7 @@ SELECT @index;
--echo # crash_purge_non_critical_after_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index";
--source include/wait_for_binlog_checkpoint.inc
--error 2013
......@@ -143,7 +143,7 @@ SELECT @index;
--echo # crash_purge_critical_after_update_index
flush logs;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index";
--source include/wait_for_binlog_checkpoint.inc
--error 2013
......@@ -167,7 +167,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000008;
SELECT @index;
--echo # crash_create_non_critical_before_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index";
--error 2013
flush logs;
......@@ -185,7 +185,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000009;
SELECT @index;
--echo # crash_create_critical_before_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
--error 2013
flush logs;
......@@ -205,7 +205,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000011;
SELECT @index;
--echo # crash_create_after_update_index
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET SESSION debug_dbug="+d,crash_create_after_update_index";
--error 2013
flush logs;
......
......@@ -26,10 +26,10 @@
ALTER TABLE mysql.gtid_slave_pos ENGINE=innodb;
--echo # Restart the server so mysqld reads the gtid_slave_pos using innodb
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -68,10 +68,10 @@ while ($loop_times) {
# try to change the log-bin configs and restart
--echo # ======= now try to change the log-bin config for mysqld =======
--let $restart_parameters="--log-bin=new_log_bin"
--let $restart_parameters=--log-bin=new_log_bin
--echo #begin to restart mysqld
--source include/restart_mysqld.inc
--let $restart_parameters= ""
--let $restart_parameters=
--source include/show_binary_logs.inc
let $loop_times= 10;
......
......@@ -20,7 +20,7 @@
--connection $_cur_con
--enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
shutdown_server;
......@@ -31,5 +31,5 @@ if ($rpl_server_parameters)
{
--let $_rpl_start_server_command= restart:$rpl_server_parameters
}
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--source include/wait_until_connected_again.inc
......@@ -16,7 +16,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau
--let $MYSQLD_DATADIR = `SELECT @@datadir`
--let SEARCH_RANGE = 10000000
--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -25,7 +25,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau
4;770A8A65DA156D24EE2A093277530143
EOF
--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......@@ -47,7 +47,7 @@ UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -62,7 +62,7 @@ ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--source include/restart_mysqld.inc
......@@ -80,7 +80,7 @@ SELECT * FROM t1;
-- let SEARCH_FILE=$t1_IBD
-- source include/search_pattern_in_file.inc
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--remove_file $MYSQLTEST_VARDIR/keys1.txt
......@@ -89,7 +89,7 @@ SELECT * FROM t1;
4;770A8A65DA156D24EE2A093277530143
EOF
--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
DROP TABLE t1;
......
......@@ -20,7 +20,7 @@ CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
CREATE TABLE t2 (f1 int not null)engine=innodb;
let $restart_parameters="--debug=d,ib_log_checkpoint_avoid";
let $restart_parameters=--debug=d,ib_log_checkpoint_avoid;
--source include/restart_mysqld.inc
# Stop the purge
......
......@@ -8,7 +8,7 @@ if (!$kill_signal)
# Write file to make mysql-test-run.pl expect the crash, but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
# Kill the connected server
--disable_reconnect
......
......@@ -4,12 +4,12 @@
if ($galera_wsrep_start_position != '') {
--echo Using --wsrep-start-position when starting mysqld ...
--exec echo "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" > $_expect_file_name
--write_line "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" $_expect_file_name
--let $galera_wsrep_start_position = 0
}
if ($galera_wsrep_start_position == '') {
--exec echo "restart:$start_mysqld_params" > $_expect_file_name
--write_line "restart:$start_mysqld_params" $_expect_file_name
}
--source include/galera_wait_ready.inc
......@@ -37,7 +37,7 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
# Write file to make mysql-test-run.pl expect the crash, but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
--let KILL_NODE_PIDFILE = `SELECT @@pid_file`
......
......@@ -27,8 +27,8 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 1 FROM t1;
--let $NODE_2_PIDFILE = `SELECT @@pid_file`
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--exec kill -9 `cat $NODE_1_PIDFILE` `cat $NODE_2_PIDFILE`
# Perform --wsrep-recover and preserve the positions into variables by placing them in $MYSQL_TMP_DIR/galera_wsrep_start_position.inc and then --source'ing it
......@@ -66,8 +66,8 @@ if ($galera_wsrep_start_position2 == '') {
# Instruct MTR to perform the actual restart using --wsrep-start-position . Proper --wsrep_cluster_address is used as my.cnf only contains 'gcomm://' for node #1
--exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position1 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position2 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line "restart: --wsrep-start-position=$galera_wsrep_start_position1 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart: --wsrep-start-position=$galera_wsrep_start_position2 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--sleep 5
--connection node_1
......
......@@ -62,7 +62,7 @@ SELECT * FROM t1;
--let $start_mysqld_params=--galera-unknown-option
--echo Starting server ...
--exec echo "try:$start_mysqld_params" > $_expect_file_name
--write_line "try:$start_mysqld_params" $_expect_file_name
# Sleep to ensure that server exited...
......@@ -107,7 +107,7 @@ SELECT * FROM t1;
--let $start_mysqld_params=--galera-unknown-option
--echo Starting server ...
--exec echo "try:$start_mysqld_params" > $_expect_file_name
--write_line "try:$start_mysqld_params" $_expect_file_name
# Sleep to ensure that server exited...
......
......@@ -36,7 +36,7 @@ SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
# Restart without waiting. The UPDATE should block FTWRL on node_1,
# so the SST cannot be completed and node_2 cannot join before
# UPDATE connection is signalled to continue.
--exec echo "restart:$start_mysqld_params" > $_expect_file_name
--write_line "restart:$start_mysqld_params" $_expect_file_name
# If the bug is present, FTWRL times out on node_1 in couple of
# seconds and node_2 fails to join.
--sleep 10
......
......@@ -17,7 +17,7 @@ SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal";
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB;
......
......@@ -70,7 +70,7 @@ let $orig_table_id = `SELECT table_id
WHERE name = 'test/t1'`;
# Write file to make mysql-test-run.pl expect crash
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
......@@ -123,7 +123,7 @@ let $orig_table_id = `SELECT table_id
WHERE name = 'test/t2'`;
# Write file to make mysql-test-run.pl expect crash
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
......@@ -165,7 +165,7 @@ let $orig_table_id = `select table_id from
information_schema.innodb_sys_tables where name = 'test/t1'`;
# Write file to make mysql-test-run.pl expect crash
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#
--error 2013
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE;
......
......@@ -18,7 +18,7 @@ INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
--echo #
--echo # Create a file called MYSQLD_DATADIR/test/t1.ibd
--exec echo "This is not t1.ibd" > $MYSQLD_DATADIR/test/t1.ibd
--write_line "This is not t1.ibd" $MYSQLD_DATADIR/test/t1.ibd
--echo # Directory listing of test/*.ibd
--echo #
......
......@@ -45,7 +45,7 @@ commit work;
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
let $shutdown_timeout=;
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
......@@ -95,7 +95,7 @@ select f1, f2 from t1;
--echo # Test Begin: Test if recovery works if 1st page of
--echo # system tablespace is corrupted and 2nd page as corrupted.
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
......
......@@ -51,7 +51,7 @@ while ($numtests)
START TRANSACTION;
insert into t1 select * from t2;
# Write file to make mysql-test-run.pl expect crash
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
eval call setcrash($numtests);
......
......@@ -51,7 +51,7 @@ while ($numtests)
START TRANSACTION;
insert into t1 select * from t2;
# Write file to make mysql-test-run.pl expect crash
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
eval call setcrash($numtests);
......
......@@ -35,7 +35,7 @@ let datadir= `select @@datadir`;
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
SET debug_dbug='+d,innodb_alter_commit_crash_before_commit';
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
......
......@@ -51,7 +51,7 @@ DELETE FROM t1 WHERE a=1;
INSERT INTO t1 VALUES(1,'X',1);
SET DEBUG_DBUG='+d,crash_after_log_ibuf_upd_inplace';
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
--error 2013
# This should force a change buffer merge
SELECT b FROM t1 LIMIT 3;
......
......@@ -23,14 +23,14 @@ alter table t1 add primary key (pk);
--echo # Stop the server, replace the frm with the old one and restart the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--remove_file $datadir/test/t1.frm
--copy_file $MYSQLTEST_VARDIR/tmp/t1.frm $datadir/test/t1.frm
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -41,7 +41,7 @@ INSERT INTO t1 VALUES(1),(2),(3);
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo wait > $_expect_file_name
--write_line wait $_expect_file_name
SET SESSION debug_dbug="+d,ib_discard_before_commit_crash";
--error 2013
ALTER TABLE t1 DISCARD TABLESPACE;
......@@ -55,7 +55,7 @@ SET GLOBAL innodb_file_per_table = 1;
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1),(2),(3);
--exec echo wait > $_expect_file_name
--write_line wait $_expect_file_name
SET SESSION debug_dbug="+d,ib_discard_after_commit_crash";
--error 2013
ALTER TABLE t1 DISCARD TABLESPACE;
......@@ -99,7 +99,7 @@ EOF
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
--exec echo wait > $_expect_file_name
--write_line wait $_expect_file_name
SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
--error 2013
ALTER TABLE t1 IMPORT TABLESPACE;
......
......@@ -58,7 +58,7 @@ SELECT * FROM bug_60196;
--echo # Restart server.
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Turn on reconnect
--enable_reconnect
......@@ -132,7 +132,7 @@ SELECT * FROM Bug_60309;
--echo # Restart server.
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Turn on reconnect
--enable_reconnect
......
......@@ -205,7 +205,7 @@ print FILE "\0" x 16384;
close(FILE);
EOF
--exec echo "" > $MYSQLD_DATADIR/test/u2.ibd
--write_line "" $MYSQLD_DATADIR/test/u2.ibd
# TODO: Test with this, once
# Bug#18131883 IMPROVE INNODB ERROR MESSAGES REGARDING FILES
......
......@@ -135,7 +135,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
# We cannot use include/restart_mysqld.inc in this particular test,
# because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir.
--source include/shutdown_mysqld.inc
--exec echo "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" > $_expect_file_name
--write_line "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" $_expect_file_name
--enable_reconnect
--disable_result_log
--disable_query_log
......
......@@ -12,7 +12,7 @@ insert into t1 values (1, 1);
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
let $shutdown_timeout=;
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
......
......@@ -115,7 +115,7 @@ CREATE TABLE t1 (
INSERT INTO t1(title) VALUES('database');
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash';
......
......@@ -463,7 +463,7 @@ rollback;
# Test partial update rollback after recovered.
# Crash the server in partial update.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
set session debug="+d,row_mysql_crash_if_error";
--error 2013
update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3;
......
......@@ -426,13 +426,13 @@ SHOW CREATE TABLE t77_restart;
--echo # Moving tablespace 't4_restart' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_DATA_DIR/test/t4_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t4_restart.ibd
--exec echo $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd > $MYSQL_DATA_DIR/test/t4_restart.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd $MYSQL_DATA_DIR/test/t4_restart.isl
--echo # Moving tablespace 't55_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
--remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd > $MYSQL_DATA_DIR/test/t55_restart.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd $MYSQL_DATA_DIR/test/t55_restart.isl
--echo # Moving tablespace 't66_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd
......@@ -444,9 +444,9 @@ SHOW CREATE TABLE t77_restart;
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
--echo # Moving tablespace 't77_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd
......@@ -461,10 +461,10 @@ SHOW CREATE TABLE t77_restart;
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
--echo ---- MYSQL_DATA_DIR/test
--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
......
......@@ -73,7 +73,7 @@ SET SESSION debug_dbug="+d,ib_import_before_commit_crash";
SELECT * FROM t1;
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
......@@ -94,7 +94,7 @@ SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash";
SELECT COUNT(*) FROM t1;
# Don't start up the server right away.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Execute the statement that causes the crash
--error 2013
......@@ -111,7 +111,7 @@ EOF
--echo # Restart and reconnect to the server
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
......
......@@ -15,7 +15,7 @@ DROP PROCEDURE IF EXISTS proc_insert_many;
# --------
# Configure encryption
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -23,7 +23,7 @@ DROP PROCEDURE IF EXISTS proc_insert_many;
1;76025E3ADC78D74819927DB02AAA4C35
EOF
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......@@ -75,7 +75,7 @@ CALL proc_insert_many();
UNLOCK TABLES;
# Crash and restart the server while it's still flushing index
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET debug_dbug="d,crash_shutdown";
--error 2013
shutdown;
......
......@@ -12,7 +12,7 @@
#
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
create table t1 (a int primary key, b int, c int, unique key(b), key(c)) engine=aria transactional=1;
insert into t1 values (1000,1000,1000);
......
......@@ -26,10 +26,10 @@ CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=Aria;
--echo # Restart with encryption enabled
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......@@ -40,10 +40,10 @@ LOAD INDEX INTO CACHE t1;
# Restart without encryption. Above table should be unreadable
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--aria-encrypt-tables=0" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=0" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -9,7 +9,7 @@ call mtr.add_suppression("System key id 1 is missing");
call mtr.add_suppression("Unknown key id 1");
call mtr.add_suppression("Initialization of encryption failed.*");
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -17,14 +17,14 @@ call mtr.add_suppression("Initialization of encryption failed.*");
1;770A8A65DA156D24EE2A093277530142
EOF
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=Aria;
INSERT INTO t1 VALUES (1);
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
......@@ -32,7 +32,7 @@ INSERT INTO t1 VALUES (1);
2;770A8A65DA156D24EE2A093277530143
EOF
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......@@ -43,11 +43,11 @@ repair table t1;
--error HA_ERR_NO_ENCRYPTION
INSERT INTO t1 VALUES (2);
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -12,7 +12,7 @@
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--disable_reconnect
# CR_SERVER_LOST
--error 2013
......@@ -23,7 +23,7 @@ SELECT * FROM t1;
--replace_regex /sql-exchange.*\./sql-exchange./ /sql-shadow-[0-9a-f]*-/sql-shadow-/ /#sql-ib[1-9][0-9]*\.ibd\n//
--cat_file $DATADIR.files.txt
--remove_file $DATADIR.files.txt
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # State after crash recovery
......
......@@ -13,7 +13,7 @@ let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
let SEARCH_FILE= $error_log;
# Stop the server
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--shutdown_server
--source include/wait_until_disconnected.inc
--error 7
......@@ -61,7 +61,7 @@ let SEARCH_PATTERN= Can.t change dir to .*bad_option_h_param;
--remove_file $error_log
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $restart_file
--write_line restart $restart_file
# Turn on reconnect
--enable_reconnect
......
......@@ -23,7 +23,7 @@ DROP TABLE performance_schema.processlist;
SHOW CREATE TABLE performance_schema.processlist;
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--echo ##
--echo ## Server shutdown
--echo ##
......@@ -93,7 +93,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--error ER_BAD_FIELD_ERROR
SHOW PROCESSLIST;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--echo ##
--echo ## Server shutdown
--echo ##
......@@ -166,7 +166,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
# Works and returns no data, innodb table is empty.
SHOW PROCESSLIST;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--echo ##
--echo ## Server shutdown
--echo ##
......@@ -231,7 +231,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
# Works and returns no data, innodb table is empty.
SHOW PROCESSLIST;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--echo ##
--echo ## Server shutdown
--echo ##
......@@ -306,7 +306,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 3 [HOST:PORT] 6 [TIME]
SHOW PROCESSLIST;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--echo ##
--echo ## Server shutdown
--echo ##
......
......@@ -69,7 +69,7 @@ SELECT * FROM performance_schema.setup_instruments
WHERE name like "%wait/io/table/sql/handler%";
# Write file to make mysql-test-run.pl wait for the server to stop
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Restart the server
--echo #
......@@ -79,7 +79,7 @@ WHERE name like "%wait/io/table/sql/handler%";
--echo # Restart server with wait/io/table/sql/handler disabled
--exec echo "restart:--loose-performance-schema-instrument=%wait/io/table/sql/%=off" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line "restart:--loose-performance-schema-instrument=%wait/io/table/sql/%=off" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Turn on reconnect
--echo # Enable reconnect
......
......@@ -19,10 +19,10 @@
--source include/have_perfschema.inc
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--write_line wait $restart_file
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360">$restart_file
--write_line "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360" $restart_file
--enable_reconnect
--source include/wait_until_connected_again.inc
......
......@@ -39,7 +39,7 @@ insert into ti set a=null;
insert into tm set a=null;
set @@global.debug_dbug="+d,crash_before_send_xid";
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
connection slave;
let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
......@@ -61,7 +61,7 @@ connection master;
--enable_reconnect
--let $rpl_server_number=1
--source include/rpl_start_server.inc
#--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--echo # Master has restarted successfully
save_master_pos;
......
......@@ -47,7 +47,7 @@ RESET SLAVE;
--echo #
--let $datadir = `select @@datadir`
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
......@@ -64,7 +64,7 @@ RESET SLAVE;
--echo # Restart slave server
--echo #
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
......
......@@ -82,7 +82,7 @@ print FILE "failure";
close ($file);
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;
......@@ -130,7 +130,7 @@ print FILE @content;
close FILE;
EOF
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
SET SESSION debug_dbug="d,crash_before_rotate_relaylog";
--error 2013
FLUSH LOGS;
......
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