mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge from 5.5 main
This commit is contained in:
158
mysql-test/include/check_ftwrl_compatible.inc
Normal file
158
mysql-test/include/check_ftwrl_compatible.inc
Normal file
@ -0,0 +1,158 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check that a statement is compatible with FLUSH TABLES WITH READ LOCK.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $con_aux1 Name of the 1st aux connection to be used by this script.
|
||||
# $con_aux2 Name of the 2nd aux connection to be used by this script.
|
||||
# $statement The statement to be checked.
|
||||
# $cleanup_stmt The statement to be run in order to revert effects of
|
||||
# the statement to be checked.
|
||||
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
|
||||
# stage is to check that metadata locks taken by this
|
||||
# statement are compatible with metadata locks taken
|
||||
# by FTWRL.
|
||||
#
|
||||
# EXAMPLE
|
||||
# flush_read_lock.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
# Reset DEBUG_SYNC facility for safety.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
#
|
||||
# First, check that the statement can be run under FTWRL.
|
||||
#
|
||||
flush tables with read lock;
|
||||
--disable_abort_on_error
|
||||
--eval $statement
|
||||
--enable_abort_on_error
|
||||
let $err= $mysql_errno;
|
||||
if (!$err)
|
||||
{
|
||||
--echo Success: Was able to run '$statement' under FTWRL.
|
||||
unlock tables;
|
||||
if (`SELECT "$cleanup_stmt" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt;
|
||||
}
|
||||
}
|
||||
if ($err)
|
||||
{
|
||||
--echo Error: Wasn't able to run '$statement' under FTWRL!
|
||||
unlock tables;
|
||||
}
|
||||
|
||||
#
|
||||
# Then check that this statement won't be blocked by FTWRL
|
||||
# that is active in another connection.
|
||||
#
|
||||
connection $con_aux1;
|
||||
flush tables with read lock;
|
||||
|
||||
connection default;
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux1;
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where info = "$statement";
|
||||
--source include/wait_condition.inc
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: Was able to run '$statement' with FTWRL active in another connection.
|
||||
|
||||
connection default;
|
||||
# Apparently statement was successfully executed and so
|
||||
# was not blocked by FTWRL.
|
||||
# To be safe against wait_condition.inc succeeding due to
|
||||
# races let us first reap the statement being checked to
|
||||
# ensure that it has been successfully executed.
|
||||
--reap
|
||||
|
||||
connection $con_aux1;
|
||||
unlock tables;
|
||||
|
||||
connection default;
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: Wasn't able to run '$statement' with FTWRL active in another connection!
|
||||
unlock tables;
|
||||
connection default;
|
||||
--reap
|
||||
}
|
||||
|
||||
if (`SELECT "$cleanup_stmt" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt;
|
||||
}
|
||||
|
||||
if (`SELECT "$skip_3rd_check" = ""`)
|
||||
{
|
||||
#
|
||||
# Finally, let us check that FTWRL will succeed if this statement
|
||||
# is active but has already closed its tables.
|
||||
#
|
||||
connection default;
|
||||
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux1;
|
||||
set debug_sync="now WAIT_FOR parked";
|
||||
--send flush tables with read lock
|
||||
|
||||
connection $con_aux2;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where info = "flush tables with read lock";
|
||||
--source include/wait_condition.inc
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: Was able to run FTWRL while '$statement' was active in another connection.
|
||||
connection $con_aux1;
|
||||
# Apparently FTWRL was successfully executed and so was not blocked by
|
||||
# the statement being checked. To be safe against wait_condition.inc
|
||||
# succeeding due to races let us first reap the FTWRL to ensure that it
|
||||
# has been successfully executed.
|
||||
--reap
|
||||
unlock tables;
|
||||
set debug_sync="now SIGNAL go";
|
||||
connection default;
|
||||
--reap
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: Wasn't able to run FTWRL while '$statement' was active in another connection!
|
||||
set debug_sync="now SIGNAL go";
|
||||
connection default;
|
||||
--reap
|
||||
connection $con_aux1;
|
||||
--reap
|
||||
unlock tables;
|
||||
connection default;
|
||||
}
|
||||
|
||||
set debug_sync= "RESET";
|
||||
if (`SELECT "$cleanup_stmt" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
155
mysql-test/include/check_ftwrl_incompatible.inc
Normal file
155
mysql-test/include/check_ftwrl_incompatible.inc
Normal file
@ -0,0 +1,155 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $con_aux1 Name of the 1st aux connection to be used by this script.
|
||||
# $con_aux2 Name of the 2nd aux connection to be used by this script.
|
||||
# $statement The statement to be checked.
|
||||
# $cleanup_stmt1 The 1st statement to be run in order to revert effects
|
||||
# of statement to be checked.
|
||||
# $cleanup_stmt2 The 2nd statement to be run in order to revert effects
|
||||
# of statement to be checked.
|
||||
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
|
||||
# stage is to check that metadata locks taken by this
|
||||
# statement are incompatible with metadata locks taken
|
||||
# by FTWRL.
|
||||
#
|
||||
# EXAMPLE
|
||||
# flush_read_lock.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
# Reset DEBUG_SYNC facility for safety.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
#
|
||||
# First, check that the statement cannot be run under FTWRL.
|
||||
#
|
||||
flush tables with read lock;
|
||||
--disable_abort_on_error
|
||||
--eval $statement
|
||||
--enable_abort_on_error
|
||||
let $err= $mysql_errno;
|
||||
if ($err)
|
||||
{
|
||||
--echo Success: Was not able to run '$statement' under FTWRL.
|
||||
unlock tables;
|
||||
}
|
||||
if (!$err)
|
||||
{
|
||||
--echo Error: Was able to run '$statement' under FTWRL!
|
||||
unlock tables;
|
||||
if (`SELECT "$cleanup_stmt1" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if (`SELECT "$cleanup_stmt2" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Then check that this statement is blocked by FTWRL
|
||||
# that is active in another connection.
|
||||
#
|
||||
connection $con_aux1;
|
||||
flush tables with read lock;
|
||||
|
||||
connection default;
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux1;
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where (state = "Waiting for global read lock" or
|
||||
state = "Waiting for commit lock") and
|
||||
info = "$statement";
|
||||
--source include/wait_condition.inc
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: '$statement' is blocked by FTWRL active in another connection.
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: '$statement' wasn't blocked by FTWRL active in another connection!
|
||||
}
|
||||
unlock tables;
|
||||
|
||||
connection default;
|
||||
--reap
|
||||
|
||||
if (`SELECT "$cleanup_stmt1" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if (`SELECT "$cleanup_stmt2" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
}
|
||||
|
||||
if (`SELECT "$skip_3rd_check" = ""`)
|
||||
{
|
||||
#
|
||||
# Finally, let us check that FTWRL will not succeed if this
|
||||
# statement is active but has already closed its tables.
|
||||
#
|
||||
connection default;
|
||||
--eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux1;
|
||||
set debug_sync="now WAIT_FOR parked";
|
||||
--send flush tables with read lock
|
||||
|
||||
connection $con_aux2;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where (state = "Waiting for global read lock" or
|
||||
state = "Waiting for commit lock") and
|
||||
info = "flush tables with read lock";
|
||||
--source include/wait_condition.inc
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: FTWRL is blocked when '$statement' is active in another connection.
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: FTWRL isn't blocked when '$statement' is active in another connection!
|
||||
}
|
||||
set debug_sync="now SIGNAL go";
|
||||
connection default;
|
||||
--reap
|
||||
connection $con_aux1;
|
||||
--reap
|
||||
unlock tables;
|
||||
connection default;
|
||||
|
||||
set debug_sync= "RESET";
|
||||
|
||||
if (`SELECT "$cleanup_stmt1" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if (`SELECT "$cleanup_stmt2" <> ""`)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
}
|
||||
}
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
@ -1722,6 +1722,21 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#58190 BETWEEN no longer uses indexes for date or datetime fields
|
||||
--echo #
|
||||
SELECT @@collation_connection;
|
||||
CREATE TABLE t1 (
|
||||
id INT(11) DEFAULT NULL,
|
||||
date_column DATE DEFAULT NULL,
|
||||
KEY(date_column));
|
||||
INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01');
|
||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
|
||||
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
|
||||
--echo #
|
||||
|
@ -1545,8 +1545,6 @@ lock table not_exists_write read;
|
||||
--echo # We still have the read lock.
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
drop table t1;
|
||||
handler t1 read next;
|
||||
handler t1 close;
|
||||
handler t1 open;
|
||||
select a from t2;
|
||||
handler t1 read next;
|
||||
|
5
mysql-test/include/have_plugin_interface.inc
Normal file
5
mysql-test/include/have_plugin_interface.inc
Normal file
@ -0,0 +1,5 @@
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
select (PLUGIN_LIBRARY LIKE 'qa_auth_interface%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
|
||||
WHERE PLUGIN_NAME='qa_auth_interface';
|
||||
--enable_query_log
|
5
mysql-test/include/have_plugin_server.inc
Normal file
5
mysql-test/include/have_plugin_server.inc
Normal file
@ -0,0 +1,5 @@
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
select (PLUGIN_LIBRARY LIKE 'qa_auth_server%') as `TRUE` FROM INFORMATION_SCHEMA.PLUGINS
|
||||
WHERE PLUGIN_NAME='qa_auth_server';
|
||||
--enable_query_log
|
@ -16,6 +16,12 @@ CREATE TABLE test_suppressions (
|
||||
-- no invalid patterns can be inserted
|
||||
-- into test_suppressions
|
||||
--
|
||||
SET @character_set_client_saved = @@character_set_client||
|
||||
SET @character_set_results_saved = @@character_set_results||
|
||||
SET @collation_connection_saved = @@collation_connection||
|
||||
SET @@character_set_client = latin1||
|
||||
SET @@character_set_results = latin1||
|
||||
SET @@collation_connection = latin1_swedish_ci||
|
||||
/*!50002
|
||||
CREATE DEFINER=root@localhost TRIGGER ts_insert
|
||||
BEFORE INSERT ON test_suppressions
|
||||
@ -24,6 +30,9 @@ FOR EACH ROW BEGIN
|
||||
SELECT "" REGEXP NEW.pattern INTO dummy;
|
||||
END
|
||||
*/||
|
||||
SET @@character_set_client = @character_set_client_saved||
|
||||
SET @@character_set_results = @character_set_results_saved||
|
||||
SET @@collation_connection = @collation_connection_saved||
|
||||
|
||||
|
||||
--
|
||||
@ -38,6 +47,12 @@ CREATE TABLE global_suppressions (
|
||||
-- no invalid patterns can be inserted
|
||||
-- into global_suppressions
|
||||
--
|
||||
SET @character_set_client_saved = @@character_set_client||
|
||||
SET @character_set_results_saved = @@character_set_results||
|
||||
SET @collation_connection_saved = @@collation_connection||
|
||||
SET @@character_set_client = latin1||
|
||||
SET @@character_set_results = latin1||
|
||||
SET @@collation_connection = latin1_swedish_ci||
|
||||
/*!50002
|
||||
CREATE DEFINER=root@localhost TRIGGER gs_insert
|
||||
BEFORE INSERT ON global_suppressions
|
||||
@ -46,6 +61,9 @@ FOR EACH ROW BEGIN
|
||||
SELECT "" REGEXP NEW.pattern INTO dummy;
|
||||
END
|
||||
*/||
|
||||
SET @@character_set_client = @character_set_client_saved||
|
||||
SET @@character_set_results = @character_set_results_saved||
|
||||
SET @@collation_connection = @collation_connection_saved||
|
||||
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ if ($wait_for_all == 1)
|
||||
|
||||
if (!$found)
|
||||
{
|
||||
echo # Timeout in include/wait_show_condition.inc for $wait_condition;
|
||||
echo # Timeout in include/wait_show_condition.inc for $condition;
|
||||
echo # show_statement : $show_statement;
|
||||
echo # field : $field;
|
||||
echo # condition : $condition;
|
||||
|
Reference in New Issue
Block a user