diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-01-16 20:16:35 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-01-16 20:16:35 +0100 |
commit | 38e3ae155db08ab2e9e5c267f05f89bec0542b33 (patch) | |
tree | 7289bbef1ba3f495aa5c7cdb7d0a3f993a5bbc80 /mysql-test/t | |
parent | c56483d972d023105fbcb0f47af0042ee092657c (diff) | |
parent | ed1ba992c1d3c3ecbe6a2769c51ceb5d27606d3b (diff) | |
download | mariadb-git-38e3ae155db08ab2e9e5c267f05f89bec0542b33.tar.gz |
mysql-5.5 merge
Diffstat (limited to 'mysql-test/t')
35 files changed, 855 insertions, 443 deletions
diff --git a/mysql-test/t/alter_table-big.test b/mysql-test/t/alter_table-big.test index cc7b8ea02b4..b010815955f 100644 --- a/mysql-test/t/alter_table-big.test +++ b/mysql-test/t/alter_table-big.test @@ -18,7 +18,10 @@ --disable_warnings drop table if exists t1, t2; --enable_warnings +set debug_sync='RESET'; + connect (addconroot, localhost, root,,); +connect (addconroot2, localhost, root,,); connection default; create table t1 (n1 int, n2 int, n3 int, key (n1, n2, n3), @@ -26,38 +29,45 @@ create table t1 (n1 int, n2 int, n3 int, key (n3, n1, n2)); create table t2 (i int); -# Starting from 5.1 we have runtime settable @@debug variable, -# which can be used for introducing delays at certain points of -# statement execution, so we don't need many rows in 't1' to make -# this test repeatable. alter table t1 disable keys; ---disable_warnings -insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000); ---enable_warnings +insert into t1 values (1, 2, 3); # Later we use binlog to check the order in which statements are # executed so let us reset it first. reset master; -set session debug_dbug="+d,sleep_alter_enable_indexes"; +set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go'; --send alter table t1 enable keys; connection addconroot; ---sleep 2 +# Wait until ALTER TABLE acquires metadata lock. +set debug_sync='now WAIT_FOR parked'; # This statement should not be blocked by in-flight ALTER and therefore # should be executed and written to binlog before ALTER TABLE ... ENABLE KEYS # finishes. insert into t2 values (1); # And this should wait until the end of ALTER TABLE ... ENABLE KEYS. -insert into t1 values (1, 1, 1); +--send insert into t1 values (1, 1, 1); +connection addconroot2; +# Wait until the above INSERT INTO t1 is blocked due to ALTER +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t1 values (1, 1, 1)"; +--source include/wait_condition.inc +# Resume ALTER execution. +set debug_sync='now SIGNAL go'; connection default; --reap -set session debug_dbug="-d,sleep_alter_enable_indexes"; +connection addconroot; +--reap +connection default; # Check that statements were executed/binlogged in correct order. source include/show_binlog_events.inc; # Clean up drop tables t1, t2; disconnect addconroot; - +disconnect addconroot2; +set debug_sync='RESET'; --echo End of 5.0 tests @@ -72,48 +82,92 @@ disconnect addconroot; --disable_warnings drop table if exists t1, t2, t3; --enable_warnings +connect (addconroot, localhost, root,,); +connect (addconroot2, localhost, root,,); +connection default; create table t1 (i int); # We are going to check that statements are logged in correct order reset master; -set session debug_dbug="+d,sleep_alter_before_main_binlog"; +set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go'; --send alter table t1 change i c char(10) default 'Test1'; -connect (addconroot, localhost, root,,); connection addconroot; ---sleep 2 -insert into t1 values (); -select * from t1; +# Wait until ALTER TABLE acquires metadata lock. +set debug_sync='now WAIT_FOR parked'; +--send insert into t1 values (); +connection addconroot2; +# Wait until the above INSERT INTO t1 is blocked due to ALTER +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t1 values ()"; +--source include/wait_condition.inc +# Resume ALTER execution. +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot; +--reap +connection default; +select * from t1; +set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go'; --send alter table t1 change c vc varchar(100) default 'Test2'; connection addconroot; ---sleep 2 -rename table t1 to t2; +# Wait until ALTER TABLE acquires metadata lock. +set debug_sync='now WAIT_FOR parked'; +--send rename table t1 to t2; +connection addconroot2; +# Wait until the above RENAME TABLE is blocked due to ALTER +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; +--source include/wait_condition.inc +# Resume ALTER execution. +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot; +--reap +connection default; drop table t2; # And now tests for ALTER TABLE with RENAME clause. In this # case target table name should be properly locked as well. create table t1 (i int); +set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go'; --send alter table t1 change i c char(10) default 'Test3', rename to t2; connection addconroot; ---sleep 2 -insert into t2 values (); -select * from t2; +# Wait until ALTER TABLE acquires metadata lock. +set debug_sync='now WAIT_FOR parked'; +--send insert into t2 values(); +connection addconroot2; +# Wait until the above INSERT INTO t2 is blocked due to ALTER +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t2 values()"; +--source include/wait_condition.inc +# Resume ALTER execution. +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot; +--reap +connection default; +select * from t2; --send alter table t2 change c vc varchar(100) default 'Test2', rename to t1; connection addconroot; ---sleep 2 -rename table t1 to t3; connection default; --reap +rename table t1 to t3; + disconnect addconroot; +disconnect addconroot2; drop table t3; -set session debug_dbug="-d,sleep_alter_before_main_binlog"; +set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go'; +set debug_sync='RESET'; # Check that all statements were logged in correct order source include/show_binlog_events.inc; --echo End of 5.1 tests - diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 80f88fbb51b..d979ba509d5 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1754,3 +1754,18 @@ INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6; SELECT * FROM t1 ORDER BY f LIMIT 1; DROP TABLE t1; SET sort_buffer_size=DEFAULT; + + +--echo # +--echo # BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS +--echo # TESTS: CRASH, CORRUPTION, 4G MEMOR +--echo # (to be executed with valgrind) +CREATE TABLE t1(a BLOB, b VARCHAR(200)) ENGINE=ARCHIVE; +INSERT INTO t1 VALUES(NULL, ''); +FLUSH TABLE t1; +--echo # we need this select to workaround BUG#11764364 +SELECT * FROM t1; +CHECKSUM TABLE t1 EXTENDED; +FLUSH TABLE t1; +OPTIMIZE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/t/create-big.test b/mysql-test/t/create-big.test index 65273df3d1d..d487608f7e1 100644 --- a/mysql-test/t/create-big.test +++ b/mysql-test/t/create-big.test @@ -7,11 +7,13 @@ # # This test takes rather long time so let us run it only in --big-test mode --source include/big_test.inc -# We are using some debug-only features in this test ---source include/have_debug.inc +# We need the Debug Sync Facility. +--source include/have_debug_sync.inc # Some of tests below also use binlog to check that statements are # executed and logged in correct order --source include/have_binlog_format_mixed_or_statement.inc +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc # Create auxilliary connections connect (addconroot1, localhost, root,,); @@ -22,7 +24,7 @@ connection default; --disable_warnings drop table if exists t1,t2,t3,t4,t5; --enable_warnings - +set debug_sync='RESET'; # # Tests for concurrency problems in CREATE TABLE ... SELECT @@ -34,244 +36,378 @@ drop table if exists t1,t2,t3,t4,t5; # What happens in situation when other statement messes with # table to be created before it is created ? # Concurrent CREATE TABLE -set session debug_dbug="+d,sleep_create_select_before_create"; +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 ---error ER_TABLE_EXISTS_ERROR -create table t1 (j char(5)); +set debug_sync='now WAIT_FOR parked'; +--send create table t1 (j char(5)); +connection addconroot2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "create table t1 (j char(5))"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap +connection default; show create table t1; drop table t1; + # Concurrent CREATE TABLE ... SELECT +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 ---error ER_TABLE_EXISTS_ERROR -create table t1 select "Test" as j; +set debug_sync='now WAIT_FOR parked'; +--send create table t1 select 'Test' as j; +connection addconroot2; +# Wait until the above CREATE TABLE t1 is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "create table t1 select 'Test' as j"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap +connection default; show create table t1; drop table t1; + # Concurrent CREATE TABLE LIKE create table t3 (j char(5)); +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 ---error ER_TABLE_EXISTS_ERROR -create table t1 like t3; +set debug_sync='now WAIT_FOR parked'; +--send create table t1 like t3; +connection addconroot2; +# Wait until the above CREATE TABLE t1 is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "create table t1 like t3"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap +connection default; show create table t1; drop table t1; + # Concurrent RENAME TABLE +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 ---error ER_TABLE_EXISTS_ERROR -rename table t3 to t1; +set debug_sync='now WAIT_FOR parked'; +--send rename table t3 to t1; +connection addconroot2; +# Wait until the above RENAME TABLE is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "rename table t3 to t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--error ER_TABLE_EXISTS_ERROR +--reap +connection default; show create table t1; drop table t1; + # Concurrent ALTER TABLE RENAME +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 +set debug_sync='now WAIT_FOR parked'; --error ER_TABLE_EXISTS_ERROR alter table t3 rename to t1; +set debug_sync='now SIGNAL go'; connection default; --reap +connection default; show create table t1; drop table t1; + # Concurrent ALTER TABLE RENAME which also adds column +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 +set debug_sync='now WAIT_FOR parked'; --error ER_TABLE_EXISTS_ERROR alter table t3 rename to t1, add k int; +set debug_sync='now SIGNAL go'; connection default; --reap show create table t1; -drop table t1, t3; +drop table t1,t3; + # What happens if other statement sneaks in after the table # creation but before its opening ? -set session debug_dbug="-d,sleep_create_select_before_create:+d,sleep_create_select_before_open"; +set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go'; +connection default; + # Concurrent DROP TABLE +set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -drop table t1; +set debug_sync='now WAIT_FOR parked'; +--send drop table t1; +connection addconroot2; +# Wait until the above DROP TABLE is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; + # Concurrent RENAME TABLE +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -rename table t1 to t2; +set debug_sync='now WAIT_FOR parked'; +--send rename table t1 to t2; +connection addconroot2; +# Wait until the above RENAME TABLE is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; drop table t2; + # Concurrent SELECT +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -select * from t1; +set debug_sync='now WAIT_FOR parked'; +--send select * from t1; +connection addconroot2; +# Wait until the above SELECT is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "select * from t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; drop table t1; + # Concurrent INSERT +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -insert into t1 values (2); +set debug_sync='now WAIT_FOR parked'; +--send insert into t1 values (2); +connection addconroot2; +# Wait until the above INSERT is blocked due to CREATE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t1 values (2)"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; select * from t1; drop table t1; + # Concurrent CREATE TRIGGER set @a:=0; +set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -create trigger t1_bi before insert on t1 for each row set @a:=1; +set debug_sync='now WAIT_FOR parked'; +--send create trigger t1_bi before insert on t1 for each row set @a:=1; +connection addconroot2; +# Wait until the above CREATE TRIGGER is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "create trigger t1_bi before insert on t1 for each row set @a:=1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; select @a; drop table t1; + # Okay, now the same tests for the potential gap between open and lock -set session debug_dbug="-d,sleep_create_select_before_open:+d,sleep_create_select_before_lock"; +set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go'; + # Concurrent DROP TABLE --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -drop table t1; +set debug_sync='now WAIT_FOR parked'; +--send drop table t1; +connection addconroot2; +# Wait until the above DROP TABLE is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; + # Concurrent RENAME TABLE +set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -rename table t1 to t2; +set debug_sync='now WAIT_FOR parked'; +--send rename table t1 to t2; +connection addconroot2; +# Wait until the above RENAME TABLE is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "rename table t1 to t2"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; drop table t2; + # Concurrent SELECT +set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -select * from t1; +set debug_sync='now WAIT_FOR parked'; +--send select * from t1; +connection addconroot2; +# Wait until the above SELECT is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "select * from t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; drop table t1; + # Concurrent INSERT +set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -insert into t1 values (2); +set debug_sync='now WAIT_FOR parked'; +--send insert into t1 values (2); +connection addconroot2; +# Wait until the above INSERT INTO t1 is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t1 values (2)"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; select * from t1; drop table t1; + # Concurrent CREATE TRIGGER set @a:=0; +set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go'; --send create table t1 select 1 as i; connection addconroot1; ---sleep 2 -create trigger t1_bi before insert on t1 for each row set @a:=1; +set debug_sync='now WAIT_FOR parked'; +--send create trigger t1_bi before insert on t1 for each row set @a:=1; +connection addconroot2; +# Wait until the above CREATE TRIGGER is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "create trigger t1_bi before insert on t1 for each row set @a:=1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; select @a; drop table t1; -# Some tests for case with existing table -set session debug_dbug="-d,sleep_create_select_before_lock:+d,sleep_create_select_before_check_if_exists"; -create table t1 (i int); + # Concurrent DROP TABLE +set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; --send create table if not exists t1 select 1 as i; connection addconroot1; ---sleep 2 -drop table t1; +set debug_sync='now WAIT_FOR parked'; +--send drop table t1; +connection addconroot2; +# Wait until the above DROP TABLE is blocked due to CREATE TABLE +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap -# Concurrent CREATE TRIGGER +connection addconroot1; +--reap +connection default; + +# Concurrent CREATE TRIGGER create table t1 (i int); set @a:=0; +set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; --send create table if not exists t1 select 1 as i; connection addconroot1; ---sleep 2 create trigger t1_bi before insert on t1 for each row set @a:=1; connection default; --reap +connection default; select @a; select * from t1; drop table t1; -set session debug_dbug="-d,sleep_create_select_before_check_if_exists"; - - -# Test for some details of CREATE TABLE ... SELECT implementation. -# -# We check that create placeholder is handled properly if we have -# to reopen tables in open_tables(). -# This test heavily relies on current implementation of name-locking/ -# table cache so it may stop working if it changes. OTOH it such problem -# will serve as warning that such changes should not be done lightly. -create table t2 (a int); -create table t4 (b int); -connection addconroot2; -lock table t4 write; -select 1; -connection addconroot1; -# Create placeholder/name-lock for t3 ---send create table t3 as select * from t4; ---sleep 2 -connection default; -# This statement creates placeholder for t1, then opens t2, -# then meets name-lock for t3 and then reopens all tables ---send create table t1 select * from t2, t3; ---sleep 2 -connection addconroot2; -unlock tables; -connection addconroot1; ---reap -connection default; ---reap -select * from t1; -show create table t1; -drop table t1, t3; -# Now similar test which proves that we really temporarily -# remove placeholder when we reopen tables. -connection addconroot2; -lock table t4 read; -select 1; -connection addconroot1; -# Create name-lock for t3 ---send rename table t4 to t3; ---sleep 2 -connection default; -# This statement creates placeholder for t1, then opens t2, -# then meets name-lock for t3 and then reopens all tables ---send create table if not exists t1 select 1 as i from t2, t3; ---sleep 2 -connection addconroot3; -# We should be able to take name-lock on table t1 as we should not have -# open placeholder for it at this point (otherwise it is possible to -# come-up with situation which will lead to deadlock, e.g. think of -# concurrent CREATE TABLE t1 SELECT * FROM t2 and RENAME TABLE t2 TO t1) -create table t5 (j int); -# This statement takes name-lock on t1 and therefore proves -# that there is no active open placeholder for it. -rename table t5 to t1; -connection addconroot2; -unlock tables; -connection addconroot1; ---reap -connection default; ---reap -select * from t1; -show create table t1; -drop table t1, t2, t3; - # Tests for possible concurrency issues with CREATE TABLE ... LIKE # @@ -286,103 +422,101 @@ drop table t1, t2, t3; --disable_warnings drop table if exists t1,t2; --enable_warnings +set debug_sync='RESET'; # What happens if some statements sneak in right after we have -# opened source table ? +# acquired locks and opened source table ? create table t1 (i int); -set session debug_dbug="+d,sleep_create_like_before_check_if_exists"; +set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go'; # Reset binlog to have clear start reset master; --send create table t2 like t1; connection addconroot1; ---sleep 2 +set debug_sync='now WAIT_FOR parked'; # DML on source table should be allowed to run concurrently insert into t1 values (1); # And DDL should wait -drop table t1; +--send drop table t1; +connection addconroot2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap +connection addconroot1; +--reap +connection default; show create table t2; drop table t2; # Let us check that statements were executed/binlogged in correct order source include/show_binlog_events.inc; -# Now let us check the gap between check for target table -# existance and copying of .frm file. +# Now check the gap between table creation and binlogging create table t1 (i int); -set session debug_dbug="-d,sleep_create_like_before_check_if_exists:+d,sleep_create_like_before_copy"; -# It should be impossible to create target table concurrently ---send create table t2 like t1; -connection addconroot1; ---sleep 2 -create table if not exists t2 (j int); -connection default; ---reap -show create table t2; -drop table t2; -# And concurrent DDL on the source table should be still disallowed +set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go'; reset master; --send create table t2 like t1; connection addconroot1; ---sleep 2 -drop table t1; +set debug_sync='now WAIT_FOR parked'; +--send insert into t2 values (1); +connection addconroot2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "insert into t2 values (1)"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap -drop table t2; -source include/show_binlog_events.inc; -# And now he gap between copying of .frm file and ha_create_table() call. -create table t1 (i int); -set session debug_dbug="-d,sleep_create_like_before_copy:+d,sleep_create_like_before_ha_create"; -# Both DML and DDL on target table should wait till operation completes -reset master; ---send create table t2 like t1; connection addconroot1; ---sleep 2 -insert into t2 values (1); -connection default; --reap +connection default; drop table t2; +set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go'; --send create table t2 like t1; connection addconroot1; ---sleep 2 -drop table t2; +set debug_sync='now WAIT_FOR parked'; +--send drop table t2; +connection addconroot2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t2"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap -# Concurrent DDL on the source table still waits ---send create table t2 like t1; connection addconroot1; ---sleep 2 -drop table t1; -connection default; --reap -drop table t2; -source include/show_binlog_events.inc; - -# Finally we check the gap between ha_create_table() and binlogging -create table t1 (i int); -set session debug_dbug="-d,sleep_create_like_before_ha_create:+d,sleep_create_like_before_binlogging"; -reset master; ---send create table t2 like t1; -connection addconroot1; ---sleep 2 -insert into t2 values (1); connection default; ---reap -drop table t2; +set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go'; --send create table t2 like t1; connection addconroot1; ---sleep 2 -drop table t2; +set debug_sync='now WAIT_FOR parked'; +--send drop table t1; +connection addconroot2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "drop table t1"; +--source include/wait_condition.inc +set debug_sync='now SIGNAL go'; connection default; --reap ---send create table t2 like t1; connection addconroot1; ---sleep 2 -drop table t1; -connection default; --reap +connection default; drop table t2; -source include/show_binlog_events.inc; +disconnect addconroot1; +disconnect addconroot2; +disconnect addconroot3; -set session debug_dbug="-d,sleep_create_like_before_binlogging"; +set debug_sync='RESET'; +source include/show_binlog_events.inc; +# Check that all connections opened by test cases in this file are really +# gone so execution of other tests won't be affected by their presence. +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index d47dc335d5b..847e302e615 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -764,6 +764,20 @@ DROP TABLE t1; SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)); + +--echo # +--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT +--echo # + +SET NAMES utf8, @@character_set_connection=utf16; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 +GROUP BY id +ORDER BY l DESC; + + # ## TODO: add tests for all engines # diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 945646087aa..5fc01e4467e 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -843,5 +843,18 @@ SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; DROP TABLE t1; --echo # +--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT +--echo # + +SET NAMES utf8, @@character_set_connection=utf32; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 +GROUP BY id +ORDER BY l DESC; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 2c7b27c63bb..b123902f605 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1571,5 +1571,17 @@ SET NAMES utf8; EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ'; --echo # +--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT +--echo # + +SET NAMES utf8; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 +GROUP BY id +ORDER BY l DESC; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index ce9f57b130f..37b4626e6db 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -14,8 +14,6 @@ events_time_zone : Test is not predictable as it depends on precise timi lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested -alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested -create-big : Bug#11748731 2010-11-15 mattiasj was not tested archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836 diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test index f32b4f6f08b..4adf81a1aed 100644 --- a/mysql-test/t/file_contents.test +++ b/mysql-test/t/file_contents.test @@ -15,9 +15,9 @@ if ($dir_bin eq '/usr/') { # RPM package $dir_docs = $dir_bin; $dir_docs =~ s|/lib|/share/doc|; - if(-d "$dir_docs/packages/MySQL-server") { - # SuSE - $dir_docs = "$dir_docs/packages/MySQL-server"; + if(-d "$dir_docs/packages") { + # SuSE: "packages/" in the documentation path + $dir_docs = glob "$dir_docs/packages/MySQL-server*"; } else { # RedHat: version number in directory name $dir_docs = glob "$dir_docs/MySQL-server*"; @@ -25,9 +25,9 @@ if ($dir_bin eq '/usr/') { } elsif ($dir_bin eq '/usr') { # RPM build during development $dir_docs = "$dir_bin/share/doc"; - if(-d "$dir_docs/packages/MySQL-server") { - # SuSE - $dir_docs = "$dir_docs/packages/MySQL-server"; + if(-d "$dir_docs/packages") { + # SuSE: "packages/" in the documentation path + $dir_docs = glob "$dir_docs/packages/MySQL-server*"; } else { # RedHat: version number in directory name $dir_docs = glob "$dir_docs/MySQL-server*"; diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index a67bb088faa..5414adddd43 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -181,3 +181,15 @@ INSERT INTO t1 VALUES (NULL, 0), (NULL, 1); SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c; DROP TABLE t1; + +--echo # +--echo # Bug#12532830 +--echo # SIGFPE OR ASSERTION (PRECISION <= ((9 * 9) - 8*2)) && (DEC <= 30) +--echo # + +let $nines= 9999999999999999999999999999999999999; +eval select +sum(distinct(if('a', + (select adddate(elt(convert($nines,decimal(64,0)),count(*)), + interval 1 day)) + , .1))) as foo; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 8d01b84e359..208b18b3f85 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1441,6 +1441,11 @@ SELECT * FROM t1; DROP TABLE t1; --echo # +--echo # Bug#11764310 conv function crashes, negative argument to memcpy +--echo # +SELECT CONV(1,-2147483648,-2147483648); + +--echo # --echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY --echo # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index f1e85ac0e40..a559b16b1f0 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1313,5 +1313,17 @@ FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) DROP TABLE g1; +--echo # +--echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); + +INSERT INTO g1 VALUES ('a'),('a'); +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; + +DROP TABLE g1; + --echo End of 5.5 tests diff --git a/mysql-test/t/group_min_max_innodb.test b/mysql-test/t/group_min_max_innodb.test index 643b4f7d55e..7038eb2ff47 100644 --- a/mysql-test/t/group_min_max_innodb.test +++ b/mysql-test/t/group_min_max_innodb.test @@ -117,3 +117,23 @@ drop view v1; drop table t1; --echo End of 5.1 tests + +--echo # +--echo # Bug#12540545 61101: ASSERTION FAILURE IN THREAD 1256741184 IN +--echo # FILE /BUILDDIR/BUILD/BUILD/MYSQ +--echo # + +CREATE TABLE t1 (a CHAR(1), b CHAR(1), PRIMARY KEY (a,b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd'); +EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; +SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; +DROP TABLE t1; + +CREATE TABLE t1 (a CHAR(1) NOT NULL, b CHAR(1) NOT NULL, UNIQUE KEY (a,b)) +ENGINE=InnoDB; +INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd'); +EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; +SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; +DROP TABLE t1; + +--echo End of 5.5 tests diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test index 376829b9baf..9104be78952 100644 --- a/mysql-test/t/handler_read_last.test +++ b/mysql-test/t/handler_read_last.test @@ -1,18 +1,3 @@ -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test index b6bac5f65fa..e96d02fe0d1 100644 --- a/mysql-test/t/init_connect.test +++ b/mysql-test/t/init_connect.test @@ -36,6 +36,14 @@ connection con0; set GLOBAL init_connect="adsfsdfsdfs"; connect (con5,localhost,user_1,,); connection con5; +# BUG#11755281/47032: ERROR 2006 / ERROR 2013 INSTEAD OF PROPER ERROR MESSAGE +# We now throw a proper error message here: +--replace_regex /connection .* to/connection to/ +--error ER_NEW_ABORTING_CONNECTION +select @a; +# We got disconnected after receiving the above error message; any further +# requests should fail with a notice that no one's listening to us. +# --error CR_SERVER_GONE_ERROR,CR_SERVER_LOST --error 2013,2006 select @a; connection con0; diff --git a/mysql-test/t/ipv4_as_ipv6.test b/mysql-test/t/ipv4_as_ipv6.test index ace3c286643..1fbc0317a36 100644 --- a/mysql-test/t/ipv4_as_ipv6.test +++ b/mysql-test/t/ipv4_as_ipv6.test @@ -1,7 +1,3 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 # Test of ipv4 (127.0.0.1) in ipv6 format # Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file). # diff --git a/mysql-test/t/ipv6.test b/mysql-test/t/ipv6.test index 5c08cde3746..24ab09b7083 100644 --- a/mysql-test/t/ipv6.test +++ b/mysql-test/t/ipv6.test @@ -1,7 +1,3 @@ -# Copyright (C) 2009 SUN Microsystems -# All rights reserved. Use is subject to license terms. -# Author: Horst Hunger -# Nov. 19, 2009 # Test of ipv6 format # Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file). # diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test index b7fbe377e31..c5968df85f8 100644 --- a/mysql-test/t/mysql_plugin.test +++ b/mysql-test/t/mysql_plugin.test @@ -105,7 +105,7 @@ let $MYSQL_PLUGIN_CMD= $MYSQL_PLUGIN --datadir=$MYSQLD_DATADIR --basedir=$MYSQLD --echo # --echo # Ensure the plugin isn't loaded. --echo # -SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; +SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name; --echo # --echo # Enable the plugin... @@ -139,10 +139,21 @@ EOF --source include/wait_until_connected_again.inc --echo # +--echo # Simulate loading a plugin libary with multiple entry points. +--echo # This will test the DISABLE to ensure all rows are removed. +--echo # +--replace_regex /\.dll/.so/ +eval INSERT INTO mysql.plugin VALUES ('wicky', '$DAEMONEXAMPLE'); +--replace_regex /\.dll/.so/ +eval INSERT INTO mysql.plugin VALUES ('wacky', '$DAEMONEXAMPLE'); +--replace_regex /\.dll/.so/ +eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE'); + +--echo # --echo # Ensure the plugin is now loaded. --echo # --replace_regex /\.dll/.so/ -SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; +SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name; --echo # --echo # Disable the plugin... @@ -173,7 +184,7 @@ EOF --echo # --echo # Ensure the plugin isn't loaded. --echo # -SELECT * FROM mysql.plugin WHERE name = 'daemon_example' ORDER BY name; +SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name; # # Stop the server for error conditions diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 4c188ff3147..f200bce551f 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -105,3 +105,22 @@ DROP USER 'user3'@'%'; --replace_result $MYSQLTEST_VARDIR var --exec $MYSQL_UPGRADE --force --upgrade-system-tables +--echo # +--echo # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION +--echo # SKIP-WRITE-BINLOG +--echo # + +let $MYSQLD_DATADIR= `select @@datadir`; + +--echo # Droping the previously created mysql_upgrade_info file.. +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info + +--echo # Running mysql_upgrade with --skip-write-binlog.. +--replace_result $MYSQLTEST_VARDIR var +--exec $MYSQL_UPGRADE --skip-write-binlog + +# mysql_upgrade must have created mysql_upgrade_info file, +# so the following command should never fail. +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info + +--echo End of tests diff --git a/mysql-test/t/mysqld--help-notwin.test b/mysql-test/t/mysqld--help-notwin.test index e3d1ca97128..7cc490c0615 100644 --- a/mysql-test/t/mysqld--help-notwin.test +++ b/mysql-test/t/mysqld--help-notwin.test @@ -1,18 +1,3 @@ -# Copyright (C) 2009-2010 Sun Microsystems, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # mysqld --help # diff --git a/mysql-test/t/mysqld--help-win.test b/mysql-test/t/mysqld--help-win.test index 56cfec8999b..fca329bfbe6 100644 --- a/mysql-test/t/mysqld--help-win.test +++ b/mysql-test/t/mysqld--help-win.test @@ -1,18 +1,3 @@ -# Copyright (C) 2009-2010 Sun Microsystems, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # mysqld --help # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 2170b9aa38b..302d79b6b13 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2226,5 +2226,43 @@ CREATE TABLE t1 (a INT); --exec $MYSQL_DUMP --compatible=no_t,no_f --skip-comments test DROP TABLE t1; +--echo # +--echo # Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION --FLUSH-LOG BREAKS +--echo # CONSISTENCY +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS b12809202_db; +--enable_warnings + +CREATE DATABASE b12809202_db; +CREATE TABLE b12809202_db.t1 (c1 INT); +CREATE TABLE b12809202_db.t2 (c1 INT); + +INSERT INTO b12809202_db.t1 VALUES (1), (2), (3); +INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); + +--echo # Starting mysqldump with --single-transaction & --flush-log options.. +--echo # Note : In the following dump the transaction +--echo # should start only after the logs are +--echo # flushed, as 'flush logs' causes implicit +--echo # commit starting 5.5. +--echo +--echo #### Dump starts here #### +--replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/ +--exec $MYSQL_DUMP --verbose --single-transaction --flush-log b12809202_db 2>&1 +--echo +--echo #### Dump ends here #### + +# Cleanup +DROP TABLE b12809202_db.t1; +DROP TABLE b12809202_db.t2; +DROP DATABASE b12809202_db; + +--echo # +--echo # Delete all existing binary logs. +--echo # +RESET MASTER; + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index ab55fd30bf5..a7585bea4f8 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1753,6 +1753,12 @@ let $long_rep= $long_rep,$long_rep; --replace_result $long_rep LONG_STRING eval select "$long_rep" as x; +# Test replace within `` + +--replace_result cat dog +--let $animal= `select "cat" as pet` +--echo $animal + # ---------------------------------------------------------------------------- # Test sync_with_master # ---------------------------------------------------------------------------- @@ -2075,6 +2081,48 @@ insert into t1 values (2,4); select * from t1; drop table t1; +# Test usage with `` + +--replace_regex /x/y/ +--let $result= `select "x" as col` +--echo $result + +# Test usage with a variable as pattern list + +--disable_query_log +--let $patt= /a /b / /less/more/ +--replace_regex $patt +select "a is a and less is more" as txt; +--let $patt= +--replace_regex $patt +select "a is a and less is more" as txt; +--enable_query_log + +#------------------------------------------------------------------------- +# BUG #11754855 : Passing variable to --error +#------------------------------------------------------------------------- +create table t2 ( a char(10)); +let $errno1=0; +let $errno2=ER_PARSE_ERROR; +let $errno3=ER_NO_SUCH_TABLE; +--error $errno2 +garbage; + +--error $errno2,$errno3 +garbage; + +--error $errno2,ER_NO_SUCH_TABLE +garbage; + +--error ER_NO_SUCH_TABLE,$errno2 +insert into t1 values ("Abcd"); + +--error $errno1,ER_PARSE_ERROR +garbage; + +drop table t2; + + # ---------------------------------------------------------------------------- # Tests of send # ---------------------------------------------------------------------------- diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index 9da22d55ef7..4693288a4dd 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -6,8 +6,8 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # --echo # Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB, --echo # PARTITONING, ON INDEX CREATE +--echo # Bug#12696518: MEMORY LEAKS IN HA_PARTITION (VALGRIND TESTS ON TRUNK) --echo # -call mtr.add_suppression("contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MySQL"); CREATE TABLE t1 ( id bigint NOT NULL AUTO_INCREMENT, time date, @@ -26,6 +26,7 @@ INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1); CREATE UNIQUE INDEX uk_time_id2 on t1(time,id2); SELECT COUNT(*) FROM t1; +SHOW CREATE TABLE t1; DROP TABLE t1; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index e87e57702ac..c8371ea31f1 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -1205,48 +1205,55 @@ set global query_cache_size=0; set global query_cache_type=0; show status like 'Qcache_free_blocks'; +--error ER_QUERY_CACHE_DISABLED +set global query_cache_size=102400; +set global query_cache_type=on; +set session query_cache_type=on; + --echo Restore default values. -# Bug#28211 RENAME DATABASE and query cache don't play nicely together -# -# TODO: enable these tests when RENAME DATABASE is implemented. -# --disable_warnings -# drop database if exists db1; -# drop database if exists db2; -# --enable_warnings -# set GLOBAL query_cache_size=15*1024*1024; -# create database db1; -# use db1; -# create table t1(c1 int)engine=myisam; -# insert into t1(c1) values (1); -# select * from db1.t1 f; -# show status like 'Qcache_queries_in_cache'; -# rename schema db1 to db2; -# show status like 'Qcache_queries_in_cache'; -# drop database db2; -# set global query_cache_size=default; -# -# --disable_warnings -# drop database if exists db1; -# drop database if exists db3; -# --enable_warnings -# set GLOBAL query_cache_size=15*1024*1024; -# create database db1; -# create database db3; -# use db1; -# create table t1(c1 int) engine=myisam; -# use db3; -# create table t1(c1 int) engine=myisam; -# use db1; -# insert into t1(c1) values (1); -# use mysql; -# select * from db1.t1; -# select c1+1 from db1.t1; -# select * from db3.t1; -# show status like 'Qcache_queries_in_cache'; -# rename schema db1 to db2; -# show status like 'Qcache_queries_in_cache'; -# drop database db2; -# drop database db3; + --disable_warnings + drop database if exists db1; + drop database if exists db2; + --enable_warnings + set GLOBAL query_cache_size=15*1024*1024; + create database db1; + use db1; + create table t1(c1 int)engine=myisam; + insert into t1(c1) values (1); + select * from db1.t1 f; + show status like 'Qcache_queries_in_cache'; + + create database db2; + rename table db1.t1 to db2.t2; + drop database db1; + show status like 'Qcache_queries_in_cache'; + drop database db2; + set global query_cache_size=default; + + --disable_warnings + drop database if exists db1; + drop database if exists db3; + --enable_warnings + set GLOBAL query_cache_size=15*1024*1024; + create database db1; + create database db3; + use db1; + create table t1(c1 int) engine=myisam; + use db3; + create table t1(c1 int) engine=myisam; + use db1; + insert into t1(c1) values (1); + use test; + select * from db1.t1; + select c1+1 from db1.t1; + select * from db3.t1; + show status like 'Qcache_queries_in_cache'; + create database db2; + rename table db1.t1 to db2.t2; + drop database db1; + show status like 'Qcache_queries_in_cache'; + drop database db2; + drop database db3; set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 2a8913730ca..44fb3ba46f5 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4417,6 +4417,7 @@ DROP TABLE t1; --echo # End of test BUG#57203 +--echo # --echo # lp:822760 Wrong result with view + invalid dates --echo # CREATE TABLE t1 (f1 date); @@ -4430,4 +4431,19 @@ SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; DROP TABLE t1; DROP VIEW v1; +--echo # +--echo # Bug#63020: Function "format"'s 'locale' argument is not considered +--echo # when creating a "view' +--echo # + +CREATE TABLE t1 (f1 DECIMAL(10,2)); +INSERT INTO t1 VALUES (11.67),(17865.3),(12345678.92); +CREATE VIEW view_t1 AS SELECT FORMAT(f1,1,'sk_SK') AS f1 FROM t1; +SHOW CREATE VIEW view_t1; +SELECT * FROM view_t1; +DROP TABLE t1; +DROP VIEW view_t1; +--echo # End of test BUG#63020 + SET optimizer_switch=@save_optimizer_switch; + diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index e78724d16da..3a38b85f1ae 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1,21 +1,3 @@ -# Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2 of -# the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -# 02110-1301 USA -# - ################################################################################ # # NOTICE: diff --git a/mysql-test/t/signal.test b/mysql-test/t/signal.test index af0aa17f232..13a0db2029b 100644 --- a/mysql-test/t/signal.test +++ b/mysql-test/t/signal.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # Tests for SIGNAL and RESIGNAL --echo # diff --git a/mysql-test/t/signal_code.test b/mysql-test/t/signal_code.test index d2f65647c81..6922a447c6a 100644 --- a/mysql-test/t/signal_code.test +++ b/mysql-test/t/signal_code.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # Tests for SIGNAL and RESIGNAL -- source include/have_debug.inc diff --git a/mysql-test/t/signal_demo1.test b/mysql-test/t/signal_demo1.test index 5de847ba0ba..62020b8f3fd 100644 --- a/mysql-test/t/signal_demo1.test +++ b/mysql-test/t/signal_demo1.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # Demonstrate how SIGNAL can be used to enforce integrity constraints. # diff --git a/mysql-test/t/signal_demo2.test b/mysql-test/t/signal_demo2.test index fc909cb926c..30f5cef715c 100644 --- a/mysql-test/t/signal_demo2.test +++ b/mysql-test/t/signal_demo2.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # Demonstrate how RESIGNAL can be used to 'catch' and 're-throw' an error # diff --git a/mysql-test/t/signal_demo3.test b/mysql-test/t/signal_demo3.test index 347f1b75a79..a685111c3c1 100644 --- a/mysql-test/t/signal_demo3.test +++ b/mysql-test/t/signal_demo3.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # Demonstrate how RESIGNAL can be used to print a stack trace # diff --git a/mysql-test/t/signal_sqlmode.test b/mysql-test/t/signal_sqlmode.test index 860c145a361..2b311fd1ab1 100644 --- a/mysql-test/t/signal_sqlmode.test +++ b/mysql-test/t/signal_sqlmode.test @@ -1,18 +1,3 @@ -# Copyright (C) 2008 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # Tests for SIGNAL, RESIGNAL and GET DIAGNOSTICS SET @save_sql_mode=@@sql_mode; diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test index 6284169eb9b..a01c9e19908 100644 --- a/mysql-test/t/sp-lock.test +++ b/mysql-test/t/sp-lock.test @@ -1,18 +1,3 @@ -# Copyright (C) 2009 Sun Microsystems, Inc -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # # Metadata lock handling for stored procedures and # functions. diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index acbf75d9f01..09deb057ea0 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3336,28 +3336,20 @@ drop table t3| --disable_warnings drop procedure if exists bug6857| --enable_warnings -create procedure bug6857(counter int) +create procedure bug6857() begin declare t0, t1 int; declare plus bool default 0; - - set t0 = current_time(); - while counter > 0 do - set counter = counter - 1; - end while; - set t1 = current_time(); + set t0 = unix_timestamp(); + select sleep(1.1); + set t1 = unix_timestamp(); if t1 > t0 then set plus = 1; end if; select plus; end| -# QQ: This is currently disabled. Not only does it slow down a normal test -# run, it makes running with valgrind (or similar tools) extremely -# painful. -# Make sure this takes at least one second on all machines in all builds. -# 30000 makes it about 3 seconds on an old 1.1GHz linux. -#call bug6857(300000)| +call bug6857()| drop procedure bug6857| @@ -8764,11 +8756,117 @@ call p1(1, 0); call p1(1, 5); call p1(3, 2); +delimiter |; +--echo # Try to create a function that +--echo # refers to non-existing variables. +--error ER_SP_UNDECLARED_VAR +create function f1(p1 integer, p2 integer) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit a, b); + return a; +end| + +create function f1() + returns int +begin + declare a, b, c int; + set a = (select count(*) from t1 limit b, c); + return a; +end| + +delimiter ;| +--echo # How do we handle NULL limit values? +select f1(); + +drop function f1; + +delimiter |; +--echo # +--echo # Try to use data types not allowed in LIMIT +--echo # +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 date, p2 date) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 integer, p2 float) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 integer, p2 char(1)) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 varchar(5), p2 char(1)) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 decimal, p2 decimal) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--error ER_WRONG_SPVAR_TYPE_IN_LIMIT +create function f1(p1 double, p2 double) + returns int +begin + declare a int; + set a = (select count(*) from t1 limit p1, p2); + return a; +end| + +--echo # +--echo # Finally, test the valid case. +--echo # + +create function f1(p1 integer, p2 integer) +returns int +begin + declare count int; + set count= (select count(*) from (select * from t1 limit p1, p2) t_1); + return count; +end| + +delimiter ;| + +select f1(0, 0); +select f1(0, -1); +select f1(-1, 0); +select f1(-1, -1); +select f1(0, 1); +select f1(1, 0); +select f1(1, 5); +select f1(3, 2); --echo # Cleanup drop table t1; drop procedure p1; - +drop function f1; --echo # --echo # BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW) @@ -8890,4 +8988,52 @@ DROP TABLE t1; DROP PROCEDURE p1; --echo +--echo # +--echo # Bug#12621017 - Crash if a sp variable is used in the +--echo # limit clause of a set statement +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +--enable_warnings + +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 VALUES (1); + +delimiter |; + +CREATE PROCEDURE p1() +BEGIN + DECLARE foo, cnt INT UNSIGNED DEFAULT 1; + SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt); +END| + +CREATE PROCEDURE p2() +BEGIN + +DECLARE iLimit INT; +DECLARE iVal INT; + +DECLARE cur1 CURSOR FOR + SELECT c1 FROM t1 + LIMIT iLimit; + +SET iLimit=1; + +OPEN cur1; +FETCH cur1 INTO iVal; + +END| + +delimiter ;| + +CALL p1(); +CALL p2(); + +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; + --echo # End of 5.5 test diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 1b9c2c0a25e..663501a0a88 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -165,6 +165,12 @@ explain select c from mysqltest.v4; show create view mysqltest.v4; --error ER_TABLEACCESS_DENIED_ERROR explain select c from mysqltest.v5; +# new in 5.5: SHOW CREATE VIEW needs SELECT now (MySQL Bug#27145) +--error ER_TABLEACCESS_DENIED_ERROR +show create view mysqltest.v5; +connection root; +grant select on mysqltest.v5 to mysqltest_1@localhost; +connection user1; show create view mysqltest.v5; # missing SELECT on underlying t1, no SHOW VIEW on v1 either. @@ -177,6 +183,7 @@ show create view mysqltest.v1; connection root; grant show view on mysqltest.v1 to mysqltest_1@localhost; grant select on mysqltest.t1 to mysqltest_1@localhost; +revoke select on mysqltest.v5 from mysqltest_1@localhost; connection user1; # EXPLAIN works explain select c from mysqltest.v1; @@ -198,8 +205,6 @@ show create view mysqltest.v4; # we have SHOW VIEW on v5, and SELECT on t1 -- not enough --error ER_TABLEACCESS_DENIED_ERROR explain select c from mysqltest.v5; -# we can SHOW CREATE VIEW though -show create view mysqltest.v5; # allow to see any view in mysqltest database connection root; |