mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Remove one of the major sources of race condiitons in mariadb-test. Normally, mariadb_close() sends COM_QUIT to the server and immediately disconnects. In mariadb-test it means the test can switch to another connection and sends queries to the server before the server even started parsing the COM_QUIT packet and these queries can see the connection as fully active, as it didn't reach dispatch_command yet. This is a major source of instability in tests and many - but not all, still less than a half - tests employ workarounds. The correct one is a pair count_sessions.inc/wait_until_count_sessions.inc. Also very popular was wait_until_disconnected.inc, which was completely useless, because it verifies that the connection is closed, and after disconnect it always is, it didn't verify whether the server processed COM_QUIT. Sadly the placebo was as widely used as the real thing. Let's fix this by making mariadb-test `disconnect` command _to wait_ for the server to confirm. This makes almost all workarounds redundant. In some cases count_sessions.inc/wait_until_count_sessions.inc is still needed, though, as only `disconnect` command is changed: * after external tools, like `exec $MYSQL` * after failed `connect` command * replication, after `STOP SLAVE` * Federated/CONNECT/SPIDER/etc after `DROP TABLE` and also in some XA tests, because an XA transaction is dissociated from the THD very late, after the server has closed the client connection. Collateral cleanups: fix comments, remove some redundant statements: * DROP IF EXISTS if nothing is known to exist * DROP table/view before DROP DATABASE * REVOKE privileges before DROP USER etc
116 lines
3.0 KiB
HTML
116 lines
3.0 KiB
HTML
#==============================================================================
|
|
# Set IP address defaults with respect to IPV6 support
|
|
#
|
|
# This file determines the level of support for IPV4, IPV4 mapped or IPV6, then
|
|
# sets the appropriate localhost IP format to use for 'connect()' commands.
|
|
#
|
|
# Input: $my_socket_debug - Print results of IP version check (optional)
|
|
# Output: $my_localhost - Default localhost IP
|
|
#==============================================================================
|
|
|
|
let $check_ipv6_just_check= 1;
|
|
#--source include/check_ipv6.inc
|
|
|
|
#==============================================================================
|
|
# Determine if IPV6 supported
|
|
#
|
|
# Parameters:
|
|
# $check_ipv6_just_check - Don't skip the test if IPv6 is unsupported,
|
|
# just set the variable $check_ipv6_supported
|
|
#==============================================================================
|
|
--disable_query_log
|
|
--disable_result_log
|
|
--disable_connect_log
|
|
--disable_abort_on_error
|
|
|
|
let $check_ipv6_supported= 1;
|
|
|
|
connect (checkcon123456789,::1,root,,test);
|
|
|
|
if($mysql_errno)
|
|
{
|
|
let $check_ipv6_supported=0;
|
|
if(!$check_ipv6_just_check)
|
|
{
|
|
skip No IPv6 support;
|
|
}
|
|
}
|
|
|
|
if(!$mysql_errno)
|
|
{
|
|
disconnect checkcon123456789;
|
|
}
|
|
|
|
connection default;
|
|
|
|
--enable_abort_on_error
|
|
--enable_connect_log
|
|
--enable_result_log
|
|
--enable_query_log
|
|
|
|
#==============================================================================
|
|
#
|
|
# Determine if IPV4 mapped to IPV6 supported
|
|
#
|
|
let $check_ipv4_mapped_just_check= 1;
|
|
#--source include/check_ipv4_mapped.inc
|
|
#==============================================================================
|
|
# Check if ipv4 mapped to ipv6 is available.
|
|
#
|
|
# Parameters:
|
|
# $check_ipv4_mapped_just_check - Don't skip the test if IPv4 mapped is unsupported,
|
|
# just set the variable $check_ipv4_mapped_supported
|
|
#==============================================================================
|
|
--disable_query_log
|
|
--disable_result_log
|
|
--disable_connect_log
|
|
--disable_abort_on_error
|
|
|
|
let $check_ipv4_mapped_supported= 1;
|
|
|
|
connect (checkcon123456789a,::FFFF:127.0.0.1,root,,test);
|
|
|
|
if($mysql_errno)
|
|
{
|
|
let $check_ipv4_mapped_supported=0;
|
|
if(!$check_ipv4_mapped_just_check)
|
|
{
|
|
skip No mapped IPv4 support;
|
|
}
|
|
}
|
|
|
|
if(!$mysql_errno)
|
|
{
|
|
disconnect checkcon123456789a;
|
|
}
|
|
|
|
connection default;
|
|
|
|
--enable_abort_on_error
|
|
--enable_connect_log
|
|
--enable_result_log
|
|
--enable_query_log
|
|
|
|
#==============================================================================
|
|
# Set the localhost IP default to use when establishing connections
|
|
#
|
|
#==============================================================================
|
|
let $my_localhost=127.0.0.1;
|
|
|
|
if($check_ipv6_supported)
|
|
{
|
|
let $my_localhost=::1;
|
|
}
|
|
|
|
if($check_ipv4_mapped_supported)
|
|
{
|
|
let $my_localhost=::ffff:127.0.0.1;
|
|
}
|
|
|
|
if($my_socket_debug)
|
|
{
|
|
--echo IPV6=$check_ipv6_supported, IPV4_MAPPED=$check_ipv4_mapped_supported, LOCALHOST=$my_localhost
|
|
}
|
|
#==============================================================================
|
|
|