diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-05 12:54:43 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-05 12:54:43 +0200 |
commit | 10d544aa7b305210246a976ca47a7559f8b78f72 (patch) | |
tree | a6df2319a67afbc523be05789c77e9a28a49e29c /mysql-test | |
parent | aa4f76bed715ec1016260f593e9cf4a8a1a4da36 (diff) | |
parent | fcc9f8b10cd2f497ff410b592808eedb3ee5f212 (diff) | |
download | mariadb-git-10d544aa7b305210246a976ca47a7559f8b78f72.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/lib/My/Debugger.pm | 3 | ||||
-rw-r--r-- | mysql-test/main/flush_and_binlog.result | 11 | ||||
-rw-r--r-- | mysql-test/main/flush_and_binlog.test | 14 | ||||
-rw-r--r-- | mysql-test/main/group_by.result | 29 | ||||
-rw-r--r-- | mysql-test/main/group_by.test | 23 | ||||
-rw-r--r-- | mysql-test/main/having.result | 33 | ||||
-rw-r--r-- | mysql-test/main/having.test | 21 | ||||
-rw-r--r-- | mysql-test/main/ps.result | 17 | ||||
-rw-r--r-- | mysql-test/main/ps.test | 14 | ||||
-rw-r--r-- | mysql-test/main/set_statement.result | 26 | ||||
-rw-r--r-- | mysql-test/main/set_statement.test | 26 | ||||
-rw-r--r-- | mysql-test/main/table_value_constr.result | 6 | ||||
-rw-r--r-- | mysql-test/main/table_value_constr.test | 6 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/truncate_foreign.result | 11 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/truncate_foreign.test | 13 | ||||
-rw-r--r-- | mysql-test/suite/plugins/r/server_audit.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/plugins/t/server_audit.test | 1 | ||||
-rw-r--r-- | mysql-test/suite/unit/suite.pm | 11 |
19 files changed, 260 insertions, 10 deletions
diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm index 2bbffc89f1a..0854a1c4363 100644 --- a/mysql-test/lib/My/Debugger.pm +++ b/mysql-test/lib/My/Debugger.pm @@ -74,7 +74,8 @@ my %debuggers = ( options => '-f -o {log} {exe} {args}', }, rr => { - options => 'record -o {log} {exe} {args}', + options => '_RR_TRACE_DIR={log} rr record {exe} {args}', + run => 'env', pre => sub { ::mtr_error('rr requires kernel.perf_event_paranoid <= 1') if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1; diff --git a/mysql-test/main/flush_and_binlog.result b/mysql-test/main/flush_and_binlog.result index b9560964046..a1d73c6590f 100644 --- a/mysql-test/main/flush_and_binlog.result +++ b/mysql-test/main/flush_and_binlog.result @@ -20,3 +20,14 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction connection default; disconnect con1; unlock tables; +# Second test from MDEV-23843 +CREATE TABLE t (a INT); +FLUSH TABLES WITH READ LOCK; +connect con1,localhost,root,,; +SET lock_wait_timeout= 1; +ANALYZE TABLE t; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t; diff --git a/mysql-test/main/flush_and_binlog.test b/mysql-test/main/flush_and_binlog.test index 373b900b451..a28d8e365dd 100644 --- a/mysql-test/main/flush_and_binlog.test +++ b/mysql-test/main/flush_and_binlog.test @@ -27,3 +27,17 @@ FLUSH TABLES; --connection default --disconnect con1 unlock tables; + +--echo # Second test from MDEV-23843 + +CREATE TABLE t (a INT); +FLUSH TABLES WITH READ LOCK; +--connect (con1,localhost,root,,) +SET lock_wait_timeout= 1; +--error ER_LOCK_WAIT_TIMEOUT +ANALYZE TABLE t; +# Cleanup +--disconnect con1 +--connection default +UNLOCK TABLES; +DROP TABLE t; diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 54a9da479dd..8c1ba102e8f 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -2958,5 +2958,34 @@ f COUNT(*) NULL 1 DROP TABLE t1; # +# MDEV-24710 Uninitialized value upon CREATE .. SELECT ... VALUE +# +CREATE TABLE t1 (a VARCHAR(8) NOT NULL DEFAULT ''); +INSERT INTO t1 (a) VALUES ('foo'); +CREATE TABLE t2 AS SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE VALUE(a) IS NOT NULL; +SELECT * from t2; +f1 f2 +NULL NULL +SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE VALUE(a) IS NOT NULL; +f1 f2 +NULL NULL +SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE 1=0; +f1 f2 +NULL NULL +drop table t1,t2; +# Extra test by to check the fix for MDEV-24710 +create table t20 (pk int primary key, a int); +insert into t20 values (1,1); +create table t21 (pk int primary key, b int not null); +insert into t21 values (1,1); +create table t22 (a int); +insert into t22 values (1),(2); +select a, (select max(t21.b) from t20 left join t21 on t21.pk=t20.a+10 +where t20.pk=1 and rand(123) < 0.5) as SUBQ from t22; +a SUBQ +1 NULL +2 NULL +drop table t20, t21, t22; +# # End of 10.3 tests # diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index d5908946afa..97209b50cda 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -2062,5 +2062,28 @@ SELECT d != '2023-03-04' AS f, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP; DROP TABLE t1; --echo # +--echo # MDEV-24710 Uninitialized value upon CREATE .. SELECT ... VALUE +--echo # + +CREATE TABLE t1 (a VARCHAR(8) NOT NULL DEFAULT ''); +INSERT INTO t1 (a) VALUES ('foo'); +CREATE TABLE t2 AS SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE VALUE(a) IS NOT NULL; +SELECT * from t2; +SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE VALUE(a) IS NOT NULL; +SELECT MAX(a) AS f1, a AS f2 FROM t1 WHERE 1=0; +drop table t1,t2; + +--echo # Extra test by to check the fix for MDEV-24710 + +create table t20 (pk int primary key, a int); +insert into t20 values (1,1);create table t21 (pk int primary key, b int not null); +insert into t21 values (1,1); +create table t22 (a int); +insert into t22 values (1),(2); +select a, (select max(t21.b) from t20 left join t21 on t21.pk=t20.a+10 + where t20.pk=1 and rand(123) < 0.5) as SUBQ from t22; +drop table t20, t21, t22; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result index 703f013c2da..51b88c5b8d2 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -847,6 +847,39 @@ t r DROP TABLE t1; DROP FUNCTION next_seq_value; DROP TABLE series; +# +# MDEV-24958 Server crashes in my_strtod / +# Value_source::Converter_strntod::Converter_strntod with DEFAULT(blob) +# +# MDEV-24942 Server crashes in _ma_rec_pack / _ma_write_blob_record with +# DEFAULT() on BLOB +# +CREATE TABLE t1 (id INT, f MEDIUMTEXT NOT NULL DEFAULT 'A'); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +SELECT f FROM t1 GROUP BY id ORDER BY DEFAULT(f); +f +foo +bar +SELECT DEFAULT(f) AS h FROM t1 HAVING h > 5; +h +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'A' +SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 0; +h +A +A +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'A' +SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 'A'; +h +A +A +alter table t1 add column b int default (rand()+1+3); +select default(b) AS h FROM t1 HAVING h > "2"; +h +# +# +drop table t1; # End of 10.3 tests # # MDEV-18681: AND formula in HAVING with several occurances diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test index 072f1a088dc..7e0a0439f8e 100644 --- a/mysql-test/main/having.test +++ b/mysql-test/main/having.test @@ -891,6 +891,27 @@ DROP TABLE t1; DROP FUNCTION next_seq_value; DROP TABLE series; + +--echo # +--echo # MDEV-24958 Server crashes in my_strtod / +--echo # Value_source::Converter_strntod::Converter_strntod with DEFAULT(blob) +--echo # +--echo # MDEV-24942 Server crashes in _ma_rec_pack / _ma_write_blob_record with +--echo # DEFAULT() on BLOB +--echo # + +CREATE TABLE t1 (id INT, f MEDIUMTEXT NOT NULL DEFAULT 'A'); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +SELECT f FROM t1 GROUP BY id ORDER BY DEFAULT(f); +SELECT DEFAULT(f) AS h FROM t1 HAVING h > 5; +SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 0; +SELECT DEFAULT(f) AS h FROM t1 HAVING h >= 'A'; + +alter table t1 add column b int default (rand()+1+3); +--replace_column 1 # +select default(b) AS h FROM t1 HAVING h > "2"; +drop table t1; + --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index b7e126e5061..1c13b0a0b84 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5497,6 +5497,23 @@ EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1)) 0 DROP TABLE t1; # +# MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement +# +CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY); +PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE a system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE b system NULL NULL NULL NULL 0 Const row not found +DROP TABLE t1; +CREATE TABLE t1(a INT); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 6a109951d0e..2ce78b78e90 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -4942,6 +4942,20 @@ EXECUTE stmt; DROP TABLE t1; --echo # +--echo # MDEV-25006: Failed assertion on executing EXPLAIN DELETE statement as a prepared statement +--echo # + +CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY); +PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(a INT); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/set_statement.result b/mysql-test/main/set_statement.result index 511ecf77357..53574fb4e4f 100644 --- a/mysql-test/main/set_statement.result +++ b/mysql-test/main/set_statement.result @@ -1217,6 +1217,31 @@ set @rnd=1; select @rnd; @rnd 0 +# +# MDEV-24860: Incorrect behaviour of SET STATEMENT in case +# it is executed as a prepared statement +# +PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +# Show definition of the table t1 created using Prepared Statement +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# Create the table t1 with the same definition as it used before +# using regular statement execution mode. +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1; +# Show that the table has the same definition as it is in case the table +# created in prepared statement mode. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; create table t (a int); SET sql_mode=ORACLE; SET STATEMENT myisam_sort_buffer_size=800000 FOR OPTIMIZE TABLE t; @@ -1234,3 +1259,4 @@ SET sql_mode=ORACLE; SET STATEMENT max_statement_time=30 FOR DELETE FROM mysql.user where user = 'unknown'; SET sql_mode=default; SET STATEMENT max_statement_time=30 FOR DELETE FROM mysql.user where user = 'unknown'; +# End of 10.4 tests diff --git a/mysql-test/main/set_statement.test b/mysql-test/main/set_statement.test index 12a6ccad8f9..670e9862abc 100644 --- a/mysql-test/main/set_statement.test +++ b/mysql-test/main/set_statement.test @@ -1137,6 +1137,30 @@ while ($1) --echo # @rnd should be 0 select @rnd; + +--echo # +--echo # MDEV-24860: Incorrect behaviour of SET STATEMENT in case +--echo # it is executed as a prepared statement +--echo # +PREPARE stmt FROM "SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1"; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo # Show definition of the table t1 created using Prepared Statement +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +--echo # Create the table t1 with the same definition as it used before +--echo # using regular statement execution mode. +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR CREATE TABLE t1 AS SELECT CONCAT('abc') AS c1; + +--echo # Show that the table has the same definition as it is in case the table +--echo # created in prepared statement mode. +SHOW CREATE TABLE t1; + +DROP TABLE t1; + create table t (a int); SET sql_mode=ORACLE; SET STATEMENT myisam_sort_buffer_size=800000 FOR OPTIMIZE TABLE t; @@ -1152,3 +1176,5 @@ SET sql_mode=ORACLE; SET STATEMENT max_statement_time=30 FOR DELETE FROM mysql.user where user = 'unknown'; SET sql_mode=default; SET STATEMENT max_statement_time=30 FOR DELETE FROM mysql.user where user = 'unknown'; + +--echo # End of 10.4 tests diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 3bb27589f66..01eee420885 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -2880,8 +2880,12 @@ deallocate prepare stmt; drop view v1; drop table t1,t2,t3; # -# End of 10.3 tests +# MDEV-24919: subselect formed by TVC and used in set function # +select sum((values(1))); +sum((values(1))) +1 +End of 10.3 tests # # MDEV-22610 Crash in INSERT INTO t1 (VALUES (DEFAULT) UNION VALUES (DEFAULT)) # diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index d2baccd1e7e..0e0e102a29c 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1517,9 +1517,13 @@ drop view v1; drop table t1,t2,t3; --echo # ---echo # End of 10.3 tests +--echo # MDEV-24919: subselect formed by TVC and used in set function --echo # +select sum((values(1))); + +--echo End of 10.3 tests + --echo # --echo # MDEV-22610 Crash in INSERT INTO t1 (VALUES (DEFAULT) UNION VALUES (DEFAULT)) --echo # diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f8b349f3239..fd0e5ffd12a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5000,7 +5000,7 @@ sub mysqld_start ($$) { $ENV{'MYSQLD_LAST_CMD'}= "$exe @$args"; My::Debugger::setup_args(\$args, \$exe, $mysqld->name()); - $ENV{'VALGRIND_TEST'}= $opt_valgrind = int($exe && $exe eq 'valgrind'); + $ENV{'VALGRIND_TEST'}= $opt_valgrind = int(($exe || '') eq 'valgrind'); # Remove the old pidfile if any unlink($mysqld->value('pid-file')); diff --git a/mysql-test/suite/innodb/r/truncate_foreign.result b/mysql-test/suite/innodb/r/truncate_foreign.result index fc09b74d62f..12a41860708 100644 --- a/mysql-test/suite/innodb/r/truncate_foreign.result +++ b/mysql-test/suite/innodb/r/truncate_foreign.result @@ -57,3 +57,14 @@ disconnect dml; connection default; SET DEBUG_SYNC = RESET; DROP TABLE child, parent; +# +# MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or +# ER_CRASHED_ON_USAGE after ALTER on table with foreign key +# +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE; +LOCK TABLE t1 WRITE; +TRUNCATE TABLE t1; +ALTER TABLE t1 ADD c INT; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/truncate_foreign.test b/mysql-test/suite/innodb/t/truncate_foreign.test index d9d647e69f0..1c150e5db40 100644 --- a/mysql-test/suite/innodb/t/truncate_foreign.test +++ b/mysql-test/suite/innodb/t/truncate_foreign.test @@ -67,3 +67,16 @@ connection default; SET DEBUG_SYNC = RESET; DROP TABLE child, parent; + +--echo # +--echo # MDEV-24532 Table corruption ER_NO_SUCH_TABLE_IN_ENGINE or +--echo # ER_CRASHED_ON_USAGE after ALTER on table with foreign key +--echo # + +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (b) REFERENCES t1 (a) ON UPDATE CASCADE; +LOCK TABLE t1 WRITE; +TRUNCATE TABLE t1; +ALTER TABLE t1 ADD c INT; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 2c06b70c509..ac710a7ab85 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -118,6 +118,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); CREATE USER u3 IDENTIFIED BY ''; +ALTER USER u3 IDENTIFIED BY 'pwd-456'; drop user u1, u2, u3; set global server_audit_events='query_ddl'; create table t1(id int); @@ -393,6 +394,8 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,global_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'ALTER USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 0d65c451d08..8edf898a998 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -95,6 +95,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; SET PASSWORD FOR u1 = PASSWORD('pwd 098'); CREATE USER u3 IDENTIFIED BY ''; +ALTER USER u3 IDENTIFIED BY 'pwd-456'; drop user u1, u2, u3; set global server_audit_events='query_ddl'; diff --git a/mysql-test/suite/unit/suite.pm b/mysql-test/suite/unit/suite.pm index b7a1f9ae871..43c9e115de6 100644 --- a/mysql-test/suite/unit/suite.pm +++ b/mysql-test/suite/unit/suite.pm @@ -20,7 +20,6 @@ sub start_test { ($path, $args) = ($cmd, , [ ]) } - my $oldpwd=getcwd(); chdir $::opt_vardir; my $proc=My::SafeProcess->new @@ -49,12 +48,12 @@ sub start_test { my ($command, %tests, $prefix); for (@ctest_list) { chomp; - if (/^\d+: Test command: +/) { - $command= $'; + if (/^\d+: Test command: +([^ \t]+)/) { + $command= $1; $prefix= /libmariadb/ ? 'conc_' : ''; - } elsif (/^ +Test +#\d+: +/) { - if ($command ne "NOT_AVAILABLE") { - $tests{$prefix.$'}=$command; + } elsif (/^ +Test +#\d+: ([^ \t]+)/) { + if ($command ne "NOT_AVAILABLE" && $command ne "/bin/sh") { + $tests{$prefix.$1}=$command; } } } |