Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2021-06-21 09:07:40 +03:00
commit c9a85fb1b1
43 changed files with 427 additions and 162 deletions

View file

@ -3892,6 +3892,25 @@ id rn
1 1
drop table t1;
#
# MDEV-25630: Crash with window function in left expr of IN subquery
#
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a) FROM t1;
lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a)
NULL
1
0
DROP TABLE t1;
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT sum(i) over () IN ( SELECT 1 FROM t1 a) FROM t1;
sum(i) over () IN ( SELECT 1 FROM t1 a)
0
0
0
DROP TABLE t1;
#
# End of 10.2 tests
#
#

View file

@ -2542,6 +2542,20 @@ order by rn desc;
drop table t1;
--echo #
--echo # MDEV-25630: Crash with window function in left expr of IN subquery
--echo #
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT sum(i) over () IN ( SELECT 1 FROM t1 a) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View file

@ -1,9 +1,3 @@
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
create database enctests;
use enctests;
create table t1(a int not null primary key, b char(200)) engine=innodb;

View file

@ -0,0 +1,19 @@
create table t1(f1 int not null)engine=innodb;
create table t2(f1 int not null)engine=innodb;
insert into t1 select * from seq_1_to_100;
insert into t2 select * from seq_1_to_100;
# Enable encryption
set global innodb_encrypt_tables=ON;
# Create a new table and it is added to rotation list
create table t3(f1 int not null)engine=innodb;
insert into t3 select * from seq_1_to_100;
# Increase the version and it should set rotation
# variable for the encryption plugin
set global debug_key_management_version=10;
select @@debug_key_management_version;
@@debug_key_management_version
10
# Decrease the key version and Disable the encryption
set global debug_key_management_version=1;
set global innodb_encrypt_tables=off;
DROP TABLE t1, t2, t3;

View file

@ -3898,6 +3898,25 @@ id rn
1 1
drop table t1;
#
# MDEV-25630: Crash with window function in left expr of IN subquery
#
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a) FROM t1;
lag(i) over (ORDER BY i) IN ( SELECT 1 FROM t1 a)
NULL
1
0
DROP TABLE t1;
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT sum(i) over () IN ( SELECT 1 FROM t1 a) FROM t1;
sum(i) over () IN ( SELECT 1 FROM t1 a)
0
0
0
DROP TABLE t1;
#
# End of 10.2 tests
#
#

View file

@ -3,9 +3,6 @@
# not embedded because of restarts
-- source include/not_embedded.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
let $encryption = `SELECT @@innodb_encrypt_tables`;
SET GLOBAL innodb_file_per_table = ON;
# zlib

View file

@ -0,0 +1,2 @@
--innodb-tablespaces-encryption
--plugin-load-add=$DEBUG_KEY_MANAGEMENT_SO

View file

@ -0,0 +1,41 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_sequence.inc
create table t1(f1 int not null)engine=innodb;
create table t2(f1 int not null)engine=innodb;
insert into t1 select * from seq_1_to_100;
insert into t2 select * from seq_1_to_100;
let $restart_parameters=--innodb_encrypt_tables=0 --innodb_encryption_threads=1 --innodb_encryption_rotate_key_age=9;
--source include/restart_mysqld.inc
--echo # Enable encryption
set global innodb_encrypt_tables=ON;
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
--echo # Create a new table and it is added to rotation list
create table t3(f1 int not null)engine=innodb;
insert into t3 select * from seq_1_to_100;
--echo # Increase the version and it should set rotation
--echo # variable for the encryption plugin
set global debug_key_management_version=10;
select @@debug_key_management_version;
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
--source include/wait_condition.inc
--echo # Decrease the key version and Disable the encryption
set global debug_key_management_version=1;
set global innodb_encrypt_tables=off;
--let $wait_timeout= 600
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
DROP TABLE t1, t2, t3;

View file

@ -262,3 +262,37 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# MDEV-25872 InnoDB: Assertion failure in row_merge_read_clustered_index
# upon ALTER on table with indexed virtual columns
#
CREATE TABLE t1 (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
a INT,
va INT ZEROFILL AS (a) VIRTUAL,
b TIMESTAMP,
c CHAR(204),
vc CHAR(8),
KEY(vc,c(64),b,va)
) ENGINE=InnoDB CHARACTER SET utf32;
INSERT INTO t1 (id) SELECT NULL FROM seq_1_to_75;
INSERT IGNORE INTO t1 (id, a) VALUES (NULL, -1);
Warnings:
Warning 1264 Out of range value for column 'va' at row 1
ALTER TABLE t1 FORCE;
ERROR 22003: Out of range value for column 'va' at row 1
DROP TABLE t1;
#
# MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed
# in row_merge_buf_add()
#
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(3),
b CHAR(8) AS (a) VIRTUAL, KEY(b))
ROW_FORMAT=REDUNDANT ENGINE=InnoDB
CHARACTER SET utf8;
INSERT INTO t1 (id,a) VALUES (1,'foo');
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
DROP TABLE t1;

View file

@ -0,0 +1 @@
--innodb_sort_buffer_size=64k

View file

@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
# Ensure that the history list length will actually be decremented by purge.
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
@ -281,3 +282,35 @@ ROLLBACK;
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-25872 InnoDB: Assertion failure in row_merge_read_clustered_index
--echo # upon ALTER on table with indexed virtual columns
--echo #
CREATE TABLE t1 (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
a INT,
va INT ZEROFILL AS (a) VIRTUAL,
b TIMESTAMP,
c CHAR(204),
vc CHAR(8),
KEY(vc,c(64),b,va)
) ENGINE=InnoDB CHARACTER SET utf32;
INSERT INTO t1 (id) SELECT NULL FROM seq_1_to_75;
INSERT IGNORE INTO t1 (id, a) VALUES (NULL, -1);
--error ER_WARN_DATA_OUT_OF_RANGE
ALTER TABLE t1 FORCE;
DROP TABLE t1;
--echo #
--echo # MDEV-24713 Assertion `dict_table_is_comp(index->table)' failed
--echo # in row_merge_buf_add()
--echo #
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(3),
b CHAR(8) AS (a) VIRTUAL, KEY(b))
ROW_FORMAT=REDUNDANT ENGINE=InnoDB
CHARACTER SET utf8;
INSERT INTO t1 (id,a) VALUES (1,'foo');
OPTIMIZE TABLE t1;
DROP TABLE t1;

View file

@ -1049,10 +1049,13 @@ a
10
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
SET @save_allowed = @@GLOBAL.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed=never;
iNSERT INTO t1 VALUES (10);
ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
SELECT * FROM t1;
a b
10 2001-01-01

View file

@ -652,10 +652,13 @@ DROP TABLE t1;
# DATETIME-to-DATE truncation is OK
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
SET @save_allowed = @@GLOBAL.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed=never;
iNSERT INTO t1 VALUES (10);
--enable_info
ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
--disable_info
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
SELECT * FROM t1;
DROP TABLE t1;

View file

@ -31,19 +31,17 @@ DROP TABLE t2, t1;
#
CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter";
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
ALTER TABLE t1 ADD FULLTEXT(c);
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
SET DEBUG_SYNC='now WAIT_FOR s2';
START TRANSACTION;
SELECT * FROM t1;
a b c
SET DEBUG_SYNC='now SIGNAL s2';
SET DEBUG_SYNC='now SIGNAL g2';
connection con1;
ERROR 70100: Query execution was interrupted
ERROR HY000: Out of memory.
disconnect con1;
connection default;
SET DEBUG_SYNC=RESET;

View file

@ -60,20 +60,16 @@ DROP TABLE t2, t1;
--echo #
CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
connect(con1,localhost,root,,test);
let $ID= `SELECT @id := CONNECTION_ID()`;
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter";
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
send ALTER TABLE t1 ADD FULLTEXT(c);
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
let $ignore= `SELECT @id := $ID`;
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
SET DEBUG_SYNC='now WAIT_FOR s2';
START TRANSACTION;
SELECT * FROM t1;
SET DEBUG_SYNC='now SIGNAL s2';
SET DEBUG_SYNC='now SIGNAL g2';
connection con1;
--error ER_QUERY_INTERRUPTED
--error ER_OUT_OF_RESOURCES
reap;
disconnect con1;
connection default;

View file

@ -1,5 +1,5 @@
INSTALL SONAME 'auth_named_pipe';
CREATE USER 'USERNAME' IDENTIFIED WITH named_pipe;
GRANT ALL PRIVILEGES ON *.* to USERNAME;
GRANT ALL PRIVILEGES ON *.* to 'USERNAME';
DROP USER 'USERNAME';
UNINSTALL SONAME 'auth_named_pipe';

View file

@ -18,7 +18,7 @@ INSTALL SONAME 'auth_named_pipe';
--replace_result $USERNAME USERNAME
eval CREATE USER '$USERNAME' IDENTIFIED WITH named_pipe;
--replace_result $USERNAME USERNAME
eval GRANT ALL PRIVILEGES ON *.* to $USERNAME;
eval GRANT ALL PRIVILEGES ON *.* to '$USERNAME';
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--disable_result_log

View file

@ -2,7 +2,7 @@ install plugin unix_socket soname 'auth_socket.so';
#
# with named user
#
create user USER identified via unix_socket;
create user 'USER' identified via unix_socket;
#
# name match = ok
#
@ -12,7 +12,7 @@ USER@localhost USER@% test
#
# name does not match = failure
#
drop user USER;
drop user 'USER';
#
# and now with anonymous user
#

View file

@ -12,9 +12,9 @@ eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
--echo # with named user
--echo #
--let $replace=create user $USER
--replace_result $replace "create user USER"
eval create user $USER identified via unix_socket;
--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
--let $replace1=$USER@localhost
@ -34,9 +34,9 @@ EOF
--error 1
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--let $replace=drop user $USER
--replace_result $replace "drop user USER"
eval drop user $USER;
--let $replace=drop user '$USER'
--replace_result $replace "drop user 'USER'"
eval drop user '$USER';
--echo #
--echo # and now with anonymous user