diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/stress | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/stress')
25 files changed, 3484 insertions, 0 deletions
diff --git a/mysql-test/suite/stress/include/ddl.cln b/mysql-test/suite/stress/include/ddl.cln new file mode 100644 index 00000000..7d021a8c --- /dev/null +++ b/mysql-test/suite/stress/include/ddl.cln @@ -0,0 +1,4 @@ +######## include/ddl.cln ######## +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/include/ddl.pre b/mysql-test/suite/stress/include/ddl.pre new file mode 100644 index 00000000..52de4a36 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl.pre @@ -0,0 +1,21 @@ +######## include/ddl.pre ######## +# The variable +# $runtime -- rough intended runtime per subtest variant +# must be set within the routine sourcing this script. +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-11 mleich +# +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +--replace_result $runtime <intended_runtime> +eval SET @runtime = $runtime; +eval PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect (con2,localhost,root,,); +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings diff --git a/mysql-test/suite/stress/include/ddl1.inc b/mysql-test/suite/stress/include/ddl1.inc new file mode 100644 index 00000000..00e64cee --- /dev/null +++ b/mysql-test/suite/stress/include/ddl1.inc @@ -0,0 +1,277 @@ +######## include/ddl1.inc ###### +# +# Purpose of include/ddl1.inc - include/ddl8.inc: +# +# Stress storage engines with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# Real runtime without server restarts and comparison is: +# - >= $runtime +# - > runtime needed for $loop_size execution loops +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Attention: +# The test does suppress the writing of most statements, server error +# messages and result sets. +# This is needed because their number is usual not deterministic. +# The test is partially self checking. That means is prints some +# helpful hints into the protocol and aborts if something is wrong. +# +# Creation of this test: +# 2007-07-04 mleich +# +############################################################################ +# +# Some details: +# +# 1. Base question of the test: +# There was just a create or drop of some object (TABLE/INDEX). +# +# Could it happen that the next statement referring to this +# object gets a somehow wrong server response (result set, +# error message, warning) because the creation or removal of +# the object is in an incomplete state? +# +# Thinkable reasons for incomplete state of creation or removal: +# The server performs the creation or removal +# - all time incomplete. +# Example: +# Bug#28309 First insert violates unique constraint +# - was "memory" table empty ? +# - asynchronous +# In that case the next statement has probably to wait till +# completion. +# +# 2. Why do we use in some scripts "--error 0,<expected error>" followed +# a check of $mysql_errno? +# +# System reactions when running with "--error 0,<expected error>": +# - RC=0 --> no error message +# - RC=<expected error> --> no error message +# - RC not in (0,<expected error>) --> error message + abort of script +# execution +# +# Requirements and tricky solution for statements which are expected +# to fail: +# 1. RC=<expected error> +# - no abort of script execution +# --> add "--error <expected error>" +# - no error message into the protocol, because the number of +# executions is NOT deterministic +# --> use "--error 0,<expected error>" +# 2. RC=0 = failure +# - abort of script execution +# "--error 0,<expected error>" prevents the automatic abort of +# execution. Therefore we do not need to code the abort. +# --> Check $mysql_errno and do an explicit abort if $mysql_errno = 0. +# 3. RC not in (0,<expected error>) +# - abort of script execution +# "--error 0,<expected error>" causes an automatic abort. +# +# 3. We do not check the correctness of the SHOW CREATE TABLE output +# in detail. This must be done within other tests. +# We only check here that +# - same CREATE TABLE/INDEX statements lead to the same +# - different CREATE TABLE/INDEX statements lead to different +# SHOW CREATE TABLE output +# (Applies to ddl4.inc. and ddl8.inc.) +# +# 4. It could be assumed that running this test with +# - PS-PROTOCOL +# There are already subtests using prepared statements contained. +# - SP/CURSOR/VIEW-PROTOCOL +# These protocol variants transform SELECTs to hopefully much +# stressing statement sequencies using SP/CURSOR/VIEW. +# The SELECTs within include/ddl*.inc are very simple. +# does not increase the coverage. +# Therefore we skip runs with these protocols. +# +# 5. The test consumes significant runtime when running on a non RAM +# based filesystem (run without "--mem"). +# Therefore we adjust $runtime and $loop_size depending on "--big-test" +# option. +# $runtime and $loop_size do not influence the expected results. +# Rough runtime in seconds reported by mysql-test-run.pl: +# (engine_type = MEMORY) +# option set -> $runtime $loop_size real runtime in seconds +# 1 20 68 +# --mem 1 20 32 +# --big-test 5 100 200 +# --mem --big-test 5 100 400 +# I assume that runs with slow filesystems are as much valuable +# as runs with extreme fast filesystems. +# +# 6. Hints for analysis of test failures: +# 1. Look into the protocol and check in which ddl*.inc +# script the difference to the expected result occurred. +# 2. Comment the sourcing of all other ddl*.inc scripts +# out. +# 3. Edit the ddl*.inc script where the error occurred and +# remove all +# - "--disable_query_log", "--disable_result_log" +# - successful passed subtests. +# 4. Alternative: +# Have a look into VARDIR/master-data/mysql/general_log.CSV +# and construct a new testcase from that. +# 5. If the problem is not deterministic, please try the following +# - increase $runtime (important), $loop_size (most probably +# less important) within the "t/ddl_<engine>.test" and +# maybe the "--testcase-timeout" assigned to mysqltest-run.pl +# - vary the I/O performance of the testing machine by using +# a RAM or disk based filesystem for VARDIR +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 1 variants +# Scenario: CREATE with UNIQUE KEY/INSERT/DROP TABLE like in Bug#28309 +let $create_table= CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = $engine_type; +let $insert_into= INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +let $drop_table= DROP TABLE t1; +#---------------------------------------------------------------------- + +# +--echo # Subtest 1A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $insert_into +--echo # default: $drop_table +--disable_query_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + eval $insert_into; + eval $drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_query_log +# +--echo # Subtest 1B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $insert_into +--echo # default: $drop_table +--disable_query_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +eval PREPARE insert_into FROM "$insert_into"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + EXECUTE insert_into; + EXECUTE drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE insert_into; +DEALLOCATE PREPARE drop_table; +--enable_query_log +# +--echo # Subtest 1C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $insert_into +--echo # con2: $drop_table +--disable_query_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + connection con2; + eval $insert_into; + eval $drop_table; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_query_log +# +--echo # Subtest 1D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $insert_into +--echo # con2: $drop_table +--disable_query_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +connection con2; +eval PREPARE insert_into FROM "$insert_into"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + connection con2; + EXECUTE insert_into; + EXECUTE drop_table; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +connection con2; +DEALLOCATE PREPARE insert_into; +DEALLOCATE PREPARE drop_table; +connection default; +--enable_query_log diff --git a/mysql-test/suite/stress/include/ddl2.inc b/mysql-test/suite/stress/include/ddl2.inc new file mode 100644 index 00000000..dd2ec0fd --- /dev/null +++ b/mysql-test/suite/stress/include/ddl2.inc @@ -0,0 +1,259 @@ +######## include/ddl2.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 2 variants (2A - 2D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 2 variants +# Scenario: CREATE TABLE AS SELECT/SELECT/DROP/SELECT(F) +let $create_table= CREATE TABLE t1 ENGINE = $engine_type AS SELECT 1 AS f1; +let $select_record= SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1; +let $drop_table= DROP TABLE t1; +#---------------------------------------------------------------------- + +# +--echo # Subtest 2A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $select_record +--echo # default: $drop_table +--echo # default: $select_record (expect to get ER_NO_SUCH_TABLE) +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + if (`$select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + eval $select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + eval $drop_table; + --error 0,ER_NO_SUCH_TABLE + eval $select_record; + if (!$mysql_errno) + { + --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE + --echo # abort + exit; + } + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 2B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $select_record +--echo # default: $drop_table +--echo # default: $select_record (expect to get ER_NO_SUCH_TABLE) +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +eval PREPARE select_record FROM "$select_record"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + if (`EXECUTE select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + EXECUTE select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + EXECUTE drop_table; + --error 0,ER_NO_SUCH_TABLE + EXECUTE select_record; + if (!$mysql_errno) + { + --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE + --echo # abort + exit; + } + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE select_record; +DEALLOCATE PREPARE drop_table; +--enable_result_log +--enable_query_log +# +--echo # Subtest 2C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $select_record +--echo # default: $drop_table +--echo # con2: $select_record (expect to get ER_NO_SUCH_TABLE) +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + connection con2; + if (`$select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + eval $select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + connection default; + eval $drop_table; + connection con2; + --error 0,ER_NO_SUCH_TABLE + eval $select_record; + if (!$mysql_errno) + { + --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE + --echo # abort + exit; + } + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 2D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $select_record +--echo # default: $drop_table +--echo # con2: $select_record (expect to get ER_NO_SUCH_TABLE) +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table FROM "$create_table"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE create_table; +connection con2; +eval PREPARE select_record FROM "$select_record"; +connection default; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + connection con2; + if (`EXECUTE select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + EXECUTE select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + connection default; + EXECUTE drop_table; + connection con2; + --error 0,ER_NO_SUCH_TABLE + EXECUTE select_record; + if (!$mysql_errno) + { + --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE + --echo # abort + exit; + } + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE drop_table; +connection con2; +DEALLOCATE PREPARE select_record; +connection default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/stress/include/ddl3.inc b/mysql-test/suite/stress/include/ddl3.inc new file mode 100644 index 00000000..d41c8506 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl3.inc @@ -0,0 +1,242 @@ +######## include/ddl3.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 3 variants (3A - 3D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl2.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 3 variants +# Scenario: CREATE TABLE/CREATE TABLE(F)/DROP TABLE/DROP TABLE(F) +let $create_table= CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=$engine_type; +let $drop_table= DROP TABLE t1; +#---------------------------------------------------------------------- + +# +--echo # Subtest 3A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $create_table (expect to get ER_TABLE_EXISTS_ERROR) +--echo # default: $drop_table +--echo # default: $drop_table (expect to get ER_BAD_TABLE_ERROR) +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + --error 0,ER_TABLE_EXISTS_ERROR + eval $create_table; + if (!$mysql_errno) + { + --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR + --echo # abort + exit; + } + eval $drop_table; + --error 0,ER_BAD_TABLE_ERROR + eval $drop_table; + if (!$mysql_errno) + { + --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR) + --echo # abort + exit; + } + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 3B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $create_table (expect to get ER_TABLE_EXISTS_ERROR) +--echo # default: $drop_table +--echo # default: $drop_table (expect to get ER_BAD_TABLE_ERROR) +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + --error 0,ER_TABLE_EXISTS_ERROR + EXECUTE create_table; + if (!$mysql_errno) + { + --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR + --echo # abort + exit; + } + EXECUTE drop_table; + --error 0,ER_BAD_TABLE_ERROR + EXECUTE drop_table; + if (!$mysql_errno) + { + --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR) + --echo # abort + exit; + } + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE drop_table; +--enable_result_log +--enable_query_log +# +--echo # Subtest 3C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $create_table (expect to get ER_TABLE_EXISTS_ERROR) +--echo # default: $drop_table +--echo # con2: $drop_table (expect to get ER_BAD_TABLE_ERROR) +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + connection con2; + --error 0,ER_TABLE_EXISTS_ERROR + eval $create_table; + if (!$mysql_errno) + { + --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR + --echo # abort + exit; + } + connection default; + eval $drop_table; + connection con2; + --error 0,ER_BAD_TABLE_ERROR + eval $drop_table; + if (!$mysql_errno) + { + --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR) + --echo # abort + exit; + } + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 3D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $create_table (expect to get ER_TABLE_EXISTS_ERROR) +--echo # default: $drop_table +--echo # con2: $drop_table (expect to get ER_BAD_TABLE_ERROR) +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table FROM "$create_table"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE create_table; +connection con2; +eval PREPARE create_table FROM "$create_table"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + connection con2; + --error 0,ER_TABLE_EXISTS_ERROR + EXECUTE create_table; + if (!$mysql_errno) + { + --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR + --echo # abort + exit; + } + connection default; + EXECUTE drop_table; + connection con2; + --error 0,ER_BAD_TABLE_ERROR + EXECUTE drop_table; + if (!$mysql_errno) + { + --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR) + --echo # abort + exit; + } + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE drop_table; +connection con2; +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE drop_table; +connection default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/stress/include/ddl4.inc b/mysql-test/suite/stress/include/ddl4.inc new file mode 100644 index 00000000..10452a45 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl4.inc @@ -0,0 +1,339 @@ +######## include/ddl4.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 4 variants (4A - 4D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 4 variants +# Scenario: CREATE TABLE variant1/SHOW/DROP TABLE/SHOW(F)/ +# CREATE TABLE variant2/SHOW/DROP TABLE +let $create_table1= CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=$engine_type; +let $create_table2= CREATE TABLE t1 (f1 BIGINT) ENGINE=$engine_type; +let $show_table= SHOW CREATE TABLE t1; +let $drop_table= DROP TABLE t1; +# +eval $create_table1; +let $cr_value1= INITIALIZED; +let $cr_value1= query_get_value($show_table, Create Table, 1); +eval $drop_table; +eval $create_table2; +let $cr_value2= INITIALIZED; +let $cr_value2= query_get_value($show_table, Create Table, 1); +eval $drop_table; +if (`SELECT '$cr_value1' = '$cr_value2'`) +{ + --echo # Error during generation of prerequisites. + --echo # cr_value1 equals cr_value2 + --echo # cr_value1: $cr_value1 + --echo # cr_value2: $cr_value2 + --echo # abort + exit; +} +#---------------------------------------------------------------------- + +# +--echo # Subtest 4A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table1 +--echo # default: $show_table +--echo # default: $drop_table +--echo # default: $show_table (expect to get ER_NO_SUCH_TABLE) +--echo # default: $create_table2 +--echo # default: $show_table +--echo # default: $drop_table +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table1; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + eval $drop_table; + --error 0,ER_NO_SUCH_TABLE + eval $show_table; + if (!$mysql_errno) + { + --echo # Error: SHOW CREATE TABLE was successful though we expected ER_NO_SUCH_TABLE) + --echo # abort + exit; + } + eval $create_table2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + eval $drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 4B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table1 +--echo # default: $show_table +--echo # default: $drop_table +--echo # default: $show_table (expect to get ER_NO_SUCH_TABLE) +--echo # default: $create_table2 +--echo # default: $show_table +--echo # default: $drop_table +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table1 FROM "$create_table1"; +eval PREPARE create_table2 FROM "$create_table2"; +EXECUTE create_table1; +eval PREPARE show_table FROM "$show_table"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table1; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + EXECUTE drop_table; + --error 0,ER_NO_SUCH_TABLE + EXECUTE show_table; + if (!$mysql_errno) + { + --echo # Error: SHOW CREATE TABLE was successful though we expected ER_NO_SUCH_TABLE) + --echo # abort + exit; + } + EXECUTE create_table2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + EXECUTE drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table1; +DEALLOCATE PREPARE create_table2; +DEALLOCATE PREPARE show_table; +DEALLOCATE PREPARE drop_table; +--enable_result_log +--enable_query_log +# +--echo # Subtest 4C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table1 +--echo # con2: $show_table +--echo # default: $drop_table +--echo # con2: $show_table (expect to get ER_NO_SUCH_TABLE) +--echo # default: $create_table2 +--echo # con2: $show_table +--echo # default: $drop_table +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table1; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + connection default; + eval $drop_table; + connection con2; + --error 0,ER_NO_SUCH_TABLE + eval $show_table; + if (!$mysql_errno) + { + --echo # Error: SHOW CREATE TABLE was successful though we expected ER_NO_SUCH_TABLE) + --echo # abort + exit; + } + connection default; + eval $create_table2; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + connection default; + eval $drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 4D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table1 +--echo # con2: $show_table +--echo # default: $drop_table +--echo # con2: $show_table (expect to get ER_NO_SUCH_TABLE) +--echo # default: $create_table2 +--echo # con2: $show_table +--echo # default: $drop_table +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_table1 FROM "$create_table1"; +eval PREPARE create_table2 FROM "$create_table2"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE create_table1; +connection con2; +eval PREPARE show_table FROM "$show_table"; +connection default; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table1; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + connection default; + EXECUTE drop_table; + connection con2; + --error 0,ER_NO_SUCH_TABLE + EXECUTE show_table; + if (!$mysql_errno) + { + --echo # Error: SHOW CREATE TABLE was successful though we expected ER_NO_SUCH_TABLE) + --echo # abort + exit; + } + connection default; + EXECUTE create_table2; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + connection default; + EXECUTE drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table1; +DEALLOCATE PREPARE create_table2; +DEALLOCATE PREPARE drop_table; +connection con2; +DEALLOCATE PREPARE show_table; +connection default; +--enable_result_log +--enable_query_log diff --git a/mysql-test/suite/stress/include/ddl5.inc b/mysql-test/suite/stress/include/ddl5.inc new file mode 100644 index 00000000..5a6c2fa0 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl5.inc @@ -0,0 +1,227 @@ +######## include/ddl5.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 5 variants (5A - 5D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +#---------------------------------------------------------------------- +# Settings for Subtest 5 variants +# Scenario: CREATE TABLE with AUTOINC/INSERT/SELECT/DROP TABLE +let $create_table= CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = $engine_type; +let $insert_into= INSERT INTO t1 SET f2 = 9; +let $select_record= SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9; +let $drop_table= DROP TABLE t1; +#---------------------------------------------------------------------- + +# +--echo # Subtest 5A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $insert_into +--echo # default: $select_record +--echo # default: $drop_table +--disable_query_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + eval $insert_into; + if (`$select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + eval $select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + eval $drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_query_log +# +--echo # Subtest 5B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # default: $insert_into +--echo # default: $select_record +--echo # default: $drop_table +--disable_query_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +eval PREPARE insert_into FROM "$insert_into"; +eval PREPARE select_record FROM "$select_record"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + EXECUTE insert_into; + if (`EXECUTE select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + EXECUTE select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + EXECUTE drop_table; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE insert_into; +DEALLOCATE PREPARE select_record; +DEALLOCATE PREPARE drop_table; +--enable_query_log +# +--echo # Subtest 5C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $insert_into +--echo # default: $select_record +--echo # con2: $drop_table +--disable_query_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_table; + connection con2; + eval $insert_into; + connection default; + if (`$select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + eval $select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + connection con2; + eval $drop_table; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_query_log +# +--echo # Subtest 5D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_table +--echo # con2: $insert_into +--echo # default: $select_record +--echo # con2: $drop_table +--disable_query_log +connection default; +eval PREPARE create_table FROM "$create_table"; +EXECUTE create_table; +eval PREPARE select_record FROM "$select_record"; +connection con2; +eval PREPARE insert_into FROM "$insert_into"; +eval PREPARE drop_table FROM "$drop_table"; +EXECUTE drop_table; +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_table; + connection con2; + EXECUTE insert_into; + connection default; + if (`EXECUTE select_record`) + { + --enable_result_log + --enable_query_log + --echo # Error: Unexpected content within t1. + --echo # Expected: 0 + --echo # Got: + EXECUTE select_record; + SELECT * FROM t1; + --echo # abort + exit; + } + connection con2; + EXECUTE drop_table; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_table; +DEALLOCATE PREPARE select_record; +connection con2; +DEALLOCATE PREPARE insert_into; +DEALLOCATE PREPARE drop_table; +connection default; +--enable_query_log diff --git a/mysql-test/suite/stress/include/ddl6.inc b/mysql-test/suite/stress/include/ddl6.inc new file mode 100644 index 00000000..7bbfe300 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl6.inc @@ -0,0 +1,266 @@ +######## include/ddl6.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 6 variants (6A - 6D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 6 variants +# Scenario: CREATE INDEX/CREATE INDEX(F)/DROP INDEX/DROP INDEX(F) +let $create_index= CREATE INDEX IDX1 ON t1 (f2); +let $drop_index= DROP INDEX IDX1 ON t1; +eval CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=$engine_type; +#---------------------------------------------------------------------- + + +# +--echo # Subtest 6A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $create_index (expect to get ER_DUP_KEYNAME) +--echo # default: $drop_index +--echo # default: $drop_index (expect to get ER_CANT_DROP_FIELD_OR_KEY) +--echo # default: $create_index +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index; + --error 0,ER_DUP_KEYNAME + eval $create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME + --echo # abort + exit; + } + eval $drop_index; + --error 0,ER_CANT_DROP_FIELD_OR_KEY + eval $drop_index; + if (!$mysql_errno) + { + --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY + --echo # abort + exit; + } + eval $create_index; + eval $drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 6B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $create_index (expect to get ER_DUP_KEYNAME) +--echo # default: $drop_index +--echo # default: $drop_index (expect to get ER_CANT_DROP_FIELD_OR_KEY) +--echo # default: $create_index +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index FROM "$create_index"; +EXECUTE create_index; +eval PREPARE drop_index FROM "$drop_index"; +EXECUTE drop_index; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index; + --error 0,ER_DUP_KEYNAME + EXECUTE create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME + --echo # abort + exit; + } + EXECUTE drop_index; + --error 0,ER_CANT_DROP_FIELD_OR_KEY + EXECUTE drop_index; + if (!$mysql_errno) + { + --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY + --echo # abort + exit; + } + EXECUTE create_index; + EXECUTE drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE drop_index; +--enable_result_log +--enable_query_log +# +--echo # Subtest 6C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # con2: $create_index (expect to get ER_DUP_KEYNAME) +--echo # default: $drop_index +--echo # con2: $drop_index (expect to get ER_CANT_DROP_FIELD_OR_KEY) +--echo # default: $create_index +--echo # con2: $drop_index +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index; + connection con2; + --error 0,ER_DUP_KEYNAME + eval $create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME + --echo # abort + exit; + } + connection default; + eval $drop_index; + connection con2; + --error 0,ER_CANT_DROP_FIELD_OR_KEY + eval $drop_index; + if (!$mysql_errno) + { + --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY + --echo # abort + exit; + } + connection default; + eval $create_index; + connection con2; + eval $drop_index; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 6D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # con2: $create_index (expect to get ER_DUP_KEYNAME) +--echo # default: $drop_index +--echo # con2: $drop_index (expect to get ER_CANT_DROP_FIELD_OR_KEY) +--echo # default: $create_index +--echo # con2: $drop_index +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index FROM "$create_index"; +eval PREPARE drop_index FROM "$drop_index"; +EXECUTE create_index; +connection con2; +eval PREPARE create_index FROM "$create_index"; +eval PREPARE drop_index FROM "$drop_index"; +EXECUTE drop_index; +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index; + connection con2; + --error 0,ER_DUP_KEYNAME + EXECUTE create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME + --echo # abort + exit; + } + connection default; + EXECUTE drop_index; + connection con2; + --error 0,ER_CANT_DROP_FIELD_OR_KEY + EXECUTE drop_index; + if (!$mysql_errno) + { + --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY + --echo # abort + exit; + } + connection default; + EXECUTE create_index; + connection con2; + EXECUTE drop_index; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE drop_index; +connection con2; +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE drop_index; +connection default; +--enable_result_log +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/stress/include/ddl7.inc b/mysql-test/suite/stress/include/ddl7.inc new file mode 100644 index 00000000..00308a1a --- /dev/null +++ b/mysql-test/suite/stress/include/ddl7.inc @@ -0,0 +1,272 @@ +######## include/ddl7.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 7 variants (7A - 7D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 7 variants +# Scenario: CREATE INDEX/INSERT(F)/DROP INDEX/INSERT/CREATE INDEX(F)/DELETE +let $create_index= CREATE UNIQUE INDEX IDX1 ON t1 (f2); +let $insert_record= INSERT INTO t1 VALUES(1,1); +let $drop_index= DROP INDEX IDX1 ON t1; +let $delete_record= DELETE FROM t1 WHERE f1 = 1; +eval CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1)) ENGINE=$engine_type; +INSERT INTO t1 VALUES(0,1); +#---------------------------------------------------------------------- + +# +--echo # Subtest 7A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $insert_record (expect to get ER_DUP_ENTRY) +--echo # default: $drop_index +--echo # default: $insert_record +--echo # default: $create_index (expect to get ER_DUP_ENTRY) +--echo # default: $delete_record +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +let $counter= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index; + --error 0,ER_DUP_ENTRY + eval $insert_record; + if (!$mysql_errno) + { + --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + eval $drop_index; + eval $insert_record; + --error 0,ER_DUP_ENTRY + eval $create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + eval $delete_record; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 7B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $insert_record (expect to get ER_DUP_ENTRY) +--echo # default: $drop_index +--echo # default: $insert_record +--echo # default: $create_index (expect to get ER_DUP_ENTRY) +--echo # default: $delete_record +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index FROM "$create_index"; +eval PREPARE insert_record FROM "$insert_record"; +eval PREPARE delete_record FROM "$delete_record"; +eval PREPARE drop_index FROM "$drop_index"; +let $run= 1; +let $counter= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index; + --error 0,ER_DUP_ENTRY + EXECUTE insert_record; + if (!$mysql_errno) + { + --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + EXECUTE drop_index; + EXECUTE insert_record; + --error 0,ER_DUP_ENTRY + EXECUTE create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + EXECUTE delete_record; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE insert_record; +DEALLOCATE PREPARE delete_record; +DEALLOCATE PREPARE drop_index; +--enable_result_log +--enable_query_log +# +--echo # Subtest 7C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $insert_record (expect to get ER_DUP_ENTRY) +--echo # con2: $drop_index +--echo # default: $insert_record +--echo # con2: $create_index (expect to get ER_DUP_ENTRY) +--echo # con2: $delete_record +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +let $counter= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index; + --error 0,ER_DUP_ENTRY + eval $insert_record; + if (!$mysql_errno) + { + --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + connection con2; + eval $drop_index; + connection default; + eval $insert_record; + connection con2; + --error 0,ER_DUP_ENTRY + eval $create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + eval $delete_record; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 7D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index +--echo # default: $insert_record (expect to get ER_DUP_ENTRY) +--echo # con2: $drop_index +--echo # default: $insert_record +--echo # con2: $create_index (expect to get ER_DUP_ENTRY) +--echo # con2: $delete_record +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index FROM "$create_index"; +eval PREPARE insert_record FROM "$insert_record"; +EXECUTE create_index; +connection con2; +eval PREPARE create_index FROM "$create_index"; +eval PREPARE drop_index FROM "$drop_index"; +eval PREPARE delete_record FROM "$delete_record"; +EXECUTE drop_index; +connection default; +let $run= 1; +let $counter= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index; + --error 0,ER_DUP_ENTRY + EXECUTE insert_record; + if (!$mysql_errno) + { + --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + connection con2; + EXECUTE drop_index; + connection default; + EXECUTE insert_record; + connection con2; + --error 0,ER_DUP_ENTRY + EXECUTE create_index; + if (!$mysql_errno) + { + --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY + --echo # abort + exit; + } + EXECUTE delete_record; + connection default; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE insert_record; +connection con2; +DEALLOCATE PREPARE create_index; +DEALLOCATE PREPARE drop_index; +DEALLOCATE PREPARE delete_record; +connection default; +--enable_result_log +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/stress/include/ddl8.inc b/mysql-test/suite/stress/include/ddl8.inc new file mode 100644 index 00000000..85a70770 --- /dev/null +++ b/mysql-test/suite/stress/include/ddl8.inc @@ -0,0 +1,302 @@ +######## include/ddl8.inc ###### +# +# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX +# and following SELECT/INSERT/SHOW etc. +# Subtest 8 variants (8A - 8D) +# +# The variables +# $loop_size -- number of rounds till we look at the clock again +# $runtime -- rough intended runtime per subtest variant +# $engine_type -- storage engine to be used in CREATE TABLE +# must be set within the routine sourcing this script. +# +# Other stuff which must already exist: +# - connection con2 +# - stmt_start and stmt_break prepared by the default connection +# +# Please look for more details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + + +#---------------------------------------------------------------------- +# Settings for Subtest 8 variants +# Scenario: CREATE INDEX variant1/SHOW/DROP INDEX/ +# CREATE INDEX variant2/SHOW/DROP INDEX +let $create_index1= CREATE INDEX IDX ON t1 (f2); +let $create_index2= CREATE UNIQUE INDEX IDX ON t1 (f2); +let $show_table= SHOW CREATE TABLE t1; +let $drop_index= DROP INDEX IDX ON t1; +eval CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=$engine_type; +INSERT INTO t1 VALUES(1,1); +eval $create_index1; +let $cr_value1= INITIALIZED; +let $cr_value1= query_get_value($show_table, Create Table, 1); +eval $drop_index; +eval $create_index2; +let $cr_value2= INITIALIZED; +let $cr_value2= query_get_value($show_table, Create Table, 1); +eval $drop_index; +if (`SELECT '$cr_value1' = '$cr_value2'`) +{ + --echo # Error during generation of prerequisites. + --echo # cr_value1 equals cr_value2 + --echo # cr_value1: $cr_value1 + --echo # cr_value2: $cr_value2 + --echo # abort + exit; +} +#---------------------------------------------------------------------- + +# +--echo # Subtest 8A (one connection, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index1 +--echo # default: $show_table +--echo # default: $drop_index +--echo # default: $create_index2 +--echo # default: $show_table +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index1; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + eval $drop_index; + eval $create_index2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + eval $drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 8B (one connection, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index1 +--echo # default: $show_table +--echo # default: $drop_index +--echo # default: $create_index2 +--echo # default: $show_table +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index1 FROM "$create_index1"; +eval PREPARE create_index2 FROM "$create_index2"; +EXECUTE create_index1; +eval PREPARE show_table FROM "$show_table"; +eval PREPARE drop_index FROM "$drop_index"; +EXECUTE drop_index; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index1; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + EXECUTE drop_index; + EXECUTE create_index2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + EXECUTE drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index1; +DEALLOCATE PREPARE create_index2; +DEALLOCATE PREPARE show_table; +DEALLOCATE PREPARE drop_index; +--enable_result_log +--enable_query_log +# +--echo # Subtest 8C (two connections, no PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index1 +--echo # con2: $show_table +--echo # default: $drop_index +--echo # default: $create_index2 +--echo # con2: $show_table +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + eval $create_index1; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + connection default; + eval $drop_index; + eval $create_index2; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value($show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + connection default; + eval $drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +--enable_result_log +--enable_query_log +# +--echo # Subtest 8D (two connections, use PREPARE/EXECUTE) +--echo # connection action +--echo # default: $create_index1 +--echo # con2: $show_table +--echo # default: $drop_index +--echo # default: $create_index2 +--echo # con2: $show_table +--echo # default: $drop_index +--disable_query_log +--disable_result_log +connection default; +eval PREPARE create_index1 FROM "$create_index1"; +eval PREPARE create_index2 FROM "$create_index2"; +eval PREPARE drop_index FROM "$drop_index"; +EXECUTE create_index1; +connection con2; +eval PREPARE show_table FROM "$show_table"; +connection default; +EXECUTE drop_index; +let $run= 1; +# Determine the current time. +EXECUTE stmt_start; +# Run execution loops till the planned runtime is reached +while ($run) +{ + let $loop_run= $loop_size; + while ($loop_run) + { + EXECUTE create_index1; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value1'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value1 + --echo # abort + exit; + } + connection default; + EXECUTE drop_index; + EXECUTE create_index2; + connection con2; + let $value= INITIALIZED; + let $value= query_get_value(EXECUTE show_table, Create Table, 1); + if (`SELECT '$value' <> '$cr_value2'`) + { + --echo # Error: Unexpected SHOW CREATE TABLE output + --echo # Got: $value + --echo # Expected: $cr_value2 + --echo # abort + exit; + } + connection default; + EXECUTE drop_index; + dec $loop_run; + } + if (`EXECUTE stmt_break`) + { + let $run= 0; + } +} +DEALLOCATE PREPARE create_index1; +DEALLOCATE PREPARE create_index2; +DEALLOCATE PREPARE drop_index; +connection con2; +DEALLOCATE PREPARE show_table; +connection default; +--enable_result_log +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/stress/r/ddl_archive.result b/mysql-test/suite/stress/r/ddl_archive.result new file mode 100644 index 00000000..f11610b6 --- /dev/null +++ b/mysql-test/suite/stress/r/ddl_archive.result @@ -0,0 +1,82 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +SET @runtime = <intended_runtime>; +PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect con2,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +# Subtest 2A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = ARCHIVE AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = ARCHIVE AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = ARCHIVE AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = ARCHIVE AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 3A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 5A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = ARCHIVE +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = ARCHIVE +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = ARCHIVE +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +# Subtest 5D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = ARCHIVE +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/r/ddl_csv.result b/mysql-test/suite/stress/r/ddl_csv.result new file mode 100644 index 00000000..ed6fafe3 --- /dev/null +++ b/mysql-test/suite/stress/r/ddl_csv.result @@ -0,0 +1,58 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +SET @runtime = <intended_runtime>; +PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect con2,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +# Subtest 2A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = CSV AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = CSV AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = CSV AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = CSV AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 3A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/r/ddl_innodb.result b/mysql-test/suite/stress/r/ddl_innodb.result new file mode 100644 index 00000000..479f11eb --- /dev/null +++ b/mysql-test/suite/stress/r/ddl_innodb.result @@ -0,0 +1,254 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +SET @runtime = <intended_runtime>; +PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect con2,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +# Subtest 1A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = InnoDB +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = InnoDB +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = InnoDB +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 1D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = InnoDB +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 2A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = InnoDB AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = InnoDB AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = InnoDB AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = InnoDB AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 3A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB; +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB; +DROP TABLE t1; +# Subtest 4A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 5A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = InnoDB +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = InnoDB +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = InnoDB +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +# Subtest 5D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = InnoDB +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=InnoDB; +# Subtest 6A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +# Subtest 6D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0,1); +# Subtest 7A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1); +CREATE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +CREATE UNIQUE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +# Subtest 8A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +DROP TABLE t1; +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/r/ddl_memory.result b/mysql-test/suite/stress/r/ddl_memory.result new file mode 100644 index 00000000..8f206369 --- /dev/null +++ b/mysql-test/suite/stress/r/ddl_memory.result @@ -0,0 +1,254 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +SET @runtime = <intended_runtime>; +PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect con2,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +# Subtest 1A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MEMORY +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MEMORY +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MEMORY +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 1D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MEMORY +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 2A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MEMORY AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MEMORY AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MEMORY AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MEMORY AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 3A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY; +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY; +DROP TABLE t1; +# Subtest 4A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 5A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MEMORY +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MEMORY +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MEMORY +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +# Subtest 5D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MEMORY +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=MEMORY; +# Subtest 6A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +# Subtest 6D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1)) ENGINE=MEMORY; +INSERT INTO t1 VALUES(0,1); +# Subtest 7A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=MEMORY; +INSERT INTO t1 VALUES(1,1); +CREATE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +CREATE UNIQUE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +# Subtest 8A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +DROP TABLE t1; +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/r/ddl_myisam.result b/mysql-test/suite/stress/r/ddl_myisam.result new file mode 100644 index 00000000..c441d0dd --- /dev/null +++ b/mysql-test/suite/stress/r/ddl_myisam.result @@ -0,0 +1,254 @@ +SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION'; +PREPARE stmt_start FROM "SELECT UNIX_TIMESTAMP() INTO @start"; +SET @runtime = <intended_runtime>; +PREPARE stmt_break FROM "SELECT UNIX_TIMESTAMP() - @start > @runtime - 1"; +connect con2,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +# Subtest 1A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MyISAM +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MyISAM +# default: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# default: DROP TABLE t1 +# Subtest 1C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MyISAM +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 1D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT,f2 BIGINT,UNIQUE(f1),UNIQUE(f2)) +ENGINE = MyISAM +# con2: INSERT INTO t1 VALUES (1,1), (2,2), (3,3) +# con2: DROP TABLE t1 +# Subtest 2A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MyISAM AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MyISAM AS SELECT 1 AS f1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# default: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MyISAM AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 2D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 ENGINE = MyISAM AS SELECT 1 AS f1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 +# default: DROP TABLE t1 +# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE) +# Subtest 3A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +# Subtest 3D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM +# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR) +# default: DROP TABLE t1 +# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR) +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM; +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM; +DROP TABLE t1; +# Subtest 4A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# default: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM +# default: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 4D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# con2: SHOW CREATE TABLE t1 (expect to get ER_NO_SUCH_TABLE) +# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM +# con2: SHOW CREATE TABLE t1 +# default: DROP TABLE t1 +# Subtest 5A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MyISAM +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MyISAM +# default: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# default: DROP TABLE t1 +# Subtest 5C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MyISAM +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +# Subtest 5D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE TABLE t1 (f1 MEDIUMINT NOT NULL AUTO_INCREMENT,f2 BIGINT, UNIQUE(f1)) ENGINE = MyISAM +# con2: INSERT INTO t1 SET f2 = 9 +# default: SELECT f1 <> 1 OR f1 IS NULL FROM t1 WHERE f2 = 9 +# con2: DROP TABLE t1 +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=MyISAM; +# Subtest 6A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# default: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# default: DROP INDEX IDX1 ON t1 +# Subtest 6C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +# Subtest 6D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: CREATE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_KEYNAME) +# default: DROP INDEX IDX1 ON t1 +# con2: DROP INDEX IDX1 ON t1 (expect to get ER_CANT_DROP_FIELD_OR_KEY) +# default: CREATE INDEX IDX1 ON t1 (f2) +# con2: DROP INDEX IDX1 ON t1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES(0,1); +# Subtest 7A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# default: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# default: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +# Subtest 7D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE UNIQUE INDEX IDX1 ON t1 (f2) +# default: INSERT INTO t1 VALUES(1,1) (expect to get ER_DUP_ENTRY) +# con2: DROP INDEX IDX1 ON t1 +# default: INSERT INTO t1 VALUES(1,1) +# con2: CREATE UNIQUE INDEX IDX1 ON t1 (f2) (expect to get ER_DUP_ENTRY) +# con2: DELETE FROM t1 WHERE f1 = 1 +DROP TABLE t1; +CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1,1); +CREATE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +CREATE UNIQUE INDEX IDX ON t1 (f2); +DROP INDEX IDX ON t1; +# Subtest 8A (one connection, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8B (one connection, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# default: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8C (two connections, no PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# Subtest 8D (two connections, use PREPARE/EXECUTE) +# connection action +# default: CREATE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +# default: CREATE UNIQUE INDEX IDX ON t1 (f2) +# con2: SHOW CREATE TABLE t1 +# default: DROP INDEX IDX ON t1 +DROP TABLE t1; +disconnect con2; +DEALLOCATE PREPARE stmt_start; +DEALLOCATE PREPARE stmt_break; diff --git a/mysql-test/suite/stress/r/deadlock_drop_table.result b/mysql-test/suite/stress/r/deadlock_drop_table.result new file mode 100644 index 00000000..7e549157 --- /dev/null +++ b/mysql-test/suite/stress/r/deadlock_drop_table.result @@ -0,0 +1,33 @@ +create or replace table t1 (a int primary key, b int, c int, key(b),key(c)) engine=myisam; +insert into t1 (a) values(1); +set debug_sync='RESET'; +connect con1, localhost, root,,; +connect con2, localhost, root,,; +connection default; +backup stage start; +backup stage flush; +select * from t1; +a b c +1 NULL NULL +set debug_sync='after_purge_tables SIGNAL parked WAIT_FOR go'; +set debug_sync='before_tc_release_table SIGNAL parked2 WAIT_FOR go2'; +backup stage BLOCK_DDL; +connection con1; +set debug_sync='now WAIT_FOR parked'; +select * from t1; +a b c +1 NULL NULL +set debug_sync='now SIGNAL go'; +set debug_sync='now WAIT_FOR parked2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; +drop table t1;; +connection con2; +set debug_sync='now WAIT_FOR waiting'; +set debug_sync='now SIGNAL go2'; +set debug_sync='now SIGNAL go3'; +connection default; +connection con1; +connection default; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; diff --git a/mysql-test/suite/stress/r/misc.result b/mysql-test/suite/stress/r/misc.result new file mode 100644 index 00000000..6d0a3ea5 --- /dev/null +++ b/mysql-test/suite/stress/r/misc.result @@ -0,0 +1,9 @@ +# +# MDEV-22339 - Assertion `str_length < len' failed in +# Binary_string::realloc_raw +# +CREATE TABLE t1(a INT) ENGINE=MyISAM; +connect con1, localhost, root; +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/stress/t/ddl_archive.test b/mysql-test/suite/stress/t/ddl_archive.test new file mode 100644 index 00000000..c688ae19 --- /dev/null +++ b/mysql-test/suite/stress/t/ddl_archive.test @@ -0,0 +1,48 @@ +######## t/ddl_archive.test ###### +# +# Stress the storage engine ARCHIVE with CREATE/DROP TABLE/INDEX +# +# Please look for details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +# Storage engine to be used in CREATE TABLE +--source include/have_archive.inc +let $engine_type= ARCHIVE; + +--source include/no_protocol.inc + +let $run= `SELECT '$BIG_TEST' = '1'`; +if ($run) +{ + # A run started with "--big-test" should be allowed to consume more time. + # Rough intended runtime per subtest variant in seconds + let $runtime = 5; + # number of rounds till we look at the clock again + let $loop_size= 100; +} +if (!$run) +{ + let $runtime = 1; + let $loop_size= 20; +} + + +##### Some preparations needed for the ddl*.inc scripts +--source suite/stress/include/ddl.pre + +# Tests set to comment fail because of CSV limitations +# (limited number of keys, NULL within index not supported) +# --source suite/stress/include/ddl1.inc +--source suite/stress/include/ddl2.inc +--source suite/stress/include/ddl3.inc +# --source suite/stress/include/ddl4.inc +--source suite/stress/include/ddl5.inc +# --source suite/stress/include/ddl6.inc +# --source suite/stress/include/ddl7.inc +# --source suite/stress/include/ddl8.inc + +##### Cleanup +--source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/stress/t/ddl_csv.test b/mysql-test/suite/stress/t/ddl_csv.test new file mode 100644 index 00000000..3e0f8acb --- /dev/null +++ b/mysql-test/suite/stress/t/ddl_csv.test @@ -0,0 +1,48 @@ +######## t/ddl_csv.test ###### +# +# Stress the storage engine CSV with CREATE/DROP TABLE/INDEX +# +# Please look for details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +# Storage engine to be used in CREATE TABLE +--source include/have_csv.inc +let $engine_type= CSV; + +--source include/no_protocol.inc + +let $run= `SELECT '$BIG_TEST' = '1'`; +if ($run) +{ + # A run started with "--big-test" should be allowed to consume more time. + # Rough intended runtime per subtest variant in seconds + let $runtime = 5; + # number of rounds till we look at the clock again + let $loop_size= 100; +} +if (!$run) +{ + let $runtime = 1; + let $loop_size= 20; +} + + +##### Some preparations needed for the ddl*.inc scripts +--source suite/stress/include/ddl.pre + +# Tests set to comment fail because of CSV limitations +# (limited number of keys, AUTOINC not supported) +# --source suite/stress/include/ddl1.inc +--source suite/stress/include/ddl2.inc +--source suite/stress/include/ddl3.inc +# --source suite/stress/include/ddl4.inc +# --source suite/stress/include/ddl5.inc +# --source suite/stress/include/ddl6.inc +# --source suite/stress/include/ddl7.inc +# --source suite/stress/include/ddl8.inc + +##### Cleanup +--source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test new file mode 100644 index 00000000..d5e23124 --- /dev/null +++ b/mysql-test/suite/stress/t/ddl_innodb.test @@ -0,0 +1,47 @@ +--source include/no_valgrind_without_big.inc +######## t/ddl_innodb.test ###### +# +# Stress the storage engine InnoDB with CREATE/DROP TABLE/INDEX +# +# Please look for details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +# Storage engine to be used in CREATE TABLE +--source include/have_innodb.inc +let $engine_type= InnoDB; + +--source include/no_protocol.inc + +let $run= `SELECT '$BIG_TEST' = '1'`; +if ($run) +{ + # A run started with "--big-test" should be allowed to consume more time. + # Rough intended runtime per subtest variant in seconds + let $runtime = 5; + # number of rounds till we look at the clock again + let $loop_size= 100; +} +if (!$run) +{ + let $runtime = 1; + let $loop_size= 20; +} + + +##### Some preparations needed for the ddl*.inc scripts +--source suite/stress/include/ddl.pre + +--source suite/stress/include/ddl1.inc +--source suite/stress/include/ddl2.inc +--source suite/stress/include/ddl3.inc +--source suite/stress/include/ddl4.inc +--source suite/stress/include/ddl5.inc +--source suite/stress/include/ddl6.inc +--source suite/stress/include/ddl7.inc +--source suite/stress/include/ddl8.inc + +##### Cleanup +--source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/stress/t/ddl_memory.test b/mysql-test/suite/stress/t/ddl_memory.test new file mode 100644 index 00000000..bcca77a7 --- /dev/null +++ b/mysql-test/suite/stress/t/ddl_memory.test @@ -0,0 +1,45 @@ +######## t/ddl_memory.test ###### +# +# Stress the storage engine MEMORY with CREATE/DROP TABLE/INDEX +# +# Please look for details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +# Storage engine to be used in CREATE TABLE +let $engine_type= MEMORY; + +--source include/no_protocol.inc + +let $run= `SELECT '$BIG_TEST' = '1'`; +if ($run) +{ + # A run started with "--big-test" should be allowed to consume more time. + # Rough intended runtime per subtest variant in seconds + let $runtime = 5; + # number of rounds till we look at the clock again + let $loop_size= 100; +} +if (!$run) +{ + let $runtime = 1; + let $loop_size= 20; +} + + +##### Some preparations needed for the ddl*.inc scripts +--source suite/stress/include/ddl.pre + +--source suite/stress/include/ddl1.inc +--source suite/stress/include/ddl2.inc +--source suite/stress/include/ddl3.inc +--source suite/stress/include/ddl4.inc +--source suite/stress/include/ddl5.inc +--source suite/stress/include/ddl6.inc +--source suite/stress/include/ddl7.inc +--source suite/stress/include/ddl8.inc + +##### Cleanup +--source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/stress/t/ddl_myisam.test b/mysql-test/suite/stress/t/ddl_myisam.test new file mode 100644 index 00000000..a9b14690 --- /dev/null +++ b/mysql-test/suite/stress/t/ddl_myisam.test @@ -0,0 +1,45 @@ +######## t/ddl_myisam.test ###### +# +# Stress the storage engine MyISAM with CREATE/DROP TABLE/INDEX +# +# Please look for details within include/ddl1.inc. +# +# Creation of this test: +# 2007-07-04 mleich +# + +# Storage engine to be used in CREATE TABLE +let $engine_type= MyISAM; + +--source include/no_protocol.inc + +let $run= `SELECT '$BIG_TEST' = '1'`; +if ($run) +{ + # A run started with "--big-test" should be allowed to consume more time. + # Rough intended runtime per subtest variant in seconds + let $runtime = 5; + # number of rounds till we look at the clock again + let $loop_size= 100; +} +if (!$run) +{ + let $runtime = 1; + let $loop_size= 20; +} + + +##### Some preparations needed for the ddl*.inc scripts +--source suite/stress/include/ddl.pre + +--source suite/stress/include/ddl1.inc +--source suite/stress/include/ddl2.inc +--source suite/stress/include/ddl3.inc +--source suite/stress/include/ddl4.inc +--source suite/stress/include/ddl5.inc +--source suite/stress/include/ddl6.inc +--source suite/stress/include/ddl7.inc +--source suite/stress/include/ddl8.inc + +##### Cleanup +--source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/stress/t/deadlock_drop_table.test b/mysql-test/suite/stress/t/deadlock_drop_table.test new file mode 100644 index 00000000..b4f8f220 --- /dev/null +++ b/mysql-test/suite/stress/t/deadlock_drop_table.test @@ -0,0 +1,37 @@ +--source include/have_debug.inc +--source include/have_debug_sync.inc + +create or replace table t1 (a int primary key, b int, c int, key(b),key(c)) engine=myisam; +insert into t1 (a) values(1); + +set debug_sync='RESET'; +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); +connection default; + +backup stage start; +backup stage flush; +select * from t1; +set debug_sync='after_purge_tables SIGNAL parked WAIT_FOR go'; +set debug_sync='before_tc_release_table SIGNAL parked2 WAIT_FOR go2'; +--send backup stage BLOCK_DDL +--connection con1 +set debug_sync='now WAIT_FOR parked'; +select * from t1; +set debug_sync='now SIGNAL go'; +set debug_sync='now WAIT_FOR parked2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; +--send drop table t1; +--connection con2 +set debug_sync='now WAIT_FOR waiting'; +set debug_sync='now SIGNAL go2'; +set debug_sync='now SIGNAL go3'; + +--connection default +--reap +--connection con1 +--reap +connection default; +disconnect con1; +disconnect con2; +set debug_sync='RESET'; diff --git a/mysql-test/suite/stress/t/misc.test b/mysql-test/suite/stress/t/misc.test new file mode 100644 index 00000000..e8255cb3 --- /dev/null +++ b/mysql-test/suite/stress/t/misc.test @@ -0,0 +1,32 @@ +--echo # +--echo # MDEV-22339 - Assertion `str_length < len' failed in +--echo # Binary_string::realloc_raw +--echo # +CREATE TABLE t1(a INT) ENGINE=MyISAM; +connect con1, localhost, root; +let $i=1000; +disable_query_log; +disable_result_log; +while ($i) +{ + connection default; + HANDLER t1 OPEN; + send SELECT * FROM t1, t1 t1a1over8, t1 t1a2over8, t1 t1a3over8, t1 t1a4over8, t1 t1a5over8, t1 t1a6over8; + + connection con1; + send REPAIR TABLE t1; + + connection default; + reap; + HANDLER t1 CLOSE; + + connection con1; + reap; + dec $i; +} +enable_query_log; +enable_result_log; +disconnect con1; + +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/stress/t/wrapper.test b/mysql-test/suite/stress/t/wrapper.test new file mode 100644 index 00000000..7a468985 --- /dev/null +++ b/mysql-test/suite/stress/t/wrapper.test @@ -0,0 +1,29 @@ +# +# This is a wrapper "pseudo" test for mtr --stress execution. +# It should not be run directly (will be skipped) +# Do not create a result file! +# + +if (!$MST_OPTIONS) { + skip Only to be run with mtr --stress; +} + +# echo Running MST with options $MST_OPTIONS; + +perl; + my ($mtest)= split " ", $ENV{MYSQL_TEST}; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/mtest.inc") or die; + print FILE "let \$MYSQLTEST_BIN= $mtest;\n"; + close FILE; +EOF + +--source $MYSQL_TMP_DIR/mtest.inc +--remove_file $MYSQL_TMP_DIR/mtest.inc + +exec perl mariadb-stress-test.pl --mysqltest=$MYSQLTEST_BIN + --server-port=$MASTER_MYPORT --server-socket=$MASTER_MYSOCK + --server-user=root --cleanup + --server-logs-dir=$MYSQLTEST_VARDIR/log + --stress-basedir=$MYSQLTEST_VARDIR + $MST_OPTIONS +; |