diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-12-05 12:33:02 -0500 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-12-05 12:33:02 -0500 |
commit | 3bb02f3e6d70687b02c6902fd6478e8c328608f8 (patch) | |
tree | 7962068cae78450246a484cf95cbe5cf2e37382a /mysql-test | |
parent | a4cdd20d49a5a6ca0eb7346b7b9e898ac5e7995b (diff) | |
parent | ffc0ef63164e9a121d8a02323afe32a82299171e (diff) | |
download | mariadb-git-3bb02f3e6d70687b02c6902fd6478e8c328608f8.tar.gz |
bzr merge -rtag:mariadb-10.0.15 maria/10.0
Diffstat (limited to 'mysql-test')
175 files changed, 11092 insertions, 266 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test index 549d184185d..765757c3427 100644 --- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test +++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test @@ -32,7 +32,7 @@ INSERT INTO tt_2(ddl_case) VALUES(0); --echo # CHECK IMPLICT COMMIT --echo ######################################################################### SET AUTOCOMMIT= 0; -let $ddl_cases= 41; +let $ddl_cases= 43; while ($ddl_cases >= 1) { --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- @@ -84,6 +84,15 @@ while ($ddl_cases >= 1) let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1); --enable_query_log eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases); + + if ($ddl_cases == 43) + { + let $cmd= CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; + } + if ($ddl_cases == 42) + { + let $cmd= DROP FUNCTION myfunc_int; + } if ($ddl_cases == 41) { let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; @@ -611,6 +620,7 @@ while ($ddl_cases >= 1) let $commit_event_row_number= 6; } } + --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --eval $cmd --disable_query_log # @@ -634,6 +644,7 @@ while ($ddl_cases >= 1) exit; } } + --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- let $binlog_start= $first_binlog_position; --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc index 8941779947a..c71c45a57c5 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc @@ -113,6 +113,19 @@ if ($commands == 'configure') RETURN "fc_i_nt_5_suc"; END| + CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) + BEGIN + DECLARE in_stmt_id INTEGER; + SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; + SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; + INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); + + SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; + SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; + INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); + RETURN "fc_i_nt_3_tt_3_suc"; + END| + CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -186,6 +199,7 @@ if ($commands == 'clean') DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; + DROP FUNCTION fc_i_nt_3_tt_3_suc; --disable_query_log if ($database_name != 'test') @@ -439,6 +453,21 @@ while ($commands != '') eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id)); inc $stmt_id; } + if ($command == 'set-T') + { + --eval SET @var= fc_i_tt_5_suc($trans_id, $stmt_id) + inc $stmt_id; + } + if ($command == 'set-N') + { + --eval SET @var= fc_i_nt_5_suc($trans_id, $stmt_id) + inc $stmt_id; + } + if ($command == 'set-NT') + { + --eval SET @var= fc_i_nt_3_tt_3_suc($trans_id, $stmt_id) + inc $stmt_id; + } if ($command == 'CS-T->T') { --eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM tt_1; diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test index 991e1c465e9..ce6dee7c62e 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -1763,6 +1763,43 @@ connection master; --echo ################################################################################### +--echo # 5 - SET WITH ROW CHANGES +--echo ################################################################################### +--let $commands= set-T +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= set-N +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= set-NT +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-N set-T C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-N C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-N set-T R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-N R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-NT set-T C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-NT C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-NT set-T R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-NT R +--source extra/rpl_tests/rpl_mixing_engines.inc + + +--echo ################################################################################### --echo # CHECK CONSISTENCY --echo ################################################################################### connection master; diff --git a/mysql-test/include/function_defaults.inc b/mysql-test/include/function_defaults.inc index e588c82df1b..cb8e8f86f93 100644 --- a/mysql-test/include/function_defaults.inc +++ b/mysql-test/include/function_defaults.inc @@ -408,15 +408,28 @@ UPDATE t1 SET c = 2; SELECT * FROM t1; --echo # +--echo # Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +--echo # + +--echo # 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; + +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; + +UPDATE t1 SET c = 3; +SELECT * FROM t1; + +--echo # --echo # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP --echo # --echo # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; +UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; -UPDATE t1 t11, t1 t12 SET t11.c = 3; +UPDATE t1 t11, t1 t12 SET t11.c = 2; SELECT * FROM t1; DROP TABLE t1; @@ -1037,7 +1050,7 @@ SET TIME_ZONE = "+03:00"; --echo # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp) ENGINE = INNODB; +eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp); SHOW CREATE TABLE t1; @@ -1094,10 +1107,10 @@ eval CREATE TABLE t1 ( b INT, ts $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp, PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -eval CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +eval CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 @@ -1133,8 +1146,7 @@ eval ALTER TABLE t1 ADD COLUMN c4 $datetime ON UPDATE $now AFTER c3; eval ALTER TABLE t1 ADD COLUMN c5 $datetime DEFAULT $now AFTER c4; eval ALTER TABLE t1 ADD COLUMN c6 $datetime DEFAULT $now ON UPDATE $now AFTER c5; -SELECT * FROM t1; - +query_vertical SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/include/rpl_connect.inc b/mysql-test/include/rpl_connect.inc index 95912d57469..11927833f53 100644 --- a/mysql-test/include/rpl_connect.inc +++ b/mysql-test/include/rpl_connect.inc @@ -42,7 +42,7 @@ if (!$rpl_connection_name) --let $_rpl_port= \$SERVER_MYPORT_$rpl_server_number if (!$_rpl_port) { - --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cfg file. + --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cnf file. --die Not all SERVER_MYPORT_* environment variables are setup correctly. } diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 9a39ec67d0e..7917b6740cf 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -88,6 +88,7 @@ let $script= s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>}; s{rand_seed1=[0-9]*,rand_seed2=[0-9]*}{rand_seed1=<seed 1>,rand_seed2=<seed 2>}; s{((?:master|slave|slave-relay)-bin\.[0-9]{6};pos=)[0-9]+DOLLAR}{DOLLAR1POS}; + s{SONAME ".*"}{SONAME "LIB"}; s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; || --let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; diff --git a/mysql-test/include/wait_innodb_all_purged.inc b/mysql-test/include/wait_innodb_all_purged.inc new file mode 100644 index 00000000000..97b038acc44 --- /dev/null +++ b/mysql-test/include/wait_innodb_all_purged.inc @@ -0,0 +1,59 @@ +# include/wait_innodb_all_purged.inc +# +# SUMMARY +# +# Waits until purged all undo records of innodb, or operation times out. +# +# USAGE +# +# --source include/wait_innodb_all_purged.inc +# +--source include/have_innodb.inc +--source include/have_debug.inc + +--disable_query_log + +let $wait_counter_init= 300; +if ($wait_timeout) +{ + let $wait_counter_init= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +let $wait_counter= $wait_counter_init; + +# Keep track of how many times the wait condition is tested +let $wait_condition_reps= 0; +let $prev_trx_age= 0; +while ($wait_counter) +{ + let $trx_age = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';`; + + if ($trx_age != $prev_trx_age) + { + let $wait_counter= $wait_counter_init; + let $prev_trx_age= $trx_age; + } + + let $success= `SELECT $trx_age < 1`; + inc $wait_condition_reps; + if ($success) + { + let $wait_counter= 0; + } + if (!$success) + { + set global innodb_purge_run_now=ON; + real_sleep 0.1; + dec $wait_counter; + } +} +if (!$success) +{ + echo Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = $trx_age; +} + +--enable_query_log diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 483bf0bd4f3..1776f1008da 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -110,6 +110,8 @@ sub check_socket_path_length { # This may not be true, but we can't test for it on AIX due to Perl bug # See Bug #45771 return 0 if ($^O eq 'aix'); + # See Debian bug #670722 - failing on kFreeBSD even after setting short path + return 0 if $^O eq 'gnukfreebsd' and length $path < 40; require IO::Socket::UNIX; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e0c5c8663fb..befdf3a3ffd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -333,7 +333,7 @@ sub testcase_timeout ($) { return $opt_testcase_timeout * 60; } -sub check_timeout ($) { return testcase_timeout($_[0]) / 10; } +sub check_timeout ($) { return testcase_timeout($_[0]); } our $opt_warnings= 1; @@ -4881,6 +4881,8 @@ sub extract_warning_lines ($$) { qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|, qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind + qr|Failed to setup SSL|, + qr|SSL error: Failed to set ciphers to use|, # Galera-related warnings. qr|WSREP:.*down context.*|, qr|WSREP: Failed to send state UUID:.*|, diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 41a2200c13f..ec70dba674f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -2609,5 +2609,52 @@ a b 1 1 unlock tables; drop table t1,t2; +# +# MDEV-6179: dynamic columns functions/cast()/convert() doesn't +# play nice with CREATE/ALTER TABLE +# +create table t1 ( +color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent, +cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent, +item_name varchar(32) primary key, -- A common attribute for all items +i int, +dynamic_cols blob -- Dynamic columns will be stored here +); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES +('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES +('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2); +select item_name, color, cl from t1; +item_name color cl +MariaDB T-shirt blue blue +Thinkpad Laptop black ttt +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT, + `cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT, + `item_name` varchar(32) NOT NULL, + `i` int(11) DEFAULT NULL, + `dynamic_cols` blob, + PRIMARY KEY (`item_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 ( +n int, +c char(32) as (convert(cast(n as char), char)) persistent +); +insert into t1(n) values (1),(2),(3); +select * from t1; +n c +1 1 +2 2 +3 3 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `n` int(11) DEFAULT NULL, + `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; create table t1; ERROR 42000: A table must have at least 1 column diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result new file mode 100644 index 00000000000..4b170ee4c9b --- /dev/null +++ b/mysql-test/r/ctype_cp932.result @@ -0,0 +1,35 @@ +# +# Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE +# USED. +# +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET character_set_client= 'utf8'; +SET character_set_connection= 'utf8'; +SET character_set_results= 'utf8'; +CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin); +INSERT INTO t1 VALUES('カカ'); +SELECT * FROM t1 WHERE a LIKE '%カ'; +a +カカ +SELECT * FROM t1 WHERE a LIKE '_カ'; +a +カカ +SELECT * FROM t1 WHERE a LIKE '%_カ'; +a +カカ +ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin; +SELECT * FROM t1 WHERE a LIKE '%カ'; +a +カカ +SELECT * FROM t1 WHERE a LIKE '_カ'; +a +カカ +SELECT * FROM t1 WHERE a LIKE '%_カ'; +a +カカ +DROP TABLE t1; +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index af69a9e77d6..5ca7d1689d2 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); show variables like 'collation_server'; Variable_name Value collation_server ucs2_unicode_ci diff --git a/mysql-test/r/ctype_ucs2_query_cache.result b/mysql-test/r/ctype_ucs2_query_cache.result index 6f26bed02da..9a7580324c1 100644 --- a/mysql-test/r/ctype_ucs2_query_cache.result +++ b/mysql-test/r/ctype_ucs2_query_cache.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); # # Start of 5.5 tests # diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result index 825ad8dac21..56e2ef96ead 100644 --- a/mysql-test/r/ctype_upgrade.result +++ b/mysql-test/r/ctype_upgrade.result @@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci; # Checking mysql_upgrade # # Running mysql_upgrade -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -258,9 +258,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -279,10 +279,11 @@ test.maria050313_ucs2_croatian_ci_def OK test.maria050313_utf8_croatian_ci OK test.maria050533_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # Running mysql_upgrade for the second time # This should report OK for all tables -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -313,9 +314,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -328,6 +329,7 @@ test.maria050313_utf8_croatian_ci OK test.maria050533_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK test.mysql050614_xxx_croatian_ci OK +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def; Table Create Table diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 074fc28a6b7..2d91ce3dd6f 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1573,6 +1573,13 @@ a 512 Warnings: Warning 1260 Row 1 was cut by GROUP_CONCAT() # +# MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS.. +# +DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +ERROR HY000: Invalid utf16 character string: 'DE9899' +DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +ERROR HY000: Invalid utf16 character string: 'DE9899' +# # End of 5.5 tests # # diff --git a/mysql-test/r/ctype_utf16_def.result b/mysql-test/r/ctype_utf16_def.result index 6514734cb38..9d3d110fc99 100644 --- a/mysql-test/r/ctype_utf16_def.result +++ b/mysql-test/r/ctype_utf16_def.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use utf16 as character_set_client"); SHOW VARIABLES LIKE 'collation_server'; Variable_name Value collation_server utf16_general_ci diff --git a/mysql-test/r/derived_opt.result b/mysql-test/r/derived_opt.result index f5e7393591c..a2e08eacebc 100644 --- a/mysql-test/r/derived_opt.result +++ b/mysql-test/r/derived_opt.result @@ -1,4 +1,5 @@ -drop table if exists t1,t2,t3; +drop table if exists t0,t1,t2,t3; +drop database if exists test1; set @exit_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=on,derived_with_keys=on'; set @save_optimizer_switch=@@optimizer_switch; @@ -352,4 +353,155 @@ pk pk 72 72 80 80 drop table t1, t2, t3, t4; +# +# MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled +# +create database test1; +use test1; +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +CREATE TABLE t0 ( +f1 bigint(20) DEFAULT NULL, +f2 char(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two'); +CREATE TABLE t1 ( +f1 decimal(64,30) DEFAULT NULL, +f2 varchar(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES +(NULL,'numeric column is NULL'), +(0.000000000000000000000000000000,NULL), +(5.000000000000000000000000000000,'five'), +(1.000000000000000000000000000000,'one'), +(3.000000000000000000000000000000,'three'); +CREATE TABLE t2 ( +f1 double DEFAULT NULL, +f2 varbinary(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three'); +create VIEW v0 AS select f1,f2 from t1 ; +create VIEW v1 AS select tab1_v1.f1,tab1_v1.f2 from t1 tab1_v1 join v0 tab2 on tab1_v1.f1 = tab2.f1 and tab1_v1.f2 = tab2.f2; +create VIEW v2 AS select tab1_v2.f1,tab1_v2.f2 from t2 tab1_v2 join v1 tab2 on tab1_v2.f1 = tab2.f1 and tab1_v2.f2 = tab2.f2; +create VIEW v3 AS select tab1_v3.f1,tab1_v3.f2 from t0 tab1_v3 join v2 tab2 on tab1_v3.f1 = tab2.f1 and tab1_v3.f2 = tab2.f2; +create VIEW v4 AS select tab1_v4.f1,tab1_v4.f2 from t1 tab1_v4 join v3 tab2 on tab1_v4.f1 = tab2.f1 and tab1_v4.f2 = tab2.f2; +create VIEW v5 AS select tab1_v5.f1,tab1_v5.f2 from t2 tab1_v5 join v4 tab2 on tab1_v5.f1 = tab2.f1 and tab1_v5.f2 = tab2.f2; +create VIEW v6 AS select tab1_v6.f1,tab1_v6.f2 from t0 tab1_v6 join v5 tab2 on tab1_v6.f1 = tab2.f1 and tab1_v6.f2 = tab2.f2; +create VIEW v7 AS select tab1_v7.f1,tab1_v7.f2 from t1 tab1_v7 join v6 tab2 on tab1_v7.f1 = tab2.f1 and tab1_v7.f2 = tab2.f2; +create VIEW v8 AS select tab1_v8.f1,tab1_v8.f2 from t2 tab1_v8 join v7 tab2 on tab1_v8.f1 = tab2.f1 and tab1_v8.f2 = tab2.f2; +create VIEW v9 AS select tab1_v9.f1,tab1_v9.f2 from t0 tab1_v9 join v8 tab2 on tab1_v9.f1 = tab2.f1 and tab1_v9.f2 = tab2.f2; +create VIEW v10 AS select tab1_v10.f1,tab1_v10.f2 from t1 tab1_v10 join v9 tab2 on tab1_v10.f1 = tab2.f1 and tab1_v10.f2 = tab2.f2; +create VIEW v11 AS select tab1_v11.f1,tab1_v11.f2 from t2 tab1_v11 join v10 tab2 on tab1_v11.f1 = tab2.f1 and tab1_v11.f2 = tab2.f2; +create VIEW v12 AS select tab1_v12.f1,tab1_v12.f2 from t0 tab1_v12 join v11 tab2 on tab1_v12.f1 = tab2.f1 and tab1_v12.f2 = tab2.f2; +create VIEW v13 AS select tab1_v13.f1,tab1_v13.f2 from t1 tab1_v13 join v12 tab2 on tab1_v13.f1 = tab2.f1 and tab1_v13.f2 = tab2.f2; +create VIEW v14 AS select tab1_v14.f1,tab1_v14.f2 from t2 tab1_v14 join v13 tab2 on tab1_v14.f1 = tab2.f1 and tab1_v14.f2 = tab2.f2; +create VIEW v15 AS select tab1_v15.f1,tab1_v15.f2 from t0 tab1_v15 join v14 tab2 on tab1_v15.f1 = tab2.f1 and tab1_v15.f2 = tab2.f2; +create VIEW v16 AS select tab1_v16.f1,tab1_v16.f2 from t1 tab1_v16 join v15 tab2 on tab1_v16.f1 = tab2.f1 and tab1_v16.f2 = tab2.f2; +create VIEW v17 AS select tab1_v17.f1,tab1_v17.f2 from t2 tab1_v17 join v16 tab2 on tab1_v17.f1 = tab2.f1 and tab1_v17.f2 = tab2.f2; +create VIEW v18 AS select tab1_v18.f1,tab1_v18.f2 from t0 tab1_v18 join v17 tab2 on tab1_v18.f1 = tab2.f1 and tab1_v18.f2 = tab2.f2; +create VIEW v19 AS select tab1_v19.f1,tab1_v19.f2 from t1 tab1_v19 join v18 tab2 on tab1_v19.f1 = tab2.f1 and tab1_v19.f2 = tab2.f2; +create VIEW v20 AS select tab1_v20.f1,tab1_v20.f2 from t2 tab1_v20 join v19 tab2 on tab1_v20.f1 = tab2.f1 and tab1_v20.f2 = tab2.f2; +create VIEW v21 AS select tab1_v21.f1,tab1_v21.f2 from t0 tab1_v21 join v20 tab2 on tab1_v21.f1 = tab2.f1 and tab1_v21.f2 = tab2.f2; +create VIEW v22 AS select tab1_v22.f1,tab1_v22.f2 from t1 tab1_v22 join v21 tab2 on tab1_v22.f1 = tab2.f1 and tab1_v22.f2 = tab2.f2; +create VIEW v23 AS select tab1_v23.f1,tab1_v23.f2 from t2 tab1_v23 join v22 tab2 on tab1_v23.f1 = tab2.f1 and tab1_v23.f2 = tab2.f2; +create VIEW v24 AS select tab1_v24.f1,tab1_v24.f2 from t0 tab1_v24 join v23 tab2 on tab1_v24.f1 = tab2.f1 and tab1_v24.f2 = tab2.f2; +create VIEW v25 AS select tab1_v25.f1,tab1_v25.f2 from t1 tab1_v25 join v24 tab2 on tab1_v25.f1 = tab2.f1 and tab1_v25.f2 = tab2.f2; +create VIEW v26 AS select tab1_v26.f1,tab1_v26.f2 from t2 tab1_v26 join v25 tab2 on tab1_v26.f1 = tab2.f1 and tab1_v26.f2 = tab2.f2; +create VIEW v27 AS select tab1_v27.f1,tab1_v27.f2 from t0 tab1_v27 join v26 tab2 on tab1_v27.f1 = tab2.f1 and tab1_v27.f2 = tab2.f2; +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +# This used to hang forever: +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +use test; +drop database test1; +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +# +# MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost() +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c text); +insert into t2 +select +A.a + B.a* 10, +A.a + B.a* 10, +'blob-data' +from t1 A, t1 B; +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=6; +set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on'; +explain +select * from +t1 join +(select * from t2 order by a limit 1000) as D1 +where +D1.a= t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY <derived2> hash_ALL key0 #hash#key0 5 test.t1.a 100 Using join buffer (flat, BNLH join) +2 DERIVED t2 ALL NULL NULL NULL NULL 100 Using filesort +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +drop table t1, t2; set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 4753728793a..cc4e8074395 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1777,5 +1777,27 @@ group_concat(cast(column_json(dyn) as char)) {"name1":"value1","name2":"value2"} drop table t1; # +# MDEV-7116: Dynamic column hangs/segfaults +# +create table t1 ( +impressions mediumblob +); +insert into t1 values (""); +update t1 +set impressions = column_add(impressions, +'total', 12, +'2014-10-28 16:00:00', 3, +'2014-10-30 15:00:00', 3, +'2014-11-04 09:00:00', 6 +); +update t1 +set impressions = column_add(impressions, +'total', "a12", +'2014-10-28 16:00:00', "a3", +'2014-10-30 15:00:00', "a3", +'2014-11-04 09:00:00', "a6" + ); +drop table t1; +# # end of 10.0 tests # diff --git a/mysql-test/r/ext_key_noPK_6794.result b/mysql-test/r/ext_key_noPK_6794.result new file mode 100644 index 00000000000..59344522887 --- /dev/null +++ b/mysql-test/r/ext_key_noPK_6794.result @@ -0,0 +1,20 @@ +create table t1 (c1 int not null, c2 int, unique index(c1), index (c2)) engine=innodb; +insert into t1 (c1, c2) select 1, round(rand()*100); +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +select count(*) from t1; +count(*) +8 +explain select * from t1 where c2 = 1 order by c1; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys c2 +key c2 +key_len 5 +ref const +rows 1 +Extra Using where; Using index +drop table t1; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 22b75de8c60..9fde006b377 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -147,3 +147,11 @@ DROP TABLE t1; # # End of 5.3 tests # +SELECT UNCOMPRESS(CAST(0 AS BINARY(5))); +UNCOMPRESS(CAST(0 AS BINARY(5))) +NULL +Warnings: +Warning 1259 ZLIB: Input data corrupted +# +# End of 5.5 tests +# diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index b777af767cb..641c4fddbf7 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -839,3 +839,9 @@ SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2'); REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2') /abc SET default_regex_flags=DEFAULT; +# +# MDEV-6965 non-captured group \2 in regexp_replace +# +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); +REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that') +1 this and that diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 2c1c416472f..97ef61047a5 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -320,3 +320,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0))) drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +# +SELECT NOT NOT strcmp('a','b'); +NOT NOT strcmp('a','b') +1 +EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')` +# +# End of 10.0 tests +# diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result index 27b9ee0a323..50183a1f416 100644 --- a/mysql-test/r/function_defaults.result +++ b/mysql-test/r/function_defaults.result @@ -435,18 +435,31 @@ SELECT * FROM t1; a b c 2011-04-20 09:53:41 2011-04-20 09:53:41 2 # +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +# # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP # # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; +UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; a b c -2011-04-20 09:53:41 2011-04-20 09:53:41 2 -UPDATE t1 t11, t1 t12 SET t11.c = 3; +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; SELECT * FROM t1; a b c -2011-04-20 15:06:13 2011-04-20 15:06:13 3 +2011-04-20 15:06:13 2011-04-20 15:06:13 2 DROP TABLE t1; # # Test of a multiple-table update where only one table is updated and @@ -1421,13 +1434,13 @@ drop table t1; SET TIME_ZONE = "+03:00"; # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) ENGINE = INNODB; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -1477,9 +1490,9 @@ a INT, b INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 SET t1.b = t1.b + 1 @@ -1508,8 +1521,19 @@ ALTER TABLE t1 ADD COLUMN c4 DATETIME ON UPDATE NOW() AFTER c3; ALTER TABLE t1 ADD COLUMN c5 DATETIME DEFAULT NOW() AFTER c4; ALTER TABLE t1 ADD COLUMN c6 DATETIME DEFAULT NOW() ON UPDATE NOW() AFTER c5; SELECT * FROM t1; -a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 -0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 1 0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 +a1 0000-00-00 00:00:00 +a2 1970-01-01 03:16:40 +a3 1970-01-01 03:16:40 +a4 NULL +a5 1970-01-01 03:16:40 +a6 1970-01-01 03:16:40 +b 1 +c1 0000-00-00 00:00:00 +c2 1970-01-01 03:16:40 +c3 1970-01-01 03:16:40 +c4 NULL +c5 1970-01-01 03:16:40 +c6 1970-01-01 03:16:40 DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b DATETIME DEFAULT NOW() ); INSERT INTO t1 VALUES (); @@ -1967,18 +1991,31 @@ SELECT * FROM t1; a b c 2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 # +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +# # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP # # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; +UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; a b c -2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 -UPDATE t1 t11, t1 t12 SET t11.c = 3; +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; SELECT * FROM t1; a b c -2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 3 +2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 2 DROP TABLE t1; # # Test of a multiple-table update where only one table is updated and @@ -2953,13 +2990,13 @@ drop table t1; SET TIME_ZONE = "+03:00"; # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)) ENGINE = INNODB; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -3009,9 +3046,9 @@ a INT, b INT, ts TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 SET t1.b = t1.b + 1 @@ -3040,8 +3077,19 @@ ALTER TABLE t1 ADD COLUMN c4 DATETIME(6) ON UPDATE NOW(6) AFTER c3; ALTER TABLE t1 ADD COLUMN c5 DATETIME(6) DEFAULT NOW(6) AFTER c4; ALTER TABLE t1 ADD COLUMN c6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c5; SELECT * FROM t1; -a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 -0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 1 0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 +a1 0000-00-00 00:00:00.000000 +a2 1970-01-01 03:16:40.000000 +a3 1970-01-01 03:16:40.000000 +a4 NULL +a5 1970-01-01 03:16:40.000000 +a6 1970-01-01 03:16:40.000000 +b 1 +c1 0000-00-00 00:00:00.000000 +c2 1970-01-01 03:16:40.000000 +c3 1970-01-01 03:16:40.000000 +c4 NULL +c5 1970-01-01 03:16:40.000000 +c6 1970-01-01 03:16:40.000000 DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b DATETIME(6) DEFAULT NOW(6) ); INSERT INTO t1 VALUES (); diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result new file mode 100644 index 00000000000..302d4c85e05 --- /dev/null +++ b/mysql-test/r/function_defaults_innodb.result @@ -0,0 +1,3116 @@ +# +# Test of function defaults for any server, including embedded. +# +set default_storage_engine=innodb; +# +# Function defaults run 1. No microsecond precision. +# +SET TIME_ZONE = "+00:00"; +# +# Test of errors for column data types that dont support function +# defaults. +# +CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +# +# Test that the default clause behaves like NOW() regarding time zones. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NULL, +e DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +f DATETIME DEFAULT CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h DATETIME +); +# 2011-09-27 14:11:08 UTC +SET TIMESTAMP = 1317132668.654321; +SET @old_time_zone = @@TIME_ZONE; +SET TIME_ZONE = "+05:00"; +INSERT INTO t1( d, h ) VALUES ( NOW(), NOW() ); +SELECT * FROM t1; +a b c d e f g h +2011-09-27 19:11:08 2011-09-27 19:11:08 0000-00-00 00:00:00 2011-09-27 19:11:08 2011-09-27 19:11:08 2011-09-27 19:11:08 NULL 2011-09-27 19:11:08 +# 1989-05-13 01:02:03 +SET TIMESTAMP = 611017323.543212; +UPDATE t1 SET d = NOW(), h = NOW(); +SELECT * FROM t1; +a b c d e f g h +1989-05-13 04:02:03 2011-09-27 19:11:08 1989-05-13 04:02:03 1989-05-13 04:02:03 1989-05-13 04:02:03 2011-09-27 19:11:08 1989-05-13 04:02:03 1989-05-13 04:02:03 +SET TIME_ZONE = @old_time_zone; +DROP TABLE t1; +# +# Test of several TIMESTAMP columns with different function defaults. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +f INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( f ) VALUES (1); +SELECT * FROM t1; +a b c d e f +2011-04-19 07:22:02 2011-04-19 07:22:02 2011-04-19 07:22:02 0000-00-00 00:00:00 0000-00-00 00:00:00 1 +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.132435; +UPDATE t1 SET f = 2; +SELECT * FROM t1; +a b c d e f +2011-04-19 07:23:18 2011-04-19 07:23:18 2011-04-19 07:22:02 2011-04-19 07:23:18 2011-04-19 07:23:18 2 +DROP TABLE t1; +# +# Test of inserted values out of order. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +j INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( j, a ) VALUES ( 1, 1 ); +SELECT * FROM t1; +a b c d e f g h i j +1 2011-04-19 07:22:02 2011-04-19 07:22:02 0000-00-00 00:00:00 NULL NULL 2011-04-19 07:22:02 NULL 2011-04-19 07:22:02 1 +DROP TABLE t1; +# +# Test of ON DUPLICATE KEY UPDATE +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b INT, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +f TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +g TIMESTAMP NULL, +h DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP, +j DATETIME ON UPDATE CURRENT_TIMESTAMP, +k DATETIME NULL, +l DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +# 1977-12-21 23:00:00 UTC +SET TIMESTAMP = 251593200.192837; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 NULL 1977-12-21 23:00:00 1977-12-21 23:00:00 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 1977-12-21 23:00:00 1977-12-21 23:00:00 NULL NULL 1986-09-27 03:00:00 +# 1975-05-21 23:00:00 UTC +SET TIMESTAMP = 169945200.918273; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 1986-09-27 03:00:00 NULL 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 NULL 1986-09-27 03:00:00 +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1(a) VALUES (2) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 1986-09-27 03:00:00 NULL 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 NULL 1986-09-27 03:00:00 +2 NULL 1973-08-14 09:11:22 1973-08-14 09:11:22 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 1973-08-14 09:11:22 1973-08-14 09:11:22 NULL NULL 1986-09-27 03:00:00 +DROP TABLE t1; +CREATE TABLE t1 ( a INT PRIMARY KEY, b INT, c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.945156; +INSERT INTO t1 VALUES +(1, 0, '2001-01-01 01:01:01.111111'), +(2, 0, '2002-02-02 02:02:02.222222'), +(3, 0, '2003-03-03 03:03:03.333333'); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 0 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +UPDATE t1 SET b = 2, c = c WHERE a = 2; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +INSERT INTO t1 (a) VALUES (4); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +4 NULL 2011-04-19 07:23:18 +UPDATE t1 SET c = '2004-04-04 04:04:04.444444' WHERE a = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +4 NULL 2004-04-04 04:04:04 +INSERT INTO t1 ( a ) VALUES ( 3 ), ( 5 ) ON DUPLICATE KEY UPDATE b = 3, c = c; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 3 2003-03-03 03:03:03 +4 NULL 2004-04-04 04:04:04 +5 NULL 2011-04-19 07:23:18 +INSERT INTO t1 (a, c) VALUES +(4, '2004-04-04 00:00:00.444444'), +(6, '2006-06-06 06:06:06.666666') +ON DUPLICATE KEY UPDATE b = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 3 2003-03-03 03:03:03 +4 4 2011-04-19 07:23:18 +5 NULL 2011-04-19 07:23:18 +6 NULL 2006-06-06 06:06:06 +DROP TABLE t1; +# +# Test of REPLACE INTO executed as UPDATE. +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +e DATETIME DEFAULT CURRENT_TIMESTAMP, +f TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h TIMESTAMP NULL, +i DATETIME +); +# 1970-09-21 09:11:12 UTC +SET TIMESTAMP = 22756272.163584; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-09-21 09:11:12 1970-09-21 09:11:12 1970-09-21 09:11:12 1970-09-21 09:11:12 0000-00-00 00:00:00 NULL NULL NULL +# 1970-11-10 14:16:17 UTC +SET TIMESTAMP = 27094577.852954; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-11-10 14:16:17 1970-11-10 14:16:17 1970-11-10 14:16:17 1970-11-10 14:16:17 0000-00-00 00:00:00 NULL NULL NULL +DROP TABLE t1; +# +# Test of insertion of NULL, DEFAULT and an empty row for DEFAULT +# CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.163578; +INSERT INTO t1 VALUES (NULL, NULL, 1), (DEFAULT, DEFAULT, 2); +INSERT INTO t1 ( a, b, c ) VALUES (NULL, NULL, 3), (DEFAULT, DEFAULT, 4); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 NULL 1 +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +2011-04-20 09:53:41 NULL 3 +2011-04-20 09:53:41 2011-04-20 09:53:41 4 +SET TIME_ZONE = "+03:00"; +SELECT * FROM t1; +a b c +2011-04-20 12:53:41 NULL 1 +2011-04-20 12:53:41 2011-04-20 09:53:41 2 +2011-04-20 12:53:41 NULL 3 +2011-04-20 12:53:41 2011-04-20 09:53:41 4 +SET TIME_ZONE = "+00:00"; +DROP TABLE t1; +# 2011-04-20 07:05:39 UTC +SET TIMESTAMP = 1303283139.195624; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '2010-10-11 12:34:56' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT '2010-10-11 12:34:56' +); +INSERT INTO t1 VALUES (NULL, NULL), (DEFAULT, DEFAULT); +INSERT INTO t1 ( a, b ) VALUES (NULL, NULL), (DEFAULT, DEFAULT); +SELECT * FROM t1; +a b +2011-04-20 07:05:39 NULL +2010-10-11 12:34:56 2010-10-11 12:34:56 +2011-04-20 07:05:39 NULL +2010-10-11 12:34:56 2010-10-11 12:34:56 +DROP TABLE t1; +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.136952; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME NULL, +j DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +INSERT INTO t1 SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL; +SELECT * FROM t1; +a b c d e f g h i j +2011-04-20 09:53:41 2011-04-20 09:53:41 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 2011-04-20 09:53:41 2011-04-20 09:53:41 NULL NULL 1986-09-27 03:00:00 +2011-04-20 09:53:41 2011-04-20 09:53:41 2011-04-20 09:53:41 2011-04-20 09:53:41 NULL NULL NULL NULL NULL NULL +DROP TABLE t1; +# +# Test of multiple-table UPDATE for DEFAULT CURRENT_TIMESTAMP +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c INT +); +INSERT INTO t1 ( c ) VALUES (1); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 1 +# 2011-04-20 17:06:13 UTC +SET TIMESTAMP = 1303311973.163587; +UPDATE t1 t11, t1 t12 SET t11.c = 1; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 1 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13 2011-04-20 09:53:41 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP, +d DATETIME ON UPDATE CURRENT_TIMESTAMP, +e INT +); +CREATE TABLE t2 ( +f INT, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h DATETIME DEFAULT CURRENT_TIMESTAMP, +i TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +j TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); +# 1995-03-11 00:02:03 UTC +SET TIMESTAMP = 794880123.195676; +INSERT INTO t1 ( e ) VALUES ( 1 ), ( 2 ); +INSERT INTO t2 ( f ) VALUES ( 1 ), ( 2 ); +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 NULL 1 +1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 NULL 2 +SELECT * FROM t2; +f g h i j +1 NULL 1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 +2 NULL 1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 +# 1980-12-13 02:02:01 UTC +SET TIMESTAMP = 345520921.196755; +UPDATE t1, t2 SET t1.e = 3, t2.f = 4; +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 3 +1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 3 +SELECT * FROM t2; +f g h i j +4 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 +4 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 +DROP TABLE t1, t2; +# +# Test of multiple table update with temporary table and on the fly. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT, +d INT +); +CREATE TABLE t2 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT KEY, +d INT +); +INSERT INTO t1 ( c ) VALUES (1), (2); +INSERT INTO t2 ( c ) VALUES (1), (2); +# Test of multiple table update done on the fly +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.194685; +UPDATE t1 JOIN t2 USING ( c ) SET t2.d = 1; +SELECT * FROM t1; +a b c d +0000-00-00 00:00:00 NULL 1 NULL +0000-00-00 00:00:00 NULL 2 NULL +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13 2011-04-20 15:06:13 1 1 +2011-04-20 15:06:13 2011-04-20 15:06:13 2 1 +# Test of multiple table update done with temporary table. +# 1979-01-15 03:02:01 +SET TIMESTAMP = 285213721.134679; +UPDATE t1 JOIN t2 USING ( c ) SET t1.d = 1; +SELECT * FROM t1; +a b c d +1979-01-15 02:02:01 1979-01-15 02:02:01 1 1 +1979-01-15 02:02:01 1979-01-15 02:02:01 2 1 +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13 2011-04-20 15:06:13 1 1 +2011-04-20 15:06:13 2011-04-20 15:06:13 2 1 +DROP TABLE t1, t2; +# +# Test of ON UPDATE CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.794613; +INSERT INTO t1 ( c ) VALUES ( 1 ); +SELECT * FROM t1; +a b c +0000-00-00 00:00:00 NULL 1 +UPDATE t1 SET c = 1; +SELECT * FROM t1; +a b c +0000-00-00 00:00:00 NULL 1 +UPDATE t1 SET c = 2; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +# +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +# +# Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP +# +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.534231; +UPDATE t1 t11, t1 t12 SET t11.c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13 2011-04-20 15:06:13 2 +DROP TABLE t1; +# +# Test of a multiple-table update where only one table is updated and +# the updated table has a primary key. +# +CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (a) ); +INSERT INTO t1 VALUES (1, 1),(2, 2),(3, 3),(4, 4); +CREATE TABLE t2 ( a INT, b INT ); +INSERT INTO t2 VALUES (1, 1),(2, 2),(3, 3),(4, 4),(5, 5); +UPDATE t1, t2 SET t1.b = 100 WHERE t1.a = t2.a; +SELECT * FROM t1; +a b +1 100 +2 100 +3 100 +4 100 +SELECT * FROM t2; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +DROP TABLE t1, t2; +# +# Test of ALTER TABLE, reordering columns. +# +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b INT ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of ALTER TABLE, adding columns. +# +CREATE TABLE t1 ( a INT ); +ALTER TABLE t1 ADD COLUMN b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of INSERT SELECT. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( +placeholder1 INT, +placeholder2 INT, +placeholder3 INT, +placeholder4 INT, +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', +c DATETIME, +d DATETIME +); +# 1977-08-16 15:30:01 UTC +SET TIMESTAMP = 240589801.654312; +INSERT INTO t2 (a, b, c, d) VALUES ( +'1977-08-16 15:30:01.123456', +'1977-08-16 15:30:01.234567', +'1977-08-16 15:30:01.345678', +'1977-08-16 15:30:01.456789' +); +# 1986-09-27 01:00:00 UTC +SET TIMESTAMP = 528166800.132435; +INSERT INTO t1 ( a, c ) SELECT a, c FROM t2; +SELECT * FROM t1; +a b c d +1977-08-16 15:30:01 1986-09-27 01:00:00 1977-08-16 15:30:01 1986-09-27 01:00:00 +DROP TABLE t1, t2; +# +# Test of CREATE TABLE SELECT. +# +# We test that the columns of the source table are not used to determine +# function defaults for the receiving table. +# +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.657898; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME NULL, +j DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.164937; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +0000-00-00 00:00:00 +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +1986-09-27 03:00:00 +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +NULL +CREATE TABLE t7 SELECT f FROM t1; +SHOW CREATE TABLE t7; +Table Create Table +t7 CREATE TABLE `t7` ( + `f` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t7; +f +1970-04-11 20:13:57 +CREATE TABLE t8 SELECT g FROM t1; +SHOW CREATE TABLE t8; +Table Create Table +t8 CREATE TABLE `t8` ( + `g` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t8; +g +1970-04-11 20:13:57 +CREATE TABLE t9 SELECT h FROM t1; +SHOW CREATE TABLE t9; +Table Create Table +t9 CREATE TABLE `t9` ( + `h` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t9; +h +NULL +CREATE TABLE t10 SELECT i FROM t1; +SHOW CREATE TABLE t10; +Table Create Table +t10 CREATE TABLE `t10` ( + `i` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t10; +i +NULL +CREATE TABLE t11 SELECT j FROM t1; +SHOW CREATE TABLE t11; +Table Create Table +t11 CREATE TABLE `t11` ( + `j` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t11; +j +1986-09-27 03:00:00 +CREATE TABLE t12 ( +k TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +l TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +m TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +n TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +o TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +p TIMESTAMP NULL, +q DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +r DATETIME DEFAULT CURRENT_TIMESTAMP, +s DATETIME ON UPDATE CURRENT_TIMESTAMP, +t DATETIME NULL, +u DATETIME DEFAULT '1986-09-27 03:00:00.098765' +) +SELECT * FROM t1; +SHOW CREATE TABLE t12; +Table Create Table +t12 CREATE TABLE `t12` ( + `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', + `p` timestamp NULL DEFAULT NULL, + `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `r` datetime DEFAULT CURRENT_TIMESTAMP, + `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `t` datetime DEFAULT NULL, + `u` datetime DEFAULT '1986-09-27 03:00:00', + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', + `e` timestamp NULL DEFAULT NULL, + `f` datetime DEFAULT NULL, + `g` datetime DEFAULT NULL, + `h` datetime DEFAULT NULL, + `i` datetime DEFAULT NULL, + `j` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.164953; +CREATE TABLE t1 ( +a DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c DATETIME ON UPDATE CURRENT_TIMESTAMP, +d DATETIME NULL, +e DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.915736; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +NULL +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +NULL +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +1986-09-27 03:00:00 +DROP TABLE t1, t2, t3, t4, t5, t6; +# +# Test of a CREATE TABLE SELECT that also declared columns. In this case +# the function default should be de-activated during the execution of the +# CREATE TABLE statement. +# +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.987654; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES ( 1 ), ( 2 ); +CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET TIMESTAMP = 2000.876543; +INSERT INTO t2( a ) VALUES ( 3 ); +SELECT * FROM t2; +b a +0000-00-00 00:00:00 1 +0000-00-00 00:00:00 2 +1970-01-01 00:33:20 3 +DROP TABLE t1, t2; +# +# Test of updating a view. +# +CREATE TABLE t1 ( a INT, b DATETIME DEFAULT CURRENT_TIMESTAMP ); +CREATE TABLE t2 ( a INT, b DATETIME ON UPDATE CURRENT_TIMESTAMP ); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci +CREATE VIEW v2 AS SELECT * FROM t2; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b` from `t2` latin1 latin1_swedish_ci +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.348564; +INSERT INTO v1 ( a ) VALUES ( 1 ); +INSERT INTO v2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1971-01-31 20:13:57 +SELECT * FROM v1; +a b +1 1971-01-31 20:13:57 +SELECT * FROM t2; +a b +1 NULL +SELECT * FROM v2; +a b +1 NULL +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.567332; +UPDATE v1 SET a = 2; +UPDATE v2 SET a = 2; +SELECT * FROM t1; +a b +2 1971-01-31 20:13:57 +SELECT * FROM v1; +a b +2 1971-01-31 20:13:57 +SELECT * FROM t2; +a b +2 1970-04-11 20:13:57 +SELECT * FROM v2; +a b +2 1970-04-11 20:13:57 +DROP VIEW v1, v2; +DROP TABLE t1, t2; +# +# Test with stored procedures. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP +); +CREATE PROCEDURE p1() INSERT INTO test.t1( a ) VALUES ( 1 ); +CREATE PROCEDURE p2() UPDATE t1 SET a = 2 WHERE a = 1; +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.876544; +CALL p1(); +SELECT * FROM t1; +a b c d e f g +1 1971-01-31 20:13:57 1971-01-31 20:13:57 0000-00-00 00:00:00 NULL 1971-01-31 20:13:57 NULL +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.143546; +CALL p2(); +SELECT * FROM t1; +a b c d e f g +2 1970-04-11 20:13:57 1971-01-31 20:13:57 1970-04-11 20:13:57 NULL 1971-01-31 20:13:57 1970-04-11 20:13:57 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; +# +# Test with triggers. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( a INT ); +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +INSERT INTO t1 ( a ) VALUES ( 1 ); +END| +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.978675; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1971-01-31 20:13:57 1971-01-31 20:13:57 0000-00-00 00:00:00 NULL NULL 1971-01-31 20:13:57 NULL 1971-01-31 20:13:57 +DROP TRIGGER t2_trg; +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +UPDATE t1 SET a = 2; +END| +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.456789; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +2 1970-04-11 20:13:57 1971-01-31 20:13:57 1970-04-11 20:13:57 NULL NULL 1971-01-31 20:13:57 1970-04-11 20:13:57 1970-04-11 20:13:57 +DROP TABLE t1, t2; +# +# Test where the assignment target is not a column. +# +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t2 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t3 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t4 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ); +CREATE VIEW v1 AS SELECT a COLLATE latin1_german1_ci AS b FROM t1; +CREATE VIEW v2 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t2; +CREATE VIEW v3 AS SELECT a COLLATE latin1_german1_ci AS b FROM t3; +CREATE VIEW v4 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t4; +INSERT INTO v1 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t1; +a +2007-10-24 00:03:34 +INSERT INTO v2 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t2; +a +2007-10-24 00:03:34 +INSERT INTO t3 VALUES (); +UPDATE v3 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t3; +a +2007-10-24 00:03:34 +INSERT INTO t4 VALUES (); +UPDATE v4 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t4; +a +2007-10-24 00:03:34 +DROP VIEW v1, v2, v3, v4; +DROP TABLE t1, t2, t3, t4; +# +# Test of LOAD DATA/XML INFILE +# This tests behavior of function defaults for TIMESTAMP and DATETIME +# columns. during LOAD ... INFILE. +# As can be seen here, a TIMESTAMP column with only ON UPDATE +# CURRENT_TIMESTAMP will still have CURRENT_TIMESTAMP inserted on LOAD +# ... INFILE if the value is missing. For DATETIME columns a NULL value +# is inserted instead. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +e DATETIME NOT NULL, +f DATETIME NOT NULL DEFAULT '1977-01-02 12:13:14', +g DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, +h DATETIME ON UPDATE CURRENT_TIMESTAMP NOT NULL, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL +); +SELECT 1 INTO OUTFILE 't3.dat' FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE 't4.dat' +FROM dual; +SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.918273; +LOAD DATA INFILE 't3.dat' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19 +c 2011-08-01 15:11:19 +d 2011-08-01 15:11:19 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i NULL +LOAD DATA INFILE 't4.dat' INTO TABLE t2; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'g' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'h' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT a FROM t2; +a +2011-08-01 15:11:19 +SELECT b FROM t2; +b +2011-08-01 15:11:19 +SELECT c FROM t2; +c +2011-08-01 15:11:19 +SELECT d FROM t2; +d +2011-08-01 15:11:19 +# As shown here, supplying a NULL value to a non-nullable +# column with no default value results in the zero date. +SELECT e FROM t2; +e +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable column with a +# default value results in the zero date. +SELECT f FROM t2; +f +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable column with a +# default function results in the zero date. +SELECT g FROM t2; +g +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable DATETIME ON +# UPDATE CURRENT_TIMESTAMP column with no default value results in the +# zero date. +SELECT h FROM t2; +h +0000-00-00 00:00:00 +SELECT i FROM t2; +i +0000-00-00 00:00:00 +DELETE FROM t1; +DELETE FROM t2; +# Read t3 file into t1 +# The syntax will cause a different code path to be taken +# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command +# above. The code in this path is copy-pasted code from the path taken +# under the syntax used in the previous LOAD command. +LOAD DATA INFILE 't3.dat' INTO TABLE t1 +FIELDS TERMINATED BY '' ENCLOSED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT b FROM t1; +b +2011-08-01 15:11:19 +SELECT c FROM t1; +c +2011-08-01 15:11:19 +SELECT d FROM t1; +d +2011-08-01 15:11:19 +SELECT e FROM t1; +e +2011-08-01 15:11:19 +# Yes, a missing field cannot be NULL using this syntax, so it will +# zero date instead. Says a comment in read_fixed_length() : "No fields +# specified in fields_vars list can be NULL in this format." +# It appears to be by design. This is inconsistent with LOAD DATA INFILE +# syntax in previous test. +SELECT f FROM t1; +f +0000-00-00 00:00:00 +SELECT g FROM t1; +g +0000-00-00 00:00:00 +# See comment above "SELECT f FROM f1". +SELECT h FROM t1; +h +0000-00-00 00:00:00 +SELECT i FROM t1; +i +0000-00-00 00:00:00 +DELETE FROM t1; +LOAD DATA INFILE 't5.dat' INTO TABLE t1 ( a, @dummy ); +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2011-08-01 15:11:19 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 +SELECT @dummy; +@dummy +2 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET c = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2005-06-06 08:09:10 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET g = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2011-08-01 15:11:19 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2005-06-06 08:09:10 NULL 2011-08-01 15:11:19 +DELETE FROM t1; +# Load a static XML file +LOAD XML INFILE '../../std_data/onerow.xml' INTO TABLE t1 +ROWS IDENTIFIED BY '<row>'; +Missing tags are treated as NULL +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19 +c 2011-08-01 15:11:19 +d 2011-08-01 15:11:19 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i NULL +DROP TABLE t1, t2; +# +# Similar LOAD DATA tests in another form +# +# All of this test portion has been run on a pre-WL5874 trunk +# (except that like_b and like_c didn't exist) and all result +# differences are a bug. +# Regarding like_b its definition is the same as b's except +# that the constant default is replaced with a function +# default. Our expectation is that like_b would behave +# like b: if b is set to NULL, or set to 0000-00-00, or set to +# its default, then the same should apply to like_b. Same for +# like_c vs c. +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.089786; +SELECT 1 INTO OUTFILE "file1.dat" FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE "file2.dat" FROM dual; +# Too short row +CREATE TABLE t1 ( +dummy INT, +a DATETIME NULL DEFAULT NULL, +b DATETIME NULL DEFAULT "2011-11-18", +like_b DATETIME NULL DEFAULT CURRENT_TIMESTAMP, +c DATETIME NOT NULL DEFAULT "2011-11-18", +like_c DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +g TIMESTAMP NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +# It is strange that "like_b" gets NULL when "b" gets 0. But +# this is consistent with how "a" gets NULL when "b" gets 0, +# with how "g" gets NULL when "d" gets 0, and with how "h" gets +# NULL when "i" gets 0. Looks like "DEFAULT +# <non-NULL-constant>" is changed to 0, whereas DEFAULT NULL +# and DEFAULT NOW are changed to NULL. +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00 +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d 0000-00-00 00:00:00 +e 2011-08-01 15:11:19 +f 2011-08-01 15:11:19 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00 +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d 0000-00-00 00:00:00 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i 0 +delete from t1; +drop table t1; +# Conclusion derived from trunk's results: +# DATETIME DEFAULT <non-NULL-constant> (b,c) gets 0000-00-00, +# DATETIME DEFAULT NULL (a) gets NULL, +# TIMESTAMP NULL DEFAULT <non-NULL-constant> (d) gets 0000-00-00, +# TIMESTAMP NULL DEFAULT NULL (g) gets NULL, +# TIMESTAMP NULL DEFAULT NOW (f after ALTER) gets NULL, +# TIMESTAMP NOT NULL (f before ALTER, e) gets NOW. +### Loading NULL ### +CREATE TABLE t1 ( +dummy INT, +a DATETIME NULL DEFAULT NULL, +b DATETIME NULL DEFAULT "2011-11-18", +like_b DATETIME NULL DEFAULT CURRENT_TIMESTAMP, +c DATETIME NOT NULL DEFAULT "2011-11-18", +like_c DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +g TIMESTAMP NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d NULL +e 2011-08-01 15:11:19 +f 2011-08-01 15:11:19 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d NULL +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i 0 +delete from t1; +# Conclusion derived from trunk's results: +# DATETIME NULL (a,b) gets NULL, +# DATETIME NOT NULL (c) gets 0000-00-00, +# TIMESTAMP NULL (d,f,g) gets NULL, +# TIMESTAMP NOT NULL (e) gets NOW. +drop table t1; +# +# Test of updatable views with check options. The option can be violated +# using ON UPDATE updates which is very strange as this offers a loophole +# in this integrity check. +# +SET TIME_ZONE = "+03:00"; +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.123456; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE b <= '1970-01-01 03:16:40.123456' +WITH CHECK OPTION; +SELECT * FROM v1; +a b +1 1970-01-01 03:16:40 +# 1970-01-01 03:33:20 +SET TIMESTAMP = 2000.000234; +UPDATE v1 SET a = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40 +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '1973-08-14 09:11:22.089786' ON UPDATE CURRENT_TIMESTAMP, +c INT KEY +); +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1 ( c ) VALUES ( 1 ); +CREATE VIEW v1 AS +SELECT * +FROM t1 +WHERE a >= '1973-08-14 09:11:22' +WITH LOCAL CHECK OPTION; +SELECT * FROM v1; +a c +1973-08-14 09:11:22 1 +SET TIMESTAMP = 1.126789; +INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM v1; +a c +1973-08-14 09:11:22 1 +DROP VIEW v1; +DROP TABLE t1; +# +# Bug 13095459 - MULTI-TABLE UPDATE MODIFIES A ROW TWICE +# +CREATE TABLE t1 ( +a INT, +b INT, +ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +PRIMARY KEY ( a, ts ) +); +INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES ( 1 ); +UPDATE t1 STRAIGHT_JOIN t2 +SET t1.b = t1.b + 1 +WHERE t1.a = 1 AND t1.ts >= '2000-09-28 00:00:00'; +SELECT b FROM t1; +b +1 +DROP TABLE t1, t2; +# +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP NOT NULL DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW() AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP NOT NULL DEFAULT NOW() AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME ON UPDATE NOW() AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME DEFAULT NOW() AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME DEFAULT NOW() ON UPDATE NOW() AFTER c5; +SELECT * FROM t1; +a1 0000-00-00 00:00:00 +a2 1970-01-01 03:16:40 +a3 1970-01-01 03:16:40 +a4 NULL +a5 1970-01-01 03:16:40 +a6 1970-01-01 03:16:40 +b 1 +c1 0000-00-00 00:00:00 +c2 1970-01-01 03:16:40 +c3 1970-01-01 03:16:40 +c4 NULL +c5 1970-01-01 03:16:40 +c6 1970-01-01 03:16:40 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b DATETIME DEFAULT NOW() ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '1999-12-01 11:22:33' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP DEFAULT NOW(); +ALTER TABLE t1 MODIFY COLUMN b DATETIME DEFAULT NOW(); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33 1999-12-01 11:22:33 +2001-09-09 04:46:40 2001-09-09 04:46:40 +DROP TABLE t1; +# +# Function defaults run 2. Six digits scale on seconds precision. +# +SET TIME_ZONE = "+00:00"; +# +# Test of errors for column data types that dont support function +# defaults. +# +CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +# +# Test that the default clause behaves like NOW() regarding time zones. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL, +e DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h DATETIME(6) +); +# 2011-09-27 14:11:08 UTC +SET TIMESTAMP = 1317132668.654321; +SET @old_time_zone = @@TIME_ZONE; +SET TIME_ZONE = "+05:00"; +INSERT INTO t1( d, h ) VALUES ( NOW(6), NOW(6) ); +SELECT * FROM t1; +a b c d e f g h +2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 0000-00-00 00:00:00.000000 2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 NULL 2011-09-27 19:11:08.654321 +# 1989-05-13 01:02:03 +SET TIMESTAMP = 611017323.543212; +UPDATE t1 SET d = NOW(6), h = NOW(6); +SELECT * FROM t1; +a b c d e f g h +1989-05-13 04:02:03.543212 2011-09-27 19:11:08.654321 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 2011-09-27 19:11:08.654321 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 +SET TIME_ZONE = @old_time_zone; +DROP TABLE t1; +# +# Test of several TIMESTAMP columns with different function defaults. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +f INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( f ) VALUES (1); +SELECT * FROM t1; +a b c d e f +2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 0000-00-00 00:00:00.000000 0000-00-00 00:00:00.000000 1 +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.132435; +UPDATE t1 SET f = 2; +SELECT * FROM t1; +a b c d e f +2011-04-19 07:23:18.132435 2011-04-19 07:23:18.132435 2011-04-19 07:22:02.534231 2011-04-19 07:23:18.132435 2011-04-19 07:23:18.132435 2 +DROP TABLE t1; +# +# Test of inserted values out of order. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +j INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( j, a ) VALUES ( 1, 1 ); +SELECT * FROM t1; +a b c d e f g h i j +1 2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 0000-00-00 00:00:00.000000 NULL NULL 2011-04-19 07:22:02.534231 NULL 2011-04-19 07:22:02.534231 1 +DROP TABLE t1; +# +# Test of ON DUPLICATE KEY UPDATE +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b INT, +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +f TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +g TIMESTAMP(6) NULL, +h DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +j DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +k DATETIME(6) NULL, +l DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +# 1977-12-21 23:00:00 UTC +SET TIMESTAMP = 251593200.192837; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 NULL 1977-12-21 23:00:00.192837 1977-12-21 23:00:00.192837 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 1977-12-21 23:00:00.192837 1977-12-21 23:00:00.192837 NULL NULL 1986-09-27 03:00:00.098765 +# 1975-05-21 23:00:00 UTC +SET TIMESTAMP = 169945200.918273; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 1986-09-27 03:00:00.098765 NULL 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 NULL 1986-09-27 03:00:00.098765 +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1(a) VALUES (2) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 1986-09-27 03:00:00.098765 NULL 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 NULL 1986-09-27 03:00:00.098765 +2 NULL 1973-08-14 09:11:22.534231 1973-08-14 09:11:22.534231 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 1973-08-14 09:11:22.534231 1973-08-14 09:11:22.534231 NULL NULL 1986-09-27 03:00:00.098765 +DROP TABLE t1; +CREATE TABLE t1 ( a INT PRIMARY KEY, b INT, c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.945156; +INSERT INTO t1 VALUES +(1, 0, '2001-01-01 01:01:01.111111'), +(2, 0, '2002-02-02 02:02:02.222222'), +(3, 0, '2003-03-03 03:03:03.333333'); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 0 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +UPDATE t1 SET b = 2, c = c WHERE a = 2; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +INSERT INTO t1 (a) VALUES (4); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +4 NULL 2011-04-19 07:23:18.945156 +UPDATE t1 SET c = '2004-04-04 04:04:04.444444' WHERE a = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +4 NULL 2004-04-04 04:04:04.444444 +INSERT INTO t1 ( a ) VALUES ( 3 ), ( 5 ) ON DUPLICATE KEY UPDATE b = 3, c = c; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 3 2003-03-03 03:03:03.333333 +4 NULL 2004-04-04 04:04:04.444444 +5 NULL 2011-04-19 07:23:18.945156 +INSERT INTO t1 (a, c) VALUES +(4, '2004-04-04 00:00:00.444444'), +(6, '2006-06-06 06:06:06.666666') +ON DUPLICATE KEY UPDATE b = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 3 2003-03-03 03:03:03.333333 +4 4 2011-04-19 07:23:18.945156 +5 NULL 2011-04-19 07:23:18.945156 +6 NULL 2006-06-06 06:06:06.666666 +DROP TABLE t1; +# +# Test of REPLACE INTO executed as UPDATE. +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +e DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +f TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h TIMESTAMP(6) NULL, +i DATETIME(6) +); +# 1970-09-21 09:11:12 UTC +SET TIMESTAMP = 22756272.163584; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 0000-00-00 00:00:00.000000 NULL NULL NULL +# 1970-11-10 14:16:17 UTC +SET TIMESTAMP = 27094577.852954; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 0000-00-00 00:00:00.000000 NULL NULL NULL +DROP TABLE t1; +# +# Test of insertion of NULL, DEFAULT and an empty row for DEFAULT +# CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.163578; +INSERT INTO t1 VALUES (NULL, NULL, 1), (DEFAULT, DEFAULT, 2); +INSERT INTO t1 ( a, b, c ) VALUES (NULL, NULL, 3), (DEFAULT, DEFAULT, 4); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.163578 NULL 1 +2011-04-20 09:53:41.163578 2011-04-20 09:53:41.163578 2 +2011-04-20 09:53:41.163578 NULL 3 +2011-04-20 09:53:41.163578 2011-04-20 09:53:41.163578 4 +SET TIME_ZONE = "+03:00"; +SELECT * FROM t1; +a b c +2011-04-20 12:53:41.163578 NULL 1 +2011-04-20 12:53:41.163578 2011-04-20 09:53:41.163578 2 +2011-04-20 12:53:41.163578 NULL 3 +2011-04-20 12:53:41.163578 2011-04-20 09:53:41.163578 4 +SET TIME_ZONE = "+00:00"; +DROP TABLE t1; +# 2011-04-20 07:05:39 UTC +SET TIMESTAMP = 1303283139.195624; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '2010-10-11 12:34:56' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT '2010-10-11 12:34:56' +); +INSERT INTO t1 VALUES (NULL, NULL), (DEFAULT, DEFAULT); +INSERT INTO t1 ( a, b ) VALUES (NULL, NULL), (DEFAULT, DEFAULT); +SELECT * FROM t1; +a b +2011-04-20 07:05:39.195624 NULL +2010-10-11 12:34:56.000000 2010-10-11 12:34:56.000000 +2011-04-20 07:05:39.195624 NULL +2010-10-11 12:34:56.000000 2010-10-11 12:34:56.000000 +DROP TABLE t1; +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.136952; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) NULL, +j DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +INSERT INTO t1 SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL; +SELECT * FROM t1; +a b c d e f g h i j +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 NULL NULL 1986-09-27 03:00:00.098765 +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 NULL NULL NULL NULL NULL NULL +DROP TABLE t1; +# +# Test of multiple-table UPDATE for DEFAULT CURRENT_TIMESTAMP +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c INT +); +INSERT INTO t1 ( c ) VALUES (1); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 1 +# 2011-04-20 17:06:13 UTC +SET TIMESTAMP = 1303311973.163587; +UPDATE t1 t11, t1 t12 SET t11.c = 1; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 1 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13.163587 2011-04-20 09:53:41.136952 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +d DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +e INT +); +CREATE TABLE t2 ( +f INT, +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +i TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +j TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) +); +# 1995-03-11 00:02:03 UTC +SET TIMESTAMP = 794880123.195676; +INSERT INTO t1 ( e ) VALUES ( 1 ), ( 2 ); +INSERT INTO t2 ( f ) VALUES ( 1 ), ( 2 ); +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 NULL 1 +1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 NULL 2 +SELECT * FROM t2; +f g h i j +1 NULL 1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 +2 NULL 1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 +# 1980-12-13 02:02:01 UTC +SET TIMESTAMP = 345520921.196755; +UPDATE t1, t2 SET t1.e = 3, t2.f = 4; +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 3 +1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 3 +SELECT * FROM t2; +f g h i j +4 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 +4 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 +DROP TABLE t1, t2; +# +# Test of multiple table update with temporary table and on the fly. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT, +d INT +); +CREATE TABLE t2 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT KEY, +d INT +); +INSERT INTO t1 ( c ) VALUES (1), (2); +INSERT INTO t2 ( c ) VALUES (1), (2); +# Test of multiple table update done on the fly +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.194685; +UPDATE t1 JOIN t2 USING ( c ) SET t2.d = 1; +SELECT * FROM t1; +a b c d +0000-00-00 00:00:00.000000 NULL 1 NULL +0000-00-00 00:00:00.000000 NULL 2 NULL +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 1 1 +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 2 1 +# Test of multiple table update done with temporary table. +# 1979-01-15 03:02:01 +SET TIMESTAMP = 285213721.134679; +UPDATE t1 JOIN t2 USING ( c ) SET t1.d = 1; +SELECT * FROM t1; +a b c d +1979-01-15 02:02:01.134679 1979-01-15 02:02:01.134679 1 1 +1979-01-15 02:02:01.134679 1979-01-15 02:02:01.134679 2 1 +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 1 1 +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 2 1 +DROP TABLE t1, t2; +# +# Test of ON UPDATE CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.794613; +INSERT INTO t1 ( c ) VALUES ( 1 ); +SELECT * FROM t1; +a b c +0000-00-00 00:00:00.000000 NULL 1 +UPDATE t1 SET c = 1; +SELECT * FROM t1; +a b c +0000-00-00 00:00:00.000000 NULL 1 +UPDATE t1 SET c = 2; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +# +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +# +# Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP +# +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.534231; +UPDATE t1 t11, t1 t12 SET t11.c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 2 +DROP TABLE t1; +# +# Test of a multiple-table update where only one table is updated and +# the updated table has a primary key. +# +CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (a) ); +INSERT INTO t1 VALUES (1, 1),(2, 2),(3, 3),(4, 4); +CREATE TABLE t2 ( a INT, b INT ); +INSERT INTO t2 VALUES (1, 1),(2, 2),(3, 3),(4, 4),(5, 5); +UPDATE t1, t2 SET t1.b = 100 WHERE t1.a = t2.a; +SELECT * FROM t1; +a b +1 100 +2 100 +3 100 +4 100 +SELECT * FROM t2; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +DROP TABLE t1, t2; +# +# Test of ALTER TABLE, reordering columns. +# +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of ALTER TABLE, adding columns. +# +CREATE TABLE t1 ( a INT ); +ALTER TABLE t1 ADD COLUMN b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of INSERT SELECT. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( +placeholder1 INT, +placeholder2 INT, +placeholder3 INT, +placeholder4 INT, +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00', +c DATETIME(6), +d DATETIME(6) +); +# 1977-08-16 15:30:01 UTC +SET TIMESTAMP = 240589801.654312; +INSERT INTO t2 (a, b, c, d) VALUES ( +'1977-08-16 15:30:01.123456', +'1977-08-16 15:30:01.234567', +'1977-08-16 15:30:01.345678', +'1977-08-16 15:30:01.456789' +); +# 1986-09-27 01:00:00 UTC +SET TIMESTAMP = 528166800.132435; +INSERT INTO t1 ( a, c ) SELECT a, c FROM t2; +SELECT * FROM t1; +a b c d +1977-08-16 15:30:01.123456 1986-09-27 01:00:00.132435 1977-08-16 15:30:01.345678 1986-09-27 01:00:00.132435 +DROP TABLE t1, t2; +# +# Test of CREATE TABLE SELECT. +# +# We test that the columns of the source table are not used to determine +# function defaults for the receiving table. +# +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.657898; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) NULL, +j DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.164937; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57.657897 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57.657897 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +0000-00-00 00:00:00.000000 +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +1986-09-27 03:00:00.098765 +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +NULL +CREATE TABLE t7 SELECT f FROM t1; +SHOW CREATE TABLE t7; +Table Create Table +t7 CREATE TABLE `t7` ( + `f` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t7; +f +1970-04-11 20:13:57.657897 +CREATE TABLE t8 SELECT g FROM t1; +SHOW CREATE TABLE t8; +Table Create Table +t8 CREATE TABLE `t8` ( + `g` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t8; +g +1970-04-11 20:13:57.657897 +CREATE TABLE t9 SELECT h FROM t1; +SHOW CREATE TABLE t9; +Table Create Table +t9 CREATE TABLE `t9` ( + `h` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t9; +h +NULL +CREATE TABLE t10 SELECT i FROM t1; +SHOW CREATE TABLE t10; +Table Create Table +t10 CREATE TABLE `t10` ( + `i` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t10; +i +NULL +CREATE TABLE t11 SELECT j FROM t1; +SHOW CREATE TABLE t11; +Table Create Table +t11 CREATE TABLE `t11` ( + `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t11; +j +1986-09-27 03:00:00.098765 +CREATE TABLE t12 ( +k TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +l TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +m TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +n TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +o TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +p TIMESTAMP(6) NULL, +q DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +r DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +s DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +t DATETIME(6) NULL, +u DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +) +SELECT * FROM t1; +SHOW CREATE TABLE t12; +Table Create Table +t12 CREATE TABLE `t12` ( + `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', + `p` timestamp(6) NULL DEFAULT NULL, + `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `t` datetime(6) DEFAULT NULL, + `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', + `e` timestamp(6) NULL DEFAULT NULL, + `f` datetime(6) DEFAULT NULL, + `g` datetime(6) DEFAULT NULL, + `h` datetime(6) DEFAULT NULL, + `i` datetime(6) DEFAULT NULL, + `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.164953; +CREATE TABLE t1 ( +a DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +d DATETIME(6) NULL, +e DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.915736; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57.164953 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57.164953 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +NULL +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +NULL +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +1986-09-27 03:00:00.098765 +DROP TABLE t1, t2, t3, t4, t5, t6; +# +# Test of a CREATE TABLE SELECT that also declared columns. In this case +# the function default should be de-activated during the execution of the +# CREATE TABLE statement. +# +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.987654; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES ( 1 ), ( 2 ); +CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)) SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET TIMESTAMP = 2000.876543; +INSERT INTO t2( a ) VALUES ( 3 ); +SELECT * FROM t2; +b a +0000-00-00 00:00:00.000000 1 +0000-00-00 00:00:00.000000 2 +1970-01-01 00:33:20.876543 3 +DROP TABLE t1, t2; +# +# Test of updating a view. +# +CREATE TABLE t1 ( a INT, b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ); +CREATE TABLE t2 ( a INT, b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci +CREATE VIEW v2 AS SELECT * FROM t2; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b` from `t2` latin1 latin1_swedish_ci +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.348564; +INSERT INTO v1 ( a ) VALUES ( 1 ); +INSERT INTO v2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1971-01-31 20:13:57.348564 +SELECT * FROM v1; +a b +1 1971-01-31 20:13:57.348564 +SELECT * FROM t2; +a b +1 NULL +SELECT * FROM v2; +a b +1 NULL +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.567332; +UPDATE v1 SET a = 2; +UPDATE v2 SET a = 2; +SELECT * FROM t1; +a b +2 1971-01-31 20:13:57.348564 +SELECT * FROM v1; +a b +2 1971-01-31 20:13:57.348564 +SELECT * FROM t2; +a b +2 1970-04-11 20:13:57.567332 +SELECT * FROM v2; +a b +2 1970-04-11 20:13:57.567332 +DROP VIEW v1, v2; +DROP TABLE t1, t2; +# +# Test with stored procedures. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE PROCEDURE p1() INSERT INTO test.t1( a ) VALUES ( 1 ); +CREATE PROCEDURE p2() UPDATE t1 SET a = 2 WHERE a = 1; +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.876544; +CALL p1(); +SELECT * FROM t1; +a b c d e f g +1 1971-01-31 20:13:57.876544 1971-01-31 20:13:57.876544 0000-00-00 00:00:00.000000 NULL 1971-01-31 20:13:57.876544 NULL +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.143546; +CALL p2(); +SELECT * FROM t1; +a b c d e f g +2 1970-04-11 20:13:57.143546 1971-01-31 20:13:57.876544 1970-04-11 20:13:57.143546 NULL 1971-01-31 20:13:57.876544 1970-04-11 20:13:57.143546 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; +# +# Test with triggers. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( a INT ); +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +INSERT INTO t1 ( a ) VALUES ( 1 ); +END| +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.978675; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1971-01-31 20:13:57.978675 1971-01-31 20:13:57.978675 0000-00-00 00:00:00.000000 NULL NULL 1971-01-31 20:13:57.978675 NULL 1971-01-31 20:13:57.978675 +DROP TRIGGER t2_trg; +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +UPDATE t1 SET a = 2; +END| +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.456789; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +2 1970-04-11 20:13:57.456789 1971-01-31 20:13:57.978675 1970-04-11 20:13:57.456789 NULL NULL 1971-01-31 20:13:57.978675 1970-04-11 20:13:57.456789 1970-04-11 20:13:57.456789 +DROP TABLE t1, t2; +# +# Test where the assignment target is not a column. +# +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t2 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t3 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t4 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE VIEW v1 AS SELECT a COLLATE latin1_german1_ci AS b FROM t1; +CREATE VIEW v2 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t2; +CREATE VIEW v3 AS SELECT a COLLATE latin1_german1_ci AS b FROM t3; +CREATE VIEW v4 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t4; +INSERT INTO v1 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t1; +a +2007-10-24 00:03:34.010203 +INSERT INTO v2 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t2; +a +2007-10-24 00:03:34.010203 +INSERT INTO t3 VALUES (); +UPDATE v3 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t3; +a +2007-10-24 00:03:34.010203 +INSERT INTO t4 VALUES (); +UPDATE v4 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t4; +a +2007-10-24 00:03:34.010203 +DROP VIEW v1, v2, v3, v4; +DROP TABLE t1, t2, t3, t4; +# +# Test of LOAD DATA/XML INFILE +# This tests behavior of function defaults for TIMESTAMP and DATETIME +# columns. during LOAD ... INFILE. +# As can be seen here, a TIMESTAMP column with only ON UPDATE +# CURRENT_TIMESTAMP will still have CURRENT_TIMESTAMP inserted on LOAD +# ... INFILE if the value is missing. For DATETIME columns a NULL value +# is inserted instead. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +e DATETIME(6) NOT NULL, +f DATETIME(6) NOT NULL DEFAULT '1977-01-02 12:13:14', +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) NOT NULL, +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) NOT NULL, +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) NOT NULL +); +SELECT 1 INTO OUTFILE 't3.dat' FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE 't4.dat' +FROM dual; +SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.918273; +LOAD DATA INFILE 't3.dat' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19.918273 +c 2011-08-01 15:11:19.918273 +d 2011-08-01 15:11:19.918273 +e 2011-08-01 15:11:19.918273 +f NULL +g NULL +h NULL +i NULL +LOAD DATA INFILE 't4.dat' INTO TABLE t2; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'g' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'h' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT a FROM t2; +a +2011-08-01 15:11:19.918273 +SELECT b FROM t2; +b +2011-08-01 15:11:19.918273 +SELECT c FROM t2; +c +2011-08-01 15:11:19.918273 +SELECT d FROM t2; +d +2011-08-01 15:11:19.918273 +# As shown here, supplying a NULL value to a non-nullable +# column with no default value results in the zero date. +SELECT e FROM t2; +e +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable column with a +# default value results in the zero date. +SELECT f FROM t2; +f +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable column with a +# default function results in the zero date. +SELECT g FROM t2; +g +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable DATETIME ON +# UPDATE CURRENT_TIMESTAMP column with no default value results in the +# zero date. +SELECT h FROM t2; +h +0000-00-00 00:00:00.000000 +SELECT i FROM t2; +i +0000-00-00 00:00:00.000000 +DELETE FROM t1; +DELETE FROM t2; +# Read t3 file into t1 +# The syntax will cause a different code path to be taken +# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command +# above. The code in this path is copy-pasted code from the path taken +# under the syntax used in the previous LOAD command. +LOAD DATA INFILE 't3.dat' INTO TABLE t1 +FIELDS TERMINATED BY '' ENCLOSED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT b FROM t1; +b +2011-08-01 15:11:19.918273 +SELECT c FROM t1; +c +2011-08-01 15:11:19.918273 +SELECT d FROM t1; +d +2011-08-01 15:11:19.918273 +SELECT e FROM t1; +e +2011-08-01 15:11:19.918273 +# Yes, a missing field cannot be NULL using this syntax, so it will +# zero date instead. Says a comment in read_fixed_length() : "No fields +# specified in fields_vars list can be NULL in this format." +# It appears to be by design. This is inconsistent with LOAD DATA INFILE +# syntax in previous test. +SELECT f FROM t1; +f +0000-00-00 00:00:00.000000 +SELECT g FROM t1; +g +0000-00-00 00:00:00.000000 +# See comment above "SELECT f FROM f1". +SELECT h FROM t1; +h +0000-00-00 00:00:00.000000 +SELECT i FROM t1; +i +0000-00-00 00:00:00.000000 +DELETE FROM t1; +LOAD DATA INFILE 't5.dat' INTO TABLE t1 ( a, @dummy ); +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2011-08-01 15:11:19.918273 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 +SELECT @dummy; +@dummy +2 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET c = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2005-06-06 08:09:10.000000 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET g = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2011-08-01 15:11:19.918273 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2005-06-06 08:09:10.000000 NULL 2011-08-01 15:11:19.918273 +DELETE FROM t1; +# Load a static XML file +LOAD XML INFILE '../../std_data/onerow.xml' INTO TABLE t1 +ROWS IDENTIFIED BY '<row>'; +Missing tags are treated as NULL +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19.918273 +c 2011-08-01 15:11:19.918273 +d 2011-08-01 15:11:19.918273 +e 2011-08-01 15:11:19.918273 +f NULL +g NULL +h NULL +i NULL +DROP TABLE t1, t2; +# +# Similar LOAD DATA tests in another form +# +# All of this test portion has been run on a pre-WL5874 trunk +# (except that like_b and like_c didn't exist) and all result +# differences are a bug. +# Regarding like_b its definition is the same as b's except +# that the constant default is replaced with a function +# default. Our expectation is that like_b would behave +# like b: if b is set to NULL, or set to 0000-00-00, or set to +# its default, then the same should apply to like_b. Same for +# like_c vs c. +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.089786; +SELECT 1 INTO OUTFILE "file1.dat" FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE "file2.dat" FROM dual; +# Too short row +CREATE TABLE t1 ( +dummy INT, +a DATETIME(6) NULL DEFAULT NULL, +b DATETIME(6) NULL DEFAULT "2011-11-18", +like_b DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) NOT NULL DEFAULT "2011-11-18", +like_c DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +g TIMESTAMP(6) NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +# It is strange that "like_b" gets NULL when "b" gets 0. But +# this is consistent with how "a" gets NULL when "b" gets 0, +# with how "g" gets NULL when "d" gets 0, and with how "h" gets +# NULL when "i" gets 0. Looks like "DEFAULT +# <non-NULL-constant>" is changed to 0, whereas DEFAULT NULL +# and DEFAULT NOW are changed to NULL. +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00.000000 +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d 0000-00-00 00:00:00.000000 +e 2011-08-01 15:11:19.089786 +f 2011-08-01 15:11:19.089786 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00.000000 +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d 0000-00-00 00:00:00.000000 +e 2011-08-01 15:11:19.089786 +f NULL +g NULL +h NULL +i 0 +delete from t1; +drop table t1; +# Conclusion derived from trunk's results: +# DATETIME DEFAULT <non-NULL-constant> (b,c) gets 0000-00-00, +# DATETIME DEFAULT NULL (a) gets NULL, +# TIMESTAMP NULL DEFAULT <non-NULL-constant> (d) gets 0000-00-00, +# TIMESTAMP NULL DEFAULT NULL (g) gets NULL, +# TIMESTAMP NULL DEFAULT NOW (f after ALTER) gets NULL, +# TIMESTAMP NOT NULL (f before ALTER, e) gets NOW. +### Loading NULL ### +CREATE TABLE t1 ( +dummy INT, +a DATETIME(6) NULL DEFAULT NULL, +b DATETIME(6) NULL DEFAULT "2011-11-18", +like_b DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) NOT NULL DEFAULT "2011-11-18", +like_c DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +g TIMESTAMP(6) NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d NULL +e 2011-08-01 15:11:19.089786 +f 2011-08-01 15:11:19.089786 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d NULL +e 2011-08-01 15:11:19.089786 +f NULL +g NULL +h NULL +i 0 +delete from t1; +# Conclusion derived from trunk's results: +# DATETIME NULL (a,b) gets NULL, +# DATETIME NOT NULL (c) gets 0000-00-00, +# TIMESTAMP NULL (d,f,g) gets NULL, +# TIMESTAMP NOT NULL (e) gets NOW. +drop table t1; +# +# Test of updatable views with check options. The option can be violated +# using ON UPDATE updates which is very strange as this offers a loophole +# in this integrity check. +# +SET TIME_ZONE = "+03:00"; +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.123456; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40.123456 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE b <= '1970-01-01 03:16:40.123456' +WITH CHECK OPTION; +SELECT * FROM v1; +a b +1 1970-01-01 03:16:40.123456 +# 1970-01-01 03:33:20 +SET TIMESTAMP = 2000.000234; +UPDATE v1 SET a = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40.123456 +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '1973-08-14 09:11:22.089786' ON UPDATE CURRENT_TIMESTAMP(6), +c INT KEY +); +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1 ( c ) VALUES ( 1 ); +CREATE VIEW v1 AS +SELECT * +FROM t1 +WHERE a >= '1973-08-14 09:11:22' +WITH LOCAL CHECK OPTION; +SELECT * FROM v1; +a c +1973-08-14 09:11:22.089786 1 +SET TIMESTAMP = 1.126789; +INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM v1; +a c +1973-08-14 09:11:22.089786 1 +DROP VIEW v1; +DROP TABLE t1; +# +# Bug 13095459 - MULTI-TABLE UPDATE MODIFIES A ROW TWICE +# +CREATE TABLE t1 ( +a INT, +b INT, +ts TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +PRIMARY KEY ( a, ts ) +); +INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES ( 1 ); +UPDATE t1 STRAIGHT_JOIN t2 +SET t1.b = t1.b + 1 +WHERE t1.a = 1 AND t1.ts >= '2000-09-28 00:00:00'; +SELECT b FROM t1; +b +1 +DROP TABLE t1, t2; +# +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME(6) DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6) AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME(6) ON UPDATE NOW(6) AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME(6) DEFAULT NOW(6) AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c5; +SELECT * FROM t1; +a1 0000-00-00 00:00:00.000000 +a2 1970-01-01 03:16:40.000000 +a3 1970-01-01 03:16:40.000000 +a4 NULL +a5 1970-01-01 03:16:40.000000 +a6 1970-01-01 03:16:40.000000 +b 1 +c1 0000-00-00 00:00:00.000000 +c2 1970-01-01 03:16:40.000000 +c3 1970-01-01 03:16:40.000000 +c4 NULL +c5 1970-01-01 03:16:40.000000 +c6 1970-01-01 03:16:40.000000 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b DATETIME(6) DEFAULT NOW(6) ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '1999-12-01 11:22:33' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(6) DEFAULT NOW(6); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(6) DEFAULT NOW(6); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33.000000 1999-12-01 11:22:33.000000 +2001-09-09 04:46:40.000000 2001-09-09 04:46:40.000000 +DROP TABLE t1; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index a1d2ec862b7..4b7a9a5dc0c 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1557,6 +1557,12 @@ Warnings: Warning 1300 Invalid utf8 character string: 'E043' Warning 1300 Invalid utf8 character string: 'E043' drop table t1; +# +# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +# +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); +st_within(GeomFromText('Polygon((0 0))'), Point(0,0)) +1 End of 5.3 tests # # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 643849f36ed..0858198694b 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2483,6 +2483,17 @@ test 2 SET sql_mode=''; # +# MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key +# +CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (6,'b'); +CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p'); +SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 ) +WHERE t1a.c1 = c2 GROUP BY i2; +i2 +DROP TABLE t1,t2; +# # Bug #58782 # Missing rows with SELECT .. WHERE .. IN subquery # with full GROUP BY and no aggr diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 06a8a8a06b8..9421ea9e740 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2129,10 +2129,11 @@ Warnings: Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` create table t4 as select distinct a1, a2, b, c from t1; alter table t4 add unique index idxt4 (a1, a2, b, c); +# This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: explain select a1, a2, b, min(c) from t4 group by a1, a2, b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL idxt4 163 NULL 64 Using index +1 SIMPLE t4 range NULL idxt4 147 NULL 10 Using index for group-by select a1, a2, b, min(c) from t4 group by a1, a2, b; a1 a2 b min(c) a a a a111 @@ -2355,7 +2356,7 @@ CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c)); INSERT INTO t2 SELECT a,b,b FROM t1; explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref PRIMARY PRIMARY 8 const,const 1 Using where; Using index +1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 1 Using where; Using index for group-by SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; MIN(c) 2 @@ -3686,3 +3687,43 @@ a b 3 2 3 3 drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +# +CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,' 2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,' 2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,' 2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,' 2001-01-04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result index f3511b0ad4a..77c74fbc041 100644 --- a/mysql-test/r/group_min_max_innodb.result +++ b/mysql-test/r/group_min_max_innodb.result @@ -174,7 +174,7 @@ F 17 EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 2 Using where; Using index +1 SIMPLE t1 range k1 k1 5 NULL 1 Using where; Using index for group-by SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; c1 max(i2) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 11ef1acc18f..f0220e7c043 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -803,7 +803,7 @@ drop view a2, a1; drop table t_crashme; select table_schema,table_name, column_name from information_schema.columns -where data_type = 'longtext'; +where data_type = 'longtext' and table_schema != 'performance_schema'; table_schema table_name column_name information_schema ALL_PLUGINS PLUGIN_DESCRIPTION information_schema COLUMNS COLUMN_DEFAULT @@ -821,14 +821,6 @@ information_schema ROUTINES ROUTINE_COMMENT information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION -performance_schema events_statements_current SQL_TEXT -performance_schema events_statements_current DIGEST_TEXT -performance_schema events_statements_history SQL_TEXT -performance_schema events_statements_history DIGEST_TEXT -performance_schema events_statements_history_long SQL_TEXT -performance_schema events_statements_history_long DIGEST_TEXT -performance_schema events_statements_summary_by_digest DIGEST_TEXT -performance_schema threads PROCESSLIST_INFO select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%'; table_name column_name data_type @@ -1580,7 +1572,9 @@ show open tables where f1()=0; drop table t1; drop function f1; select * from information_schema.tables where 1=sleep(100000); +Got one of the listed errors select * from information_schema.columns where 1=sleep(100000); +Got one of the listed errors explain select count(*) from information_schema.tables; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result index bcee428bc57..99ed73a3e83 100644 --- a/mysql-test/r/innodb_mrr_cpk.result +++ b/mysql-test/r/innodb_mrr_cpk.result @@ -145,11 +145,47 @@ select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; a b c filler a b set optimizer_switch='index_condition_pushdown=on'; drop table t1,t2; -set @@join_cache_level= @save_join_cache_level; -set storage_engine=@save_storage_engine; -set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; # +# MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read() +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk varchar(32) character set utf8 primary key, +kp1 char(32) not null, +col1 varchar(32), +key (kp1) +) engine=innodb; +insert into t1 +select +concat('pk-', 1000 +A.a), +concat('kp1-', 1000 +A.a), +concat('val-', 1000 +A.a) +from test.t0 A ; +create table t2 as select kp1 as a from t1; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +explain +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +a pk kp1 col1 +kp1-1000 pk-1000 kp1-1000 val-1000 +kp1-1001 pk-1001 kp1-1001 val-1001 +kp1-1002 pk-1002 kp1-1002 val-1002 +kp1-1003 pk-1003 kp1-1003 val-1003 +kp1-1004 pk-1004 kp1-1004 val-1004 +kp1-1005 pk-1005 kp1-1005 val-1005 +kp1-1006 pk-1006 kp1-1006 val-1006 +kp1-1007 pk-1007 kp1-1007 val-1007 +kp1-1008 pk-1008 kp1-1008 val-1008 +kp1-1009 pk-1009 kp1-1009 val-1009 +drop table t0,t1,t2; +# +# # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions # set @tmp_mdev3817=@@optimizer_switch; @@ -194,3 +230,9 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t2 ALL NULL NULL NULL NULL # set join_cache_level= @tmp_mdev5037; drop table t0,t1,t2; +# +# This must be at the end: +# +set @@join_cache_level= @save_join_cache_level; +set storage_engine=@save_storage_engine; +set optimizer_switch=@innodb_mrr_cpk_tmp; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index 253fb61dc27..456e17a91f7 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -498,8 +498,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) 1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -576,8 +576,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -654,8 +654,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) 1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -732,8 +732,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index e303c288552..40abc197a36 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2222,4 +2222,27 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# Bug mdev-6705: wrong on expression after constant row substitution +# that triggers a simplification of WHERE condition +# +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +a b c d +DROP TABLE t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index beea0daa1fa..81395612269 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2233,6 +2233,29 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# Bug mdev-6705: wrong on expression after constant row substitution +# that triggers a simplification of WHERE condition +# +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +a b c d +DROP TABLE t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/r/log_errchk.result b/mysql-test/r/log_errchk.result new file mode 100644 index 00000000000..407fba2323e --- /dev/null +++ b/mysql-test/r/log_errchk.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("Could not use"); +# Case 1: Setting fife file to general_log_file and slow_query_log_file +# system variable. +SET GLOBAL general_log_file="MYSQLTEST_VARDIR/tmp/general_log.fifo";; +ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/general_log.fifo' +SET GLOBAL slow_query_log_file="MYSQLTEST_VARDIR/tmp/slow_log.fifo";; +ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/slow_log.fifo' +# Case 2: Starting server with fifo file as general log file +# and slow query log file. +Setting fifo file as general log file and slow query log failed. diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 9900f6d6b5a..a609b222d53 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -11,7 +11,7 @@ Table Op Msg_type Msg_text test.bug49823 repair status OK RENAME TABLE general_log TO renamed_general_log; RENAME TABLE test.bug49823 TO general_log; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -43,9 +43,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -53,6 +53,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK DROP TABLE general_log; RENAME TABLE renamed_general_log TO general_log; diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result new file mode 100644 index 00000000000..6ae995cd030 --- /dev/null +++ b/mysql-test/r/mysql_upgrade-6984.result @@ -0,0 +1,58 @@ +update mysql.user set password=password("foo") where user='root'; +Phase 1/5: Checking mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.index_stats OK +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK + +Repairing tables +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables +Processing databases +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +test +Phase 5/5: Running 'FLUSH PRIVILEGES'... +OK +update mysql.user set password='' where user='root'; +flush privileges; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 1cc448b3ba2..64c2c0222fc 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -1,5 +1,5 @@ Run mysql_upgrade once -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -30,9 +30,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -40,11 +40,12 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK Run it again - should say already completed This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade Force should run it regardless of wether it's been run before -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -75,9 +76,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -85,11 +86,12 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; Run mysql_upgrade with password protected account -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -120,9 +122,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -130,6 +132,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK DROP USER mysqltest1@'%'; Version check failed. Got the following error when calling the 'mysql' command line client @@ -139,7 +142,7 @@ Run mysql_upgrade with a non existing server socket mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -170,9 +173,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -180,6 +183,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK set GLOBAL sql_mode=default; # @@ -190,7 +194,7 @@ CREATE PROCEDURE testproc() BEGIN END; UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc'; UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc'; UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc'; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -221,9 +225,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -231,6 +235,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK CALL testproc(); DROP PROCEDURE testproc; @@ -244,7 +249,7 @@ WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; Run mysql_upgrade with all privileges on a user -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -275,9 +280,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -285,6 +290,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SHOW GRANTS FOR 'user3'@'%'; Grants for user3@% @@ -293,7 +299,7 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' DROP USER 'user3'@'%'; End of 5.1 tests The --upgrade-system-tables option was used, user tables won't be touched. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -324,7 +330,8 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION @@ -332,7 +339,7 @@ OK # # Droping the previously created mysql_upgrade_info file.. # Running mysql_upgrade with --skip-write-binlog.. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -363,9 +370,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -373,6 +380,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # # MDEV-4332 Increase username length from 16 characters @@ -386,7 +394,7 @@ GRANT INSERT ON mysql.user TO very_long_user_name_number_2; GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1; GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2; CREATE PROCEDURE test.pr() BEGIN END; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -417,9 +425,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -427,6 +435,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr'; definer diff --git a/mysql-test/r/mysql_upgrade_no_innodb.result b/mysql-test/r/mysql_upgrade_no_innodb.result index 320dcfe5d3b..e65c6ae05f7 100644 --- a/mysql-test/r/mysql_upgrade_no_innodb.result +++ b/mysql-test/r/mysql_upgrade_no_innodb.result @@ -1,5 +1,5 @@ The --upgrade-system-tables option was used, user tables won't be touched. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -42,5 +42,6 @@ error : Corrupt mysql.innodb_table_stats Error : Unknown storage engine 'InnoDB' error : Corrupt -Phase 2/4: Running 'mysql_fix_privilege_tables'... +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index 14671aa6409..1bbee22aba2 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -1,7 +1,7 @@ # # Bug#55672 mysql_upgrade dies with internal error # -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -32,9 +32,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -42,4 +42,5 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index ce233e0db23..b5219333ef1 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -382,3 +382,15 @@ CREATE TABLE t2 (d DATE) ENGINE=MyISAM; SELECT * FROM t1,t2 WHERE 1 IS NOT NULL AND t1.b IS NULL; a b c d DROP TABLE t1,t2; +# +# Start of 10.0 tests +# +# +# MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +# +SELECT NOT NOT NULLIF(2,3); +NOT NOT NULLIF(2,3) +1 +# +# End of 10.0 tests +# diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index 7f3339e7ce4..4f650c3c781 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -101,3 +101,16 @@ Warnings: Warning 1292 Incorrect datetime value: '0000-00-00 00:20:12' Warning 1292 Truncated incorrect datetime value: '-00:20:12' DROP TABLE t1; +# +# MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast +# +SET @@old_mode=zero_date_time_cast; +CREATE TABLE t1 (a TIME,b TIME(1)); +INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); +SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; +TO_DAYS(a) TO_DAYS(b) +NULL NULL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +DROP TABLE t1; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 76b8e887d89..4627f03a8a3 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -7,6 +7,8 @@ grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; +connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); +ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO) connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) SHOW STATUS LIKE 'Ssl_cipher'; diff --git a/mysql-test/r/openssl_6975,tlsv10.result b/mysql-test/r/openssl_6975,tlsv10.result new file mode 100644 index 00000000000..52d5978749e --- /dev/null +++ b/mysql-test/r/openssl_6975,tlsv10.result @@ -0,0 +1,25 @@ +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; +TLS1.2 ciphers: user is ok with any cipher +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user is ok with any cipher +Variable_name Value +Ssl_cipher RC4-SHA +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA +SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA +Variable_name Value +Ssl_cipher RC4-SHA +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result new file mode 100644 index 00000000000..033220427be --- /dev/null +++ b/mysql-test/r/openssl_6975,tlsv12.result @@ -0,0 +1,25 @@ +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; +TLS1.2 ciphers: user is ok with any cipher +Variable_name Value +Ssl_cipher AES128-SHA256 +Variable_name Value +Ssl_cipher DHE-RSA-AES256-GCM-SHA384 +TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +Variable_name Value +Ssl_cipher AES128-SHA256 +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +SSLv3 ciphers: user is ok with any cipher +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; diff --git a/mysql-test/r/order_by_zerolength-4285.result b/mysql-test/r/order_by_zerolength-4285.result new file mode 100644 index 00000000000..f60ce7d90c7 --- /dev/null +++ b/mysql-test/r/order_by_zerolength-4285.result @@ -0,0 +1,26 @@ +create table t1 (pk int primary key); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +select * from t1 order by now(), cast(pk as char(0)); +pk +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +Warnings: +Warning 1292 Truncated incorrect CHAR(0) value: '1' +Warning 1292 Truncated incorrect CHAR(0) value: '2' +Warning 1292 Truncated incorrect CHAR(0) value: '3' +Warning 1292 Truncated incorrect CHAR(0) value: '4' +Warning 1292 Truncated incorrect CHAR(0) value: '5' +Warning 1292 Truncated incorrect CHAR(0) value: '6' +Warning 1292 Truncated incorrect CHAR(0) value: '7' +Warning 1292 Truncated incorrect CHAR(0) value: '8' +Warning 1292 Truncated incorrect CHAR(0) value: '9' +Warning 1292 Truncated incorrect CHAR(0) value: '10' +drop table t1; diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 41ede085623..847af86913d 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1764,6 +1764,11 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed DROP TABLE t1; End of 5.1 tests +create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1)); +ERROR HY000: This partition function is not allowed +create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1)); +ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') (partition p0 values in (0), partition p1 values in (1))' at line 1 +End of 5.5 tests CREATE TABLE t1 (a INT) PARTITION BY LIST (a) SUBPARTITION BY HASH (a) SUBPARTITIONS 2 diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result index 127fa96b84b..0182245c278 100644 --- a/mysql-test/r/processlist.result +++ b/mysql-test/r/processlist.result @@ -1,15 +1,19 @@ SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; SELECT 1; SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed'; -SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL; +SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":TID:"; 1 1 SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; -INFO TIME TIME_MS -NULL 0 0.000 +ID TIME TIME_MS +TID 0 0.000 +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2'; +SET DEBUG_SYNC= 'now WAIT_FOR query_done'; +SET DEBUG_SYNC= 'now SIGNAL nosignal'; select sleep(5); sleep(5) 0 +SET DEBUG_SYNC = 'now WAIT_FOR query_done'; select command, time < 5 from information_schema.processlist where id != connection_id(); command time < 5 Sleep 1 diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 9899b894ff6..3f2343fa365 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -1346,4 +1346,67 @@ foo foo 1 foo foo 2 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; +# +# Bug mdev-6325: wrong selectivity of a column with ref access +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; +# +# Bug mdev-6843: col IS NULL in where condition when col is always NULL +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t2 a straight_join t2 b where a.a is null; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where +1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 90f6dba83f1..0b7f1c950e5 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1356,6 +1356,134 @@ foo foo 1 foo foo 2 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; +# +# Bug mdev-6325: wrong selectivity of a column with ref access +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; +# +# Bug mdev-6843: col IS NULL in where condition when col is always NULL +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t2 a straight_join t2 b where a.a is null; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where +1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; +set @tmp_ust= @@use_stat_tables; +set @tmp_oucs= @@optimizer_use_condition_selectivity; +# +# MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1 +# +set @tmp_mdev6808= @@optimizer_use_condition_selectivity; +SET optimizer_use_condition_selectivity = 2; +CREATE TABLE t1 ( +event_id int(11) unsigned NOT NULL AUTO_INCREMENT, +PRIMARY KEY (event_id) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +repost_id int(11) unsigned NOT NULL AUTO_INCREMENT, +subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, +subject_id int(11) unsigned NOT NULL, +object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, +object_id int(11) unsigned NOT NULL, +is_private int(1) NOT NULL DEFAULT '0', +PRIMARY KEY (repost_id), +UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private), +KEY SUBJECT (subject_type,subject_id), +KEY OBJECT (object_type,object_id) +) ENGINE=InnoDB; +SELECT +* +FROM +t2, t1 +WHERE +t2.object_type = 'event' AND +t2.object_id = t1.event_id AND +t2.is_private = 0 AND +t2.subject_id = 127994 AND +t2.subject_type in ('user') +; +repost_id subject_type subject_id object_type object_id is_private event_id +DROP TABLE t1, t2; +set optimizer_use_condition_selectivity=@tmp_mdev6808; +# +# MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ... +# +SET use_stat_tables = PREFERABLY; +SET optimizer_use_condition_selectivity = 3; +CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English'); +CREATE TABLE t2 (i INT) ENGINE=InnoDB; +SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN ( +SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b ) +); +a b i +DROP TABLE t1,t2; +# +# MDEV-6738: use_stat_table + histograms crashing optimizer +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; +# Need innodb because there is a special kind of field_bit for non-myisam tables +create table t1(col1 int, col2 bit(1) DEFAULT NULL) engine=innodb; +select * from t1 where col2 != true; +col1 col2 +drop table t1; +# +# End of 10.0 tests +# +set use_stat_tables= @tmp_ust; +set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/show_bad_definer-5553.result b/mysql-test/r/show_bad_definer-5553.result new file mode 100644 index 00000000000..a1b8c6a7410 --- /dev/null +++ b/mysql-test/r/show_bad_definer-5553.result @@ -0,0 +1,13 @@ +create database mysqltest1; +use mysqltest1; +create table t1(id int primary key); +create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id; +Warnings: +Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL +v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW +Warnings: +Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist +drop database mysqltest1; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index d373d14c089..dd9277517d8 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1869,3 +1869,216 @@ AVG(f1) 1.5000 drop table t1; End of 5.3 tests +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 ENUM('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE t1, t2; +# +# MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +# +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +# +CREATE TABLE t1 (id INT NOT NULL, a ENUM('04','03','02','01')) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'01'); +INSERT INTO t1 VALUES (1,'02'); +INSERT INTO t1 VALUES (1,'03'); +INSERT INTO t1 VALUES (1,'04'); +INSERT INTO t1 VALUES (2,'01'); +INSERT INTO t1 VALUES (2,'02'); +INSERT INTO t1 VALUES (2,'03'); +INSERT INTO t1 VALUES (2,'04'); +INSERT INTO t1 VALUES (3,'01'); +INSERT INTO t1 VALUES (3,'02'); +INSERT INTO t1 VALUES (3,'03'); +INSERT INTO t1 VALUES (3,'04'); +INSERT INTO t1 VALUES (4,'01'); +INSERT INTO t1 VALUES (4,'02'); +INSERT INTO t1 VALUES (4,'03'); +INSERT INTO t1 VALUES (4,'04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +# Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 6 NULL 16 Using where; Using index +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +# Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 6 NULL 16 Using where; Using index +DROP TABLE t1; +# +# MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +# +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 ENUM('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +c1 +1.0 +2.0 +DROP TABLE t1,t2; +CREATE TABLE t1 (a DECIMAL(10,1), b ENUM('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +a b +1.0 1 +2.0 2 +ALTER TABLE t1 MODIFY a ENUM('1','2'); +SELECT * FROM t1; +a b +1 1 +2 2 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index f498b6889a5..57e2660750b 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -465,3 +465,70 @@ f 1 2 DROP TABLE t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +# +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +# t2 should NOT be elimitated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index fb10e65c0ce..ab075d29e22 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1988,3 +1988,93 @@ SELECT d1 * d2 FROM t1; d1 * d2 0 DROP TABLE t1; +select 0.000000000000000000000000000000000000000000000000001 mod 1; +0.000000000000000000000000000000000000000000000000001 mod 1 +0.000000000000000000000000000000 +select 0.0000000001 mod 1; +0.0000000001 mod 1 +0.0000000001 +select 0.01 mod 1; +0.01 mod 1 +0.01 +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DECIMAL(30,1)); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +# +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DECIMAL(30,10)); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 09531ec60d5..f3b7019c989 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -104,3 +104,162 @@ INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' ); ERROR 23000: Duplicate entry '' for key 'set_unique_utf8' DROP TABLE t1; End of 5.0 tests +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 SET('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE t1, t2; +# +# MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +# +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +# +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 SET('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +c1 +1.0 +2.0 +DROP TABLE t1,t2; +CREATE TABLE t1 (a DECIMAL(10,1), b SET('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +a b +1.0 1 +2.0 2 +ALTER TABLE t1 MODIFY a SET('1','2'); +SELECT * FROM t1; +a b +1 1 +2 2 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 55b3ca1a1f4..477703edebb 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -369,6 +369,17 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); 1 DROP TABLE t1; # +# MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +# +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +d c +DROP TABLE t1; +# +# End of 5.5 tests +# +# # Start of 10.0 tests # # diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index e08605fb237..10aa2f2f393 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -14,3 +14,40 @@ this 0 4294967295 drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01'); +CREATE TABLE t2 (a INT UNSIGNED); +INSERT INTO t2 VALUES (19990101); +INSERT INTO t2 VALUES (990101); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 +1999-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 +1999-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 +1999-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 +1999-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 38ed8a47339..965d113124b 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -510,3 +510,44 @@ SELECT 5 = a FROM t1; Warnings: Warning 1292 Truncated incorrect DOUBLE value: 's ' DROP TABLE t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 VARCHAR(20)); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 4ecac34d9fa..40f5a77e3d0 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1935,3 +1935,23 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION t1 ALL NULL NULL NULL NULL 4 NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL drop table t1; +# +# MDEV-6868:MariaDB server crash ( select with union and order by +# with subquery ) +# +CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) ); +INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' ); +( +SELECT sample_name1 AS testname FROM t1 +) +UNION +( +SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id) +) +; +testname +aaaa +cccc +bbbb +dddd +drop table t1; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index ca08c53cabe..ff155e5fe15 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5500,6 +5500,20 @@ a b a b a c 9 10 9 10 9 10 drop view v1; drop table t1,t2; +create table t1 (i int not null); +insert into t1 values (1),(2); +create table t2 (j int not null); +insert into t2 values (11),(12); +create algorithm=merge view v3 as select t1.* from t2 left join t1 on (t2.j = t1.i); +prepare stmt from 'select count(v3.i) from t1, v3'; +execute stmt; +count(v3.i) +0 +execute stmt; +count(v3.i) +0 +drop table t1, t2; +drop view v3; # ----------------------------------------------------------------- # -- End of 10.0 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index d80b4aaf822..ac4068a6373 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -52,6 +52,9 @@ sub skip_combinations { } $skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok(); + $skip{'t/openssl_6975.test'} = 'no or too old openssl' + unless ! IS_WINDOWS and ! system "openssl ciphers TLSv1.2 2>&1 >/dev/null"; + %skip; } diff --git a/mysql-test/suite/binlog/r/load_data_stm_view.result b/mysql-test/suite/binlog/r/load_data_stm_view.result new file mode 100644 index 00000000000..ddbdb71983f --- /dev/null +++ b/mysql-test/suite/binlog/r/load_data_stm_view.result @@ -0,0 +1,24 @@ +create table t1 (i int, j int); +create view v1 as select i from t1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i); +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1; +select * from v1; +i +1 +1 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1 (i int, j int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select i from t1 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=# +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=# +master-bin.000001 # Query # # COMMIT +drop view v1; +drop table t1; diff --git a/mysql-test/suite/binlog/t/load_data_stm_view.test b/mysql-test/suite/binlog/t/load_data_stm_view.test new file mode 100644 index 00000000000..b70651b4e2d --- /dev/null +++ b/mysql-test/suite/binlog/t/load_data_stm_view.test @@ -0,0 +1,20 @@ +# +# MDEV-3940 Server crash or assertion `item->type() == Item::STRING_ITEM' failure on LOAD DATA through a view with statement binary logging +# + +--source include/have_binlog_format_statement.inc + +--write_file $MYSQLTEST_VARDIR/3940.data +1 +EOF + +create table t1 (i int, j int); +create view v1 as select i from t1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i) +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 +select * from v1; +--source include/show_binlog_events.inc +drop view v1; +drop table t1; diff --git a/mysql-test/suite/heap/btree_varchar_null.result b/mysql-test/suite/heap/btree_varchar_null.result new file mode 100644 index 00000000000..9199cf6ef7d --- /dev/null +++ b/mysql-test/suite/heap/btree_varchar_null.result @@ -0,0 +1,6 @@ +create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory; +insert into t1 values (null,'not'),('one',null),('two',null),('three',''); +select * from t1 where f1 = 'one' and f2 is null; +f1 f2 +one NULL +drop table t1; diff --git a/mysql-test/suite/heap/btree_varchar_null.test b/mysql-test/suite/heap/btree_varchar_null.test new file mode 100644 index 00000000000..8e6625a2bfa --- /dev/null +++ b/mysql-test/suite/heap/btree_varchar_null.test @@ -0,0 +1,7 @@ +# +# MDEV-4813 Replication fails on updating a MEMORY table with an index using btree +# +create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory; +insert into t1 values (null,'not'),('one',null),('two',null),('three',''); +select * from t1 where f1 = 'one' and f2 is null; +drop table t1; diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index ad1323d4857..8cae44a3607 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -9,4 +9,4 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -innodb_bug14676111: MDEV-4396 + diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result new file mode 100644 index 00000000000..53ddf618244 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -0,0 +1,16 @@ +# +# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +# ADD FOREIGN KEY +# +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); +drop table title, department, people; diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result index ebecd1d00cb..c2fdfee5522 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14676111.result +++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result @@ -1,4 +1,6 @@ drop table if exists t1; +call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*"); +set global innodb_stats_persistent = false; CREATE TABLE t1 (a int not null primary key) engine=InnoDB; set global innodb_limit_optimistic_insert_debug = 2; insert into t1 values (1); @@ -9,45 +11,55 @@ insert into t1 values (2); analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -10.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +10 delete from t1 where a=4; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -8.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +8 delete from t1 where a=5; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -5.0000 -set global innodb_limit_optimistic_insert_debug = 10000; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +5 +set global innodb_limit_optimistic_insert_debug = 0; delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -3.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +3 insert into t1 values (2); delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -2.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +2 insert into t1 values (2); delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -1.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result new file mode 100644 index 00000000000..f8d24f4e6f5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_monitor.result @@ -0,0 +1,585 @@ +set global innodb_monitor_disable = All; +select name, status from information_schema.innodb_metrics; +name status +metadata_table_handles_opened disabled +metadata_table_handles_closed disabled +metadata_table_reference_count disabled +metadata_mem_pool_size disabled +lock_deadlocks disabled +lock_timeouts disabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits disabled +lock_row_lock_time disabled +lock_row_lock_time_max disabled +lock_row_lock_waits disabled +lock_row_lock_time_avg disabled +buffer_pool_size disabled +buffer_pool_reads disabled +buffer_pool_read_requests disabled +buffer_pool_write_requests disabled +buffer_pool_wait_free disabled +buffer_pool_read_ahead disabled +buffer_pool_read_ahead_evicted disabled +buffer_pool_pages_total disabled +buffer_pool_pages_misc disabled +buffer_pool_pages_data disabled +buffer_pool_bytes_data disabled +buffer_pool_pages_dirty disabled +buffer_pool_bytes_dirty disabled +buffer_pool_pages_free disabled +buffer_pages_created disabled +buffer_pages_written disabled +buffer_pages_read disabled +buffer_data_reads disabled +buffer_data_written disabled +buffer_flush_batch_scanned disabled +buffer_flush_batch_num_scan disabled +buffer_flush_batch_scanned_per_call disabled +buffer_flush_batch_rescan disabled +buffer_flush_batch_total_pages disabled +buffer_flush_batches disabled +buffer_flush_batch_pages disabled +buffer_flush_neighbor_total_pages disabled +buffer_flush_neighbor disabled +buffer_flush_neighbor_pages disabled +buffer_flush_n_to_flush_requested disabled +buffer_flush_avg_page_rate disabled +buffer_flush_lsn_avg_rate disabled +buffer_flush_pct_for_dirty disabled +buffer_flush_pct_for_lsn disabled +buffer_flush_sync_waits disabled +buffer_flush_adaptive_total_pages disabled +buffer_flush_adaptive disabled +buffer_flush_adaptive_pages disabled +buffer_flush_sync_total_pages disabled +buffer_flush_sync disabled +buffer_flush_sync_pages disabled +buffer_flush_background_total_pages disabled +buffer_flush_background disabled +buffer_flush_background_pages disabled +buffer_LRU_batch_scanned disabled +buffer_LRU_batch_num_scan disabled +buffer_LRU_batch_scanned_per_call disabled +buffer_LRU_batch_total_pages disabled +buffer_LRU_batches disabled +buffer_LRU_batch_pages disabled +buffer_LRU_single_flush_scanned disabled +buffer_LRU_single_flush_num_scan disabled +buffer_LRU_single_flush_scanned_per_call disabled +buffer_LRU_single_flush_failure_count disabled +buffer_LRU_get_free_search disabled +buffer_LRU_search_scanned disabled +buffer_LRU_search_num_scan disabled +buffer_LRU_search_scanned_per_call disabled +buffer_LRU_unzip_search_scanned disabled +buffer_LRU_unzip_search_num_scan disabled +buffer_LRU_unzip_search_scanned_per_call disabled +buffer_page_read_index_leaf disabled +buffer_page_read_index_non_leaf disabled +buffer_page_read_index_ibuf_leaf disabled +buffer_page_read_index_ibuf_non_leaf disabled +buffer_page_read_undo_log disabled +buffer_page_read_index_inode disabled +buffer_page_read_ibuf_free_list disabled +buffer_page_read_ibuf_bitmap disabled +buffer_page_read_system_page disabled +buffer_page_read_trx_system disabled +buffer_page_read_fsp_hdr disabled +buffer_page_read_xdes disabled +buffer_page_read_blob disabled +buffer_page_read_zblob disabled +buffer_page_read_zblob2 disabled +buffer_page_read_other disabled +buffer_page_written_index_leaf disabled +buffer_page_written_index_non_leaf disabled +buffer_page_written_index_ibuf_leaf disabled +buffer_page_written_index_ibuf_non_leaf disabled +buffer_page_written_undo_log disabled +buffer_page_written_index_inode disabled +buffer_page_written_ibuf_free_list disabled +buffer_page_written_ibuf_bitmap disabled +buffer_page_written_system_page disabled +buffer_page_written_trx_system disabled +buffer_page_written_fsp_hdr disabled +buffer_page_written_xdes disabled +buffer_page_written_blob disabled +buffer_page_written_zblob disabled +buffer_page_written_zblob2 disabled +buffer_page_written_other disabled +os_data_reads disabled +os_data_writes disabled +os_data_fsyncs disabled +os_pending_reads disabled +os_pending_writes disabled +os_log_bytes_written disabled +os_log_fsyncs disabled +os_log_pending_fsyncs disabled +os_log_pending_writes disabled +trx_rw_commits disabled +trx_ro_commits disabled +trx_nl_ro_commits disabled +trx_commits_insert_update disabled +trx_rollbacks disabled +trx_rollbacks_savepoint disabled +trx_rollback_active disabled +trx_active_transactions disabled +trx_rseg_history_len disabled +trx_undo_slots_used disabled +trx_undo_slots_cached disabled +trx_rseg_current_size disabled +purge_del_mark_records disabled +purge_upd_exist_or_extern_records disabled +purge_invoked disabled +purge_undo_log_pages disabled +purge_dml_delay_usec disabled +purge_stop_count disabled +purge_resume_count disabled +log_checkpoints disabled +log_lsn_last_flush disabled +log_lsn_last_checkpoint disabled +log_lsn_current disabled +log_lsn_checkpoint_age disabled +log_lsn_buf_pool_oldest disabled +log_max_modified_age_async disabled +log_max_modified_age_sync disabled +log_pending_log_writes disabled +log_pending_checkpoint_writes disabled +log_num_log_io disabled +log_waits disabled +log_write_requests disabled +log_writes disabled +compress_pages_compressed disabled +compress_pages_decompressed disabled +compression_pad_increments disabled +compression_pad_decrements disabled +index_page_splits disabled +index_page_merge_attempts disabled +index_page_merge_successful disabled +index_page_reorg_attempts disabled +index_page_reorg_successful disabled +index_page_discards disabled +adaptive_hash_searches disabled +adaptive_hash_searches_btree disabled +adaptive_hash_pages_added disabled +adaptive_hash_pages_removed disabled +adaptive_hash_rows_added disabled +adaptive_hash_rows_removed disabled +adaptive_hash_rows_deleted_no_hash_entry disabled +adaptive_hash_rows_updated disabled +file_num_open_files disabled +ibuf_merges_insert disabled +ibuf_merges_delete_mark disabled +ibuf_merges_delete disabled +ibuf_merges_discard_insert disabled +ibuf_merges_discard_delete_mark disabled +ibuf_merges_discard_delete disabled +ibuf_merges disabled +ibuf_size disabled +innodb_master_thread_sleeps disabled +innodb_activity_count disabled +innodb_master_active_loops disabled +innodb_master_idle_loops disabled +innodb_background_drop_table_usec disabled +innodb_ibuf_merge_usec disabled +innodb_log_flush_usec disabled +innodb_mem_validate_usec disabled +innodb_master_purge_usec disabled +innodb_dict_lru_usec disabled +innodb_checkpoint_usec disabled +innodb_dblwr_writes disabled +innodb_dblwr_pages_written disabled +innodb_page_size disabled +innodb_rwlock_s_spin_waits disabled +innodb_rwlock_x_spin_waits disabled +innodb_rwlock_s_spin_rounds disabled +innodb_rwlock_x_spin_rounds disabled +innodb_rwlock_s_os_waits disabled +innodb_rwlock_x_os_waits disabled +dml_reads disabled +dml_inserts disabled +dml_deletes disabled +dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled +ddl_background_drop_indexes disabled +ddl_background_drop_tables disabled +ddl_online_create_index disabled +ddl_pending_alter_table disabled +icp_attempts disabled +icp_no_match disabled +icp_out_of_range disabled +icp_match disabled +set global innodb_monitor_enable = all; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_enable = aaa; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' +set global innodb_monitor_disable = All; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_reset_all = all; +select name from information_schema.innodb_metrics where count!=0; +name +set global innodb_monitor_enable = "%lock%"; +select name from information_schema.innodb_metrics +where status != IF(name like "%lock%", 'enabled', 'disabled'); +name +set global innodb_monitor_disable = "%lock%"; +select name, status from information_schema.innodb_metrics +where name like "%lock%"; +name status +lock_deadlocks disabled +lock_timeouts disabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits disabled +lock_row_lock_time disabled +lock_row_lock_time_max disabled +lock_row_lock_waits disabled +lock_row_lock_time_avg disabled +innodb_rwlock_s_spin_waits disabled +innodb_rwlock_x_spin_waits disabled +innodb_rwlock_s_spin_rounds disabled +innodb_rwlock_x_spin_rounds disabled +innodb_rwlock_s_os_waits disabled +innodb_rwlock_x_os_waits disabled +set global innodb_monitor_enable = "%lock*"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' +set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_disable="%%%%%"; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_enable="%"; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_disable="%_%"; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_enable="log%%%%"; +select name from information_schema.innodb_metrics +where status != IF(name like "log%", 'enabled', 'disabled'); +name +set global innodb_monitor_enable="os_%a_fs_ncs"; +set global innodb_monitor_enable="os%pending%"; +select name, status from information_schema.innodb_metrics +where name like "os%"; +name status +os_data_reads disabled +os_data_writes disabled +os_data_fsyncs enabled +os_pending_reads enabled +os_pending_writes enabled +os_log_bytes_written disabled +os_log_fsyncs disabled +os_log_pending_fsyncs enabled +os_log_pending_writes enabled +set global innodb_monitor_enable=""; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' +set global innodb_monitor_enable="_"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' +set global innodb_monitor_disable = module_metadata; +set global innodb_monitor_reset_all = module_metadata; +set global innodb_monitor_enable = metadata_table_handles_opened; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_disable = metadata_table_handles_opened; +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = metadata_table_handles_opened; +drop table monitor_test; +create table monitor_test(col int) engine = innodb stats_persistent=0; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_enable = metadata_table_handles_closed; +create index idx on monitor_test(col); +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_closed"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled +metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_disable = module_metadata; +set global innodb_monitor_reset = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_reset_all = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = module_trx; +begin; +insert into monitor_test values(9); +commit; +begin; +insert into monitor_test values(9); +rollback; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "trx_rollbacks" or name like "trx_active_transactions"; +name max_count min_count count max_count_reset min_count_reset count_reset status +trx_rollbacks 1 NULL 1 1 NULL 1 enabled +trx_active_transactions 1 0 0 1 0 0 enabled +set global innodb_monitor_disable = module_trx; +set global innodb_monitor_enable = module_dml; +insert into monitor_test values(9); +update monitor_test set col = 10 where col = 9; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 4 NULL 4 4 NULL 4 enabled +dml_inserts 1 NULL 1 1 NULL 1 enabled +dml_deletes 0 NULL 0 0 NULL 0 enabled +dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 6 NULL 6 6 NULL 6 enabled +dml_inserts 1 NULL 1 1 NULL 1 enabled +dml_deletes 2 NULL 2 2 NULL 2 enabled +dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_reset = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 6 NULL 6 0 NULL 0 enabled +dml_inserts 1 NULL 1 0 NULL 0 enabled +dml_deletes 2 NULL 2 0 NULL 0 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +insert into monitor_test values(9); +insert into monitor_test values(1); +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 enabled +dml_inserts 3 NULL 3 2 NULL 2 enabled +dml_deletes 4 NULL 4 2 NULL 2 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_reset_all = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 enabled +dml_inserts 3 NULL 3 2 NULL 2 enabled +dml_deletes 4 NULL 4 2 NULL 2 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_disable = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 disabled +dml_inserts 3 NULL 3 2 NULL 2 disabled +dml_deletes 4 NULL 4 2 NULL 2 disabled +dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled +set global innodb_monitor_reset_all = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads NULL NULL 0 NULL NULL 0 disabled +dml_inserts NULL NULL 0 NULL NULL 0 disabled +dml_deletes NULL NULL 0 NULL NULL 0 disabled +dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = dml_inserts; +insert into monitor_test values(9); +insert into monitor_test values(1); +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads NULL NULL 0 NULL NULL 0 disabled +dml_inserts 2 NULL 2 2 NULL 2 enabled +dml_deletes NULL NULL 0 NULL NULL 0 disabled +dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_disable = module_dml; +drop table monitor_test; +set global innodb_monitor_enable = file_num_open_files; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "file_num_open_files"; +name max_count min_count count max_count_reset min_count_reset count_reset status +file_num_open_files # # # # # # enabled +set global innodb_monitor_disable = file_num_open_files; +set global innodb_monitor_enable = "icp%"; +create table monitor_test(a char(3), b int, c char(2), +primary key (a(1), c(1)), key(b)) engine = innodb; +insert into monitor_test values("13", 2, "aa"); +select a from monitor_test where b < 1 for update; +a +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 1 +icp_no_match 0 +icp_out_of_range 1 +icp_match 0 +select a from monitor_test where b < 3 for update; +a +13 +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 2 +icp_no_match 0 +icp_out_of_range 1 +icp_match 1 +drop table monitor_test; +set global innodb_monitor_disable = all; +set global innodb_monitor_reset_all = all; +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; +1 +set global innodb_monitor_enable = default; +set global innodb_monitor_disable = default; +set global innodb_monitor_reset = default; +set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test new file mode 100644 index 00000000000..8ee96347208 --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign-keys.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +if (`select plugin_auth_version <= "5.5.39-MariaDB-36.0" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB as of 5.5.39-MariaDB-36.0 or earlier +} + +--echo # +--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +--echo # ADD FOREIGN KEY +--echo # + +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; + +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; + +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; + +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); + +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); + +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); + +drop table title, department, people; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index f687f089d78..b519c48b23d 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1314,7 +1314,7 @@ drop table t1; # Test for testable InnoDB status variables. This test # uses previous ones(pages_created, rows_deleted, ...). ---replace_result 511 ok 512 ok 2047 ok 513 ok +--replace_result 511 ok 512 ok 2047 ok 513 ok 515 ok 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'; diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.opt b/mysql-test/suite/innodb/t/innodb_bug14676111.opt new file mode 100644 index 00000000000..77945d1e4bb --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.opt @@ -0,0 +1 @@ +--innodb-sys-tablestats=1
\ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test index 41862b8105e..ba04d421fde 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14676111.test +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test @@ -3,11 +3,6 @@ -- source include/have_innodb.inc -- source include/have_debug.inc -# Note that this test needs to be able to manipulate how/when purge is done -# using @@innodb_limit_optimistic_insert_debug. This does not work with -# background purge threads, so we disabled them in the -master.opt (they are -# off by default in normal 5.5 innodb but on by default in xtradb) - if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`) { --skip Test requires InnoDB built with UNIV_DEBUG definition. @@ -15,16 +10,20 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n --disable_query_log set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +set @old_innodb_stats_persistent = @@innodb_stats_persistent; +set @old_innodb_undo_logs = @@innodb_undo_logs; +# Limit undo segments for stable progress of purge. +set global innodb_undo_logs = 1; --enable_query_log --disable_warnings drop table if exists t1; --enable_warnings -CREATE TABLE t1 (a int not null primary key) engine=InnoDB; +call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*"); -let $wait_condition= - SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS - WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE'; +set global innodb_stats_persistent = false; + +CREATE TABLE t1 (a int not null primary key) engine=InnoDB; # # make 4 leveled straight tree @@ -55,10 +54,12 @@ insert into t1 values (2); #(1, 2) (3) (4) (5) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; delete from t1 where a=4; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #deleting 1 record of 2 records don't cause merge artificially. #current tree form # (1, 5) @@ -67,10 +68,12 @@ delete from t1 where a=4; #(1, 2) (3) (5) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; delete from t1 where a=5; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #deleting 1 record of 2 records don't cause merge artificially. #current tree form # (1) @@ -79,16 +82,18 @@ delete from t1 where a=5; #(1, 2) (3) <- merged next analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; # # cause merge at level 0 # #disable the artificial limitation of records in a page -set global innodb_limit_optimistic_insert_debug = 10000; +set global innodb_limit_optimistic_insert_debug = 0; delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #merge page occurs. and lift up occurs. #current tree form # (1) @@ -96,7 +101,7 @@ delete from t1 where a=2; # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; insert into t1 values (2); #current tree form @@ -105,13 +110,15 @@ insert into t1 values (2); # (1, 2, 3) delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #current tree form # (1) # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; insert into t1 values (2); #current tree form @@ -119,15 +126,19 @@ insert into t1 values (2); # (1, 2, 3) <- lift up this level next, because the father is root delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #current tree form # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; drop table t1; --disable_query_log set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +set global innodb_stats_persistent = @old_innodb_stats_persistent; +set global innodb_undo_logs = @old_innodb_undo_logs; --enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test index 205344a1cd7..95b436d676c 100644 --- a/mysql-test/suite/innodb/t/innodb_information_schema.test +++ b/mysql-test/suite/innodb/t/innodb_information_schema.test @@ -122,7 +122,7 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE; # then its contents will never change because the cache from which it is # filled is updated only if it has not been read for 0.1 seconds. See # CACHE_MIN_IDLE_TIME_US in trx/trx0i_s.c. -let $cnt=10; +let $cnt=200; while ($cnt) { let $success=`SELECT COUNT(*) = 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`; diff --git a/mysql-test/suite/innodb/t/innodb_monitor.test b/mysql-test/suite/innodb/t/innodb_monitor.test new file mode 100644 index 00000000000..864e0cae862 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_monitor.test @@ -0,0 +1,387 @@ +# This is the test for Metrics Monitor Table feature. +# Test the metrics monitor system's control system +# and counter accuracy. + +--source include/have_innodb.inc + +set global innodb_monitor_disable = All; + +# Test turn on/off the monitor counter with "all" option +# By default, they will be off +select name, status from information_schema.innodb_metrics; + +# Turn on all monitor counters +set global innodb_monitor_enable = all; + +# status should all change to "enabled" +select name from information_schema.innodb_metrics where status!='enabled'; + +# Test wrong argument to the global configure option +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable = aaa; + +# We require a valid monitor counter/module name. There is no default +# counter name or module. A warning will be printed asking user to +# specify a valid counter name. +#--disable_warnings +#set global innodb_monitor_enable = default; +#--enable_warnings + +# Turn off all monitor counters, option name should be case +# insensitive +set global innodb_monitor_disable = All; + +# status should all change to "disabled" +select name from information_schema.innodb_metrics where status!='disabled'; + +# Reset all counter values +set global innodb_monitor_reset_all = all; + +# count should all change to 0 +select name from information_schema.innodb_metrics where count!=0; + +# Test wildcard match, turn on all counters contain string "lock" +set global innodb_monitor_enable = "%lock%"; + +# All lock related counter should be enabled +select name from information_schema.innodb_metrics +where status != IF(name like "%lock%", 'enabled', 'disabled'); + +# Disable them +set global innodb_monitor_disable = "%lock%"; + +# All lock related counter should be disabled +select name, status from information_schema.innodb_metrics +where name like "%lock%"; + +# No match for "%lock*" +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable = "%lock*"; + +# All counters will be turned on with wildcard match string with all "%" +set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; + +select name from information_schema.innodb_metrics where status!='enabled'; + +# Turn off all counters +set global innodb_monitor_disable="%%%%%"; + +select name from information_schema.innodb_metrics where status!='disabled'; + +# One more round testing. All counters will be turned on with +# single wildcard character "%" +set global innodb_monitor_enable="%"; + +select name from information_schema.innodb_metrics where status!='enabled'; + +# Turn off all the counters with "%_%" +set global innodb_monitor_disable="%_%"; + +select name from information_schema.innodb_metrics where status!='disabled'; + +# Turn on all counters start with "log" +set global innodb_monitor_enable="log%%%%"; + +select name from information_schema.innodb_metrics +where status != IF(name like "log%", 'enabled', 'disabled'); + +# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" +# is single character wildcard match word +set global innodb_monitor_enable="os_%a_fs_ncs"; + +# Turn on counters whose name contains "os" and "pending" with +# wildcard match "os%pending%" +set global innodb_monitor_enable="os%pending%"; + +select name, status from information_schema.innodb_metrics +where name like "os%"; + +# Empty string is an invalid option +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable=""; + +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable="_"; + +# Reset counters only in "module_metadata" module +set global innodb_monitor_disable = module_metadata; + +set global innodb_monitor_reset_all = module_metadata; + +# Only turn on "table_open" counter +set global innodb_monitor_enable = metadata_table_handles_opened; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +# This will open the monitor_test table +select * from monitor_test; + +# "metadata_table_handles_opened" should increment by 1 +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Reset the counter value while counter is still on (started) +# This will reset value "count_reset" but not +# "count" +set global innodb_monitor_reset = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# re-create table again to increment "metadata_table_handles_opened" again +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +select * from monitor_test; + +# "metadata_table_handles_opened" should increment +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Cannot reset all monitor value while the counter is on +set global innodb_monitor_reset_all = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Turn off the counter "metadata_table_handles_opened" +set global innodb_monitor_disable = metadata_table_handles_opened; + +# Reset the counter value while counter is off (disabled) +set global innodb_monitor_reset = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# re-create table again. Since monitor is off, "metadata_table_handles_opened" +# should not be incremented +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +# "metadata_table_handles_opened" should increment +select * from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Reset all the counters, include those counter *_since_start +set global innodb_monitor_reset_all = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Turn on "table_open" counter again +set global innodb_monitor_enable = metadata_table_handles_opened; + +# Test metadata_table_handles_opened again to see if it is working correctly +# after above round of turning on/off/reset +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb stats_persistent=0; + +select * from monitor_test; + +# "metadata_table_handles_opened" should increment +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Test counter "metadata_table_handles_closed", +# create index will close the old handle +set global innodb_monitor_enable = metadata_table_handles_closed; + +create index idx on monitor_test(col); + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_closed"; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +# Reset counters only in "module_metadata" module +set global innodb_monitor_disable = module_metadata; + +set global innodb_monitor_reset = module_metadata; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +set global innodb_monitor_reset_all = module_metadata; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +# Test Transaction Module +set global innodb_monitor_enable = module_trx; + +begin; +insert into monitor_test values(9); +commit; + +begin; +insert into monitor_test values(9); +rollback; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "trx_rollbacks" or name like "trx_active_transactions"; + +set global innodb_monitor_disable = module_trx; + +# Test DML Module +set global innodb_monitor_enable = module_dml; + +insert into monitor_test values(9); + +update monitor_test set col = 10 where col = 9; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +delete from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status + from information_schema.innodb_metrics + where name like "dml%"; + +# test reset counter while the counter is on +set global innodb_monitor_reset = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# insert/delete some rows after the reset +insert into monitor_test values(9); +insert into monitor_test values(1); + +delete from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# We do not allow reset_all while the counter is on, nothing +# should be reset here +set global innodb_monitor_reset_all = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Turn off the counter +set global innodb_monitor_disable = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Reset all counter values +set global innodb_monitor_reset_all = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Open individual counter "dml_inserts" +set global innodb_monitor_enable = dml_inserts; + +insert into monitor_test values(9); +insert into monitor_test values(1); + +delete from monitor_test; + +# Only counter "dml_inserts" should be updated +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +set global innodb_monitor_disable = module_dml; + +drop table monitor_test; + +set global innodb_monitor_enable = file_num_open_files; + +# Counters are unpredictable when innodb-file-per-table is on +--replace_column 2 # 3 # 4 # 5 # 6 # 7 # +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "file_num_open_files"; + +set global innodb_monitor_disable = file_num_open_files; + +# Test ICP module counters +set global innodb_monitor_enable = "icp%"; + +create table monitor_test(a char(3), b int, c char(2), +primary key (a(1), c(1)), key(b)) engine = innodb; + +insert into monitor_test values("13", 2, "aa"); + +select a from monitor_test where b < 1 for update; + +# should have icp_attempts = 1 and icp_out_of_range = 1 +select name, count from information_schema.innodb_metrics +where name like "icp%"; + +# should have icp_attempts = 2 and icp_match = 1 +select a from monitor_test where b < 3 for update; + +select name, count from information_schema.innodb_metrics +where name like "icp%"; + +drop table monitor_test; + +set global innodb_monitor_disable = all; +set global innodb_monitor_reset_all = all; + +# Test for bug #13966091 +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; + +-- disable_warnings +set global innodb_monitor_enable = default; +set global innodb_monitor_disable = default; +set global innodb_monitor_reset = default; +set global innodb_monitor_reset_all = default; +-- enable_warnings diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test index c3b7a60448a..6108d3043d5 100644 --- a/mysql-test/suite/multi_source/simple.test +++ b/mysql-test/suite/multi_source/simple.test @@ -33,6 +33,13 @@ set default_master_connection = ''; --connection slave --sync_with_master 0,'slave2' +# MDEV-7074 (Sporadic test failure due to a race condition) +let $show_statement = SHOW ALL SLAVES STATUS; +let $field = Executed_log_entries; +let $condition = = 7; +let $wait_for_all = 1; +--source include/wait_show_condition.inc + --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 show all slaves status; diff --git a/mysql-test/suite/perfschema/t/mks_timer-6258.test b/mysql-test/suite/perfschema/t/mks_timer-6258.test index b4e5791298a..2bc14abf2f1 100644 --- a/mysql-test/suite/perfschema/t/mks_timer-6258.test +++ b/mysql-test/suite/perfschema/t/mks_timer-6258.test @@ -1,4 +1,5 @@ --source include/not_embedded.inc +--source include/have_perfschema.inc # # MDEV-6258 MariaDB 10.0 performance schema timestamps relative to epoch # diff --git a/mysql-test/suite/plugins/t/unix_socket.test b/mysql-test/suite/plugins/t/unix_socket.test index 2c1af9fb1da..1522c9b7cbe 100644 --- a/mysql-test/suite/plugins/t/unix_socket.test +++ b/mysql-test/suite/plugins/t/unix_socket.test @@ -12,11 +12,14 @@ eval install plugin unix_socket soname '$AUTH_SOCKET_SO'; --echo # with named user --echo # ---replace_result $USER USER +--let $replace=create user $USER +--replace_result $replace "create user USER" eval create user $USER identified via unix_socket; --write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt ---replace_result $USER USER +--let $replace1=$USER@localhost +--let $replace2=$USER@% +--replace_result $replace1 "USER@localhost" $replace2 "USER@%" select user(), current_user(), database(); EOF @@ -31,7 +34,8 @@ EOF --error 1 --exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt ---replace_result $USER USER +--let $replace=drop user $USER +--replace_result $replace "drop user USER" eval drop user $USER; --echo # diff --git a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc new file mode 100644 index 00000000000..b624853cd37 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc @@ -0,0 +1,50 @@ +######################################### +# Author: Benjamin Renard benj@fb.com +# Date: 11/15/2013 +# Purpose: Showing the difference between current innodb rows stats and the ones recorded at the beginning of the test +# Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created +######################################### + +--connection master +--echo ==========MASTER========== + +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; + +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; + +--sync_slave_with_master +--echo ==========SLAVE=========== + +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; + +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; + +--connection master diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index debd107221f..3417ad561f4 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -124,7 +124,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (11); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -141,7 +141,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (12); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -164,7 +164,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (21); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -185,7 +185,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (22); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result b/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result new file mode 100644 index 00000000000..b8e9262c771 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result @@ -0,0 +1,225 @@ +include/master-slave.inc +[connection master] +select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +CREATE DATABASE testdb; +USE testdb; +CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO testdb.t1 VALUES (1); +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +0 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +0 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +0 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +0 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +UPDATE t1 SET i=2 WHERE i=1; +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +1 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +1 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +DELETE FROM t1 WHERE i=2; +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +2 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +1 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +2 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +1 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +DROP TABLE t1; +DROP DATABASE testdb; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result index e25401d310f..328c3c3423f 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result @@ -14,6 +14,34 @@ INSERT INTO tt_2(ddl_case) VALUES(0); ######################################################################### SET AUTOCOMMIT= 0; -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (43) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (42) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result index 296d21d8ef9..63a5493f045 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12816,6 +12827,352 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -12838,4 +13195,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result index a2dcd4fd39b..5811617e71e 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -13188,6 +13199,372 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -13210,4 +13587,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result index 4e8e83d2187..39e1541eb0e 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -15012,6 +15023,460 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -15034,4 +15499,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc 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 bc09916361e..8a110048d80 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 @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12319,6 +12330,338 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -12341,4 +12684,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index fb86d46b01e..ac21e7a3e01 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -923,6 +923,55 @@ a 32 33 34 +*** MDEV-6775: Wrong binlog order in parallel replication *** +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +UPDATE t4 SET b=NULL WHERE a=6; +SET debug_sync='now WAIT_FOR master_queued1'; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 3; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +SET binlog_format= @old_format; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +SET debug_sync= 'now SIGNAL cont'; +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_retry.result b/mysql-test/suite/rpl/r/rpl_parallel_retry.result index cd12d92430b..0129814e6a8 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_retry.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_retry.result @@ -188,9 +188,120 @@ a LENGTH(b) 3 5012 4 5000 SET GLOBAL max_relay_log_size=@old_max; +*** MDEV-7065: Incorrect relay log position in parallel replication after retry of transaction *** +include/stop_slave.inc +BEGIN; +INSERT INTO t1 VALUES (100, 0); +INSERT INTO t1 VALUES (101, 0); +INSERT INTO t1 VALUES (102, 0); +INSERT INTO t1 VALUES (103, 0); +COMMIT; +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +include/start_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +retries +1 +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +include/stop_slave_sql.inc +INSERT INTO t1 VALUES (104, 1); +INSERT INTO t1 VALUES (105, 1); +INSERT INTO t1 VALUES (106, 1); +INSERT INTO t1 VALUES (107, 1); +INSERT INTO t1 VALUES (108, 1); +INSERT INTO t1 VALUES (109, 1); +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +104 1 +105 1 +106 1 +107 1 +108 1 +109 1 +*** MDEV-6917: Parallel replication: "Commit failed due to failure of an earlier commit on which this one depends", but no prior failure seen ** +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (10, foo(1, 'before_execute_sql_command WAIT_FOR t1_start', '')); +UPDATE t3 SET b=NULL WHERE a=6; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued1'; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (20, foo(2, 'group_commit_waiting_for_prior SIGNAL t2_waiting', '')); +DELETE FROM t3 WHERE b <= 3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued2'; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (30, foo(3, 'before_execute_sql_command WAIT_FOR t3_start', 'group_commit_waiting_for_prior SIGNAL t3_waiting')); +INSERT INTO t3 VALUES (7,7); +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +SET binlog_format=@old_format; +SET binlog_format=@old_format; +SET debug_sync='RESET'; +SET binlog_format=@old_format; +SELECT * FROM t3 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +7 7 +SET @old_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,thd_need_ordering_with_force"; +include/start_slave.inc +SET debug_sync='now WAIT_FOR t2_waiting'; +SET debug_sync='now SIGNAL t3_start'; +SET debug_sync='now WAIT_FOR t3_waiting'; +SET debug_sync='now SIGNAL t1_start'; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; +retries +1 +SELECT * FROM t3 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +7 7 +SET binlog_format=@old_format; include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; include/start_slave.inc -DROP TABLE t1, t2; +DROP TABLE t1, t2, t3, t4; DROP function foo; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result index b69deb17c4c..d454fa41111 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result @@ -7,7 +7,6 @@ SHOW BINLOG EVENTS; SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; FLUSH LOGS; SET DEBUG_SYNC= 'now SIGNAL end'; -SET DEBUG_SYNC= 'RESET'; [connection slave] SET DEBUG_SYNC= 'RESET'; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result index 289cc313e2a..cc537f83ca4 100644 --- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result @@ -14,6 +14,36 @@ INSERT INTO tt_2(ddl_case) VALUES(0); ######################################################################### SET AUTOCOMMIT= 0; -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; Table Op Msg_type Msg_text diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result index 4e8e83d2187..39e1541eb0e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -15012,6 +15023,460 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -15034,4 +15499,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result index 91adfc7965c..cb702ad64ef 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result @@ -14,6 +14,34 @@ INSERT INTO tt_2(ddl_case) VALUES(0); ######################################################################### SET AUTOCOMMIT= 0; -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (43) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (42) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; Table Op Msg_type Msg_text 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 9ca811c29c8..1cf49b30fcd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12522,6 +12533,344 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` / -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- ################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-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- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 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. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-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- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + +################################################################################### # CHECK CONSISTENCY ################################################################################### ################################################################################### @@ -12544,6 +12893,7 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_reset.inc CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test new file mode 100644 index 00000000000..76e7c60fd59 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test @@ -0,0 +1,53 @@ +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +# +# Bug#68220: innodb_rows_updated is misleading on slave when *info_repository=TABLE +# + +# created all the base variables at the beginning at the test +--connection master +select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; + +--connection slave +select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; + +--connection master +CREATE DATABASE testdb; +USE testdb; +CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB; + +# insert a row and show counters on master and slave +INSERT INTO testdb.t1 VALUES (1); +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# update the row and show counters on master and slave +UPDATE t1 SET i=2 WHERE i=1; +--sync_slave_with_master +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# delete the row and show counters on master and slave +DELETE FROM t1 WHERE i=2; +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# clean the test +DROP TABLE t1; +DROP DATABASE testdb; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test index 161ab2f9dca..b2e8308b34d 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_mixed.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test index 4f01ef7765b..d3ec08f5508 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel.test +++ b/mysql-test/suite/rpl/t/rpl_parallel.test @@ -1466,6 +1466,75 @@ SET sql_slave_skip_counter= 1; SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +--echo *** MDEV-6775: Wrong binlog order in parallel replication *** +--connection server_1 +# A bit tricky bug to reproduce. On the master, we binlog in statement-mode +# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate +# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, +# is not binlogged. Then we inject a wait in the group commit code on the +# slave, shortly before the actual commit of the UPDATE. The bug was that the +# DELETE could wake up from wait_for_prior_commit() before the commit of the +# UPDATE. So the test could see the slave position updated to after DELETE, +# while the UPDATE was still not visible. +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +# Re-spawn the worker threads to be sure they pick up the new binlog format +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format= @old_format; +--connection con2 +REAP; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--save_master_pos +SELECT * FROM t4 ORDER BY a; + +--connection server_2 +--source include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +--sync_with_master +SELECT * FROM t4 ORDER BY a; +SET debug_sync= 'now SIGNAL cont'; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + --connection server_2 --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test index d3be6262cb0..b3a8ea45cf0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test @@ -135,7 +135,6 @@ SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parall let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); START SLAVE; --let $slave_sql_errno= 1213 ---let $slave_timeout= 10 --source include/wait_for_slave_sql_error.inc SET GLOBAL debug_dbug=@old_dbug; let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); @@ -208,13 +207,178 @@ SELECT a, LENGTH(b) FROM t2 ORDER BY a; SET GLOBAL max_relay_log_size=@old_max; +--echo *** MDEV-7065: Incorrect relay log position in parallel replication after retry of transaction *** + +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +BEGIN; +INSERT INTO t1 VALUES (100, 0); +INSERT INTO t1 VALUES (101, 0); +INSERT INTO t1 VALUES (102, 0); +INSERT INTO t1 VALUES (103, 0); +COMMIT; +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +--save_master_pos + +--connection server_2 +# Inject a DBUG error insert to cause the XID event of the single transaction +# from the master to fail with a deadlock error and be retried. +# The bug was that the retry of the XID would leave the relay log position +# incorrect (off by the size of XID event). +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--source include/start_slave.inc +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; +let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--disable_query_log +eval SELECT $new_retry - $old_retry AS retries; +--enable_query_log + +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +# Stop the SQL thread. When the bug was there to give the incorrect relay log +# position, the restart of the SQL thread would read garbage data from the +# middle of an event and fail with relay log IO error. +--source include/stop_slave_sql.inc + +--connection server_1 +INSERT INTO t1 VALUES (104, 1); +INSERT INTO t1 VALUES (105, 1); +INSERT INTO t1 VALUES (106, 1); +INSERT INTO t1 VALUES (107, 1); +INSERT INTO t1 VALUES (108, 1); +INSERT INTO t1 VALUES (109, 1); +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; + + +--echo *** MDEV-6917: Parallel replication: "Commit failed due to failure of an earlier commit on which this one depends", but no prior failure seen ** + +--connection server_1 +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; + +# We need statement binlog format to be able to inject debug_sync statements +# on the slave with calls to foo(). +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; + +--connection server_1 + +# Create a group commit with three transactions T1, T2, T3. +# T2 will block T1 on the slave where we will make it run first, so it will be +# deadlock killed. +# The bug was that in this case, T3 was signalled to fail due to T2 failing, +# even though the retry of T2 was later successful. + +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (10, foo(1, 'before_execute_sql_command WAIT_FOR t1_start', '')); +UPDATE t3 SET b=NULL WHERE a=6; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send COMMIT; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (20, foo(2, 'group_commit_waiting_for_prior SIGNAL t2_waiting', '')); +DELETE FROM t3 WHERE b <= 3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connect (con3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (30, foo(3, 'before_execute_sql_command WAIT_FOR t3_start', 'group_commit_waiting_for_prior SIGNAL t3_waiting')); +INSERT INTO t3 VALUES (7,7); +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format=@old_format; +--connection con2 +REAP; +SET binlog_format=@old_format; +--connection con3 +REAP; +SET debug_sync='RESET'; +SET binlog_format=@old_format; + +--connection server_1 +--save_master_pos +SELECT * FROM t3 ORDER BY a; + + +--connection server_2 +let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +SET @old_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,thd_need_ordering_with_force"; +--source include/start_slave.inc +# First, wait for T2 to complete up to where it is waiting for T1 to group +# commit for both of them. This will set locks that will block T1, causing +# a deadlock kill and retry of T2. T1 and T3 are still blocked at the start +# of each their SQL statements. +SET debug_sync='now WAIT_FOR t2_waiting'; +# Now let T3 move on until the point where it is itself ready to commit. +SET debug_sync='now SIGNAL t3_start'; +SET debug_sync='now WAIT_FOR t3_waiting'; +# Now T2 and T3 are set up, so we can let T1 proceed. +SET debug_sync='now SIGNAL t1_start'; +# Now we can wait for the slave to catch up. +# We should see T2 being deadlock killed and retried. +# The bug was that T2 deadlock kill would cause T3 to fail due to failure +# of an earlier commit. This is wrong as T2 did not fail, it was only +# retried. +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; +let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--disable_query_log +eval SELECT $new_retry - $old_retry >= 1 AS retries; +--enable_query_log +SELECT * FROM t3 ORDER BY a; + + +--connection server_1 +SET binlog_format=@old_format; + + +# Clean up. --connection server_2 --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; --source include/start_slave.inc --connection server_1 -DROP TABLE t1, t2; +DROP TABLE t1, t2, t3, t4; DROP function foo; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test index 16d986268c9..83d847318d8 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test @@ -22,7 +22,6 @@ SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; FLUSH LOGS; SET DEBUG_SYNC= 'now SIGNAL end'; -SET DEBUG_SYNC= 'RESET'; --echo [connection slave] --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test index 8eb397c3460..b13fa5a01b1 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test @@ -1,6 +1,8 @@ --source include/have_innodb.inc --source include/have_debug.inc --source include/have_binlog_format_statement.inc +# Valgrind does not work well with test that crashes the server +--source include/not_valgrind.inc --let $rpl_topology=1->2 --source include/rpl_init.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test index cfad4fca433..2b35f68ff63 100644 --- a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test index 7ba5e90b96d..84c5c215a08 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test @@ -25,6 +25,11 @@ let $field= Server_id; # 3 is server_id of slave2. let $condition= ='3'; source include/wait_show_condition.inc; +# Make sure that the other slave also had time to register. Otherwise we get +# occasional spurious failures where server_id=2 is missing from SHOW SLAVE +# HOSTS, when that slave is much slower to register due to thread scheduling. +let $condition= ='2'; +source include/wait_show_condition.inc; --replace_column 3 'SLAVE_PORT' --replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT SHOW SLAVE HOSTS; diff --git a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test index ae59008c3ee..1e66b76abc8 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_statement.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test index 995878424f4..8256d068ade 100644 --- a/mysql-test/suite/storage_engine/trx/xa_recovery.test +++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test @@ -56,10 +56,14 @@ XA PREPARE 'xa2'; --connection default --enable_reconnect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart +wait EOF --shutdown_server 0 --source include/wait_until_disconnected.inc + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF --source include/wait_until_connected_again.inc XA RECOVER; XA ROLLBACK 'xa1'; diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_func.result b/mysql-test/suite/sys_vars/r/character_set_connection_func.result index 6fc33a4f369..7f3c4e42ce6 100644 --- a/mysql-test/suite/sys_vars/r/character_set_connection_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_connection_func.result @@ -11,7 +11,7 @@ SELECT @@global.character_set_connection; utf8 SELECT @@session.character_set_connection; @@session.character_set_connection -utf8 +latin1 '#--------------------FN_DYNVARS_011_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/character_set_results_func.result b/mysql-test/suite/sys_vars/r/character_set_results_func.result index d92821fdfa6..14bad0f4eb4 100644 --- a/mysql-test/suite/sys_vars/r/character_set_results_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_results_func.result @@ -9,7 +9,7 @@ SELECT @@global.character_set_results; utf8 SELECT @@session.character_set_results; @@session.character_set_results -utf8 +latin1 '#--------------------FN_DYNVARS_012_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/collation_connection_func.result b/mysql-test/suite/sys_vars/r/collation_connection_func.result index 18f82dc60e1..b40efda517f 100644 --- a/mysql-test/suite/sys_vars/r/collation_connection_func.result +++ b/mysql-test/suite/sys_vars/r/collation_connection_func.result @@ -9,7 +9,7 @@ SELECT @@global.collation_connection; latin1_danish_ci SELECT @@session.collation_connection; @@session.collation_connection -latin1_danish_ci +latin1_swedish_ci '#--------------------FN_DYNVARS_015_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result index 1797845def2..bfd59cfd9cc 100644 --- a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result @@ -7,55 +7,55 @@ SET @@global.innodb_adaptive_flushing_lwm = 1; SET @@global.innodb_adaptive_flushing_lwm = DEFAULT; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -10 +10.000000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_adaptive_flushing_lwm = 1; ERROR HY000: Variable 'innodb_adaptive_flushing_lwm' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_adaptive_flushing_lwm; @@innodb_adaptive_flushing_lwm -10 +10.000000 SELECT local.innodb_adaptive_flushing_lwm; ERROR 42S02: Unknown table 'local' in field list SET global innodb_adaptive_flushing_lwm = 1; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_adaptive_flushing_lwm = 1; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 SET @@global.innodb_adaptive_flushing_lwm = 60; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -60 +60.000000 SET @@global.innodb_adaptive_flushing_lwm = 70; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_adaptive_flushing_lwm = -1; Warnings: Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '-1' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = 71; Warnings: Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '71' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_adaptive_flushing_lwm = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -65,32 +65,32 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_adaptive_flushing_lwm'; VARIABLE_VALUE -70 +70.000000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_adaptive_flushing_lwm = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 SET @@global.innodb_adaptive_flushing_lwm = ON; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_adaptive_flushing_lwm = TRUE; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 SET @@global.innodb_adaptive_flushing_lwm = FALSE; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = @global_start_value; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -10 +10.000000 diff --git a/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result b/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result index ebc934acf6e..f22d11e1b62 100644 --- a/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result @@ -45,27 +45,42 @@ set global innodb_io_capacity_max=1e1; ERROR 42000: Incorrect argument type to variable 'innodb_io_capacity_max' set global innodb_io_capacity_max="foo"; ERROR 42000: Incorrect argument type to variable 'innodb_io_capacity_max' -set global innodb_io_capacity_max=@start_innodb_capacity - 1; +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity_max=400; Warnings: -Warning 1210 innodb_io_capacity_max cannot be set lower than innodb_io_capacity. -Warning 1210 Setting innodb_io_capacity_max to 200 +Warning 1210 Setting innodb_io_capacity_max 400 lower than innodb_io_capacity 500. +Warning 1210 Setting innodb_io_capacity to 400 select @@global.innodb_io_capacity_max; @@global.innodb_io_capacity_max -200 +400 +select @@global.innodb_io_capacity; +@@global.innodb_io_capacity +400 select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; VARIABLE_NAME VARIABLE_VALUE -INNODB_IO_CAPACITY_MAX 200 -set global innodb_io_capacity_max=-7; +INNODB_IO_CAPACITY_MAX 400 +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_IO_CAPACITY 400 +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity=1400; Warnings: -Warning 1292 Truncated incorrect innodb_io_capacity_max value: '-7' -Warning 1210 innodb_io_capacity_max cannot be set lower than innodb_io_capacity. -Warning 1210 Setting innodb_io_capacity_max to 200 +Warning 1210 Setting innodb_io_capacity to 1400 higher than innodb_io_capacity_max 1000 +Warning 1210 Setting innodb_max_io_capacity to 2800 select @@global.innodb_io_capacity_max; @@global.innodb_io_capacity_max -200 +2800 +select @@global.innodb_io_capacity; +@@global.innodb_io_capacity +1400 select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; VARIABLE_NAME VARIABLE_VALUE -INNODB_IO_CAPACITY_MAX 200 +INNODB_IO_CAPACITY_MAX 2800 +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_IO_CAPACITY 1400 set global innodb_io_capacity=100; set global innodb_io_capacity_max=100; select @@global.innodb_io_capacity_max; diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result index eff72613102..d705624eb53 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result @@ -4,58 +4,64 @@ SELECT @global_start_value; 75 '#--------------------FN_DYNVARS_046_01------------------------#' SET @@global.innodb_max_dirty_pages_pct = 0; -SET @@global.innodb_max_dirty_pages_pct = DEFAULT; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' +SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_max_dirty_pages_pct = 1; ERROR HY000: Variable 'innodb_max_dirty_pages_pct' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_max_dirty_pages_pct; @@innodb_max_dirty_pages_pct -75 +75.000000 SELECT local.innodb_max_dirty_pages_pct; ERROR 42S02: Unknown table 'local' in field list SET global innodb_max_dirty_pages_pct = 0; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_max_dirty_pages_pct = 0; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = 1; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct = 99; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_max_dirty_pages_pct = -1; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '-1' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = 1001; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '1001' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_max_dirty_pages_pct = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -65,32 +71,34 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct'; VARIABLE_VALUE -99 +99.999000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_max_dirty_pages_pct = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 SET @@global.innodb_max_dirty_pages_pct = ON; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_max_dirty_pages_pct = TRUE; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct = FALSE; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result index 55de5adbc33..05aa3e5fd89 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result @@ -5,13 +5,13 @@ SET @@global.innodb_max_dirty_pages_pct = 80; 'connection con1' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -80 +80.000000 SET @@global.innodb_max_dirty_pages_pct = 70; 'connect (con2,localhost,root,,,,)' 'connection con2' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -70 +70.000000 'connection default' 'disconnect con2' 'disconnect con1' diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result index 82388cebc82..676ec103664 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result @@ -1,70 +1,70 @@ SET @pct_lwm_start_value = @@global.innodb_max_dirty_pages_pct_lwm; SELECT @pct_lwm_start_value; @pct_lwm_start_value -0 +0.001 SET @pct_start_value = @@global.innodb_max_dirty_pages_pct; SELECT @pct_start_value; @pct_start_value 75 '#--------------------FN_DYNVARS_046_01------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = 0; -SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.001000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_max_dirty_pages_pct_lwm = 1; ERROR HY000: Variable 'innodb_max_dirty_pages_pct_lwm' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_max_dirty_pages_pct_lwm; @@innodb_max_dirty_pages_pct_lwm -0 +0.001000 SELECT local.innodb_max_dirty_pages_pct_lwm; ERROR 42S02: Unknown table 'local' in field list SET global innodb_max_dirty_pages_pct_lwm = 0; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = 0; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = -1; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '-1' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value + 1; Warnings: Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct. -Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75 +Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = 100; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '100' Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct. -Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75 +Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_max_dirty_pages_pct_lwm = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -74,36 +74,36 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct_lwm'; VARIABLE_VALUE -75 +75.000000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = ON; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = TRUE; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = FALSE; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct = @pct_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.001000 diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result new file mode 100644 index 00000000000..fa0861d7930 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result @@ -0,0 +1,56 @@ +SET @start_global_value = @@global.innodb_stats_modified_counter; +SELECT @start_global_value; +@start_global_value +0 +Valid values are one or above +select @@global.innodb_stats_modified_counter >=1; +@@global.innodb_stats_modified_counter >=1 +0 +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 +select @@session.innodb_stats_modified_counter; +ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable +show global variables like 'innodb_stats_modified_counter'; +Variable_name Value +innodb_stats_modified_counter 0 +show session variables like 'innodb_stats_modified_counter'; +Variable_name Value +innodb_stats_modified_counter 0 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +set global innodb_stats_modified_counter=10; +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +10 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 10 +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 10 +set session innodb_stats_modified_counter=1; +ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_stats_modified_counter=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter="foo"; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter=-7; +Warnings: +Warning 1292 Truncated incorrect innodb_stats_modified_counter value: '-7' +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +SET @@global.innodb_stats_modified_counter = @start_global_value; +SELECT @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result new file mode 100644 index 00000000000..00ee2877e58 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result @@ -0,0 +1,92 @@ +SET @start_global_value = @@global.innodb_stats_traditional; +SELECT @start_global_value; +@start_global_value +1 +Valid values are 'ON' and 'OFF' +select @@global.innodb_stats_traditional in (0, 1); +@@global.innodb_stats_traditional in (0, 1) +1 +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select @@session.innodb_stats_traditional; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable +show global variables like 'innodb_stats_traditional'; +Variable_name Value +innodb_stats_traditional ON +show session variables like 'innodb_stats_traditional'; +Variable_name Value +innodb_stats_traditional ON +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional='OFF'; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +0 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +set @@global.innodb_stats_traditional=1; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional=0; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +0 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +set @@global.innodb_stats_traditional='ON'; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set session innodb_stats_traditional='OFF'; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_stats_traditional='ON'; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_stats_traditional=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional' +set global innodb_stats_traditional=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional' +set global innodb_stats_traditional=2; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '2' +set global innodb_stats_traditional=-3; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '-3' +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional='AUTO'; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of 'AUTO' +SET @@global.innodb_stats_traditional = @start_global_value; +SELECT @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 diff --git a/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test index 125ceaa1c30..cedc6c0c45e 100644 --- a/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test @@ -25,7 +25,7 @@ select * from information_schema.global_variables where variable_name='innodb_io select * from information_schema.session_variables where variable_name='innodb_io_capacity_max'; # -# show that it's writable. Allowed value cannot be lower than innodb_io_capacity +# show that it's writable. # set global innodb_io_capacity_max=@start_innodb_capacity + 1; select @@global.innodb_io_capacity_max; @@ -45,15 +45,26 @@ set global innodb_io_capacity_max=1e1; set global innodb_io_capacity_max="foo"; # -# can't set it below innodb_io_capacity +# Setting io_capacity_max lower than io_capacity affects also io_capacity # -set global innodb_io_capacity_max=@start_innodb_capacity - 1; +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity_max=400; select @@global.innodb_io_capacity_max; +select @@global.innodb_io_capacity; select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; -set global innodb_io_capacity_max=-7; +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; + +# +# Setting io_capacity higher than io_capacity_max affects also io_capacity_max +# +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity=1400; select @@global.innodb_io_capacity_max; +select @@global.innodb_io_capacity; select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; - +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; # # min/max values # diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test index 7e70ed11351..5b4eaa41598 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test @@ -44,7 +44,7 @@ SELECT @global_start_value; ######################################################################## SET @@global.innodb_max_dirty_pages_pct = 0; -SET @@global.innodb_max_dirty_pages_pct = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; --echo '#---------------------FN_DYNVARS_046_02-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test index 7a6da2e6a08..d81b6cc725b 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test @@ -47,7 +47,7 @@ SELECT @pct_start_value; ######################################################################## SET @@global.innodb_max_dirty_pages_pct_lwm = 0; -SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; --echo '#---------------------FN_DYNVARS_046_02-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test new file mode 100644 index 00000000000..98fc804906b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test @@ -0,0 +1,47 @@ +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_stats_modified_counter; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are one or above +select @@global.innodb_stats_modified_counter >=1; +select @@global.innodb_stats_modified_counter; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_stats_modified_counter; +show global variables like 'innodb_stats_modified_counter'; +show session variables like 'innodb_stats_modified_counter'; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; + +# +# show that it's writable +# +set global innodb_stats_modified_counter=10; +select @@global.innodb_stats_modified_counter; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +--error ER_GLOBAL_VARIABLE +set session innodb_stats_modified_counter=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter="foo"; + +set global innodb_stats_modified_counter=-7; +select @@global.innodb_stats_modified_counter; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; + +# +# cleanup +# +SET @@global.innodb_stats_modified_counter = @start_global_value; +SELECT @@global.innodb_stats_modified_counter; diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test new file mode 100644 index 00000000000..d0872616114 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test @@ -0,0 +1,65 @@ +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_stats_traditional; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are 'ON' and 'OFF' +select @@global.innodb_stats_traditional in (0, 1); +select @@global.innodb_stats_traditional; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_stats_traditional; +show global variables like 'innodb_stats_traditional'; +show session variables like 'innodb_stats_traditional'; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; + +# +# show that it's writable +# +set global innodb_stats_traditional='OFF'; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set @@global.innodb_stats_traditional=1; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set global innodb_stats_traditional=0; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set @@global.innodb_stats_traditional='ON'; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +--error ER_GLOBAL_VARIABLE +set session innodb_stats_traditional='OFF'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_stats_traditional='ON'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_traditional=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_traditional=1e1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional=2; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional=-3; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional='AUTO'; + +# +# Cleanup +# + +SET @@global.innodb_stats_traditional = @start_global_value; +SELECT @@global.innodb_stats_traditional; diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result new file mode 100644 index 00000000000..06627fccf8b --- /dev/null +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -0,0 +1,67 @@ +set lc_time_names = 'es_MX'; +set time_zone='+10:00'; +set div_precision_increment=20; +create table t1 (a int, b int, v decimal(20,19) as (a/3)); +create table t2 (a int, b int, v int as (a+@a)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t3 (a int, b int, v int as (a+@@error_count)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t4 (a int, b int, v int as (@a:=a)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t5 (a int, b int, v varchar(100) as (monthname(a))); +create table t6 (a int, b int, v varchar(100) as (dayname(a))); +create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b'))); +create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); +insert t1 (a,b) values (1,2); +insert t5 (a,b) values (20141010,2); +insert t6 (a,b) values (20141010,2); +insert t7 (a,b) values (20141010,2); +insert t8 (a,b) values (1234567890,2); +select * from t1; +a b v +1 2 0.3333333333333333333 +select * from t5; +a b v +20141010 2 octubre +select * from t6; +a b v +20141010 2 viernes +select * from t7; +a b v +20141010 2 viernes vie octubre oct +select * from t8; +a b v +1234567890 2 2009-02-14 09:31:30 +set time_zone='+1:00'; +select * from t1; +a b v +1 2 0.3333333333333333333 +select * from t5; +a b v +20141010 2 octubre +select * from t6; +a b v +20141010 2 viernes +select * from t7; +a b v +20141010 2 viernes vie octubre oct +select * from t8; +a b v +1234567890 2 2009-02-14 09:31:30 +flush tables; +select * from t1; +a b v +1 2 0.3333333330000000000 +select * from t5; +a b v +20141010 2 October +select * from t6; +a b v +20141010 2 Friday +select * from t7; +a b v +20141010 2 Friday Fri October Oct +select * from t8; +a b v +1234567890 2 2009-02-14 00:31:30 +drop table t1, t5, t6, t7, t8; diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test new file mode 100644 index 00000000000..70b9dea69fd --- /dev/null +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -0,0 +1,58 @@ +# +# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor +# + +# the following functions must not be supported in virtual columns. +# but for compatibility reasons it won't be done in a GA version, +# we'll only fix most critical issues (inconsistent results, crashes) + +connect (con1, localhost, root); + +set lc_time_names = 'es_MX'; +set time_zone='+10:00'; +set div_precision_increment=20; + +create table t1 (a int, b int, v decimal(20,19) as (a/3)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t2 (a int, b int, v int as (a+@a)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t3 (a int, b int, v int as (a+@@error_count)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t4 (a int, b int, v int as (@a:=a)); +create table t5 (a int, b int, v varchar(100) as (monthname(a))); +create table t6 (a int, b int, v varchar(100) as (dayname(a))); +create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b'))); +create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); + +insert t1 (a,b) values (1,2); +insert t5 (a,b) values (20141010,2); +insert t6 (a,b) values (20141010,2); +insert t7 (a,b) values (20141010,2); +insert t8 (a,b) values (1234567890,2); + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +disconnect con1; +connection default; +set time_zone='+1:00'; + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +flush tables; + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +drop table t1, t5, t6, t7, t8; + diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt index 1b8937b91f3..5a4902eeafd 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.opt +++ b/mysql-test/suite/wsrep/t/binlog_format.opt @@ -1 +1 @@ ---binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' --wsrep-on=1 --log-bin +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' --wsrep-on=1 --log-bin diff --git a/mysql-test/suite/wsrep/t/foreign_key.opt b/mysql-test/suite/wsrep/t/foreign_key.opt index 9d6f257aca7..ebc85eae9f0 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.opt +++ b/mysql-test/suite/wsrep/t/foreign_key.opt @@ -1 +1 @@ ---binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' diff --git a/mysql-test/suite/wsrep/t/foreign_key.test b/mysql-test/suite/wsrep/t/foreign_key.test index 87eb4a88115..71f6076a1d7 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.test +++ b/mysql-test/suite/wsrep/t/foreign_key.test @@ -1,4 +1,5 @@ --source include/have_wsrep_enabled.inc +--source include/have_binlog_format_row.inc --source include/have_innodb.inc USE test; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 8bb7339ce83..4d57a5a110a 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2022,9 +2022,40 @@ select * from t1; unlock tables; drop table t1,t2; +--echo # +--echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't +--echo # play nice with CREATE/ALTER TABLE +--echo # +create table t1 ( + color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent, + cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent, + item_name varchar(32) primary key, -- A common attribute for all items + i int, + dynamic_cols blob -- Dynamic columns will be stored here +); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES + ('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES + ('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2); + +select item_name, color, cl from t1; +show create table t1; + +drop table t1; + +create table t1 ( + n int, + c char(32) as (convert(cast(n as char), char)) persistent +); +insert into t1(n) values (1),(2),(3); + +select * from t1; +show create table t1; + +drop table t1; + # # MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS # --error ER_TABLE_MUST_HAVE_COLUMNS create table t1; - diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test new file mode 100644 index 00000000000..96a2666f69b --- /dev/null +++ b/mysql-test/t/ctype_cp932.test @@ -0,0 +1,29 @@ +-- source include/have_cp932.inc +--echo # +--echo # Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE +--echo # USED. +--echo # + +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET character_set_client= 'utf8'; +SET character_set_connection= 'utf8'; +SET character_set_results= 'utf8'; + +CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin); +INSERT INTO t1 VALUES('カカ'); +SELECT * FROM t1 WHERE a LIKE '%カ'; +SELECT * FROM t1 WHERE a LIKE '_カ'; +SELECT * FROM t1 WHERE a LIKE '%_カ'; + +ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin; +SELECT * FROM t1 WHERE a LIKE '%カ'; +SELECT * FROM t1 WHERE a LIKE '_カ'; +SELECT * FROM t1 WHERE a LIKE '%_カ'; +DROP TABLE t1; + +## Reset to initial values +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index b146dc63626..be8e044f2e4 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -1,5 +1,7 @@ -- source include/have_ucs2.inc +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); + # # MySQL Bug#15276: MySQL ignores collation-server # diff --git a/mysql-test/t/ctype_ucs2_query_cache.test b/mysql-test/t/ctype_ucs2_query_cache.test index 0ac09b2ba4b..acb39419751 100644 --- a/mysql-test/t/ctype_ucs2_query_cache.test +++ b/mysql-test/t/ctype_ucs2_query_cache.test @@ -1,6 +1,8 @@ -- source include/have_query_cache.inc -- source include/have_ucs2.inc +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); + --echo # --echo # Start of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index c92889da2dc..e4305ed9879 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -788,6 +788,14 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; # --echo # +--echo # MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS.. +--echo # +--error ER_INVALID_CHARACTER_STRING +DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +--error ER_INVALID_CHARACTER_STRING +DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf16_def.test b/mysql-test/t/ctype_utf16_def.test index d8ef4a4278b..fad61b057c3 100644 --- a/mysql-test/t/ctype_utf16_def.test +++ b/mysql-test/t/ctype_utf16_def.test @@ -1,4 +1,5 @@ --source include/have_utf16.inc +call mtr.add_suppression("Cannot use utf16 as character_set_client"); # # Bug #32391 Character sets: crash with --character-set-server diff --git a/mysql-test/t/derived_opt.test b/mysql-test/t/derived_opt.test index b01c479111b..7f19553e4e5 100644 --- a/mysql-test/t/derived_opt.test +++ b/mysql-test/t/derived_opt.test @@ -1,6 +1,7 @@ # Initialize --disable_warnings -drop table if exists t1,t2,t3; +drop table if exists t0,t1,t2,t3; +drop database if exists test1; --enable_warnings set @exit_optimizer_switch=@@optimizer_switch; @@ -272,5 +273,95 @@ limit 10; drop table t1, t2, t3, t4; +--echo # +--echo # MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled +--echo # +create database test1; +use test1; + +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; + +CREATE TABLE t0 ( + f1 bigint(20) DEFAULT NULL, + f2 char(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two'); + +CREATE TABLE t1 ( + f1 decimal(64,30) DEFAULT NULL, + f2 varchar(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES +(NULL,'numeric column is NULL'), +(0.000000000000000000000000000000,NULL), +(5.000000000000000000000000000000,'five'), +(1.000000000000000000000000000000,'one'), +(3.000000000000000000000000000000,'three'); + +CREATE TABLE t2 ( + f1 double DEFAULT NULL, + f2 varbinary(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three'); + +create VIEW v0 AS select f1,f2 from t1 ; + +let $cnt= 27; +while ($cnt) +{ +# i runs from 1 to 27 + let $i= `select 28 - $cnt`; + let $prev=`select $i - 1`; + +# rem = i mod 3 + let $rem= `select MOD($i, 3)`; +# view uses $i, $prev and $rem: + eval create VIEW v$i AS select tab1_v$i.f1,tab1_v$i.f2 from t$rem tab1_v$i join v$prev tab2 on tab1_v$i.f1 = tab2.f1 and tab1_v$i.f2 = tab2.f2; + dec $cnt; +} + +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +--echo # This used to hang forever: +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; + +use test; +drop database test1; +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; + + +--echo # +--echo # MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost() +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 (a int, b int, c text); +insert into t2 +select + A.a + B.a* 10, + A.a + B.a* 10, + 'blob-data' +from t1 A, t1 B; + +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=6; +set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on'; +explain +select * from + t1 join + (select * from t2 order by a limit 1000) as D1 +where + D1.a= t1.a; + +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +drop table t1, t2; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index c5d442ebe49..65a94dcb49e 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -839,5 +839,31 @@ select group_concat(cast(column_json(dyn) as char)) from t1; drop table t1; --echo # +--echo # MDEV-7116: Dynamic column hangs/segfaults +--echo # +create table t1 ( + impressions mediumblob +); + +insert into t1 values (""); + +update t1 +set impressions = column_add(impressions, + 'total', 12, + '2014-10-28 16:00:00', 3, + '2014-10-30 15:00:00', 3, + '2014-11-04 09:00:00', 6 + ); +update t1 +set impressions = column_add(impressions, + 'total', "a12", + '2014-10-28 16:00:00', "a3", + '2014-10-30 15:00:00', "a3", + '2014-11-04 09:00:00', "a6" + ); + +drop table t1; + +--echo # --echo # end of 10.0 tests --echo # diff --git a/mysql-test/t/ext_key_noPK_6794.test b/mysql-test/t/ext_key_noPK_6794.test new file mode 100644 index 00000000000..fc8a2724c22 --- /dev/null +++ b/mysql-test/t/ext_key_noPK_6794.test @@ -0,0 +1,15 @@ +# +# MDEV-6794 XtraDB no longer using UNIQUE as clustered index when PK missing +# + +--source include/have_innodb.inc + +create table t1 (c1 int not null, c2 int, unique index(c1), index (c2)) engine=innodb; +insert into t1 (c1, c2) select 1, round(rand()*100); +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +select count(*) from t1; +--query_vertical explain select * from t1 where c2 = 1 order by c1 +drop table t1; + diff --git a/mysql-test/t/failed_auth_unixsocket.test b/mysql-test/t/failed_auth_unixsocket.test index ba31cf6a59f..f7345f44698 100644 --- a/mysql-test/t/failed_auth_unixsocket.test +++ b/mysql-test/t/failed_auth_unixsocket.test @@ -16,11 +16,17 @@ change_user $USER; eval install plugin unix_socket soname '$AUTH_SOCKET_SO'; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $USER USER +# Make sure that the replace works, even if $USER is 'user' or something else +# that matches other parts of the error message. +--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); +--let $replace=Access denied for user '$USER' +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $replace "Access denied for user 'USER'" +--disable_query_log --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR connect (fail,localhost,$USER); +--enable_query_log ---replace_result $USER USER +--replace_result $replace "Access denied for user 'USER'" --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR change_user $USER; diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index eaed0c88fe1..fc3d2697426 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -136,3 +136,12 @@ DROP TABLE t1; --echo # --echo # End of 5.3 tests --echo # + +# +# MDEV-4513 Valgrind warnings (Conditional jump or move depends on uninitialised value) in inflate on UNCOMPRESS +# +SELECT UNCOMPRESS(CAST(0 AS BINARY(5))); + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test index 7e8df840239..6710f5cf096 100644 --- a/mysql-test/t/func_regexp_pcre.test +++ b/mysql-test/t/func_regexp_pcre.test @@ -397,3 +397,8 @@ SET default_regex_flags='UNGREEDY'; SELECT REGEXP_SUBSTR('abc','.+'); SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2'); SET default_regex_flags=DEFAULT; + +--echo # +--echo # MDEV-6965 non-captured group \2 in regexp_replace +--echo # +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 6a99b975e81..d3703de26c5 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -180,3 +180,17 @@ select * from t1 where not (a+0); explain extended select * from t1 where not (a+0); drop table t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +--echo # +SELECT NOT NOT strcmp('a','b'); +EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/function_defaults.test b/mysql-test/t/function_defaults.test index dd29b4609cb..f8b23d0eda8 100644 --- a/mysql-test/t/function_defaults.test +++ b/mysql-test/t/function_defaults.test @@ -2,8 +2,6 @@ --echo # Test of function defaults for any server, including embedded. --echo # ---source include/have_innodb.inc - --echo # --echo # Function defaults run 1. No microsecond precision. --echo # diff --git a/mysql-test/t/function_defaults_innodb.test b/mysql-test/t/function_defaults_innodb.test new file mode 100644 index 00000000000..de5a6d34b73 --- /dev/null +++ b/mysql-test/t/function_defaults_innodb.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test of function defaults for any server, including embedded. +--echo # + +--source include/have_innodb.inc +set default_storage_engine=innodb; + +--echo # +--echo # Function defaults run 1. No microsecond precision. +--echo # +let $current_timestamp=CURRENT_TIMESTAMP; +let $now=NOW(); +let $timestamp=TIMESTAMP; +let $datetime=DATETIME; +source 'include/function_defaults.inc'; + +--echo # +--echo # Function defaults run 2. Six digits scale on seconds precision. +--echo # +let $current_timestamp=CURRENT_TIMESTAMP(6); +let $now=NOW(6); +let $timestamp=TIMESTAMP(6); +let $datetime=DATETIME(6); +source 'include/function_defaults.inc'; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index d20e4c1711e..2625ec5d3c9 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1413,6 +1413,11 @@ insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); select equals(`a`,convert(`a` using utf8)) from `t1`; drop table t1; +--echo # +--echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +--echo # +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); + --echo End of 5.3 tests --echo # diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 5d59acf9320..35bd447e9ea 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1650,6 +1650,20 @@ SET sql_mode='ONLY_FULL_GROUP_BY'; SELECT 1 AS test UNION SELECT 2 AS test ORDER BY test IS NULL ASC; SET sql_mode=''; +--echo # +--echo # MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key +--echo # +CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (6,'b'); + +CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p'); + +SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 ) +WHERE t1a.c1 = c2 GROUP BY i2; + +DROP TABLE t1,t2; + # # End of MariaDB 5.5 tests # diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index c809401bbf8..8c9be0ca8db 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -704,6 +704,7 @@ explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; create table t4 as select distinct a1, a2, b, c from t1; alter table t4 add unique index idxt4 (a1, a2, b, c); +--echo # This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: explain select a1, a2, b, min(c) from t4 group by a1, a2, b; select a1, a2, b, min(c) from t4 group by a1, a2, b; @@ -1488,3 +1489,38 @@ SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; drop table t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +--echo # +CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,' 2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,' 2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,' 2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,' 2001-01-04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +DROP TABLE t1; + + +--echo # +--echo # End of 10.0 tests +--echo # + diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 09a3f590a1f..6f4c81a8bb5 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -496,7 +496,7 @@ drop table t_crashme; # select table_schema,table_name, column_name from information_schema.columns -where data_type = 'longtext'; +where data_type = 'longtext' and table_schema != 'performance_schema'; select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%'; @@ -1298,12 +1298,16 @@ info='select * from information_schema.tables where 1=sleep(100000)'; disable_query_log; eval kill $ID; enable_query_log; -disconnect conn1; let $wait_timeout= 10; let $wait_condition=select count(*)=0 from information_schema.processlist where state='User sleep' and info='select * from information_schema.tables where 1=sleep(100000)'; --source include/wait_condition.inc +connection conn1; +--error 2013,ER_CONNECTION_KILLED +reap; +connection default; +disconnect conn1; connect (conn1, localhost, root,,); connection conn1; @@ -1318,12 +1322,16 @@ info='select * from information_schema.columns where 1=sleep(100000)'; disable_query_log; eval kill $ID; enable_query_log; -disconnect conn1; let $wait_timeout= 10; let $wait_condition=select count(*)=0 from information_schema.processlist where state='User sleep' and info='select * from information_schema.columns where 1=sleep(100000)'; --source include/wait_condition.inc +connection conn1; +--error 2013,ER_CONNECTION_KILLED +reap; +connection default; +disconnect conn1; # diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test index c7955a38e1b..9b2a3e68bcd 100644 --- a/mysql-test/t/information_schema_all_engines.test +++ b/mysql-test/t/information_schema_all_engines.test @@ -4,6 +4,7 @@ --source include/not_embedded.inc --source include/have_xtradb.inc +--source include/have_perfschema.inc --source include/not_staging.inc use INFORMATION_SCHEMA; diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test index bee8d5796ce..cb79c238f2b 100644 --- a/mysql-test/t/innodb_mrr_cpk.test +++ b/mysql-test/t/innodb_mrr_cpk.test @@ -134,12 +134,40 @@ set optimizer_switch='index_condition_pushdown=on'; drop table t1,t2; -set @@join_cache_level= @save_join_cache_level; -set storage_engine=@save_storage_engine; -set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; --echo # +--echo # MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read() +--echo # +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + pk varchar(32) character set utf8 primary key, + kp1 char(32) not null, + col1 varchar(32), + key (kp1) +) engine=innodb; + +insert into t1 +select + concat('pk-', 1000 +A.a), + concat('kp1-', 1000 +A.a), + concat('val-', 1000 +A.a) +from test.t0 A ; + +create table t2 as select kp1 as a from t1; + +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +explain +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; + +drop table t0,t1,t2; + +--echo # +--echo # --echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions --echo # @@ -190,5 +218,12 @@ set join_cache_level=3; explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id; set join_cache_level= @tmp_mdev5037; - drop table t0,t1,t2; + +--echo # +--echo # This must be at the end: +--echo # + +set @@join_cache_level= @save_join_cache_level; +set storage_engine=@save_storage_engine; +set optimizer_switch=@innodb_mrr_cpk_tmp; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 7a70c413e8d..19c5f64de78 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -1777,4 +1777,28 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3 DROP TABLE t1,t2,t3; +--echo # +--echo # Bug mdev-6705: wrong on expression after constant row substitution +--echo # that triggers a simplification of WHERE condition +--echo # + +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); + +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); + +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); + +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a + WHERE b IN (1,2,3) OR b = d; + +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a + WHERE b IN (1,2,3) OR b = d; + +DROP TABLE t1,t2,t3; + + SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test new file mode 100644 index 00000000000..e4bc6a841dd --- /dev/null +++ b/mysql-test/t/log_errchk.test @@ -0,0 +1,64 @@ +# +--source include/not_windows.inc +--source include/not_embedded.inc + +# +# Bug#14757009 : WHEN THE GENERAL_LOG IS A SOCKET AND THE READER GOES AWAY, +# MYSQL QUITS WORKING. +# +call mtr.add_suppression("Could not use"); + +--let $gen_log_file= $MYSQLTEST_VARDIR/tmp/general_log.fifo +--let $slow_query_log_file= $MYSQLTEST_VARDIR/tmp/slow_log.fifo +--let GREP_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err + +--exec mkfifo $gen_log_file +--exec mkfifo $slow_query_log_file + +--echo # Case 1: Setting fife file to general_log_file and slow_query_log_file +--echo # system variable. +# Only regular files can be set to general log. Setting fifo file to general log +# reports an error. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--error ER_WRONG_VALUE_FOR_VAR +--eval SET GLOBAL general_log_file="$gen_log_file"; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--error ER_WRONG_VALUE_FOR_VAR +--eval SET GLOBAL slow_query_log_file="$slow_query_log_file"; + +--echo # Case 2: Starting server with fifo file as general log file +--echo # and slow query log file. +# Restart server with fifo file as general log file. +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--shutdown_server 60 +--source include/wait_until_disconnected.inc +--enable_reconnect +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/wait_until_connected_again.inc + +# With fix error should be reported in the error log file if file is not a +# regular file. +--perl + my $file= $ENV{'GREP_FILE'}; + my $pattern= "Turning logging off for the whole duration"; + open(FILE, "$file") or die("Unable to open $file: $!\n"); + my $count = 0; + while (<FILE>) { + if ($_ =~ m/$pattern/) { + $count++; + break; + } + } + if ($count >= 2){ + print "Setting fifo file as general log file and slow query log failed.\n"; + } else { + print "test failed.\n"; + } + close(FILE); +EOF + +# Cleanup +--remove_file $gen_log_file +--remove_file $slow_query_log_file diff --git a/mysql-test/t/mysql_upgrade-6984.opt b/mysql-test/t/mysql_upgrade-6984.opt new file mode 100644 index 00000000000..97669d95260 --- /dev/null +++ b/mysql-test/t/mysql_upgrade-6984.opt @@ -0,0 +1 @@ +--skip-grant-tables --group-concat-max-len=1023 diff --git a/mysql-test/t/mysql_upgrade-6984.test b/mysql-test/t/mysql_upgrade-6984.test new file mode 100644 index 00000000000..6f10d3f33e9 --- /dev/null +++ b/mysql-test/t/mysql_upgrade-6984.test @@ -0,0 +1,22 @@ +# +# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10 +# +--source include/not_embedded.inc + +# +# When 'root' account is password protected and MYSQL_UPGRADE doesn't +# know the password (meaning, MYSQL_UPGRADE is run automatically +# on upgrade), MYSQLD has to be started with --skip-grant-tables. +# +# In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES +# + +update mysql.user set password=password("foo") where user='root'; + +--exec $MYSQL_UPGRADE + +connect(con1,localhost,root,foo,,,); + +update mysql.user set password='' where user='root'; +flush privileges; + diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 81951a9ce68..40f66946822 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -295,3 +295,16 @@ CREATE TABLE t2 (d DATE) ENGINE=MyISAM; SELECT * FROM t1,t2 WHERE 1 IS NOT NULL AND t1.b IS NULL; DROP TABLE t1,t2; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +--echo # +SELECT NOT NOT NULLIF(2,3); + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test index 483549886db..c2a43f91ecb 100644 --- a/mysql-test/t/old-mode.test +++ b/mysql-test/t/old-mode.test @@ -64,3 +64,12 @@ INSERT INTO t1 VALUES (NULL, '00:20:12'); INSERT INTO t1 VALUES (NULL, '-00:20:12'); SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast +--echo # +SET @@old_mode=zero_date_time_cast; +CREATE TABLE t1 (a TIME,b TIME(1)); +INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); +SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 0c8f81e4712..bee0e2cc720 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -20,13 +20,16 @@ grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; -connect (con1,localhost,ssl_user1,,,,,SSL); -connect (con2,localhost,ssl_user2,,,,,SSL); -connect (con3,localhost,ssl_user3,,,,,SSL); -connect (con4,localhost,ssl_user4,,,,,SSL); +connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (con5,localhost,ssl_user5,,,,,SSL); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=RC4-SHA); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); connection con1; # Check ssl turned on @@ -129,6 +132,7 @@ drop table t1; # verification of servers certificate by setting both ca certificate # and ca path to NULL # +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 --echo End of 5.0 tests @@ -255,6 +259,7 @@ select 'is still running; no cipher request crashed the server' as result from d GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect(con1,localhost,bug42158,,,,,SSL); +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; disconnect con1; connection default; diff --git a/mysql-test/t/openssl_6975.combinations b/mysql-test/t/openssl_6975.combinations new file mode 100644 index 00000000000..17517b7d552 --- /dev/null +++ b/mysql-test/t/openssl_6975.combinations @@ -0,0 +1,6 @@ +[tlsv12] +loose-ssl-cipher=TLSv1.2 + +[tlsv10] +loose-ssl-cipher=SSLv3 + diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test new file mode 100644 index 00000000000..bc6397c5c28 --- /dev/null +++ b/mysql-test/t/openssl_6975.test @@ -0,0 +1,38 @@ +# +# MDEV-6975 Implement TLS protocol +# +# test SSLv3 and TLSv1.2 ciphers when OpenSSL is restricted to SSLv3 or TLSv1.2 +# +source include/have_ssl_communication.inc; + +# this is OpenSSL test. + +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; + +let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1; + +disable_abort_on_error; +echo TLS1.2 ciphers: user is ok with any cipher; +exec $mysql --ssl-cipher=AES128-SHA256; +exec $mysql --ssl-cipher=TLSv1.2; +echo TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256; +exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2; +echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2; + +echo SSLv3 ciphers: user is ok with any cipher; +exec $mysql --ssl-cipher=RC4-SHA; +exec $mysql --ssl-cipher=SSLv3; +echo SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3; +echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=RC4-SHA; +exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3; + +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; + diff --git a/mysql-test/t/order_by_zerolength-4285.test b/mysql-test/t/order_by_zerolength-4285.test new file mode 100644 index 00000000000..2fb58edd36d --- /dev/null +++ b/mysql-test/t/order_by_zerolength-4285.test @@ -0,0 +1,8 @@ +# +# MDEV-4285 Server crashes in ptr_compare on NOW and CAST in ORDER BY +# +create table t1 (pk int primary key); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +select * from t1 order by now(), cast(pk as char(0)); +drop table t1; + diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index c5b37615a92..5396b9e3543 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -2017,6 +2017,17 @@ DROP TABLE t1; --echo End of 5.1 tests +# +# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor +# +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1)); + +--error ER_PARSE_ERROR +create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1)); + +--echo End of 5.5 tests + CREATE TABLE t1 (a INT) PARTITION BY LIST (a) SUBPARTITION BY HASH (a) SUBPARTITIONS 2 diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test index 7a2b33699d5..9c555c0f9fb 100644 --- a/mysql-test/t/processlist.test +++ b/mysql-test/t/processlist.test @@ -4,19 +4,22 @@ source include/have_debug_sync.inc; +let $tid= `SELECT CONNECTION_ID()`; SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; send SELECT 1; connect (con1,localhost,root,,); SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed'; -send SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL; +--replace_result $tid TID +send_eval SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":$tid:"; connection default; reap; SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; connection con1; +--replace_result $tid TID reap; connection default; @@ -25,9 +28,23 @@ connection default; # connection con1; +# Trigger a signal once the thread has gone from "Query" to "Sleep" command +# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC, +# and once for the intended time, at the end of SELECT SLEEP(). +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2'; +connection default; +# Wait for and clear the first signal set during SET DEBUG_SYNC. +SET DEBUG_SYNC= 'now WAIT_FOR query_done'; +SET DEBUG_SYNC= 'now SIGNAL nosignal'; +connection con1; select sleep(5); #run a query that will take some time connection default; +# Need to ensure that the previous query has really completed. Otherwise, +# the select could see the previous query still in "Query" stage in the +# processlist. +SET DEBUG_SYNC = 'now WAIT_FOR query_done'; + # verify that the time in COM_SLEEP doesn't include the query run time select command, time < 5 from information_schema.processlist where id != connection_id(); diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 8cb2620550e..77ee5f49bef 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -889,4 +889,58 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit DROP TABLE t1,t2; +--echo # +--echo # Bug mdev-6325: wrong selectivity of a column with ref access +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; + +set use_stat_tables='preferably'; +set histogram_size=100; + +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +analyze table t2 persistent for all; + +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; + +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +drop table t0,t1,t2; + +--echo # +--echo # Bug mdev-6843: col IS NULL in where condition when col is always NULL +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; + +set use_stat_tables='preferably'; +set histogram_size=100; + +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; + +explain extended +select * from t2 a straight_join t2 b where a.a is null; + +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +drop table t0,t1,t2; + set use_stat_tables=@save_use_stat_tables; + diff --git a/mysql-test/t/selectivity_innodb.test b/mysql-test/t/selectivity_innodb.test index 6b67e2d0529..5674cb5c006 100644 --- a/mysql-test/t/selectivity_innodb.test +++ b/mysql-test/t/selectivity_innodb.test @@ -8,5 +8,81 @@ set optimizer_switch='extended_keys=on'; --source selectivity.test set optimizer_switch=@save_optimizer_switch_for_selectivity_test; +set @tmp_ust= @@use_stat_tables; +set @tmp_oucs= @@optimizer_use_condition_selectivity; + +--echo # +--echo # MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1 +--echo # +set @tmp_mdev6808= @@optimizer_use_condition_selectivity; +SET optimizer_use_condition_selectivity = 2; +CREATE TABLE t1 ( + event_id int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (event_id) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + repost_id int(11) unsigned NOT NULL AUTO_INCREMENT, + subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, + subject_id int(11) unsigned NOT NULL, + object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, + object_id int(11) unsigned NOT NULL, + is_private int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (repost_id), + UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private), + KEY SUBJECT (subject_type,subject_id), + KEY OBJECT (object_type,object_id) +) ENGINE=InnoDB; + +SELECT + * +FROM + t2, t1 +WHERE + t2.object_type = 'event' AND + t2.object_id = t1.event_id AND + t2.is_private = 0 AND + t2.subject_id = 127994 AND + t2.subject_type in ('user') +; +DROP TABLE t1, t2; +set optimizer_use_condition_selectivity=@tmp_mdev6808; + +--echo # +--echo # MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ... +--echo # +SET use_stat_tables = PREFERABLY; +SET optimizer_use_condition_selectivity = 3; + +CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English'); + +CREATE TABLE t2 (i INT) ENGINE=InnoDB; + +SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN ( + SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b ) +); +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6738: use_stat_table + histograms crashing optimizer +--echo # + +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; + +--echo # Need innodb because there is a special kind of field_bit for non-myisam tables +create table t1(col1 int, col2 bit(1) DEFAULT NULL) engine=innodb; + +select * from t1 where col2 != true; + +drop table t1; + +--echo # +--echo # End of 10.0 tests +--echo # + +set use_stat_tables= @tmp_ust; +set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/show_bad_definer-5553.test b/mysql-test/t/show_bad_definer-5553.test new file mode 100644 index 00000000000..c5b6f1b3d10 --- /dev/null +++ b/mysql-test/t/show_bad_definer-5553.test @@ -0,0 +1,12 @@ +--source include/not_embedded.inc +# +# MDEV-5553 A view or procedure with a non existing definer can block "SHOW TABLE STATUS" with an unclear error message +# + +create database mysqltest1; # all-open privileges on test db desroy the test +use mysqltest1; +create table t1(id int primary key); +create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id; +--replace_column 8 # 12 # 13 # +show table status; +drop database mysqltest1; diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index eb4da99588c..988a9d6c056 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -11,6 +11,7 @@ connect (ssl_con,localhost,root,,,,,SSL); # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check ssl expiration @@ -21,6 +22,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; -- source include/common-tests.inc # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; connection default; diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt index 8d103df3a95..531c0abc9f1 100644 --- a/mysql-test/t/ssl_8k_key-master.opt +++ b/mysql-test/t/ssl_8k_key-master.opt @@ -1 +1,3 @@ ---ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem +--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem +--loose-ssl-cipher=DHE-RSA-AES256-SHA diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test index 8e0dea53fe7..5e45e3824a2 100644 --- a/mysql-test/t/ssl_compress.test +++ b/mysql-test/t/ssl_compress.test @@ -11,6 +11,7 @@ connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check compression turned on @@ -20,6 +21,7 @@ SHOW STATUS LIKE 'Compression'; -- source include/common-tests.inc # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check compression turned on diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 5b0b70631a5..9ce34c0b55b 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -236,3 +236,124 @@ SELECT AVG(f1) FROM t1; drop table t1; --echo End of 5.3 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/ENUM/VARCHAR columns +--echo # + +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 ENUM('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +--echo # +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +--echo # +CREATE TABLE t1 (id INT NOT NULL, a ENUM('04','03','02','01')) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'01'); +INSERT INTO t1 VALUES (1,'02'); +INSERT INTO t1 VALUES (1,'03'); +INSERT INTO t1 VALUES (1,'04'); +INSERT INTO t1 VALUES (2,'01'); +INSERT INTO t1 VALUES (2,'02'); +INSERT INTO t1 VALUES (2,'03'); +INSERT INTO t1 VALUES (2,'04'); +INSERT INTO t1 VALUES (3,'01'); +INSERT INTO t1 VALUES (3,'02'); +INSERT INTO t1 VALUES (3,'03'); +INSERT INTO t1 VALUES (3,'04'); +INSERT INTO t1 VALUES (4,'01'); +INSERT INTO t1 VALUES (4,'02'); +INSERT INTO t1 VALUES (4,'03'); +INSERT INTO t1 VALUES (4,'04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +--echo # Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +--echo # Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +DROP TABLE t1; + +--echo # +--echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +--echo # +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 ENUM('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +DROP TABLE t1,t2; + +CREATE TABLE t1 (a DECIMAL(10,1), b ENUM('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +ALTER TABLE t1 MODIFY a ENUM('1','2'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 96ce1bcbd9e..bb7a784553e 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -343,3 +343,45 @@ INSERT INTO t1 VALUES ('2.0.'); INSERT INTO t1 VALUES ('.'); SELECT * FROM t1 ORDER BY f; DROP TABLE t1; + + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +--echo # +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +--echo # t2 should NOT be elimitated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index bf7e3794a19..09149253c67 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1570,3 +1570,55 @@ SELECT d1 * d2 FROM t1; DROP TABLE t1; +# +# Test for Bug#18469276: MOD FOR SMALL DECIMALS FAILS +# +select 0.000000000000000000000000000000000000000000000000001 mod 1; + +# +# incorrect result +# +select 0.0000000001 mod 1; +select 0.01 mod 1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DECIMAL(30,1)); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +--echo # +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DECIMAL(30,10)); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +DROP TABLE t1,t2; + + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index a851d116743..8b9da6962d5 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -95,3 +95,93 @@ DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns +--echo # + +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 SET('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +--echo # +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +--echo # +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 SET('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +DROP TABLE t1,t2; + +CREATE TABLE t1 (a DECIMAL(10,1), b SET('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +ALTER TABLE t1 MODIFY a SET('1','2'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 4f23f7b1bb8..d36c6af65e8 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -250,9 +250,20 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); DROP TABLE t1; --echo # ---echo # Start of 10.0 tests +--echo # MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +--echo # +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests --echo # +--echo # +--echo # Start of 10.0 tests +--echo # --echo # --echo # MDEV-6102 Comparison between TIME and DATETIME does not use CURRENT_DATE diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index a9212183cb6..3a949c5c47a 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -15,3 +15,29 @@ select * from t1; drop table t1; # End of 4.1 tests + + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01'); +CREATE TABLE t2 (a INT UNSIGNED); +INSERT INTO t2 VALUES (19990101); +INSERT INTO t2 VALUES (990101); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 33b84266118..528d26d6f86 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -217,3 +217,29 @@ CREATE TABLE t1 (a CHAR(16)); INSERT INTO t1 VALUES ('5'), ('s'), (''); SELECT 5 = a FROM t1; DROP TABLE t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 VARCHAR(20)); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index a5d7dae606f..9204ddd22e5 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1330,3 +1330,23 @@ create table t1 (a int); insert t1 values (1),(2),(3),(1); explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1); drop table t1; + +--echo # +--echo # MDEV-6868:MariaDB server crash ( select with union and order by +--echo # with subquery ) +--echo # + +CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) ); + +INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' ); + +( + SELECT sample_name1 AS testname FROM t1 +) +UNION +( + SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id) +) +; + +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6029ad471f6..eb905b5c4df 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5364,6 +5364,21 @@ select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a; drop view v1; drop table t1,t2; +# +# MDEV-6785 Wrong result on 2nd execution of PS with aggregate function, FROM SQ or MERGE view +# + +create table t1 (i int not null); +insert into t1 values (1),(2); +create table t2 (j int not null); +insert into t2 values (11),(12); +create algorithm=merge view v3 as select t1.* from t2 left join t1 on (t2.j = t1.i); +prepare stmt from 'select count(v3.i) from t1, v3'; +execute stmt; +execute stmt; +drop table t1, t2; +drop view v3; + --echo # ----------------------------------------------------------------- --echo # -- End of 10.0 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index ca190104d79..5c54c4ff30c 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1269,3 +1269,16 @@ fun:__tls_get_addr } +{ + Mroonga: dlopen leaves some "still reachable" + Memcheck:Leak + fun:malloc + ... + fun:dl_open_worker + fun:_dl_catch_error + fun:_dl_open + fun:dlopen_doit + fun:_dl_catch_error + fun:_dlerror_run + fun:dlopen@@GLIBC_2.2.5 +} |