Skip to content

Commit

Permalink
Merge 10.2 into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jun 21, 2021
2 parents 068246c + 773a07b commit c9a85fb
Show file tree
Hide file tree
Showing 43 changed files with 427 additions and 162 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Code status:
------------

* [![Travis CI status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.3)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.3 branch)
* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com

## MariaDB: drop-in replacement for MySQL
Expand Down Expand Up @@ -76,5 +75,3 @@ https://bugs.mysql.com

The code for MariaDB, including all revision history, can be found at:
https://github.com/MariaDB/server

***************************************************************************
15 changes: 9 additions & 6 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ static my_bool non_blocking_api_enabled= 0;

#define QUERY_PRINT_ORIGINAL_FLAG 4

#define CLOSED_CONNECTION "-closed_connection-"

#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
Expand Down Expand Up @@ -5597,11 +5599,12 @@ void do_close_connection(struct st_command *command)
my_free(con->name);

/*
When the connection is closed set name to "-closed_connection-"
When the connection is closed set name to CLOSED_CONNECTION
to make it possible to reuse the connection name.
*/
if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
if (!(con->name = my_strdup(CLOSED_CONNECTION, MYF(MY_WME))))
die("Out of memory");
con->name_len= sizeof(CLOSED_CONNECTION)-1;

if (con == cur_con)
{
Expand Down Expand Up @@ -5985,7 +5988,7 @@ void do_connect(struct st_command *command)
con_slot= next_con;
else
{
if (!(con_slot= find_connection_by_name("-closed_connection-")))
if (!(con_slot= find_connection_by_name(CLOSED_CONNECTION)))
die("Connection limit exhausted, you can have max %d connections",
opt_max_connections);
my_free(con_slot->name);
Expand Down Expand Up @@ -8600,7 +8603,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
log_file.flush();
dynstr_set(&ds_res, 0);

if (view_protocol_enabled &&
if (view_protocol_enabled && mysql &&
complete_query &&
match_re(&view_re, query))
{
Expand Down Expand Up @@ -8646,7 +8649,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
dynstr_free(&query_str);
}

if (sp_protocol_enabled &&
if (sp_protocol_enabled && mysql &&
complete_query &&
match_re(&sp_re, query))
{
Expand Down Expand Up @@ -9009,7 +9012,7 @@ static void dump_backtrace(void)
struct st_connection *conn= cur_con;

fprintf(stderr, "read_command_buf (%p): ", read_command_buf);
my_safe_print_str(read_command_buf, sizeof(read_command_buf));
fprintf(stderr, "%.*s\n", (int)read_command_buflen, read_command_buf);
fputc('\n', stderr);

if (conn)
Expand Down
5 changes: 3 additions & 2 deletions cmake/do_abi_check.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ FOREACH(file ${ABI_HEADERS})
FILE(REMOVE ${tmpfile})
EXECUTE_PROCESS(
COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result)
IF(NOT ${result} EQUAL 0)
IF(result MATCHES "No such file or directory")
MESSAGE("Command 'diff' not found. ABI check for ${file} skipped.")
ELSEIF(NOT result EQUAL 0)
IF(ABI_UPDATE)
EXECUTE_PROCESS(COMMAND mv -v ${abi_check_out} ${file}.pp)
ELSE(ABI_UPDATE)
Expand All @@ -84,4 +86,3 @@ FOREACH(file ${ABI_HEADERS})
ENDIF()
FILE(REMOVE ${abi_check_out})
ENDFOREACH()

22 changes: 22 additions & 0 deletions cmake/os/OpenBSD.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2012 Monty Program Ab, 2021 Brad Smith
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA

# This file includes OpenBSD specific options and quirks, related to system checks

# Find libexecinfo (library that contains backtrace_symbols etc)
FIND_LIBRARY(EXECINFO NAMES execinfo)
IF(EXECINFO)
SET(LIBEXECINFO ${EXECINFO})
ENDIF()
2 changes: 1 addition & 1 deletion libmariadb
19 changes: 19 additions & 0 deletions mysql-test/main/win.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
#
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/main/win.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
19 changes: 19 additions & 0 deletions mysql-test/suite/encryption/r/key_version_rotation.result
Original file line number Diff line number Diff line change
@@ -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;
19 changes: 19 additions & 0 deletions mysql-test/suite/encryption/r/tempfiles_encrypted.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/suite/encryption/t/key_version_rotation.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--innodb-tablespaces-encryption
--plugin-load-add=$DEBUG_KEY_MANAGEMENT_SO
41 changes: 41 additions & 0 deletions mysql-test/suite/encryption/t/key_version_rotation.test
Original file line number Diff line number Diff line change
@@ -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;
34 changes: 34 additions & 0 deletions mysql-test/suite/gcol/r/innodb_virtual_index.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions mysql-test/suite/gcol/t/innodb_virtual_index.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb_sort_buffer_size=64k
33 changes: 33 additions & 0 deletions mysql-test/suite/gcol/t/innodb_virtual_index.test
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
3 changes: 3 additions & 0 deletions mysql-test/suite/innodb/r/innodb-alter.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/innodb/t/innodb-alter.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit c9a85fb

Please sign in to comment.