mariadb/mysql-test/main/lowercase_fs_on.test
Vladislav Vaintroub 061adae9a2 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.
2024-04-17 16:52:37 +02:00

38 lines
1.1 KiB
Text

#
# Specific tests for case-insensitive file systems
# i.e. lower_case_filesystem=ON
#
-- source include/have_case_insensitive_file_system.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc
--echo #
--echo # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
--echo #
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
--error 0,1
--remove_file $SEARCH_FILE
#Shutdown the server
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
#Start the server with --lower_case_table_names=0 in Windows.
--enable_reconnect
--error 1
--exec $MYSQLD_CMD --lower_case_table_names=0 > $SEARCH_FILE 2>&1
#Search for the error messege in the server error log.
let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names;
--source include/search_pattern_in_file.inc
#Restart the server
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
#Cleanup
--error 0,1
--remove_file $SEARCH_FILE