diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-06-07 12:47:04 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-06-07 12:47:04 +0400 |
commit | 8a247e963dcaa12b70e9aae0c9f3cb831d30f4a7 (patch) | |
tree | 4268070936d3c9dbd27165b1d9c1593e17ec0d61 /mysql-test | |
parent | e4ab99764249f90a83c7f384eadc913331c59aee (diff) | |
parent | 75dce25ca8276f56c45f747c9a9a1b4046b6efca (diff) | |
download | mariadb-git-8a247e963dcaa12b70e9aae0c9f3cb831d30f4a7.tar.gz |
Manual merge from mysql-trunk-bugfixing.
Conflicts:
- BUILD/SETUP.sh
- mysql-test/mysql-test-run.pl
- mysql-test/r/partition_error.result
- mysql-test/t/disabled.def
- mysql-test/t/partition_error.test
- sql/share/errmsg-utf8.txt
Diffstat (limited to 'mysql-test')
187 files changed, 7916 insertions, 1020 deletions
diff --git a/mysql-test/include/check_concurrent_insert.inc b/mysql-test/include/check_concurrent_insert.inc new file mode 100644 index 00000000000..6a9ada65562 --- /dev/null +++ b/mysql-test/include/check_concurrent_insert.inc @@ -0,0 +1,96 @@ +# +# SUMMARY +# Check if statement reading table '$table' allows concurrent +# inserts in it. +# +# PARAMETERS +# $table Table in which concurrent inserts should be allowed. +# $con_aux1 Name of the first auxiliary connection to be used by this +# script. +# $con_aux2 Name of the second auxiliary connection to be used by this +# script. +# $statement Statement to be checked. +# $restore_table Table which might be modified affected by statement to be +# checked and thus needs backing up before its execution +# and restoring after it (can be empty). +# +# EXAMPLE +# lock_sync.test +# +--disable_result_log +--disable_query_log + +# Reset DEBUG_SYNC facility for safety. +set debug_sync= "RESET"; + +if (`SELECT '$restore_table' <> ''`) +{ +--eval create table t_backup select * from $restore_table; +} + +connection $con_aux1; +set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go'; +--send_eval $statement; + +connection $con_aux2; +set debug_sync='now WAIT_FOR parked'; +--send_eval insert into $table values (0); + +--enable_result_log +--enable_query_log +connection default; +# Wait until concurrent insert is successfully executed while +# statement being checked has its tables locked. +# We use wait_condition.inc instead of simply executing +# concurrent insert here in order to avoid deadlocks if test +# fails and timing out instead. +let $wait_condition= + select count(*) = 0 from information_schema.processlist + where info = "insert into $table values (0)"; +--source include/wait_condition.inc + +--disable_result_log +--disable_query_log + +if ($success) +{ +# Apparently concurrent insert was successfully executed. +# To be safe against wait_condition.inc succeeding due to +# races let us first reap concurrent insert to ensure that +# it has really been successfully executed. +connection $con_aux2; +--reap +connection default; +set debug_sync= 'now SIGNAL go'; +connection $con_aux1; +--reap +connection default; +--echo Success: '$statement' allows concurrent inserts into '$table'. +} +if (!$success) +{ +# Waiting has timed out. Apparently concurrent insert was blocked. +# So to be able to continue we need to end our statement first. +set debug_sync= 'now SIGNAL go'; +connection $con_aux1; +--reap +connection $con_aux2; +--reap +connection default; +--echo Error: '$statement' doesn't allow concurrent inserts into '$table'! +} + +--eval delete from $table where i = 0; + +if (`SELECT '$restore_table' <> ''`) +{ +--eval truncate table $restore_table; +--eval insert into $restore_table select * from t_backup; +drop table t_backup; +} + +# Clean-up. Reset DEBUG_SYNC facility after use. +set debug_sync= "RESET"; + +--enable_result_log +--enable_query_log diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc new file mode 100644 index 00000000000..278ffeffb1e --- /dev/null +++ b/mysql-test/include/check_no_concurrent_insert.inc @@ -0,0 +1,81 @@ +# +# SUMMARY +# Check that statement reading table '$table' doesn't allow concurrent +# inserts in it. +# +# PARAMETERS +# $table Table in which concurrent inserts should be disallowed. +# $con_aux1 Name of the first auxiliary connection to be used by this +# script. +# $con_aux2 Name of the second auxiliary connection to be used by this +# script. +# $statement Statement to be checked. +# $restore_table Table which might be modified affected by statement to be +# checked and thus needs backing up before its execution +# and restoring after it (can be empty). +# +# EXAMPLE +# lock_sync.test +# +--disable_result_log +--disable_query_log + +# Reset DEBUG_SYNC facility for safety. +set debug_sync= "RESET"; + +if (`SELECT '$restore_table' <> ''`) +{ +--eval create table t_backup select * from $restore_table; +} + +connection $con_aux1; +set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go'; +--send_eval $statement; + +connection $con_aux2; +set debug_sync='now WAIT_FOR parked'; +--send_eval insert into $table values (0); + +--enable_result_log +--enable_query_log +connection default; +# Wait until concurrent insert is successfully blocked because +# of our statement. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Table lock" and info = "insert into $table values (0)"; +--source include/wait_condition.inc + +--disable_result_log +--disable_query_log + +set debug_sync= 'now SIGNAL go'; +connection $con_aux1; +--reap +connection $con_aux2; +--reap +connection default; + +if ($success) +{ +--echo Success: '$statement' doesn't allow concurrent inserts into '$table'. +} +if (!$success) +{ +--echo Error: '$statement' allows concurrent inserts into '$table'! +} + +--eval delete from $table where i = 0; + +if (`SELECT '$restore_table' <> ''`) +{ +--eval truncate table $restore_table; +--eval insert into $restore_table select * from t_backup; +drop table t_backup; +} + +# Clean-up. Reset DEBUG_SYNC facility after use. +set debug_sync= "RESET"; + +--enable_result_log +--enable_query_log diff --git a/mysql-test/include/check_no_row_lock.inc b/mysql-test/include/check_no_row_lock.inc new file mode 100644 index 00000000000..958161b9b7f --- /dev/null +++ b/mysql-test/include/check_no_row_lock.inc @@ -0,0 +1,71 @@ +# +# SUMMARY +# Check if statement affecting or reading table '$table' doesn't +# take any kind of locks on its rows. +# +# PARAMETERS +# $table Table for which presence of row locks should be checked. +# $con_aux Name of auxiliary connection to be used by this script. +# $statement Statement to be checked. +# +# EXAMPLE +# innodb_mysql_lock2.test +# +--disable_result_log +--disable_query_log + +connection default; +begin; +--eval select * from $table for update; + +connection $con_aux; +begin; +--send_eval $statement; + +--enable_result_log +--enable_query_log + +connection default; +# Wait until statement is successfully executed while +# all rows in table are X-locked. This means that it +# does not acquire any row locks. +# We use wait_condition.inc instead of simply executing +# statement here in order to avoid deadlocks if test +# fails and timing out instead. +let $wait_condition= + select count(*) = 0 from information_schema.processlist + where info = "$statement"; +--source include/wait_condition.inc + +--disable_result_log +--disable_query_log + +if ($success) +{ +# Apparently statement was successfully executed and thus it +# has not required any row locks. +# To be safe against wait_condition.inc succeeding due to +# races let us first reap the statement being checked to +# ensure that it has been successfully executed. +connection $con_aux; +--reap +rollback; +connection default; +rollback; +--echo Success: '$statement' doesn't take row locks on '$table'. +} +if (!$success) +{ +# Waiting has timed out. Apparently statement was blocked on +# some row lock. So to be able to continue we need to unlock +# rows first. +rollback; +connection $con_aux; +--reap +rollback; +connection default; +--echo Error: '$statement' takes some row locks on '$table'! +} + +--enable_result_log +--enable_query_log diff --git a/mysql-test/include/check_shared_row_lock.inc b/mysql-test/include/check_shared_row_lock.inc new file mode 100644 index 00000000000..efc7e13b3aa --- /dev/null +++ b/mysql-test/include/check_shared_row_lock.inc @@ -0,0 +1,61 @@ +# +# SUMMARY +# Check if statement reading table '$table' takes shared locks +# on some of its rows. +# +# PARAMETERS +# $table Table for which presence of row locks should be checked. +# $con_aux Name of auxiliary connection to be used by this script. +# $statement Statement to be checked. +# $wait_statement Sub-statement which is supposed to acquire locks (should +# be the same as $statement for ordinary statements). +# +# EXAMPLE +# innodb_mysql_lock2.test +# +--disable_result_log +--disable_query_log + +connection default; +begin; +--eval select * from $table for update; + +connection $con_aux; +begin; +--send_eval $statement; + +--enable_result_log +--enable_query_log + +connection default; +# Wait until statement is successfully blocked because +# all rows in table are X-locked. This means that at +# least it acquires S-locks on some of rows. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state in ("Sending data","statistics", "preparing") and + info = "$wait_statement"; +--source include/wait_condition.inc + +--disable_result_log +--disable_query_log + +rollback; + +connection $con_aux; +--reap +rollback; + +connection default; +--enable_result_log +--enable_query_log + +if ($success) +{ +--echo Success: '$statement' takes shared row locks on '$table'. +} + +if (!$success) +{ +--echo Error: '$statement' hasn't taken shared row locks on '$table'! +} diff --git a/mysql-test/include/innodb-index.inc b/mysql-test/include/innodb-index.inc new file mode 100644 index 00000000000..37de3162abe --- /dev/null +++ b/mysql-test/include/innodb-index.inc @@ -0,0 +1,26 @@ +--eval create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=$charset +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +--error ER_DUP_ENTRY +alter table t1 add unique index (b); +insert into t1 values(8,9,'fff','fff'); +select * from t1; +show create table t1; +alter table t1 add index (b); +insert into t1 values(10,10,'kkk','iii'); +select * from t1; +select * from t1 force index(b) order by b; +explain select * from t1 force index(b) order by b; +show create table t1; +alter table t1 add unique index (c), add index (d); +insert into t1 values(11,11,'aaa','mmm'); +select * from t1; +select * from t1 force index(b) order by b; +select * from t1 force index(c) order by c; +select * from t1 force index(d) order by d; +explain select * from t1 force index(b) order by b; +explain select * from t1 force index(c) order by c; +explain select * from t1 force index(d) order by d; +show create table t1; +check table t1; +drop table t1; diff --git a/mysql-test/include/not_var_link.inc b/mysql-test/include/not_var_link.inc index 96db4f1dfd5..e1eb1dff2d7 100644 --- a/mysql-test/include/not_var_link.inc +++ b/mysql-test/include/not_var_link.inc @@ -1,6 +1,11 @@ +# Test if MYSQLTEST_VARDIR is a soft link +# If we run in parallel, we have a suffix "/$child_num", so chop off that. + perl; + my $path= $ENV{'MYSQLTEST_VARDIR'}; + $path=~ s|/\d+$||; open (ISLINK, ">" . $ENV{'MYSQL_TMP_DIR'} . "/mtr_var_link"); - my $mvr= -l $ENV{'MYSQLTEST_VARDIR'} ? 1 : 0; + my $mvr= -l $path ? 1 : 0; print ISLINK "let \$mtr_var_link= $mvr;\n"; close ISLINK; EOF diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 83c07eaa5f1..fa2db663e1e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2114,7 +2114,7 @@ sub environment_setup { # mysqlhotcopy # ---------------------------------------------------- my $mysqlhotcopy= - mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy"); + mtr_pl_maybe_exists("$bindir/scripts/mysqlhotcopy"); # Since mysqltest interprets the real path as "false" in an if, # use 1 ("true") to indicate "not exists" so it can be tested for $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1; diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 581ce66a3d4..90dde034e10 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1366,3 +1366,7 @@ ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used le CREATE INDEX i2 ON t1 (a(20)); ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys DROP TABLE t1; +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (1), (2); +ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2); +DROP TABLE t1; diff --git a/mysql-test/r/bug39022.result b/mysql-test/r/bug39022.result index 5963709aa2a..75899ed686b 100644 --- a/mysql-test/r/bug39022.result +++ b/mysql-test/r/bug39022.result @@ -12,7 +12,7 @@ INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10), START TRANSACTION; # in thread2 REPLACE INTO t2 VALUES (-17); -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; d # in thread1 REPLACE INTO t1(a,b) VALUES (67,20); @@ -21,10 +21,10 @@ COMMIT; START TRANSACTION; REPLACE INTO t1(a,b) VALUES (65,-50); REPLACE INTO t2 VALUES (-91); -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; # in thread1 # should not crash -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction # in thread2 d diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index eb1437414e7..e37f9d580ba 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1977,3 +1977,59 @@ CREATE TABLE t1 LIKE t2; ERROR 42S01: Table 't1' already exists DROP TABLE t2; DROP TABLE t1; +# +# Bug #48800 CREATE TABLE t...SELECT fails if t is a +# temporary table +# +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TABLE t1 (a INT); +CREATE TEMPORARY TABLE t2 (a INT); +CREATE VIEW t2 AS SELECT 1; +CREATE TABLE t3 (a INT); +CREATE TEMPORARY TABLE t3 SELECT 1; +CREATE TEMPORARY TABLE t4 (a INT); +CREATE TABLE t4 AS SELECT 1; +DROP TEMPORARY TABLE t1, t2, t3, t4; +DROP TABLE t1, t3, t4; +DROP VIEW t2; +# +# Bug #49193 CREATE TABLE reacts differently depending +# on whether data is selected or not +# +CREATE TEMPORARY TABLE t2 (ID INT); +INSERT INTO t2 VALUES (1),(2),(3); +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE IF NOT EXISTS t1 (ID INT); +INSERT INTO t1 SELECT * FROM t2; +SELECT * FROM t1; +ID +1 +2 +3 +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; +ID +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2; +SELECT * FROM t1; +ID +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; +ID +1 +2 +3 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE t1 SELECT * FROM t2; +SELECT * FROM t1; +ID +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; +ID +1 +2 +3 +DROP TABLE t1; +DROP TEMPORARY TABLE t2; diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 3c2fe316d71..c5fd7ef1439 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1034,5 +1034,48 @@ DROP TABLE t1; SET max_sort_length=DEFAULT; SET NAMES latin1; # +# Bug#52520 Difference in tinytext utf column metadata +# +CREATE TABLE t1 ( +s1 TINYTEXT CHARACTER SET utf16, +s2 TEXT CHARACTER SET utf16, +s3 MEDIUMTEXT CHARACTER SET utf16, +s4 LONGTEXT CHARACTER SET utf16 +); +SET NAMES utf8, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 54 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 54 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 54 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 54 +def HEX(s1) 253 6120 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 127 0 Y 16 0 8 +def test t1 t1 s2 s2 252 32767 0 Y 16 0 8 +def test t1 t1 s3 s3 252 8388607 0 Y 16 0 8 +def test t1 t1 s4 s4 252 2147483647 0 Y 16 0 8 +def HEX(s1) 253 2040 0 Y 0 0 8 +s1 s2 s3 s4 HEX(s1) +SET NAMES utf8; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 381 0 Y 16 0 33 +def test t1 t1 s2 s2 252 98301 0 Y 16 0 33 +def test t1 t1 s3 s3 252 25165821 0 Y 16 0 33 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 33 +def HEX(s1) 253 6120 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(s1)` varchar(255) CHARACTER SET utf16 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index f0f10be9743..9f395f87be7 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1048,5 +1048,48 @@ DROP TABLE t1; SET max_sort_length=DEFAULT; SET NAMES latin1; # +# Bug#52520 Difference in tinytext utf column metadata +# +CREATE TABLE t1 ( +s1 TINYTEXT CHARACTER SET utf32, +s2 TEXT CHARACTER SET utf32, +s3 MEDIUMTEXT CHARACTER SET utf32, +s4 LONGTEXT CHARACTER SET utf32 +); +SET NAMES utf8mb4, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 60 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 60 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 60 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 60 +def HEX(s1) 253 8160 0 Y 0 0 45 +s1 s2 s3 s4 HEX(s1) +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 63 0 Y 16 0 8 +def test t1 t1 s2 s2 252 16383 0 Y 16 0 8 +def test t1 t1 s3 s3 252 4194303 0 Y 16 0 8 +def test t1 t1 s4 s4 252 1073741823 0 Y 16 0 8 +def HEX(s1) 253 2040 0 Y 0 0 8 +s1 s2 s3 s4 HEX(s1) +SET NAMES utf8mb4; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 252 0 Y 16 0 45 +def test t1 t1 s2 s2 252 65532 0 Y 16 0 45 +def test t1 t1 s3 s3 252 16777212 0 Y 16 0 45 +def test t1 t1 s4 s4 252 4294967292 0 Y 16 0 45 +def HEX(s1) 253 8160 0 Y 0 0 45 +s1 s2 s3 s4 HEX(s1) +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(s1)` varchar(255) CHARACTER SET utf32 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 03040d1676c..a4e7c4ef53a 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -2041,3 +2041,52 @@ predicted_order hex(utf8_encoding) 101 E0B78AE2808DE0B6BB DROP TABLE t1; End of 5.4 tests +# +# Start of 5.5 tests +# +# +# Bug#52520 Difference in tinytext utf column metadata +# +CREATE TABLE t1 ( +s1 TINYTEXT CHARACTER SET utf8, +s2 TEXT CHARACTER SET utf8, +s3 MEDIUMTEXT CHARACTER SET utf8, +s4 LONGTEXT CHARACTER SET utf8 +); +SET NAMES utf8, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 33 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 33 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 33 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 33 +def HEX(s1) 253 4590 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 8 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 8 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 8 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 8 +def HEX(s1) 253 1530 0 Y 0 0 8 +s1 s2 s3 s4 HEX(s1) +SET NAMES utf8; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 765 0 Y 16 0 33 +def test t1 t1 s2 s2 252 196605 0 Y 16 0 33 +def test t1 t1 s3 s3 252 50331645 0 Y 16 0 33 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 33 +def HEX(s1) 253 4590 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(s1)` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index 4de7a192546..454c9d4bfbb 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -2471,6 +2471,49 @@ abc𐐀def 𐐀 DROP TABLE t1; # +# Bug#52520 Difference in tinytext utf column metadata +# +CREATE TABLE t1 ( +s1 TINYTEXT CHARACTER SET utf8mb4, +s2 TEXT CHARACTER SET utf8mb4, +s3 MEDIUMTEXT CHARACTER SET utf8mb4, +s4 LONGTEXT CHARACTER SET utf8mb4 +); +SET NAMES utf8mb4, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 45 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 45 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 45 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 45 +def HEX(s1) 253 8160 0 Y 0 0 45 +s1 s2 s3 s4 HEX(s1) +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 8 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 8 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 8 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 8 +def HEX(s1) 253 2040 0 Y 0 0 8 +s1 s2 s3 s4 HEX(s1) +SET NAMES utf8mb4; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 1020 0 Y 16 0 45 +def test t1 t1 s2 s2 252 262140 0 Y 16 0 45 +def test t1 t1 s3 s3 252 67108860 0 Y 16 0 45 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 45 +def HEX(s1) 253 8160 0 Y 0 0 45 +s1 s2 s3 s4 HEX(s1) +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(s1)` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# # End of 5.5 tests # # diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index a3a8fe0b147..3d247a242a3 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -120,3 +120,17 @@ SET sql_quote_show_create= _utf8 x'5452C39C45'; ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE' SET sql_quote_show_create=_latin1 x'5452DC45'; ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE' +# +# Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type +# +CREATE TABLE t1(c1 BINARY(10), c2 BINARY(10), c3 BINARY(10), +PRIMARY KEY(c1,c2,c3)); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +ERROR 23000: Duplicate entry 'abc-abc-abc' for key 'PRIMARY' +DROP TABLE t1; +CREATE TABLE t1 (f1 VARBINARY(19) PRIMARY KEY); +INSERT INTO t1 VALUES ('abc\0\0'); +INSERT INTO t1 VALUES ('abc\0\0'); +ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY' +DROP TABLE t1; diff --git a/mysql-test/r/information_schema_part.result b/mysql-test/r/information_schema_part.result index 11c57ceb2c2..b34183ebdee 100644 --- a/mysql-test/r/information_schema_part.result +++ b/mysql-test/r/information_schema_part.result @@ -37,9 +37,9 @@ partitions 3; select * from information_schema.partitions where table_schema="test" and table_name="t4"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME -def test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL -def test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL -def test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL +def test t4 p0 NULL 1 NULL KEY NULL `f1`,`f2` NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL +def test t4 p1 NULL 2 NULL KEY NULL `f1`,`f2` NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL +def test t4 p2 NULL 3 NULL KEY NULL `f1`,`f2` NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL drop table t1,t2,t3,t4; create table t1 (a int not null,b int not null,c int not null,primary key (a,b)) partition by range (a) @@ -67,10 +67,10 @@ def test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default def test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default t2 def test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t1 def test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t2 -def test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default t1 -def test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default t2 -def test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default t1 -def test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default t2 +def test t2 x1 x11 1 1 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1 +def test t2 x1 x12 1 2 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2 +def test t2 x2 x21 2 1 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1 +def test t2 x2 x22 2 2 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2 drop table t1,t2; create table t1 ( a int not null, diff --git a/mysql-test/r/innodb_bug38231.result b/mysql-test/r/innodb_bug38231.result deleted file mode 100644 index 2f909779755..00000000000 --- a/mysql-test/r/innodb_bug38231.result +++ /dev/null @@ -1,11 +0,0 @@ -SET storage_engine=InnoDB; -INSERT INTO bug38231 VALUES (1), (10), (300); -SET autocommit=0; -SELECT * FROM bug38231 FOR UPDATE; -a -1 -10 -300 -TRUNCATE TABLE bug38231; -COMMIT; -DROP TABLE bug38231; diff --git a/mysql-test/r/innodb_bug44571.result b/mysql-test/r/innodb_bug44571.result deleted file mode 100644 index 36374edcb3e..00000000000 --- a/mysql-test/r/innodb_bug44571.result +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; -ALTER TABLE bug44571 CHANGE foo bar INT; -ALTER TABLE bug44571 ADD INDEX bug44571b (foo); -ERROR 42000: Key column 'foo' doesn't exist in table -ALTER TABLE bug44571 ADD INDEX bug44571b (bar); -ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it -CREATE INDEX bug44571b ON bug44571 (bar); -ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it -DROP TABLE bug44571; diff --git a/mysql-test/r/innodb_mysql_lock.result b/mysql-test/r/innodb_mysql_lock.result index 375ae8aeb12..95adf712cb4 100644 --- a/mysql-test/r/innodb_mysql_lock.result +++ b/mysql-test/r/innodb_mysql_lock.result @@ -86,3 +86,33 @@ release_lock('bug42147_lock') UNLOCK TABLES; # Connection 1 DROP TABLE t1; +# +# Bug#53798 OPTIMIZE TABLE breaks repeatable read +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT) engine=innodb; +INSERT INTO t1 VALUES (1), (2), (3); +# Connection con1 +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SELECT * FROM t1; +a +1 +2 +3 +# Connection default +# This should block +# Sending: +OPTIMIZE TABLE t1; +# Connection con1 +SELECT * FROM t1; +a +1 +2 +3 +COMMIT; +# Connection default +# Reaping OPTIMIZE TABLE t1 +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status OK +DROP TABLE t1; diff --git a/mysql-test/r/innodb_mysql_lock2.result b/mysql-test/r/innodb_mysql_lock2.result new file mode 100644 index 00000000000..aed704e6b3e --- /dev/null +++ b/mysql-test/r/innodb_mysql_lock2.result @@ -0,0 +1,564 @@ +# +# Test how do we handle locking in various cases when +# we read data from InnoDB tables. +# +# In fact by performing this test we check two things: +# 1) That SQL-layer correctly determine type of thr_lock.c +# lock to be acquired/passed to InnoDB engine. +# 2) That InnoDB engine correctly interprets this lock +# type and takes necessary row locks or does not +# take them if they are not necessary. +# +# This test makes sense only in REPEATABLE-READ mode as +# in SERIALIZABLE mode all statements that read data take +# shared lock on them to enforce its semantics. +select @@session.tx_isolation; +@@session.tx_isolation +REPEATABLE-READ +# Prepare playground by creating tables, views, +# routines and triggers used in tests. +drop table if exists t0, t1, t2, t3, t4, t5; +drop view if exists v1, v2; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; +drop function if exists f2; +drop function if exists f3; +drop function if exists f4; +drop function if exists f5; +drop function if exists f6; +drop function if exists f7; +drop function if exists f8; +drop function if exists f9; +drop function if exists f10; +drop function if exists f11; +drop function if exists f12; +drop function if exists f13; +drop function if exists f14; +drop function if exists f15; +create table t1 (i int primary key) engine=innodb; +insert into t1 values (1), (2), (3), (4), (5); +create table t2 (j int primary key) engine=innodb; +insert into t2 values (1), (2), (3), (4), (5); +create table t3 (k int primary key) engine=innodb; +insert into t3 values (1), (2), (3); +create table t4 (l int primary key) engine=innodb; +insert into t4 values (1); +create table t5 (l int primary key) engine=innodb; +insert into t5 values (1); +create view v1 as select i from t1; +create view v2 as select j from t2 where j in (select i from t1); +create procedure p1(k int) insert into t2 values (k); +create function f1() returns int +begin +declare j int; +select i from t1 where i = 1 into j; +return j; +end| +create function f2() returns int +begin +declare k int; +select i from t1 where i = 1 into k; +insert into t2 values (k + 5); +return 0; +end| +create function f3() returns int +begin +return (select i from t1 where i = 3); +end| +create function f4() returns int +begin +if (select i from t1 where i = 3) then +return 1; +else +return 0; +end if; +end| +create function f5() returns int +begin +insert into t2 values ((select i from t1 where i = 1) + 5); +return 0; +end| +create function f6() returns int +begin +declare k int; +select i from v1 where i = 1 into k; +return k; +end| +create function f7() returns int +begin +declare k int; +select j from v2 where j = 1 into k; +return k; +end| +create function f8() returns int +begin +declare k int; +select i from v1 where i = 1 into k; +insert into t2 values (k+5); +return k; +end| +create function f9() returns int +begin +update v2 set j=j+10 where j=1; +return 1; +end| +create function f10() returns int +begin +return f1(); +end| +create function f11() returns int +begin +declare k int; +set k= f1(); +insert into t2 values (k+5); +return k; +end| +create function f12(p int) returns int +begin +insert into t2 values (p); +return p; +end| +create function f13(p int) returns int +begin +return p; +end| +create procedure p2(inout p int) +begin +select i from t1 where i = 1 into p; +end| +create function f14() returns int +begin +declare k int; +call p2(k); +insert into t2 values (k+5); +return k; +end| +create function f15() returns int +begin +declare k int; +call p2(k); +return k; +end| +create trigger t4_bi before insert on t4 for each row +begin +declare k int; +select i from t1 where i=1 into k; +set new.l= k+1; +end| +create trigger t4_bu before update on t4 for each row +begin +if (select i from t1 where i=1) then +set new.l= 2; +end if; +end| +create trigger t4_bd before delete on t4 for each row +begin +if !(select i from v1 where i=1) then +signal sqlstate '45000'; +end if; +end| +create trigger t5_bi before insert on t5 for each row +begin +set new.l= f1()+1; +end| +create trigger t5_bu before update on t5 for each row +begin +declare j int; +call p2(j); +set new.l= j + 1; +end| +# +# Set common variables to be used by scripts called below. +# +# +# 1. Statements that read tables and do not use subqueries. +# +# +# 1.1 Simple SELECT statement. +# +# No locks are necessary as this statement won't be written +# to the binary log and thanks to how MyISAM works SELECT +# will see version of the table prior to concurrent insert. +Success: 'select * from t1' doesn't take row locks on 't1'. +# +# 1.2 Multi-UPDATE statement. +# +# Has to take shared locks on rows in the table being read as this +# statement will be written to the binary log and therefore should +# be serialized with concurrent statements. +Success: 'update t2, t1 set j= j - 1 where i = j' takes shared row locks on 't1'. +# +# 1.3 Multi-DELETE statement. +# +# The above is true for this statement as well. +Success: 'delete t2 from t1, t2 where i = j' takes shared row locks on 't1'. +# +# 1.4 DESCRIBE statement. +# +# This statement does not really read data from the +# target table and thus does not take any lock on it. +# We check this for completeness of coverage. +Success: 'describe t1' doesn't take row locks on 't1'. +# +# 1.5 SHOW statements. +# +# The above is true for SHOW statements as well. +Success: 'show create table t1' doesn't take row locks on 't1'. +Success: 'show keys from t1' doesn't take row locks on 't1'. +# +# 2. Statements which read tables through subqueries. +# +# +# 2.1 CALL with a subquery. +# +# A strong lock is not necessary as this statement is not +# written to the binary log as a whole (it is written +# statement-by-statement) and thanks to MVCC we can always get +# versions of rows prior to the update that has locked them. +# But in practice InnoDB does locking reads for all statements +# other than SELECT (unless it is a READ-COMITTED mode or +# innodb_locks_unsafe_for_binlog is ON). +Success: 'call p1((select i + 5 from t1 where i = 1))' takes shared row locks on 't1'. +# +# 2.2 CREATE TABLE with a subquery. +# +# Has to take shared locks on rows in the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent statements. +Success: 'create table t0 engine=innodb select * from t1' takes shared row locks on 't1'. +drop table t0; +Success: 'create table t0 engine=innodb select j from t2 where j in (select i from t1)' takes shared row locks on 't1'. +drop table t0; +# +# 2.3 DELETE with a subquery. +# +# The above is true for this statement as well. +Success: 'delete from t2 where j in (select i from t1)' takes shared row locks on 't1'. +# +# 2.4 MULTI-DELETE with a subquery. +# +# Same is true for this statement as well. +Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' takes shared row locks on 't1'. +# +# 2.5 DO with a subquery. +# +# In theory should not take row locks as it is not logged. +# In practice InnoDB takes shared row locks. +Success: 'do (select i from t1 where i = 1)' takes shared row locks on 't1'. +# +# 2.6 INSERT with a subquery. +# +# Has to take shared locks on rows in the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent statements. +Success: 'insert into t2 select i+5 from t1' takes shared row locks on 't1'. +Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'. +# +# 2.7 LOAD DATA with a subquery. +# +# The above is true for this statement as well. +Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' takes shared row locks on 't1'. +# +# 2.8 REPLACE with a subquery. +# +# Same is true for this statement as well. +Success: 'replace into t2 select i+5 from t1' takes shared row locks on 't1'. +Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' takes shared row locks on 't1'. +# +# 2.9 SELECT with a subquery. +# +# Locks are not necessary as this statement is not written +# to the binary log and thanks to MVCC we can always get +# versions of rows prior to the update that has locked them. +# +# Also serves as a test case for bug #46947 "Embedded SELECT +# without FOR UPDATE is causing a lock". +Success: 'select * from t2 where j in (select i from t1)' doesn't take row locks on 't1'. +# +# 2.10 SET with a subquery. +# +# In theory should not require locking as it is not written +# to the binary log. In practice InnoDB acquires shared row +# locks. +Success: 'set @a:= (select i from t1 where i = 1)' takes shared row locks on 't1'. +# +# 2.11 SHOW with a subquery. +# +# Similarly to the previous case, in theory should not require locking +# as it is not written to the binary log. In practice InnoDB +# acquires shared row locks. +Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' takes shared row locks on 't1'. +Success: 'show columns from t2 where (select i from t1 where i = 1)' takes shared row locks on 't1'. +# +# 2.12 UPDATE with a subquery. +# +# Has to take shared locks on rows in the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent statements. +Success: 'update t2 set j= j-10 where j in (select i from t1)' takes shared row locks on 't1'. +# +# 2.13 MULTI-UPDATE with a subquery. +# +# Same is true for this statement as well. +Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' takes shared row locks on 't1'. +# +# 3. Statements which read tables through a view. +# +# +# 3.1 SELECT statement which uses some table through a view. +# +# Since this statement is not written to the binary log +# and old version of rows are accessible thanks to MVCC, +# no locking is necessary. +Success: 'select * from v1' doesn't take row locks on 't1'. +Success: 'select * from v2' doesn't take row locks on 't1'. +Success: 'select * from t2 where j in (select i from v1)' doesn't take row locks on 't1'. +Success: 'select * from t3 where k in (select j from v2)' doesn't take row locks on 't1'. +# +# 3.2 Statements which modify a table and use views. +# +# Since such statements are going to be written to the binary +# log they need to be serialized against concurrent statements +# and therefore should take shared row locks on data read. +Success: 'update t2 set j= j-10 where j in (select i from v1)' takes shared row locks on 't1'. +Success: 'update t3 set k= k-10 where k in (select j from v2)' takes shared row locks on 't1'. +Success: 'update t2, v1 set j= j-10 where j = i' takes shared row locks on 't1'. +Success: 'update v2 set j= j-10 where j = 3' takes shared row locks on 't1'. +# +# 4. Statements which read tables through stored functions. +# +# +# 4.1 SELECT/SET with a stored function which does not +# modify data and uses SELECT in its turn. +# +# In theory there is no need to take row locks on the table +# being selected from in SF as the call to such function +# won't get into the binary log. In practice, however, we +# discover that fact too late in the process to be able to +# affect the decision what locks should be taken. +# Hence, strong locks are taken in this case. +Success: 'select f1()' takes shared row locks on 't1'. +Success: 'set @a:= f1()' takes shared row locks on 't1'. +# +# 4.2 INSERT (or other statement which modifies data) with +# a stored function which does not modify data and uses +# SELECT. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting the data +# it uses. Therefore it should take row locks on the data +# it reads. +Success: 'insert into t2 values (f1() + 5)' takes shared row locks on 't1'. +# +# 4.3 SELECT/SET with a stored function which +# reads and modifies data. +# +# Since a call to such function is written to the binary log, +# it should be serialized with concurrent statements affecting +# the data it uses. Hence, row locks on the data read +# should be taken. +Success: 'select f2()' takes shared row locks on 't1'. +Success: 'set @a:= f2()' takes shared row locks on 't1'. +# +# 4.4. SELECT/SET with a stored function which does not +# modify data and reads a table through subselect +# in a control construct. +# +# Again, in theory a call to this function won't get to the +# binary log and thus no locking is needed. But in practice +# we don't detect this fact early enough (get_lock_type_for_table()) +# to avoid taking row locks. +Success: 'select f3()' takes shared row locks on 't1'. +Success: 'set @a:= f3()' takes shared row locks on 't1'. +Success: 'select f4()' takes shared row locks on 't1'. +Success: 'set @a:= f4()' takes shared row locks on 't1'. +# +# 4.5. INSERT (or other statement which modifies data) with +# a stored function which does not modify data and reads +# the table through a subselect in one of its control +# constructs. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting data it +# uses. Therefore it should take row locks on the data +# it reads. +Success: 'insert into t2 values (f3() + 5)' takes shared row locks on 't1'. +Success: 'insert into t2 values (f4() + 6)' takes shared row locks on 't1'. +# +# 4.6 SELECT/SET which uses a stored function with +# DML which reads a table via a subquery. +# +# Since call to such function is written to the binary log +# it should be serialized with concurrent statements. +# Hence reads should take row locks. +Success: 'select f5()' takes shared row locks on 't1'. +Success: 'set @a:= f5()' takes shared row locks on 't1'. +# +# 4.7 SELECT/SET which uses a stored function which +# doesn't modify data and reads tables through +# a view. +# +# Once again, in theory, calls to such functions won't +# get into the binary log and thus don't need row +# locks. But in practice this fact is discovered +# too late to have any effect. +Success: 'select f6()' takes shared row locks on 't1'. +Success: 'set @a:= f6()' takes shared row locks on 't1'. +Success: 'select f7()' takes shared row locks on 't1'. +Success: 'set @a:= f7()' takes shared row locks on 't1'. +# +# 4.8 INSERT which uses stored function which +# doesn't modify data and reads a table +# through a view. +# +# Since such statement is written to the binary log and +# should be serialized with concurrent statements affecting +# the data it uses. Therefore it should take row locks on +# the rows it reads. +Success: 'insert into t3 values (f6() + 5)' takes shared row locks on 't1'. +Success: 'insert into t3 values (f7() + 5)' takes shared row locks on 't1'. +# +# 4.9 SELECT which uses a stored function which +# modifies data and reads tables through a view. +# +# Since a call to such function is written to the binary log +# it should be serialized with concurrent statements. +# Hence, reads should take row locks. +Success: 'select f8()' takes shared row locks on 't1'. +Success: 'select f9()' takes shared row locks on 't1'. +# +# 4.10 SELECT which uses stored function which doesn't modify +# data and reads a table indirectly, by calling another +# function. +# +# In theory, calls to such functions won't get into the binary +# log and thus don't need to acquire row locks. But in practice +# this fact is discovered too late to have any effect. +Success: 'select f10()' takes shared row locks on 't1'. +# +# 4.11 INSERT which uses a stored function which doesn't modify +# data and reads a table indirectly, by calling another +# function. +# +# Since such statement is written to the binary log, it should +# be serialized with concurrent statements affecting the data it +# uses. Therefore it should take row locks on data it reads. +Success: 'insert into t2 values (f10() + 5)' takes shared row locks on 't1'. +# +# 4.12 SELECT which uses a stored function which modifies +# data and reads a table indirectly, by calling another +# function. +# +# Since a call to such function is written to the binary log +# it should be serialized from concurrent statements. +# Hence, reads should take row locks. +Success: 'select f11()' takes shared row locks on 't1'. +# +# 4.13 SELECT that reads a table through a subquery passed +# as a parameter to a stored function which modifies +# data. +# +# Even though a call to this function is written to the +# binary log, values of its parameters are written as literals. +# So there is no need to acquire row locks on rows used in +# the subquery. +Success: 'select f12((select i+10 from t1 where i=1))' doesn't take row locks on 't1'. +# +# 4.14 INSERT that reads a table via a subquery passed +# as a parameter to a stored function which doesn't +# modify data. +# +# Since this statement is written to the binary log it should +# be serialized with concurrent statements affecting the data it +# uses. Therefore it should take row locks on the data it reads. +Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' takes shared row locks on 't1'. +# +# 5. Statements that read tables through stored procedures. +# +# +# 5.1 CALL statement which reads a table via SELECT. +# +# Since neither this statement nor its components are +# written to the binary log, there is no need to take +# row locks on the data it reads. +Success: 'call p2(@a)' doesn't take row locks on 't1'. +# +# 5.2 Function that modifes data and uses CALL, +# which reads a table through SELECT. +# +# Since a call to such function is written to the binary +# log, it should be serialized with concurrent statements. +# Hence, in this case reads should take row locks on data. +Success: 'select f14()' takes shared row locks on 't1'. +# +# 5.3 SELECT that calls a function that doesn't modify data and +# uses a CALL statement that reads a table via SELECT. +# +# In theory, calls to such functions won't get into the binary +# log and thus don't need to acquire row locks. But in practice +# this fact is discovered too late to have any effect. +Success: 'select f15()' takes shared row locks on 't1'. +# +# 5.4 INSERT which calls function which doesn't modify data and +# uses CALL statement which reads table through SELECT. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting data it +# uses. Therefore it should take row locks on data it reads. +Success: 'insert into t2 values (f15()+5)' takes shared row locks on 't1'. +# +# 6. Statements that use triggers. +# +# +# 6.1 Statement invoking a trigger that reads table via SELECT. +# +# Since this statement is written to the binary log it should +# be serialized with concurrent statements affecting the data +# it uses. Therefore, it should take row locks on the data +# it reads. +Success: 'insert into t4 values (2)' takes shared row locks on 't1'. +# +# 6.2 Statement invoking a trigger that reads table through +# a subquery in a control construct. +# +# The above is true for this statement as well. +Success: 'update t4 set l= 2 where l = 1' takes shared row locks on 't1'. +# +# 6.3 Statement invoking a trigger that reads a table through +# a view. +# +# And for this statement. +Success: 'delete from t4 where l = 1' takes shared row locks on 't1'. +# +# 6.4 Statement invoking a trigger that reads a table through +# a stored function. +# +# And for this statement. +Success: 'insert into t5 values (2)' takes shared row locks on 't1'. +# +# 6.5 Statement invoking a trigger that reads a table through +# stored procedure. +# +# And for this statement. +Success: 'update t5 set l= 2 where l = 1' takes shared row locks on 't1'. +# Clean-up. +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; +drop function f8; +drop function f9; +drop function f10; +drop function f11; +drop function f12; +drop function f13; +drop function f14; +drop function f15; +drop view v1, v2; +drop procedure p1; +drop procedure p2; +drop table t1, t2, t3, t4, t5; diff --git a/mysql-test/r/lock_sync.result b/mysql-test/r/lock_sync.result index 18f3f6bc1a7..e6265f1cb5e 100644 --- a/mysql-test/r/lock_sync.result +++ b/mysql-test/r/lock_sync.result @@ -1,4 +1,596 @@ # +# Test how we handle locking in various cases when +# we read data from MyISAM tables. +# +# In this test we mostly check that the SQL-layer correctly +# determines the type of thr_lock.c lock for a table being +# read. +# I.e. that it disallows concurrent inserts when the statement +# is going to be written to the binary log and therefore +# should be serialized, and allows concurrent inserts when +# such serialization is not necessary (e.g. when +# the statement is not written to binary log). +# +# Force concurrent inserts to be performed even if the table +# has gaps. This allows to simplify clean up in scripts +# used below (instead of backing up table being inserted +# into and then restoring it from backup at the end of the +# script we can simply delete rows which were inserted). +set @old_concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert= 2; +select @@global.concurrent_insert; +@@global.concurrent_insert +ALWAYS +# Prepare playground by creating tables, views, +# routines and triggers used in tests. +drop table if exists t0, t1, t2, t3, t4, t5; +drop view if exists v1, v2; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; +drop function if exists f2; +drop function if exists f3; +drop function if exists f4; +drop function if exists f5; +drop function if exists f6; +drop function if exists f7; +drop function if exists f8; +drop function if exists f9; +drop function if exists f10; +drop function if exists f11; +drop function if exists f12; +drop function if exists f13; +drop function if exists f14; +drop function if exists f15; +create table t1 (i int primary key); +insert into t1 values (1), (2), (3), (4), (5); +create table t2 (j int primary key); +insert into t2 values (1), (2), (3), (4), (5); +create table t3 (k int primary key); +insert into t3 values (1), (2), (3); +create table t4 (l int primary key); +insert into t4 values (1); +create table t5 (l int primary key); +insert into t5 values (1); +create view v1 as select i from t1; +create view v2 as select j from t2 where j in (select i from t1); +create procedure p1(k int) insert into t2 values (k); +create function f1() returns int +begin +declare j int; +select i from t1 where i = 1 into j; +return j; +end| +create function f2() returns int +begin +declare k int; +select i from t1 where i = 1 into k; +insert into t2 values (k + 5); +return 0; +end| +create function f3() returns int +begin +return (select i from t1 where i = 3); +end| +create function f4() returns int +begin +if (select i from t1 where i = 3) then +return 1; +else +return 0; +end if; +end| +create function f5() returns int +begin +insert into t2 values ((select i from t1 where i = 1) + 5); +return 0; +end| +create function f6() returns int +begin +declare k int; +select i from v1 where i = 1 into k; +return k; +end| +create function f7() returns int +begin +declare k int; +select j from v2 where j = 1 into k; +return k; +end| +create function f8() returns int +begin +declare k int; +select i from v1 where i = 1 into k; +insert into t2 values (k+5); +return k; +end| +create function f9() returns int +begin +update v2 set j=j+10 where j=1; +return 1; +end| +create function f10() returns int +begin +return f1(); +end| +create function f11() returns int +begin +declare k int; +set k= f1(); +insert into t2 values (k+5); +return k; +end| +create function f12(p int) returns int +begin +insert into t2 values (p); +return p; +end| +create function f13(p int) returns int +begin +return p; +end| +create procedure p2(inout p int) +begin +select i from t1 where i = 1 into p; +end| +create function f14() returns int +begin +declare k int; +call p2(k); +insert into t2 values (k+5); +return k; +end| +create function f15() returns int +begin +declare k int; +call p2(k); +return k; +end| +create trigger t4_bi before insert on t4 for each row +begin +declare k int; +select i from t1 where i=1 into k; +set new.l= k+1; +end| +create trigger t4_bu before update on t4 for each row +begin +if (select i from t1 where i=1) then +set new.l= 2; +end if; +end| +create trigger t4_bd before delete on t4 for each row +begin +if !(select i from v1 where i=1) then +signal sqlstate '45000'; +end if; +end| +create trigger t5_bi before insert on t5 for each row +begin +set new.l= f1()+1; +end| +create trigger t5_bu before update on t5 for each row +begin +declare j int; +call p2(j); +set new.l= j + 1; +end| +# +# Set common variables to be used by the scripts +# called below. +# +# Switch to connection 'con1'. +# Cache all functions used in the tests below so statements +# calling them won't need to open and lock mysql.proc table +# and we can assume that each statement locks its tables +# once during its execution. +show create procedure p1; +show create procedure p2; +show create function f1; +show create function f2; +show create function f3; +show create function f4; +show create function f5; +show create function f6; +show create function f7; +show create function f8; +show create function f9; +show create function f10; +show create function f11; +show create function f12; +show create function f13; +show create function f14; +show create function f15; +# Switch back to connection 'default'. +# +# 1. Statements that read tables and do not use subqueries. +# +# +# 1.1 Simple SELECT statement. +# +# No locks are necessary as this statement won't be written +# to the binary log and thanks to how MyISAM works SELECT +# will see version of the table prior to concurrent insert. +Success: 'select * from t1' allows concurrent inserts into 't1'. +# +# 1.2 Multi-UPDATE statement. +# +# Has to take shared locks on rows in the table being read as this +# statement will be written to the binary log and therefore should +# be serialized with concurrent statements. +Success: 'update t2, t1 set j= j - 1 where i = j' doesn't allow concurrent inserts into 't1'. +# +# 1.3 Multi-DELETE statement. +# +# The above is true for this statement as well. +Success: 'delete t2 from t1, t2 where i = j' doesn't allow concurrent inserts into 't1'. +# +# 1.4 DESCRIBE statement. +# +# This statement does not really read data from the +# target table and thus does not take any lock on it. +# We check this for completeness of coverage. +lock table t1 write; +# Switching to connection 'con1'. +# This statement should not be blocked. +describe t1; +# Switching to connection 'default'. +unlock tables; +# +# 1.5 SHOW statements. +# +# The above is true for SHOW statements as well. +lock table t1 write; +# Switching to connection 'con1'. +# These statements should not be blocked. +show keys from t1; +# Switching to connection 'default'. +unlock tables; +# +# 2. Statements which read tables through subqueries. +# +# +# 2.1 CALL with a subquery. +# +# A strong lock is not necessary as this statement is not +# written to the binary log as a whole (it is written +# statement-by-statement). +Success: 'call p1((select i + 5 from t1 where i = 1))' allows concurrent inserts into 't1'. +# +# 2.2 CREATE TABLE with a subquery. +# +# Has to take a strong lock on the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent statements. +Success: 'create table t0 select * from t1' doesn't allow concurrent inserts into 't1'. +drop table t0; +Success: 'create table t0 select j from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'. +drop table t0; +# +# 2.3 DELETE with a subquery. +# +# The above is true for this statement as well. +Success: 'delete from t2 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'. +# +# 2.4 MULTI-DELETE with a subquery. +# +# Same is true for this statement as well. +Success: 'delete t2 from t3, t2 where k = j and j in (select i from t1)' doesn't allow concurrent inserts into 't1'. +# +# 2.5 DO with a subquery. +# +# A strong lock is not necessary as it is not logged. +Success: 'do (select i from t1 where i = 1)' allows concurrent inserts into 't1'. +# +# 2.6 INSERT with a subquery. +# +# Has to take a strong lock on the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent inserts. +Success: 'insert into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'. +Success: 'insert into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'. +# +# 2.7 LOAD DATA with a subquery. +# +# The above is true for this statement as well. +Success: 'load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1)' doesn't allow concurrent inserts into 't1'. +# +# 2.8 REPLACE with a subquery. +# +# Same is true for this statement as well. +Success: 'replace into t2 select i+5 from t1' doesn't allow concurrent inserts into 't1'. +Success: 'replace into t2 values ((select i+5 from t1 where i = 4))' doesn't allow concurrent inserts into 't1'. +# +# 2.9 SELECT with a subquery. +# +# Strong locks are not necessary as this statement is not written +# to the binary log and thanks to how MyISAM works this statement +# sees a version of the table prior to the concurrent insert. +Success: 'select * from t2 where j in (select i from t1)' allows concurrent inserts into 't1'. +# +# 2.10 SET with a subquery. +# +# The same is true for this statement as well. +Success: 'set @a:= (select i from t1 where i = 1)' allows concurrent inserts into 't1'. +# +# 2.11 SHOW with a subquery. +# +# And for this statement too. +Success: 'show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1)' allows concurrent inserts into 't1'. +Success: 'show columns from t2 where (select i from t1 where i = 1)' allows concurrent inserts into 't1'. +# +# 2.12 UPDATE with a subquery. +# +# Has to take a strong lock on the table being read as +# this statement is written to the binary log and therefore +# should be serialized with concurrent inserts. +Success: 'update t2 set j= j-10 where j in (select i from t1)' doesn't allow concurrent inserts into 't1'. +# +# 2.13 MULTI-UPDATE with a subquery. +# +# Same is true for this statement as well. +Success: 'update t2, t3 set j= j -10 where j=k and j in (select i from t1)' doesn't allow concurrent inserts into 't1'. +# +# 3. Statements which read tables through a view. +# +# +# 3.1 SELECT statement which uses some table through a view. +# +# Since this statement is not written to the binary log and +# an old version of the table is accessible thanks to how MyISAM +# handles concurrent insert, no locking is necessary. +Success: 'select * from v1' allows concurrent inserts into 't1'. +Success: 'select * from v2' allows concurrent inserts into 't1'. +Success: 'select * from t2 where j in (select i from v1)' allows concurrent inserts into 't1'. +Success: 'select * from t3 where k in (select j from v2)' allows concurrent inserts into 't1'. +# +# 3.2 Statements which modify a table and use views. +# +# Since such statements are going to be written to the binary +# log they need to be serialized against concurrent statements +# and therefore should take strong locks on the data read. +Success: 'update t2 set j= j-10 where j in (select i from v1)' doesn't allow concurrent inserts into 't1'. +Success: 'update t3 set k= k-10 where k in (select j from v2)' doesn't allow concurrent inserts into 't1'. +Success: 'update t2, v1 set j= j-10 where j = i' doesn't allow concurrent inserts into 't1'. +Success: 'update v2 set j= j-10 where j = 3' doesn't allow concurrent inserts into 't1'. +# +# 4. Statements which read tables through stored functions. +# +# +# 4.1 SELECT/SET with a stored function which does not +# modify data and uses SELECT in its turn. +# +# In theory there is no need to take strong locks on the table +# being selected from in SF as the call to such function +# won't get into the binary log. In practice, however, we +# discover that fact too late in the process to be able to +# affect the decision what locks should be taken. +# Hence, strong locks are taken in this case. +Success: 'select f1()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f1()' doesn't allow concurrent inserts into 't1'. +# +# 4.2 INSERT (or other statement which modifies data) with +# a stored function which does not modify data and uses +# SELECT. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting the data +# it uses. Therefore it should take strong lock on the data +# it reads. +Success: 'insert into t2 values (f1() + 5)' doesn't allow concurrent inserts into 't1'. +# +# 4.3 SELECT/SET with a stored function which +# reads and modifies data. +# +# Since a call to such function is written to the binary log, +# it should be serialized with concurrent statements affecting +# the data it uses. Hence, a strong lock on the data read +# should be taken. +Success: 'select f2()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f2()' doesn't allow concurrent inserts into 't1'. +# +# 4.4. SELECT/SET with a stored function which does not +# modify data and reads a table through subselect +# in a control construct. +# +# Again, in theory a call to this function won't get to the +# binary log and thus no strong lock is needed. But in practice +# we don't detect this fact early enough (get_lock_type_for_table()) +# to avoid taking a strong lock. +Success: 'select f3()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f3()' doesn't allow concurrent inserts into 't1'. +Success: 'select f4()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f4()' doesn't allow concurrent inserts into 't1'. +# +# 4.5. INSERT (or other statement which modifies data) with +# a stored function which does not modify data and reads +# the table through a subselect in one of its control +# constructs. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting data it +# uses. Therefore it should take a strong lock on the data +# it reads. +Success: 'insert into t2 values (f3() + 5)' doesn't allow concurrent inserts into 't1'. +Success: 'insert into t2 values (f4() + 6)' doesn't allow concurrent inserts into 't1'. +# +# 4.6 SELECT/SET which uses a stored function with +# DML which reads a table via a subquery. +# +# Since call to such function is written to the binary log +# it should be serialized with concurrent statements. +# Hence reads should take a strong lock. +Success: 'select f5()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f5()' doesn't allow concurrent inserts into 't1'. +# +# 4.7 SELECT/SET which uses a stored function which +# doesn't modify data and reads tables through +# a view. +# +# Once again, in theory, calls to such functions won't +# get into the binary log and thus don't need strong +# locks. But in practice this fact is discovered +# too late to have any effect. +Success: 'select f6()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f6()' doesn't allow concurrent inserts into 't1'. +Success: 'select f7()' doesn't allow concurrent inserts into 't1'. +Success: 'set @a:= f7()' doesn't allow concurrent inserts into 't1'. +# +# 4.8 INSERT which uses stored function which +# doesn't modify data and reads a table +# through a view. +# +# Since such statement is written to the binary log and +# should be serialized with concurrent statements affecting +# the data it uses. Therefore it should take a strong lock on +# the table it reads. +Success: 'insert into t3 values (f6() + 5)' doesn't allow concurrent inserts into 't1'. +Success: 'insert into t3 values (f7() + 5)' doesn't allow concurrent inserts into 't1'. +# +# 4.9 SELECT which uses a stored function which +# modifies data and reads tables through a view. +# +# Since a call to such function is written to the binary log +# it should be serialized with concurrent statements. +# Hence, reads should take strong locks. +Success: 'select f8()' doesn't allow concurrent inserts into 't1'. +Success: 'select f9()' doesn't allow concurrent inserts into 't1'. +# +# 4.10 SELECT which uses a stored function which doesn't modify +# data and reads a table indirectly, by calling another +# function. +# +# In theory, calls to such functions won't get into the binary +# log and thus don't need to acquire strong locks. But in practice +# this fact is discovered too late to have any effect. +Success: 'select f10()' doesn't allow concurrent inserts into 't1'. +# +# 4.11 INSERT which uses a stored function which doesn't modify +# data and reads a table indirectly, by calling another +# function. +# +# Since such statement is written to the binary log, it should +# be serialized with concurrent statements affecting the data it +# uses. Therefore it should take strong locks on data it reads. +Success: 'insert into t2 values (f10() + 5)' doesn't allow concurrent inserts into 't1'. +# +# 4.12 SELECT which uses a stored function which modifies +# data and reads a table indirectly, by calling another +# function. +# +# Since a call to such function is written to the binary log +# it should be serialized from concurrent statements. +# Hence, read should take a strong lock. +Success: 'select f11()' doesn't allow concurrent inserts into 't1'. +# +# 4.13 SELECT that reads a table through a subquery passed +# as a parameter to a stored function which modifies +# data. +# +# Even though a call to this function is written to the +# binary log, values of its parameters are written as literals. +# So there is no need to acquire strong locks for tables used in +# the subquery. +Success: 'select f12((select i+10 from t1 where i=1))' allows concurrent inserts into 't1'. +# +# 4.14 INSERT that reads a table via a subquery passed +# as a parameter to a stored function which doesn't +# modify data. +# +# Since this statement is written to the binary log it should +# be serialized with concurrent statements affecting the data it +# uses. Therefore it should take strong locks on the data it reads. +Success: 'insert into t2 values (f13((select i+10 from t1 where i=1)))' doesn't allow concurrent inserts into 't1'. +# +# 5. Statements that read tables through stored procedures. +# +# +# 5.1 CALL statement which reads a table via SELECT. +# +# Since neither this statement nor its components are +# written to the binary log, there is no need to take +# strong locks on the data it reads. +Success: 'call p2(@a)' allows concurrent inserts into 't1'. +# +# 5.2 Function that modifes data and uses CALL, +# which reads a table through SELECT. +# +# Since a call to such function is written to the binary +# log, it should be serialized with concurrent statements. +# Hence, in this case reads should take strong locks on data. +Success: 'select f14()' doesn't allow concurrent inserts into 't1'. +# +# 5.3 SELECT that calls a function that doesn't modify data and +# uses a CALL statement that reads a table via SELECT. +# +# In theory, calls to such functions won't get into the binary +# log and thus don't need to acquire strong locks. But in practice +# this fact is discovered too late to have any effect. +Success: 'select f15()' doesn't allow concurrent inserts into 't1'. +# +# 5.4 INSERT which calls function which doesn't modify data and +# uses CALL statement which reads table through SELECT. +# +# Since such statement is written to the binary log it should +# be serialized with concurrent statements affecting data it +# uses. Therefore it should take strong locks on data it reads. +Success: 'insert into t2 values (f15()+5)' doesn't allow concurrent inserts into 't1'. +# +# 6. Statements that use triggers. +# +# +# 6.1 Statement invoking a trigger that reads table via SELECT. +# +# Since this statement is written to the binary log it should +# be serialized with concurrent statements affecting the data +# it uses. Therefore, it should take strong locks on the data +# it reads. +Success: 'insert into t4 values (2)' doesn't allow concurrent inserts into 't1'. +# +# 6.2 Statement invoking a trigger that reads table through +# a subquery in a control construct. +# +# The above is true for this statement as well. +Success: 'update t4 set l= 2 where l = 1' doesn't allow concurrent inserts into 't1'. +# +# 6.3 Statement invoking a trigger that reads a table through +# a view. +# +# And for this statement. +Success: 'delete from t4 where l = 1' doesn't allow concurrent inserts into 't1'. +# +# 6.4 Statement invoking a trigger that reads a table through +# a stored function. +# +# And for this statement. +Success: 'insert into t5 values (2)' doesn't allow concurrent inserts into 't1'. +# +# 6.5 Statement invoking a trigger that reads a table through +# stored procedure. +# +# And for this statement. +Success: 'update t5 set l= 2 where l = 1' doesn't allow concurrent inserts into 't1'. +# Clean-up. +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; +drop function f8; +drop function f9; +drop function f10; +drop function f11; +drop function f12; +drop function f13; +drop function f14; +drop function f15; +drop view v1, v2; +drop procedure p1; +drop procedure p2; +drop table t1, t2, t3, t4, t5; +set @@global.concurrent_insert= @old_concurrent_insert; +# # Test for bug #45143 "All connections hang on concurrent ALTER TABLE". # # Concurrent execution of statements which required weak write lock diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result index 984f0df3d0e..b78b8dadc77 100644 --- a/mysql-test/r/mdl_sync.result +++ b/mysql-test/r/mdl_sync.result @@ -2381,3 +2381,17 @@ commit; # Reap ALTER TABLE. set debug_sync= 'RESET'; drop table t1; +# +# Bug#52856 concurrent show columns or show full columns causes a crash!!! +# +CREATE TABLE t1(a CHAR(255)); +SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed"; +SHOW FULL COLUMNS FROM t1; +SET DEBUG_SYNC= "now WAIT_FOR waiting"; +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +a char(255) latin1_swedish_ci YES NULL # +SET DEBUG_SYNC= "now SIGNAL completed"; +Field Type Collation Null Key Default Extra Privileges Comment +a char(255) latin1_swedish_ci YES NULL # +DROP TABLE t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index ff9b1a84dbc..e46d8e75ab1 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` ( drop table t3,t2,t1; create table t1 (a int not null, key(a)) engine=merge; select * from t1; -ERROR HY000: Got error 124 from storage engine +a drop table t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); @@ -988,6 +988,11 @@ m1 CREATE TABLE `m1` ( `a` int(11) DEFAULT NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, m1; +CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; +SELECT MAX(a) FROM t1; +MAX(a) +NULL +DROP TABLE t1; CREATE TABLE t1(a INT); CREATE TABLE t2(a VARCHAR(10)); CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2); diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result index 4293465df67..f7b5869a3e3 100644 --- a/mysql-test/r/mysqlshow.result +++ b/mysql-test/r/mysqlshow.result @@ -109,13 +109,20 @@ Database: information_schema | TRIGGERS | | USER_PRIVILEGES | | VIEWS | -| INNODB_CMP_RESET | +| INNODB_SYS_FIELDS | | INNODB_TRX | -| INNODB_CMPMEM_RESET | +| INNODB_SYS_INDEXES | | INNODB_LOCK_WAITS | -| INNODB_CMPMEM | +| INNODB_SYS_TABLESTATS | | INNODB_CMP | +| INNODB_SYS_COLUMNS | +| INNODB_CMP_RESET | +| INNODB_SYS_FOREIGN_COLS | | INNODB_LOCKS | +| INNODB_CMPMEM_RESET | +| INNODB_CMPMEM | +| INNODB_SYS_FOREIGN | +| INNODB_SYS_TABLES | +---------------------------------------+ Database: INFORMATION_SCHEMA +---------------------------------------+ @@ -151,13 +158,20 @@ Database: INFORMATION_SCHEMA | TRIGGERS | | USER_PRIVILEGES | | VIEWS | -| INNODB_CMP_RESET | +| INNODB_SYS_FIELDS | | INNODB_TRX | -| INNODB_CMPMEM_RESET | +| INNODB_SYS_INDEXES | | INNODB_LOCK_WAITS | -| INNODB_CMPMEM | +| INNODB_SYS_TABLESTATS | | INNODB_CMP | +| INNODB_SYS_COLUMNS | +| INNODB_CMP_RESET | +| INNODB_SYS_FOREIGN_COLS | | INNODB_LOCKS | +| INNODB_CMPMEM_RESET | +| INNODB_CMPMEM | +| INNODB_SYS_FOREIGN | +| INNODB_SYS_TABLES | +---------------------------------------+ Wildcard: inf_rmation_schema +--------------------+ diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 6827fd0bc76..fa5d8142baf 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1618,3 +1618,32 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer DROP TABLE t1, t2; End of 5.1 tests +# +# Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY +# when it should use index +# +CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY); +CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY); +CREATE TABLE t3 (i3 integer); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12); +INSERT INTO t2 SELECT * FROM t1; +EXPLAIN EXTENDED +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 +LEFT JOIN t3 ON t2.i2 = t3.i3 +ORDER BY t1.i1 LIMIT 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 const row not found +1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 240.00 Using index +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index +Warnings: +Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`i2` = `test`.`t1`.`i1`) order by `test`.`t1`.`i1` limit 5 +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 +LEFT JOIN t3 ON t2.i2 = t3.i3 +ORDER BY t1.i1 LIMIT 5; +i1 i2 +1 1 +2 2 +3 3 +4 4 +5 5 +DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 80d520007a4..55366bd2e07 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,4 +1,46 @@ drop table if exists t1, t2; +# Bug#39338: Fieldnames in +# INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped +# NOTE: the partition expression is saved as a string, so changing from +# normal quotes to ansi quotes does not change the expression, only +# for partition by KEY. +CREATE TABLE t1 ( +ID int(11) NOT NULL, +`aaaa,aaaaa` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', +ddddddddd int(11) NOT NULL DEFAULT '0', +new_field0 varchar(50), +PRIMARY KEY(ID, `aaaa,aaaaa`, ddddddddd)) +PARTITION BY RANGE(ID) +PARTITIONS 3 +SUBPARTITION BY LINEAR KEY(ID,`aaaa,aaaaa`) +SUBPARTITIONS 2 ( +PARTITION p01 VALUES LESS THAN(100), +PARTITION p11 VALUES LESS THAN(200), +PARTITION p21 VALUES LESS THAN MAXVALUE); +SELECT PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1'; +PARTITION_EXPRESSION SUBPARTITION_EXPRESSION +ID `ID`,`aaaa,aaaaa` +ID `ID`,`aaaa,aaaaa` +ID `ID`,`aaaa,aaaaa` +ID `ID`,`aaaa,aaaaa` +ID `ID`,`aaaa,aaaaa` +ID `ID`,`aaaa,aaaaa` +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ID` int(11) NOT NULL, + `aaaa,aaaaa` tinyint(3) unsigned NOT NULL DEFAULT '0', + `ddddddddd` int(11) NOT NULL DEFAULT '0', + `new_field0` varchar(50) DEFAULT NULL, + PRIMARY KEY (`ID`,`aaaa,aaaaa`,`ddddddddd`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (ID) +SUBPARTITION BY LINEAR KEY (ID,`aaaa,aaaaa`) +SUBPARTITIONS 2 +(PARTITION p01 VALUES LESS THAN (100) ENGINE = MyISAM, + PARTITION p11 VALUES LESS THAN (200) ENGINE = MyISAM, + PARTITION p21 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +drop table t1; CREATE TABLE t1 (a INT, b INT) PARTITION BY LIST (a) SUBPARTITION BY HASH (b) diff --git a/mysql-test/r/partition_binlog_stmt.result b/mysql-test/r/partition_binlog_stmt.result new file mode 100644 index 00000000000..9be23636ca6 --- /dev/null +++ b/mysql-test/r/partition_binlog_stmt.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS t1; +# +# Bug#51851: Server with SBR locks mutex twice on LOAD DATA into +# partitioned MyISAM table +CREATE TABLE t1 +(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +name TINYBLOB NOT NULL, +modified TIMESTAMP DEFAULT '0000-00-00 00:00:00', +INDEX namelocs (name(255))) ENGINE = MyISAM +PARTITION BY HASH(id) PARTITIONS 2; +LOAD DATA LOCAL INFILE 'init_file.txt' +INTO TABLE t1 (name); +DROP TABLE t1; diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result index 458343a6b92..7b45ffcb0de 100644 --- a/mysql-test/r/partition_column.result +++ b/mysql-test/r/partition_column.result @@ -1,4 +1,44 @@ drop table if exists t1; +# +# Bug#52815: LIST COLUMNS doesn't insert rows in correct partition +# if muliple columns used +CREATE TABLE t1 ( +id INT NOT NULL, +name VARCHAR(255), +department VARCHAR(10), +country VARCHAR(255) +) PARTITION BY LIST COLUMNS (department, country) ( +PARTITION first_office VALUES IN (('dep1', 'Russia'), ('dep1', 'Croatia')), +PARTITION second_office VALUES IN (('dep2', 'Russia')) +); +INSERT INTO t1 VALUES(1, 'Ann', 'dep1', 'Russia'); +INSERT INTO t1 VALUES(2, 'Bob', 'dep1', 'Croatia'); +INSERT INTO t1 VALUES(3, 'Cecil', 'dep2', 'Russia'); +INSERT INTO t1 VALUES(3, 'Dan', 'dep2', 'Croatia'); +ERROR HY000: Table has no partition for value from column_list +SELECT PARTITION_NAME,TABLE_ROWS +FROM INFORMATION_SCHEMA.PARTITIONS +WHERE TABLE_NAME = 't1'; +PARTITION_NAME TABLE_ROWS +first_office 2 +second_office 1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `department` varchar(10) DEFAULT NULL, + `country` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50500 PARTITION BY LIST COLUMNS(department,country) +(PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM, + PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) */ +SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia'; +id name department country +SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia'; +id name department country +2 Bob dep1 Croatia +DROP TABLE t1; CREATE TABLE t1 (a DECIMAL) PARTITION BY RANGE COLUMNS (a) (PARTITION p0 VALUES LESS THAN (0)); @@ -168,22 +208,22 @@ partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE)); select partition_method, partition_expression, partition_description from information_schema.partitions where table_name = "t1"; partition_method partition_expression partition_description -RANGE COLUMNS a,b,c,d 1,'0',MAXVALUE,'1900-01-01' -RANGE COLUMNS a,b,c,d 1,'0',MAXVALUE,'1900-01-01' -RANGE COLUMNS a,b,c,d 1,'0',MAXVALUE,'1900-01-01' -RANGE COLUMNS a,b,c,d 1,'0',MAXVALUE,'1900-01-01' -RANGE COLUMNS a,b,c,d 1,'a',MAXVALUE,'1999-01-01' -RANGE COLUMNS a,b,c,d 1,'a',MAXVALUE,'1999-01-01' -RANGE COLUMNS a,b,c,d 1,'a',MAXVALUE,'1999-01-01' -RANGE COLUMNS a,b,c,d 1,'a',MAXVALUE,'1999-01-01' -RANGE COLUMNS a,b,c,d 1,'b',MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,'b',MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,'b',MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,'b',MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE -RANGE COLUMNS a,b,c,d 1,MAXVALUE,MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'0',MAXVALUE,'1900-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'0',MAXVALUE,'1900-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'0',MAXVALUE,'1900-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'0',MAXVALUE,'1900-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'a',MAXVALUE,'1999-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'a',MAXVALUE,'1999-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'a',MAXVALUE,'1999-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'a',MAXVALUE,'1999-01-01' +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'b',MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'b',MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'b',MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,'b',MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,MAXVALUE,MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,MAXVALUE,MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,MAXVALUE,MAXVALUE,MAXVALUE +RANGE COLUMNS `a`,`b`,`c`,`d` 1,MAXVALUE,MAXVALUE,MAXVALUE show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -266,9 +306,9 @@ partition p2 values in ((3, NULL), (NULL, 1))); select partition_method, partition_expression, partition_description from information_schema.partitions where table_name = "t1"; partition_method partition_expression partition_description -LIST COLUMNS a,b (1,NULL),(2,NULL),(NULL,NULL) -LIST COLUMNS a,b (1,1),(2,2) -LIST COLUMNS a,b (3,NULL),(NULL,1) +LIST COLUMNS `a`,`b` (1,NULL),(2,NULL),(NULL,NULL) +LIST COLUMNS `a`,`b` (1,1),(2,2) +LIST COLUMNS `a`,`b` (3,NULL),(NULL,1) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -298,11 +338,11 @@ select * from t1 where a > 8; a b select * from t1 where a not between 8 and 8; a b +1 NULL 2 NULL +1 1 2 2 3 NULL -1 NULL -1 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -356,8 +396,8 @@ partition p1 values in (4, NULL, 3)); select partition_method, partition_expression, partition_description from information_schema.partitions where table_name = "t1"; partition_method partition_expression partition_description -LIST COLUMNS a 2,1 -LIST COLUMNS a 4,NULL,3 +LIST COLUMNS `a` 2,1 +LIST COLUMNS `a` 4,NULL,3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -393,18 +433,18 @@ partition p3 values less than (4,'abc','abc')); select partition_method, partition_expression, partition_description from information_schema.partitions where table_name = "t1"; partition_method partition_expression partition_description -RANGE COLUMNS a,b,c 1,'abc','abc' -RANGE COLUMNS a,b,c 1,'abc','abc' -RANGE COLUMNS a,b,c 1,'abc','abc' -RANGE COLUMNS a,b,c 2,'abc','abc' -RANGE COLUMNS a,b,c 2,'abc','abc' -RANGE COLUMNS a,b,c 2,'abc','abc' -RANGE COLUMNS a,b,c 3,'abc','abc' -RANGE COLUMNS a,b,c 3,'abc','abc' -RANGE COLUMNS a,b,c 3,'abc','abc' -RANGE COLUMNS a,b,c 4,'abc','abc' -RANGE COLUMNS a,b,c 4,'abc','abc' -RANGE COLUMNS a,b,c 4,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 1,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 1,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 1,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 2,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 2,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 2,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 3,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 3,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 3,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 4,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 4,'abc','abc' +RANGE COLUMNS `a`,`b`,`c` 4,'abc','abc' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -437,8 +477,8 @@ partition p1 values less than (1, 'B', 1)); select partition_method, partition_expression, partition_description from information_schema.partitions where table_name = "t1"; partition_method partition_expression partition_description -RANGE COLUMNS a,b,c 1,'A',1 -RANGE COLUMNS a,b,c 1,'B',1 +RANGE COLUMNS `a`,`b`,`c` 1,'A',1 +RANGE COLUMNS `a`,`b`,`c` 1,'B',1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index b506c2eb0cb..25addd7fdea 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -24,6 +24,76 @@ CREATE TEMPORARY TABLE tmp_t1 LIKE t1; ERROR HY000: Cannot create temporary table with partitions DROP TABLE t1; # +# Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with +# subpartitions +SET @org_mode=@@sql_mode; +SET @@sql_mode='NO_DIR_IN_CREATE'; +SELECT @@sql_mode; +@@sql_mode +NO_DIR_IN_CREATE +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +SUBPARTITION BY HASH(TO_DAYS(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE +DATA DIRECTORY = '/tmp/not-existing' +INDEX DIRECTORY = '/tmp/not-existing'); +Warnings: +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `purchased` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (YEAR(purchased)) +SUBPARTITION BY HASH (TO_DAYS(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +DROP TABLE t1; +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2 +(PARTITION p0 VALUES LESS THAN MAXVALUE +(SUBPARTITION sp0 +DATA DIRECTORY = '/tmp/not-existing' +INDEX DIRECTORY = '/tmp/not-existing', +SUBPARTITION sp1)); +Warnings: +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `purchased` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (YEAR(purchased)) +SUBPARTITION BY HASH (TO_DAYS(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE + (SUBPARTITION sp0 ENGINE = MyISAM, + SUBPARTITION sp1 ENGINE = MyISAM)) */ +DROP TABLE t1; +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE +DATA DIRECTORY = '/tmp/not-existing' +INDEX DIRECTORY = '/tmp/not-existing'); +Warnings: +Warning 1618 <DATA DIRECTORY> option ignored +Warning 1618 <INDEX DIRECTORY> option ignored +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL, + `purchased` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (YEAR(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +DROP TABLE t1; +SET @@sql_mode= @org_mode; +# # Bug#50392: insert_id is not reset for partitioned tables # auto_increment on duplicate entry CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 9ba1a0446dd..ef2277fef38 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1436,6 +1436,7 @@ DROP PROCEDURE p1; DROP FUNCTION f1; DROP TABLE t1; DROP EVENT ev1; +SHOW STORAGE ENGINES; CREATE USER test_u@localhost; GRANT PROCESS ON *.* TO test_u@localhost; SHOW ENGINE MYISAM MUTEX; diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index 01841bf27fc..b00d1585b29 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -47,7 +47,7 @@ create table t1 (s1 binary(2) primary key); insert into t1 values (0x01); insert into t1 values (0x0120); insert into t1 values (0x0100); -ERROR 23000: Duplicate entry '\x01\x00' for key 'PRIMARY' +ERROR 23000: Duplicate entry '\x01' for key 'PRIMARY' select hex(s1) from t1 order by s1; hex(s1) 0100 diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index d131fa2b4d5..d08f86909ba 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -966,3 +966,31 @@ max(case 1 when 1 then c else null end) 300.00 drop table t1; End of 5.0 tests +CREATE TABLE t1 (a INTEGER); +INSERT INTO t1 VALUES (NULL); +CREATE TABLE t2 (b INTEGER); +INSERT INTO t2 VALUES (NULL), (NULL); +SELECT b FROM t1 JOIN t2 WHERE CONVERT(a, DECIMAL)|CONVERT(b, DECIMAL); +b +DROP TABLE t1, t2; +CREATE TABLE t1 (col0 INTEGER, col1 REAL); +CREATE TABLE t2 (col0 INTEGER); +INSERT INTO t1 VALUES (0, 0.0), (NULL, NULL); +INSERT INTO t2 VALUES (1); +SELECT 1 FROM t1 +JOIN +( +SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0) +GROUP BY t2.col0 +) AS subq +WHERE t1.col1 + CAST(subq.col0 AS DECIMAL); +1 +SELECT 1 FROM t1 +JOIN +( +SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0) +GROUP BY t2.col0 +) AS subq +WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); +1 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result index 2cdd62655fa..b0ec756b651 100644 --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result @@ -8,14 +8,14 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c *** Please look in binlog_multi_engine.test if you have a diff here **** START TRANSACTION; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; COMMIT; TRUNCATE t1m; diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 6643c4557c2..86da7468892 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -412,13 +412,41 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB +master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` int(11) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB +master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */ reset master; diff --git a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result new file mode 100644 index 00000000000..17a473ff062 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result @@ -0,0 +1,53 @@ +SET @old_binlog_format= @@global.binlog_format; +INSTALL PLUGIN example SONAME 'ha_example.so'; +################################################################################ +# Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog +# format to STATEMENT and the transaction isolation level to READ COMMITTED as +# such changes force Innodb to accept changes in the row format. +# +# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed +# any error should be triggered. +# +# In contrast, CREATE TABLE ... SELECT should trigger the following error: +# ER_BINLOG_STMT_MODE_AND_ROW_ENGINE. +################################################################################ +SET binlog_format = STATEMENT; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +CREATE TABLE t_row (a VARCHAR(100)) ENGINE = InnoDB; +ALTER TABLE t_row ADD COLUMN b INT; +CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1); +CREATE INDEX i ON t_row(a); +CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row; +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. +DROP TABLE t_row; + + +################################################################################ +# Verifies if ER_BINLOG_ROW_MODE_AND_STMT_ENGINE happens by setting the binlog +# format to ROW and using a engine, i.e. EXAMPLE, that only supports STATEMENT. +# +# When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed +# the error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE is not triggered. Note that other +# errors are triggered due to restrictions in the engine. +# +# In contrast, CREATE TABLE ... SELECT should trigger the following error: +# ER_BINLOG_ROW_MODE_AND_STMT_ENGINE. +################################################################################ +SET binlog_format = ROW; +CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE; +ALTER TABLE t_stmt ADD COLUMN b INT; +ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE' +CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1); +CREATE INDEX i ON t_stmt(a); +ERROR 42000: Too many key parts specified; max 0 parts allowed +CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt; +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. +DROP TABLE t_stmt; + + +################################################################################ +# CLEAN UP # +################################################################################ +UNINSTALL PLUGIN example; +SET @@global.binlog_format = @old_binlog_format; +SET @@session.binlog_format = @old_binlog_format; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index cea3819cad3..9bf6f4de144 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -8,7 +8,7 @@ begin; insert into t1 values(1); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. commit; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info @@ -23,7 +23,7 @@ begin; insert into t1 values(2); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back @@ -42,7 +42,7 @@ savepoint my_savepoint; insert into t1 values(4); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. rollback to savepoint my_savepoint; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back @@ -65,7 +65,7 @@ savepoint my_savepoint; insert into t1 values(6); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. rollback to savepoint my_savepoint; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back @@ -95,7 +95,7 @@ begin; insert into t1 values(8); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. select get_lock("a",10); get_lock("a",10) 1 @@ -111,7 +111,7 @@ reset master; insert into t1 values(9); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -127,7 +127,7 @@ insert into t1 values(10); begin; insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -246,7 +246,7 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back create table t0 (n int); insert t0 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. set autocommit=1; insert into t0 select GET_LOCK("lock1",null); Warnings: @@ -418,6 +418,9 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100) master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (101,101) +master-bin.000001 # Query # # ROLLBACK master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2 reset master; create table t1 (a int) engine=innodb; @@ -429,7 +432,7 @@ begin; insert into t1 values(8); insert into t2 select * from t1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. select get_lock("a",10); get_lock("a",10) 1 diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result index e3250f00dbf..d6d44ccad8e 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result +++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result @@ -67,11 +67,8 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc SELECT sf_bug50192(); sf_bug50192() 1 -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. SHOW WARNINGS; Level Code Message -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. DROP FUNCTION sf_bug50192; DROP TRIGGER tr_bug50192; DROP TABLE t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_switch_inside_trans.result b/mysql-test/suite/binlog/r/binlog_switch_inside_trans.result index de224a190c2..48b6dfa61d9 100644 --- a/mysql-test/suite/binlog/r/binlog_switch_inside_trans.result +++ b/mysql-test/suite/binlog/r/binlog_switch_inside_trans.result @@ -1,5 +1,6 @@ set @save_binlog_format= @@global.binlog_format; set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates; +set @save_sql_log_bin= @@global.sql_log_bin; create table t1 (a int) engine= myisam; create table t2 (a int) engine= innodb; SELECT @@session.binlog_format; @@ -8,116 +9,148 @@ ROW SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 1 +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +1 SET AUTOCOMMIT=1; -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are -# writable outside a transaction. -# Current session values are ROW and FALSE, respectively. +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' +# are writable outside a transaction. +# Current session values are ROW, FALSE, TRUE, respectively. set @@session.binlog_format= statement; set @@session.binlog_direct_non_transactional_updates= TRUE; +set @@session.sql_log_bin= FALSE; SELECT @@session.binlog_format; @@session.binlog_format STATEMENT SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 1 +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +0 begin; -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # read-only inside a transaction with no preceding updates. -# Current session values are STATEMENT and TRUE, respectively. +# Current session values are STATEMENT, TRUE, FALSE, respectively. set @@session.binlog_format= mixed; ERROR HY000: Cannot modify @@session.binlog_format inside a transaction set @@session.binlog_direct_non_transactional_updates= FALSE; ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction +set @@session.sql_log_bin= FALSE; +ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction insert into t2 values (1); -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # read-only inside a transaction with preceding transactional updates. -# Current session values are STATEMENT and TRUE, respectively. +# Current session values are STATEMENT, TRUE and FALSE, respectively. set @@session.binlog_format= row; ERROR HY000: Cannot modify @@session.binlog_format inside a transaction set @@session.binlog_direct_non_transactional_updates= FALSE; ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction +set @@session.sql_log_bin= FALSE; +ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction commit; begin; insert into t1 values (2); -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format' +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # read-only inside a transaction with preceding non-transactional updates. -# Current session values are STATEMENT and TRUE, respectively. +# Current session values are STATEMENT, TRUE, FALSE, respectively. set @@session.binlog_format= mixed; ERROR HY000: Cannot modify @@session.binlog_format inside a transaction set @@session.binlog_direct_non_transactional_updates= FALSE; ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction +set @@session.sql_log_bin= FALSE; +ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction commit; -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # writable when AUTOCOMMIT=0, before a transaction has started. -# Current session values are STATEMENT and TRUE, respectively. +# Current session values are STATEMENT, TRUE, FALSE, respectively. set AUTOCOMMIT=0; set @@session.binlog_format= row; set @@session.binlog_direct_non_transactional_updates= FALSE; +set @@session.sql_log_bin= TRUE; SELECT @@session.binlog_format; @@session.binlog_format ROW SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 0 +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +1 insert into t1 values (3); -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # read-only inside an AUTOCOMMIT=0 transaction # with preceding non-transactional updates. -# Current session values are ROW and FALSE, respectively. +# Current session values are ROW, FALSE, TRUE, respectively. set @@session.binlog_format= statement; ERROR HY000: Cannot modify @@session.binlog_format inside a transaction set @@session.binlog_direct_non_transactional_updates= TRUE; ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction +set @@session.sql_log_bin= FALSE; +ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction SELECT @@session.binlog_format; @@session.binlog_format ROW SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 0 +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +1 commit; insert into t2 values (4); -# Test that the session variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# Test that the session variable 'binlog_format', +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # read-only inside an AUTOCOMMIT=0 transaction with # preceding transactional updates. -# Current session values are ROW and FALSE, respectively. +# Current session values are ROW, FALSE, TRUE, respectively. set @@session.binlog_format= statement; ERROR HY000: Cannot modify @@session.binlog_format inside a transaction set @@session.binlog_direct_non_transactional_updates= TRUE; ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction +set @@session.sql_log_bin= FALSE; +ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction SELECT @@session.binlog_format; @@session.binlog_format ROW SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 0 +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +1 commit; begin; insert into t2 values (5); # Test that the global variable 'binlog_format' and -# 'binlog_direct_non_transactional_updates' are +# 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are # writable inside a transaction. -# Current session values are ROW and FALSE, respectively. +# Current session values are ROW, FALSE, TRUE respectively. SELECT @@global.binlog_format; @@global.binlog_format ROW set @@global.binlog_format= statement; set @@global.binlog_direct_non_transactional_updates= TRUE; +set @@global.sql_log_bin= FALSE; SELECT @@global.binlog_format; @@global.binlog_format STATEMENT SELECT @@global.binlog_direct_non_transactional_updates; @@global.binlog_direct_non_transactional_updates 1 +SELECT @@global.sql_log_bin; +@@global.sql_log_bin +0 commit; set @@global.binlog_format= @save_binlog_format; set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct; +set @@global.sql_log_bin= @save_sql_log_bin; create table t3(a int, b int) engine= innodb; create table t4(a int) engine= innodb; create table t5(a int) engine= innodb; @@ -153,6 +186,23 @@ ERROR HY000: Cannot change the binlog direct flag inside a stored function or tr SELECT @@session.binlog_direct_non_transactional_updates; @@session.binlog_direct_non_transactional_updates 0 +create table t9(a int, b int) engine= innodb; +create table t10(a int) engine= innodb; +create table t11(a int) engine= innodb; +create trigger tr3 after insert on t9 for each row begin +insert into t10(a) values(1); +set @@session.sql_log_bin= TRUE; +insert into t10(a) values(2); +insert into t11(a) values(3); +end | +# Test that the session variable 'sql_log_bin' is +# read-only in sub-statements. +# Current session value is FALSE. +insert into t9(a,b) values(1,1); +ERROR HY000: Cannot change the sql_log_bin inside a stored function or trigger +SELECT @@session.sql_log_bin; +@@session.sql_log_bin +1 drop table t1; drop table t2; drop table t3; @@ -161,3 +211,6 @@ drop table t5; drop table t6; drop table t7; drop table t8; +drop table t9; +drop table t10; +drop table t11; diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt new file mode 100644 index 00000000000..ffa981152ea --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors-master.opt @@ -0,0 +1 @@ +--innodb $EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test new file mode 100644 index 00000000000..6514ff1f712 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test @@ -0,0 +1,95 @@ +################################################################################ +# BUG#50479 DDL stmt on row-only/stmt-only tables generate spurious +# binlog_format errors +# +# In the fix of BUG#39934 in 5.1-rep+3, errors are generated when +# binlog_format=row and a statement modifies a table restricted to +# statement-logging (ER_BINLOG_ROW_MODE_AND_STMT_ENGINE); or if +# binlog_format=statement and a statement modifies a table limited to +# row-logging (ER_BINLOG_STMT_MODE_AND_ROW_ENGINE). +# +# In this test case, we check if some DDL statements that lock tables do not +# trigger errors as they do not generate rows events and as such are harmless +# from the point of view of conflicts between the engine's supported logging +# format and the value of binlog_format. +# +# In particular, we check if: +# 1 - ALTER TABLE, CREATE INDEX and CREATE TRIGGER do not generate either +# ER_BINLOG_STMT_MODE_AND_ROW_ENGINE or ER_BINLOG_STMT_MODE_AND_ROW_ENGINE +# +# 2 - CREATE TABLE ... SELECT generates an error because the command can +# generate row events but CREATE TABLE without SELECT does not generate +# an error. +################################################################################ +--source include/have_innodb.inc +--source include/have_example_plugin.inc +--source include/have_log_bin.inc + +SET @old_binlog_format= @@global.binlog_format; +INSTALL PLUGIN example SONAME 'ha_example.so'; + +--echo ################################################################################ +--echo # Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog +--echo # format to STATEMENT and the transaction isolation level to READ COMMITTED as +--echo # such changes force Innodb to accept changes in the row format. +--echo # +--echo # When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed +--echo # any error should be triggered. +--echo # +--echo # In contrast, CREATE TABLE ... SELECT should trigger the following error: +--echo # ER_BINLOG_STMT_MODE_AND_ROW_ENGINE. +--echo ################################################################################ +SET binlog_format = STATEMENT; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +CREATE TABLE t_row (a VARCHAR(100)) ENGINE = InnoDB; + +ALTER TABLE t_row ADD COLUMN b INT; + +CREATE TRIGGER trig_row BEFORE INSERT ON t_row FOR EACH ROW INSERT INTO t_stmt VALUES (1); + +CREATE INDEX i ON t_row(a); + +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE +CREATE TABLE t_row_new ENGINE = InnoDB SELECT * FROM t_row; + +DROP TABLE t_row; + +--echo +--echo + +--echo ################################################################################ +--echo # Verifies if ER_BINLOG_ROW_MODE_AND_STMT_ENGINE happens by setting the binlog +--echo # format to ROW and using a engine, i.e. EXAMPLE, that only supports STATEMENT. +--echo # +--echo # When CREATE TABLE, ALTER TABLE, CREATE INDEX and CREATE TRIGGER are executed +--echo # the error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE is not triggered. Note that other +--echo # errors are triggered due to restrictions in the engine. +--echo # +--echo # In contrast, CREATE TABLE ... SELECT should trigger the following error: +--echo # ER_BINLOG_ROW_MODE_AND_STMT_ENGINE. +--echo ################################################################################ +SET binlog_format = ROW; +CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE; + +--error ER_NOT_SUPPORTED_YET +ALTER TABLE t_stmt ADD COLUMN b INT; + +CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1); + +--error ER_TOO_MANY_KEY_PARTS +CREATE INDEX i ON t_stmt(a); + +--error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE +CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt; + +DROP TABLE t_stmt; + +--echo +--echo + +--echo ################################################################################ +--echo # CLEAN UP # +--echo ################################################################################ +UNINSTALL PLUGIN example; +SET @@global.binlog_format = @old_binlog_format; +SET @@session.binlog_format = @old_binlog_format; diff --git a/mysql-test/suite/binlog/t/binlog_switch_inside_trans.test b/mysql-test/suite/binlog/t/binlog_switch_inside_trans.test index cdc94198933..06c5e78bd0e 100644 --- a/mysql-test/suite/binlog/t/binlog_switch_inside_trans.test +++ b/mysql-test/suite/binlog/t/binlog_switch_inside_trans.test @@ -10,107 +10,128 @@ source include/have_binlog_format_row.inc; set @save_binlog_format= @@global.binlog_format; set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates; +set @save_sql_log_bin= @@global.sql_log_bin; create table t1 (a int) engine= myisam; create table t2 (a int) engine= innodb; SELECT @@session.binlog_format; SELECT @@session.binlog_direct_non_transactional_updates; +SELECT @@session.sql_log_bin; SET AUTOCOMMIT=1; ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are ---echo # writable outside a transaction. ---echo # Current session values are ROW and FALSE, respectively. +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' +--echo # are writable outside a transaction. +--echo # Current session values are ROW, FALSE, TRUE, respectively. set @@session.binlog_format= statement; set @@session.binlog_direct_non_transactional_updates= TRUE; +set @@session.sql_log_bin= FALSE; SELECT @@session.binlog_format; SELECT @@session.binlog_direct_non_transactional_updates; +SELECT @@session.sql_log_bin; begin; ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # read-only inside a transaction with no preceding updates. ---echo # Current session values are STATEMENT and TRUE, respectively. +--echo # Current session values are STATEMENT, TRUE, FALSE, respectively. --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT set @@session.binlog_format= mixed; --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT set @@session.binlog_direct_non_transactional_updates= FALSE; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN +set @@session.sql_log_bin= FALSE; insert into t2 values (1); ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # read-only inside a transaction with preceding transactional updates. ---echo # Current session values are STATEMENT and TRUE, respectively. +--echo # Current session values are STATEMENT, TRUE and FALSE, respectively. --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT set @@session.binlog_format= row; --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT set @@session.binlog_direct_non_transactional_updates= FALSE; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN +set @@session.sql_log_bin= FALSE; commit; begin; insert into t1 values (2); ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format' +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # read-only inside a transaction with preceding non-transactional updates. ---echo # Current session values are STATEMENT and TRUE, respectively. +--echo # Current session values are STATEMENT, TRUE, FALSE, respectively. --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT set @@session.binlog_format= mixed; --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT set @@session.binlog_direct_non_transactional_updates= FALSE; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN +set @@session.sql_log_bin= FALSE; commit; ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # writable when AUTOCOMMIT=0, before a transaction has started. ---echo # Current session values are STATEMENT and TRUE, respectively. +--echo # Current session values are STATEMENT, TRUE, FALSE, respectively. set AUTOCOMMIT=0; set @@session.binlog_format= row; set @@session.binlog_direct_non_transactional_updates= FALSE; +set @@session.sql_log_bin= TRUE; SELECT @@session.binlog_format; SELECT @@session.binlog_direct_non_transactional_updates; +SELECT @@session.sql_log_bin; insert into t1 values (3); ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # read-only inside an AUTOCOMMIT=0 transaction --echo # with preceding non-transactional updates. ---echo # Current session values are ROW and FALSE, respectively. +--echo # Current session values are ROW, FALSE, TRUE, respectively. --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT set @@session.binlog_format= statement; --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT set @@session.binlog_direct_non_transactional_updates= TRUE; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN +set @@session.sql_log_bin= FALSE; SELECT @@session.binlog_format; SELECT @@session.binlog_direct_non_transactional_updates; +SELECT @@session.sql_log_bin; commit; insert into t2 values (4); ---echo # Test that the session variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # Test that the session variable 'binlog_format', +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # read-only inside an AUTOCOMMIT=0 transaction with --echo # preceding transactional updates. ---echo # Current session values are ROW and FALSE, respectively. +--echo # Current session values are ROW, FALSE, TRUE, respectively. --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT set @@session.binlog_format= statement; --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT set @@session.binlog_direct_non_transactional_updates= TRUE; +--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN +set @@session.sql_log_bin= FALSE; SELECT @@session.binlog_format; SELECT @@session.binlog_direct_non_transactional_updates; +SELECT @@session.sql_log_bin; commit; begin; insert into t2 values (5); --echo # Test that the global variable 'binlog_format' and ---echo # 'binlog_direct_non_transactional_updates' are +--echo # 'binlog_direct_non_transactional_updates' and 'sql_log_bin' are --echo # writable inside a transaction. ---echo # Current session values are ROW and FALSE, respectively. +--echo # Current session values are ROW, FALSE, TRUE respectively. SELECT @@global.binlog_format; set @@global.binlog_format= statement; set @@global.binlog_direct_non_transactional_updates= TRUE; + set @@global.sql_log_bin= FALSE; SELECT @@global.binlog_format; SELECT @@global.binlog_direct_non_transactional_updates; + SELECT @@global.sql_log_bin; commit; set @@global.binlog_format= @save_binlog_format; set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct; +set @@global.sql_log_bin= @save_sql_log_bin; create table t3(a int, b int) engine= innodb; create table t4(a int) engine= innodb; @@ -151,6 +172,25 @@ delimiter ;| insert into t6(a,b) values(1,1); SELECT @@session.binlog_direct_non_transactional_updates; +create table t9(a int, b int) engine= innodb; +create table t10(a int) engine= innodb; +create table t11(a int) engine= innodb; +delimiter |; +eval create trigger tr3 after insert on t9 for each row begin + insert into t10(a) values(1); + set @@session.sql_log_bin= TRUE; + insert into t10(a) values(2); + insert into t11(a) values(3); +end | +delimiter ;| + +--echo # Test that the session variable 'sql_log_bin' is +--echo # read-only in sub-statements. +--echo # Current session value is FALSE. +--error ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN +insert into t9(a,b) values(1,1); +SELECT @@session.sql_log_bin; + drop table t1; drop table t2; drop table t3; @@ -159,3 +199,6 @@ drop table t5; drop table t6; drop table t7; drop table t8; +drop table t9; +drop table t10; +drop table t11; diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def index a86136fec69..b6086edb2f0 100644 --- a/mysql-test/suite/binlog/t/disabled.def +++ b/mysql-test/suite/binlog/t/disabled.def @@ -9,6 +9,6 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763 -binlog_unsafe : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client - +binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763 +binlog_unsafe : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client +binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled diff --git a/mysql-test/suite/innodb/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result new file mode 100644 index 00000000000..54e972843f5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result @@ -0,0 +1,30 @@ +drop table if exists t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +SELECT * FROM t1; +d1 +1 +2 +SELECT * FROM t1; +d1 +1 +2 +INSERT INTO t1 VALUES(null); +ALTER TABLE t1 AUTO_INCREMENT = 3; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`d1`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +d1 +1 +2 +3 +4 +DROP TABLE t1; diff --git a/mysql-test/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result index abb8f3da072..a36b3a1a865 100644 --- a/mysql-test/r/innodb-autoinc.result +++ b/mysql-test/suite/innodb/r/innodb-autoinc.result @@ -868,35 +868,6 @@ Got one of the listed errors DROP TABLE t1; DROP TABLE t2; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -d1 -1 -2 -SELECT * FROM t1; -d1 -1 -2 -INSERT INTO t1 VALUES(null); -Got one of the listed errors -ALTER TABLE t1 AUTO_INCREMENT = 3; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`d1`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -d1 -1 -2 -3 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 1 @@ -1111,18 +1082,165 @@ c1 c2 3 innodb 4 NULL DROP TABLE t1; -CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; -CREATE INDEX i1 on T1(c2); -SHOW CREATE TABLE T1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; +CREATE INDEX i1 on t1(c2); +SHOW CREATE TABLE t1; Table Create Table -T1 CREATE TABLE `T1` ( +t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL AUTO_INCREMENT, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`), KEY `i1` (`c2`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 -INSERT INTO T1 (c2) values (0); -SELECT * FROM T1; +INSERT INTO t1 (c2) values (0); +SELECT * FROM t1; c1 c2 10 0 -DROP TABLE T1; +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C1` double NOT NULL AUTO_INCREMENT, + `C2` char(10) DEFAULT NULL, + PRIMARY KEY (`C1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `C1` float NOT NULL AUTO_INCREMENT, + `C2` char(10) DEFAULT NULL, + PRIMARY KEY (`C1`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SET c1 = 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 +INSERT INTO t1 SET c1 = 2; +INSERT INTO t1 SET c1 = -1; +SELECT * FROM t1; +c1 +-1 +1 +2 +INSERT INTO t1 SET c1 = -1; +Got one of the listed errors +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +REPLACE INTO t1 VALUES (-1); +SELECT * FROM t1; +c1 +-1 +1 +2 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); +SELECT * FROM t1; +c1 +-685113344 +2 +3 +4 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); +INSERT INTO t1 VALUES (4), (5), (6), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +4 +5 +6 +7 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +5 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); +SELECT * FROM t1; +c1 +-685113344 +1 +2 +3 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/r/innodb-consistent.result b/mysql-test/suite/innodb/r/innodb-consistent.result index 9115791b99c..9115791b99c 100644 --- a/mysql-test/r/innodb-consistent.result +++ b/mysql-test/suite/innodb/r/innodb-consistent.result diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 67fbe0dce02..5d67a06b80f 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -46,13 +46,6 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; -alter table t1 add unique index (c), add index (d); -ERROR HY000: Table 'test.t1#1' already exists -rename table `t1#1` to `t1#2`; -alter table t1 add unique index (c), add index (d); -ERROR HY000: Table 'test.t1#2' already exists -drop table `t1#2`; alter table t1 add unique index (c), add index (d); show create table t1; Table Create Table @@ -441,6 +434,7 @@ t3 CREATE TABLE `t3` ( KEY `c` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 alter table t2 drop index b, add index (b); +ERROR 42000: Incorrect index name 'b' show create table t2; Table Create Table t2 CREATE TABLE `t2` ( @@ -451,8 +445,8 @@ t2 CREATE TABLE `t2` ( `e` int(11) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `dc` (`d`,`c`), - KEY `c` (`c`), KEY `b` (`b`), + KEY `c` (`c`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE, CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`), CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`) @@ -841,48 +835,6 @@ test.t1 check status OK explain select * from t1 where b like 'adfd%'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where -create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb; -insert into t2 select a,left(b,255) from t1; -drop table t1; -rename table t2 to t1; -set innodb_lock_wait_timeout=1; -begin; -select a from t1 limit 1 for update; -a -22 -set innodb_lock_wait_timeout=1; -create index t1ba on t1 (b,a); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -begin; -select a from t1 limit 1 lock in share mode; -a -22 -create index t1ba on t1 (b,a); -drop index t1ba on t1; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -explain select a from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index -select a,sleep(2+a/100) from t1 order by b limit 3; -select sleep(1); -sleep(1) -0 -drop index t1ba on t1; -a sleep(2+a/100) -22 0 -44 0 -66 0 -explain select a from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort -select a from t1 order by b limit 3; -a -22 -66 -44 -commit; drop table t1; set global innodb_file_per_table=on; set global innodb_file_format='Barracuda'; @@ -1133,39 +1085,3 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; -CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); -BEGIN; -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -CREATE INDEX t1a ON t1(a); -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -ERROR HY000: Table definition has changed, please retry transaction -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -COMMIT; -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -a b -0 d -1 c -1 e -3 a -3 b -DROP TABLE t1; diff --git a/mysql-test/r/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result index ab7e9aa7b25..41f308788a2 100644 --- a/mysql-test/r/innodb-lock.result +++ b/mysql-test/suite/innodb/r/innodb-lock.result @@ -27,9 +27,10 @@ commit; drop table t1; # # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer -# works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary -# deadlock" and bug #37346 "innodb does not detect deadlock between -# update and alter table". +# works when LOCK TABLE ... WRITE is used due to fix for bugs #46272 +# "MySQL 5.4.4, new MDL: unnecessary and bug #37346 "innodb does not +# detect deadlock between update and alter table". But it still works +# for LOCK TABLE ... READ. # set @@innodb_table_locks=0; create table t1 (id integer primary key, x integer) engine=INNODB; @@ -61,4 +62,30 @@ commit; # Reap LOCK TABLE. unlock tables; # Connection 'con1'. +select * from t1 where id = 0 for update; +id x +0 1 +# Connection 'con2'. +# The below statement should not be blocked as LOCK TABLES ... READ +# does not take strong SQL-level lock on t1. SELECTs which do not +# conflict with transaction in the first connections should not be +# blocked. +lock table t1 read; +select * from t1; +id x +0 1 +1 1 +2 2 +select * from t1 where id = 1 lock in share mode; +id x +1 1 +unlock tables; +select * from t1; +id x +0 1 +1 1 +2 2 +commit; +# Connection 'con1'. +commit; drop table t1; diff --git a/mysql-test/r/innodb-replace.result b/mysql-test/suite/innodb/r/innodb-replace.result index c926bb89a2e..c926bb89a2e 100644 --- a/mysql-test/r/innodb-replace.result +++ b/mysql-test/suite/innodb/r/innodb-replace.result diff --git a/mysql-test/r/innodb-semi-consistent.result b/mysql-test/suite/innodb/r/innodb-semi-consistent.result index ca0e362ef80..ca0e362ef80 100644 --- a/mysql-test/r/innodb-semi-consistent.result +++ b/mysql-test/suite/innodb/r/innodb-semi-consistent.result diff --git a/mysql-test/suite/innodb/r/innodb-system-table-view.result b/mysql-test/suite/innodb/r/innodb-system-table-view.result new file mode 100644 index 00000000000..ffa57ee32ce --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-system-table-view.result @@ -0,0 +1,110 @@ +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; +TABLE_ID NAME FLAG N_COLS SPACE +11 SYS_FOREIGN 0 7 0 +12 SYS_FOREIGN_COLS 0 7 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; +INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE +11 ID_IND 11 3 1 302 0 +12 FOR_IND 11 0 1 303 0 +13 REF_IND 11 0 1 304 0 +14 ID_IND 12 3 2 305 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; +TABLE_ID NAME POS MTYPE PRTYPE LEN +11 ID 0 1 524292 0 +11 FOR_NAME 1 1 524292 0 +11 REF_NAME 2 1 524292 0 +11 N_COLS 3 6 0 4 +12 ID 0 1 524292 0 +12 POS 1 6 0 4 +12 FOR_COL_NAME 2 1 524292 0 +12 REF_COL_NAME 3 1 524292 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; +INDEX_ID NAME POS +11 ID 0 +12 FOR_NAME 0 +13 REF_NAME 0 +14 ID 0 +14 POS 1 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; +TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC MYSQL_HANDLES_OPENED +11 SYS_FOREIGN Uninitialized 0 0 0 0 0 0 +12 SYS_FOREIGN_COLS Uninitialized 0 0 0 0 0 0 +CREATE TABLE parent (id INT NOT NULL, +PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE child (id INT, parent_id INT, +INDEX par_ind (parent_id), +CONSTRAINT constraint_test +FOREIGN KEY (parent_id) REFERENCES parent(id) +ON DELETE CASCADE) ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/constraint_test test/child test/parent 1 1 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/constraint_test parent_id id 0 +INSERT INTO parent VALUES(1); +SELECT name, num_rows, mysql_handles_opened +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; +name num_rows mysql_handles_opened +test/parent 1 1 +SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; +NAME FLAG N_COLS SPACE +SYS_FOREIGN 0 7 0 +SYS_FOREIGN_COLS 0 7 0 +test/child 1 5 0 +test/parent 1 4 0 +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%parent%"); +name n_fields +PRIMARY 1 +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%child%"); +name n_fields +GEN_CLUST_INDEX 0 +par_ind 1 +SELECT name, pos, mtype, len +from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS +WHERE table_id In (SELECT table_id from +INFORMATION_SCHEMA.INNODB_SYS_TABLES +WHERE name LIKE "%child%"); +name pos mtype len +id 0 6 4 +parent_id 1 6 4 +DROP TABLE child; +DROP TABLE parent; +CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL, +PRIMARY KEY (id, newid)) ENGINE=INNODB; +CREATE TABLE child (id INT, parent_id INT, +INDEX par_ind (parent_id), +CONSTRAINT constraint_test +FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid) +ON DELETE CASCADE) ENGINE=INNODB; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +test/constraint_test test/child test/parent 2 1 +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +test/constraint_test id id 0 +test/constraint_test parent_id newid 1 +INSERT INTO parent VALUES(1, 9); +SELECT * FROM parent WHERE id IN (SELECT id FROM parent); +id newid +1 9 +SELECT name, num_rows, mysql_handles_opened +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; +name num_rows mysql_handles_opened +test/parent 1 2 +DROP TABLE child; +DROP TABLE parent; diff --git a/mysql-test/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 4f2009764fc..2e5585ee7af 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -169,10 +169,10 @@ Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 id A # NULL NULL BTREE -t1 1 parent_id 1 parent_id A # NULL NULL BTREE -t1 1 level 1 level A # NULL NULL BTREE +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 id A # NULL NULL BTREE +t1 1 parent_id 1 parent_id A # NULL NULL BTREE +t1 1 level 1 level A # NULL NULL BTREE drop table t1; CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, @@ -213,8 +213,8 @@ analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 skr 1 a A # NULL NULL YES BTREE +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 1 skr 1 a A # NULL NULL YES BTREE drop table t1; create table t1 (a int,b varchar(20),key(a)) engine=innodb; insert into t1 values (1,""), (2,"testing"); @@ -401,13 +401,13 @@ drop table t1; CREATE TABLE t1 (a int not null, b int not null,c int not null, key(a),primary key(a,b), unique(c),key(a),unique(b)); show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A # NULL NULL BTREE -t1 0 PRIMARY 2 b A # NULL NULL BTREE -t1 0 c 1 c A # NULL NULL BTREE -t1 0 b 1 b A # NULL NULL BTREE -t1 1 a 1 a A # NULL NULL BTREE -t1 1 a_2 1 a A # NULL NULL BTREE +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 a A # NULL NULL BTREE +t1 0 PRIMARY 2 b A # NULL NULL BTREE +t1 0 c 1 c A # NULL NULL BTREE +t1 0 b 1 b A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL BTREE +t1 1 a_2 1 a A # NULL NULL BTREE drop table t1; create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); alter table t1 engine=innodb; @@ -692,6 +692,8 @@ select count(*) from t1 where sca_pic is null; count(*) 2 alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); +alter table t1 drop index sca_pic; +alter table t1 add index sca_pic (cat_code, sca_pic); select count(*) from t1 where sca_code='PD' and sca_pic is null; count(*) 1 @@ -699,6 +701,9 @@ select count(*) from t1 where cat_code='E'; count(*) 0 alter table t1 drop index sca_pic, add index (sca_pic, cat_code); +ERROR 42000: Incorrect index name 'sca_pic' +alter table t1 drop index sca_pic; +alter table t1 add index (sca_pic, cat_code); select count(*) from t1 where sca_code='PD' and sca_pic is null; count(*) 1 @@ -743,8 +748,8 @@ Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A # NULL NULL BTREE +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 a A # NULL NULL BTREE drop table t1; create table t1 (i int, j int ) ENGINE=innodb; insert into t1 values (1,2); @@ -1179,82 +1184,6 @@ a b 8 8 9 9 drop table t1; -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -update t1,t2 set t1.a=t1.a+100; -select * from t1; -a b -101 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; -a b -201 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; -a b -201 1 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -a b -201 1 -103 5 -104 6 -106 6 -105 7 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -select * from t2; -a b -1 1 -2 2 -6 6 -7 7 -8 8 -9 9 -3 13 -4 14 -5 15 -drop table t1,t2; CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; @@ -1643,12 +1572,6 @@ ERROR 42S21: Duplicate column name 'c1' alter table t1 add key (c1,c1,c2); ERROR 42S21: Duplicate column name 'c1' drop table t1; -create table t1(a int(1) , b int(1)) engine=innodb; -insert into t1 values ('1111', '3333'); -select distinct concat(a, b) from t1; -concat(a, b) -11113333 -drop table t1; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); ERROR HY000: The used table type doesn't support FULLTEXT indexes @@ -1738,7 +1661,7 @@ count(*) drop table t1; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; variable_value -512 +511 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; variable_value 16384 @@ -1747,10 +1670,10 @@ variable_value - @innodb_rows_deleted_orig 71 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; variable_value - @innodb_rows_inserted_orig -1084 +1065 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; variable_value - @innodb_rows_updated_orig -885 +865 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; variable_value - @innodb_row_lock_waits_orig 0 @@ -1833,6 +1756,7 @@ show variables like "innodb_thread_sleep_delay"; Variable_name Value innodb_thread_sleep_delay 10000 set storage_engine=INNODB; +set session old_alter_table=1; drop table if exists t1,t2,t3; --- Testing varchar --- --- Testing varchar --- @@ -1970,7 +1894,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref v v 13 const # Using where; Using index alter table t1 add unique(v); -ERROR 23000: Duplicate entry 'v' for key 'v_2' +ERROR 23000: Duplicate entry '{ ' for key 'v_2' alter table t1 add key(v); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; qq @@ -2406,6 +2330,7 @@ select * from t1 where a=20 and b is null; a b 20 NULL drop table t1; +set session old_alter_table=0; create table t1 (v varchar(65530), key(v)); Warnings: Warning 1071 Specified key was too long; max key length is 767 bytes @@ -2723,7 +2648,7 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; insert into t1 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY' +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' insert into t2 values (0x41),(0x4120); insert into t3 values (0x41),(0x4120),(0x4100); ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' @@ -2832,65 +2757,6 @@ t2 CREATE TABLE `t2` ( KEY `t2_ibfk_0` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t2,t1; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | -commit; -set autocommit = 0; -update t1 set b = 5 where a = 2; -set autocommit = 0; -insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), -(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), -(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), -(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), -(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); -commit; -commit; -drop trigger t1t; -drop table t1; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -insert into t2(a) values (1),(2),(3); -insert into t3(a) values (1),(2),(3); -insert into t4(a) values (1),(2),(3); -insert into t3(a) values (5),(7),(8); -insert into t4(a) values (5),(7),(8); -insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); -create trigger t1t before insert on t1 for each row begin -INSERT INTO t2 SET a = NEW.a; -end | -create trigger t2t before insert on t2 for each row begin -DELETE FROM t3 WHERE a = NEW.a; -end | -create trigger t3t before delete on t3 for each row begin -UPDATE t4 SET b = b + 1 WHERE a = OLD.a; -end | -create trigger t4t before update on t4 for each row begin -UPDATE t5 SET b = b + 1 where a = NEW.a; -end | -commit; -set autocommit = 0; -update t1 set b = b + 5 where a = 1; -update t2 set b = b + 5 where a = 1; -update t3 set b = b + 5 where a = 1; -update t4 set b = b + 5 where a = 1; -insert into t5(a) values(20); -set autocommit = 0; -insert into t1(a) values(7); -insert into t2(a) values(8); -delete from t2 where a = 3; -update t4 set b = b + 1 where a = 3; -commit; -commit; -drop trigger t1t; -drop trigger t2t; -drop trigger t3t; -drop trigger t4t; -drop table t1, t2, t3, t4, t5; CREATE TABLE t1 ( field1 varchar(8) NOT NULL DEFAULT '', field2 varchar(8) NOT NULL DEFAULT '', diff --git a/mysql-test/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result index b8e0b15d50d..ffbfa8a337e 100644 --- a/mysql-test/r/innodb_bug21704.result +++ b/mysql-test/suite/innodb/r/innodb_bug21704.result @@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT; ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150) # Ensure that online column rename works. ALTER TABLE t1 CHANGE b c INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 # Test renaming the column in the referencing table @@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT; ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150) # Ensure that online column rename works. ALTER TABLE t2 CHANGE b c INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 # Test with self-referential constraints @@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT; ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150) # Ensure that online column rename works. ALTER TABLE t3 CHANGE c d INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 # Cleanup. diff --git a/mysql-test/r/innodb_bug34053.result b/mysql-test/suite/innodb/r/innodb_bug34053.result index 195775f74c8..195775f74c8 100644 --- a/mysql-test/r/innodb_bug34053.result +++ b/mysql-test/suite/innodb/r/innodb_bug34053.result diff --git a/mysql-test/r/innodb_bug34300.result b/mysql-test/suite/innodb/r/innodb_bug34300.result index ae9fee81ad7..ae9fee81ad7 100644 --- a/mysql-test/r/innodb_bug34300.result +++ b/mysql-test/suite/innodb/r/innodb_bug34300.result diff --git a/mysql-test/r/innodb_bug35220.result b/mysql-test/suite/innodb/r/innodb_bug35220.result index 195775f74c8..195775f74c8 100644 --- a/mysql-test/r/innodb_bug35220.result +++ b/mysql-test/suite/innodb/r/innodb_bug35220.result diff --git a/mysql-test/suite/innodb/r/innodb_bug38231.result b/mysql-test/suite/innodb/r/innodb_bug38231.result new file mode 100644 index 00000000000..41a40542b84 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug38231.result @@ -0,0 +1,11 @@ +SET storage_engine=InnoDB; +INSERT INTO bug38231_2 VALUES (1), (10), (300); +SET autocommit=0; +SELECT * FROM bug38231_2 FOR UPDATE; +a +1 +10 +300 +TRUNCATE TABLE bug38231_2; +COMMIT; +DROP TABLE bug38231_2; diff --git a/mysql-test/r/innodb_bug39438.result b/mysql-test/suite/innodb/r/innodb_bug39438.result index 195775f74c8..195775f74c8 100644 --- a/mysql-test/r/innodb_bug39438.result +++ b/mysql-test/suite/innodb/r/innodb_bug39438.result diff --git a/mysql-test/r/innodb_bug40565.result b/mysql-test/suite/innodb/r/innodb_bug40565.result index 21e923d9336..21e923d9336 100644 --- a/mysql-test/r/innodb_bug40565.result +++ b/mysql-test/suite/innodb/r/innodb_bug40565.result diff --git a/mysql-test/r/innodb_bug42101-nonzero.result b/mysql-test/suite/innodb/r/innodb_bug42101-nonzero.result index f43cb9da239..f43cb9da239 100644 --- a/mysql-test/r/innodb_bug42101-nonzero.result +++ b/mysql-test/suite/innodb/r/innodb_bug42101-nonzero.result diff --git a/mysql-test/r/innodb_bug42101.result b/mysql-test/suite/innodb/r/innodb_bug42101.result index 4e3367d5a54..4e3367d5a54 100644 --- a/mysql-test/r/innodb_bug42101.result +++ b/mysql-test/suite/innodb/r/innodb_bug42101.result diff --git a/mysql-test/r/innodb_bug44369.result b/mysql-test/suite/innodb/r/innodb_bug44369.result index ff25c774aa2..ff25c774aa2 100644 --- a/mysql-test/r/innodb_bug44369.result +++ b/mysql-test/suite/innodb/r/innodb_bug44369.result diff --git a/mysql-test/suite/innodb/r/innodb_bug44571.result b/mysql-test/suite/innodb/r/innodb_bug44571.result new file mode 100644 index 00000000000..7ee7820a02d --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug44571.result @@ -0,0 +1,8 @@ +CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; +ALTER TABLE bug44571 CHANGE foo bar INT; +ALTER TABLE bug44571 ADD INDEX bug44571b (foo); +ERROR 42000: Key column 'foo' doesn't exist in table +ALTER TABLE bug44571 ADD INDEX bug44571c (bar); +DROP INDEX bug44571c ON bug44571; +CREATE INDEX bug44571c ON bug44571 (bar); +DROP TABLE bug44571; diff --git a/mysql-test/r/innodb_bug45357.result b/mysql-test/suite/innodb/r/innodb_bug45357.result index 7adeff2062f..7adeff2062f 100644 --- a/mysql-test/r/innodb_bug45357.result +++ b/mysql-test/suite/innodb/r/innodb_bug45357.result diff --git a/mysql-test/r/innodb_bug46000.result b/mysql-test/suite/innodb/r/innodb_bug46000.result index c8e3db8d641..c8e3db8d641 100644 --- a/mysql-test/r/innodb_bug46000.result +++ b/mysql-test/suite/innodb/r/innodb_bug46000.result diff --git a/mysql-test/suite/innodb/r/innodb_bug47621.result b/mysql-test/suite/innodb/r/innodb_bug47621.result new file mode 100644 index 00000000000..c5f56c09788 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug47621.result @@ -0,0 +1,21 @@ +CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; +ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; +create index orgs on bug47621(sales_acct_id); +ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; +drop table bug47621; +CREATE TABLE bug47621_sale ( +salesperson INT, +PRIMARY KEY(salesperson)) engine = innodb; +CREATE TABLE bug47621_shirt( +id SMALLINT, +owner INT, +FOREIGN KEY(owner) +references bug47621_sale(salesperson) ON DELETE RESTRICT) +engine = innodb; +insert into bug47621_sale values(9); +insert into bug47621_shirt values(1, 9); +ALTER TABLE bug47621_shirt CHANGE id new_id INT; +drop table bug47621_shirt; +ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; +ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); +drop table bug47621_sale; diff --git a/mysql-test/suite/innodb/r/innodb_bug47622.result b/mysql-test/suite/innodb/r/innodb_bug47622.result new file mode 100644 index 00000000000..f5d13711c52 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug47622.result @@ -0,0 +1,23 @@ +CREATE TABLE bug47622( +`rule_key` int(11) NOT NULL DEFAULT '0', +`seq` smallint(6) NOT NULL DEFAULT '0', +`action` smallint(6) NOT NULL DEFAULT '0', +`arg_id` smallint(6) DEFAULT NULL, +`else_ind` TINYINT NOT NULL, +KEY IDX_A (`arg_id`) +) ENGINE=InnoDB; +ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id); +drop index IDX_B on bug47622; +create index idx on bug47622(seq, arg_id); +ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action); +drop table bug47622; +CREATE TABLE bug47622 ( +`a` int(11) NOT NULL, +`b` int(11) DEFAULT NULL, +`c` char(10) DEFAULT NULL, +`d` varchar(20) DEFAULT NULL, +PRIMARY KEY (`a`), +KEY `b` (`b`) +) ENGINE=InnoDB; +alter table bug47622 add unique index (c), add index (d); +drop table bug47622; diff --git a/mysql-test/r/innodb_bug47777.result b/mysql-test/suite/innodb/r/innodb_bug47777.result index fbba47edcfc..fbba47edcfc 100644 --- a/mysql-test/r/innodb_bug47777.result +++ b/mysql-test/suite/innodb/r/innodb_bug47777.result diff --git a/mysql-test/suite/innodb/r/innodb_bug48024.result b/mysql-test/suite/innodb/r/innodb_bug48024.result new file mode 100644 index 00000000000..611923d2796 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug48024.result @@ -0,0 +1,10 @@ +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b); +DROP TABLE bug48024,bug48024_b; +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)| +DROP TABLE bug48024,bug48024_b; diff --git a/mysql-test/suite/innodb/r/innodb_bug49164.result b/mysql-test/suite/innodb/r/innodb_bug49164.result new file mode 100644 index 00000000000..9456702e1d0 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug49164.result @@ -0,0 +1,42 @@ +SET tx_isolation = 'READ-COMMITTED'; +CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b)) +ENGINE=InnoDB; +insert into bug49164 values (1,1,1), (2,2,2), (3,3,3); +begin; +update bug49164 set c=7; +select * from bug49164; +a b c +1 1 7 +2 2 7 +3 3 7 +rollback; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +begin; +update bug49164 set c=7; +SET tx_isolation = 'READ-COMMITTED'; +begin; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +commit; +begin; +update bug49164 set c=6 where a=1 and b=1; +rollback; +select * from bug49164; +a b c +1 1 1 +2 2 2 +3 3 3 +commit; +select * from bug49164; +a b c +1 1 6 +2 2 2 +3 3 3 +drop table bug49164; diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb/r/innodb_bug51378.result new file mode 100644 index 00000000000..a3ca73c16a9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug51378.result @@ -0,0 +1,66 @@ +create table bug51378 ( +col1 int not null, +col2 blob not null, +col3 time not null) engine = innodb; +create unique index idx on bug51378(col1, col2(31)); +alter table bug51378 add unique index idx2(col1, col2(31)); +create unique index idx3 on bug51378(col1, col3); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + UNIQUE KEY `idx3` (`col1`,`col3`), + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop index idx3 on bug51378; +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +alter table bug51378 add primary key idx3(col1, col2(31)); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + PRIMARY KEY (`col1`,`col2`(31)), + UNIQUE KEY `idx` (`col1`,`col2`(31)), + UNIQUE KEY `idx2` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table bug51378; +create table bug51378 ( +col1 int not null, +col2 blob not null, +col3 time not null, primary key(col1, col2(31))) engine = innodb; +create unique index idx on bug51378(col1, col2(31)); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` blob NOT NULL, + `col3` time NOT NULL, + PRIMARY KEY (`col1`,`col2`(31)), + UNIQUE KEY `idx` (`col1`,`col2`(31)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table bug51378; +create table bug51378 ( +col1 int not null, +col2 int ) engine = innodb; +create unique index idx on bug51378(col1, col2); +SHOW CREATE TABLE bug51378; +Table Create Table +bug51378 CREATE TABLE `bug51378` ( + `col1` int(11) NOT NULL, + `col2` int(11) DEFAULT NULL, + UNIQUE KEY `idx` (`col1`,`col2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table bug51378; diff --git a/mysql-test/suite/innodb/r/innodb_bug51920.result b/mysql-test/suite/innodb/r/innodb_bug51920.result new file mode 100644 index 00000000000..7ded141c239 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug51920.result @@ -0,0 +1,13 @@ +CREATE TABLE bug51920 (i INT) ENGINE=InnoDB; +INSERT INTO bug51920 VALUES (1); +BEGIN; +SELECT * FROM bug51920 FOR UPDATE; +i +1 +UPDATE bug51920 SET i=2; +SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE INFO="UPDATE bug51920 SET i=2" +INTO @thread_id; +KILL @thread_id; +Got one of the listed errors +DROP TABLE bug51920; diff --git a/mysql-test/suite/innodb/r/innodb_bug52663.result b/mysql-test/suite/innodb/r/innodb_bug52663.result new file mode 100644 index 00000000000..89add18617b --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug52663.result @@ -0,0 +1,26 @@ +set session transaction isolation level read committed; +create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key +(what, id)) engine=innodb; +insert into innodb_bug52663 values ('total', 0, 0); +begin; +set session transaction isolation level read committed; +begin; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; +what id count +total 0 1 +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from innodb_bug52663; +what id count +total 0 0 +commit; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +commit; +select * from innodb_bug52663; +what id count +total 0 2 +select * from innodb_bug52663; +what id count +total 0 2 +drop table innodb_bug52663; diff --git a/mysql-test/suite/innodb/r/innodb_bug52745.result b/mysql-test/suite/innodb/r/innodb_bug52745.result new file mode 100644 index 00000000000..254c6525257 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug52745.result @@ -0,0 +1,130 @@ +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=on; +CREATE TABLE bug52745 ( +a2 int(10) unsigned DEFAULT NULL, +col37 time DEFAULT NULL, +col38 char(229) CHARACTER SET utf8 DEFAULT NULL, +col39 text, +col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +col41 int(10) unsigned DEFAULT NULL, +col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL, +col43 smallint(5) unsigned zerofill DEFAULT NULL, +col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL, +col45 float unsigned zerofill DEFAULT NULL, +col46 binary(1) DEFAULT NULL, +col47 tinyint(4) DEFAULT NULL, +col48 tinyint(1) DEFAULT NULL, +col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +col50 binary(1) DEFAULT NULL, +col51 double unsigned zerofill DEFAULT NULL, +col52 int(10) unsigned DEFAULT NULL, +col53 time DEFAULT NULL, +col54 double unsigned DEFAULT NULL, +col55 time DEFAULT NULL, +col56 mediumtext CHARACTER SET latin2, +col57 blob, +col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000', +col59 binary(1) DEFAULT NULL, +col60 longblob, +col61 time DEFAULT NULL, +col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci, +col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +col64 int(10) unsigned DEFAULT NULL, +col65 date DEFAULT NULL, +col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +col67 binary(1) DEFAULT NULL, +col68 tinyblob, +col69 date DEFAULT NULL, +col70 tinyint(3) unsigned zerofill DEFAULT NULL, +col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, +col72 datetime DEFAULT NULL, +col73 smallint(5) unsigned zerofill DEFAULT NULL, +col74 longblob, +col75 bit(34) DEFAULT NULL, +col76 float unsigned zerofill DEFAULT NULL, +col77 year(2) DEFAULT NULL, +col78 tinyint(3) unsigned DEFAULT NULL, +col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, +col80 datetime DEFAULT NULL, +col81 smallint(6) DEFAULT NULL, +col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, +col83 bigint(20) unsigned zerofill DEFAULT NULL, +col84 float unsigned zerofill DEFAULT NULL, +col85 double DEFAULT NULL, +col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, +col87 varbinary(221) DEFAULT NULL, +col88 double unsigned DEFAULT NULL, +col89 float unsigned zerofill DEFAULT NULL, +col90 tinyblob +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +Warnings: +Note 1291 Column 'col82' has duplicated value '' in ENUM +Note 1291 Column 'col82' has duplicated value '' in ENUM +INSERT INTO bug52745 SET +col40='0000-00-00 00:00:00', +col51=16547, +col53='7711484', +col54=-28604, +col55='7112612', +col56='wakefulness\'', +col57=repeat('absorbefacient\'',106), +col58=11027, +col59='AM09gW7', +col60=repeat('Noelani\'',16), +col61='2520576', +col62='substitutiv', +col63='19950106155112', +col64=-12038, +col65='86238806', +col66='19600719080256', +col68=repeat('Sagittarius\'',54), +col69='38943902', +col70=1232, +col71='Elora\'', +col74=repeat('zipp',11), +col75='0', +col76=23254, +col78=13247, +col79='56219', +col80='20500609035724', +col81=11632, +col82=7, +col84=-23863, +col85=6341, +col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', +col88=16894, +col89=6161, +col90=repeat('gale',48); +Warnings: +Warning 1265 Data truncated for column 'col53' at row 1 +Warning 1264 Out of range value for column 'col54' at row 1 +Warning 1265 Data truncated for column 'col59' at row 1 +Warning 1265 Data truncated for column 'col61' at row 1 +Warning 1264 Out of range value for column 'col64' at row 1 +Warning 1265 Data truncated for column 'col65' at row 1 +Warning 1264 Out of range value for column 'col66' at row 1 +Warning 1265 Data truncated for column 'col68' at row 1 +Warning 1265 Data truncated for column 'col69' at row 1 +Warning 1264 Out of range value for column 'col70' at row 1 +Warning 1264 Out of range value for column 'col78' at row 1 +Warning 1265 Data truncated for column 'col79' at row 1 +Warning 1264 Out of range value for column 'col84' at row 1 +SHOW WARNINGS; +Level Code Message +Warning 1265 Data truncated for column 'col53' at row 1 +Warning 1264 Out of range value for column 'col54' at row 1 +Warning 1265 Data truncated for column 'col59' at row 1 +Warning 1265 Data truncated for column 'col61' at row 1 +Warning 1264 Out of range value for column 'col64' at row 1 +Warning 1265 Data truncated for column 'col65' at row 1 +Warning 1264 Out of range value for column 'col66' at row 1 +Warning 1265 Data truncated for column 'col68' at row 1 +Warning 1265 Data truncated for column 'col69' at row 1 +Warning 1264 Out of range value for column 'col70' at row 1 +Warning 1264 Out of range value for column 'col78' at row 1 +Warning 1265 Data truncated for column 'col79' at row 1 +Warning 1264 Out of range value for column 'col84' at row 1 +DROP TABLE bug52745; +SET GLOBAL innodb_file_format=Antelope; +SET GLOBAL innodb_file_format_check=Antelope; +SET GLOBAL innodb_file_per_table=0; diff --git a/mysql-test/suite/innodb/r/innodb_bug53290.result b/mysql-test/suite/innodb/r/innodb_bug53290.result new file mode 100644 index 00000000000..46cd7248c4e --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53290.result @@ -0,0 +1,17 @@ +create table bug53290 (x bigint) engine=innodb; +insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),(); +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +alter table bug53290 add unique index `idx` (x); +drop table bug53290; diff --git a/mysql-test/suite/innodb/r/innodb_bug53591.result b/mysql-test/suite/innodb/r/innodb_bug53591.result new file mode 100644 index 00000000000..1f05b6d2a57 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53591.result @@ -0,0 +1,16 @@ +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=on; +set old_alter_table=0; +CREATE TABLE bug53591(a text charset utf8 not null) +ENGINE=InnoDB KEY_BLOCK_SIZE=1; +ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); +ERROR HY000: Too big row +SHOW WARNINGS; +Level Code Message +Error 139 Too big row +Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs +Error 1030 Got error 139 from storage engine +DROP TABLE bug53591; +SET GLOBAL innodb_file_format=Antelope; +SET GLOBAL innodb_file_format_check=Antelope; +SET GLOBAL innodb_file_per_table=0; diff --git a/mysql-test/suite/innodb/r/innodb_bug53592.result b/mysql-test/suite/innodb/r/innodb_bug53592.result new file mode 100644 index 00000000000..63b30f50413 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53592.result @@ -0,0 +1,43 @@ +set old_alter_table=0; +create table bug53592(a int) engine=innodb row_format=compact; +alter table bug53592 add column b text charset utf8; +alter table bug53592 add column c blob not null; +create index bug53592_b on bug53592(b(81)); +create unique index bug53592_c on bug53592(c(1)); +replace into bug53592 values (),(); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +check table bug53592; +Table Op Msg_type Msg_text +test.bug53592 check status OK +drop table bug53592; +set old_alter_table=1; +create table bug53592(a int) engine=innodb row_format=compact; +alter table bug53592 add column b text charset utf8; +alter table bug53592 add column c blob not null; +create index bug53592_b on bug53592(b(81)); +create unique index bug53592_c on bug53592(c(1)); +replace into bug53592 values (),(); +Warnings: +Warning 1364 Field 'c' doesn't have a default value +check table bug53592; +Table Op Msg_type Msg_text +test.bug53592 check status OK +drop table bug53592; +CREATE TABLE bug53592_1( +col1 int, col2 int, +PRIMARY KEY (col1, col2) +) ENGINE=InnoDB; +CREATE TABLE bug53592_2 ( +col int PRIMARY KEY, +FOREIGN KEY (col) REFERENCES bug53592_1 (col1) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO bug53592_1 VALUES (1, 2); +INSERT INTO bug53592_1 VALUES (3, 4); +INSERT INTO bug53592_2 VALUES (1); +INSERT INTO bug53592_2 VALUES (3); +UPDATE bug53592_1 SET col1 = 3 WHERE col2 = 2; +ERROR 23000: Upholding foreign key constraints for table 'bug53592_1', entry '3-2', key 1 would lead to a duplicate entry +drop table bug53592_2; +drop table bug53592_1; diff --git a/mysql-test/suite/innodb/r/innodb_bug53674.result b/mysql-test/suite/innodb/r/innodb_bug53674.result new file mode 100644 index 00000000000..c4021c2e7cd --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug53674.result @@ -0,0 +1,11 @@ +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +a +1 +2 +select * from bug53674 where a=(select a from bug53674 where a > 1); +a +2 +drop table bug53674; diff --git a/mysql-test/suite/innodb/r/innodb_file_format.result b/mysql-test/suite/innodb/r/innodb_file_format.result index 107025e4e52..6a573d8658e 100644 --- a/mysql-test/suite/innodb/r/innodb_file_format.result +++ b/mysql-test/suite/innodb/r/innodb_file_format.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value"); select @@innodb_file_format; @@innodb_file_format Antelope @@ -41,3 +40,4 @@ ERROR 42000: Variable 'innodb_file_format' can't be set to the value of 'off' select @@innodb_file_format_check; @@innodb_file_format_check Barracuda +set global innodb_file_format_check=antelope; diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result index 396cae579ce..ad8729804df 100644 --- a/mysql-test/suite/innodb/r/innodb_information_schema.result +++ b/mysql-test/suite/innodb/r/innodb_information_schema.result @@ -21,3 +21,46 @@ lock_table COUNT(*) "test"."t_max" 2 "test"."t_min" 2 "test"."`t'\""_str" 10 +Field Type Null Key Default Extra +trx_id varchar(18) NO +trx_state varchar(13) NO +trx_started datetime NO 0000-00-00 00:00:00 +trx_requested_lock_id varchar(81) YES NULL +trx_wait_started datetime YES NULL +trx_weight bigint(21) unsigned NO 0 +trx_mysql_thread_id bigint(21) unsigned NO 0 +trx_query varchar(1024) YES NULL +trx_operation_state varchar(64) YES NULL +trx_tables_in_use bigint(21) unsigned NO 0 +trx_tables_locked bigint(21) unsigned NO 0 +trx_lock_structs bigint(21) unsigned NO 0 +trx_lock_memory_bytes bigint(21) unsigned NO 0 +trx_rows_locked bigint(21) unsigned NO 0 +trx_rows_modified bigint(21) unsigned NO 0 +trx_concurrency_tickets bigint(21) unsigned NO 0 +trx_isolation_level varchar(16) NO +trx_unique_checks int(1) NO 0 +trx_foreign_key_checks int(1) NO 0 +trx_last_foreign_key_error varchar(256) YES NULL +trx_apative_hash_latched int(1) NO 0 +trx_adaptive_hash_timeout bigint(21) unsigned NO 0 +trx_operation_state varchar(64) YES NULL +trx_tables_in_use bigint(21) unsigned NO 0 +trx_tables_locked bigint(21) unsigned NO 0 +trx_lock_structs bigint(21) unsigned NO 0 +trx_lock_memory_bytes bigint(21) unsigned NO 0 +trx_rows_locked bigint(21) unsigned NO 0 +trx_rows_modified bigint(21) unsigned NO 0 +trx_concurrency_tickets bigint(21) unsigned NO 0 +trx_isolation_level varchar(16) NO +trx_unique_checks int(1) NO 0 +trx_foreign_key_checks int(1) NO 0 +trx_last_foreign_key_error varchar(256) YES NULL +trx_apative_hash_latched int(1) NO 0 +trx_adaptive_hash_timeout bigint(21) unsigned NO 0 +trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks +RUNNING 4 0 0 7 1 0 REPEATABLE READ 1 1 +trx_isolation_level trx_unique_checks trx_foreign_key_checks +SERIALIZABLE 0 0 +trx_state trx_isolation_level trx_last_foreign_key_error +RUNNING SERIALIZABLE `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`) diff --git a/mysql-test/suite/innodb/r/innodb_multi_update.result b/mysql-test/suite/innodb/r/innodb_multi_update.result new file mode 100644 index 00000000000..7af9b030d1f --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_multi_update.result @@ -0,0 +1,76 @@ +CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100; +select * from bug38999_1; +a b +101 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101; +select * from bug38999_1; +a b +201 1 +102 2 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2; +select * from bug38999_1; +a b +201 1 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100; +select * from bug38999_1; +a b +201 1 +103 5 +104 6 +106 6 +105 7 +107 7 +108 8 +109 9 +110 10 +111 11 +102 12 +112 12 +select * from bug38999_2; +a b +1 1 +2 2 +6 6 +7 7 +8 8 +9 9 +3 13 +4 14 +5 15 +drop table bug38999_1,bug38999_2; diff --git a/mysql-test/r/innodb_trx_weight.result b/mysql-test/suite/innodb/r/innodb_trx_weight.result index 195775f74c8..195775f74c8 100644 --- a/mysql-test/r/innodb_trx_weight.result +++ b/mysql-test/suite/innodb/r/innodb_trx_weight.result diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def index 6535ee27887..da04138fd0a 100644 --- a/mysql-test/suite/innodb/t/disabled.def +++ b/mysql-test/suite/innodb/t/disabled.def @@ -1 +1,12 @@ -innodb-index : Bug#49396 2009-12-03 test fails in embedded mode +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## +innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-44030.test b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test new file mode 100644 index 00000000000..17c836004a1 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test @@ -0,0 +1,43 @@ +-- source include/have_innodb.inc +# embedded server ignores 'delayed', so skip this +-- source include/not_embedded.inc + +let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from +# the index (PRIMARY) +# This test requires a restart of the server +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +SELECT * FROM t1; +# Restart the server +-- source include/restart_mysqld.inc +# The MySQL and InnoDB data dictionaries should now be out of sync. +# The select should print message to the error log +SELECT * FROM t1; +# MySQL have made a change (http://lists.mysql.com/commits/75268) that no +# longer results in the two data dictionaries being out of sync. If they +# revert their changes then this check for ER_AUTOINC_READ_FAILED will need +# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621. +#-- error ER_AUTOINC_READ_FAILED,1467 +INSERT INTO t1 VALUES(null); +ALTER TABLE t1 AUTO_INCREMENT = 3; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +DROP TABLE t1; + +# +# restore environment to the state it was before this test execution +# + +-- disable_query_log +eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test index 558de6a1060..c1cae16153e 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/suite/innodb/t/innodb-autoinc.test @@ -2,6 +2,8 @@ # embedded server ignores 'delayed', so skip this -- source include/not_embedded.inc +let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; + --disable_warnings drop table if exists t1; --enable_warnings @@ -478,28 +480,6 @@ INSERT INTO t2 SELECT c1 FROM t1; INSERT INTO t2 SELECT NULL FROM t1; DROP TABLE t1; DROP TABLE t2; -# -# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from -# the index (PRIMARY) -# This test requires a restart of the server -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -# Restart the server --- source include/restart_mysqld.inc -# The MySQL and InnoDB data dictionaries should now be out of sync. -# The select should print message to the error log -SELECT * FROM t1; --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 VALUES(null); -ALTER TABLE t1 AUTO_INCREMENT = 3; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -DROP TABLE t1; # If the user has specified negative values for an AUTOINC column then # InnoDB should ignore those values when setting the table's max value. @@ -610,9 +590,85 @@ DROP TABLE t1; # 47125: auto_increment start value is ignored if an index is created # and engine=innodb # -CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; -CREATE INDEX i1 on T1(c2); -SHOW CREATE TABLE T1; -INSERT INTO T1 (c2) values (0); -SELECT * FROM T1; -DROP TABLE T1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; +CREATE INDEX i1 on t1(c2); +SHOW CREATE TABLE t1; +INSERT INTO t1 (c2) values (0); +SELECT * FROM t1; +DROP TABLE t1; + +## +# 49032: Use the correct function to read the AUTOINC column value +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +# Restart the server +-- source include/restart_mysqld.inc +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +# Restart the server +-- source include/restart_mysqld.inc +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +## +# 47720: REPLACE INTO Autoincrement column with negative values +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 SET c1 = 1; +SHOW CREATE TABLE t1; +INSERT INTO t1 SET c1 = 2; +INSERT INTO t1 SET c1 = -1; +SELECT * FROM t1; +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 SET c1 = -1; +SHOW CREATE TABLE t1; +REPLACE INTO t1 VALUES (-1); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +## +# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL); +INSERT INTO t1 VALUES (4), (5), (6), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +# +# restore environment to the state it was before this test execution +# + +-- disable_query_log +eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/t/innodb-consistent-master.opt b/mysql-test/suite/innodb/t/innodb-consistent-master.opt index 8cca44767da..e76299453d3 100644 --- a/mysql-test/t/innodb-consistent-master.opt +++ b/mysql-test/suite/innodb/t/innodb-consistent-master.opt @@ -1 +1 @@ ---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/innodb-consistent.test b/mysql-test/suite/innodb/t/innodb-consistent.test index 791600fc8a7..bf829a74ea2 100644 --- a/mysql-test/t/innodb-consistent.test +++ b/mysql-test/suite/innodb/t/innodb-consistent.test @@ -1,58 +1,58 @@ --- source include/not_embedded.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
-# a consistent read of the source table.
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-
-# REPLACE INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-replace into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-# INSERT INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-insert into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-select * from t1;
-drop table t1;
-drop table t2;
-
-connection default;
-disconnect a;
-disconnect b;
+-- source include/not_embedded.inc +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do +# a consistent read of the source table. + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +set session transaction isolation level read committed; +create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; +create table t2 like t1; +insert into t2 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; + +# REPLACE INTO ... SELECT case +begin; +# this should not result in any locks on t2. +replace into t1 select * from t2; + +connection b; +set session transaction isolation level read committed; +set autocommit=0; +# should not cause a lock wait. +delete from t2 where a=5; +commit; +delete from t2; +commit; +connection a; +commit; + +# INSERT INTO ... SELECT case +begin; +# this should not result in any locks on t2. +insert into t1 select * from t2; + +connection b; +set session transaction isolation level read committed; +set autocommit=0; +# should not cause a lock wait. +delete from t2 where a=5; +commit; +delete from t2; +commit; +connection a; +commit; + +select * from t1; +drop table t1; +drop table t2; + +connection default; +disconnect a; +disconnect b; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index b5dd2e037e7..f7cf3050704 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -1,5 +1,7 @@ -- source include/have_innodb.inc +let $MYSQLD_DATADIR= `select @@datadir`; + let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb; @@ -19,16 +21,6 @@ show create table t1; alter table t1 add index (b); show create table t1; -# Check how existing tables interfere with temporary tables. -CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; - ---error 156 -alter table t1 add unique index (c), add index (d); -rename table `t1#1` to `t1#2`; ---error 156 -alter table t1 add unique index (c), add index (d); -drop table `t1#2`; - alter table t1 add unique index (c), add index (d); show create table t1; explain select * from t1 force index(c) order by c; @@ -139,6 +131,8 @@ show create table t4; --error ER_CANT_CREATE_TABLE alter table t3 add constraint dc foreign key (a) references t1(a); show create table t3; +# this should be fixed by MySQL (see Bug #51451) +--error ER_WRONG_NAME_FOR_INDEX alter table t2 drop index b, add index (b); show create table t2; --error ER_ROW_IS_REFERENCED_2 @@ -146,7 +140,9 @@ delete from t1; --error ER_CANT_DROP_FIELD_OR_KEY drop index dc on t4; # there is no foreign key dc on t3 ---replace_regex /'\.\/test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ +--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ +# Embedded server doesn't chdir to data directory +--replace_result $MYSQLD_DATADIR ./ master-data/ '' --error ER_ERROR_ON_RENAME alter table t3 drop foreign key dc; alter table t4 drop foreign key dc; @@ -157,7 +153,7 @@ select * from t2; drop table t2,t4,t3,t1; -- let charset = utf8 --- source suite/innodb/include/innodb-index.inc +-- source include/innodb-index.inc create table t1(a int not null, b int) engine = innodb; insert into t1 values (1,1),(1,1),(1,1),(1,1); @@ -292,66 +288,73 @@ show create table t1; check table t1; explain select * from t1 where b like 'adfd%'; +# The following tests are disabled because of the introduced timeouts for +# metadata locks at the MySQL level as part of the fix for +# Bug#45225 Locking: hang if drop table with no timeout +# The following commands now play with MySQL metadata locks instead of +# InnoDB locks +# start disabled45225_1 +## +## Test locking +## # -# Test locking +#create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb; +#insert into t2 select a,left(b,255) from t1; +#drop table t1; +#rename table t2 to t1; # - -create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb; -insert into t2 select a,left(b,255) from t1; -drop table t1; -rename table t2 to t1; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -set innodb_lock_wait_timeout=1; -begin; -# Obtain an IX lock on the table -select a from t1 limit 1 for update; -connection b; -set innodb_lock_wait_timeout=1; -# This would require an S lock on the table, conflicting with the IX lock. ---error ER_LOCK_WAIT_TIMEOUT -create index t1ba on t1 (b,a); -connection a; -commit; -begin; -# Obtain an IS lock on the table -select a from t1 limit 1 lock in share mode; -connection b; -# This will require an S lock on the table. No conflict with the IS lock. -create index t1ba on t1 (b,a); -# This would require an X lock on the table, conflicting with the IS lock. ---error ER_LOCK_WAIT_TIMEOUT -drop index t1ba on t1; -connection a; -commit; -explain select a from t1 order by b; ---send -select a,sleep(2+a/100) from t1 order by b limit 3; - -# The following DROP INDEX will succeed, altough the SELECT above has -# opened a read view. However, during the execution of the SELECT, -# MySQL should hold a table lock that should block the execution -# of the DROP INDEX below. - -connection b; -select sleep(1); -drop index t1ba on t1; - -# After the index was dropped, subsequent SELECTs will use the same -# read view, but they should not be accessing the dropped index any more. - -connection a; -reap; -explain select a from t1 order by b; -select a from t1 order by b limit 3; -commit; - -connection default; -disconnect a; -disconnect b; - +#connect (a,localhost,root,,); +#connect (b,localhost,root,,); +#connection a; +#set innodb_lock_wait_timeout=1; +#begin; +## Obtain an IX lock on the table +#select a from t1 limit 1 for update; +#connection b; +#set innodb_lock_wait_timeout=1; +## This would require an S lock on the table, conflicting with the IX lock. +#--error ER_LOCK_WAIT_TIMEOUT +#create index t1ba on t1 (b,a); +#connection a; +#commit; +#begin; +## Obtain an IS lock on the table +#select a from t1 limit 1 lock in share mode; +#connection b; +## This will require an S lock on the table. No conflict with the IS lock. +#create index t1ba on t1 (b,a); +## This would require an X lock on the table, conflicting with the IS lock. +#--error ER_LOCK_WAIT_TIMEOUT +#drop index t1ba on t1; +#connection a; +#commit; +#explain select a from t1 order by b; +#--send +#select a,sleep(2+a/100) from t1 order by b limit 3; +# +## The following DROP INDEX will succeed, altough the SELECT above has +## opened a read view. However, during the execution of the SELECT, +## MySQL should hold a table lock that should block the execution +## of the DROP INDEX below. +# +#connection b; +#select sleep(1); +#drop index t1ba on t1; +# +## After the index was dropped, subsequent SELECTs will use the same +## read view, but they should not be accessing the dropped index any more. +# +#connection a; +#reap; +#explain select a from t1 order by b; +#select a from t1 order by b limit 3; +#commit; +# +#connection default; +#disconnect a; +#disconnect b; +# +# end disabled45225_1 drop table t1; let $per_table=`select @@innodb_file_per_table`; @@ -513,28 +516,34 @@ SHOW CREATE TABLE t2; DROP TABLE t2; DROP TABLE t1; -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); -connection b; -BEGIN; -SELECT * FROM t1; -connection a; -CREATE INDEX t1a ON t1(a); -connection b; -SELECT * FROM t1; ---error ER_TABLE_DEF_CHANGED -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -SELECT * FROM t1; -COMMIT; -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -connection default; -disconnect a; -disconnect b; - -DROP TABLE t1; +# The following tests are disabled because of the introduced timeouts for +# metadata locks at the MySQL level as part of the fix for +# Bug#45225 Locking: hang if drop table with no timeout +# The following CREATE INDEX t1a ON t1(a); causes a lock wait timeout +# start disabled45225_2 +#connect (a,localhost,root,,); +#connect (b,localhost,root,,); +#connection a; +#CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; +#INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); +#connection b; +#BEGIN; +#SELECT * FROM t1; +#connection a; +#CREATE INDEX t1a ON t1(a); +#connection b; +#SELECT * FROM t1; +#--error ER_TABLE_DEF_CHANGED +#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; +#SELECT * FROM t1; +#COMMIT; +#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; +#connection default; +#disconnect a; +#disconnect b; +# +#DROP TABLE t1; +# end disabled45225_2 # # restore environment to the state it was before this test execution diff --git a/mysql-test/suite/innodb/t/innodb-index_ucs2.test b/mysql-test/suite/innodb/t/innodb-index_ucs2.test index db4626ac346..fff9a4da1a8 100644 --- a/mysql-test/suite/innodb/t/innodb-index_ucs2.test +++ b/mysql-test/suite/innodb/t/innodb-index_ucs2.test @@ -2,4 +2,4 @@ -- source include/have_ucs2.inc -- let charset = ucs2 --- source suite/innodb/include/innodb-index.inc +-- source include/innodb-index.inc diff --git a/mysql-test/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test index d2f630ccaba..05df3615822 100644 --- a/mysql-test/t/innodb-lock.test +++ b/mysql-test/suite/innodb/t/innodb-lock.test @@ -58,9 +58,10 @@ drop table t1; --echo # --echo # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer ---echo # works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary ---echo # deadlock" and bug #37346 "innodb does not detect deadlock between ---echo # update and alter table". +--echo # works when LOCK TABLE ... WRITE is used due to fix for bugs #46272 +--echo # "MySQL 5.4.4, new MDL: unnecessary and bug #37346 "innodb does not +--echo # detect deadlock between update and alter table". But it still works +--echo # for LOCK TABLE ... READ. --echo # set @@innodb_table_locks=0; @@ -102,6 +103,26 @@ unlock tables; --echo # Connection 'con1'. connection con1; + +select * from t1 where id = 0 for update; + +--echo # Connection 'con2'. +connection con2; +--echo # The below statement should not be blocked as LOCK TABLES ... READ +--echo # does not take strong SQL-level lock on t1. SELECTs which do not +--echo # conflict with transaction in the first connections should not be +--echo # blocked. +lock table t1 read; +select * from t1; +select * from t1 where id = 1 lock in share mode; +unlock tables; +select * from t1; +commit; + +--echo # Connection 'con1'. +connection con1; +commit; + drop table t1; # End of 4.1 tests diff --git a/mysql-test/suite/innodb/t/innodb-master.opt b/mysql-test/suite/innodb/t/innodb-master.opt new file mode 100644 index 00000000000..4901efb416c --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-master.opt @@ -0,0 +1 @@ +--binlog_cache_size=32768 --innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/innodb-replace.test b/mysql-test/suite/innodb/t/innodb-replace.test index 8c3aacde5e8..8c3aacde5e8 100644 --- a/mysql-test/t/innodb-replace.test +++ b/mysql-test/suite/innodb/t/innodb-replace.test diff --git a/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt b/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt new file mode 100644 index 00000000000..e76299453d3 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/innodb-semi-consistent.test b/mysql-test/suite/innodb/t/innodb-semi-consistent.test index 61ad7815ca9..61ad7815ca9 100644 --- a/mysql-test/t/innodb-semi-consistent.test +++ b/mysql-test/suite/innodb/t/innodb-semi-consistent.test diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test new file mode 100644 index 00000000000..e570a33b59d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test @@ -0,0 +1,94 @@ +# This is the test for Information Schema System Table View +# that displays the InnoDB system table content through +# information schema tables. + +--source include/have_innodb.inc + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; + +# Create a foreign key constraint, and verify the information +# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and +# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS +CREATE TABLE parent (id INT NOT NULL, + PRIMARY KEY (id)) ENGINE=INNODB; + +CREATE TABLE child (id INT, parent_id INT, + INDEX par_ind (parent_id), + CONSTRAINT constraint_test + FOREIGN KEY (parent_id) REFERENCES parent(id) + ON DELETE CASCADE) ENGINE=INNODB; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; + +# Insert a row in the table "parent", and see whether that reflected in +# INNODB_SYS_TABLESTATS +INSERT INTO parent VALUES(1); + +SELECT name, num_rows, mysql_handles_opened +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; + +SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; + +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from + INFORMATION_SCHEMA.INNODB_SYS_TABLES + WHERE name LIKE "%parent%"); + +SELECT name, n_fields +from INFORMATION_SCHEMA.INNODB_SYS_INDEXES +WHERE table_id In (SELECT table_id from + INFORMATION_SCHEMA.INNODB_SYS_TABLES + WHERE name LIKE "%child%"); + +SELECT name, pos, mtype, len +from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS +WHERE table_id In (SELECT table_id from + INFORMATION_SCHEMA.INNODB_SYS_TABLES + WHERE name LIKE "%child%"); + +DROP TABLE child; + +DROP TABLE parent; + +# Create table with 2 columns in the foreign key constraint +CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL, + PRIMARY KEY (id, newid)) ENGINE=INNODB; + +CREATE TABLE child (id INT, parent_id INT, + INDEX par_ind (parent_id), + CONSTRAINT constraint_test + FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid) + ON DELETE CASCADE) ENGINE=INNODB; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; + +INSERT INTO parent VALUES(1, 9); + +# Nested query will open the table handle twice +SELECT * FROM parent WHERE id IN (SELECT id FROM parent); + +SELECT name, num_rows, mysql_handles_opened +FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS +WHERE name LIKE "%parent"; + +DROP TABLE child; + +DROP TABLE parent; diff --git a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt index 8ec086387f8..acf3b8729ed 100644 --- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt +++ b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt @@ -1,2 +1 @@ ---loose-innodb-use-sys-malloc=true ---loose-innodb-use-sys-malloc=true +--innodb-use-sys-malloc=true diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test index eb517563416..8ba83517b44 100644 --- a/mysql-test/suite/innodb/t/innodb-zip.test +++ b/mysql-test/suite/innodb/t/innodb-zip.test @@ -85,7 +85,8 @@ SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; drop table t1,t2; -# The following should fail even in non-strict mode. +# The following should fail in non-strict mode too. +# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.) SET SESSION innodb_strict_mode = off; --error ER_TOO_BIG_ROWSIZE CREATE TABLE t1( diff --git a/mysql-test/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index c4380ff8f43..a283cd26ccb 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # @@ -15,6 +21,8 @@ -- source include/have_innodb.inc +let $MYSQLD_DATADIR= `select @@datadir`; + # Save the original values of some variables in order to be able to # estimate how much they have changed during the tests. Previously this # test assumed that e.g. rows_deleted is 0 here and after deleting 23 @@ -425,11 +433,21 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code <= 'PD'; select count(*) from t1 where sca_pic is null; +# this should be fixed by MySQL (see Bug #51451) +# now that http://bugs.mysql.com/49838 is fixed the following ALTER does +# copy the table instead of failing +# --error ER_WRONG_NAME_FOR_INDEX alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); +alter table t1 drop index sca_pic; +alter table t1 add index sca_pic (cat_code, sca_pic); select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where cat_code='E'; +# this should be fixed by MySQL (see Bug #51451) +--error ER_WRONG_NAME_FOR_INDEX alter table t1 drop index sca_pic, add index (sca_pic, cat_code); +alter table t1 drop index sca_pic; +alter table t1 add index (sca_pic, cat_code); select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_pic >= 'n'; select sca_pic from t1 where sca_pic is null; @@ -903,33 +921,6 @@ UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; SELECT * from t1; drop table t1; -# -# Test multi update with different join methods -# - -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); - -# Full join, without key -update t1,t2 set t1.a=t1.a+100; -select * from t1; - -# unique key -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; - -# ref key -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; - -# Range key (in t1) -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -select * from t2; - -drop table t1,t2; CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=0; @@ -1225,11 +1216,11 @@ drop table t1; # # Bug #4082: integer truncation # - -create table t1(a int(1) , b int(1)) engine=innodb; -insert into t1 values ('1111', '3333'); -select distinct concat(a, b) from t1; -drop table t1; +# disable because the bug has resurfaced +#create table t1(a int(1) , b int(1)) engine=innodb; +#insert into t1 values ('1111', '3333'); +#select distinct concat(a, b) from t1; +#drop table t1; # # BUG#7709 test case - Boolean fulltext query against unsupported @@ -1317,7 +1308,7 @@ drop table t1; # Test for testable InnoDB status variables. This test # uses previous ones(pages_created, rows_deleted, ...). ---replace_result 511 512 +--replace_result 512 511 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; @@ -1375,7 +1366,10 @@ show variables like "innodb_thread_sleep_delay"; let $default=`select @@storage_engine`; set storage_engine=INNODB; +# this should be fixed by MySQL (see Bug #51451) +set session old_alter_table=1; source include/varchar.inc; +set session old_alter_table=0; # # Some errors/warnings on create @@ -1700,7 +1694,7 @@ set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLD_DATADIR ./ master-data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; @@ -1848,95 +1842,97 @@ DROP TABLE t2,t1; # # Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing # - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -delimiter |; -create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | -delimiter ;| -commit; -connection b; -set autocommit = 0; -update t1 set b = 5 where a = 2; -connection a; -set autocommit = 0; -insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), -(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), -(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), -(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), -(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); -connection b; -commit; -connection a; -commit; -drop trigger t1t; -drop table t1; -disconnect a; -disconnect b; -# -# Another trigger test -# -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -insert into t2(a) values (1),(2),(3); -insert into t3(a) values (1),(2),(3); -insert into t4(a) values (1),(2),(3); -insert into t3(a) values (5),(7),(8); -insert into t4(a) values (5),(7),(8); -insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); - -delimiter |; -create trigger t1t before insert on t1 for each row begin - INSERT INTO t2 SET a = NEW.a; -end | - -create trigger t2t before insert on t2 for each row begin - DELETE FROM t3 WHERE a = NEW.a; -end | - -create trigger t3t before delete on t3 for each row begin - UPDATE t4 SET b = b + 1 WHERE a = OLD.a; -end | - -create trigger t4t before update on t4 for each row begin - UPDATE t5 SET b = b + 1 where a = NEW.a; -end | -delimiter ;| -commit; -set autocommit = 0; -update t1 set b = b + 5 where a = 1; -update t2 set b = b + 5 where a = 1; -update t3 set b = b + 5 where a = 1; -update t4 set b = b + 5 where a = 1; -insert into t5(a) values(20); -connection b; -set autocommit = 0; -insert into t1(a) values(7); -insert into t2(a) values(8); -delete from t2 where a = 3; -update t4 set b = b + 1 where a = 3; -commit; -connection a; -commit; -connection b; -drop trigger t1t; -drop trigger t2t; -drop trigger t3t; -drop trigger t4t; -drop table t1, t2, t3, t4, t5; -connection default; -disconnect a; -disconnect b; +## the following cannot be tested after the introduction of metadata locks +## because the create trigger command blocks and waits for connection b to +## commit +## begin disabled_mdl +#connect (a,localhost,root,,); +#connect (b,localhost,root,,); +#connection a; +#create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#insert into t1(a) values (1),(2),(3); +#commit; +#connection b; +#set autocommit = 0; +#update t1 set b = 5 where a = 2; +#connection a; +#delimiter |; +#create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | +#delimiter ;| +#set autocommit = 0; +#connection a; +#insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), +#(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), +#(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), +#(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), +#(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); +#connection b; +#commit; +#connection a; +#commit; +#drop trigger t1t; +#drop table t1; +#disconnect a; +#disconnect b; +## +## Another trigger test +## +#connect (a,localhost,root,,); +#connect (b,localhost,root,,); +#connection a; +#create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; +#insert into t1(a) values (1),(2),(3); +#insert into t2(a) values (1),(2),(3); +#insert into t3(a) values (1),(2),(3); +#insert into t4(a) values (1),(2),(3); +#insert into t3(a) values (5),(7),(8); +#insert into t4(a) values (5),(7),(8); +#insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); +# +#delimiter |; +#create trigger t1t before insert on t1 for each row begin +# INSERT INTO t2 SET a = NEW.a; +#end | +# +#create trigger t2t before insert on t2 for each row begin +# DELETE FROM t3 WHERE a = NEW.a; +#end | +# +#create trigger t3t before delete on t3 for each row begin +# UPDATE t4 SET b = b + 1 WHERE a = OLD.a; +#end | +# +#create trigger t4t before update on t4 for each row begin +# UPDATE t5 SET b = b + 1 where a = NEW.a; +#end | +#delimiter ;| +#commit; +#set autocommit = 0; +#update t1 set b = b + 5 where a = 1; +#update t2 set b = b + 5 where a = 1; +#update t3 set b = b + 5 where a = 1; +#update t4 set b = b + 5 where a = 1; +#insert into t5(a) values(20); +#connection b; +#set autocommit = 0; +#insert into t1(a) values(7); +#insert into t2(a) values(8); +#delete from t2 where a = 3; +#update t4 set b = b + 1 where a = 3; +#commit; +#drop trigger t1t; +#drop trigger t2t; +#drop trigger t3t; +#drop trigger t4t; +#drop table t1, t2, t3, t4, t5; +#connection default; +#disconnect a; +#disconnect b; +## end disabled_mdl # # Test that cascading updates leading to duplicate keys give the correct @@ -2342,7 +2338,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; # mysqltest first does replace_regex, then replace_result --replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ # Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLD_DATADIR ./ master-data/ '' --error 1025 ALTER TABLE t2 MODIFY a INT NOT NULL; DELETE FROM t1; diff --git a/mysql-test/t/innodb_bug21704.test b/mysql-test/suite/innodb/t/innodb_bug21704.test index c649b61034c..c649b61034c 100644 --- a/mysql-test/t/innodb_bug21704.test +++ b/mysql-test/suite/innodb/t/innodb_bug21704.test diff --git a/mysql-test/t/innodb_bug34053.test b/mysql-test/suite/innodb/t/innodb_bug34053.test index b935e45c06d..b935e45c06d 100644 --- a/mysql-test/t/innodb_bug34053.test +++ b/mysql-test/suite/innodb/t/innodb_bug34053.test diff --git a/mysql-test/t/innodb_bug34300.test b/mysql-test/suite/innodb/t/innodb_bug34300.test index 68c385fd72a..68c385fd72a 100644 --- a/mysql-test/t/innodb_bug34300.test +++ b/mysql-test/suite/innodb/t/innodb_bug34300.test diff --git a/mysql-test/t/innodb_bug35220.test b/mysql-test/suite/innodb/t/innodb_bug35220.test index 26f7d6b1ddd..26f7d6b1ddd 100644 --- a/mysql-test/t/innodb_bug35220.test +++ b/mysql-test/suite/innodb/t/innodb_bug35220.test diff --git a/mysql-test/suite/innodb/t/innodb_bug36169.test b/mysql-test/suite/innodb/t/innodb_bug36169.test index 5bf55193b5c..5bbbf45d484 100644 --- a/mysql-test/suite/innodb/t/innodb_bug36169.test +++ b/mysql-test/suite/innodb/t/innodb_bug36169.test @@ -24,6 +24,7 @@ SET GLOBAL innodb_file_per_table=ON; # Generating 10 tables # Creating a table with 94 columns and 24 indexes DROP TABLE IF EXISTS `table0`; +set innodb_strict_mode=on; --error ER_TOO_BIG_ROWSIZE CREATE TABLE IF NOT EXISTS `table0` (`col0` BOOL, diff --git a/mysql-test/suite/innodb/t/innodb_bug38231.test b/mysql-test/suite/innodb/t/innodb_bug38231.test new file mode 100644 index 00000000000..a0a10bbd100 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug38231.test @@ -0,0 +1,100 @@ +# +# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK +# http://bugs.mysql.com/38231 +# + +-- source include/have_innodb.inc + +# skip this test in embedded mode because "TRUNCATE TABLE bug38231_1" +# hangs in that mode waiting for "lock_wait_timeout" although it is +# preceded by --send +-- source include/not_embedded.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug38231_1; +CREATE TABLE bug38231_1 (a INT); + +-- connect (lock_gain,localhost,root,,) +-- connect (lock_wait1,localhost,root,,) +-- connect (lock_wait2,localhost,root,,) +-- connect (truncate_wait,localhost,root,,) + +-- connection lock_gain +SET autocommit=0; +LOCK TABLE bug38231_1 WRITE; + +-- connection lock_wait1 +SET autocommit=0; +-- send +LOCK TABLE bug38231_1 WRITE; + +-- connection lock_wait2 +SET autocommit=0; +-- send +LOCK TABLE bug38231_1 WRITE; + +-- connection truncate_wait +-- send +TRUNCATE TABLE bug38231_1; + +-- connection lock_gain +# this crashes the server if the bug is present +UNLOCK TABLES; + +# clean up + +# do not clean up - we do not know which of the three has been released +# so the --reap command may hang because the command that is being executed +# in that connection is still running/waiting +#-- connection lock_wait1 +#-- reap +#UNLOCK TABLES; +# +#-- connection lock_wait2 +#-- reap +#UNLOCK TABLES; +# +#-- connection truncate_wait +#-- reap + +-- connection default + +-- disconnect lock_gain +-- disconnect lock_wait1 +-- disconnect lock_wait2 +-- disconnect truncate_wait + +DROP TABLE bug38231_1; + +# test that TRUNCATE works with row-level locks + +DROP TABLE IF EXISTS bug38231_2; +CREATE TABLE bug38231_2 (a INT); + +-- enable_query_log +-- enable_result_log + +INSERT INTO bug38231_2 VALUES (1), (10), (300); + +-- connect (con4,localhost,root,,) + +-- connection con4 +SET autocommit=0; +SELECT * FROM bug38231_2 FOR UPDATE; + +-- connection default +TRUNCATE TABLE bug38231_2; + +-- connection con4 +COMMIT; + +-- connection default + +-- disconnect con4 + +DROP TABLE bug38231_2; diff --git a/mysql-test/t/innodb_bug39438-master.opt b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt index 43fac202fd4..43fac202fd4 100644 --- a/mysql-test/t/innodb_bug39438-master.opt +++ b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt diff --git a/mysql-test/suite/innodb/t/innodb_bug39438.test b/mysql-test/suite/innodb/t/innodb_bug39438.test new file mode 100644 index 00000000000..52302871beb --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug39438.test @@ -0,0 +1,51 @@ +# +# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch +# http://bugs.mysql.com/39438 +# +# This test must be run with innodb_file_per_table=1 because the crash +# only occurs if that option is turned on and DISCARD TABLESPACE only +# works with innodb_file_per_table. +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug39438; + +CREATE TABLE bug39438 (id INT) ENGINE=INNODB; + +# remove: XXX Uncomment the following ALTER and remove those lines after +# remove: applying the patch. +# remove: Obviously this test is useless without this ALTER command, +# remove: but it causes warnings to be printed by mysqld and the whole +# remove: mysql-test suite fails at the end (returns non-zero). Please +# remove: apply this patch to the mysql source tree, remove those lines +# remove: and uncomment the following ALTER. We do not care about the +# remove: warnings, this test is to ensure mysqld does not crash. +# remove: === modified file 'mysql-test/lib/mtr_report.pl' +# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000 +# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000 +# remove: @@ -412,7 +412,10 @@ +# remove: +# remove: # When trying to set lower_case_table_names = 2 +# remove: # on a case sensitive file system. Bug#37402. +# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ +# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or +# remove: + +# remove: + # this test is expected to print warnings +# remove: + ($testname eq 'main.innodb_bug39438') +# remove: ) +# remove: { +# remove: next; # Skip these lines +# remove: +#ALTER TABLE bug39438 DISCARD TABLESPACE; + +# this crashes the server if the bug is present +SHOW TABLE STATUS; + +DROP TABLE bug39438; diff --git a/mysql-test/t/innodb_bug40565.test b/mysql-test/suite/innodb/t/innodb_bug40565.test index d7aa0fd514a..d7aa0fd514a 100644 --- a/mysql-test/t/innodb_bug40565.test +++ b/mysql-test/suite/innodb/t/innodb_bug40565.test diff --git a/mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt new file mode 100644 index 00000000000..d71dbe17d5b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt @@ -0,0 +1 @@ +--innodb_commit_concurrency=1 diff --git a/mysql-test/t/innodb_bug42101-nonzero.test b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero.test index 2e4cf1f46dd..2e4cf1f46dd 100644 --- a/mysql-test/t/innodb_bug42101-nonzero.test +++ b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero.test diff --git a/mysql-test/t/innodb_bug42101.test b/mysql-test/suite/innodb/t/innodb_bug42101.test index f0b88e034a0..f0b88e034a0 100644 --- a/mysql-test/t/innodb_bug42101.test +++ b/mysql-test/suite/innodb/t/innodb_bug42101.test diff --git a/mysql-test/t/innodb_bug44369.test b/mysql-test/suite/innodb/t/innodb_bug44369.test index f5d85cd5815..f5d85cd5815 100644 --- a/mysql-test/t/innodb_bug44369.test +++ b/mysql-test/suite/innodb/t/innodb_bug44369.test diff --git a/mysql-test/suite/innodb/t/innodb_bug44571.test b/mysql-test/suite/innodb/t/innodb_bug44571.test new file mode 100644 index 00000000000..91b6722d8af --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug44571.test @@ -0,0 +1,22 @@ +# +# Bug#44571 InnoDB Plugin crashes on ADD INDEX +# http://bugs.mysql.com/44571 +# Please also refer to related fix in +# http://bugs.mysql.com/47621 +# +-- source include/have_innodb.inc + +CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; +ALTER TABLE bug44571 CHANGE foo bar INT; +# Create index with the old column name will fail, +# because the CHANGE foo bar is successful. And +# the column name change would communicate to +# InnoDB with the fix from bug #47621 +-- error ER_KEY_COLUMN_DOES_NOT_EXITS +ALTER TABLE bug44571 ADD INDEX bug44571b (foo); +# The following create indexes should succeed, +# indirectly confirm the CHANGE foo bar is successful. +ALTER TABLE bug44571 ADD INDEX bug44571c (bar); +DROP INDEX bug44571c ON bug44571; +CREATE INDEX bug44571c ON bug44571 (bar); +DROP TABLE bug44571; diff --git a/mysql-test/t/innodb_bug45357.test b/mysql-test/suite/innodb/t/innodb_bug45357.test index 81727f352dd..81727f352dd 100644 --- a/mysql-test/t/innodb_bug45357.test +++ b/mysql-test/suite/innodb/t/innodb_bug45357.test diff --git a/mysql-test/t/innodb_bug46000.test b/mysql-test/suite/innodb/t/innodb_bug46000.test index 5a3c666326e..5a3c666326e 100644 --- a/mysql-test/t/innodb_bug46000.test +++ b/mysql-test/suite/innodb/t/innodb_bug46000.test diff --git a/mysql-test/suite/innodb/t/innodb_bug47621.test b/mysql-test/suite/innodb/t/innodb_bug47621.test new file mode 100644 index 00000000000..4863cc6bba1 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug47621.test @@ -0,0 +1,57 @@ +# This is the test for bug #47621, column rename operation should +# not result in column definition inconsistency between MySQL and +# InnoDB + +--source include/have_innodb.inc + +CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; + +# Change the column name +ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; + +# If there is inconsistency of column name definition +# in MySQL or InnoDB, following create index would fail +create index orgs on bug47621(sales_acct_id); + +# Change the column name back with the index defined on it. +ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; + +drop table bug47621; + +CREATE TABLE bug47621_sale ( + salesperson INT, + PRIMARY KEY(salesperson)) engine = innodb; + +CREATE TABLE bug47621_shirt( + id SMALLINT, + owner INT, + FOREIGN KEY(owner) + references bug47621_sale(salesperson) ON DELETE RESTRICT) + engine = innodb; + +insert into bug47621_sale values(9); + +insert into bug47621_shirt values(1, 9); + +# Any rename operation on columns involved in a reference constraint will +# fail, as it will be rejected by InnoDB row_rename_table_for_mysql(). +# In above example, any rename on column "salesperson" for table +# "bug47621_sale", or on column "owner" for table "bug47621_shirt will +# be blocked. We do not put such rename in the test since InnoDB error +# message will be printed in the error log, and result in test failure. +# +# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +# Any rename on columns not involved in the foreign key constraint +# could still proceed +ALTER TABLE bug47621_shirt CHANGE id new_id INT; + +# Referencing table dropped, the rename operation on related columns +# could proceed +drop table bug47621_shirt; + +ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; + +ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); + +drop table bug47621_sale; diff --git a/mysql-test/suite/innodb/t/innodb_bug47622.test b/mysql-test/suite/innodb/t/innodb_bug47622.test new file mode 100644 index 00000000000..9cf9d0e531b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug47622.test @@ -0,0 +1,55 @@ +# This is the test for bug 47622. There could be index +# metadata sequence mismatch between MySQL and Innodb +# after creating index through FIC interfaces. +# We resolve the problem by sync the index sequence +# up when opening the table. + +--source include/have_innodb.inc + +connect (a,localhost,root,,); +connect (b,localhost,root,,); + +# Create a table with a non-unique index +CREATE TABLE bug47622( + `rule_key` int(11) NOT NULL DEFAULT '0', + `seq` smallint(6) NOT NULL DEFAULT '0', + `action` smallint(6) NOT NULL DEFAULT '0', + `arg_id` smallint(6) DEFAULT NULL, + `else_ind` TINYINT NOT NULL, + KEY IDX_A (`arg_id`) +) ENGINE=InnoDB; + +connection a; + +# A subsequent creating unique index should not trigger +# any error message. Unique index would be ranked ahead +# of regular index. +ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id); + +drop index IDX_B on bug47622; + +# In another connection, create additional set of normal +# index and unique index. Again, unique index would be ranked +# ahead of regular index. +connection b; +create index idx on bug47622(seq, arg_id); + +ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action); + +drop table bug47622; + +# Create a table with one Primary key and a non-unique key +CREATE TABLE bug47622 ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB; + +# Add two index with one unique and one non-unique. +# Index sequence is "PRIMARY", "c", "b" and "d" +alter table bug47622 add unique index (c), add index (d); + +drop table bug47622; diff --git a/mysql-test/t/innodb_bug47777.test b/mysql-test/suite/innodb/t/innodb_bug47777.test index 8f2985b2cf0..8f2985b2cf0 100644 --- a/mysql-test/t/innodb_bug47777.test +++ b/mysql-test/suite/innodb/t/innodb_bug47777.test diff --git a/mysql-test/suite/innodb/t/innodb_bug48024.test b/mysql-test/suite/innodb/t/innodb_bug48024.test new file mode 100644 index 00000000000..db828aa1cda --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug48024.test @@ -0,0 +1,22 @@ +# Bug #48024 Innodb doesn't work with multi-statements + +--source include/have_innodb.inc + +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +# Bug #53644 InnoDB thinks that /*/ starts and ends a comment +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b); + +DROP TABLE bug48024,bug48024_b; + +# Work around Bug #53750 (failure in mysql-test-run --ps-protocol) +-- disable_ps_protocol +delimiter |; +CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB; +CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB; +ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/ +ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)| +delimiter ;| + +DROP TABLE bug48024,bug48024_b; diff --git a/mysql-test/suite/innodb/t/innodb_bug49164.test b/mysql-test/suite/innodb/t/innodb_bug49164.test new file mode 100644 index 00000000000..7f1c9f4ca9c --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug49164.test @@ -0,0 +1,47 @@ +-- source include/have_innodb.inc + +# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK +# a duplicate of +# Bug #52663 Lost update incrementing column value under READ COMMITTED + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +SET tx_isolation = 'READ-COMMITTED'; + +CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b)) +ENGINE=InnoDB; + +insert into bug49164 values (1,1,1), (2,2,2), (3,3,3); + +begin; +update bug49164 set c=7; +select * from bug49164; +rollback; +select * from bug49164; +begin; +update bug49164 set c=7; + +connection con2; + +SET tx_isolation = 'READ-COMMITTED'; +begin; +select * from bug49164; +commit; +begin; +--send +update bug49164 set c=6 where a=1 and b=1; + +connection con1; +rollback; +select * from bug49164; +connection con2; +reap; +commit; +connection con1; +select * from bug49164; +connection default; +disconnect con1; +disconnect con2; +drop table bug49164; diff --git a/mysql-test/suite/innodb/t/innodb_bug51378.test b/mysql-test/suite/innodb/t/innodb_bug51378.test new file mode 100644 index 00000000000..8f7b0b9605a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug51378.test @@ -0,0 +1,77 @@ +# This is the test for bug 51378. Unique index created +# through "create index" and "alter table add unique index" +# interfaces should not be treated as primary index if indexed +# columns contain one or more column prefix(es) (only prefix/part of +# the column is indexed) +# On the other hand, if there is a unique index covers all +# columns of a table, and they are non-null columns, and +# full length of the column are indexed, then this index +# will be created as primary index +# Following queries test various scenario, no mismatch +# error message should be printed. +--source include/have_innodb.inc + +# Create a table contains a BLOB column +create table bug51378 ( + col1 int not null, + col2 blob not null, + col3 time not null) engine = innodb; + +# Create following unique indexes on 'col1' and 'col2(31)' +# of the table, the index should not be treated as primary +# key because it indexes only first 31 bytes of col2. +# Thus it contains "column prefix", and will not be +# upgraded to primary index. +# There should not be mismatch message printed in the +# errorlog +create unique index idx on bug51378(col1, col2(31)); + +alter table bug51378 add unique index idx2(col1, col2(31)); + +# Unique index on 'col1' and 'col3' will be created as primary index, +# since the index does not contain column prefix +create unique index idx3 on bug51378(col1, col3); + +# Show create table would show idx3 created as unique index, internally, +# idx3 is treated as primary index both by MySQL and Innodb +SHOW CREATE TABLE bug51378; + +# "GEN_CLUST_INDEX" will be re-created as default primary index +# after idx3 is dropped +drop index idx3 on bug51378; + +SHOW CREATE TABLE bug51378; + +# Or we can add the primary key through alter table interfaces +alter table bug51378 add primary key idx3(col1, col2(31)); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; + +# Or we can create such primary key through create table interfaces +create table bug51378 ( + col1 int not null, + col2 blob not null, + col3 time not null, primary key(col1, col2(31))) engine = innodb; + +# Unique index on one or more column prefix(es) will be created +# as non-cluster index +create unique index idx on bug51378(col1, col2(31)); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; + +# If a table has a NULLABLE column, unique index on it will not +# be treated as primary index. +create table bug51378 ( + col1 int not null, + col2 int ) engine = innodb; + +# This will be created as non-cluster index since col2 is nullable +create unique index idx on bug51378(col1, col2); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test new file mode 100644 index 00000000000..bc3bb006c1c --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug51920.test @@ -0,0 +1,43 @@ +# +# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout +# +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +CREATE TABLE bug51920 (i INT) ENGINE=InnoDB; +INSERT INTO bug51920 VALUES (1); + +BEGIN; +SELECT * FROM bug51920 FOR UPDATE; + +connect (con1,localhost,root,,); + +connection con1; +--send +UPDATE bug51920 SET i=2; + +connection default; +let $wait_condition = + SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE INFO="UPDATE bug51920 SET i=2"; +-- source include/wait_condition.inc + +SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE INFO="UPDATE bug51920 SET i=2" +INTO @thread_id; + +KILL @thread_id; +let $wait_condition = + SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id; +-- source include/wait_condition.inc + +# +# Bug#19723: kill of active connection yields different error code +# depending on platform. +# +connection con1; +-- error 1317, 2006, 2013 +reap; +connection default; +DROP TABLE bug51920; +-- disconnect con1 diff --git a/mysql-test/suite/innodb/t/innodb_bug52663.test b/mysql-test/suite/innodb/t/innodb_bug52663.test new file mode 100644 index 00000000000..fcf97531e00 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug52663.test @@ -0,0 +1,34 @@ +--source include/have_innodb.inc + +set session transaction isolation level read committed; + +create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key +(what, id)) engine=innodb; +insert into innodb_bug52663 values ('total', 0, 0); +begin; + +connect (addconroot, localhost, root,,); +connection addconroot; +set session transaction isolation level read committed; +begin; + +connection default; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; + +connection addconroot; +--error ER_LOCK_WAIT_TIMEOUT +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +select * from innodb_bug52663; + +connection default; +commit; + +connection addconroot; +update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0; +commit; +select * from innodb_bug52663; + +connection default; +select * from innodb_bug52663; +drop table innodb_bug52663; diff --git a/mysql-test/suite/innodb/t/innodb_bug52745.test b/mysql-test/suite/innodb/t/innodb_bug52745.test new file mode 100644 index 00000000000..d2de869648b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug52745.test @@ -0,0 +1,109 @@ +-- source include/have_innodb.inc + +let $file_format=`select @@innodb_file_format`; +let $file_format_check=`select @@innodb_file_format_check`; +let $file_per_table=`select @@innodb_file_per_table`; +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=on; + +CREATE TABLE bug52745 ( + a2 int(10) unsigned DEFAULT NULL, + col37 time DEFAULT NULL, + col38 char(229) CHARACTER SET utf8 DEFAULT NULL, + col39 text, + col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + col41 int(10) unsigned DEFAULT NULL, + col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL, + col43 smallint(5) unsigned zerofill DEFAULT NULL, + col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL, + col45 float unsigned zerofill DEFAULT NULL, + col46 binary(1) DEFAULT NULL, + col47 tinyint(4) DEFAULT NULL, + col48 tinyint(1) DEFAULT NULL, + col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + col50 binary(1) DEFAULT NULL, + col51 double unsigned zerofill DEFAULT NULL, + col52 int(10) unsigned DEFAULT NULL, + col53 time DEFAULT NULL, + col54 double unsigned DEFAULT NULL, + col55 time DEFAULT NULL, + col56 mediumtext CHARACTER SET latin2, + col57 blob, + col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000', + col59 binary(1) DEFAULT NULL, + col60 longblob, + col61 time DEFAULT NULL, + col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci, + col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + col64 int(10) unsigned DEFAULT NULL, + col65 date DEFAULT NULL, + col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + col67 binary(1) DEFAULT NULL, + col68 tinyblob, + col69 date DEFAULT NULL, + col70 tinyint(3) unsigned zerofill DEFAULT NULL, + col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL, + col72 datetime DEFAULT NULL, + col73 smallint(5) unsigned zerofill DEFAULT NULL, + col74 longblob, + col75 bit(34) DEFAULT NULL, + col76 float unsigned zerofill DEFAULT NULL, + col77 year(2) DEFAULT NULL, + col78 tinyint(3) unsigned DEFAULT NULL, + col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL, + col80 datetime DEFAULT NULL, + col81 smallint(6) DEFAULT NULL, + col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL, + col83 bigint(20) unsigned zerofill DEFAULT NULL, + col84 float unsigned zerofill DEFAULT NULL, + col85 double DEFAULT NULL, + col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL, + col87 varbinary(221) DEFAULT NULL, + col88 double unsigned DEFAULT NULL, + col89 float unsigned zerofill DEFAULT NULL, + col90 tinyblob +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; + +INSERT INTO bug52745 SET +col40='0000-00-00 00:00:00', +col51=16547, +col53='7711484', +col54=-28604, +col55='7112612', +col56='wakefulness\'', +col57=repeat('absorbefacient\'',106), +col58=11027, +col59='AM09gW7', +col60=repeat('Noelani\'',16), +col61='2520576', +col62='substitutiv', +col63='19950106155112', +col64=-12038, +col65='86238806', +col66='19600719080256', +col68=repeat('Sagittarius\'',54), +col69='38943902', +col70=1232, +col71='Elora\'', +col74=repeat('zipp',11), +col75='0', +col76=23254, +col78=13247, +col79='56219', +col80='20500609035724', +col81=11632, +col82=7, +col84=-23863, +col85=6341, +col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W', +col88=16894, +col89=6161, +col90=repeat('gale',48); + +SHOW WARNINGS; + +DROP TABLE bug52745; + +EVAL SET GLOBAL innodb_file_format=$file_format; +EVAL SET GLOBAL innodb_file_format_check=$file_format_check; +EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/mysql-test/suite/innodb/t/innodb_bug53290.test b/mysql-test/suite/innodb/t/innodb_bug53290.test new file mode 100644 index 00000000000..ea15212fa39 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53290.test @@ -0,0 +1,22 @@ +-- source include/have_innodb.inc + +create table bug53290 (x bigint) engine=innodb; + +insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),(); +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; +insert into bug53290 select * from bug53290; + +alter table bug53290 add unique index `idx` (x); + +drop table bug53290; diff --git a/mysql-test/suite/innodb/t/innodb_bug53591.test b/mysql-test/suite/innodb/t/innodb_bug53591.test new file mode 100644 index 00000000000..58a7596dff9 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53591.test @@ -0,0 +1,22 @@ +-- source include/have_innodb.inc + +let $file_format=`select @@innodb_file_format`; +let $file_format_check=`select @@innodb_file_format_check`; +let $file_per_table=`select @@innodb_file_per_table`; + +SET GLOBAL innodb_file_format='Barracuda'; +SET GLOBAL innodb_file_per_table=on; + +set old_alter_table=0; + +CREATE TABLE bug53591(a text charset utf8 not null) +ENGINE=InnoDB KEY_BLOCK_SIZE=1; +-- error 139 +ALTER TABLE bug53591 ADD PRIMARY KEY(a(220)); +SHOW WARNINGS; + +DROP TABLE bug53591; + +EVAL SET GLOBAL innodb_file_format=$file_format; +EVAL SET GLOBAL innodb_file_format_check=$file_format_check; +EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/mysql-test/suite/innodb/t/innodb_bug53592.test b/mysql-test/suite/innodb/t/innodb_bug53592.test new file mode 100644 index 00000000000..bc37743f6bf --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53592.test @@ -0,0 +1,82 @@ +# Testcase for Bug #53592 - "crash replacing duplicates into +# table after fast alter table added unique key". The fix is to make +# sure index number lookup should go through "index translation table". + +--source include/have_innodb.inc + +# Use FIC for index creation +set old_alter_table=0; + +create table bug53592(a int) engine=innodb row_format=compact; + +alter table bug53592 add column b text charset utf8; + +alter table bug53592 add column c blob not null; + +# Create a non-unique nonclustered index +create index bug53592_b on bug53592(b(81)); + +# Create a unique index, this unique index should have smaller +# index number than bug53592_b, since unique index ranks higher +# than regular index does +create unique index bug53592_c on bug53592(c(1)); + +# This will trigger a dup key error and will require fetching +# the index number through a index structure for the error reporting. +# To get the correct index number, the code should go through index +# translation table. Otherwise, it will get the wrong index +# number and later trigger a server crash. +replace into bug53592 values (),(); + +check table bug53592; + +drop table bug53592; + +# Running the same set of test when "old_alter_table" is turned on +set old_alter_table=1; + +create table bug53592(a int) engine=innodb row_format=compact; + +alter table bug53592 add column b text charset utf8; + +alter table bug53592 add column c blob not null; + +# Create a non-unique nonclustered index +create index bug53592_b on bug53592(b(81)); + +# Create a unique index +create unique index bug53592_c on bug53592(c(1)); + +# This will trigger a dup key error and will require fetching +# the index number through a index structure for the error reporting. +# To get the correct index number, the code should go through index +# translation table. Otherwise, it will get the wrong index +# number and later trigger a server crash. +replace into bug53592 values (),(); + +check table bug53592; +drop table bug53592; + +# Test a dup key reported by foreign key constriant. +CREATE TABLE bug53592_1( + col1 int, col2 int, + PRIMARY KEY (col1, col2) +) ENGINE=InnoDB; + +CREATE TABLE bug53592_2 ( + col int PRIMARY KEY, + FOREIGN KEY (col) REFERENCES bug53592_1 (col1) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT INTO bug53592_1 VALUES (1, 2); +INSERT INTO bug53592_1 VALUES (3, 4); + +INSERT INTO bug53592_2 VALUES (1); +INSERT INTO bug53592_2 VALUES (3); + +--error ER_FOREIGN_DUPLICATE_KEY +UPDATE bug53592_1 SET col1 = 3 WHERE col2 = 2; + +drop table bug53592_2; +drop table bug53592_1; diff --git a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt new file mode 100644 index 00000000000..f1cfd7ab6c7 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt @@ -0,0 +1 @@ +--log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed diff --git a/mysql-test/suite/innodb/t/innodb_bug53674.test b/mysql-test/suite/innodb/t/innodb_bug53674.test new file mode 100644 index 00000000000..47f67f109c3 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug53674.test @@ -0,0 +1,8 @@ +-- source include/have_innodb.inc + +create table bug53674(a int)engine=innodb; +insert into bug53674 values (1),(2); +start transaction; +select * from bug53674 for update; +select * from bug53674 where a=(select a from bug53674 where a > 1); +drop table bug53674; diff --git a/mysql-test/suite/innodb/t/innodb_file_format.test b/mysql-test/suite/innodb/t/innodb_file_format.test index 4e11da5f123..5d094cb9dba 100644 --- a/mysql-test/suite/innodb/t/innodb_file_format.test +++ b/mysql-test/suite/innodb/t/innodb_file_format.test @@ -1,10 +1,5 @@ -- source include/have_innodb.inc -call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value"); - -let $format=`select @@innodb_file_format`; -let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; - select @@innodb_file_format; select @@innodb_file_format_check; set global innodb_file_format=antelope; @@ -31,12 +26,4 @@ set global innodb_file_format=on; --error ER_WRONG_VALUE_FOR_VAR set global innodb_file_format=off; select @@innodb_file_format_check; - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_format=$format; -eval set global innodb_file_format_check=$innodb_file_format_check_orig; --- enable_query_log +set global innodb_file_format_check=antelope; diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test index fc1d38d8d14..3dc2a8a40d4 100644 --- a/mysql-test/suite/innodb/t/innodb_information_schema.test +++ b/mysql-test/suite/innodb/t/innodb_information_schema.test @@ -64,6 +64,8 @@ INSERT INTO ```t'\"_str` VALUES INSERT INTO ```t'\"_str` VALUES ('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000); +--source include/count_sessions.inc + -- connect (con_lock,localhost,root,,) -- connect (con_min_trylock,localhost,root,,) -- connect (con_max_trylock,localhost,root,,) @@ -147,3 +149,104 @@ SET @@sql_mode=@save_sql_mode; -- disconnect con_verify_innodb_locks DROP TABLE t_min, t_max, ```t'\"_str`; + +--source include/wait_until_count_sessions.inc + +# +# Test that transaction data is correctly "visualized" in +# INFORMATION_SCHEMA.INNODB_TRX +# + +-- enable_result_log +DESCRIBE INFORMATION_SCHEMA.INNODB_TRX; +-- disable_result_log + +-- disable_warnings +DROP TABLE IF EXISTS t1; +-- enable_warnings + +CREATE TABLE t1 ( + c01 INT, + c02 INT, + PRIMARY KEY (c01) +) ENGINE = InnoDB; + +INSERT INTO t1 VALUES +(1,2),(2,4),(3,6),(4,8); + +CREATE TABLE t2 ( + c01 INT, + c02 INT, + PRIMARY KEY (c01), + FOREIGN KEY fk1 (c02) REFERENCES t1 (c01) +) ENGINE = InnoDB; + +INSERT INTO t2 VALUES +(1,1),(2,2),(3,3); + +-- connect (con_trx,localhost,root,,) +-- connect (con_verify_innodb_trx,localhost,root,,) + +-- connection con_trx +SET autocommit=0; +INSERT INTO t1 VALUES (5,10); +SELECT * FROM t1 FOR UPDATE; + +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TRX; +--source include/wait_condition.inc +-- disable_query_log + +-- connection con_verify_innodb_trx +-- enable_result_log +SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked, +trx_rows_locked, trx_rows_modified, trx_concurrency_tickets, +trx_isolation_level, trx_unique_checks, trx_foreign_key_checks +FROM INFORMATION_SCHEMA.INNODB_TRX; + +-- connection con_trx +-- disable_result_log +ROLLBACK; +SET FOREIGN_KEY_CHECKS = 0; +SET UNIQUE_CHECKS = 0; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +BEGIN; +INSERT INTO t1 VALUES (6,12); + +let $wait_condition= + SELECT trx_unique_checks = 0 FROM INFORMATION_SCHEMA.INNODB_TRX; +--source include/wait_condition.inc +-- disable_query_log + +-- connection con_verify_innodb_trx +-- enable_result_log +SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks +FROM INFORMATION_SCHEMA.INNODB_TRX; + +-- disable_result_log +-- connection con_trx +ROLLBACK; +SET FOREIGN_KEY_CHECKS = 1; +SET UNIQUE_CHECKS = 1; +BEGIN; +-- error 1452 +INSERT INTO t2 VALUES (4,10); + +let $wait_condition= + SELECT trx_unique_checks = 1 FROM INFORMATION_SCHEMA.INNODB_TRX; +--source include/wait_condition.inc +-- disable_query_log + +-- enable_result_log +-- connection con_verify_innodb_trx +SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error +FROM INFORMATION_SCHEMA.INNODB_TRX; +-- disable_result_log + +-- connection default + +-- disconnect con_trx +-- disconnect con_verify_innodb_trx + +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_multi_update.test b/mysql-test/suite/innodb/t/innodb_multi_update.test new file mode 100644 index 00000000000..7ab17ccf70a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_multi_update.test @@ -0,0 +1,29 @@ +-- source include/have_innodb.inc + +# +# Test multi update with different join methods +# + +CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb; +CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb; +INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); +INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); + +# Full join, without key +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100; +select * from bug38999_1; + +# unique key +update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101; +select * from bug38999_1; + +# ref key +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2; +select * from bug38999_1; + +# Range key (in bug38999_1) +update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100; +select * from bug38999_1; +select * from bug38999_2; + +drop table bug38999_1,bug38999_2; diff --git a/mysql-test/t/innodb_trx_weight.test b/mysql-test/suite/innodb/t/innodb_trx_weight.test index b72eaad345f..b72eaad345f 100644 --- a/mysql-test/t/innodb_trx_weight.test +++ b/mysql-test/suite/innodb/t/innodb_trx_weight.test diff --git a/mysql-test/suite/ndb/r/ndb_binlog_format.result b/mysql-test/suite/ndb/r/ndb_binlog_format.result index baf00186ff3..909d122bfc6 100644 --- a/mysql-test/suite/ndb/r/ndb_binlog_format.result +++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result @@ -9,12 +9,12 @@ INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. START TRANSACTION; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c; COMMIT; show binlog events from <binlog_start>; diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result index 448aaa7400f..73dc1178a54 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result +++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result @@ -8,12 +8,12 @@ wait/synch/mutex/sql/Cversion_lock YES YES wait/synch/mutex/sql/Delayed_insert::mutex YES YES wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state YES YES wait/synch/mutex/sql/hash_filo::lock YES YES +wait/synch/mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc YES YES wait/synch/mutex/sql/LOCK_active_mi YES YES wait/synch/mutex/sql/LOCK_audit_mask YES YES wait/synch/mutex/sql/LOCK_connection_count YES YES wait/synch/mutex/sql/LOCK_crypt YES YES wait/synch/mutex/sql/LOCK_delayed_create YES YES -wait/synch/mutex/sql/LOCK_delayed_insert YES YES select * from performance_schema.SETUP_INSTRUMENTS where name like 'Wait/Synch/Rwlock/sql/%' and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock') diff --git a/mysql-test/suite/rpl/r/rpl_concurrency_error.result b/mysql-test/suite/rpl/r/rpl_concurrency_error.result index 033783c65b4..013f02c3a86 100644 --- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result +++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result @@ -22,7 +22,7 @@ SET AUTOCOMMIT = 1; BEGIN; UPDATE t SET f = 'yellow 2' WHERE i = 3; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SET AUTOCOMMIT = 1; BEGIN; UPDATE t SET f = 'magenta 2' WHERE f = 'red'; @@ -51,7 +51,7 @@ SET AUTOCOMMIT = 1; BEGIN; UPDATE t SET f = 'gray 2' WHERE i = 3; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SET AUTOCOMMIT = 1; BEGIN; UPDATE t SET f = 'dark blue 2' WHERE f = 'red'; @@ -77,7 +77,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ SET AUTOCOMMIT = 0; UPDATE t SET f = 'yellow 1' WHERE i = 3; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SET AUTOCOMMIT = 0; UPDATE t SET f = 'magenta 1' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction @@ -104,7 +104,7 @@ master-bin.000001 # Query # # ROLLBACK SET AUTOCOMMIT = 0; UPDATE t SET f = 'gray 1' WHERE i = 3; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SET AUTOCOMMIT = 0; UPDATE t SET f = 'dark blue 1' WHERE f = 'red'; ERROR HY000: Lock wait timeout exceeded; try restarting transaction diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result index dfceb41948d..ab02432b0d4 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result @@ -392,7 +392,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 @@ -408,7 +408,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 @@ -424,7 +424,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 @@ -439,6 +439,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) @@ -453,6 +455,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) @@ -468,7 +472,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 @@ -483,6 +487,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) @@ -497,6 +503,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) @@ -3637,6 +3645,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3755,6 +3765,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -3877,6 +3889,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4001,6 +4015,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -4261,6 +4277,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4387,6 +4405,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4517,6 +4537,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -4649,6 +4671,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -6053,7 +6077,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 @@ -6087,7 +6111,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 206, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6117,7 +6141,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 207 --> 2", tt_3.info= "new text 207 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6146,6 +6170,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (208, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6174,6 +6200,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (209, 2, fc_i_tt_5_suc(209, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6203,7 +6231,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 210 --> 2", nt_4.info= "new text 210 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6232,6 +6260,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (211, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6260,6 +6290,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (212, 2, fc_i_nt_5_suc(212, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6487,7 +6519,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 @@ -6523,7 +6555,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 220, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6545,7 +6577,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 221 --> 2", tt_3.info= "new text 221 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6576,6 +6608,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (222, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6606,6 +6640,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (223, 2, fc_i_tt_5_suc(223, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6637,7 +6673,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 224 --> 2", nt_4.info= "new text 224 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6668,6 +6704,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (225, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6698,6 +6736,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (226, 2, fc_i_nt_5_suc(226, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6934,7 +6974,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -6964,7 +7004,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 234, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -6994,7 +7034,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 235 --> 4", tt_3.info= "new text 235 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7023,6 +7063,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (236, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7051,6 +7093,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (237, 4, fc_i_tt_5_suc(237, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7080,7 +7124,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 238 --> 4", nt_4.info= "new text 238 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7109,6 +7153,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (239, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7137,6 +7183,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (240, 4, fc_i_nt_5_suc(240, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7358,7 +7406,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7390,7 +7438,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 248, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7412,7 +7460,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 249 --> 4", tt_3.info= "new text 249 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7443,6 +7491,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (250, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7473,6 +7523,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (251, 4, fc_i_tt_5_suc(251, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7504,7 +7556,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 252 --> 4", nt_4.info= "new text 252 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7535,6 +7587,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (253, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7565,6 +7619,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (254, 4, fc_i_nt_5_suc(254, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7790,7 +7846,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 @@ -7824,7 +7880,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 262, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -7856,7 +7912,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 263 --> 2", tt_3.info= "new text 263 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -7887,6 +7943,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (264, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -7917,6 +7975,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (265, 2, fc_i_tt_5_suc(265, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -7948,7 +8008,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 266 --> 2", nt_4.info= "new text 266 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -7979,6 +8039,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (267, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8009,6 +8071,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (268, 2, fc_i_nt_5_suc(268, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8248,7 +8312,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 @@ -8284,7 +8348,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 276, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8318,7 +8382,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 277 --> 2", tt_3.info= "new text 277 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8351,6 +8415,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (278, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8383,6 +8449,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (279, 2, fc_i_tt_5_suc(279, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8416,7 +8484,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 280 --> 2", nt_4.info= "new text 280 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8449,6 +8517,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (281, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8481,6 +8551,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (282, 2, fc_i_nt_5_suc(282, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8740,7 +8812,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 @@ -8774,7 +8846,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 290, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8808,7 +8880,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 291 --> 4", tt_3.info= "new text 291 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8841,6 +8913,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (292, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8873,6 +8947,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (293, 4, fc_i_tt_5_suc(293, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8906,7 +8982,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 294 --> 4", nt_4.info= "new text 294 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8939,6 +9015,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (295, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -8971,6 +9049,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (296, 4, fc_i_nt_5_suc(296, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9218,7 +9298,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 @@ -9254,7 +9334,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 304, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9290,7 +9370,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 305 --> 4", tt_3.info= "new text 305 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9325,6 +9405,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (306, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9359,6 +9441,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (307, 4, fc_i_tt_5_suc(307, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9394,7 +9478,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 308 --> 4", nt_4.info= "new text 308 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9429,6 +9513,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (309, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9463,6 +9549,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (310, 4, fc_i_nt_5_suc(310, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10047,7 +10135,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO tt_xx_7(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> IS-T<-N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10125,7 +10213,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO tt_xx_7(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> IS-T<-N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10389,7 +10477,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> IS-N<-T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10469,7 +10557,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1 @@ -10879,7 +10967,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index 579e5eb02e9..a5219662881 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -392,7 +392,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1 @@ -408,7 +408,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1 @@ -424,7 +424,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1 @@ -439,6 +439,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1) @@ -453,6 +455,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1)) @@ -468,7 +472,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1 @@ -483,6 +487,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1) @@ -497,6 +503,8 @@ master-bin.000001 # Xid # # COMMIT /* XID */ -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1)) @@ -3641,6 +3649,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4) @@ -3779,6 +3789,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4) @@ -3921,6 +3933,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4) @@ -4065,6 +4079,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4) @@ -4349,6 +4365,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4) @@ -4495,6 +4513,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4) @@ -4645,6 +4665,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4) @@ -4797,6 +4819,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4) @@ -6221,7 +6245,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1 @@ -6255,7 +6279,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 206, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6285,7 +6309,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 207 --> 2", tt_3.info= "new text 207 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6314,6 +6338,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (208, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6342,6 +6368,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (209, 2, fc_i_tt_5_suc(209, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6371,7 +6399,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 210 --> 2", nt_4.info= "new text 210 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6400,6 +6428,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (211, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6428,6 +6458,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (212, 2, fc_i_nt_5_suc(212, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6655,7 +6687,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1 @@ -6691,7 +6723,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 220, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6713,7 +6745,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 221 --> 2", tt_3.info= "new text 221 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6744,6 +6776,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (222, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6774,6 +6808,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (223, 2, fc_i_tt_5_suc(223, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6805,7 +6841,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 224 --> 2", nt_4.info= "new text 224 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6836,6 +6872,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (225, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -6866,6 +6904,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (226, 2, fc_i_nt_5_suc(226, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -7102,7 +7142,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1 @@ -7136,7 +7176,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 234, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7166,7 +7206,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 235 --> 4", tt_3.info= "new text 235 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7195,6 +7235,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (236, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7223,6 +7265,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (237, 4, fc_i_tt_5_suc(237, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7252,7 +7296,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 238 --> 4", nt_4.info= "new text 238 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7281,6 +7325,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (239, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7309,6 +7355,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (240, 4, fc_i_nt_5_suc(240, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -7534,7 +7582,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1 @@ -7570,7 +7618,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 248, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7592,7 +7640,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 249 --> 4", tt_3.info= "new text 249 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7623,6 +7671,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (250, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7653,6 +7703,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (251, 4, fc_i_tt_5_suc(251, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7684,7 +7736,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 252 --> 4", nt_4.info= "new text 252 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7715,6 +7767,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (253, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7745,6 +7799,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (254, 4, fc_i_nt_5_suc(254, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -7974,7 +8030,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1 @@ -8008,7 +8064,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 262, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8044,7 +8100,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 263 --> 2", tt_3.info= "new text 263 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8079,6 +8135,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (264, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8113,6 +8171,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (265, 2, fc_i_tt_5_suc(265, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8148,7 +8208,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 266 --> 2", nt_4.info= "new text 266 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8183,6 +8243,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (267, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8217,6 +8279,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (268, 2, fc_i_nt_5_suc(268, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8476,7 +8540,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1 @@ -8512,7 +8576,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 276, 2, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8550,7 +8614,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 277 --> 2", tt_3.info= "new text 277 --> 2" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8587,6 +8651,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (278, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8623,6 +8689,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (279, 2, fc_i_tt_5_suc(279, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8660,7 +8728,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 280 --> 2", nt_4.info= "new text 280 --> 2" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8697,6 +8765,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (281, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -8733,6 +8803,8 @@ Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (282, 2, fc_i_nt_5_suc(282, 2)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b- @@ -9012,7 +9084,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1 @@ -9046,7 +9118,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 290, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9080,7 +9152,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 291 --> 4", tt_3.info= "new text 291 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9113,6 +9185,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (292, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9145,6 +9219,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (293, 4, fc_i_tt_5_suc(293, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9178,7 +9254,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 294 --> 4", nt_4.info= "new text 294 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9211,6 +9287,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (295, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9243,6 +9321,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (296, 4, fc_i_nt_5_suc(296, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- @@ -9490,7 +9570,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1 @@ -9526,7 +9606,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 304, 4, COUNT(*) FROM nt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9562,7 +9642,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b- UPDATE nt_3, tt_3 SET nt_3.info= "new text 305 --> 4", tt_3.info= "new text 305 --> 4" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9597,6 +9677,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_4(trans_id, stmt_id) VALUES (306, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9631,6 +9713,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (307, 4, fc_i_tt_5_suc(307, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9666,7 +9750,7 @@ master-bin.000001 # Query # # COMMIT -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b- UPDATE tt_4, nt_4 SET tt_4.info= "new text 308 --> 4", nt_4.info= "new text 308 --> 4" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9701,6 +9785,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_3(trans_id, stmt_id) VALUES (309, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -9735,6 +9821,8 @@ master-bin.000001 # Query # # COMMIT -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (310, 4, fc_i_nt_5_suc(310, 4)); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- @@ -10327,7 +10415,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO tt_xx_7(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> IS-T<-N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10405,7 +10493,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO tt_xx_7(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info -e-e-e-e-e-e-e-e-e-e-e- >> IS-T<-N << -e-e-e-e-e-e-e-e-e-e-e- -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b- @@ -10669,7 +10757,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1 @@ -10757,7 +10845,7 @@ Log_name Pos Event_type Server_id End_log_pos Info INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1 @@ -11175,7 +11263,7 @@ Log_name Pos Event_type Server_id End_log_pos Info -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1 diff --git a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result index e4e98f0bfe5..96829a1b1ec 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result +++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result @@ -53,7 +53,7 @@ set @@global.debug="+d,stop_slave_middle_group"; set @@global.debug="+d,incomplete_group_in_relay_log"; update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`; Last_SQL_Error true Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1 diff --git a/mysql-test/suite/rpl/r/rpl_temp_temporary.result b/mysql-test/suite/rpl/r/rpl_temp_temporary.result index 19b36da2800..3911bd8a773 100644 --- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temp_temporary.result @@ -24,7 +24,7 @@ INSERT INTO t_innodb_temp VALUES(1); BEGIN; INSERT INTO t_myisam SELECT * FROM t_myisam_temp; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. INSERT INTO t_innodb SELECT * FROM t_myisam_temp; INSERT INTO t_innodb SELECT * FROM t_innodb_temp; ROLLBACK; @@ -33,7 +33,7 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back BEGIN; INSERT INTO t_myisam SELECT * FROM t_innodb_temp; Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe. +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. INSERT INTO t_innodb SELECT * FROM t_myisam_temp; INSERT INTO t_innodb SELECT * FROM t_innodb_temp; ROLLBACK; @@ -193,8 +193,6 @@ Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. INSERT INTO t_innodb VALUES(1); COMMIT; -DROP TABLE t_myisam; -DROP TABLE t_innodb; show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam @@ -214,8 +212,29 @@ master-bin.000001 # Query # # use `test`; INSERT INTO tmp1 VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; DROP TABLE t_myisam -master-bin.000001 # Query # # use `test`; DROP TABLE t_innodb +######################################################################## +# VERIFY ITEM 8 +######################################################################## +SET BINLOG_FORMAT=MIXED; +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb VALUES(1); +INSERT INTO t_innodb VALUES(1); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) +master-bin.000001 # Query # # use `test`; INSERT INTO t_innodb VALUES(1) +master-bin.000001 # Query # # ROLLBACK ################################################################################### # CHECK CONSISTENCY ################################################################################### +################################################################################### +# CLEAN UP +################################################################################### +DROP TABLE t_myisam; +DROP TABLE t_innodb; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 7610ee68417..1bf4f1a3396 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -602,7 +602,11 @@ source include/stop_slave.inc; UNINSTALL PLUGIN rpl_semi_sync_slave; connection master; +# The dump thread may still be running on the master, and so the following +# UNINSTALL could generate a warning about the plugin is busy. +disable_warnings; UNINSTALL PLUGIN rpl_semi_sync_master; +enable_warnings; connection slave; source include/start_slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_temp_temporary.test b/mysql-test/suite/rpl/t/rpl_temp_temporary.test index a7234c53655..4eb2d16b91e 100644 --- a/mysql-test/suite/rpl/t/rpl_temp_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temp_temporary.test @@ -34,10 +34,13 @@ # the CREATE TEMPORARY is not logged and the DROP TEMPORARY is extended with # the IF EXISTS clause. # -# 7 - It also verifies if the CONNECTION_ID along with a non-transactional +# 7 - It verifies if the CONNECTION_ID along with a non-transactional # table is written outside the transaction boundaries and is not classified # as unsafe. See BUG#53075. # +# 8 - It verifies if OPTION_KEEP_LOG is set and thus forcing to write the +# trx-cache to the binary log when an rollback is issued and only trx-tables +# were updated. See BUG#53421. ################################################################################ source include/master-slave.inc; @@ -186,18 +189,40 @@ INSERT INTO t_innodb VALUES(1); INSERT INTO t_myisam VALUES(CONNECTION_ID()); INSERT INTO t_innodb VALUES(1); COMMIT; -DROP TABLE t_myisam; -DROP TABLE t_innodb; +source include/show_binlog_events.inc; + +--echo ######################################################################## +--echo # VERIFY ITEM 8 +--echo ######################################################################## +# +# Before the patch for BUG#53421, nothing were written to the binary log on +# behalf of the transaction presented below: +# +SET BINLOG_FORMAT=MIXED; +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +BEGIN; +CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb; +INSERT INTO t_innodb VALUES(1); +INSERT INTO t_innodb VALUES(1); +ROLLBACK; source include/show_binlog_events.inc; --echo ################################################################################### --echo # CHECK CONSISTENCY --echo ################################################################################### -connection master; sync_slave_with_master; +connection master; --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql --diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql +--echo ################################################################################### +--echo # CLEAN UP +--echo ################################################################################### +connection master; +DROP TABLE t_myisam; +DROP TABLE t_innodb; + +sync_slave_with_master; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result index 7350f10e53e..64ab9a6d637 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result @@ -43,11 +43,11 @@ SELECT * FROM t /* Should be empty */; a * Modify both row-only and stmt-only table CREATE TRIGGER trig_2 AFTER INSERT ON t_stmt FOR EACH ROW BEGIN INSERT INTO t_row VALUES(1); END; -ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. INSERT INTO t_stmt VALUES (1); -ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. +ERROR HY000: Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved. SELECT * FROM t_stmt /* should be empty */; a +DROP TRIGGER trig_2; * Stmt-only table and binlog_format=row INSERT INTO t_stmt VALUES (1); ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging. diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test index 14f39d7de2b..1aae0d2d57f 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test @@ -97,11 +97,11 @@ SELECT * FROM t_self_logging /* Should be empty */; SELECT * FROM t /* Should be empty */; --echo * Modify both row-only and stmt-only table ---error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE --eval CREATE TRIGGER trig_2 AFTER INSERT ON t_stmt FOR EACH ROW BEGIN INSERT INTO t_row VALUES(1); END ---error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE +--error ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE INSERT INTO t_stmt VALUES (1); SELECT * FROM t_stmt /* should be empty */; +DROP TRIGGER trig_2; --echo * Stmt-only table and binlog_format=row --error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_instances_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_instances_basic.result new file mode 100644 index 00000000000..a3c1a7b7bd4 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_instances_basic.result @@ -0,0 +1,53 @@ +'#---------------------BS_STVARS_035_01----------------------#' +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +COUNT(@@GLOBAL.innodb_buffer_pool_instances) +1 +1 Expected +'#---------------------BS_STVARS_035_02----------------------#' +SET @@GLOBAL.innodb_buffer_pool_instances=1; +ERROR HY000: Variable 'innodb_buffer_pool_instances' is a read only variable +Expected error 'Read only variable' +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +COUNT(@@GLOBAL.innodb_buffer_pool_instances) +1 +1 Expected +'#---------------------BS_STVARS_035_03----------------------#' +SELECT @@GLOBAL.innodb_buffer_pool_instances = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_instances'; +@@GLOBAL.innodb_buffer_pool_instances = VARIABLE_VALUE +1 +1 Expected +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +COUNT(@@GLOBAL.innodb_buffer_pool_instances) +1 +1 Expected +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_instances'; +COUNT(VARIABLE_VALUE) +1 +1 Expected +'#---------------------BS_STVARS_035_04----------------------#' +SELECT @@innodb_buffer_pool_instances = @@GLOBAL.innodb_buffer_pool_instances; +@@innodb_buffer_pool_instances = @@GLOBAL.innodb_buffer_pool_instances +1 +1 Expected +'#---------------------BS_STVARS_035_05----------------------#' +SELECT COUNT(@@innodb_buffer_pool_instances); +COUNT(@@innodb_buffer_pool_instances) +1 +1 Expected +SELECT COUNT(@@local.innodb_buffer_pool_instances); +ERROR HY000: Variable 'innodb_buffer_pool_instances' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@SESSION.innodb_buffer_pool_instances); +ERROR HY000: Variable 'innodb_buffer_pool_instances' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +COUNT(@@GLOBAL.innodb_buffer_pool_instances) +1 +1 Expected +SELECT innodb_buffer_pool_instances = @@SESSION.innodb_buffer_pool_instances; +ERROR 42S22: Unknown column 'innodb_buffer_pool_instances' in 'field list' +Expected error 'Readonly variable' diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result index 70b0425ce6f..f80ed54100f 100644 --- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result @@ -1,28 +1,28 @@ SET @start_global_value = @@global.innodb_change_buffering; SELECT @start_global_value; @start_global_value -inserts -Valid values are 'inserts' and 'none' -select @@global.innodb_change_buffering in ('inserts', 'none'); -@@global.innodb_change_buffering in ('inserts', 'none') +all +Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges' +select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges'); +@@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges') 1 select @@global.innodb_change_buffering; @@global.innodb_change_buffering -inserts +all select @@session.innodb_change_buffering; ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable show global variables like 'innodb_change_buffering'; Variable_name Value -innodb_change_buffering inserts +innodb_change_buffering all show session variables like 'innodb_change_buffering'; Variable_name Value -innodb_change_buffering inserts +innodb_change_buffering all select * from information_schema.global_variables where variable_name='innodb_change_buffering'; VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING inserts +INNODB_CHANGE_BUFFERING all select * from information_schema.session_variables where variable_name='innodb_change_buffering'; VARIABLE_NAME VARIABLE_VALUE -INNODB_CHANGE_BUFFERING inserts +INNODB_CHANGE_BUFFERING all set global innodb_change_buffering='none'; select @@global.innodb_change_buffering; @@global.innodb_change_buffering @@ -60,4 +60,4 @@ ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'so SET @@global.innodb_change_buffering = @start_global_value; SELECT @@global.innodb_change_buffering; @@global.innodb_change_buffering -inserts +all diff --git a/mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result new file mode 100644 index 00000000000..1ff36237907 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result @@ -0,0 +1,98 @@ +SET @global_start_value = @@global.innodb_purge_batch_size; +SELECT @global_start_value; +@global_start_value +20 +'#--------------------FN_DYNVARS_046_01------------------------#' +SET @@global.innodb_purge_batch_size = 1; +SET @@global.innodb_purge_batch_size = DEFAULT; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +20 +'#---------------------FN_DYNVARS_046_02-------------------------#' +SET innodb_purge_batch_size = 1; +ERROR HY000: Variable 'innodb_purge_batch_size' is a GLOBAL variable and should be set with SET GLOBAL +SELECT @@innodb_purge_batch_size; +@@innodb_purge_batch_size +20 +SELECT local.innodb_purge_batch_size; +ERROR 42S02: Unknown table 'local' in field list +SET global innodb_purge_batch_size = 1; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +'#--------------------FN_DYNVARS_046_03------------------------#' +SET @@global.innodb_purge_batch_size = 1; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = 5000; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +5000 +SET @@global.innodb_purge_batch_size = 1000; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1000 +'#--------------------FN_DYNVARS_046_04-------------------------#' +SET @@global.innodb_purge_batch_size = 0; +Warnings: +Warning 1292 Truncated incorrect innodb_purge_batch_size value: '0' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = "T"; +ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = "Y"; +ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = 5001; +Warnings: +Warning 1292 Truncated incorrect innodb_purge_batch_size value: '5001' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +5000 +'#----------------------FN_DYNVARS_046_05------------------------#' +SELECT @@global.innodb_purge_batch_size = +VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_batch_size'; +@@global.innodb_purge_batch_size = +VARIABLE_VALUE +1 +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +5000 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_batch_size'; +VARIABLE_VALUE +5000 +'#---------------------FN_DYNVARS_046_06-------------------------#' +SET @@global.innodb_purge_batch_size = OFF; +ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +5000 +SET @@global.innodb_purge_batch_size = ON; +ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +5000 +'#---------------------FN_DYNVARS_046_07----------------------#' +SET @@global.innodb_purge_batch_size = TRUE; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = FALSE; +Warnings: +Warning 1292 Truncated incorrect innodb_purge_batch_size value: '0' +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +1 +SET @@global.innodb_purge_batch_size = @global_start_value; +SELECT @@global.innodb_purge_batch_size; +@@global.innodb_purge_batch_size +20 diff --git a/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result b/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result new file mode 100644 index 00000000000..e3358a14ea2 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_purge_threads_basic.result @@ -0,0 +1,53 @@ +'#---------------------BS_STVARS_035_01----------------------#' +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +COUNT(@@GLOBAL.innodb_purge_threads) +1 +1 Expected +'#---------------------BS_STVARS_035_02----------------------#' +SET @@GLOBAL.innodb_purge_threads=1; +ERROR HY000: Variable 'innodb_purge_threads' is a read only variable +Expected error 'Read only variable' +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +COUNT(@@GLOBAL.innodb_purge_threads) +1 +1 Expected +'#---------------------BS_STVARS_035_03----------------------#' +SELECT @@GLOBAL.innodb_purge_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_threads'; +@@GLOBAL.innodb_purge_threads = VARIABLE_VALUE +1 +1 Expected +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +COUNT(@@GLOBAL.innodb_purge_threads) +1 +1 Expected +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_threads'; +COUNT(VARIABLE_VALUE) +1 +1 Expected +'#---------------------BS_STVARS_035_04----------------------#' +SELECT @@innodb_purge_threads = @@GLOBAL.innodb_purge_threads; +@@innodb_purge_threads = @@GLOBAL.innodb_purge_threads +1 +1 Expected +'#---------------------BS_STVARS_035_05----------------------#' +SELECT COUNT(@@innodb_purge_threads); +COUNT(@@innodb_purge_threads) +1 +1 Expected +SELECT COUNT(@@local.innodb_purge_threads); +ERROR HY000: Variable 'innodb_purge_threads' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@SESSION.innodb_purge_threads); +ERROR HY000: Variable 'innodb_purge_threads' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +COUNT(@@GLOBAL.innodb_purge_threads) +1 +1 Expected +SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads; +ERROR 42S22: Unknown column 'innodb_purge_threads' in 'field list' +Expected error 'Readonly variable' diff --git a/mysql-test/suite/sys_vars/r/innodb_use_native_aio_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_native_aio_basic.result new file mode 100644 index 00000000000..2e093a9fd2a --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_use_native_aio_basic.result @@ -0,0 +1,53 @@ +'#---------------------BS_STVARS_035_01----------------------#' +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +COUNT(@@GLOBAL.innodb_use_native_aio) +1 +1 Expected +'#---------------------BS_STVARS_035_02----------------------#' +SET @@GLOBAL.innodb_use_native_aio=1; +ERROR HY000: Variable 'innodb_use_native_aio' is a read only variable +Expected error 'Read only variable' +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +COUNT(@@GLOBAL.innodb_use_native_aio) +1 +1 Expected +'#---------------------BS_STVARS_035_03----------------------#' +SELECT IF(@@GLOBAL.innodb_use_native_aio, 'ON', 'OFF') = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_use_native_aio'; +IF(@@GLOBAL.innodb_use_native_aio, 'ON', 'OFF') = VARIABLE_VALUE +1 +1 Expected +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +COUNT(@@GLOBAL.innodb_use_native_aio) +1 +1 Expected +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_use_native_aio'; +COUNT(VARIABLE_VALUE) +1 +1 Expected +'#---------------------BS_STVARS_035_04----------------------#' +SELECT @@innodb_use_native_aio = @@GLOBAL.innodb_use_native_aio; +@@innodb_use_native_aio = @@GLOBAL.innodb_use_native_aio +1 +1 Expected +'#---------------------BS_STVARS_035_05----------------------#' +SELECT COUNT(@@innodb_use_native_aio); +COUNT(@@innodb_use_native_aio) +1 +1 Expected +SELECT COUNT(@@local.innodb_use_native_aio); +ERROR HY000: Variable 'innodb_use_native_aio' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@SESSION.innodb_use_native_aio); +ERROR HY000: Variable 'innodb_use_native_aio' is a GLOBAL variable +Expected error 'Variable is a GLOBAL variable' +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +COUNT(@@GLOBAL.innodb_use_native_aio) +1 +1 Expected +SELECT innodb_use_native_aio = @@SESSION.innodb_use_native_aio; +ERROR 42S22: Unknown column 'innodb_use_native_aio' in 'field list' +Expected error 'Readonly variable' diff --git a/mysql-test/suite/sys_vars/r/tx_isolation_func.result b/mysql-test/suite/sys_vars/r/tx_isolation_func.result index 2242525f14b..6b4c990c71c 100644 --- a/mysql-test/suite/sys_vars/r/tx_isolation_func.result +++ b/mysql-test/suite/sys_vars/r/tx_isolation_func.result @@ -95,10 +95,7 @@ a b 22 10 24 10 INSERT INTO t1 VALUES(23, 23); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES(25, 25); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -Bug: Only even rows are being locked, error 1205 should'nt have occured SELECT * FROM t1; a b 2 10 @@ -109,7 +106,9 @@ a b 18 10 20 10 22 10 +23 23 24 10 +25 25 COMMIT; ** Connection con0 ** COMMIT; @@ -144,7 +143,9 @@ a b 18 10 20 10 22 10 +23 23 24 10 +25 25 INSERT INTO t1 VALUES(5, 5); INSERT INTO t1 VALUES(7, 7); SELECT * FROM t1; @@ -159,7 +160,9 @@ a b 18 10 20 10 22 10 +23 23 24 10 +25 25 COMMIT; ** Connection con0 ** COMMIT; @@ -196,7 +199,9 @@ a b 18 11 20 11 22 11 +23 23 24 11 +25 25 INSERT INTO t1 VALUES(9, 9); ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES(13, 13); @@ -214,7 +219,9 @@ a b 18 11 20 11 22 11 +23 23 24 11 +25 25 COMMIT; ** Connection con0 ** COMMIT; @@ -225,6 +232,8 @@ SELECT * FROM t1 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0 FOR UPDATE; a b 5 5 7 7 +23 23 +25 25 UPDATE t1 SET b = 13 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0; ** Connection con1 ** START TRANSACTION; @@ -240,7 +249,9 @@ a b 18 12 20 12 22 12 +23 23 24 12 +25 25 INSERT INTO t1 VALUES(9, 9); ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES(13, 13); @@ -258,7 +269,9 @@ a b 18 12 20 12 22 12 +23 23 24 12 +25 25 COMMIT; ** Connection con0 ** COMMIT; @@ -273,7 +286,9 @@ a b 18 12 20 12 22 12 +23 13 24 12 +25 13 UPDATE t1 SET b = 14 WHERE a IN (2,4,6,8) = 0; ** Connection con1 ** START TRANSACTION; @@ -289,7 +304,9 @@ a b 18 12 20 12 22 12 +23 13 24 12 +25 13 INSERT INTO t1 VALUES(9, 9); ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES(13, 13); @@ -307,7 +324,9 @@ a b 18 12 20 12 22 12 +23 13 24 12 +25 13 COMMIT; ** Connection con0 ** COMMIT; diff --git a/mysql-test/suite/sys_vars/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test index ff93607a2cd..6f7b6bac18e 100644 --- a/mysql-test/suite/sys_vars/t/identity_func.test +++ b/mysql-test/suite/sys_vars/t/identity_func.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + #################### mysql-test\t\identity_func.test ########################## # # # Variable Name: identity # diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test index 89c1c80a6dc..082507efd07 100644 --- a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + ################# mysql-test\t\innodb_autoinc_lock_mode_func.test ############ # # # Variable Name: innodb_autoinc_lock_mode # diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_instances_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_instances_basic.test new file mode 100644 index 00000000000..0960f1fb38b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_instances_basic.test @@ -0,0 +1,103 @@ + + +################## mysql-test\t\innodb_buffer_pool_instances_basic.test ####### +# # +# Variable Name: innodb_buffer_pool_instances # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable # +# innodb_buffer_pool_instances # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_035_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_035_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_buffer_pool_instances=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_035_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_buffer_pool_instances = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_instances'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_instances'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_buffer_pool_instances = @@GLOBAL.innodb_buffer_pool_instances; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_05----------------------#' +################################################################################ +# Check if innodb_buffer_pool_instances can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_buffer_pool_instances); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_buffer_pool_instances); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_buffer_pool_instances); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_buffer_pool_instances = @@SESSION.innodb_buffer_pool_instances; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test index 65e36aa9cb3..abdfddb4c4b 100644 --- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_basic.test @@ -11,8 +11,8 @@ SELECT @start_global_value; # # exists as global only # ---echo Valid values are 'inserts' and 'none' -select @@global.innodb_change_buffering in ('inserts', 'none'); +--echo Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges' +select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges'); select @@global.innodb_change_buffering; --error ER_INCORRECT_GLOBAL_LOCAL_VAR select @@session.innodb_change_buffering; diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test new file mode 100644 index 00000000000..88271d26965 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_purge_batch_size_basic.test @@ -0,0 +1,142 @@ +################# mysql-test\t\innodb_purge_batch_size_basic.test ############# +# # +# Variable Name: innodb_purge_batch_size # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 20 # +# Range: 0-4294967295 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +#Description:Test Cases of Dynamic System Variable innodb_purge_batch_size # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_purge_batch_size TESTS # +######################################################################## + + +############################################################################ +# Saving initial value of innodb_purge_batch_size in a temporary variable # +############################################################################ + +SET @global_start_value = @@global.innodb_purge_batch_size; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_purge_batch_size # +######################################################################## + +SET @@global.innodb_purge_batch_size = 1; +SET @@global.innodb_purge_batch_size = DEFAULT; +SELECT @@global.innodb_purge_batch_size; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +############################################################################## +# Check if innodb_purge_batch_size can be accessed with and without @@ sign # +############################################################################## + +--Error ER_GLOBAL_VARIABLE +SET innodb_purge_batch_size = 1; +SELECT @@innodb_purge_batch_size; + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_purge_batch_size; + +SET global innodb_purge_batch_size = 1; +SELECT @@global.innodb_purge_batch_size; + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_purge_batch_size to a valid value # +########################################################################## + +SET @@global.innodb_purge_batch_size = 1; +SELECT @@global.innodb_purge_batch_size; + +SET @@global.innodb_purge_batch_size = 5000; +SELECT @@global.innodb_purge_batch_size; +SET @@global.innodb_purge_batch_size = 1000; +SELECT @@global.innodb_purge_batch_size; + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_purge_batch_size to invalid value # +########################################################################### + +SET @@global.innodb_purge_batch_size = 0; +SELECT @@global.innodb_purge_batch_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_purge_batch_size = "T"; +SELECT @@global.innodb_purge_batch_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_purge_batch_size = "Y"; +SELECT @@global.innodb_purge_batch_size; + +SET @@global.innodb_purge_batch_size = 5001; +SELECT @@global.innodb_purge_batch_size; + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_purge_batch_size = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_purge_batch_size'; +SELECT @@global.innodb_purge_batch_size; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_purge_batch_size'; + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_purge_batch_size = OFF; +SELECT @@global.innodb_purge_batch_size; + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_purge_batch_size = ON; +SELECT @@global.innodb_purge_batch_size; + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + + +SET @@global.innodb_purge_batch_size = TRUE; +SELECT @@global.innodb_purge_batch_size; +SET @@global.innodb_purge_batch_size = FALSE; +SELECT @@global.innodb_purge_batch_size; + +############################## +# Restore initial value # +############################## + +SET @@global.innodb_purge_batch_size = @global_start_value; +SELECT @@global.innodb_purge_batch_size; + +############################################################### +# END OF innodb_purge_batch_size TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test new file mode 100644 index 00000000000..64d834c6344 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_purge_threads_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_log_purge_threads_basic.test ########### +# # +# Variable Name: innodb_purge_threads # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_purge_threads # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_035_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_035_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_purge_threads=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_035_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_purge_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_threads'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_purge_threads'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_purge_threads = @@GLOBAL.innodb_purge_threads; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_05----------------------#' +################################################################################ +# Check if innodb_purge_threads can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_purge_threads); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_purge_threads); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_purge_threads); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_purge_threads); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test new file mode 100644 index 00000000000..37879530d75 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_use_native_aio_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_use_native_aio_basic.test ############## +# # +# Variable Name: innodb_use_native_aio # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_use_native_aio # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_035_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_035_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_use_native_aio=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_035_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT IF(@@GLOBAL.innodb_use_native_aio, 'ON', 'OFF') = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_use_native_aio'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_use_native_aio'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_use_native_aio = @@GLOBAL.innodb_use_native_aio; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_05----------------------#' +################################################################################ +# Check if innodb_log_file_size can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_use_native_aio); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_use_native_aio); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_use_native_aio); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_use_native_aio); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_use_native_aio = @@SESSION.innodb_use_native_aio; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func.test b/mysql-test/suite/sys_vars/t/last_insert_id_func.test index 2309c539bd9..bb3adbc1c64 100644 --- a/mysql-test/suite/sys_vars/t/last_insert_id_func.test +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + ################# mysql-test\t\last_insert_id_func.test ####################### # # # Variable Name: last_insert_id # diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test index e62390cb384..7ec071e6414 100644 --- a/mysql-test/suite/sys_vars/t/storage_engine_basic.test +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + ############## mysql-test\t\storage_engine_basic.test ################## # # # # diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test index 1fd2e323db8..3a78d46e527 100644 --- a/mysql-test/suite/sys_vars/t/tx_isolation_func.test +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test @@ -1,3 +1,9 @@ +--source include/not_windows_embedded.inc +# remove this when +# Bug#53947 InnoDB: Assertion failure in thread 4224 in file +# .\sync\sync0sync.c line 324 +# is fixed + ############# mysql-test\t\tx_isolation_func.test ####################################### # # # Variable Name: tx_isolation # @@ -134,12 +140,9 @@ START TRANSACTION; SELECT * FROM t1; ---error ER_LOCK_WAIT_TIMEOUT INSERT INTO t1 VALUES(23, 23); ---error ER_LOCK_WAIT_TIMEOUT INSERT INTO t1 VALUES(25, 25); ---echo Bug: Only even rows are being locked, error 1205 should'nt have occured SELECT * FROM t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 54c662bccf2..d7f7a12cbf8 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1117,3 +1117,14 @@ CREATE INDEX i2 ON t1 (a(20)); # cleanup DROP TABLE t1; + +# +# Bug #45052 ALTER TABLE ADD COLUMN crashes server with multiple foreign key columns +# The alter table fails if 2 or more new fields added and +# also added a key with these fields +# +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (1), (2); +ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2); +DROP TABLE t1; + diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test index 268b207e0e5..6056dbf0e7b 100644 --- a/mysql-test/t/bug39022.test +++ b/mysql-test/t/bug39022.test @@ -24,7 +24,7 @@ START TRANSACTION; connection thread2; --echo # in thread2 REPLACE INTO t2 VALUES (-17); -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; connection thread1; --echo # in thread1 @@ -37,14 +37,14 @@ START TRANSACTION; REPLACE INTO t1(a,b) VALUES (65,-50); REPLACE INTO t2 VALUES (-91); send; -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #waits +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #waits connection thread1; --echo # in thread1 --echo # should not crash --error ER_LOCK_DEADLOCK -SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); #crashes +SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #crashes connection thread2; --echo # in thread2 diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index e0a6fde1381..383ba98ae6d 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1668,3 +1668,66 @@ CREATE TABLE t1 LIKE t2; DROP TABLE t2; DROP TABLE t1; + +--echo # +--echo # Bug #48800 CREATE TABLE t...SELECT fails if t is a +--echo # temporary table +--echo # + +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TABLE t1 (a INT); + +CREATE TEMPORARY TABLE t2 (a INT); +CREATE VIEW t2 AS SELECT 1; + +CREATE TABLE t3 (a INT); +CREATE TEMPORARY TABLE t3 SELECT 1; + +CREATE TEMPORARY TABLE t4 (a INT); +CREATE TABLE t4 AS SELECT 1; + +DROP TEMPORARY TABLE t1, t2, t3, t4; +DROP TABLE t1, t3, t4; +DROP VIEW t2; + +--echo # +--echo # Bug #49193 CREATE TABLE reacts differently depending +--echo # on whether data is selected or not +--echo # + +CREATE TEMPORARY TABLE t2 (ID INT); +INSERT INTO t2 VALUES (1),(2),(3); + +# Case 1 -- did not fail +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE IF NOT EXISTS t1 (ID INT); +INSERT INTO t1 SELECT * FROM t2; +SELECT * FROM t1; +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; + +DROP TABLE t1; + +# Case 2 -- The DROP TABLE t1 failed with +# Table 'test.t1' doesn't exist in the SELECT * +# as the (permanent) table was not created +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2; +SELECT * FROM t1; +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; + +DROP TABLE t1; + +# Case 3 -- The CREATE TABLE failed with +# Table 't1' already exists +CREATE TEMPORARY TABLE t1 (ID INT); +CREATE TABLE t1 SELECT * FROM t2; +SELECT * FROM t1; +DROP TEMPORARY TABLE t1; +SELECT * FROM t1; + +DROP TABLE t1; + +DROP TEMPORARY TABLE t2; + diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index b997bde6e7c..e9c7e569250 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -723,6 +723,27 @@ DROP TABLE t1; SET max_sort_length=DEFAULT; SET NAMES latin1; +--echo # +--echo # Bug#52520 Difference in tinytext utf column metadata +--echo # +CREATE TABLE t1 ( + s1 TINYTEXT CHARACTER SET utf16, + s2 TEXT CHARACTER SET utf16, + s3 MEDIUMTEXT CHARACTER SET utf16, + s4 LONGTEXT CHARACTER SET utf16 +); +--enable_metadata +SET NAMES utf8, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +SET NAMES utf8; +SELECT *, HEX(s1) FROM t1; +--disable_metadata +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + # ## TODO: add tests for all engines diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index f1e17532b88..96f1a341d38 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -780,5 +780,26 @@ SET max_sort_length=DEFAULT; SET NAMES latin1; --echo # +--echo # Bug#52520 Difference in tinytext utf column metadata +--echo # +CREATE TABLE t1 ( + s1 TINYTEXT CHARACTER SET utf32, + s2 TEXT CHARACTER SET utf32, + s3 MEDIUMTEXT CHARACTER SET utf32, + s4 LONGTEXT CHARACTER SET utf32 +); +--enable_metadata +SET NAMES utf8mb4, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +SET NAMES utf8mb4; +SELECT *, HEX(s1) FROM t1; +--disable_metadata +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +--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 201e96b0b09..f2287488a4f 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1480,3 +1480,31 @@ DROP TABLE t1; --echo End of 5.4 tests +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Bug#52520 Difference in tinytext utf column metadata +--echo # +CREATE TABLE t1 ( + s1 TINYTEXT CHARACTER SET utf8, + s2 TEXT CHARACTER SET utf8, + s3 MEDIUMTEXT CHARACTER SET utf8, + s4 LONGTEXT CHARACTER SET utf8 +); +--enable_metadata +SET NAMES utf8, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +SET NAMES utf8; +SELECT *, HEX(s1) FROM t1; +--disable_metadata +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test index f396d36e5b0..8fcba92ff47 100644 --- a/mysql-test/t/ctype_utf8mb4.test +++ b/mysql-test/t/ctype_utf8mb4.test @@ -1790,6 +1790,27 @@ SELECT subject FROM t1 ORDER BY 1; DROP TABLE t1; --echo # +--echo # Bug#52520 Difference in tinytext utf column metadata +--echo # +CREATE TABLE t1 ( + s1 TINYTEXT CHARACTER SET utf8mb4, + s2 TEXT CHARACTER SET utf8mb4, + s3 MEDIUMTEXT CHARACTER SET utf8mb4, + s4 LONGTEXT CHARACTER SET utf8mb4 +); +--enable_metadata +SET NAMES utf8mb4, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +SET NAMES utf8mb4; +SELECT *, HEX(s1) FROM t1; +--disable_metadata +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 37682550487..7b14c332233 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,9 +11,8 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -innodb-autoinc : Bug#49267 2009-12-02 test fails on windows because of different case mode -innodb : Bug#49396 2009-12-03 test fails in embedded mode +sp_sync : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution plugin_load : Bug#42144 2009-12-21 alik plugin_load fails partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings -main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst -main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst +mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst +mysqlhotcopy_archive : bug#54129 2010-06-04 Horst diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index 5e53eaf0a52..f308c340645 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -140,3 +140,18 @@ SET sql_quote_show_create= _utf8 x'5452C39C45'; --error ER_WRONG_VALUE_FOR_VAR SET sql_quote_show_create=_latin1 x'5452DC45'; +--echo # +--echo # Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type +--echo # +CREATE TABLE t1(c1 BINARY(10), c2 BINARY(10), c3 BINARY(10), +PRIMARY KEY(c1,c2,c3)); +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +--error ER_DUP_ENTRY +INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc'); +DROP TABLE t1; + +CREATE TABLE t1 (f1 VARBINARY(19) PRIMARY KEY); +INSERT INTO t1 VALUES ('abc\0\0'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('abc\0\0'); +DROP TABLE t1; diff --git a/mysql-test/t/innodb-master.opt b/mysql-test/t/innodb-master.opt deleted file mode 100644 index 72c88068345..00000000000 --- a/mysql-test/t/innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=32768 --loose_innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/innodb-semi-consistent-master.opt b/mysql-test/t/innodb-semi-consistent-master.opt deleted file mode 100644 index cb48f1aaf60..00000000000 --- a/mysql-test/t/innodb-semi-consistent-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test deleted file mode 100644 index b3fcd89f371..00000000000 --- a/mysql-test/t/innodb_bug38231.test +++ /dev/null @@ -1,75 +0,0 @@ -# -# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK -# http://bugs.mysql.com/38231 -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not crash the server --- disable_query_log --- disable_result_log - -DROP TABLE IF EXISTS bug38231; -CREATE TABLE bug38231 (a INT); - --- connect (con1,localhost,root,,) --- connect (con2,localhost,root,,) - --- connection con1 -SET autocommit=0; -LOCK TABLE bug38231 WRITE; - --- connection con2 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - --- connection default --- send -TRUNCATE TABLE bug38231; - --- connection con1 -# give time to TRUNCATE and others to be executed; without sleep, sometimes -# UNLOCK executes before TRUNCATE -# TODO: Replace with wait_condition once possible under embedded server. --- sleep 0.2 -# this crashes the server if the bug is present -UNLOCK TABLES; - -# clean up - --- connection con2 --- reap -UNLOCK TABLES; - --- connection default --- reap --- disconnect con1 --- disconnect con2 - -# test that TRUNCATE works with with row-level locks - --- enable_query_log --- enable_result_log - -INSERT INTO bug38231 VALUES (1), (10), (300); - --- connect (con4,localhost,root,,) - --- connection con4 -SET autocommit=0; -SELECT * FROM bug38231 FOR UPDATE; - --- connection default -TRUNCATE TABLE bug38231; - --- connection con4 -COMMIT; - --- connection default - --- disconnect con4 - -DROP TABLE bug38231; diff --git a/mysql-test/t/innodb_bug39438.test b/mysql-test/t/innodb_bug39438.test deleted file mode 100644 index 2a51e5fcbb8..00000000000 --- a/mysql-test/t/innodb_bug39438.test +++ /dev/null @@ -1,31 +0,0 @@ -# -# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch -# http://bugs.mysql.com/39438 -# -# This test must be run with innodb_file_per_table=1 because the crash -# only occurs if that option is turned on and DISCARD TABLESPACE only -# works with innodb_file_per_table. -# - --- source include/have_innodb.inc - ---disable_query_log -call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'"); ---enable_query_log - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not crash the server --- disable_query_log --- disable_result_log - -DROP TABLE IF EXISTS bug39438; - -CREATE TABLE bug39438 (id INT) ENGINE=INNODB; - -ALTER TABLE bug39438 DISCARD TABLESPACE; - -# this crashes the server if the bug is present -SHOW TABLE STATUS; - -DROP TABLE bug39438; diff --git a/mysql-test/t/innodb_bug42101-nonzero-master.opt b/mysql-test/t/innodb_bug42101-nonzero-master.opt deleted file mode 100644 index 455d66a06b8..00000000000 --- a/mysql-test/t/innodb_bug42101-nonzero-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose_innodb_commit_concurrency=1 diff --git a/mysql-test/t/innodb_bug44571.test b/mysql-test/t/innodb_bug44571.test deleted file mode 100644 index 685463ceff9..00000000000 --- a/mysql-test/t/innodb_bug44571.test +++ /dev/null @@ -1,17 +0,0 @@ -# -# Bug#44571 InnoDB Plugin crashes on ADD INDEX -# http://bugs.mysql.com/44571 -# --- source include/have_innodb.inc - -CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; -ALTER TABLE bug44571 CHANGE foo bar INT; --- error ER_KEY_COLUMN_DOES_NOT_EXITS -ALTER TABLE bug44571 ADD INDEX bug44571b (foo); -# The following will fail, because the CHANGE foo bar was -# not communicated to InnoDB. ---error ER_NOT_KEYFILE -ALTER TABLE bug44571 ADD INDEX bug44571b (bar); ---error ER_NOT_KEYFILE -CREATE INDEX bug44571b ON bug44571 (bar); -DROP TABLE bug44571; diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test index 6469ef2d229..36d09b4c411 100644 --- a/mysql-test/t/innodb_mysql_lock.test +++ b/mysql-test/t/innodb_mysql_lock.test @@ -170,6 +170,45 @@ connection default; disconnect con2; DROP TABLE t1; + +--echo # +--echo # Bug#53798 OPTIMIZE TABLE breaks repeatable read +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT) engine=innodb; +INSERT INTO t1 VALUES (1), (2), (3); + +--echo # Connection con1 +connect (con1, localhost, root); +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SELECT * FROM t1; + +--echo # Connection default +connection default; +--echo # This should block +--echo # Sending: +--send OPTIMIZE TABLE t1 + +--echo # Connection con1 +connection con1; +let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state='Waiting for table' AND info='OPTIMIZE TABLE t1'; +--source include/wait_condition.inc +SELECT * FROM t1; +COMMIT; + +--echo # Connection default +connection default; +--echo # Reaping OPTIMIZE TABLE t1 +--reap +disconnect con1; +DROP TABLE t1; + + # 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/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test new file mode 100644 index 00000000000..5111d56225a --- /dev/null +++ b/mysql-test/t/innodb_mysql_lock2.test @@ -0,0 +1,765 @@ +# This test covers behavior for InnoDB tables. +--source include/have_innodb.inc +# This test requires statement/mixed mode binary logging. +# Row-based mode puts weaker serializability requirements +# so weaker locks are acquired for it. +--source include/have_binlog_format_mixed_or_statement.inc +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + +--echo # +--echo # Test how do we handle locking in various cases when +--echo # we read data from InnoDB tables. +--echo # +--echo # In fact by performing this test we check two things: +--echo # 1) That SQL-layer correctly determine type of thr_lock.c +--echo # lock to be acquired/passed to InnoDB engine. +--echo # 2) That InnoDB engine correctly interprets this lock +--echo # type and takes necessary row locks or does not +--echo # take them if they are not necessary. +--echo # + +--echo # This test makes sense only in REPEATABLE-READ mode as +--echo # in SERIALIZABLE mode all statements that read data take +--echo # shared lock on them to enforce its semantics. +select @@session.tx_isolation; + +--echo # Prepare playground by creating tables, views, +--echo # routines and triggers used in tests. +connect (con1, localhost, root,,); +connection default; +--disable_warnings +drop table if exists t0, t1, t2, t3, t4, t5; +drop view if exists v1, v2; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; +drop function if exists f2; +drop function if exists f3; +drop function if exists f4; +drop function if exists f5; +drop function if exists f6; +drop function if exists f7; +drop function if exists f8; +drop function if exists f9; +drop function if exists f10; +drop function if exists f11; +drop function if exists f12; +drop function if exists f13; +drop function if exists f14; +drop function if exists f15; +--enable_warnings +create table t1 (i int primary key) engine=innodb; +insert into t1 values (1), (2), (3), (4), (5); +create table t2 (j int primary key) engine=innodb; +insert into t2 values (1), (2), (3), (4), (5); +create table t3 (k int primary key) engine=innodb; +insert into t3 values (1), (2), (3); +create table t4 (l int primary key) engine=innodb; +insert into t4 values (1); +create table t5 (l int primary key) engine=innodb; +insert into t5 values (1); +create view v1 as select i from t1; +create view v2 as select j from t2 where j in (select i from t1); +create procedure p1(k int) insert into t2 values (k); +delimiter |; +create function f1() returns int +begin + declare j int; + select i from t1 where i = 1 into j; + return j; +end| +create function f2() returns int +begin + declare k int; + select i from t1 where i = 1 into k; + insert into t2 values (k + 5); + return 0; +end| +create function f3() returns int +begin + return (select i from t1 where i = 3); +end| +create function f4() returns int +begin + if (select i from t1 where i = 3) then + return 1; + else + return 0; + end if; +end| +create function f5() returns int +begin + insert into t2 values ((select i from t1 where i = 1) + 5); + return 0; +end| +create function f6() returns int +begin + declare k int; + select i from v1 where i = 1 into k; + return k; +end| +create function f7() returns int +begin + declare k int; + select j from v2 where j = 1 into k; + return k; +end| +create function f8() returns int +begin + declare k int; + select i from v1 where i = 1 into k; + insert into t2 values (k+5); + return k; +end| +create function f9() returns int +begin + update v2 set j=j+10 where j=1; + return 1; +end| +create function f10() returns int +begin + return f1(); +end| +create function f11() returns int +begin + declare k int; + set k= f1(); + insert into t2 values (k+5); + return k; +end| +create function f12(p int) returns int +begin + insert into t2 values (p); + return p; +end| +create function f13(p int) returns int +begin + return p; +end| +create procedure p2(inout p int) +begin + select i from t1 where i = 1 into p; +end| +create function f14() returns int +begin + declare k int; + call p2(k); + insert into t2 values (k+5); + return k; +end| +create function f15() returns int +begin + declare k int; + call p2(k); + return k; +end| +create trigger t4_bi before insert on t4 for each row +begin + declare k int; + select i from t1 where i=1 into k; + set new.l= k+1; +end| +create trigger t4_bu before update on t4 for each row +begin + if (select i from t1 where i=1) then + set new.l= 2; + end if; +end| +create trigger t4_bd before delete on t4 for each row +begin + if !(select i from v1 where i=1) then + signal sqlstate '45000'; + end if; +end| +create trigger t5_bi before insert on t5 for each row +begin + set new.l= f1()+1; +end| +create trigger t5_bu before update on t5 for each row +begin + declare j int; + call p2(j); + set new.l= j + 1; +end| +delimiter ;| + +--echo # +--echo # Set common variables to be used by scripts called below. +--echo # +let $con_aux= con1; +let $table= t1; + + +--echo # +--echo # 1. Statements that read tables and do not use subqueries. +--echo # + +--echo # +--echo # 1.1 Simple SELECT statement. +--echo # +--echo # No locks are necessary as this statement won't be written +--echo # to the binary log and thanks to how MyISAM works SELECT +--echo # will see version of the table prior to concurrent insert. +let $statement= select * from t1; +--source include/check_no_row_lock.inc + +--echo # +--echo # 1.2 Multi-UPDATE statement. +--echo # +--echo # Has to take shared locks on rows in the table being read as this +--echo # statement will be written to the binary log and therefore should +--echo # be serialized with concurrent statements. +let $statement= update t2, t1 set j= j - 1 where i = j; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 1.3 Multi-DELETE statement. +--echo # +--echo # The above is true for this statement as well. +let $statement= delete t2 from t1, t2 where i = j; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 1.4 DESCRIBE statement. +--echo # +--echo # This statement does not really read data from the +--echo # target table and thus does not take any lock on it. +--echo # We check this for completeness of coverage. +let $statement= describe t1; +--source include/check_no_row_lock.inc + +--echo # +--echo # 1.5 SHOW statements. +--echo # +--echo # The above is true for SHOW statements as well. +let $statement= show create table t1; +--source include/check_no_row_lock.inc +let $statement= show keys from t1; +--source include/check_no_row_lock.inc + + +--echo # +--echo # 2. Statements which read tables through subqueries. +--echo # + +--echo # +--echo # 2.1 CALL with a subquery. +--echo # +--echo # A strong lock is not necessary as this statement is not +--echo # written to the binary log as a whole (it is written +--echo # statement-by-statement) and thanks to MVCC we can always get +--echo # versions of rows prior to the update that has locked them. +--echo # But in practice InnoDB does locking reads for all statements +--echo # other than SELECT (unless it is a READ-COMITTED mode or +--echo # innodb_locks_unsafe_for_binlog is ON). +let $statement= call p1((select i + 5 from t1 where i = 1)); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.2 CREATE TABLE with a subquery. +--echo # +--echo # Has to take shared locks on rows in the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent statements. +let $statement= create table t0 engine=innodb select * from t1; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +drop table t0; +let $statement= create table t0 engine=innodb select j from t2 where j in (select i from t1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +drop table t0; + +--echo # +--echo # 2.3 DELETE with a subquery. +--echo # +--echo # The above is true for this statement as well. +let $statement= delete from t2 where j in (select i from t1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.4 MULTI-DELETE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.5 DO with a subquery. +--echo # +--echo # In theory should not take row locks as it is not logged. +--echo # In practice InnoDB takes shared row locks. +let $statement= do (select i from t1 where i = 1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.6 INSERT with a subquery. +--echo # +--echo # Has to take shared locks on rows in the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent statements. +let $statement= insert into t2 select i+5 from t1; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= insert into t2 values ((select i+5 from t1 where i = 4)); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.7 LOAD DATA with a subquery. +--echo # +--echo # The above is true for this statement as well. +let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.8 REPLACE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= replace into t2 select i+5 from t1; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= replace into t2 values ((select i+5 from t1 where i = 4)); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.9 SELECT with a subquery. +--echo # +--echo # Locks are not necessary as this statement is not written +--echo # to the binary log and thanks to MVCC we can always get +--echo # versions of rows prior to the update that has locked them. +--echo # +--echo # Also serves as a test case for bug #46947 "Embedded SELECT +--echo # without FOR UPDATE is causing a lock". +let $statement= select * from t2 where j in (select i from t1); +--source include/check_no_row_lock.inc + +--echo # +--echo # 2.10 SET with a subquery. +--echo # +--echo # In theory should not require locking as it is not written +--echo # to the binary log. In practice InnoDB acquires shared row +--echo # locks. +let $statement= set @a:= (select i from t1 where i = 1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.11 SHOW with a subquery. +--echo # +--echo # Similarly to the previous case, in theory should not require locking +--echo # as it is not written to the binary log. In practice InnoDB +--echo # acquires shared row locks. +let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= show columns from t2 where (select i from t1 where i = 1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.12 UPDATE with a subquery. +--echo # +--echo # Has to take shared locks on rows in the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent statements. +let $statement= update t2 set j= j-10 where j in (select i from t1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 2.13 MULTI-UPDATE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + + +--echo # +--echo # 3. Statements which read tables through a view. +--echo # + +--echo # +--echo # 3.1 SELECT statement which uses some table through a view. +--echo # +--echo # Since this statement is not written to the binary log +--echo # and old version of rows are accessible thanks to MVCC, +--echo # no locking is necessary. +let $statement= select * from v1; +--source include/check_no_row_lock.inc +let $statement= select * from v2; +--source include/check_no_row_lock.inc +let $statement= select * from t2 where j in (select i from v1); +--source include/check_no_row_lock.inc +let $statement= select * from t3 where k in (select j from v2); +--source include/check_no_row_lock.inc + +--echo # +--echo # 3.2 Statements which modify a table and use views. +--echo # +--echo # Since such statements are going to be written to the binary +--echo # log they need to be serialized against concurrent statements +--echo # and therefore should take shared row locks on data read. +let $statement= update t2 set j= j-10 where j in (select i from v1); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= update t3 set k= k-10 where k in (select j from v2); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= update t2, v1 set j= j-10 where j = i; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= update v2 set j= j-10 where j = 3; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + + +--echo # +--echo # 4. Statements which read tables through stored functions. +--echo # + +--echo # +--echo # 4.1 SELECT/SET with a stored function which does not +--echo # modify data and uses SELECT in its turn. +--echo # +--echo # In theory there is no need to take row locks on the table +--echo # being selected from in SF as the call to such function +--echo # won't get into the binary log. In practice, however, we +--echo # discover that fact too late in the process to be able to +--echo # affect the decision what locks should be taken. +--echo # Hence, strong locks are taken in this case. +let $statement= select f1(); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f1(); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.2 INSERT (or other statement which modifies data) with +--echo # a stored function which does not modify data and uses +--echo # SELECT. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data +--echo # it uses. Therefore it should take row locks on the data +--echo # it reads. +let $statement= insert into t2 values (f1() + 5); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.3 SELECT/SET with a stored function which +--echo # reads and modifies data. +--echo # +--echo # Since a call to such function is written to the binary log, +--echo # it should be serialized with concurrent statements affecting +--echo # the data it uses. Hence, row locks on the data read +--echo # should be taken. +let $statement= select f2(); +let $wait_statement= select i from t1 where i = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f2(); +let $wait_statement= select i from t1 where i = 1 into k; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.4. SELECT/SET with a stored function which does not +--echo # modify data and reads a table through subselect +--echo # in a control construct. +--echo # +--echo # Again, in theory a call to this function won't get to the +--echo # binary log and thus no locking is needed. But in practice +--echo # we don't detect this fact early enough (get_lock_type_for_table()) +--echo # to avoid taking row locks. +let $statement= select f3(); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f3(); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= select f4(); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f4(); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.5. INSERT (or other statement which modifies data) with +--echo # a stored function which does not modify data and reads +--echo # the table through a subselect in one of its control +--echo # constructs. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting data it +--echo # uses. Therefore it should take row locks on the data +--echo # it reads. +let $statement= insert into t2 values (f3() + 5); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc +let $statement= insert into t2 values (f4() + 6); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.6 SELECT/SET which uses a stored function with +--echo # DML which reads a table via a subquery. +--echo # +--echo # Since call to such function is written to the binary log +--echo # it should be serialized with concurrent statements. +--echo # Hence reads should take row locks. +let $statement= select f5(); +let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5); +--source include/check_shared_row_lock.inc +let $statement= set @a:= f5(); +let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5); +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.7 SELECT/SET which uses a stored function which +--echo # doesn't modify data and reads tables through +--echo # a view. +--echo # +--echo # Once again, in theory, calls to such functions won't +--echo # get into the binary log and thus don't need row +--echo # locks. But in practice this fact is discovered +--echo # too late to have any effect. +let $statement= select f6(); +let $wait_statement= select i from v1 where i = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f6(); +let $wait_statement= select i from v1 where i = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= select f7(); +let $wait_statement= select j from v2 where j = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= set @a:= f7(); +let $wait_statement= select j from v2 where j = 1 into k; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.8 INSERT which uses stored function which +--echo # doesn't modify data and reads a table +--echo # through a view. +--echo # +--echo # Since such statement is written to the binary log and +--echo # should be serialized with concurrent statements affecting +--echo # the data it uses. Therefore it should take row locks on +--echo # the rows it reads. +let $statement= insert into t3 values (f6() + 5); +let $wait_statement= select i from v1 where i = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= insert into t3 values (f7() + 5); +let $wait_statement= select j from v2 where j = 1 into k; +--source include/check_shared_row_lock.inc + + +--echo # +--echo # 4.9 SELECT which uses a stored function which +--echo # modifies data and reads tables through a view. +--echo # +--echo # Since a call to such function is written to the binary log +--echo # it should be serialized with concurrent statements. +--echo # Hence, reads should take row locks. +let $statement= select f8(); +let $wait_statement= select i from v1 where i = 1 into k; +--source include/check_shared_row_lock.inc +let $statement= select f9(); +let $wait_statement= update v2 set j=j+10 where j=1; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.10 SELECT which uses stored function which doesn't modify +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # In theory, calls to such functions won't get into the binary +--echo # log and thus don't need to acquire row locks. But in practice +--echo # this fact is discovered too late to have any effect. +let $statement= select f10(); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.11 INSERT which uses a stored function which doesn't modify +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # Since such statement is written to the binary log, it should +--echo # be serialized with concurrent statements affecting the data it +--echo # uses. Therefore it should take row locks on data it reads. +let $statement= insert into t2 values (f10() + 5); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.12 SELECT which uses a stored function which modifies +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # Since a call to such function is written to the binary log +--echo # it should be serialized from concurrent statements. +--echo # Hence, reads should take row locks. +let $statement= select f11(); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 4.13 SELECT that reads a table through a subquery passed +--echo # as a parameter to a stored function which modifies +--echo # data. +--echo # +--echo # Even though a call to this function is written to the +--echo # binary log, values of its parameters are written as literals. +--echo # So there is no need to acquire row locks on rows used in +--echo # the subquery. +let $statement= select f12((select i+10 from t1 where i=1)); +--source include/check_no_row_lock.inc + +--echo # +--echo # 4.14 INSERT that reads a table via a subquery passed +--echo # as a parameter to a stored function which doesn't +--echo # modify data. +--echo # +--echo # Since this statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data it +--echo # uses. Therefore it should take row locks on the data it reads. +let $statement= insert into t2 values (f13((select i+10 from t1 where i=1))); +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + + +--echo # +--echo # 5. Statements that read tables through stored procedures. +--echo # + +--echo # +--echo # 5.1 CALL statement which reads a table via SELECT. +--echo # +--echo # Since neither this statement nor its components are +--echo # written to the binary log, there is no need to take +--echo # row locks on the data it reads. +let $statement= call p2(@a); +--source include/check_no_row_lock.inc + +--echo # +--echo # 5.2 Function that modifes data and uses CALL, +--echo # which reads a table through SELECT. +--echo # +--echo # Since a call to such function is written to the binary +--echo # log, it should be serialized with concurrent statements. +--echo # Hence, in this case reads should take row locks on data. +let $statement= select f14(); +let $wait_statement= select i from t1 where i = 1 into p; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 5.3 SELECT that calls a function that doesn't modify data and +--echo # uses a CALL statement that reads a table via SELECT. +--echo # +--echo # In theory, calls to such functions won't get into the binary +--echo # log and thus don't need to acquire row locks. But in practice +--echo # this fact is discovered too late to have any effect. +let $statement= select f15(); +let $wait_statement= select i from t1 where i = 1 into p; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 5.4 INSERT which calls function which doesn't modify data and +--echo # uses CALL statement which reads table through SELECT. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting data it +--echo # uses. Therefore it should take row locks on data it reads. +let $statement= insert into t2 values (f15()+5); +let $wait_statement= select i from t1 where i = 1 into p; +--source include/check_shared_row_lock.inc + + +--echo # +--echo # 6. Statements that use triggers. +--echo # + +--echo # +--echo # 6.1 Statement invoking a trigger that reads table via SELECT. +--echo # +--echo # Since this statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data +--echo # it uses. Therefore, it should take row locks on the data +--echo # it reads. +let $statement= insert into t4 values (2); +let $wait_statement= select i from t1 where i=1 into k; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 6.2 Statement invoking a trigger that reads table through +--echo # a subquery in a control construct. +--echo # +--echo # The above is true for this statement as well. +let $statement= update t4 set l= 2 where l = 1; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 6.3 Statement invoking a trigger that reads a table through +--echo # a view. +--echo # +--echo # And for this statement. +let $statement= delete from t4 where l = 1; +let $wait_statement= $statement; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 6.4 Statement invoking a trigger that reads a table through +--echo # a stored function. +--echo # +--echo # And for this statement. +let $statement= insert into t5 values (2); +let $wait_statement= select i from t1 where i = 1 into j; +--source include/check_shared_row_lock.inc + +--echo # +--echo # 6.5 Statement invoking a trigger that reads a table through +--echo # stored procedure. +--echo # +--echo # And for this statement. +let $statement= update t5 set l= 2 where l = 1; +let $wait_statement= select i from t1 where i = 1 into p; +--source include/check_shared_row_lock.inc + +--echo # Clean-up. +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; +drop function f8; +drop function f9; +drop function f10; +drop function f11; +drop function f12; +drop function f13; +drop function f14; +drop function f15; +drop view v1, v2; +drop procedure p1; +drop procedure p2; +drop table t1, t2, t3, t4, t5; +disconnect con1; + +# 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/lock_sync.test b/mysql-test/t/lock_sync.test index 3cbe3342acc..921ce991652 100644 --- a/mysql-test/t/lock_sync.test +++ b/mysql-test/t/lock_sync.test @@ -4,10 +4,10 @@ --source include/have_debug_sync.inc # We need InnoDB to be able use TL_WRITE_ALLOW_WRITE type of locks in our tests. --source include/have_innodb.inc -# The test for Bug#50821 requires binary logging turned on. -# With binary logging on, sub-queries in DML statements acquire -# TL_READ_NO_INSERT which was needed to reproduce this deadlock bug. ---source include/have_log_bin.inc +# This test requires statement/mixed mode binary logging. +# Row-based mode puts weaker serializability requirements +# so weaker locks are acquired for it. +--source include/have_binlog_format_mixed_or_statement.inc # Until bug#41971 'Thread state on embedded server is always "Writing to net"' # is fixed this test can't be run on embedded version of server. --source include/not_embedded.inc @@ -17,6 +17,818 @@ --echo # +--echo # Test how we handle locking in various cases when +--echo # we read data from MyISAM tables. +--echo # +--echo # In this test we mostly check that the SQL-layer correctly +--echo # determines the type of thr_lock.c lock for a table being +--echo # read. +--echo # I.e. that it disallows concurrent inserts when the statement +--echo # is going to be written to the binary log and therefore +--echo # should be serialized, and allows concurrent inserts when +--echo # such serialization is not necessary (e.g. when +--echo # the statement is not written to binary log). +--echo # + +--echo # Force concurrent inserts to be performed even if the table +--echo # has gaps. This allows to simplify clean up in scripts +--echo # used below (instead of backing up table being inserted +--echo # into and then restoring it from backup at the end of the +--echo # script we can simply delete rows which were inserted). +set @old_concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert= 2; +select @@global.concurrent_insert; + +--echo # Prepare playground by creating tables, views, +--echo # routines and triggers used in tests. +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); +connection default; +--disable_warnings +drop table if exists t0, t1, t2, t3, t4, t5; +drop view if exists v1, v2; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; +drop function if exists f2; +drop function if exists f3; +drop function if exists f4; +drop function if exists f5; +drop function if exists f6; +drop function if exists f7; +drop function if exists f8; +drop function if exists f9; +drop function if exists f10; +drop function if exists f11; +drop function if exists f12; +drop function if exists f13; +drop function if exists f14; +drop function if exists f15; +--enable_warnings +create table t1 (i int primary key); +insert into t1 values (1), (2), (3), (4), (5); +create table t2 (j int primary key); +insert into t2 values (1), (2), (3), (4), (5); +create table t3 (k int primary key); +insert into t3 values (1), (2), (3); +create table t4 (l int primary key); +insert into t4 values (1); +create table t5 (l int primary key); +insert into t5 values (1); +create view v1 as select i from t1; +create view v2 as select j from t2 where j in (select i from t1); +create procedure p1(k int) insert into t2 values (k); +delimiter |; +create function f1() returns int +begin + declare j int; + select i from t1 where i = 1 into j; + return j; +end| +create function f2() returns int +begin + declare k int; + select i from t1 where i = 1 into k; + insert into t2 values (k + 5); + return 0; +end| +create function f3() returns int +begin + return (select i from t1 where i = 3); +end| +create function f4() returns int +begin + if (select i from t1 where i = 3) then + return 1; + else + return 0; + end if; +end| +create function f5() returns int +begin + insert into t2 values ((select i from t1 where i = 1) + 5); + return 0; +end| +create function f6() returns int +begin + declare k int; + select i from v1 where i = 1 into k; + return k; +end| +create function f7() returns int +begin + declare k int; + select j from v2 where j = 1 into k; + return k; +end| +create function f8() returns int +begin + declare k int; + select i from v1 where i = 1 into k; + insert into t2 values (k+5); + return k; +end| +create function f9() returns int +begin + update v2 set j=j+10 where j=1; + return 1; +end| +create function f10() returns int +begin + return f1(); +end| +create function f11() returns int +begin + declare k int; + set k= f1(); + insert into t2 values (k+5); + return k; +end| +create function f12(p int) returns int +begin + insert into t2 values (p); + return p; +end| +create function f13(p int) returns int +begin + return p; +end| +create procedure p2(inout p int) +begin + select i from t1 where i = 1 into p; +end| +create function f14() returns int +begin + declare k int; + call p2(k); + insert into t2 values (k+5); + return k; +end| +create function f15() returns int +begin + declare k int; + call p2(k); + return k; +end| +create trigger t4_bi before insert on t4 for each row +begin + declare k int; + select i from t1 where i=1 into k; + set new.l= k+1; +end| +create trigger t4_bu before update on t4 for each row +begin + if (select i from t1 where i=1) then + set new.l= 2; + end if; +end| +create trigger t4_bd before delete on t4 for each row +begin + if !(select i from v1 where i=1) then + signal sqlstate '45000'; + end if; +end| +create trigger t5_bi before insert on t5 for each row +begin + set new.l= f1()+1; +end| +create trigger t5_bu before update on t5 for each row +begin + declare j int; + call p2(j); + set new.l= j + 1; +end| +delimiter ;| + +--echo # +--echo # Set common variables to be used by the scripts +--echo # called below. +--echo # +let $con_aux1= con1; +let $con_aux2= con2; +let $table= t1; + +--echo # Switch to connection 'con1'. +connection con1; +--echo # Cache all functions used in the tests below so statements +--echo # calling them won't need to open and lock mysql.proc table +--echo # and we can assume that each statement locks its tables +--echo # once during its execution. +--disable_result_log +show create procedure p1; +show create procedure p2; +show create function f1; +show create function f2; +show create function f3; +show create function f4; +show create function f5; +show create function f6; +show create function f7; +show create function f8; +show create function f9; +show create function f10; +show create function f11; +show create function f12; +show create function f13; +show create function f14; +show create function f15; +--enable_result_log +--echo # Switch back to connection 'default'. +connection default; + +--echo # +--echo # 1. Statements that read tables and do not use subqueries. +--echo # + +--echo # +--echo # 1.1 Simple SELECT statement. +--echo # +--echo # No locks are necessary as this statement won't be written +--echo # to the binary log and thanks to how MyISAM works SELECT +--echo # will see version of the table prior to concurrent insert. +let $statement= select * from t1; +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 1.2 Multi-UPDATE statement. +--echo # +--echo # Has to take shared locks on rows in the table being read as this +--echo # statement will be written to the binary log and therefore should +--echo # be serialized with concurrent statements. +let $statement= update t2, t1 set j= j - 1 where i = j; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 1.3 Multi-DELETE statement. +--echo # +--echo # The above is true for this statement as well. +let $statement= delete t2 from t1, t2 where i = j; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 1.4 DESCRIBE statement. +--echo # +--echo # This statement does not really read data from the +--echo # target table and thus does not take any lock on it. +--echo # We check this for completeness of coverage. +lock table t1 write; +--echo # Switching to connection 'con1'. +connection con1; +--echo # This statement should not be blocked. +--disable_result_log +describe t1; +--enable_result_log +--echo # Switching to connection 'default'. +connection default; +unlock tables; + +--echo # +--echo # 1.5 SHOW statements. +--echo # +--echo # The above is true for SHOW statements as well. +lock table t1 write; +--echo # Switching to connection 'con1'. +connection con1; +--echo # These statements should not be blocked. +# The below test for SHOW CREATE TABLE is disabled until bug 52593 +# "SHOW CREATE TABLE is blocked if table is locked for write by another +# connection" is fixed. +--disable_parsing +show create table t1; +--enable_parsing +--disable_result_log +show keys from t1; +--enable_result_log +--echo # Switching to connection 'default'. +connection default; +unlock tables; + + +--echo # +--echo # 2. Statements which read tables through subqueries. +--echo # + +--echo # +--echo # 2.1 CALL with a subquery. +--echo # +--echo # A strong lock is not necessary as this statement is not +--echo # written to the binary log as a whole (it is written +--echo # statement-by-statement). +let $statement= call p1((select i + 5 from t1 where i = 1)); +let $restore_table= t2; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 2.2 CREATE TABLE with a subquery. +--echo # +--echo # Has to take a strong lock on the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent statements. +let $statement= create table t0 select * from t1; +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +drop table t0; +let $statement= create table t0 select j from t2 where j in (select i from t1); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +drop table t0; + +--echo # +--echo # 2.3 DELETE with a subquery. +--echo # +--echo # The above is true for this statement as well. +let $statement= delete from t2 where j in (select i from t1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 2.4 MULTI-DELETE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 2.5 DO with a subquery. +--echo # +--echo # A strong lock is not necessary as it is not logged. +let $statement= do (select i from t1 where i = 1); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 2.6 INSERT with a subquery. +--echo # +--echo # Has to take a strong lock on the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent inserts. +let $statement= insert into t2 select i+5 from t1; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= insert into t2 values ((select i+5 from t1 where i = 4)); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 2.7 LOAD DATA with a subquery. +--echo # +--echo # The above is true for this statement as well. +let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 2.8 REPLACE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= replace into t2 select i+5 from t1; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= replace into t2 values ((select i+5 from t1 where i = 4)); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 2.9 SELECT with a subquery. +--echo # +--echo # Strong locks are not necessary as this statement is not written +--echo # to the binary log and thanks to how MyISAM works this statement +--echo # sees a version of the table prior to the concurrent insert. +let $statement= select * from t2 where j in (select i from t1); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 2.10 SET with a subquery. +--echo # +--echo # The same is true for this statement as well. +let $statement= set @a:= (select i from t1 where i = 1); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 2.11 SHOW with a subquery. +--echo # +--echo # And for this statement too. +let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1); +let $restore_table= ; +--source include/check_concurrent_insert.inc +let $statement= show columns from t2 where (select i from t1 where i = 1); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 2.12 UPDATE with a subquery. +--echo # +--echo # Has to take a strong lock on the table being read as +--echo # this statement is written to the binary log and therefore +--echo # should be serialized with concurrent inserts. +let $statement= update t2 set j= j-10 where j in (select i from t1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 2.13 MULTI-UPDATE with a subquery. +--echo # +--echo # Same is true for this statement as well. +let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 3. Statements which read tables through a view. +--echo # + +--echo # +--echo # 3.1 SELECT statement which uses some table through a view. +--echo # +--echo # Since this statement is not written to the binary log and +--echo # an old version of the table is accessible thanks to how MyISAM +--echo # handles concurrent insert, no locking is necessary. +let $statement= select * from v1; +let $restore_table= ; +--source include/check_concurrent_insert.inc +let $statement= select * from v2; +let $restore_table= ; +--source include/check_concurrent_insert.inc +let $statement= select * from t2 where j in (select i from v1); +let $restore_table= ; +--source include/check_concurrent_insert.inc +let $statement= select * from t3 where k in (select j from v2); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 3.2 Statements which modify a table and use views. +--echo # +--echo # Since such statements are going to be written to the binary +--echo # log they need to be serialized against concurrent statements +--echo # and therefore should take strong locks on the data read. +let $statement= update t2 set j= j-10 where j in (select i from v1); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= update t3 set k= k-10 where k in (select j from v2); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= update t2, v1 set j= j-10 where j = i; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= update v2 set j= j-10 where j = 3; +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 4. Statements which read tables through stored functions. +--echo # + +--echo # +--echo # 4.1 SELECT/SET with a stored function which does not +--echo # modify data and uses SELECT in its turn. +--echo # +--echo # In theory there is no need to take strong locks on the table +--echo # being selected from in SF as the call to such function +--echo # won't get into the binary log. In practice, however, we +--echo # discover that fact too late in the process to be able to +--echo # affect the decision what locks should be taken. +--echo # Hence, strong locks are taken in this case. +let $statement= select f1(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f1(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.2 INSERT (or other statement which modifies data) with +--echo # a stored function which does not modify data and uses +--echo # SELECT. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data +--echo # it uses. Therefore it should take strong lock on the data +--echo # it reads. +let $statement= insert into t2 values (f1() + 5); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.3 SELECT/SET with a stored function which +--echo # reads and modifies data. +--echo # +--echo # Since a call to such function is written to the binary log, +--echo # it should be serialized with concurrent statements affecting +--echo # the data it uses. Hence, a strong lock on the data read +--echo # should be taken. +let $statement= select f2(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f2(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.4. SELECT/SET with a stored function which does not +--echo # modify data and reads a table through subselect +--echo # in a control construct. +--echo # +--echo # Again, in theory a call to this function won't get to the +--echo # binary log and thus no strong lock is needed. But in practice +--echo # we don't detect this fact early enough (get_lock_type_for_table()) +--echo # to avoid taking a strong lock. +let $statement= select f3(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f3(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +let $statement= select f4(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f4(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.5. INSERT (or other statement which modifies data) with +--echo # a stored function which does not modify data and reads +--echo # the table through a subselect in one of its control +--echo # constructs. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting data it +--echo # uses. Therefore it should take a strong lock on the data +--echo # it reads. +let $statement= insert into t2 values (f3() + 5); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= insert into t2 values (f4() + 6); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.6 SELECT/SET which uses a stored function with +--echo # DML which reads a table via a subquery. +--echo # +--echo # Since call to such function is written to the binary log +--echo # it should be serialized with concurrent statements. +--echo # Hence reads should take a strong lock. +let $statement= select f5(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f5(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.7 SELECT/SET which uses a stored function which +--echo # doesn't modify data and reads tables through +--echo # a view. +--echo # +--echo # Once again, in theory, calls to such functions won't +--echo # get into the binary log and thus don't need strong +--echo # locks. But in practice this fact is discovered +--echo # too late to have any effect. +let $statement= select f6(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f6(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= select f7(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= set @a:= f7(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.8 INSERT which uses stored function which +--echo # doesn't modify data and reads a table +--echo # through a view. +--echo # +--echo # Since such statement is written to the binary log and +--echo # should be serialized with concurrent statements affecting +--echo # the data it uses. Therefore it should take a strong lock on +--echo # the table it reads. +let $statement= insert into t3 values (f6() + 5); +let $restore_table= t3; +--source include/check_no_concurrent_insert.inc +let $statement= insert into t3 values (f7() + 5); +let $restore_table= t3; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 4.9 SELECT which uses a stored function which +--echo # modifies data and reads tables through a view. +--echo # +--echo # Since a call to such function is written to the binary log +--echo # it should be serialized with concurrent statements. +--echo # Hence, reads should take strong locks. +let $statement= select f8(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc +let $statement= select f9(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.10 SELECT which uses a stored function which doesn't modify +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # In theory, calls to such functions won't get into the binary +--echo # log and thus don't need to acquire strong locks. But in practice +--echo # this fact is discovered too late to have any effect. +let $statement= select f10(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.11 INSERT which uses a stored function which doesn't modify +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # Since such statement is written to the binary log, it should +--echo # be serialized with concurrent statements affecting the data it +--echo # uses. Therefore it should take strong locks on data it reads. +let $statement= insert into t2 values (f10() + 5); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.12 SELECT which uses a stored function which modifies +--echo # data and reads a table indirectly, by calling another +--echo # function. +--echo # +--echo # Since a call to such function is written to the binary log +--echo # it should be serialized from concurrent statements. +--echo # Hence, read should take a strong lock. +let $statement= select f11(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 4.13 SELECT that reads a table through a subquery passed +--echo # as a parameter to a stored function which modifies +--echo # data. +--echo # +--echo # Even though a call to this function is written to the +--echo # binary log, values of its parameters are written as literals. +--echo # So there is no need to acquire strong locks for tables used in +--echo # the subquery. +let $statement= select f12((select i+10 from t1 where i=1)); +let $restore_table= t2; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 4.14 INSERT that reads a table via a subquery passed +--echo # as a parameter to a stored function which doesn't +--echo # modify data. +--echo # +--echo # Since this statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data it +--echo # uses. Therefore it should take strong locks on the data it reads. +let $statement= insert into t2 values (f13((select i+10 from t1 where i=1))); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 5. Statements that read tables through stored procedures. +--echo # + +--echo # +--echo # 5.1 CALL statement which reads a table via SELECT. +--echo # +--echo # Since neither this statement nor its components are +--echo # written to the binary log, there is no need to take +--echo # strong locks on the data it reads. +let $statement= call p2(@a); +let $restore_table= ; +--source include/check_concurrent_insert.inc + +--echo # +--echo # 5.2 Function that modifes data and uses CALL, +--echo # which reads a table through SELECT. +--echo # +--echo # Since a call to such function is written to the binary +--echo # log, it should be serialized with concurrent statements. +--echo # Hence, in this case reads should take strong locks on data. +let $statement= select f14(); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 5.3 SELECT that calls a function that doesn't modify data and +--echo # uses a CALL statement that reads a table via SELECT. +--echo # +--echo # In theory, calls to such functions won't get into the binary +--echo # log and thus don't need to acquire strong locks. But in practice +--echo # this fact is discovered too late to have any effect. +let $statement= select f15(); +let $restore_table= ; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 5.4 INSERT which calls function which doesn't modify data and +--echo # uses CALL statement which reads table through SELECT. +--echo # +--echo # Since such statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting data it +--echo # uses. Therefore it should take strong locks on data it reads. +let $statement= insert into t2 values (f15()+5); +let $restore_table= t2; +--source include/check_no_concurrent_insert.inc + + +--echo # +--echo # 6. Statements that use triggers. +--echo # + +--echo # +--echo # 6.1 Statement invoking a trigger that reads table via SELECT. +--echo # +--echo # Since this statement is written to the binary log it should +--echo # be serialized with concurrent statements affecting the data +--echo # it uses. Therefore, it should take strong locks on the data +--echo # it reads. +let $statement= insert into t4 values (2); +let $restore_table= t4; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 6.2 Statement invoking a trigger that reads table through +--echo # a subquery in a control construct. +--echo # +--echo # The above is true for this statement as well. +let $statement= update t4 set l= 2 where l = 1; +let $restore_table= t4; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 6.3 Statement invoking a trigger that reads a table through +--echo # a view. +--echo # +--echo # And for this statement. +let $statement= delete from t4 where l = 1; +let $restore_table= t4; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 6.4 Statement invoking a trigger that reads a table through +--echo # a stored function. +--echo # +--echo # And for this statement. +let $statement= insert into t5 values (2); +let $restore_table= t5; +--source include/check_no_concurrent_insert.inc + +--echo # +--echo # 6.5 Statement invoking a trigger that reads a table through +--echo # stored procedure. +--echo # +--echo # And for this statement. +let $statement= update t5 set l= 2 where l = 1; +let $restore_table= t5; +--source include/check_no_concurrent_insert.inc + + +--echo # Clean-up. +drop function f1; +drop function f2; +drop function f3; +drop function f4; +drop function f5; +drop function f6; +drop function f7; +drop function f8; +drop function f9; +drop function f10; +drop function f11; +drop function f12; +drop function f13; +drop function f14; +drop function f15; +drop view v1, v2; +drop procedure p1; +drop procedure p2; +drop table t1, t2, t3, t4, t5; + +disconnect con1; +disconnect con2; + +set @@global.concurrent_insert= @old_concurrent_insert; + + +--echo # --echo # Test for bug #45143 "All connections hang on concurrent ALTER TABLE". --echo # --echo # Concurrent execution of statements which required weak write lock diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test index ef434e33cfa..0b4b9af5bc6 100644 --- a/mysql-test/t/mdl_sync.test +++ b/mysql-test/t/mdl_sync.test @@ -3468,6 +3468,27 @@ connection default; set debug_sync= 'RESET'; drop table t1; +--echo # +--echo # Bug#52856 concurrent show columns or show full columns causes a crash!!! +--echo # +CREATE TABLE t1(a CHAR(255)); + +connect(con1, localhost, root); +SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed"; +--send SHOW FULL COLUMNS FROM t1 + +connection default; +SET DEBUG_SYNC= "now WAIT_FOR waiting"; +--replace_column 8 # +SHOW FULL COLUMNS FROM t1; +SET DEBUG_SYNC= "now SIGNAL completed"; +--replace_column 8 # +connection con1; +--reap +connection default; +DROP TABLE t1; +disconnect con1; + # 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. diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index ab901185e43..a9d98da0403 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -126,7 +126,6 @@ drop table t3,t2,t1; # Test table without unions # create table t1 (a int not null, key(a)) engine=merge; ---error 1030 select * from t1; drop table t1; @@ -616,6 +615,14 @@ SHOW CREATE TABLE m1; DROP TABLE t1, m1; # +# BUG#35274 - merge table doesn't need any base tables, gives error 124 when +# key accessed +# +CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge; +SELECT MAX(a) FROM t1; +DROP TABLE t1; + +# # BUG#32047 - 'Spurious' errors while opening MERGE tables # CREATE TABLE t1(a INT); diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 36b6015c5d8..2ea169d950d 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -1468,3 +1468,27 @@ SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a; DROP TABLE t1, t2; --echo End of 5.1 tests + + +--echo # +--echo # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY +--echo # when it should use index +--echo # + +CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY); +CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY); +CREATE TABLE t3 (i3 integer); + +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12); +INSERT INTO t2 SELECT * FROM t1; + +EXPLAIN EXTENDED +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 + LEFT JOIN t3 ON t2.i2 = t3.i3 + ORDER BY t1.i1 LIMIT 5; + +SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 + LEFT JOIN t3 ON t2.i2 = t3.i3 + ORDER BY t1.i1 LIMIT 5; + +DROP TABLE t1, t2, t3; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index a2e3e43cdb9..1224dee24ed 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,6 +14,28 @@ drop table if exists t1, t2; --enable_warnings +--echo # Bug#39338: Fieldnames in +--echo # INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped +--echo # NOTE: the partition expression is saved as a string, so changing from +--echo # normal quotes to ansi quotes does not change the expression, only +--echo # for partition by KEY. +CREATE TABLE t1 ( + ID int(11) NOT NULL, + `aaaa,aaaaa` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', + ddddddddd int(11) NOT NULL DEFAULT '0', + new_field0 varchar(50), + PRIMARY KEY(ID, `aaaa,aaaaa`, ddddddddd)) +PARTITION BY RANGE(ID) +PARTITIONS 3 +SUBPARTITION BY LINEAR KEY(ID,`aaaa,aaaaa`) +SUBPARTITIONS 2 ( + PARTITION p01 VALUES LESS THAN(100), + PARTITION p11 VALUES LESS THAN(200), + PARTITION p21 VALUES LESS THAN MAXVALUE); +SELECT PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1'; +show create table t1; +drop table t1; + # # Bug#48276: can't add column if subpartition exists CREATE TABLE t1 (a INT, b INT) diff --git a/mysql-test/t/partition_binlog_stmt.test b/mysql-test/t/partition_binlog_stmt.test new file mode 100644 index 00000000000..bb52c2210f3 --- /dev/null +++ b/mysql-test/t/partition_binlog_stmt.test @@ -0,0 +1,28 @@ +--source include/have_partition.inc +--source include/have_binlog_format_statement.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--echo # +--echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into +--echo # partitioned MyISAM table +perl; +open( INIT, ">init_file.txt"); +print INIT "abcd\n"; +close( INIT ); +EOF + +CREATE TABLE t1 +(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + name TINYBLOB NOT NULL, + modified TIMESTAMP DEFAULT '0000-00-00 00:00:00', + INDEX namelocs (name(255))) ENGINE = MyISAM +PARTITION BY HASH(id) PARTITIONS 2; + +LOAD DATA LOCAL INFILE 'init_file.txt' +INTO TABLE t1 (name); + +--remove_file init_file.txt +DROP TABLE t1; diff --git a/mysql-test/t/partition_column.test b/mysql-test/t/partition_column.test index d1d2d666a39..95a2be36395 100644 --- a/mysql-test/t/partition_column.test +++ b/mysql-test/t/partition_column.test @@ -8,6 +8,32 @@ drop table if exists t1; --enable_warnings +--echo # +--echo # Bug#52815: LIST COLUMNS doesn't insert rows in correct partition +--echo # if muliple columns used +CREATE TABLE t1 ( +id INT NOT NULL, +name VARCHAR(255), +department VARCHAR(10), +country VARCHAR(255) +) PARTITION BY LIST COLUMNS (department, country) ( +PARTITION first_office VALUES IN (('dep1', 'Russia'), ('dep1', 'Croatia')), +PARTITION second_office VALUES IN (('dep2', 'Russia')) +); + +INSERT INTO t1 VALUES(1, 'Ann', 'dep1', 'Russia'); +INSERT INTO t1 VALUES(2, 'Bob', 'dep1', 'Croatia'); +INSERT INTO t1 VALUES(3, 'Cecil', 'dep2', 'Russia'); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES(3, 'Dan', 'dep2', 'Croatia'); +SELECT PARTITION_NAME,TABLE_ROWS +FROM INFORMATION_SCHEMA.PARTITIONS +WHERE TABLE_NAME = 't1'; +SHOW CREATE TABLE t1; +SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia'; +SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia'; +DROP TABLE t1; + # # Bug#51347: assertion with show create table + partition by columns # on decimal column diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index fe4829ad5d1..1496a626796 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -36,6 +36,38 @@ CREATE TABLE t1 (a INT) PARTITION BY HASH(a); --error ER_PARTITION_NO_TEMPORARY CREATE TEMPORARY TABLE tmp_t1 LIKE t1; DROP TABLE t1; +--echo # +--echo # Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with +--echo # subpartitions +SET @org_mode=@@sql_mode; +SET @@sql_mode='NO_DIR_IN_CREATE'; +SELECT @@sql_mode; +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +SUBPARTITION BY HASH(TO_DAYS(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE + DATA DIRECTORY = '/tmp/not-existing' + INDEX DIRECTORY = '/tmp/not-existing'); +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2 +(PARTITION p0 VALUES LESS THAN MAXVALUE + (SUBPARTITION sp0 + DATA DIRECTORY = '/tmp/not-existing' + INDEX DIRECTORY = '/tmp/not-existing', + SUBPARTITION sp1)); +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (id INT, purchased DATE) +PARTITION BY RANGE(YEAR(purchased)) +(PARTITION p0 VALUES LESS THAN MAXVALUE + DATA DIRECTORY = '/tmp/not-existing' + INDEX DIRECTORY = '/tmp/not-existing'); +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET @@sql_mode= @org_mode; --echo # --echo # Bug#50392: insert_id is not reset for partitioned tables diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test index e25a8b1f469..10d2e7a9ae5 100644 --- a/mysql-test/t/ps_3innodb.test +++ b/mysql-test/t/ps_3innodb.test @@ -8,6 +8,10 @@ # NOTE: PLEASE SEE ps_1general.test (bottom) # BEFORE ADDING NEW TEST CASES HERE !!! +# See Bug#38999 valgrind warnings for update statement in function +# compare_record() +-- source include/not_valgrind.inc + use test; -- source include/have_innodb.inc diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index ce75d02a1cc..fa003c2fe69 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1170,6 +1170,14 @@ DROP TABLE t1; DROP EVENT ev1; # +# Bug#30036 SHOW TABLE TYPES causes the debug client to crash +# +--disable_result_log +SHOW STORAGE ENGINES; +--enable_result_log + + +# # Bug#32710 SHOW INNODB STATUS requires SUPER # diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 5d9a2aaa5f4..1d4ef345747 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -542,3 +542,44 @@ select max(case 1 when 1 then c else null end) from t1 group by c; drop table t1; --echo End of 5.0 tests + +# +# Bug#52168 decimal casting catastrophes: +# crashes and valgrind errors on simple casts +# + +# Uninitialized read when calling Item_cache_decimal::val_int() +CREATE TABLE t1 (a INTEGER); +INSERT INTO t1 VALUES (NULL); +CREATE TABLE t2 (b INTEGER); +INSERT INTO t2 VALUES (NULL), (NULL); +SELECT b FROM t1 JOIN t2 WHERE CONVERT(a, DECIMAL)|CONVERT(b, DECIMAL); +DROP TABLE t1, t2; + +# +# Bug#52122 crash when converting derived table column to decimal +# +CREATE TABLE t1 (col0 INTEGER, col1 REAL); +CREATE TABLE t2 (col0 INTEGER); +INSERT INTO t1 VALUES (0, 0.0), (NULL, NULL); +INSERT INTO t2 VALUES (1); + +# Uninitialized read when calling Item_cache_decimal::val_real() +SELECT 1 FROM t1 +JOIN +( + SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0) + GROUP BY t2.col0 +) AS subq +WHERE t1.col1 + CAST(subq.col0 AS DECIMAL); + +# Uninitialized read when calling Item_cache_decimal::val_str() +SELECT 1 FROM t1 +JOIN +( + SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0) + GROUP BY t2.col0 +) AS subq +WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL)); + +DROP TABLE t1, t2; diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 6b10e4cb544..83896378883 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -174,6 +174,24 @@ } { + libz longest_match called from btr_store_big_rec_extern_fields + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:btr_store_big_rec_extern_fields +} + +{ + libz longest_match called from page_zip_compress + Memcheck:Cond + fun:longest_match + fun:deflate_slow + fun:deflate + fun:page_zip_compress +} + +{ libz longest_match2 Memcheck:Cond fun:longest_match @@ -722,3 +740,8 @@ fun:pthread_create* } +{ + buf_buddy_relocate peeking (space,page) in potentially free blocks + Memcheck:Addr1 + fun:buf_buddy_relocate +} |