Skip to content

Commit

Permalink
Merge 10.3 into 10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jul 15, 2020
2 parents a763428 + 8a09440 commit 9936cfd
Show file tree
Hide file tree
Showing 39 changed files with 467 additions and 141 deletions.
2 changes: 1 addition & 1 deletion cmake/build_configurations/mysql_release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ENDIF()

IF(UNIX)
SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
SET(PLUGIN_AUTH_PAM YES)
SET(PLUGIN_AUTH_PAM YES CACHE BOOL "")

IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT IGNORE_AIO_CHECK)
Expand Down
24 changes: 16 additions & 8 deletions include/mysql/psi/mysql_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -1043,10 +1043,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
if (socket_accept.fd != INVALID_SOCKET)
{
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1)
{
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
}
}
#endif
#endif
Expand All @@ -1065,10 +1069,14 @@ inline_mysql_socket_accept
#else
socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
#ifdef FD_CLOEXEC
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
if (socket_accept.fd != INVALID_SOCKET)
{
flags= fcntl(socket_accept.fd, F_GETFD);
if (flags != -1)
{
flags |= FD_CLOEXEC;
fcntl(socket_accept.fd, F_SETFD, flags);
}
}
#endif
#endif
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/main/create_drop_function.result
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,20 @@ body
DROP FUNCTION IF EXISTS f1;
Warnings:
Note 1305 FUNCTION test.f1 does not exist
#
# 10.1 Test
#
# MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
# is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
#
SET GLOBAL log_bin_trust_function_creators=0;
CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;
CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;
ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;
ERROR 42000: Identifier name 'sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934' is too long
DROP FUNCTION IF EXISTS f;
Warnings:
Note 1305 FUNCTION test.f does not exist
SET GLOBAL log_bin_trust_function_creators=1;
# End of 10.1 Test
24 changes: 24 additions & 0 deletions mysql-test/main/create_drop_function.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source include/have_log_bin.inc;

SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');

CREATE FUNCTION f1(str char(20))
Expand Down Expand Up @@ -39,3 +41,25 @@ DROP FUNCTION IF EXISTS f1;
SELECT body FROM mysql.proc WHERE name like 'f1';
DROP FUNCTION IF EXISTS f1;

--echo #
--echo # 10.1 Test
--echo #
--echo # MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK &&
--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace
--echo #

SET GLOBAL log_bin_trust_function_creators=0;

CREATE FUNCTION f(c INT) RETURNS NUMERIC NO SQL RETURN 0;

--error ER_BINLOG_UNSAFE_ROUTINE
CREATE OR REPLACE FUNCTION f(c INT) RETURNS INT RETURN 0;

--error ER_TOO_LONG_IDENT
CREATE OR REPLACE FUNCTION sp1_thisisaveryverylongnamelongnameverylongname_thisisaveryverylongname234872934(a INT) RETURNS INT RETURN 0;

DROP FUNCTION IF EXISTS f;

SET GLOBAL log_bin_trust_function_creators=1;

--echo # End of 10.1 Test
4 changes: 2 additions & 2 deletions mysql-test/main/mysqltest_tracking_info.result
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ SET @@session.session_track_system_variables= @save_session_track_system_variabl
#
set @save_optimizer_switch=@@optimizer_switch;
SET @@session.session_track_system_variables='optimizer_switch';
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES
-- optimizer_switch
-- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
-- index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on

Warnings:
Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/mysqltest_tracking_info.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set @save_optimizer_switch=@@optimizer_switch;
SET @@session.session_track_system_variables='optimizer_switch';

--enable_session_track_info
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
set optimizer_switch='index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=on,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=on,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off';
--disable_session_track_info

set @@optimizer_switch=@save_optimizer_switch;
Expand Down
55 changes: 55 additions & 0 deletions mysql-test/main/order_by.result
Original file line number Diff line number Diff line change
Expand Up @@ -3377,6 +3377,61 @@ SET @@sort_buffer_size= @save_sort_buffer_size;
SET @@max_sort_length= @save_max_sort_length;
DROP TABLE t1;
#
# MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
# SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
#
SET @save_max_sort_length= @@max_sort_length;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
SET max_sort_length=8;
SET sort_buffer_size=1024;
SET max_length_for_sort_data=7000;
CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"read_sorted_file": {
"r_rows": 5,
"filesort": {
"sort_key": "t1.a",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_limit": 5,
"r_used_priority_queue": false,
"r_output_rows": 35,
"r_sort_passes": 1,
"r_buffer_size": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 100,
"r_rows": 100,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
SELECT * FROM t1 ORDER BY a LIMIT 5;
a b
1 1
10 10
100 100
11 11
12 12
SET max_sort_length= @save_max_sort_length;
SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;
#
# MDEV-13994: Bad join results with orderby_uses_equalities=on
#
CREATE TABLE books (
Expand Down
22 changes: 22 additions & 0 deletions mysql-test/main/order_by.test
Original file line number Diff line number Diff line change
Expand Up @@ -2179,6 +2179,28 @@ SET @@sort_buffer_size= @save_sort_buffer_size;
SET @@max_sort_length= @save_max_sort_length;
DROP TABLE t1;

--echo #
--echo # MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft |
--echo # SIGSEGV in __memmove_avx_unaligned_erms from my_b_write (on optimized)
--echo #

SET @save_max_sort_length= @@max_sort_length;
SET @save_sort_buffer_size= @@sort_buffer_size;
SET @save_max_length_for_sort_data= @@max_length_for_sort_data;
SET max_sort_length=8;
SET sort_buffer_size=1024;
# needed to make sure we use addon fields
SET max_length_for_sort_data=7000;
CREATE TABLE t1(a VARCHAR(64), b VARCHAR(2048))DEFAULT CHARSET=utf8;
INSERT INTO t1 SELECT seq,seq from seq_1_to_100;
--source include/analyze-format.inc
ANALYZE FORMAT=JSON SELECT * FROM t1 ORDER BY a LIMIT 5;
SELECT * FROM t1 ORDER BY a LIMIT 5;
SET max_sort_length= @save_max_sort_length;
SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;

--echo #
--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
--echo #
Expand Down
15 changes: 5 additions & 10 deletions mysql-test/main/parser.result
Original file line number Diff line number Diff line change
Expand Up @@ -932,11 +932,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
a
1
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
a
1
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
# UNION with a parenthesed term
CREATE TABLE t1 (a INT);
Expand Down Expand Up @@ -999,14 +997,11 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
a
1
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
a
1
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
a
1
ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
DROP TABLE t1;
# Derived table with ROLLUP
CREATE TABLE t1 (a INT);
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/parser.test
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,9 @@ CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
--echo # For now, we're testing the parser.
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
DROP TABLE t1;

Expand Down Expand Up @@ -1125,8 +1127,11 @@ DROP TABLE t1;

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (10),(20),(30);
--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
--error ER_AGGREGATE_ORDER_FOR_UNION
SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
DROP TABLE t1;

Expand Down
13 changes: 13 additions & 0 deletions mysql-test/main/sp-error.result
Original file line number Diff line number Diff line change
Expand Up @@ -2874,3 +2874,16 @@ SELECT @msg;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP TABLE t1;
#
# 10.2 Test
#
# MDEV-MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK &&
# is_bulk_op())' failed in Diagnostics_area::set_ok_status
#
SET @old_optimizer_switch = @@SESSION.OPTIMIZER_SWITCH;
SET @cmd:="SET @@SESSION.SQL_MODE=(SELECT 'a')";
SET @@SESSION.OPTIMIZER_SWITCH="in_to_exists=OFF,materialization=OFF";
ERROR HY000: At least one of the 'in_to_exists' or 'materialization' optimizer_switch flags must be 'on'
PREPARE stmt FROM @cmd;
set @@SESSION.OPTIMIZER_SWITCH=@old_optimizer_switch;
# End of 10.2 Test
19 changes: 19 additions & 0 deletions mysql-test/main/sp-error.test
Original file line number Diff line number Diff line change
Expand Up @@ -3846,3 +3846,22 @@ SELECT @msg;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP TABLE t1;

--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK &&
--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status
--echo #

SET @old_optimizer_switch = @@SESSION.OPTIMIZER_SWITCH;

SET @cmd:="SET @@SESSION.SQL_MODE=(SELECT 'a')";

--error ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES
SET @@SESSION.OPTIMIZER_SWITCH="in_to_exists=OFF,materialization=OFF";
PREPARE stmt FROM @cmd;

set @@SESSION.OPTIMIZER_SWITCH=@old_optimizer_switch;

--echo # End of 10.2 Test
8 changes: 4 additions & 4 deletions mysql-test/main/subselect_exists2in.result
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ drop table t1,t3;
# MDEV-159 Assertion about not marked for read failed in
# String* Field_varstring::val_str(String*, String*)
#
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch='in_to_exists=on,exists_to_in=on';
SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'in_to_exists=off', 'in_to_exists=on');
SET optimizer_switch='exists_to_in=on';
CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('k'),('m');
CREATE TABLE t2 ( b INT,
Expand Down Expand Up @@ -596,8 +596,8 @@ Warnings:
Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`alias`.`b` and `test`.`alias`.`b` > `test`.`alias`.`a`
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'materialization=off', 'materialization=on');
SET optimizer_switch = 'exists_to_in=on,semijoin=off';
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
a b
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/main/subselect_exists2in.test
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ drop table t1,t3;
--echo # String* Field_varstring::val_str(String*, String*)
--echo #

SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch='in_to_exists=on,exists_to_in=on';
SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'in_to_exists=off', 'in_to_exists=on');
SET optimizer_switch='exists_to_in=on';

CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('k'),('m');
Expand Down Expand Up @@ -466,8 +466,8 @@ explain extended
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );

SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
SET optimizer_switch = REPLACE(REPLACE(@@optimizer_switch, '=on', '=off'), 'materialization=off', 'materialization=on');
SET optimizer_switch = 'exists_to_in=on,semijoin=off';
SELECT * FROM t1 AS alias
WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
explain extended
Expand Down
Loading

0 comments on commit 9936cfd

Please sign in to comment.