初版
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# Allow anonymous users to connect
|
||||
disable_warnings;
|
||||
disable_query_log;
|
||||
INSERT INTO mysql.user (host, user) VALUES ('localhost','');
|
||||
FLUSH PRIVILEGES;
|
||||
enable_query_log;
|
||||
enable_warnings;
|
||||
@@ -0,0 +1,9 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# This is an auxiliary file that mysqltest executes when
|
||||
# sync_slave_with_master or sync_with_master fails. The purpose is to
|
||||
# print debug information.
|
||||
|
||||
--let $rpl_server_count= 0
|
||||
--let $rpl_only_current_connection= 1
|
||||
--source include/show_rpl_debug_info.inc
|
||||
3
build/lib/mysql/mysql-test/include/analyze-timeout.test
Normal file
3
build/lib/mysql/mysql-test/include/analyze-timeout.test
Normal file
@@ -0,0 +1,3 @@
|
||||
SHOW PROCESSLIST;
|
||||
|
||||
exit;
|
||||
175
build/lib/mysql/mysql-test/include/assert.inc
Normal file
175
build/lib/mysql/mysql-test/include/assert.inc
Normal file
@@ -0,0 +1,175 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Check if a condition holds, fail with debug info if not.
|
||||
#
|
||||
# The condition is parsed before executed. The following constructs
|
||||
# are supported:
|
||||
#
|
||||
# [SQL_STATEMENT, COLUMN, ROW]
|
||||
# The square bracket is replaced by the result from SQL_STATEMENT,
|
||||
# in the given COLUMN and ROW.
|
||||
#
|
||||
# Optionally, SQL_STATEMENT may have the form:
|
||||
# connection:SQL_STATEMENT
|
||||
# In this case, SQL_STATEMENT is executed on the named connection.
|
||||
# All other queries executed by this script will be executed on
|
||||
# the connection that was in use when this script was started.
|
||||
# The current connection will also be restored at the end of this
|
||||
# script.
|
||||
#
|
||||
# Nested sub-statements on this form are not allowed.
|
||||
#
|
||||
# <1>
|
||||
# This is a shorthand for the result of the first executed square
|
||||
# bracket. <2> is a shorthand for the second executed square
|
||||
# bracket, and so on.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $assert_text= Relay_Log_Pos must be between min_pos and max_pos
|
||||
# --let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] >= $min_pos AND <1> <= $max_pos
|
||||
# [--let $assert_quiet= 1]
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/assert.inc
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# $assert_text
|
||||
# Text that describes what is being checked. This text is written to
|
||||
# the query log so it should not contain non-deterministic elements.
|
||||
#
|
||||
# $assert_cond
|
||||
# Condition to check. See above for details about the format. The
|
||||
# condition will be executed as `SELECT $assert_cond`.
|
||||
#
|
||||
# Both $assert_cond and the result from any substatement on the
|
||||
# form [SQL_STATEMENT, COLUMN, ROW] will be used in SQL statements,
|
||||
# inside single quotes (as in '$assert_text'). So any single quotes
|
||||
# in these texts must be escaped or replaced by double quotes.
|
||||
#
|
||||
# $rpl_debug
|
||||
# Print extra debug info.
|
||||
|
||||
|
||||
--let $include_filename= assert.inc [$assert_text]
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: assert_text='$assert_text' assert_cond='$assert_cond'
|
||||
}
|
||||
|
||||
# Sanity-check input
|
||||
if (!$assert_text)
|
||||
{
|
||||
--die ERROR IN TEST: the mysqltest variable rpl_test must be set
|
||||
}
|
||||
|
||||
--let $_assert_old_connection= $CURRENT_CONNECTION
|
||||
|
||||
# Evaluate square brackets in cond.
|
||||
--let $_assert_substmt_number= 1
|
||||
--let $_assert_cond_interp= '$assert_cond'
|
||||
--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)`
|
||||
while ($_assert_lbracket)
|
||||
{
|
||||
# Get position of right bracket
|
||||
--let $_assert_rbracket= `SELECT LOCATE(']', $_assert_cond_interp)`
|
||||
if (!$_assert_rbracket)
|
||||
{
|
||||
--echo BUG IN TEST: Mismatching square brackets in assert_cond.
|
||||
--echo Original assert_cond='$assert_cond'
|
||||
--echo Interpolated assert_cond=$_assert_cond_interp
|
||||
--die BUG IN TEST: Mismatching square brackets in $assert_cond
|
||||
}
|
||||
|
||||
# Get sub-statement from statement. Preserve escapes for single quotes.
|
||||
--let $_assert_full_substmt= `SELECT QUOTE(SUBSTRING($_assert_cond_interp, $_assert_lbracket + 1, $_assert_rbracket - $_assert_lbracket - 1))`
|
||||
|
||||
# Get connection from sub-statement
|
||||
--let $_assert_colon= `SELECT IF($_assert_full_substmt REGEXP '^[a-zA-Z_][a-zA-Z_0-9]*:', LOCATE(':', $_assert_full_substmt), 0)`
|
||||
--let $_assert_connection=
|
||||
--let $_assert_substmt= $_assert_full_substmt
|
||||
if ($_assert_colon)
|
||||
{
|
||||
--let $_assert_connection= `SELECT SUBSTRING($_assert_substmt, 1, $_assert_colon - 1)`
|
||||
# Preserve escapes for single quotes.
|
||||
--let $_assert_substmt= `SELECT QUOTE(SUBSTRING($_assert_substmt, $_assert_colon + 1))`
|
||||
}
|
||||
|
||||
# Interpolate escapes before using condition outside string context.
|
||||
--let $_assert_substmt_interp= `SELECT $_assert_substmt`
|
||||
|
||||
# Execute and get result from sub-statement
|
||||
if ($_assert_connection)
|
||||
{
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: connection='$_assert_connection' sub-statement=$_assert_substmt
|
||||
}
|
||||
--let $rpl_connection_name= $_assert_connection
|
||||
--source include/rpl_connection.inc
|
||||
--let $_assert_substmt_result= query_get_value($_assert_substmt_interp)
|
||||
--let $rpl_connection_name= $_assert_old_connection
|
||||
--source include/rpl_connection.inc
|
||||
}
|
||||
if (!$_assert_connection)
|
||||
{
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: old connection, sub-statement=$_assert_substmt
|
||||
}
|
||||
--let $_assert_substmt_result= query_get_value($_assert_substmt_interp)
|
||||
}
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: result of sub-statement='$_assert_substmt_result'
|
||||
}
|
||||
|
||||
# Replace sub-statement by its result
|
||||
--let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, CONCAT('[', $_assert_full_substmt, ']'), '$_assert_substmt_result'))`
|
||||
# Replace result references by result
|
||||
--let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, '<$_assert_substmt_number>', '$_assert_substmt_result'))`
|
||||
|
||||
--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)`
|
||||
|
||||
--inc $_assert_substmt_number
|
||||
}
|
||||
|
||||
# Interpolate escapes before using condition outside string context.
|
||||
--let $_assert_cond_interp= `SELECT $_assert_cond_interp`
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: interpolated_cond='$_assert_cond_interp'
|
||||
}
|
||||
|
||||
# Execute.
|
||||
--let $_assert_result= `SELECT $_assert_cond_interp`
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # debug: result='$_assert_result'
|
||||
}
|
||||
|
||||
# Check.
|
||||
if (!$_assert_result)
|
||||
{
|
||||
--echo ######## Test assertion failed: $assert_text ########
|
||||
--echo Dumping debug info:
|
||||
if ($rpl_inited)
|
||||
{
|
||||
--source include/show_rpl_debug_info.inc
|
||||
}
|
||||
--echo Assertion text: '$assert_text'
|
||||
--echo Assertion condition: '$assert_cond'
|
||||
--echo Assertion condition, interpolated: '$_assert_cond_interp'
|
||||
--echo Assertion result: '$_assert_result'
|
||||
--die Test assertion failed in assertion.inc
|
||||
}
|
||||
|
||||
--let $include_filename= assert.inc [$assert_text]
|
||||
--source include/end_include_file.inc
|
||||
|
||||
--let $assert_text=
|
||||
--let $assert_cond=
|
||||
82
build/lib/mysql/mysql-test/include/begin_include_file.inc
Normal file
82
build/lib/mysql/mysql-test/include/begin_include_file.inc
Normal file
@@ -0,0 +1,82 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# This is an auxiliary file that facilitates writing include/*.inc
|
||||
# files. It has three purposes:
|
||||
#
|
||||
# 1. Store mtr's state at the beginning of the .inc file and restore
|
||||
# the state at the end. The following status is restored:
|
||||
#
|
||||
# disable_warnings
|
||||
# disable_query_log
|
||||
# disable_result_log
|
||||
# disable_abort_on_errors
|
||||
# Current connection
|
||||
#
|
||||
# 2. This file also prints the name of the .inc file that sources
|
||||
# it. Only the name of the top-level .inc file is printed: if
|
||||
# file_1.inc sources file_2.inc, then this file only prints
|
||||
# file_1.inc.
|
||||
#
|
||||
# 3. If the mysqltest variable $rpl_debug is set, then
|
||||
# this file will print:
|
||||
#
|
||||
# ==== BEGIN include/<filename> ====
|
||||
#
|
||||
# and end_include_file.inc will print
|
||||
#
|
||||
# ==== END include/<filename> ====
|
||||
#
|
||||
# These printouts are indented to make it easier to read the
|
||||
# result log.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# # At the beginning of include/my_file.inc:
|
||||
# --let $include_filename= my_file.inc
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/begin_include_file.inc
|
||||
#
|
||||
# # At the end of include/my_file.inc:
|
||||
# --let $include_filename= my_file.inc
|
||||
# --source include/end_include_file.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $include_filename
|
||||
# The basename of the file: a file named /path/to/my_file.inc
|
||||
# should set $include_filename=my_file.inc. This parameter
|
||||
# must be provided both for begin_include_file.inc and
|
||||
# end_include_file.inc.
|
||||
#
|
||||
# $rpl_debug
|
||||
# If set, this script will print the following text:
|
||||
# ==== BEGIN include/$include_filename.inc ====
|
||||
|
||||
|
||||
# Print 'include/$include_filename', but only when invoked from
|
||||
# the top-level. We don't want to print
|
||||
# 'include/$include_filename' from all files included
|
||||
# recursively.
|
||||
if (!$_include_file_depth)
|
||||
{
|
||||
--echo include/$include_filename
|
||||
}
|
||||
--inc $_include_file_depth
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo $_include_file_indent==== BEGIN include/$include_filename ====
|
||||
}
|
||||
|
||||
--let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings
|
||||
--let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log
|
||||
--let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log
|
||||
--let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error
|
||||
--let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_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'
|
||||
}
|
||||
|
||||
--let $include_filename=
|
||||
--let $_include_file_indent= .$_include_file_indent
|
||||
4
build/lib/mysql/mysql-test/include/big_test.inc
Normal file
4
build/lib/mysql/mysql-test/include/big_test.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/big_test.require
|
||||
disable_query_log;
|
||||
eval select $BIG_TEST as using_big_test;
|
||||
enable_query_log;
|
||||
22
build/lib/mysql/mysql-test/include/binlog_inject_error.inc
Normal file
22
build/lib/mysql/mysql-test/include/binlog_inject_error.inc
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# === Name
|
||||
#
|
||||
# binlog_inject_error.inc
|
||||
#
|
||||
# === Description
|
||||
#
|
||||
# Inject binlog write error when running the query, verifies that the
|
||||
# query is ended with the proper error (ER_ERROR_ON_WRITE).
|
||||
#
|
||||
# === Usage
|
||||
#
|
||||
# let query= 'CREATE TABLE t1 (a INT)';
|
||||
# source include/binlog_inject_error.inc;
|
||||
#
|
||||
|
||||
SET GLOBAL debug='d,injecting_fault_writing';
|
||||
--echo $query;
|
||||
--replace_regex /(errno: .*)/(errno: #)/
|
||||
--error ER_ERROR_ON_WRITE
|
||||
--eval $query
|
||||
SET GLOBAL debug='';
|
||||
17
build/lib/mysql/mysql-test/include/check-testcase.test
Normal file
17
build/lib/mysql/mysql-test/include/check-testcase.test
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
#
|
||||
# This test is executed twice for each test case if mysql-test-run is passed
|
||||
# the flag --check-testcase. Before every testcase it is run with mysqltest
|
||||
# in record mode and will thus produce an output file that can be compared
|
||||
# to output from after the tescase.
|
||||
# In that way its possible to check that a testcase does not have
|
||||
# any unwanted side affects.
|
||||
#
|
||||
--disable_query_log
|
||||
--replace_column 5 # 6 # 7 # 8 # 9 # 10 # 22 # 23 # 24 # 25 # 26 #
|
||||
query_vertical
|
||||
SHOW SLAVE STATUS;
|
||||
|
||||
call mtr.check_testcase();
|
||||
--enable_query_log
|
||||
|
||||
61
build/lib/mysql/mysql-test/include/check-warnings.test
Normal file
61
build/lib/mysql/mysql-test/include/check-warnings.test
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# This test is executed once after each test to check the servers
|
||||
# for unexpected warnings found in the servers error log
|
||||
#
|
||||
# NOTE! mysql-test-run.pl has already done a rough filtering
|
||||
# of the file and written any suspicious lines
|
||||
# to $error_log.warnings file
|
||||
#
|
||||
--disable_query_log
|
||||
|
||||
# Don't write these queries to binlog
|
||||
set SQL_LOG_BIN=0;
|
||||
|
||||
# Turn off any debug crashes, allow the variable to be
|
||||
# non existent in release builds
|
||||
--error 0,1193
|
||||
set debug="";
|
||||
|
||||
use mtr;
|
||||
|
||||
create temporary table error_log (
|
||||
row int auto_increment primary key,
|
||||
suspicious int default 1,
|
||||
file_name varchar(255),
|
||||
line varchar(1024) default null
|
||||
) engine=myisam;
|
||||
|
||||
# Get the name of servers error log
|
||||
let $log_error= $MTR_LOG_ERROR;
|
||||
let $log_warning= $log_error.warnings;
|
||||
|
||||
# Try tload the warnings into a temporary table,
|
||||
# it might fail with error saying "The MySQL server is
|
||||
# running with the --secure-file-priv" in which case
|
||||
# an attempt to load the file using LOAD DATA LOCAL is made
|
||||
--error 0,1290
|
||||
eval load data infile '$log_warning' into table error_log
|
||||
fields terminated by 'xykls37' escaped by ''
|
||||
ignore 1 lines
|
||||
(line)
|
||||
set file_name='$log_error';
|
||||
|
||||
if ($mysql_errno)
|
||||
{
|
||||
# Try LOAD DATA LOCAL
|
||||
eval load data local infile '$log_warning' into table error_log
|
||||
fields terminated by 'xykls37' escaped by ''
|
||||
ignore 1 lines
|
||||
(line)
|
||||
set file_name='$log_error';
|
||||
}
|
||||
|
||||
# Call check_warnings to filter out any warning in
|
||||
# the error_log table
|
||||
call mtr.check_warnings(@result);
|
||||
if (`select @result = 0`){
|
||||
skip OK;
|
||||
}
|
||||
--enable_query_log
|
||||
echo ^ Found warnings in $log_error;
|
||||
exit;
|
||||
@@ -0,0 +1,96 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check if statement reading table '$table' allows concurrent
|
||||
# inserts in it.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $table Table in which concurrent inserts should be allowed.
|
||||
# $con_aux1 Name of the first auxiliary connection to be used by this
|
||||
# script.
|
||||
# $con_aux2 Name of the second auxiliary connection to be used by this
|
||||
# script.
|
||||
# $statement Statement to be checked.
|
||||
# $restore_table Table which might be modified by statement to be checked
|
||||
# and thus needs backing up before its execution and
|
||||
# restoring after it (can be empty).
|
||||
#
|
||||
# EXAMPLE
|
||||
# lock_sync.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
# Reset DEBUG_SYNC facility for safety.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
if ($restore_table)
|
||||
{
|
||||
--eval create temporary table t_backup select * from $restore_table;
|
||||
}
|
||||
|
||||
connection $con_aux1;
|
||||
set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux2;
|
||||
set debug_sync='now WAIT_FOR parked';
|
||||
--send_eval insert into $table (i) values (0);
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
connection default;
|
||||
# Wait until concurrent insert is successfully executed while
|
||||
# statement being checked has its tables locked.
|
||||
# We use wait_condition.inc instead of simply reaping
|
||||
# concurrent insert here in order to avoid deadlocks if test
|
||||
# fails and to time out gracefully instead.
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where info = "insert into $table (i) values (0)";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
# Apparently concurrent insert was successfully executed.
|
||||
# To be safe against wait_condition.inc succeeding due to
|
||||
# races let us first reap concurrent insert to ensure that
|
||||
# it has really been successfully executed.
|
||||
connection $con_aux2;
|
||||
--reap
|
||||
connection default;
|
||||
set debug_sync= 'now SIGNAL go';
|
||||
connection $con_aux1;
|
||||
--reap
|
||||
connection default;
|
||||
--echo Success: '$statement' allows concurrent inserts into '$table'.
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
# Waiting has timed out. Apparently concurrent insert was blocked.
|
||||
# So to be able to continue we need to end our statement first.
|
||||
set debug_sync= 'now SIGNAL go';
|
||||
connection $con_aux1;
|
||||
--reap
|
||||
connection $con_aux2;
|
||||
--reap
|
||||
connection default;
|
||||
--echo Error: '$statement' doesn't allow concurrent inserts into '$table'!
|
||||
}
|
||||
|
||||
--eval delete from $table where i = 0;
|
||||
|
||||
if ($restore_table)
|
||||
{
|
||||
--eval truncate table $restore_table;
|
||||
--eval insert into $restore_table select * from t_backup;
|
||||
drop temporary table t_backup;
|
||||
}
|
||||
|
||||
# Clean-up. Reset DEBUG_SYNC facility after use.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
31
build/lib/mysql/mysql-test/include/check_events_off.inc
Normal file
31
build/lib/mysql/mysql-test/include/check_events_off.inc
Normal file
@@ -0,0 +1,31 @@
|
||||
########## include/check_events_off.inc ####################################
|
||||
# #
|
||||
# Purpose: #
|
||||
# Wait till we can expect that we have no event activity till the scheduler is #
|
||||
# switched on again. #
|
||||
# = There will be no modifications of user tables by existing events #
|
||||
# except they use "INSERT DELAYED" or the server system variable #
|
||||
# "concurrent_inserts" is not switched off. #
|
||||
# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2008-12-19 mleich Implement this check needed for bug fixes in tests #
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
# 1. Check that the server system variable shows the state needed
|
||||
if (`SELECT @@global.event_scheduler <> 'OFF'`)
|
||||
{
|
||||
--echo # Error: We expect here that the event scheduler is switched off.
|
||||
SELECT @@global.event_scheduler;
|
||||
--echo # Thinkable reasons:
|
||||
--echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect.
|
||||
--echo # 2. Use of the current routine (include/check_events_off.inc)
|
||||
--echo # within the wrong situation
|
||||
--die
|
||||
}
|
||||
# 2. Wait till we have no event_scheduler session within the processlist
|
||||
--source include/no_running_event_scheduler.inc
|
||||
# 3. Wait till we have no event executor sessions within the processlist
|
||||
--source include/no_running_events.inc
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check that statement reading table '$table' doesn't allow concurrent
|
||||
# inserts in it.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $table Table in which concurrent inserts should be disallowed.
|
||||
# $con_aux1 Name of the first auxiliary connection to be used by this
|
||||
# script.
|
||||
# $con_aux2 Name of the second auxiliary connection to be used by this
|
||||
# script.
|
||||
# $statement Statement to be checked.
|
||||
# $restore_table Table which might be modified by statement to be checked
|
||||
# and thus needs backing up before its execution and
|
||||
# restoring after it (can be empty).
|
||||
#
|
||||
# EXAMPLE
|
||||
# lock_sync.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
# Reset DEBUG_SYNC facility for safety.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
if ($restore_table)
|
||||
{
|
||||
--eval create temporary table t_backup select * from $restore_table;
|
||||
}
|
||||
|
||||
connection $con_aux1;
|
||||
set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
|
||||
--send_eval $statement;
|
||||
|
||||
connection $con_aux2;
|
||||
set debug_sync='now WAIT_FOR parked';
|
||||
--send_eval insert into $table (i) values (0);
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
connection default;
|
||||
# Wait until concurrent insert is successfully blocked because
|
||||
# of our statement.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "insert into $table (i) values (0)";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
set debug_sync= 'now SIGNAL go';
|
||||
connection $con_aux1;
|
||||
--reap
|
||||
connection $con_aux2;
|
||||
--reap
|
||||
connection default;
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: '$statement' doesn't allow concurrent inserts into '$table'.
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: '$statement' allows concurrent inserts into '$table'!
|
||||
}
|
||||
|
||||
--eval delete from $table where i = 0;
|
||||
|
||||
if ($restore_table)
|
||||
{
|
||||
--eval truncate table $restore_table;
|
||||
--eval insert into $restore_table select * from t_backup;
|
||||
drop temporary table t_backup;
|
||||
}
|
||||
|
||||
# Clean-up. Reset DEBUG_SYNC facility after use.
|
||||
set debug_sync= "RESET";
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
71
build/lib/mysql/mysql-test/include/check_no_row_lock.inc
Normal file
71
build/lib/mysql/mysql-test/include/check_no_row_lock.inc
Normal file
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check if statement affecting or reading table '$table' doesn't
|
||||
# take any kind of locks on its rows.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $table Table for which presence of row locks should be checked.
|
||||
# $con_aux Name of auxiliary connection to be used by this script.
|
||||
# $statement Statement to be checked.
|
||||
#
|
||||
# EXAMPLE
|
||||
# innodb_mysql_lock2.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
connection default;
|
||||
begin;
|
||||
--eval select * from $table for update;
|
||||
|
||||
connection $con_aux;
|
||||
begin;
|
||||
--send_eval $statement;
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
# Wait until statement is successfully executed while
|
||||
# all rows in table are X-locked. This means that it
|
||||
# does not acquire any row locks.
|
||||
# We use wait_condition.inc instead of simply reaping
|
||||
# statement here in order to avoid deadlocks if test
|
||||
# fails and to time out gracefully instead.
|
||||
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)
|
||||
{
|
||||
# Apparently statement was successfully executed and thus it
|
||||
# has not required any row locks.
|
||||
# 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.
|
||||
connection $con_aux;
|
||||
--reap
|
||||
rollback;
|
||||
connection default;
|
||||
rollback;
|
||||
--echo Success: '$statement' doesn't take row locks on '$table'.
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
# Waiting has timed out. Apparently statement was blocked on
|
||||
# some row lock. So to be able to continue we need to unlock
|
||||
# rows first.
|
||||
rollback;
|
||||
connection $con_aux;
|
||||
--reap
|
||||
rollback;
|
||||
connection default;
|
||||
--echo Error: '$statement' takes some row locks on '$table'!
|
||||
}
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
61
build/lib/mysql/mysql-test/include/check_shared_row_lock.inc
Normal file
61
build/lib/mysql/mysql-test/include/check_shared_row_lock.inc
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# SUMMARY
|
||||
# Check if statement reading table '$table' takes shared locks
|
||||
# on some of its rows.
|
||||
#
|
||||
# PARAMETERS
|
||||
# $table Table for which presence of row locks should be checked.
|
||||
# $con_aux Name of auxiliary connection to be used by this script.
|
||||
# $statement Statement to be checked.
|
||||
# $wait_statement Sub-statement which is supposed to acquire locks (should
|
||||
# be the same as $statement for ordinary statements).
|
||||
#
|
||||
# EXAMPLE
|
||||
# innodb_mysql_lock2.test
|
||||
#
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
connection default;
|
||||
begin;
|
||||
--eval select * from $table for update;
|
||||
|
||||
connection $con_aux;
|
||||
begin;
|
||||
--send_eval $statement;
|
||||
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
connection default;
|
||||
# Wait until statement is successfully blocked because
|
||||
# all rows in table are X-locked. This means that at
|
||||
# least it acquires S-locks on some of rows.
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state in ("Sending data","statistics", "preparing") and
|
||||
info = "$wait_statement";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
rollback;
|
||||
|
||||
connection $con_aux;
|
||||
--reap
|
||||
rollback;
|
||||
|
||||
connection default;
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
if ($success)
|
||||
{
|
||||
--echo Success: '$statement' takes shared row locks on '$table'.
|
||||
}
|
||||
|
||||
if (!$success)
|
||||
{
|
||||
--echo Error: '$statement' hasn't taken shared row locks on '$table'!
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Assert that the slave threads are running and don't have any errors.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/check_slave_is_running.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
|
||||
|
||||
--let $include_filename= check_slave_is_running.inc
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
--let $slave_param= Slave_IO_Running
|
||||
--let $slave_param_value= Yes
|
||||
--source include/check_slave_param.inc
|
||||
|
||||
--let $slave_param= Slave_SQL_Running
|
||||
--let $slave_param_value= Yes
|
||||
--source include/check_slave_param.inc
|
||||
|
||||
|
||||
--let $include_filename= check_slave_is_running.inc
|
||||
--source include/end_include_file.inc
|
||||
31
build/lib/mysql/mysql-test/include/check_slave_no_error.inc
Normal file
31
build/lib/mysql/mysql-test/include/check_slave_no_error.inc
Normal file
@@ -0,0 +1,31 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0 in the output from
|
||||
# SHOW SLAVE STATUS.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/check_slave_no_error.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
|
||||
|
||||
--let $include_filename= check_slave_no_error.inc
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
--let $slave_param= Last_SQL_Errno
|
||||
--let $slave_param_value= 0
|
||||
--source include/check_slave_param.inc
|
||||
|
||||
--let $slave_param= Last_IO_Errno
|
||||
--let $slave_param_value= 0
|
||||
--source include/check_slave_param.inc
|
||||
|
||||
|
||||
--let $include_filename= check_slave_no_error.inc
|
||||
--source include/end_include_file.inc
|
||||
36
build/lib/mysql/mysql-test/include/check_slave_param.inc
Normal file
36
build/lib/mysql/mysql-test/include/check_slave_param.inc
Normal file
@@ -0,0 +1,36 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Assert that a given column in SHOW SLAVE STATUS has a given value.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $slave_param= COLUMN_NAME
|
||||
# --let $slave_param_value= VALUE
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/check_slave_param.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $slave_param, $slave_param_value
|
||||
# Column name in output of SHOW SLAVE STATUS that should be checked,
|
||||
# and the expected value. Example:
|
||||
# --let $slave_param= Exec_Master_Log_Pos
|
||||
# --let $slave_param_value= 4711
|
||||
#
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
|
||||
|
||||
--let $include_filename= check_slave_param.inc [$slave_param]
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
|
||||
if (`SELECT '$_param_value' != '$slave_param_value'`) {
|
||||
--source include/show_rpl_debug_info.inc
|
||||
--echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
|
||||
--die Wrong value for slave parameter
|
||||
}
|
||||
|
||||
|
||||
--let $include_filename= check_slave_param.inc
|
||||
--source include/end_include_file.inc
|
||||
9
build/lib/mysql/mysql-test/include/check_var_limit.inc
Normal file
9
build/lib/mysql/mysql-test/include/check_var_limit.inc
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Check that second part of $LIMIT is between $MIN_LIMIT and $MAX_LIMIT
|
||||
# This is useful to check that a variable from SHOW_VARIABLES is within
|
||||
# certain limits. Check query_cache_merge.test for an example of using this.
|
||||
#
|
||||
-- require r/check_var_limit.require
|
||||
disable_query_log;
|
||||
eval select SUBSTRING_INDEX("$LIMIT", "\\t", -1) BETWEEN $MIN_LIMIT AND $MAX_LIMIT as "limit";
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,28 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Clean up files created by setup_fake_relay_log.inc.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# See setup_fake_relay_log.inc
|
||||
|
||||
--let $include_filename= cleanup_fake_relay_log.inc
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
--disable_query_log
|
||||
RESET SLAVE;
|
||||
|
||||
# Assert that the fake relay log files are gone (RESET SLAVE should
|
||||
# have removed them).
|
||||
--let $file_does_not_exist= $_fake_relay_log
|
||||
--source include/file_does_not_exist.inc
|
||||
|
||||
# Revert variables.
|
||||
eval SET @@global.relay_log_purge= $_fake_relay_log_purge;
|
||||
|
||||
eval CHANGE MASTER TO MASTER_HOST = '$_fake_old_master_host';
|
||||
|
||||
|
||||
--let $include_filename= cleanup_fake_relay_log.inc
|
||||
--source include/end_include_file.inc
|
||||
752
build/lib/mysql/mysql-test/include/commit.inc
Normal file
752
build/lib/mysql/mysql-test/include/commit.inc
Normal file
@@ -0,0 +1,752 @@
|
||||
## Bug#12713 (Error in a stored function called from a SELECT doesn't cause
|
||||
## ROLLBACK of statem)
|
||||
|
||||
##
|
||||
## Pre-Requisites :
|
||||
## - $engine_type should be set
|
||||
##
|
||||
|
||||
set sql_mode=no_engine_substitution;
|
||||
eval set storage_engine = $engine_type;
|
||||
set autocommit=1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop function if exists f2;
|
||||
drop procedure if exists bug12713_call;
|
||||
drop procedure if exists bug12713_dump_spvars;
|
||||
drop procedure if exists dummy;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int);
|
||||
create table t2 (a int unique);
|
||||
create table t3 (a int);
|
||||
|
||||
# a workaround for Bug#32633: Can not create any routine if
|
||||
# SQL_MODE=no_engine_substitution
|
||||
|
||||
set sql_mode=default;
|
||||
|
||||
insert into t1 (a) values (1), (2);
|
||||
insert into t3 (a) values (1), (2);
|
||||
|
||||
delimiter |;
|
||||
|
||||
## Cause a failure every time
|
||||
create function f2(x int) returns int
|
||||
begin
|
||||
insert into t2 (a) values (x);
|
||||
insert into t2 (a) values (x);
|
||||
return x;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
set autocommit=0;
|
||||
|
||||
flush status;
|
||||
##============================================================================
|
||||
## Design notes
|
||||
##
|
||||
## In each case, statement rollback is expected.
|
||||
## for transactional engines, the rollback should be properly executed
|
||||
## for non transactional engines, the rollback may cause warnings.
|
||||
##
|
||||
## The test pattern is as follows
|
||||
## - insert 1000+N
|
||||
## - statement with a side effect, that fails to insert N twice
|
||||
## - a statement rollback is expected (expecting 1 row 1000+N only) in t2
|
||||
## - a rollback is performed
|
||||
## - expecting a clean table t2.
|
||||
##============================================================================
|
||||
|
||||
insert into t2 (a) values (1001);
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 (a) values (f2(1));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1002);
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t3 (a) select f2(2) from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1003);
|
||||
--error ER_DUP_ENTRY
|
||||
update t1 set a= a + f2(3);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1004);
|
||||
--error ER_DUP_ENTRY
|
||||
update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1005);
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t1 where (a = f2(5));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1006);
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t1, t3 using t1, t3 where (f2(6) = 6) ;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1007);
|
||||
--error ER_DUP_ENTRY
|
||||
replace t1 values (f2(7));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1008);
|
||||
--error ER_DUP_ENTRY
|
||||
replace into t3 (a) select f2(8) from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1009);
|
||||
--error ER_DUP_ENTRY
|
||||
select f2(9) from t1 ;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1010);
|
||||
--error ER_DUP_ENTRY
|
||||
show databases where (f2(10) = 10);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1011);
|
||||
--error ER_DUP_ENTRY
|
||||
show tables where (f2(11) = 11);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1012);
|
||||
--error ER_DUP_ENTRY
|
||||
show triggers where (f2(12) = 12);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1013);
|
||||
--error ER_DUP_ENTRY
|
||||
show table status where (f2(13) = 13);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1014);
|
||||
--error ER_DUP_ENTRY
|
||||
show open tables where (f2(14) = 14);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1015);
|
||||
--error ER_DUP_ENTRY
|
||||
show columns in mysql.proc where (f2(15) = 15);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1016);
|
||||
--error ER_DUP_ENTRY
|
||||
show status where (f2(16) = 16);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1017);
|
||||
--error ER_DUP_ENTRY
|
||||
show variables where (f2(17) = 17);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1018);
|
||||
--error ER_DUP_ENTRY
|
||||
show charset where (f2(18) = 18);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1019);
|
||||
--error ER_DUP_ENTRY
|
||||
show collation where (f2(19) = 19);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo # We need at least one procedure to make sure the WHERE clause is
|
||||
--echo # evaluated
|
||||
create procedure dummy() begin end;
|
||||
insert into t2 (a) values (1020);
|
||||
--error ER_DUP_ENTRY
|
||||
show procedure status where (f2(20) = 20);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
drop procedure dummy;
|
||||
|
||||
insert into t2 (a) values (1021);
|
||||
--error ER_DUP_ENTRY
|
||||
show function status where (f2(21) = 21);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1022);
|
||||
prepare stmt from "insert into t1 (a) values (f2(22))";
|
||||
--error ER_DUP_ENTRY
|
||||
execute stmt;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1023);
|
||||
do (f2(23));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
## Please note :
|
||||
## This will insert a record 1024 in t1 (statement commit)
|
||||
## This will insert a record 24 in t1 (statement commit)
|
||||
## then will rollback the second insert only (24) (statement rollback)
|
||||
## then will rollback the complete transaction (transaction rollback)
|
||||
|
||||
delimiter |;
|
||||
|
||||
create procedure bug12713_call ()
|
||||
begin
|
||||
insert into t2 (a) values (24);
|
||||
insert into t2 (a) values (24);
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
insert into t2 (a) values (1024);
|
||||
--error ER_DUP_ENTRY
|
||||
call bug12713_call();
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing select_to_file
|
||||
--echo =======================================================================
|
||||
|
||||
insert into t2 (a) values (1025);
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR ..
|
||||
--error ER_DUP_ENTRY
|
||||
eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dml.out
|
||||
|
||||
insert into t2 (a) values (1026);
|
||||
--replace_result $MYSQLTEST_VARDIR ..
|
||||
--error ER_DUP_ENTRY
|
||||
eval load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
|
||||
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing select_dumpvar
|
||||
--echo =======================================================================
|
||||
|
||||
insert into t2 (a) values (1027);
|
||||
--error ER_DUP_ENTRY
|
||||
select f2(27) into @foo;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing Select_fetch_into_spvars
|
||||
--echo =======================================================================
|
||||
|
||||
delimiter |;
|
||||
|
||||
create procedure bug12713_dump_spvars ()
|
||||
begin
|
||||
declare foo int;
|
||||
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
select "Exception trapped";
|
||||
end;
|
||||
|
||||
select f2(28) into foo;
|
||||
select * from t2;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
insert into t2 (a) values (1028);
|
||||
call bug12713_dump_spvars ();
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Cleanup
|
||||
--echo =======================================================================
|
||||
|
||||
set autocommit=default;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop function f2;
|
||||
drop procedure bug12713_call;
|
||||
drop procedure bug12713_dump_spvars;
|
||||
--echo #
|
||||
--echo # Bug#12713 Error in a stored function called from a SELECT doesn't
|
||||
--echo # cause ROLLBACK of statem
|
||||
--echo #
|
||||
--echo # Verify that two-phase commit is not issued for read-only
|
||||
--echo # transactions.
|
||||
--echo #
|
||||
--echo # Verify that two-phase commit is issued for read-write transactions,
|
||||
--echo # even if the change is done inside a stored function called from
|
||||
--echo # SELECT or SHOW statement.
|
||||
--echo #
|
||||
set autocommit=0;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop function if exists f1;
|
||||
drop procedure if exists p_verify_status_increment;
|
||||
--enable_warnings
|
||||
|
||||
# Save binlog_format in a user variable. References to system
|
||||
# variables are "unsafe", meaning they are written as rows instead of
|
||||
# as statements to the binlog, if the loggging mode is 'mixed'. But
|
||||
# we don't want p_verify_status_increment to affect the logging mode.
|
||||
# Hence, we save binlog_format in a user variable (which is not
|
||||
# unsafe) and use that inside p_verify_status_increment.
|
||||
set @binlog_format=@@global.binlog_format;
|
||||
|
||||
set sql_mode=no_engine_substitution;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (a int) engine=myisam;
|
||||
set sql_mode=default;
|
||||
--echo #
|
||||
--echo # An auxiliary procedure to track Handler_prepare and Handler_commit
|
||||
--echo # statistics.
|
||||
--echo #
|
||||
delimiter |;
|
||||
create procedure
|
||||
p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int,
|
||||
commit_inc_row int, prepare_inc_row int)
|
||||
begin
|
||||
declare commit_inc int;
|
||||
declare prepare_inc int;
|
||||
declare old_commit_count int default ifnull(@commit_count, 0);
|
||||
declare old_prepare_count int default ifnull(@prepare_count, 0);
|
||||
declare c_res int;
|
||||
# Use a cursor to have just one access to I_S instead of 2, it is very slow
|
||||
# and amounts for over 90% of test CPU time
|
||||
declare c cursor for
|
||||
select variable_value
|
||||
from information_schema.session_status
|
||||
where variable_name='Handler_commit' or variable_name='Handler_prepare'
|
||||
order by variable_name;
|
||||
|
||||
if @binlog_format = 'ROW' then
|
||||
set commit_inc= commit_inc_row;
|
||||
set prepare_inc= prepare_inc_row;
|
||||
else
|
||||
set commit_inc= commit_inc_mixed;
|
||||
set prepare_inc= prepare_inc_mixed;
|
||||
end if;
|
||||
|
||||
open c;
|
||||
fetch c into c_res;
|
||||
set @commit_count=c_res;
|
||||
fetch c into c_res;
|
||||
set @prepare_count=c_res;
|
||||
close c;
|
||||
|
||||
if old_commit_count + commit_inc <> @commit_count then
|
||||
select concat("Expected commit increment: ", commit_inc,
|
||||
" actual: ", @commit_count - old_commit_count)
|
||||
as 'ERROR';
|
||||
elseif old_prepare_count + prepare_inc <> @prepare_count then
|
||||
select concat("Expected prepare increment: ", prepare_inc,
|
||||
" actual: ", @prepare_count - old_prepare_count)
|
||||
as 'ERROR';
|
||||
else
|
||||
select '' as 'SUCCESS';
|
||||
end if;
|
||||
end|
|
||||
delimiter ;|
|
||||
--echo # Reset Handler_commit and Handler_prepare counters
|
||||
flush status;
|
||||
--echo #
|
||||
--echo # 1. Read-only statement: SELECT
|
||||
--echo #
|
||||
select * from t1;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 2. Read-write statement: INSERT, insert 1 row.
|
||||
--echo #
|
||||
insert into t1 (a) values (1);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 3. Read-write statement: UPDATE, update 1 row.
|
||||
--echo #
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE
|
||||
--echo #
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE
|
||||
--echo #
|
||||
--echo # In mixed replication mode, there is a read-only transaction
|
||||
--echo # in InnoDB and also the statement is written to the binary log.
|
||||
--echo # So we have two commits but no 2pc, since the first engine's
|
||||
--echo # transaction is read-only.
|
||||
--echo # In the row level replication mode, we only have the read-only
|
||||
--echo # transaction in InnoDB and nothing is written to the binary log.
|
||||
--echo #
|
||||
update t1 set a=3 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 6. Read-write statement: DELETE, delete 0 rows.
|
||||
--echo #
|
||||
delete from t1 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 7. Read-write statement: DELETE, delete 1 row.
|
||||
--echo #
|
||||
delete from t1 where a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 8. Read-write statement: unqualified DELETE
|
||||
--echo #
|
||||
--echo # In statement or mixed replication mode, we call
|
||||
--echo # handler::ha_delete_all_rows() and write statement text
|
||||
--echo # to the binary log. This results in two read-write transactions.
|
||||
--echo # In row level replication mode, we do not call
|
||||
--echo # handler::ha_delete_all_rows(), but delete rows one by one.
|
||||
--echo # Since there are no rows, nothing is written to the binary log.
|
||||
--echo # Thus we have just one read-only transaction in InnoDB.
|
||||
delete from t1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 9. Read-write statement: REPLACE, change 1 row.
|
||||
--echo #
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 10. Read-write statement: REPLACE, change 0 rows.
|
||||
--echo #
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 11. Read-write statement: IODKU, change 1 row.
|
||||
--echo #
|
||||
insert t1 set a=1 on duplicate key update a=a+1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
select * from t1;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 12. Read-write statement: IODKU, change 0 rows.
|
||||
--echo #
|
||||
insert t1 set a=2 on duplicate key update a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
--echo #
|
||||
insert ignore t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 14. Read-write statement: INSERT IGNORE, change 1 row.
|
||||
--echo #
|
||||
insert ignore t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
--echo # 15. Read-write statement: UPDATE IGNORE, change 0 rows.
|
||||
--echo #
|
||||
update ignore t1 set a=2 where a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
--echo #
|
||||
--echo # Create a stored function that modifies a
|
||||
--echo # non-transactional table. Demonstrate that changes in
|
||||
--echo # non-transactional tables do not affect the two phase commit
|
||||
--echo # algorithm.
|
||||
--echo #
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert t2 set a=2;
|
||||
return 2;
|
||||
end|
|
||||
delimiter ;|
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 16. A function changes non-trans-table.
|
||||
--echo #
|
||||
--echo # For row-based logging, there is an extra commit for the
|
||||
--echo # non-transactional changes saved in the transaction cache to
|
||||
--echo # the binary log.
|
||||
--echo #
|
||||
select f1();
|
||||
call p_verify_status_increment(0, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 1, 0);
|
||||
|
||||
--echo # 17. Read-only statement, a function changes non-trans-table.
|
||||
--echo #
|
||||
--echo # For row-based logging, there is an extra commit for the
|
||||
--echo # non-transactional changes saved in the transaction cache to
|
||||
--echo # the binary log.
|
||||
--echo #
|
||||
select f1() from t1;
|
||||
call p_verify_status_increment(1, 0, 2, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 2, 0);
|
||||
|
||||
--echo # 18. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
--echo #
|
||||
select count(*) from t2;
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
select count(*) from t2;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
--echo #
|
||||
--echo # Replace the non-transactional table with a temporary
|
||||
--echo # transactional table. Demonstrate that a change to a temporary
|
||||
--echo # transactional table does not provoke 2-phase commit, although
|
||||
--echo # does trigger a commit and a binlog write (in statement mode).
|
||||
--echo #
|
||||
drop table t2;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create temporary table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
set sql_mode=default;
|
||||
--echo # 19. A function changes temp-trans-table.
|
||||
--echo #
|
||||
select f1();
|
||||
--echo # Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 20. Read-only statement, a function changes non-trans-table.
|
||||
--echo #
|
||||
select f1() from t1;
|
||||
--echo # Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 21. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
--echo #
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc
|
||||
--echo #
|
||||
alter table t2 add column b int default 5;
|
||||
--echo # A commit is done internally by ALTER.
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
|
||||
--echo
|
||||
--echo # No test because of Bug#8729 "rename table fails on temporary table"
|
||||
|
||||
--echo # 24. DDL: TRUNCATE TEMPORARY TABLE
|
||||
--echo
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(4, 0, 4, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 25. Read-write statement: unqualified DELETE
|
||||
--echo
|
||||
delete from t2;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
|
||||
--echo #
|
||||
drop temporary table t2;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit
|
||||
--echo #
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
set autocommit=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
delete from t1 where a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
--echo # Sic: not actually changing the value of autocommit
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 27. Savepoint management
|
||||
--echo #
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
savepoint a;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
insert t1 set a=4;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
release savepoint a;
|
||||
rollback;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 28. Read-write statement: DO
|
||||
--echo #
|
||||
create table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
do (select f1() from t1 where a=2);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 29. Read-write statement: MULTI-DELETE
|
||||
--echo #
|
||||
delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
|
||||
--echo # 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT
|
||||
--echo #
|
||||
insert into t2 select a from t1;
|
||||
commit;
|
||||
replace into t2 select a from t1;
|
||||
commit;
|
||||
call p_verify_status_increment(8, 8, 8, 8);
|
||||
#
|
||||
# Multi-update is one of the few remaining statements that still
|
||||
# locks the tables at prepare step (and hence starts the transaction.
|
||||
# Disable the PS protocol, since in this protocol we get a different
|
||||
# number of commmits (there is an extra commit after prepare
|
||||
#
|
||||
--disable_ps_protocol
|
||||
update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1;
|
||||
--enable_ps_protocol
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
|
||||
--echo # 31. DDL: various DDL with transactional tables
|
||||
--echo #
|
||||
--echo # Sic: no table is created.
|
||||
create table if not exists t2 (a int) select 6 union select 7;
|
||||
--echo # Sic: first commits the statement, and then the transaction.
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
create table t3 select a from t2;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
alter table t3 add column (b int);
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
check table t1;
|
||||
call p_verify_status_increment(3, 0, 3, 0);
|
||||
--echo # Sic: after this bug is fixed, CHECK leaves no pending transaction
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
check table t1, t2, t3;
|
||||
call p_verify_status_increment(6, 0, 6, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
drop view v1;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
drop table t1, t2, t3;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
||||
1832
build/lib/mysql/mysql-test/include/common-tests.inc
Normal file
1832
build/lib/mysql/mysql-test/include/common-tests.inc
Normal file
File diff suppressed because it is too large
Load Diff
672
build/lib/mysql/mysql-test/include/concurrent.inc
Normal file
672
build/lib/mysql/mysql-test/include/concurrent.inc
Normal file
@@ -0,0 +1,672 @@
|
||||
# include/concurrent.inc
|
||||
#
|
||||
# Concurrent tests for transactional storage engines, mainly in UPDATE's
|
||||
# Bug#3300
|
||||
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
|
||||
#
|
||||
# These variables have to be set before sourcing this script:
|
||||
# TRANSACTION ISOLATION LEVEL REPEATABLE READ
|
||||
# innodb_locks_unsafe_for_binlog 0 (default) or 1 (by
|
||||
# --innodb_locks_unsafe_for_binlog)
|
||||
# $engine_type storage engine to be tested
|
||||
#
|
||||
# Last update:
|
||||
# 2009-02-13 HH "Release_lock("hello")" is now also successful when delivering NULL,
|
||||
# replaced two sleeps by wait_condition. The last two "sleep 1" have not been
|
||||
# replaced as all tried wait conditions leaded to nondeterministic results, especially
|
||||
# to succeeding concurrent updates. To replace the sleeps there should be some time
|
||||
# planned (or internal knowledge of the server may help).
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/innodb_concurrent.test
|
||||
# main code went into include/concurrent.inc
|
||||
# 2008-06-03 KP test refactored; removed name locks, added comments.
|
||||
# renamed wrapper t/concurrent_innodb.test ->
|
||||
# t/concurrent_innodb_unsafelog.test
|
||||
# new wrapper t/concurrent_innodb_safelog.test
|
||||
#
|
||||
|
||||
connection default;
|
||||
#
|
||||
# Show prerequisites for this test.
|
||||
#
|
||||
SELECT @@global.tx_isolation;
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
#
|
||||
# When innodb_locks_unsafe_for_binlog is not set (zero), which is the
|
||||
# default, InnoDB takes "next-key locks"/"gap locks". This means it
|
||||
# locks the gap before the keys that it accessed to find the rows to
|
||||
# use for a statement. In this case we have to expect some more lock
|
||||
# wait timeouts in the tests below as if innodb_locks_unsafe_for_binlog
|
||||
# is set (non-zero). In the latter case no "next-key locks"/"gap locks"
|
||||
# are taken and locks on keys that do not match the WHERE conditon are
|
||||
# released. Hence less lock collisions occur.
|
||||
# We use the variable $keep_locks to set the expectations for
|
||||
# lock wait timeouts accordingly.
|
||||
#
|
||||
let $keep_locks= `SELECT NOT @@global.innodb_locks_unsafe_for_binlog`;
|
||||
--echo # keep_locks == $keep_locks
|
||||
|
||||
#
|
||||
# Set up privileges and remove user level locks, if exist.
|
||||
#
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
|
||||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and both changing distinct result sets
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction for thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan and a new ULL will
|
||||
--echo ** be created and blocked on the first row where tipo=11.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
|
||||
--source include/wait_condition.inc
|
||||
--echo ** Start new transaction for thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
--echo ** Release user level name lock from thread 1. This will cause the ULL
|
||||
--echo ** on thread 2 to end its wait.
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello");
|
||||
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from update on thread 2
|
||||
reap;
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello");
|
||||
--echo ** Table should have eta updates where tipo=11 but updates made by
|
||||
--echo ** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
--echo ** Sending commit on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
--echo ** And send final commit on thread 1.
|
||||
commit;
|
||||
--echo ** Table should now be updated by both updates in the order of
|
||||
--echo ** thread 1,2.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and one changing result set
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan.
|
||||
--echo ** This will cause a hang on the first row where tipo=1 until the
|
||||
--echo ** blocking ULL is released.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
|
||||
--source include/wait_condition.inc
|
||||
--echo ** Start transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
--echo ** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically)the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello");
|
||||
--echo ** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from thread 2:
|
||||
reap;
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello");
|
||||
--echo ** Seen from thread 2 the table should have been updated on four
|
||||
--echo ** places.
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Thread 2 has committed but the result should remain the same for
|
||||
--echo ** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
commit;
|
||||
--echo ** After a commit the table should be merged with the previous
|
||||
--echo ** commit.
|
||||
--echo ** This select should show both updates:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** One UPDATE and one INSERT .... Monty's test
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
--echo ** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will create a table scan which creates a ULL where a=2;
|
||||
--echo ** this will hang waiting on thread 1.
|
||||
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
|
||||
--source include/wait_condition.inc
|
||||
--echo ** Insert new values to t1 from thread 1; this created an implicit
|
||||
--echo ** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
--echo ** Release the ULL (thread 2 updates will finish).
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello2");
|
||||
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Collect results from thread 2 and release the lock.
|
||||
reap;
|
||||
# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following
|
||||
# is also guaranteed for NULL. Replaced SELECT by DO (no result).
|
||||
DO release_lock("hello2");
|
||||
--echo ** The table should look like the original+updates for thread 2,
|
||||
--echo ** and consist of new rows:
|
||||
select * from t1;
|
||||
--echo ** Commit changes from thread 2
|
||||
commit;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update the same range which is marked for update on thread 2; this
|
||||
--echo ** will hang because of row locks.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
--echo ** After the update the table will be unmodified because the previous
|
||||
--echo ** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
--echo ** Sending a commit should release the row locks and enable
|
||||
--echo ** thread 1 to complete the transaction.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should not have been changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Even on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Starting new transaction on thread 2.
|
||||
begin;
|
||||
--echo ** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo
|
||||
--echo ** Starting new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Updating single row using a table scan. This will time out
|
||||
--echo ** because of ongoing transaction on thread 1 holding lock on
|
||||
--echo ** all primary keys in the scan.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
--echo ** After the time out the transaction is aborted; no rows should
|
||||
--echo ** have changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The same thing should hold true for the transaction on
|
||||
--echo ** thread 2
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Even after committing:
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Selecting a range for update by table scan will be blocked
|
||||
--echo ** because of on-going transaction on thread 2.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Table will be unchanged and the select command will not be
|
||||
--echo ** blocked:
|
||||
select * from t1;
|
||||
--echo ** Commit transacton on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit transaction on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
# The sleep has not been replaced as all tried wait conditions leaded to sporadically
|
||||
# succeding update in the following thread. Also the used status variables '%lock%' and
|
||||
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
# The sleep has not been replaced as all tried wait conditions leaded to sporadically
|
||||
# succeding update in the following thread. Also the used status variables '%lock%' and
|
||||
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** Cleanup
|
||||
connection thread1;
|
||||
disconnect thread1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
disconnect thread2;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop user mysqltest@localhost;
|
||||
|
||||
56
build/lib/mysql/mysql-test/include/connect2.inc
Normal file
56
build/lib/mysql/mysql-test/include/connect2.inc
Normal file
@@ -0,0 +1,56 @@
|
||||
# include/connect2.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Make several attempts to connect.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# EXAMPLE
|
||||
#
|
||||
# connect.test
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
|
||||
let $wait_counter= 300;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $wait_counter= `SELECT $wait_timeout * 10`;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
--echo # -- Establishing connection '$con_name' (user: $con_user_name)...
|
||||
|
||||
while ($wait_counter)
|
||||
{
|
||||
--disable_abort_on_error
|
||||
--disable_result_log
|
||||
--connect ($con_name,localhost,$con_user_name)
|
||||
--enable_result_log
|
||||
--enable_abort_on_error
|
||||
|
||||
let $error = $mysql_errno;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
--echo # -- Error: can not establish connection '$con_name'.
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
--echo # -- Connection '$con_name' has been established.
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
21
build/lib/mysql/mysql-test/include/count_sessions.inc
Normal file
21
build/lib/mysql/mysql-test/include/count_sessions.inc
Normal file
@@ -0,0 +1,21 @@
|
||||
# include/count_sessions.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Stores the number of current sessions in $count_sessions.
|
||||
#
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# Please look into include/wait_until_count_sessions.inc
|
||||
# for examples of typical usage.
|
||||
#
|
||||
#
|
||||
# EXAMPLE
|
||||
# backup.test, grant3.test
|
||||
#
|
||||
#
|
||||
# Created: 2009-01-14 mleich
|
||||
#
|
||||
|
||||
let $count_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
|
||||
46
build/lib/mysql/mysql-test/include/ctype_8bit.inc
Normal file
46
build/lib/mysql/mysql-test/include/ctype_8bit.inc
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Test Unicode conversion, upper, lower
|
||||
#
|
||||
SELECT @@collation_connection;
|
||||
CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0;
|
||||
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
|
||||
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
|
||||
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
|
||||
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
|
||||
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
|
||||
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
|
||||
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
|
||||
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
|
||||
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
|
||||
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
|
||||
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
|
||||
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
|
||||
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
|
||||
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
|
||||
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
|
||||
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
|
||||
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
|
||||
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
|
||||
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
|
||||
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
|
||||
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
|
||||
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
|
||||
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
|
||||
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
|
||||
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
|
||||
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
|
||||
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
|
||||
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
|
||||
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
|
||||
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
|
||||
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
|
||||
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
|
||||
SELECT
|
||||
HEX(a) AS chr,
|
||||
HEX(LOWER(a)) AS upper,
|
||||
HEX(LOWER(a)) AS lower,
|
||||
HEX(@utf8:=CONVERT(a USING utf8)) AS utf8,
|
||||
HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip,
|
||||
if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe
|
||||
FROM t1 ORDER BY chr;
|
||||
DROP TABLE t1;
|
||||
85
build/lib/mysql/mysql-test/include/ctype_common.inc
Normal file
85
build/lib/mysql/mysql-test/include/ctype_common.inc
Normal file
@@ -0,0 +1,85 @@
|
||||
#
|
||||
# Common tests for all character sets and collations.
|
||||
# Include this file from a test with @test_characrer_set
|
||||
# and @test_collation set to desired values.
|
||||
#
|
||||
# Please don't use SHOW CREATE TABLE in this file,
|
||||
# we want it to be HANDLER independent. You can
|
||||
# use SHOW FULL COLUMNS instead.
|
||||
#
|
||||
# Please surround all CREATE TABLE with --disable_warnings
|
||||
# and --enable_warnings to be able to set storage_engine
|
||||
# without having to check if the hanlder exists.
|
||||
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
|
||||
#
|
||||
# Bug 1883: LIKE did not work in some cases with a key.
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
--enable_warnings
|
||||
# check the column was created with the expected charset/collation
|
||||
--replace_result select,insert,update,references ""
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 6643 incorrect response with partial utf8 index
|
||||
#
|
||||
--disable_warnings
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
--enable_warnings
|
||||
# check the column was created with the expected charset/collation
|
||||
--replace_result select,insert,update,references ""
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #31070: crash during conversion of charsets
|
||||
# Bug #32726: crash with cast in order by clause and cp932 charset
|
||||
#
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
select cast(a as char(1)) from t1;
|
||||
select a sounds like a from t1;
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#27580 SPACE() function collation bug?
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
drop table t1;
|
||||
|
||||
DROP DATABASE d1;
|
||||
# Restore settings
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
15
build/lib/mysql/mysql-test/include/ctype_filesort.inc
Normal file
15
build/lib/mysql/mysql-test/include/ctype_filesort.inc
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Set desired charset_connection and collation_collation
|
||||
# before including this file.
|
||||
#
|
||||
|
||||
# The next query creates a LONGTEXT column
|
||||
# using the current character_set_connection
|
||||
# and collation_connection.
|
||||
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
40
build/lib/mysql/mysql-test/include/ctype_german.inc
Normal file
40
build/lib/mysql/mysql-test/include/ctype_german.inc
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Bug #27877 incorrect german order in utf8_general_ci
|
||||
#
|
||||
# Testing if "SHARP S" is equal to "S",
|
||||
# like in latin1_german1_ci, utf8_general_ci, ucs2_general_ci
|
||||
# Or if "SHART S" is equal to "SS",
|
||||
# like in latin1_german2_ci, utf8_unicode_ci, ucs2_unicode_ci
|
||||
#
|
||||
# Also testing A-uml, O-uml, U-uml
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Create a table with a varchar(x) column,
|
||||
# using current values of
|
||||
# @@character_set_connection and @@collation_connection.
|
||||
#
|
||||
|
||||
create table t1 as select repeat(' ', 64) as s1;
|
||||
select collation(s1) from t1;
|
||||
delete from t1;
|
||||
|
||||
#
|
||||
# Populate data
|
||||
#
|
||||
|
||||
insert into t1 values ('a'),('ae'),(_latin1 0xE4);
|
||||
insert into t1 values ('o'),('oe'),(_latin1 0xF6);
|
||||
insert into t1 values ('s'),('ss'),(_latin1 0xDF);
|
||||
insert into t1 values ('u'),('ue'),(_latin1 0xFC);
|
||||
|
||||
#
|
||||
# Check order
|
||||
#
|
||||
select s1, hex(s1) from t1 order by s1, binary s1;
|
||||
select group_concat(s1 order by binary s1) from t1 group by s1;
|
||||
drop table t1;
|
||||
21
build/lib/mysql/mysql-test/include/ctype_innodb_like.inc
Normal file
21
build/lib/mysql/mysql-test/include/ctype_innodb_like.inc
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Bug#11650: LIKE pattern matching using prefix index
|
||||
# doesn't return correct result
|
||||
#
|
||||
--disable_warnings
|
||||
#
|
||||
# This query creates a column using
|
||||
# character_set_connection and
|
||||
# collation_connection.
|
||||
#
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
--enable_warnings
|
||||
alter table t1 add index(c1(5));
|
||||
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
drop table t1;
|
||||
18
build/lib/mysql/mysql-test/include/ctype_like_escape.inc
Normal file
18
build/lib/mysql/mysql-test/include/ctype_like_escape.inc
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Bugs: #13046:
|
||||
# LIKE pattern matching using prefix index doesn't return correct result
|
||||
#
|
||||
select @@collation_connection;
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
# should return ab_def
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
# should return ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
drop table t1;
|
||||
25
build/lib/mysql/mysql-test/include/ctype_like_range_f1f2.inc
Normal file
25
build/lib/mysql/mysql-test/include/ctype_like_range_f1f2.inc
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Bug#32510 LIKE search fails with indexed 'eucjpms' and 'ujis' char column
|
||||
#
|
||||
# Testing my_ctype_like_range_xxx
|
||||
# (used in LIKE optimization for an indexed column)
|
||||
#
|
||||
|
||||
# Create table using @@character_set_connection and @@collation_connection
|
||||
# for the string columns.
|
||||
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
|
||||
# Check pattern (important for ucs2, utf16, utf32)
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
|
||||
--echo 3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
DROP TABLE t1;
|
||||
42
build/lib/mysql/mysql-test/include/ctype_regex.inc
Normal file
42
build/lib/mysql/mysql-test/include/ctype_regex.inc
Normal file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# To test a desired collation, set session.collation_connection to
|
||||
# this collation before including this file
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Create a table with two varchar(64) null-able column,
|
||||
# using current values of
|
||||
# @@character_set_connection and @@collation_connection.
|
||||
#
|
||||
|
||||
create table t1 as
|
||||
select repeat(' ', 64) as s1, repeat(' ',64) as s2
|
||||
union
|
||||
select null, null;
|
||||
show create table t1;
|
||||
delete from t1;
|
||||
|
||||
insert into t1 values('aaa','aaa');
|
||||
insert into t1 values('aaa|qqq','qqq');
|
||||
insert into t1 values('gheis','^[^a-dXYZ]+$');
|
||||
insert into t1 values('aab','^aa?b');
|
||||
insert into t1 values('Baaan','^Ba*n');
|
||||
insert into t1 values('aaa','qqq|aaa');
|
||||
insert into t1 values('qqq','qqq|aaa');
|
||||
|
||||
insert into t1 values('bbb','qqq|aaa');
|
||||
insert into t1 values('bbb','qqq');
|
||||
insert into t1 values('aaa','aba');
|
||||
|
||||
insert into t1 values(null,'abc');
|
||||
insert into t1 values('def',null);
|
||||
insert into t1 values(null,null);
|
||||
insert into t1 values('ghi','ghi[');
|
||||
|
||||
select HIGH_PRIORITY s1 regexp s2 from t1;
|
||||
|
||||
drop table t1;
|
||||
48
build/lib/mysql/mysql-test/include/ddl_i18n.check_events.inc
Normal file
48
build/lib/mysql/mysql-test/include/ddl_i18n.check_events.inc
Normal file
@@ -0,0 +1,48 @@
|
||||
# - Check SHOW CREATE statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW CREATE EVENT ev1|
|
||||
--echo
|
||||
SHOW CREATE EVENT ev2|
|
||||
--echo
|
||||
SHOW CREATE EVENT mysqltest2.ev3|
|
||||
--echo
|
||||
SHOW CREATE EVENT mysqltest2.ev3|
|
||||
|
||||
# - Check SHOW statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW EVENTS LIKE 'ev1'|
|
||||
|
||||
--echo
|
||||
SHOW EVENTS LIKE 'ev2'|
|
||||
|
||||
--echo
|
||||
SHOW EVENTS LIKE 'ev3'|
|
||||
|
||||
--echo
|
||||
SHOW EVENTS LIKE 'ev4'|
|
||||
|
||||
# - Check INFORMATION_SCHEMA;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
--replace_column 17 CREATED 18 LAST_ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED 18 LAST_ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED 18 LAST_ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED 18 LAST_ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'|
|
||||
83
build/lib/mysql/mysql-test/include/ddl_i18n.check_sp.inc
Normal file
83
build/lib/mysql/mysql-test/include/ddl_i18n.check_sp.inc
Normal file
@@ -0,0 +1,83 @@
|
||||
# - Check SHOW CREATE statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW CREATE PROCEDURE p1|
|
||||
--echo
|
||||
SHOW CREATE PROCEDURE p2|
|
||||
--echo
|
||||
SHOW CREATE PROCEDURE mysqltest2.p3|
|
||||
--echo
|
||||
SHOW CREATE PROCEDURE mysqltest2.p4|
|
||||
|
||||
# - Check SHOW statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
--replace_column 5 MODIFIED 6 CREATED
|
||||
SHOW PROCEDURE STATUS LIKE 'p1'|
|
||||
|
||||
--echo
|
||||
--replace_column 5 MODIFIED 6 CREATED
|
||||
SHOW PROCEDURE STATUS LIKE 'p2'|
|
||||
|
||||
--echo
|
||||
--replace_column 5 MODIFIED 6 CREATED
|
||||
SHOW PROCEDURE STATUS LIKE 'p3'|
|
||||
|
||||
--echo
|
||||
--replace_column 5 MODIFIED 6 CREATED
|
||||
SHOW PROCEDURE STATUS LIKE 'p4'|
|
||||
|
||||
# - Check INFORMATION_SCHEMA;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
--replace_column 16 CREATED 17 ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'|
|
||||
|
||||
--echo
|
||||
--replace_column 16 CREATED 17 ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'|
|
||||
|
||||
--echo
|
||||
--replace_column 16 CREATED 17 ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'|
|
||||
|
||||
--echo
|
||||
--replace_column 16 CREATED 17 ALTERED
|
||||
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'|
|
||||
|
||||
# - Initialize the used variables (actual values don't matter);
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SET @a = '1'|
|
||||
SET @b = '2'|
|
||||
|
||||
# - Execute the routines;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
CALL p1(@a, @b)|
|
||||
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
|
||||
|
||||
--echo
|
||||
|
||||
CALL p2(@a, @b)|
|
||||
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
|
||||
|
||||
--echo
|
||||
|
||||
CALL mysqltest2.p3(@a, @b)|
|
||||
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
|
||||
|
||||
--echo
|
||||
|
||||
CALL mysqltest2.p4(@a, @b)|
|
||||
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
|
||||
106
build/lib/mysql/mysql-test/include/ddl_i18n.check_triggers.inc
Normal file
106
build/lib/mysql/mysql-test/include/ddl_i18n.check_triggers.inc
Normal file
@@ -0,0 +1,106 @@
|
||||
# - Check SHOW CREATE statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW CREATE TRIGGER trg1|
|
||||
--echo
|
||||
SHOW CREATE TRIGGER trg2|
|
||||
--echo
|
||||
SHOW CREATE TRIGGER mysqltest2.trg3|
|
||||
--echo
|
||||
SHOW CREATE TRIGGER mysqltest2.trg4|
|
||||
|
||||
# - Check SHOW statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW TRIGGERS|
|
||||
|
||||
--echo
|
||||
|
||||
use mysqltest2|
|
||||
|
||||
--echo
|
||||
|
||||
SHOW TRIGGERS|
|
||||
|
||||
use mysqltest1|
|
||||
|
||||
# - Check INFORMATION_SCHEMA;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
--replace_column 17 CREATED
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
|
||||
|
||||
--echo
|
||||
--replace_column 17 CREATED
|
||||
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
|
||||
|
||||
# - Initialize the used variables (actual values don't matter);
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SET @a1 = '1'|
|
||||
SET @a2 = '1'|
|
||||
SET @a3 = '1'|
|
||||
|
||||
SET @b1 = '2'|
|
||||
SET @b2 = '2'|
|
||||
SET @b3 = '2'|
|
||||
|
||||
# - Execute the triggers;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
INSERT INTO t1 VALUES(1)|
|
||||
|
||||
--echo
|
||||
--echo ---> Log:
|
||||
SELECT msg FROM log|
|
||||
|
||||
--echo
|
||||
SELECT
|
||||
COLLATION(@a1) AS ca1,
|
||||
COLLATION(@a2) AS ca2,
|
||||
COLLATION(@a3) AS ca3,
|
||||
COLLATION(@b1) AS cb1,
|
||||
COLLATION(@b2) AS cb2,
|
||||
COLLATION(@b3) AS cb3|
|
||||
|
||||
--echo
|
||||
DELETE FROM log|
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
INSERT INTO mysqltest2.t1 VALUES(1)|
|
||||
|
||||
--echo
|
||||
--echo ---> Log:
|
||||
SELECT msg FROM mysqltest2.log|
|
||||
|
||||
--echo
|
||||
SELECT
|
||||
COLLATION(@a1) AS ca1,
|
||||
COLLATION(@a2) AS ca2,
|
||||
COLLATION(@a3) AS ca3,
|
||||
COLLATION(@b1) AS cb1,
|
||||
COLLATION(@b2) AS cb2,
|
||||
COLLATION(@b3) AS cb3|
|
||||
|
||||
--echo
|
||||
DELETE FROM mysqltest2.log|
|
||||
44
build/lib/mysql/mysql-test/include/ddl_i18n.check_views.inc
Normal file
44
build/lib/mysql/mysql-test/include/ddl_i18n.check_views.inc
Normal file
@@ -0,0 +1,44 @@
|
||||
# - Check SHOW CREATE statement;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
|
||||
# - Check INFORMATION_SCHEMA;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
|
||||
# - Execute the views;
|
||||
|
||||
--echo
|
||||
--echo
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT COLLATION(c1) FROM v2|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM v3|
|
||||
172
build/lib/mysql/mysql-test/include/deadlock.inc
Normal file
172
build/lib/mysql/mysql-test/include/deadlock.inc
Normal file
@@ -0,0 +1,172 @@
|
||||
# include/deadlock.inc
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-26 ML refactoring + print when connection is switched
|
||||
# old name was t/innodb-deadlock.test
|
||||
# main code went into include/deadlock.inc
|
||||
#
|
||||
|
||||
--echo # Establish connection con1 (user=root)
|
||||
connect (con1,localhost,root,,);
|
||||
--echo # Establish connection con2 (user=root)
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1;
|
||||
#
|
||||
# Testing of FOR UPDATE
|
||||
#
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
eval create table t2 (b integer, a integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 10), (1, 20), (2, 30);
|
||||
commit;
|
||||
set autocommit=0;
|
||||
select * from t2;
|
||||
update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1, t2;
|
||||
eval create table t1 (id integer, x integer) engine = $engine_type;
|
||||
eval create table t2 (b integer, a integer) engine = $engine_type;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 0), (1, 20), (2, 30);
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
|
||||
select * from t2;
|
||||
select * from t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
|
||||
# The following query should hang because con1 is locking the record
|
||||
update t2 set a=2 where b = 0;
|
||||
select * from t2;
|
||||
--send
|
||||
update t1 set x=2 where id = 0;
|
||||
--sleep 2
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
reap;
|
||||
commit;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
# Cleanup
|
||||
--echo # Switch to connection default + disconnect con1 and con2
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#25164 create table `a` as select * from `A` hangs
|
||||
#
|
||||
|
||||
set storage_engine=innodb;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
--enable_warnings
|
||||
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
--error 0,ER_LOCK_DEADLOCK,ER_UPDATE_TABLE_USED
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists a;
|
||||
--enable_warnings
|
||||
|
||||
set storage_engine=default;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
40
build/lib/mysql/mysql-test/include/default_my.cnf
Normal file
40
build/lib/mysql/mysql-test/include/default_my.cnf
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2007 MySQL AB
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Use default setting for mysqld processes
|
||||
!include default_mysqld.cnf
|
||||
|
||||
[mysqld.1]
|
||||
|
||||
# Run the master.sh script before starting this process
|
||||
#!run-master-sh
|
||||
|
||||
log-bin= master-bin
|
||||
|
||||
|
||||
[mysqlbinlog]
|
||||
disable-force-if-open
|
||||
|
||||
# mysql_fix_privilege_tables.sh does not read from [client] so it
|
||||
# need its own section
|
||||
[mysql_fix_privilege_tables]
|
||||
socket= @client.socket
|
||||
port= @client.port
|
||||
user= @client.user
|
||||
password= @client.password
|
||||
|
||||
[ENV]
|
||||
MASTER_MYPORT= @mysqld.1.port
|
||||
MASTER_MYSOCK= @mysqld.1.socket
|
||||
36
build/lib/mysql/mysql-test/include/default_mysqld.cnf
Normal file
36
build/lib/mysql/mysql-test/include/default_mysqld.cnf
Normal file
@@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2007, 2008 MySQL AB
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Default values that applies to all MySQL Servers
|
||||
[mysqld]
|
||||
open-files-limit= 1024
|
||||
local-infile
|
||||
default-character-set= latin1
|
||||
|
||||
# Increase default connect_timeout to avoid intermittent
|
||||
# disconnects when test servers are put under load see BUG#28359
|
||||
connect-timeout= 60
|
||||
|
||||
log-bin-trust-function-creators=1
|
||||
key_buffer_size= 1M
|
||||
sort_buffer= 256K
|
||||
max_heap_table_size= 1M
|
||||
|
||||
loose-innodb_data_file_path= ibdata1:10M:autoextend
|
||||
|
||||
slave-net-timeout=120
|
||||
|
||||
log-bin=mysqld-bin
|
||||
|
||||
27
build/lib/mysql/mysql-test/include/default_ndbd.cnf
Normal file
27
build/lib/mysql/mysql-test/include/default_ndbd.cnf
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
[cluster_config]
|
||||
MaxNoOfSavedMessages= 1000
|
||||
MaxNoOfConcurrentTransactions= 128
|
||||
MaxNoOfConcurrentOperations= 10000
|
||||
DataMemory= 20M
|
||||
IndexMemory= 1M
|
||||
Diskless= 0
|
||||
TimeBetweenWatchDogCheck= 30000
|
||||
MaxNoOfOrderedIndexes= 32
|
||||
MaxNoOfAttributes= 2048
|
||||
TimeBetweenGlobalCheckpoints= 500
|
||||
NoOfFragmentLogFiles= 4
|
||||
FragmentLogFileSize= 12M
|
||||
DiskPageBufferMemory= 4M
|
||||
|
||||
# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
|
||||
#ODirect= 1
|
||||
# the following parametes just function as a small regression
|
||||
# test that the parameter exists
|
||||
InitialNoOfOpenFiles= 27
|
||||
|
||||
# Increase timeouts for slow test-machines
|
||||
HeartbeatIntervalDbDb= 30000
|
||||
HeartbeatIntervalDbApi= 30000
|
||||
|
||||
#TransactionDeadlockDetectionTimeout= 7500
|
||||
@@ -0,0 +1,7 @@
|
||||
# Remove anonymous users added by add_anonymous_users.inc
|
||||
disable_warnings;
|
||||
disable_query_log;
|
||||
DELETE FROM mysql.user where host='localhost' and user='';
|
||||
FLUSH PRIVILEGES;
|
||||
enable_query_log;
|
||||
enable_warnings;
|
||||
190
build/lib/mysql/mysql-test/include/diff_tables.inc
Normal file
190
build/lib/mysql/mysql-test/include/diff_tables.inc
Normal file
@@ -0,0 +1,190 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Check if all tables in the given list are equal. The tables may have
|
||||
# different names, exist in different connections, and/or reside in
|
||||
# different databases.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $diff_tables= [con1:][db1.]t1, [con2:][db2.]t2, ... , [conN:][dbN.]tN
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/diff_tables.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $diff_tables
|
||||
# Comma-separated list of tables to compare. Each table has the form
|
||||
#
|
||||
# [CONNECTION:][DATABASE.]table
|
||||
#
|
||||
# If CONNECTION is given, then that connection is used. If
|
||||
# CONNECTION is not given, then the connection of the previous
|
||||
# table is used (or the current connection, if this is the first
|
||||
# table). If DATABASE is given, the table is read in that
|
||||
# database. If DATABASE is not given, the table is read in the
|
||||
# connection's current database.
|
||||
#
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
#
|
||||
#
|
||||
# ==== Side effects ====
|
||||
#
|
||||
# - Prints "include/diff_tables.inc [$diff_tables]".
|
||||
#
|
||||
# - If the tables are different, prints the difference in a
|
||||
# system-specific format (unified diff if supported) and generates
|
||||
# an error.
|
||||
#
|
||||
#
|
||||
# ==== Bugs ====
|
||||
#
|
||||
# - It is currently not possible to use this for tables that are
|
||||
# supposed to be different, because if the files are different:
|
||||
# - 'diff' produces system-dependent output,
|
||||
# - the output includes the absolute path of the compared files,
|
||||
# - the output includes a timestamp.
|
||||
# To fix that, we'd probably have to use SQL to compute the
|
||||
# symmetric difference between the tables. I'm not sure how to do
|
||||
# that efficiently. If we implement this, it would be nice to
|
||||
# compare the table definitions too.
|
||||
#
|
||||
# - It actually compares the result of "SELECT * FROM table ORDER BY
|
||||
# col1, col2, ..., colN INTO OUTFILE 'file'". Hence, it is assumed
|
||||
# that the comparison orders for both tables are equal and that two
|
||||
# rows that are equal in the comparison order cannot differ, e.g.,
|
||||
# by character case.
|
||||
|
||||
|
||||
--let $include_filename= diff_tables.inc [$diff_tables]
|
||||
--source include/begin_include_file.inc
|
||||
|
||||
|
||||
if (!$rpl_debug)
|
||||
{
|
||||
--disable_query_log
|
||||
}
|
||||
|
||||
|
||||
# Check sanity
|
||||
if (`SELECT LOCATE(',', '$diff_tables') = 0`)
|
||||
{
|
||||
--die ERROR IN TEST: $diff_tables must contain at least two tables (separated by comma)
|
||||
}
|
||||
|
||||
|
||||
# ==== Save both tables to file ====
|
||||
|
||||
# Trim off whitespace
|
||||
--let $_dt_tables= `SELECT REPLACE('$diff_tables', ' ', '')`
|
||||
|
||||
# Iterate over all tables
|
||||
--let $_dt_outfile=
|
||||
--let $_dt_prev_outfile=
|
||||
while (`SELECT '$_dt_tables' != ''`)
|
||||
{
|
||||
--let $_dt_table= `SELECT SUBSTRING_INDEX('$_dt_tables', ',', 1)`
|
||||
--let $_dt_tables= `SELECT SUBSTRING('$_dt_tables', LENGTH('$_dt_table') + 2)`
|
||||
|
||||
# Parse connection, if any
|
||||
--let $_dt_colon_index= `SELECT LOCATE(':', '$_dt_table')`
|
||||
if ($_dt_colon_index)
|
||||
{
|
||||
--let $_dt_connection= `SELECT SUBSTRING('$_dt_table', 1, $_dt_colon_index - 1)`
|
||||
--let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_colon_index + 1)`
|
||||
--let $rpl_connection_name= $_dt_connection
|
||||
--source include/rpl_connection.inc
|
||||
}
|
||||
|
||||
# Parse database name, if any
|
||||
--let $_dt_database_index= `SELECT LOCATE('.', '$_dt_table')`
|
||||
if ($_dt_database_index)
|
||||
{
|
||||
--let $_dt_database= `SELECT SUBSTRING('$_dt_table', 1, $_dt_database_index - 1)`
|
||||
--let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_database_index + 1)`
|
||||
}
|
||||
if (!$_dt_database_index)
|
||||
{
|
||||
--let $_dt_database= `SELECT DATABASE()`
|
||||
}
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo con='$_dt_connection' db='$_dt_database' table='$_dt_table'
|
||||
--echo rest of tables='$_dt_tables'
|
||||
}
|
||||
|
||||
# We need to sort the output files so that diff_files does not think
|
||||
# the tables are different just because the rows are differently
|
||||
# ordered. To this end, we first generate a string containing a
|
||||
# comma-separated list of all column names. This is used in the
|
||||
# ORDER BY clause of the following SELECT statement. We get the
|
||||
# column names from INFORMATION_SCHEMA.COLUMNS, and we concatenate
|
||||
# them with GROUP_CONCAT. Since GROUP_CONCAT is limited by the
|
||||
# @@SESSION.group_concat_max_len, which is only 1024 by default, we
|
||||
# first compute the total size of all columns and then increase this
|
||||
# limit if needed. We restore the limit afterwards so as not to
|
||||
# interfere with the test case.
|
||||
|
||||
# Compute length of ORDER BY clause.
|
||||
let $_dt_order_by_length=
|
||||
`SELECT SUM(LENGTH(column_name) + 3) FROM information_schema.columns
|
||||
WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`;
|
||||
if (!$_dt_order_by_length)
|
||||
{
|
||||
--echo ERROR IN TEST: table $_dt_database.$_dt_table not found in INFORMATION_SCHEMA.COLUMNS. Did you misspell it?
|
||||
--die ERROR IN TEST: table not found in INFORMATION_SCHEMA. Did you misspell it?
|
||||
}
|
||||
--let $_dt_old_group_concat_max_len=
|
||||
# Increase group_concat_max_len if needed.
|
||||
if (`SELECT $_dt_order_by_length > @@SESSION.group_concat_max_len`)
|
||||
{
|
||||
--let $_dt_old_group_concat_max_len= `SELECT @@SESSION.group_concat_max_len`
|
||||
--eval SET SESSION group_concat_max_len = $_dt_order_by_length;
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # increasing group_concat_max_len from $_dt_old_group_concat_max_len to $_dt_order_by_length
|
||||
}
|
||||
}
|
||||
# Generate ORDER BY clause.
|
||||
# It would be better to do GROUP_CONCAT(CONCAT('`', column_name, '`')) but
|
||||
# BUG#58087 prevents us from returning strings that begin with backticks.
|
||||
let $_dt_column_list=
|
||||
`SELECT GROUP_CONCAT(column_name ORDER BY ORDINAL_POSITION SEPARATOR '`,`')
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`;
|
||||
# Restore group_concat_max_len.
|
||||
if ($_dt_old_group_concat_max_len)
|
||||
{
|
||||
--let $_dt_dummy= `SET SESSION group_concat_max_len = $_dt_old_group_concat_max_len
|
||||
}
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo using ORDER BY clause '`$_dt_column_list`'
|
||||
}
|
||||
|
||||
# Now that we have the comma-separated list of columns, we can write
|
||||
# the table to a file.
|
||||
--let $_dt_outfile= `SELECT @@datadir`
|
||||
--let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table
|
||||
eval SELECT * FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list` INTO OUTFILE '$_dt_outfile';
|
||||
|
||||
# Compare files.
|
||||
if ($_dt_prev_outfile)
|
||||
{
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo # diffing $_dt_prev_outfile vs $_dt_outfile
|
||||
}
|
||||
--diff_files $_dt_prev_outfile $_dt_outfile
|
||||
# Remove previous outfile. Keep current file for comparison with next table.
|
||||
--remove_file $_dt_prev_outfile
|
||||
}
|
||||
--let $_dt_prev_outfile= $_dt_outfile
|
||||
}
|
||||
|
||||
--remove_file $_dt_prev_outfile
|
||||
|
||||
|
||||
--let $include_filename= diff_tables.inc [$diff_tables]
|
||||
--source include/end_include_file.inc
|
||||
79
build/lib/mysql/mysql-test/include/end_include_file.inc
Normal file
79
build/lib/mysql/mysql-test/include/end_include_file.inc
Normal file
@@ -0,0 +1,79 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# See include/begin_include_file.inc
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# # At the end of include/my_file.inc:
|
||||
# --let $include_filename= my_file.inc
|
||||
# [--let $skip_restore_connection= 1]
|
||||
# [--let $rpl_debug= 1]
|
||||
# --source include/begin_include_file.inc
|
||||
#
|
||||
# Parameters:
|
||||
# $include_filename
|
||||
# Name of file that sources this file.
|
||||
#
|
||||
# $skip_restore_connection
|
||||
# By default, this script restores the connection that was active
|
||||
# when begin_include_file.inc was sourced. If
|
||||
# $skip_restore_connection is set, then this step is skipped and
|
||||
# end_include_file.inc leaves the connection as it was before
|
||||
# end_include_file.inc was sourced.
|
||||
|
||||
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_warnings', 1, 1)`
|
||||
--let $_include_file_enabled_warnings= `SELECT SUBSTRING('$_include_file_enabled_warnings', 2)`
|
||||
if ($_tmp) {
|
||||
--enable_warnings
|
||||
}
|
||||
if (!$_tmp) {
|
||||
--disable_warnings
|
||||
}
|
||||
|
||||
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_query_log', 1, 1)`
|
||||
--let $_include_file_enabled_query_log= `SELECT SUBSTRING('$_include_file_enabled_query_log', 2)`
|
||||
if ($_tmp) {
|
||||
--enable_query_log
|
||||
}
|
||||
if (!$_tmp) {
|
||||
--disable_query_log
|
||||
}
|
||||
|
||||
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_result_log', 1, 1)`
|
||||
--let $_include_file_enabled_result_log= `SELECT SUBSTRING('$_include_file_enabled_result_log', 2)`
|
||||
if ($_tmp) {
|
||||
--enable_result_log
|
||||
}
|
||||
if (!$_tmp) {
|
||||
--disable_result_log
|
||||
}
|
||||
|
||||
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 1, 1)`
|
||||
--let $_include_file_enabled_abort_on_error= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 2)`
|
||||
if ($_tmp) {
|
||||
--enable_abort_on_error
|
||||
}
|
||||
if (!$_tmp) {
|
||||
--disable_abort_on_error
|
||||
}
|
||||
|
||||
--let $_include_file_rpl_connection_name= `SELECT SUBSTRING_INDEX('$_include_file_connection', ',', 1)`
|
||||
--let $_include_file_connection= `SELECT SUBSTRING('$_include_file_connection', LENGTH('$_include_file_rpl_connection_name') + 2)`
|
||||
if (!$skip_restore_connection)
|
||||
{
|
||||
--let $rpl_connection_name= $_include_file_rpl_connection_name
|
||||
--source include/rpl_connection.inc
|
||||
}
|
||||
--let $skip_restore_connection= 0
|
||||
|
||||
|
||||
--dec $_include_file_depth
|
||||
--let $_include_file_indent= `SELECT REPEAT('.', $_include_file_depth)`
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo $_include_file_indent==== END include/$include_filename ====
|
||||
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
|
||||
}
|
||||
--let $include_filename=
|
||||
7
build/lib/mysql/mysql-test/include/endspace.inc
Normal file
7
build/lib/mysql/mysql-test/include/endspace.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
|
||||
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
|
||||
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
|
||||
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
|
||||
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
|
||||
select 'a a' > 'a', 'a \0' < 'a';
|
||||
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
|
||||
17
build/lib/mysql/mysql-test/include/file_does_not_exist.inc
Normal file
17
build/lib/mysql/mysql-test/include/file_does_not_exist.inc
Normal file
@@ -0,0 +1,17 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Checks that a given file does not exist. If the file exists, the
|
||||
# test fails.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $file_does_not_exist= /path/to/file
|
||||
# --source include/file_does_not_exist.inc
|
||||
|
||||
# Will fail if file exists.
|
||||
--write_file $file_does_not_exist
|
||||
tmp
|
||||
EOF
|
||||
|
||||
# Remove file again.
|
||||
--remove_file $file_does_not_exist
|
||||
17
build/lib/mysql/mysql-test/include/force_restart.inc
Normal file
17
build/lib/mysql/mysql-test/include/force_restart.inc
Normal file
@@ -0,0 +1,17 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Tell mtr that all servers must be restarted after the test has
|
||||
# finished.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --source include/force_restart.inc
|
||||
#
|
||||
# ==== See also ====
|
||||
#
|
||||
# include/force_restart_if_skipped.inc
|
||||
|
||||
--let $_force_restart_datadir= `SELECT @@datadir`
|
||||
--append_file $_force_restart_datadir/mtr/force_restart
|
||||
1
|
||||
EOF
|
||||
@@ -0,0 +1,17 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Tell mtr that all servers must be restarted in case the test is
|
||||
# skipped.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --source include/force_restart_if_skipped.inc
|
||||
#
|
||||
# ==== See also ====
|
||||
#
|
||||
# include/force_restart.inc
|
||||
|
||||
--let $_force_restart_datadir= `SELECT @@datadir`
|
||||
--append_file $_force_restart_datadir/mtr/force_restart_if_skipped
|
||||
1
|
||||
EOF
|
||||
70
build/lib/mysql/mysql-test/include/get_relay_log_pos.inc
Normal file
70
build/lib/mysql/mysql-test/include/get_relay_log_pos.inc
Normal file
@@ -0,0 +1,70 @@
|
||||
# For a given event which is at position $master_log_pos in the the master's
|
||||
# binary log, returns its position in the slave's relay log file
|
||||
# $relay_log_file.
|
||||
# The position is stored in the variable $relay_log_pos.
|
||||
|
||||
# Usage:
|
||||
# let $relay_log_file= 'relay-log-bin.000001';
|
||||
# let $master_log_pos= 106;
|
||||
# source include/get_relay_log_pos.inc;
|
||||
# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position
|
||||
# # in $relay_log_file: $relay_log_pos.
|
||||
|
||||
if (!$relay_log_file)
|
||||
{
|
||||
--die 'variable $relay_log_file is null'
|
||||
}
|
||||
|
||||
if (!$master_log_pos)
|
||||
{
|
||||
--die 'variable $master_log_pos is null'
|
||||
}
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
let $_suffix= `SELECT UUID()`;
|
||||
let $_tmp_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.$_suffix;
|
||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$relay_log_file > $_tmp_file
|
||||
|
||||
# All queries in this file should not be logged.
|
||||
--disable_query_log
|
||||
|
||||
--disable_warnings
|
||||
DROP TEMPORARY TABLE IF EXISTS mysqlbinlog_events;
|
||||
DROP TEMPORARY TABLE IF EXISTS events_at;
|
||||
DROP TEMPORARY TABLE IF EXISTS events_pos;
|
||||
CREATE TEMPORARY TABLE mysqlbinlog_events(c1 INT AUTO_INCREMENT KEY, c2 varchar(256));
|
||||
|
||||
# Event position is in the comments output by mysqlbinlog, we load this
|
||||
# comments into the table
|
||||
# '# at 106'
|
||||
# '# .... end_log_pos 46'
|
||||
eval LOAD DATA LOCAL INFILE '$_tmp_file' INTO TABLE mysqlbinlog_events
|
||||
LINES STARTING BY '#' (c2) SET c1 = NULL;
|
||||
--enable_warnings
|
||||
|
||||
# Event pos in relay log file is inserted into table events_at
|
||||
CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
|
||||
SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE ' at%' ORDER BY c1;
|
||||
|
||||
# Event pos in master log file is inserted into table events_pos
|
||||
CREATE TEMPORARY TABLE events_pos(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
|
||||
SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE '% end_log_pos %' ORDER BY c1;
|
||||
|
||||
# events_at events_pos
|
||||
# c1------c2-------------------------- c1------c2------------------------
|
||||
# 1 ev1's begin pos in relay log 1 ev1's end pos in master log
|
||||
# 2 ev2's begin pos in relay log 2 ev2's end pos in master log
|
||||
# 3 ev3's begin pos in relay log 3 ev3's end pos in master log
|
||||
# events always keep the same sequence.
|
||||
# Because event[N]'s end pos is equal to event[N+1]'s begin pos we want to
|
||||
# find event's end pos in relay log, we can find the right relay_log_pos
|
||||
# using the relationship that 'events_pos.c1 = events_at.c1 + 1'
|
||||
#
|
||||
# There is a fault that we can't get the relay log position of the last event,
|
||||
# as it is not output by mysqlbinlog
|
||||
let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5)
|
||||
FROM events_at a, events_pos b
|
||||
WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`;
|
||||
DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos;
|
||||
--remove_file $_tmp_file
|
||||
--enable_query_log
|
||||
250
build/lib/mysql/mysql-test/include/gis_generic.inc
Normal file
250
build/lib/mysql/mysql-test/include/gis_generic.inc
Normal file
@@ -0,0 +1,250 @@
|
||||
--source include/have_geometry.inc
|
||||
|
||||
#
|
||||
# Spatial objects
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
|
||||
CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
|
||||
CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
|
||||
CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
|
||||
CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
|
||||
CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
|
||||
CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
|
||||
|
||||
SHOW CREATE TABLE gis_point;
|
||||
SHOW FIELDS FROM gis_point;
|
||||
SHOW FIELDS FROM gis_line;
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
SHOW FIELDS FROM gis_multi_line;
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
|
||||
|
||||
INSERT INTO gis_point VALUES
|
||||
(101, PointFromText('POINT(10 10)')),
|
||||
(102, PointFromText('POINT(20 10)')),
|
||||
(103, PointFromText('POINT(20 20)')),
|
||||
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
|
||||
|
||||
INSERT INTO gis_line VALUES
|
||||
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
|
||||
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
|
||||
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
|
||||
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
|
||||
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
|
||||
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
|
||||
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
|
||||
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
|
||||
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
|
||||
|
||||
INSERT INTO gis_multi_line VALUES
|
||||
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
|
||||
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
|
||||
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
|
||||
|
||||
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
|
||||
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
|
||||
|
||||
INSERT into gis_geometry SELECT * FROM gis_point;
|
||||
INSERT into gis_geometry SELECT * FROM gis_line;
|
||||
INSERT into gis_geometry SELECT * FROM gis_polygon;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_point;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_line;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
|
||||
INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
|
||||
|
||||
SELECT fid, AsText(g) FROM gis_point ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_line ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_polygon ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid;
|
||||
SELECT fid, AsText(g) FROM gis_geometry ORDER by fid;
|
||||
|
||||
SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid;
|
||||
SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid;
|
||||
SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid;
|
||||
SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid;
|
||||
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
|
||||
|
||||
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
||||
SELECT fid, Y(g) FROM gis_point ORDER by fid;
|
||||
explain extended select X(g),Y(g) FROM gis_point;
|
||||
|
||||
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
||||
SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid;
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid;
|
||||
SELECT fid, IsClosed(g) FROM gis_line ORDER by fid;
|
||||
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
|
||||
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid;
|
||||
SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid;
|
||||
SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid;
|
||||
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
|
||||
|
||||
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
||||
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
|
||||
SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid;
|
||||
SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid;
|
||||
SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid;
|
||||
SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid;
|
||||
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
||||
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid;
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid;
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid;
|
||||
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid;
|
||||
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
||||
|
||||
SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
|
||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
|
||||
#
|
||||
# Check that ALTER TABLE doesn't loose geometry type
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
gp point,
|
||||
ln linestring,
|
||||
pg polygon,
|
||||
mp multipoint,
|
||||
mln multilinestring,
|
||||
mpg multipolygon,
|
||||
gc geometrycollection,
|
||||
gm geometry
|
||||
);
|
||||
|
||||
SHOW FIELDS FROM t1;
|
||||
ALTER TABLE t1 ADD fid INT;
|
||||
SHOW FIELDS FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
create table t1 (pk integer primary key auto_increment, a geometry not null);
|
||||
insert into t1 (a) values (GeomFromText('Point(1 2)'));
|
||||
-- error 1416
|
||||
insert into t1 (a) values ('Garbage');
|
||||
-- error 1416
|
||||
insert IGNORE into t1 (a) values ('Garbage');
|
||||
|
||||
drop table t1;
|
||||
|
||||
create table t1 (pk integer primary key auto_increment, fl geometry not null);
|
||||
--error 1416
|
||||
insert into t1 (fl) values (1);
|
||||
--error 1416
|
||||
insert into t1 (fl) values (1.11);
|
||||
--error 1416
|
||||
insert into t1 (fl) values ("qwerty");
|
||||
--error 1048
|
||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#24563: MBROverlaps does not seem to function propertly
|
||||
# Bug#54888: MBROverlaps missing in 5.1?
|
||||
#
|
||||
|
||||
# Test all MBR* functions and their non-MBR-prefixed aliases,
|
||||
# using shifted squares to verify the spatial relations.
|
||||
|
||||
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
|
||||
|
||||
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
|
||||
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
|
||||
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
|
||||
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
|
||||
# Overlaps needs a few more tests, with point and line dimensions
|
||||
|
||||
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||
|
||||
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
62
build/lib/mysql/mysql-test/include/gis_keys.inc
Normal file
62
build/lib/mysql/mysql-test/include/gis_keys.inc
Normal file
@@ -0,0 +1,62 @@
|
||||
--source include/have_geometry.inc
|
||||
|
||||
#
|
||||
# Spatial objects with keys
|
||||
#
|
||||
|
||||
#
|
||||
# Bug #30825: Problems when putting a non-spatial index on a GIS column
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (p POINT);
|
||||
CREATE TABLE t2 (p POINT, INDEX(p));
|
||||
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
|
||||
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
|
||||
|
||||
# no index, returns 1 as expected
|
||||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
# with index, returns 1 as expected
|
||||
# EXPLAIN shows that the index is not used though
|
||||
# due to the "most rows covered anyway, so a scan is more effective" rule
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
# adding another row to the table so that
|
||||
# the "most rows covered" rule doesn't kick in anymore
|
||||
# now EXPLAIN shows the index used on the table
|
||||
# and we're getting the wrong result again
|
||||
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
|
||||
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #58650 "Failing assertion: primary_key_no == -1 ||
|
||||
--echo # primary_key_no == 0".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--echo # The minimal test case.
|
||||
create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a));
|
||||
drop table t1;
|
||||
--echo # The original test case.
|
||||
create table t1 (a int not null, b linestring not null, unique key b (b(12)));
|
||||
create unique index a on t1(a);
|
||||
drop table t1;
|
||||
218
build/lib/mysql/mysql-test/include/grant_cache.inc
Normal file
218
build/lib/mysql/mysql-test/include/grant_cache.inc
Normal file
@@ -0,0 +1,218 @@
|
||||
################### include/grant_cache.inc ####################
|
||||
#
|
||||
# Test grants with query cache
|
||||
#
|
||||
# Last update:
|
||||
# 2007-05-03 ML - Move t/grant_cache.test to include/grant_cache.inc
|
||||
# - Remove the disabling of the ps-protocol
|
||||
# - minor improvements like error names instead of numbers
|
||||
# - Create two toplevel tests sourcing this routine
|
||||
#
|
||||
# Running this test with and without "--ps-protocol" produces different
|
||||
# Qcache_not_cached results because of the following reason:
|
||||
# In normal protocol, a SELECT failing due to insufficient privileges
|
||||
# increments Qcache_not_cached, while in ps-protocol, no.
|
||||
# In detail:
|
||||
# - In normal protocol,
|
||||
# the "access denied" errors on SELECT are issued at (stack trace):
|
||||
# mysql_parse/mysql_execute_command/execute_sqlcom_select/handle_select/
|
||||
# mysql_select/JOIN::prepare/setup_wild/insert_fields/
|
||||
# check_grant_all_columns/my_error/my_message_sql, which then calls
|
||||
# push_warning/query_cache_abort: at this moment,
|
||||
# query_cache_store_query() has been called, so query exists in cache,
|
||||
# so thd->net.query_cache_query!=NULL, so query_cache_abort() removes
|
||||
# the query from cache, which causes a query_cache.refused++ (thus,
|
||||
# a Qcache_not_cached++).
|
||||
# - In ps-protocol,
|
||||
# the error is issued at prepare time;
|
||||
# for this mysql_test_select() is called, not execute_sqlcom_select()
|
||||
# (and that also leads to JOIN::prepare/etc). Thus, as
|
||||
# query_cache_store_query() has not been called,
|
||||
# thd->net.query_cache_query==NULL, so query_cache_abort() does nothing:
|
||||
# Qcache_not_cached is not incremented.
|
||||
#
|
||||
# A run of this tests with sp/cursor/view protocol does not make sense
|
||||
# because these protocols serve totally different purposes than this test.
|
||||
#
|
||||
|
||||
--source include/add_anonymous_users.inc
|
||||
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
|
||||
reset query cache;
|
||||
flush status;
|
||||
--echo ----- establish connection root -----
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection root;
|
||||
show grants for current_user;
|
||||
show grants;
|
||||
--disable_warnings
|
||||
create database if not exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create table mysqltest.t1 (a int,b int,c int);
|
||||
create table mysqltest.t2 (a int,b int,c int);
|
||||
insert into mysqltest.t1 values (1,1,1),(2,2,2);
|
||||
insert into mysqltest.t2 values (3,3,3);
|
||||
create table test.t1 (a char (10));
|
||||
insert into test.t1 values ("test.t1");
|
||||
select * from t1;
|
||||
--echo ----- establish connection root2 -----
|
||||
connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection root2;
|
||||
# put queries in cache
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
select c from t1;
|
||||
select * from t2;
|
||||
select * from mysqltest.t1,test.t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits%";
|
||||
|
||||
# Create the test users
|
||||
grant SELECT on mysqltest.* to mysqltest_1@localhost;
|
||||
grant SELECT on mysqltest.t1 to mysqltest_2@localhost;
|
||||
grant SELECT on test.t1 to mysqltest_2@localhost;
|
||||
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
|
||||
|
||||
# The following queries should be fetched from cache
|
||||
--echo ----- establish connection user1 (user=mysqltest_1) -----
|
||||
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user1;
|
||||
show grants for current_user();
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
select "user1";
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
select * from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
# The pre and end space are intentional
|
||||
select a from t1 ;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
select c from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
|
||||
|
||||
--echo ----- establish connection unkuser (user=unkuser) -----
|
||||
# Don't use '' as user because it will pick Unix login
|
||||
connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection unkuser;
|
||||
show grants for current_user();
|
||||
|
||||
# The following queries should be fetched from cache
|
||||
--echo ----- establish connection user2 (user=mysqltest_2) -----
|
||||
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user2;
|
||||
select "user2";
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
select c from t1;
|
||||
select * from mysqltest.t1,test.t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
|
||||
# The following queries should not be fetched from cache
|
||||
--echo ----- establish connection user3 (user=mysqltest_3) -----
|
||||
connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user3;
|
||||
select "user3";
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
select c from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t2;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
select mysqltest.t1.c from test.t1,mysqltest.t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
|
||||
# Connect without a database
|
||||
--echo ----- establish connection user4 (user=mysqltest_1) -----
|
||||
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user4;
|
||||
select "user4";
|
||||
show grants;
|
||||
--error ER_NO_DB_ERROR
|
||||
select a from t1;
|
||||
# The following query is not cached before (different database)
|
||||
select * from mysqltest.t1,test.t1;
|
||||
# Cache a query with 'no database'
|
||||
select a from mysqltest.t1;
|
||||
select a from mysqltest.t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_hits";
|
||||
show status like "Qcache_not_cached";
|
||||
|
||||
# Cleanup
|
||||
|
||||
--echo ----- close connections -----
|
||||
connection root;
|
||||
disconnect root;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection root2;
|
||||
disconnect root2;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection user1;
|
||||
disconnect user1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection user2;
|
||||
disconnect user2;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection user3;
|
||||
disconnect user3;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection user4;
|
||||
disconnect user4;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection unkuser;
|
||||
disconnect unkuser;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--echo ----- switch to connection default -----
|
||||
connection default;
|
||||
|
||||
#
|
||||
# A temporary 4.1 workaround to make this test pass if
|
||||
# mysql was compiled with other than latin1 --with-charset=XXX.
|
||||
# Without "set names binary" the below queries fail with
|
||||
# "Illegal mix of collations" error.
|
||||
# In 5.0 we will change grant tables to use NCHAR(N) instead
|
||||
# of "CHAR(N) BINARY", and use cast-to-nchar: N'mysqltest_1'.
|
||||
#
|
||||
set names binary;
|
||||
delete from mysql.user where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
||||
delete from mysql.db where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
||||
delete from mysql.tables_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
||||
delete from mysql.columns_priv where user in ("mysqltest_1","mysqltest_2","mysqltest_3");
|
||||
flush privileges;
|
||||
drop table test.t1,mysqltest.t1,mysqltest.t2;
|
||||
drop database mysqltest;
|
||||
|
||||
set GLOBAL query_cache_size=default;
|
||||
|
||||
--source include/delete_anonymous_users.inc
|
||||
731
build/lib/mysql/mysql-test/include/handler.inc
Normal file
731
build/lib/mysql/mysql-test/include/handler.inc
Normal file
@@ -0,0 +1,731 @@
|
||||
# include/handler.inc
|
||||
#
|
||||
# The variables
|
||||
# $engine_type -- storage engine to be tested
|
||||
# $other_engine_type -- storage engine <> $engine_type
|
||||
# $other_handler_engine_type -- storage engine <> $engine_type, if possible
|
||||
# 1. $other_handler_engine_type must support handler
|
||||
# 2. $other_handler_engine_type must point to an all
|
||||
# time available storage engine
|
||||
# 2006-08 MySQL 5.1 MyISAM and MEMORY only
|
||||
# have to be set before sourcing this script.
|
||||
-- source include/not_embedded.inc
|
||||
#
|
||||
# test of HANDLER ...
|
||||
#
|
||||
# Last update:
|
||||
# 2006-07-31 ML test refactored (MySQL 5.1)
|
||||
# code of t/handler.test and t/innodb_handler.test united
|
||||
# main testing code put into include/handler.inc
|
||||
#
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t3,t4,t5;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int, b char(10), key a(a), key b(a,b));
|
||||
insert into t1 values
|
||||
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
|
||||
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
|
||||
(20,"ggg"),(21,"hhh"),(22,"iii");
|
||||
handler t1 open as t2;
|
||||
-- error 1064
|
||||
handler t2 read a=(SELECT 1);
|
||||
handler t2 read a first;
|
||||
handler t2 read a next;
|
||||
handler t2 read a next;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a last;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a prev;
|
||||
|
||||
handler t2 read a first;
|
||||
handler t2 read a prev;
|
||||
|
||||
handler t2 read a last;
|
||||
handler t2 read a prev;
|
||||
handler t2 read a next;
|
||||
handler t2 read a next;
|
||||
|
||||
handler t2 read a=(15);
|
||||
handler t2 read a=(16);
|
||||
|
||||
--error 1070
|
||||
handler t2 read a=(19,"fff");
|
||||
|
||||
handler t2 read b=(19,"fff");
|
||||
handler t2 read b=(19,"yyy");
|
||||
handler t2 read b=(19);
|
||||
|
||||
--error 1109
|
||||
handler t1 read a last;
|
||||
|
||||
handler t2 read a=(11);
|
||||
handler t2 read a>=(11);
|
||||
|
||||
handler t2 read a=(18);
|
||||
handler t2 read a>=(18);
|
||||
handler t2 read a>(18);
|
||||
handler t2 read a<=(18);
|
||||
handler t2 read a<(18);
|
||||
|
||||
handler t2 read a first limit 5;
|
||||
handler t2 read a next limit 3;
|
||||
handler t2 read a prev limit 10;
|
||||
|
||||
handler t2 read a>=(16) limit 4;
|
||||
handler t2 read a>=(16) limit 2,2;
|
||||
handler t2 read a last limit 3;
|
||||
|
||||
handler t2 read a=(19);
|
||||
handler t2 read a=(19) where b="yyy";
|
||||
|
||||
handler t2 read first;
|
||||
handler t2 read next;
|
||||
handler t2 read next;
|
||||
--error 1064
|
||||
handler t2 read last;
|
||||
handler t2 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a next; # this used to crash as a bug#5373
|
||||
handler t1 read a next;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open;
|
||||
handler t1 read a prev; # this used to crash as a bug#5373
|
||||
handler t1 read a prev;
|
||||
handler t1 close;
|
||||
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
eval alter table t1 engine = $engine_type;
|
||||
--error 1109
|
||||
handler t2 read first;
|
||||
|
||||
#
|
||||
# DROP TABLE / ALTER TABLE
|
||||
#
|
||||
handler t1 open as t2;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (17);
|
||||
--error 1109
|
||||
handler t2 read first;
|
||||
handler t1 open as t2;
|
||||
eval alter table t1 engine=$other_engine_type;
|
||||
--error 1109
|
||||
handler t2 read first;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test case for the bug #787
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
delete from t1 limit 2;
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
handler t1 read first limit 1,1;
|
||||
handler t1 read first limit 2,2;
|
||||
delete from t1 limit 3;
|
||||
handler t1 read first;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for #751
|
||||
#
|
||||
create table t1(a int, index(a));
|
||||
insert into t1 values (1), (2), (3);
|
||||
handler t1 open;
|
||||
--error 1054
|
||||
handler t1 read a=(W);
|
||||
--error 1210
|
||||
handler t1 read a=(a);
|
||||
drop table t1;
|
||||
#
|
||||
# BUG#2304
|
||||
#
|
||||
create table t1 (a char(5));
|
||||
insert into t1 values ("Ok");
|
||||
handler t1 open as t;
|
||||
handler t read first;
|
||||
use mysql;
|
||||
handler t read first;
|
||||
handler t close;
|
||||
handler test.t1 open as t;
|
||||
handler t read first;
|
||||
handler t close;
|
||||
use test;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#3649
|
||||
#
|
||||
create table t1 ( a int, b int, INDEX a (a) );
|
||||
insert into t1 values (1,2), (2,1);
|
||||
handler t1 open;
|
||||
handler t1 read a=(1) where b=2;
|
||||
handler t1 read a=(1) where b=3;
|
||||
handler t1 read a=(1) where b=1;
|
||||
handler t1 close;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check if two database names beginning the same are seen as different.
|
||||
#
|
||||
# This database begins like the usual 'test' database.
|
||||
#
|
||||
--disable_warnings
|
||||
drop database if exists test_test;
|
||||
--enable_warnings
|
||||
create database test_test;
|
||||
use test_test;
|
||||
create table t1(table_id char(20) primary key);
|
||||
insert into t1 values ('test_test.t1');
|
||||
insert into t1 values ('');
|
||||
handler t1 open;
|
||||
handler t1 read first limit 9;
|
||||
create table t2(table_id char(20) primary key);
|
||||
insert into t2 values ('test_test.t2');
|
||||
insert into t2 values ('');
|
||||
handler t2 open;
|
||||
handler t2 read first limit 9;
|
||||
#
|
||||
# This is the usual 'test' database.
|
||||
#
|
||||
use test;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(table_id char(20) primary key);
|
||||
insert into t1 values ('test.t1');
|
||||
insert into t1 values ('');
|
||||
--error 1066
|
||||
handler t1 open;
|
||||
#
|
||||
# Check accesibility of all the tables.
|
||||
#
|
||||
use test;
|
||||
--error 1064
|
||||
handler test.t1 read first limit 9;
|
||||
--error 1064
|
||||
handler test_test.t1 read first limit 9;
|
||||
handler t1 read first limit 9;
|
||||
--error 1064
|
||||
handler test_test.t2 read first limit 9;
|
||||
handler t2 read first limit 9;
|
||||
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
|
||||
--error 1064
|
||||
handler test_test.t1 close;
|
||||
handler t1 close;
|
||||
drop table test_test.t1;
|
||||
--error 1064
|
||||
handler test_test.t2 close;
|
||||
handler t2 close;
|
||||
drop table test_test.t2;
|
||||
drop database test_test;
|
||||
|
||||
#
|
||||
use test;
|
||||
--error 1064
|
||||
handler test.t1 close;
|
||||
--error 1109
|
||||
handler t1 close;
|
||||
drop table test.t1;
|
||||
|
||||
#
|
||||
# BUG#4335
|
||||
#
|
||||
--disable_warnings
|
||||
drop database if exists test_test;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
create database test_test;
|
||||
use test_test;
|
||||
create table t1 (c1 char(20));
|
||||
insert into t1 values ('test_test.t1');
|
||||
create table t3 (c1 char(20));
|
||||
insert into t3 values ('test_test.t3');
|
||||
handler t1 open;
|
||||
handler t1 read first limit 9;
|
||||
handler t1 open h1;
|
||||
handler h1 read first limit 9;
|
||||
use test;
|
||||
create table t1 (c1 char(20));
|
||||
create table t2 (c1 char(20));
|
||||
create table t3 (c1 char(20));
|
||||
insert into t1 values ('t1');
|
||||
insert into t2 values ('t2');
|
||||
insert into t3 values ('t3');
|
||||
--error 1066
|
||||
handler t1 open;
|
||||
--error 1066
|
||||
handler t2 open t1;
|
||||
--error 1066
|
||||
handler t3 open t1;
|
||||
handler t1 read first limit 9;
|
||||
--error 1064
|
||||
handler test.t1 close;
|
||||
--error 1066
|
||||
handler test.t1 open h1;
|
||||
--error 1066
|
||||
handler test_test.t1 open h1;
|
||||
handler test_test.t3 open h3;
|
||||
handler test.t1 open h2;
|
||||
handler t1 read first limit 9;
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
--error 1064
|
||||
handler test.h1 close;
|
||||
handler t1 close;
|
||||
handler h1 close;
|
||||
handler h2 close;
|
||||
--error 1109
|
||||
handler t1 read first limit 9;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
--error 1109
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
use test_test;
|
||||
handler h3 read first limit 9;
|
||||
--error 1064
|
||||
handler test.h3 read first limit 9;
|
||||
handler h3 close;
|
||||
use test;
|
||||
drop table t3;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
drop database test_test;
|
||||
|
||||
#
|
||||
# Test if fix for BUG#4286 correctly closes handler tables.
|
||||
#
|
||||
create table t1 (c1 char(20));
|
||||
insert into t1 values ("t1");
|
||||
handler t1 open as h1;
|
||||
handler h1 read first limit 9;
|
||||
create table t2 (c1 char(20));
|
||||
insert into t2 values ("t2");
|
||||
handler t2 open as h2;
|
||||
handler h2 read first limit 9;
|
||||
create table t3 (c1 char(20));
|
||||
insert into t3 values ("t3");
|
||||
handler t3 open as h3;
|
||||
handler h3 read first limit 9;
|
||||
create table t4 (c1 char(20));
|
||||
insert into t4 values ("t4");
|
||||
handler t4 open as h4;
|
||||
handler h4 read first limit 9;
|
||||
create table t5 (c1 char(20));
|
||||
insert into t5 values ("t5");
|
||||
handler t5 open as h5;
|
||||
handler h5 read first limit 9;
|
||||
# close first
|
||||
eval alter table t1 engine=$other_handler_engine_type;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
handler h4 read first limit 9;
|
||||
handler h5 read first limit 9;
|
||||
# close last
|
||||
eval alter table t5 engine=$other_handler_engine_type;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
handler h3 read first limit 9;
|
||||
handler h4 read first limit 9;
|
||||
--error 1109
|
||||
handler h5 read first limit 9;
|
||||
# close middle
|
||||
eval alter table t3 engine=$other_handler_engine_type;
|
||||
--error 1109
|
||||
handler h1 read first limit 9;
|
||||
handler h2 read first limit 9;
|
||||
--error 1109
|
||||
handler h3 read first limit 9;
|
||||
handler h4 read first limit 9;
|
||||
--error 1109
|
||||
handler h5 read first limit 9;
|
||||
handler h2 close;
|
||||
handler h4 close;
|
||||
# close all depending handler tables
|
||||
handler t1 open as h1_1;
|
||||
handler t1 open as h1_2;
|
||||
handler t1 open as h1_3;
|
||||
handler h1_1 read first limit 9;
|
||||
handler h1_2 read first limit 9;
|
||||
handler h1_3 read first limit 9;
|
||||
eval alter table t1 engine=$engine_type;
|
||||
--error 1109
|
||||
handler h1_1 read first limit 9;
|
||||
--error 1109
|
||||
handler h1_2 read first limit 9;
|
||||
--error 1109
|
||||
handler h1_3 read first limit 9;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
|
||||
#
|
||||
# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
|
||||
#
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (1);
|
||||
# client 1
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
# client 2
|
||||
connect (con2,localhost,root,,);
|
||||
connection con2;
|
||||
--exec echo send the below to another connection, do not wait for the result
|
||||
send optimize table t1;
|
||||
--sleep 1
|
||||
# client 1
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
handler t1 read next;
|
||||
handler t1 close;
|
||||
# client 2
|
||||
--exec echo read the result from the other connection
|
||||
connection con2;
|
||||
reap;
|
||||
# client 1
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2));
|
||||
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
|
||||
HANDLER t1 OPEN;
|
||||
HANDLER t1 READ `primary` = (1, 1000);
|
||||
HANDLER t1 READ `primary` PREV;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Addendum to Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
|
||||
# Show that DROP TABLE can no longer deadlock against
|
||||
# FLUSH TABLES WITH READ LOCK. This is a 5.0 issue.
|
||||
#
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values (14397);
|
||||
flush tables with read lock;
|
||||
# The thread with the global read lock cannot drop the table itself:
|
||||
--error 1223
|
||||
drop table t1;
|
||||
#
|
||||
# client 2
|
||||
# We need a second connection to try the drop.
|
||||
# The drop waits for the global read lock to go away.
|
||||
# Without the addendum fix it locked LOCK_open before entering the wait loop.
|
||||
connection con2;
|
||||
--exec echo send the below to another connection, do not wait for the result
|
||||
send drop table t1;
|
||||
--sleep 1
|
||||
#
|
||||
# client 1
|
||||
# Now we need something that wants LOCK_open. A simple table access which
|
||||
# opens the table does the trick.
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
# This would hang on LOCK_open without the 5.0 addendum fix.
|
||||
select * from t1;
|
||||
# Release the read lock. This should make the DROP go through.
|
||||
unlock tables;
|
||||
#
|
||||
# client 2
|
||||
# Read the result of the drop command.
|
||||
connection con2;
|
||||
--exec echo read the result from the other connection
|
||||
reap;
|
||||
#
|
||||
# client 1
|
||||
# Now back to normal operation. The table should not exist any more.
|
||||
--exec echo proceed with the normal connection
|
||||
connection default;
|
||||
--error 1146
|
||||
select * from t1;
|
||||
# Just to be sure and not confuse the next test case writer.
|
||||
drop table if exists t1;
|
||||
|
||||
#
|
||||
# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
eval create table t1 (a int) ENGINE=$other_engine_type;
|
||||
--echo --> client 2
|
||||
connection con2;
|
||||
--error 1031
|
||||
handler t1 open;
|
||||
--echo --> client 1
|
||||
connection default;
|
||||
drop table t1;
|
||||
disconnect con2;
|
||||
|
||||
#
|
||||
# Bug#30632 HANDLER read failure causes hang
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
--error 1176
|
||||
handler t1_alias read a next;
|
||||
--error 1054
|
||||
handler t1_alias READ a next where inexistent > 0;
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#21587 FLUSH TABLES causes server crash when used with HANDLER statements
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int);
|
||||
create table t2 (c1 int);
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (2);
|
||||
--echo connection: default
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
connect (flush,localhost,root,,);
|
||||
connection flush;
|
||||
--echo connection: flush
|
||||
--send flush tables;
|
||||
connection default;
|
||||
--echo connection: default
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Flushing tables";
|
||||
--source include/wait_condition.inc
|
||||
handler t2 open;
|
||||
handler t2 read first;
|
||||
handler t1 read next;
|
||||
handler t1 close;
|
||||
handler t2 close;
|
||||
connection flush;
|
||||
reap;
|
||||
connection default;
|
||||
drop table t1,t2;
|
||||
disconnect flush;
|
||||
|
||||
#
|
||||
# Bug#31409 RENAME TABLE causes server crash or deadlock when used with HANDLER statements
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int);
|
||||
--echo connection: default
|
||||
handler t1 open;
|
||||
handler t1 read first;
|
||||
connect (flush,localhost,root,,);
|
||||
connection flush;
|
||||
--echo connection: flush
|
||||
--send rename table t1 to t2;
|
||||
connection default;
|
||||
--echo connection: default
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Waiting for table" and info = "rename table t1 to t2";
|
||||
--source include/wait_condition.inc
|
||||
handler t2 open;
|
||||
handler t2 read first;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
handler t1 read next;
|
||||
handler t1 close;
|
||||
handler t2 close;
|
||||
connection flush;
|
||||
reap;
|
||||
connection default;
|
||||
drop table t2;
|
||||
disconnect flush;
|
||||
|
||||
#
|
||||
# Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
|
||||
#
|
||||
# Test HANDLER statements in conjunction with temporary tables. While the temporary table
|
||||
# is open by a HANDLER, no other statement can access it.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create temporary table t1 (a int, b char(1), key a(a), key b(a,b));
|
||||
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"),
|
||||
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j");
|
||||
select a,b from t1;
|
||||
handler t1 open as a1;
|
||||
handler a1 read a first;
|
||||
handler a1 read a next;
|
||||
handler a1 read a next;
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select a,b from t1;
|
||||
handler a1 read a prev;
|
||||
handler a1 read a prev;
|
||||
handler a1 read a=(6) where b="g";
|
||||
handler a1 close;
|
||||
select a,b from t1;
|
||||
handler t1 open as a2;
|
||||
handler a2 read a first;
|
||||
handler a2 read a last;
|
||||
handler a2 read a prev;
|
||||
handler a2 close;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#31397 Inconsistent drop table behavior of handler tables.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
flush tables;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
handler t1_alias close;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
handler t1 open as t1_alias;
|
||||
handler t1_alias read first;
|
||||
drop table t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler t1_alias read next;
|
||||
|
||||
# Test that temporary tables associated with handlers are properly dropped.
|
||||
|
||||
create table t1 (a int);
|
||||
create temporary table t2 (a int, key(a));
|
||||
handler t1 open as a1;
|
||||
handler t2 open as a2;
|
||||
handler a2 read a first;
|
||||
drop table t1, t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler a2 read a next;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler a1 close;
|
||||
|
||||
# Alter table drop handlers
|
||||
|
||||
create table t1 (a int, key(a));
|
||||
create table t2 like t1;
|
||||
handler t1 open as a1;
|
||||
handler t2 open as a2;
|
||||
handler a1 read a first;
|
||||
handler a2 read a first;
|
||||
alter table t1 add b int;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler a1 close;
|
||||
handler a2 close;
|
||||
drop table t1, t2;
|
||||
|
||||
# Rename table drop handlers
|
||||
|
||||
create table t1 (a int, key(a));
|
||||
handler t1 open as a1;
|
||||
handler a1 read a first;
|
||||
rename table t1 to t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler a1 read a first;
|
||||
drop table t2;
|
||||
|
||||
# Optimize table drop handlers
|
||||
|
||||
create table t1 (a int, key(a));
|
||||
create table t2 like t1;
|
||||
handler t1 open as a1;
|
||||
handler t2 open as a2;
|
||||
handler a1 read a first;
|
||||
handler a2 read a first;
|
||||
optimize table t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler a1 close;
|
||||
handler a2 close;
|
||||
drop table t1, t2;
|
||||
|
||||
# Flush tables causes handlers reopen
|
||||
|
||||
create table t1 (a int, b char(1), key a(a), key b(a,b));
|
||||
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"),
|
||||
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j");
|
||||
handler t1 open;
|
||||
handler t1 read a first;
|
||||
handler t1 read a next;
|
||||
flush tables;
|
||||
handler t1 read a next;
|
||||
handler t1 read a next;
|
||||
flush tables with read lock;
|
||||
handler t1 read a next;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
handler t1 read a next;
|
||||
|
||||
#
|
||||
# Bug#41110: crash with handler command when used concurrently with alter table
|
||||
# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
handler t1 open;
|
||||
connect(con1,localhost,root,,);
|
||||
send alter table t1 engine=memory;
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "rename result table" and info = "alter table t1 engine=memory";
|
||||
--source include/wait_condition.inc
|
||||
--error ER_ILLEGAL_HA
|
||||
handler t1 read a next;
|
||||
handler t1 close;
|
||||
connection con1;
|
||||
--reap
|
||||
drop table t1;
|
||||
disconnect con1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
connection default;
|
||||
|
||||
#
|
||||
# Bug#44151 using handler commands on information_schema tables crashes server
|
||||
#
|
||||
USE information_schema;
|
||||
--error ER_WRONG_USAGE
|
||||
HANDLER COLUMNS OPEN;
|
||||
USE test;
|
||||
16
build/lib/mysql/mysql-test/include/have_32bit.inc
Normal file
16
build/lib/mysql/mysql-test/include/have_32bit.inc
Normal file
@@ -0,0 +1,16 @@
|
||||
# Created by Horst Hunger 2008-04-15
|
||||
# see also have_64bit.inc
|
||||
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
let $save = `SELECT @@global.sort_buffer_size`;
|
||||
SET @@global.sort_buffer_size = 4294967296;
|
||||
let $mach32 = `SELECT @@global.sort_buffer_size <= 4294967295`;
|
||||
eval SET @@global.sort_buffer_size = $save;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
if (!$mach32)
|
||||
{
|
||||
skip Need a 32 bit machine/binary;
|
||||
}
|
||||
|
||||
14
build/lib/mysql/mysql-test/include/have_64bit.inc
Normal file
14
build/lib/mysql/mysql-test/include/have_64bit.inc
Normal file
@@ -0,0 +1,14 @@
|
||||
# Created by Horst Hunger 2008-04-15
|
||||
# see also have_32bit.inc
|
||||
|
||||
--disable_query_log
|
||||
let $save = `SELECT @@session.sort_buffer_size`;
|
||||
SET @@session.sort_buffer_size = 4294967296;
|
||||
let $mach64 = `SELECT @@session.sort_buffer_size > 4294967295`;
|
||||
eval SET @@session.sort_buffer_size = $save;
|
||||
--enable_query_log
|
||||
if (!$mach64)
|
||||
{
|
||||
skip Need a 64 binary ;
|
||||
}
|
||||
|
||||
4
build/lib/mysql/mysql-test/include/have_archive.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_archive.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'archive';
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_big5.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_big5.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_big5.require
|
||||
disable_query_log;
|
||||
show collation like 'big5_chinese_ci';
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,6 @@
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
-- require r/have_binlog_format_mixed.require
|
||||
disable_query_log;
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,7 @@
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
--require r/have_binlog_format_row.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED ROW
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,8 @@
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
|
||||
--require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED STATEMENT
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,6 @@
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
-- require r/have_binlog_format_row.require
|
||||
disable_query_log;
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,7 @@
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
-- require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result ROW STATEMENT
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,6 @@
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
-- require r/have_binlog_format_statement.require
|
||||
disable_query_log;
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
5
build/lib/mysql/mysql-test/include/have_blackhole.inc
Normal file
5
build/lib/mysql/mysql-test/include/have_blackhole.inc
Normal file
@@ -0,0 +1,5 @@
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'blackhole'`){
|
||||
skip Need blackhole engine;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
--require r/case_insensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,4 @@
|
||||
--require r/case_insensitive_fs.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_file_system';
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,4 @@
|
||||
--require r/case_sensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_file_system';
|
||||
--enable_query_log
|
||||
@@ -0,0 +1,4 @@
|
||||
--require r/have_community_features.require
|
||||
--disable_query_log
|
||||
show variables like 'have_community_features';
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_compress.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_compress.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_compress.require
|
||||
disable_query_log;
|
||||
show variables like 'have_compress';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_cp1250_ch.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_cp1250_ch.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_cp1250_ch.require
|
||||
disable_query_log;
|
||||
show collation like 'cp1250_czech_cs';
|
||||
enable_query_log;
|
||||
7
build/lib/mysql/mysql-test/include/have_cp1251.inc
Normal file
7
build/lib/mysql/mysql-test/include/have_cp1251.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
--require r/have_cp1251.require
|
||||
|
||||
--disable_query_log
|
||||
|
||||
SHOW COLLATION LIKE 'cp1251_general_ci';
|
||||
|
||||
--enable_query_log
|
||||
7
build/lib/mysql/mysql-test/include/have_cp866.inc
Normal file
7
build/lib/mysql/mysql-test/include/have_cp866.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
--require r/have_cp866.require
|
||||
|
||||
--disable_query_log
|
||||
|
||||
SHOW COLLATION LIKE 'cp866_general_ci';
|
||||
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_cp932.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_cp932.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_cp932.require
|
||||
disable_query_log;
|
||||
show collation like 'cp932_japanese_ci';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_crypt.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_crypt.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_crypt.require
|
||||
disable_query_log;
|
||||
show variables like 'have_crypt';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_csv.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_csv.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'csv';
|
||||
enable_query_log;
|
||||
78
build/lib/mysql/mysql-test/include/have_dbi_dbd-mysql.inc
Normal file
78
build/lib/mysql/mysql-test/include/have_dbi_dbd-mysql.inc
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Originally created by John Embretsen, 2011-01-26.
|
||||
#
|
||||
# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the
|
||||
# perl installation used by "external" executable perl scripts, i.e. scripts
|
||||
# that are executed as standalone scripts interpreted by the perl installation
|
||||
# specified by the "shebang" line in the top of these scripts.
|
||||
#
|
||||
# If either module is not found, the test will be skipped.
|
||||
#
|
||||
# For use in tests that call perl scripts that require these modules.
|
||||
#
|
||||
# This file is intended to work on Unix. Windows may need different treatment.
|
||||
# Reasoning:
|
||||
# - "shebangs" are not relevant on Windows, but need to be handled here.
|
||||
# - Perl scripts cannot be made executable on Windows, interpreter must be
|
||||
# specified.
|
||||
#
|
||||
# Note that if there are multiple perl installations and not all have the
|
||||
# required modules, this check may fail even if the perl in path does have
|
||||
# the modules available. This may happen if the perl specified by the script's
|
||||
# shebang (e.g. #!/usr/bin/perl) does not have these modules, and script is
|
||||
# called without specifying the perl interpreter. However, this will be
|
||||
# a correct result in cases where a test calls a script with a similar shebang.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
--source include/not_windows.inc
|
||||
|
||||
# We jump through some hoops since there is no direct way to check if an
|
||||
# external command went OK or not from a mysql-test file:
|
||||
#
|
||||
# - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1",
|
||||
# however we cannot check the result (exit code) from within a test script.
|
||||
# Also, this may not yield the same result as other uses of perl due to the
|
||||
# shebang issue mentioned above.
|
||||
# - Instead we use a separate helper perl script that checks for the modules.
|
||||
# - If the modules are found, the perl script leaves a file which sets a
|
||||
# variable that can be read by this file.
|
||||
# If the modules are not found, the perl script does not set this variable,
|
||||
# but leaves an empty file instead.
|
||||
#
|
||||
# This is done because there is apparently no direct way to transfer
|
||||
# information from perl to the test script itself.
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--disable_warnings
|
||||
|
||||
# We do not use embedded perl in this script because that would not have yielded
|
||||
# correct results for a situation where an external Perl script is called like
|
||||
# "scriptname" instead of "perl scriptname" and the shebang in the script points
|
||||
# to a specific perl that may be different than the perl in PATH.
|
||||
#
|
||||
# Instead, we call a separate helper script which checks for the modules in its
|
||||
# own environment. We call it without "perl" in front.
|
||||
|
||||
--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
|
||||
--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
|
||||
|
||||
# Make the script executable and execute it.
|
||||
--chmod 0755 $perlChecker
|
||||
--exec $perlChecker
|
||||
|
||||
# Source the resulting temporary file and look for a variable being set.
|
||||
--source $resultFile
|
||||
|
||||
if (!$dbidbd) {
|
||||
--skip Test needs Perl modules DBI and DBD::mysql
|
||||
}
|
||||
|
||||
# Clean up
|
||||
--remove_file $resultFile
|
||||
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
--enable_warnings
|
||||
|
||||
4
build/lib/mysql/mysql-test/include/have_debug.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_debug.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_debug.require
|
||||
disable_query_log;
|
||||
select (version() like '%debug%') as debug;
|
||||
enable_query_log;
|
||||
5
build/lib/mysql/mysql-test/include/have_debug_sync.inc
Normal file
5
build/lib/mysql/mysql-test/include/have_debug_sync.inc
Normal file
@@ -0,0 +1,5 @@
|
||||
--require r/have_debug_sync.require
|
||||
disable_query_log;
|
||||
let $value= query_get_value(SHOW VARIABLES LIKE 'debug_sync', Value, 1);
|
||||
eval SELECT ('$value' LIKE 'ON %') AS debug_sync;
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Whether server supports dynamic loading.
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_eucjpms.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_eucjpms.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_eucjpms.require
|
||||
disable_query_log;
|
||||
show collation like 'eucjpms_japanese_ci';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_euckr.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_euckr.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_euckr.require
|
||||
disable_query_log;
|
||||
show collation like 'euckr_korean_ci';
|
||||
enable_query_log;
|
||||
13
build/lib/mysql/mysql-test/include/have_example_plugin.inc
Normal file
13
build/lib/mysql/mysql-test/include/have_example_plugin.inc
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Check if server has support for loading udf's
|
||||
# i.e it will support dlopen
|
||||
#
|
||||
--source include/have_dynamic_loading.inc
|
||||
|
||||
#
|
||||
# Check if the variable EXAMPLE_PLUGIN is set
|
||||
#
|
||||
--require r/have_example_plugin.require
|
||||
disable_query_log;
|
||||
eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_exampledb.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_exampledb.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'example';
|
||||
enable_query_log;
|
||||
@@ -0,0 +1,5 @@
|
||||
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`)
|
||||
{
|
||||
--skip federated plugin not available
|
||||
}
|
||||
|
||||
4
build/lib/mysql/mysql-test/include/have_gb2312.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_gb2312.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_gb2312.require
|
||||
disable_query_log;
|
||||
show collation like 'gb2312_chinese_ci';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_gbk.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_gbk.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_gbk.require
|
||||
disable_query_log;
|
||||
show collation like 'gbk_chinese_ci';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_geometry.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_geometry.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/have_geometry.require
|
||||
--disable_query_log
|
||||
show variables like 'have_geometry';
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_innodb.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_innodb.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
|
||||
{
|
||||
--skip Test requires InnoDB.
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
if (!`SHOW VARIABLES LIKE 'innodb_change_buffering_debug'`)
|
||||
{
|
||||
# innodb_change_buffering_debug is enabled by UNIV_DEBUG or
|
||||
# UNIV_IBUF_DEBUG
|
||||
--skip Test requires binary with UNIV_DEBUG enabled
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
--source include/not_embedded.inc
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
|
||||
enable_query_log;
|
||||
7
build/lib/mysql/mysql-test/include/have_koi8r.inc
Normal file
7
build/lib/mysql/mysql-test/include/have_koi8r.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
--require r/have_koi8r.require
|
||||
|
||||
--disable_query_log
|
||||
|
||||
SHOW COLLATION LIKE 'koi8r_general_ci';
|
||||
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_latin2_ch.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_latin2_ch.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
-- require r/have_latin2_ch.require
|
||||
disable_query_log;
|
||||
show collation like 'latin2_czech_cs';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_local_infile.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_local_infile.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/have_local_infile.require
|
||||
disable_query_log;
|
||||
show variables like 'local_infile';
|
||||
enable_query_log;
|
||||
12
build/lib/mysql/mysql-test/include/have_log_bin.inc
Normal file
12
build/lib/mysql/mysql-test/include/have_log_bin.inc
Normal file
@@ -0,0 +1,12 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Ensure that the server is running with binlogging on
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/have_log_bin.inc;
|
||||
|
||||
-- require r/have_log_bin.require
|
||||
disable_query_log;
|
||||
show variables like 'log_bin';
|
||||
enable_query_log;
|
||||
4
build/lib/mysql/mysql-test/include/have_lowercase0.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_lowercase0.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/lowercase0.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_table_names";
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_lowercase1.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_lowercase1.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/lowercase1.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_table_names';
|
||||
--enable_query_log
|
||||
4
build/lib/mysql/mysql-test/include/have_lowercase2.inc
Normal file
4
build/lib/mysql/mysql-test/include/have_lowercase2.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
--require r/lowercase2.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_table_names';
|
||||
--enable_query_log
|
||||
52
build/lib/mysql/mysql-test/include/have_multi_ndb.inc
Normal file
52
build/lib/mysql/mysql-test/include/have_multi_ndb.inc
Normal file
@@ -0,0 +1,52 @@
|
||||
# Setup connections to both MySQL Servers connected to the cluster
|
||||
connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,);
|
||||
|
||||
# Check that server1 has NDB support
|
||||
connection server1;
|
||||
let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'ENGINES', Tables_in_information_schema (ENGINES), 1);
|
||||
disable_query_log;
|
||||
if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`)
|
||||
{
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
}
|
||||
enable_query_log;
|
||||
|
||||
# Check that server2 has NDB support
|
||||
connection server2;
|
||||
let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'ENGINES', Tables_in_information_schema (ENGINES), 1);
|
||||
disable_query_log;
|
||||
if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`)
|
||||
{
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
}
|
||||
enable_query_log;
|
||||
|
||||
# cleanup
|
||||
|
||||
connection server1;
|
||||
disable_query_log;
|
||||
disable_warnings;
|
||||
--error 0,1051
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
flush tables;
|
||||
flush status;
|
||||
enable_warnings;
|
||||
enable_query_log;
|
||||
|
||||
connection server2;
|
||||
disable_query_log;
|
||||
disable_warnings;
|
||||
--error 0,1051
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
flush tables;
|
||||
flush status;
|
||||
enable_warnings;
|
||||
enable_query_log;
|
||||
|
||||
# Set the default connection
|
||||
connection server1;
|
||||
@@ -0,0 +1,4 @@
|
||||
--require r/have_mysql_upgrade.result
|
||||
--disable_query_log
|
||||
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
|
||||
--enable_query_log
|
||||
10
build/lib/mysql/mysql-test/include/have_ndb.inc
Normal file
10
build/lib/mysql/mysql-test/include/have_ndb.inc
Normal file
@@ -0,0 +1,10 @@
|
||||
# Check that server is compiled and started with support for NDB
|
||||
#disable_query_log;
|
||||
#--require r/true.require
|
||||
#select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
|
||||
#--source include/ndb_not_readonly.inc
|
||||
#enable_query_log;
|
||||
# always make sure we have both mysql servers started ok before test starts
|
||||
# there are some initial startup bugs that are avoided by doing this, avoiding sporadic
|
||||
# failures in mysql-test-run
|
||||
--source include/have_multi_ndb.inc
|
||||
2
build/lib/mysql/mysql-test/include/have_ndb_extra.inc
Normal file
2
build/lib/mysql/mysql-test/include/have_ndb_extra.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
-- require r/have_ndb_extra.require
|
||||
eval select $NDB_EXTRA_TEST;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user