Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Mar 5, 2021
2 parents 33cf577 + f6cb9e6 commit 03ff588
Show file tree
Hide file tree
Showing 40 changed files with 1,657 additions and 1,166 deletions.
2 changes: 0 additions & 2 deletions include/my_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ enum ha_extra_function {
HA_EXTRA_BEGIN_ALTER_COPY,
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_END_ALTER_COPY,
/** Fake the start of a statement after wsrep_load_data_splitting hack */
HA_EXTRA_FAKE_START_STMT,
/** IGNORE is being used for the insert statement */
HA_EXTRA_IGNORE_INSERT
};
Expand Down
3 changes: 2 additions & 1 deletion mysql-test/lib/My/Debugger.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions mysql-test/main/flush_and_binlog.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
14 changes: 14 additions & 0 deletions mysql-test/main/flush_and_binlog.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
29 changes: 29 additions & 0 deletions mysql-test/main/group_by.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
23 changes: 23 additions & 0 deletions mysql-test/main/group_by.test
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,29 @@ INSERT INTO t1 VALUES ('2032-10-08');
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 #
33 changes: 33 additions & 0 deletions mysql-test/main/having.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/main/having.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/main/ps.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
#
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/main/ps.test
Original file line number Diff line number Diff line change
Expand Up @@ -4941,6 +4941,20 @@ EXECUTE stmt;
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 #
Expand Down
26 changes: 26 additions & 0 deletions mysql-test/main/set_statement.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
26 changes: 26 additions & 0 deletions mysql-test/main/set_statement.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
6 changes: 5 additions & 1 deletion mysql-test/main/table_value_constr.result
Original file line number Diff line number Diff line change
Expand Up @@ -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))
#
Expand Down
6 changes: 5 additions & 1 deletion mysql-test/main/table_value_constr.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5000,7 +5000,7 @@ ($$)
$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'));
Expand Down
11 changes: 11 additions & 0 deletions mysql-test/suite/innodb/r/truncate_foreign.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb/t/truncate_foreign.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 3 additions & 0 deletions mysql-test/suite/plugins/r/server_audit.result
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/plugins/t/server_audit.test
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit 03ff588

Please sign in to comment.