From 3efdac2064c5ea5bd58538396d1a7a9fe6f498d1 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 29 Apr 2020 13:22:25 +1000 Subject: [PATCH 01/20] MDEV-22173: socket accept - test for failure accept might return an error, including SOCKET_EAGAIN/ SOCKET_EINTR. The caller, usually handle_connections_sockets can these however and invalid file descriptor isn't something to call fcntl on. Thanks to Etienne Guesnet (ATOS) for diagnosis, sample patch description and testing. --- include/mysql/psi/mysql_socket.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index a7397795f77..2ab6932e396 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -1048,10 +1048,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 @@ -1070,10 +1074,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 From 6163af93975d4084580363321e5edfaebfb800cd Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 6 Jul 2020 16:29:09 +0530 Subject: [PATCH 02/20] MDEV-22390: Assertion `m_next_rec_ptr >= m_rawmem' failed in Filesort_buffer::spaceleft | SIGSEGV in __memmove_avx_unaligned_erms from my_b_write Make sure that the sort_buffer that is allocated has atleast space for MERGEBUFF2 keys. The issue here was that the record length is quite high and sort buffer size is very small, due to which we end up with zero number of keys in the sort buffer. The Sort_param::max_keys_per_buffer was zero in such a case, due to which we were flushing empty sort_buffer to the disk. --- mysql-test/r/order_by.result | 54 ++++++++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 22 +++++++++++++++ sql/filesort.cc | 3 +- sql/filesort_utils.cc | 1 - 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index d35012e0de5..ffb37c9309f 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -3302,3 +3302,57 @@ a b c 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": { + "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; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 2fbacb10b68..3a30e0b6c76 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2174,3 +2174,25 @@ SELECT * FROM t1 ORDER BY a,b; 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; diff --git a/sql/filesort.cc b/sql/filesort.cc index bb3e73343ad..90edd39b1da 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -256,7 +256,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, while (memory_available >= min_sort_memory) { ulonglong keys= memory_available / (param.rec_length + sizeof(char*)); - param.max_keys_per_buffer= (uint) MY_MIN(num_rows, keys); + param.max_keys_per_buffer= MY_MAX(MERGEBUFF2, + (uint) MY_MIN(num_rows, keys)); if (table_sort.get_sort_keys()) { // If we have already allocated a buffer, it better have same size! diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc index f1a164dd9fe..287edddf619 100644 --- a/sql/filesort_utils.cc +++ b/sql/filesort_utils.cc @@ -97,7 +97,6 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records, uint record_length) if (m_idx_array.is_null()) { sort_buff_sz= ((size_t)num_records) * (record_length + sizeof(uchar*)); - set_if_bigger(sort_buff_sz, record_length * MERGEBUFF2); uchar **sort_keys= (uchar**) my_malloc(sort_buff_sz, MYF(MY_THREAD_SPECIFIC)); m_idx_array= Idx_array(sort_keys, num_records); From cad9a9b1f8f09a3d7f4597bf1d68bd9c2e0c5879 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 6 Jul 2020 13:51:13 +0200 Subject: [PATCH 03/20] MDEV-23098 mariadb-upgrade-service.exe does not work on WAMPServer While trying to detect datadir, take into account that one can use Windows service name as section name in options file, for Windows service. The historical obscurity is being used by WAMP installations. --- sql/winservice.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/sql/winservice.c b/sql/winservice.c index fe1fb0cb2bb..7a7e7616e76 100644 --- a/sql/winservice.c +++ b/sql/winservice.c @@ -116,6 +116,23 @@ BOOL exclude_service(mysqld_service_properties *props) } +static void get_datadir_from_ini(const char *ini, char *service_name, char *datadir, size_t sz) +{ + *datadir= 0; + const char *sections[]= {service_name, "mysqld", "server", "mariadb", + "mariadbd"}; + for (int i= 0; i < sizeof(sections) / sizeof(sections[0]); i++) + { + if (sections[i]) + { + GetPrivateProfileStringA(sections[i], "datadir", NULL, datadir, sz, ini); + if (*datadir) + return; + } + } +} + + /* Retrieve some properties from windows mysqld service binary path. We're interested in ini file location and datadir, and also in version of @@ -135,6 +152,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, wchar_t **args= NULL; int retval= 1; BOOL have_inifile; + char service_name[MAX_PATH]; props->datadir[0]= 0; props->inifile[0]= 0; @@ -148,7 +166,7 @@ int get_mysql_service_properties(const wchar_t *bin_path, { /* There are rare cases where service config does not have - --defaults-filein the binary parth . There services were registered with + --defaults-file in the binary parth . There services were registered with plain mysqld --install, the data directory is next to "bin" in this case. */ have_inifile= FALSE; @@ -162,6 +180,9 @@ int get_mysql_service_properties(const wchar_t *bin_path, goto end; } + /* Last parameter is the service name*/ + wcstombs(service_name, args[numargs-1], MAX_PATH); + if(have_inifile && wcsncmp(args[1], L"--defaults-file=", 16) != 0) goto end; @@ -193,8 +214,8 @@ int get_mysql_service_properties(const wchar_t *bin_path, normalize_path(props->inifile, MAX_PATH); if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) { - GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, MAX_PATH, - props->inifile); + get_datadir_from_ini(props->inifile, service_name, props->datadir, + sizeof(props->datadir)); } else { @@ -243,8 +264,8 @@ int get_mysql_service_properties(const wchar_t *bin_path, if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES) { /* Ini file found, get datadir from there */ - GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir, - MAX_PATH, props->inifile); + get_datadir_from_ini(props->inifile, service_name, props->datadir, + sizeof(props->datadir)); } else { From a53662555302f08dc7dfb89c6ad12863fbf4e8d7 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Wed, 1 Jul 2020 14:11:31 +0530 Subject: [PATCH 04/20] MDEV-22654: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status on FUNCTION replace When there is REPLACE in the statement, sp_drop_routine_internal() returns 0 (SP_OK) on success which is then assigned to ret. So ret becomes false and the error state is lost. The expression inside DBUG_ASSERT() evaluates to false and thus the assertion failure. --- mysql-test/r/create_drop_function.result | 17 +++++++++++++++++ mysql-test/t/create_drop_function.test | 24 ++++++++++++++++++++++++ sql/sp.cc | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/create_drop_function.result b/mysql-test/r/create_drop_function.result index e9db636ab87..bdac57751b8 100644 --- a/mysql-test/r/create_drop_function.result +++ b/mysql-test/r/create_drop_function.result @@ -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 diff --git a/mysql-test/t/create_drop_function.test b/mysql-test/t/create_drop_function.test index e4d3d684cd5..3c4770e25e3 100644 --- a/mysql-test/t/create_drop_function.test +++ b/mysql-test/t/create_drop_function.test @@ -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)) @@ -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 diff --git a/sql/sp.cc b/sql/sp.cc index 1d340644ba1..b783ff3b583 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1080,7 +1080,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) { if (lex->create_info.or_replace()) { - if ((ret= sp_drop_routine_internal(thd, type, lex->spname, table))) + if (sp_drop_routine_internal(thd, type, lex->spname, table)) goto done; } else if (lex->create_info.if_not_exists()) From 253aa7bbc4dda77427f6b1bf47620db36ada75b9 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 7 Jul 2020 17:30:52 +0530 Subject: [PATCH 05/20] MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function Pass the unsigned flag from the Item_sum to the window function --- mysql-test/r/win.result | 10 ++++++++++ mysql-test/t/win.test | 9 +++++++++ sql/item_windowfunc.h | 1 + 3 files changed, 20 insertions(+) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 9c85315b7c1..71953871295 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3798,5 +3798,15 @@ SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 ERROR HY000: Window functions can not be used as arguments to group functions. DROP TABLE t1; # +# MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function +# +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1),(2); +SELECT MIN(d) OVER () FROM t1; +MIN(d) OVER () +1 +1 +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index d19ff2c624d..a768b893432 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2472,6 +2472,15 @@ SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a; DROP TABLE t1; +--echo # +--echo # MDEV-12059: Assertion `precision > 0' failed with a window function or window aggregate function +--echo # + +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1),(2); +SELECT MIN(d) OVER () FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index b9df1b7482b..85957949053 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -953,6 +953,7 @@ public: bool fix_length_and_dec() { decimals = window_func()->decimals; + unsigned_flag= window_func()->unsigned_flag; return FALSE; } From f18c5a7ed774228cee4fdeb4ed4b16b68ae9f4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 7 Jul 2020 17:58:24 +0300 Subject: [PATCH 06/20] MDEV-23114 AUTH_PAM plugin can not be disabled when using mysql_release config When setting the PLUGIN_AUTH_PAM variable, mark it as a "CACHE" variable so it can be overridden by the user. --- cmake/build_configurations/mysql_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 2a8461bf370..5af197c7f11 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -118,7 +118,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) From a759f9af51b2093502d3a06c0150e9aa7fc21068 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 9 Jul 2020 08:54:59 +0200 Subject: [PATCH 07/20] Fix typo in the comment (and old info) --- sql/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 1ea7b30f85d..65bd9d22857 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -70,7 +70,7 @@ const char field_separator=','; #define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \ ((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1)) -// Column marked for read or the field set to read out or record[0] or [1] +// Column marked for read or the field set to read out of record[0] #define ASSERT_COLUMN_MARKED_FOR_READ \ DBUG_ASSERT(!table || \ (!table->read_set || \ From 737c3025e9ed55855ee66806ad14e9e7e7852fa7 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Thu, 9 Jul 2020 14:01:06 +0530 Subject: [PATCH 08/20] MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT() Reject queries that have aggregate functions with UNION as these are not allowed by standard. --- mysql-test/r/parser.result | 15 +++++---------- mysql-test/r/union.result | 29 ++++++++++++----------------- mysql-test/t/parser.test | 5 +++++ mysql-test/t/union.test | 21 +++++++++++++++------ sql/sql_select.cc | 17 ++++++++++++++++- 5 files changed, 53 insertions(+), 34 deletions(-) diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 09bbd7cf176..45fcca146fe 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -943,11 +943,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); @@ -1010,14 +1008,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); diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c02e590490e..f9df02b7f81 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1757,8 +1757,7 @@ union select 4 order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION prepare stmt1 from 'select 1 as foo union select 2 @@ -1768,12 +1767,7 @@ union select 4 order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) '; -execute stmt1; -foo -1 -execute stmt1; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION select 1 as foo union select 2 @@ -1783,8 +1777,7 @@ union (select 4) order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; -foo -1 +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION prepare stmt1 from 'select 1 as foo union select 2 @@ -1794,13 +1787,7 @@ union (select 4) order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) '; -execute stmt1; -foo -1 -execute stmt1; -foo -1 -deallocate prepare stmt1; +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION End of 5.1 tests # # mdev-5091: Asseirtion failure for UNION with ORDER BY @@ -2299,3 +2286,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select 1 AS `1`,2 AS `2` union all select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0 DROP TABLE t1,t2; +# +# MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT() +# +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2),(3); +(SELECT 1 AS a) UNION (SELECT a FROM t1 GROUP BY a) ORDER BY GROUP_CONCAT(a); +ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION +DROP TABLE t1; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index 5faaca00ea8..7e11a71c500 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -1090,7 +1090,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; @@ -1131,8 +1133,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; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 707bda6d81b..9f747c9080f 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1184,11 +1184,11 @@ select 4 order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; +--error ER_AGGREGATE_ORDER_FOR_UNION eval $my_stmt; +--error ER_AGGREGATE_ORDER_FOR_UNION eval prepare stmt1 from '$my_stmt'; -execute stmt1; -execute stmt1; let $my_stmt= select 1 as foo @@ -1201,13 +1201,11 @@ union order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1) ; +--error ER_AGGREGATE_ORDER_FOR_UNION eval $my_stmt; +--error ER_AGGREGATE_ORDER_FOR_UNION eval prepare stmt1 from '$my_stmt'; -execute stmt1; -execute stmt1; - -deallocate prepare stmt1; --echo End of 5.1 tests @@ -1637,3 +1635,14 @@ eval $q; eval EXPLAIN EXTENDED $q; DROP TABLE t1,t2; + +--echo # +--echo # MDEV-10120: Wrong result of UNION .. ORDER BY GROUP_CONCAT() +--echo # + +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2),(3); + +--error ER_AGGREGATE_ORDER_FOR_UNION +(SELECT 1 AS a) UNION (SELECT a FROM t1 GROUP BY a) ORDER BY GROUP_CONCAT(a); +DROP TABLE t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4cca2d67eb8..c33e554aaca 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -22709,10 +22709,13 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, List &fields, List &all_fields, ORDER *order, bool from_window_spec) { + SELECT_LEX *select = thd->lex->current_select; enum_parsing_place context_analysis_place= thd->lex->current_select->context_analysis_place; thd->where="order clause"; - for (; order; order=order->next) + const bool for_union = select->master_unit()->is_union() && + select == select->master_unit()->fake_select_lex; + for (uint number = 1; order; order=order->next, number++) { if (find_order_in_list(thd, ref_pointer_array, tables, order, fields, all_fields, false, true, from_window_spec)) @@ -22723,6 +22726,18 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0)); return 1; } + + /* + UNION queries cannot be used with an aggregate function in + an ORDER BY clause + */ + + if (for_union && (*order->item)->with_sum_func) + { + my_error(ER_AGGREGATE_ORDER_FOR_UNION, MYF(0), number); + return 1; + } + if (from_window_spec && (*order->item)->with_sum_func && (*order->item)->type() != Item::SUM_FUNC_ITEM) (*order->item)->split_sum_func(thd, ref_pointer_array, From f81ff93287349daeb62c46e699ac54996a09860b Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Fri, 10 Jul 2020 21:27:20 +0530 Subject: [PATCH 09/20] MDEV-19119: main.ssl_crl fails in buildbot with wrong error code The client can only find out if the server has disconnected when it tries to read or send something. If the server gets disconnected before send_client_reply_packet(), the client will try sending authentication information but it will fail. But, if the client is fast enough to send autentication information before disconnecting, it will notice that when reading the ok packet. So the client can fail on read or on write. It is unpredictable because, the process are unsynchronized and this could happen in any order. --- mysql-test/t/ssl_crl.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/ssl_crl.test b/mysql-test/t/ssl_crl.test index dc30a9b5934..643fb80c747 100644 --- a/mysql-test/t/ssl_crl.test +++ b/mysql-test/t/ssl_crl.test @@ -8,6 +8,6 @@ --echo # try logging in with a certificate in the server's --ssl-crl : should fail # OpenSSL 1.1.1a correctly rejects the certificate, but the error message is wrong ---replace_result "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked" +--replace_result "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked" "ERROR 2013 (HY000): Lost connection to MySQL server at 'sending authentication information', system error: 32" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked" --error 1 --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 From 0994af43e582fccf55f7893b16228b57e92330d0 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Thu, 2 Jul 2020 19:03:39 +0530 Subject: [PATCH 10/20] MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status Error state is not stored in check_and_do_in_subquery_rewrites() when there is illegal combination of optimizer switches. So all the functions eventually return false. Thus the assetion failure. --- mysql-test/r/mysqltest_tracking_info.result | 4 ++-- mysql-test/r/sp-error.result | 13 +++++++++++ mysql-test/r/subselect_exists2in.result | 8 +++---- .../sys_vars/r/optimizer_switch_basic.result | 22 +++++++++---------- .../sys_vars/t/optimizer_switch_basic.test | 4 ++-- mysql-test/t/mysqltest_tracking_info.test | 2 +- mysql-test/t/sp-error.test | 19 ++++++++++++++++ mysql-test/t/subselect_exists2in.test | 8 +++---- sql/opt_subselect.cc | 5 ++--- sql/sys_vars.cc | 13 ++++++++++- 10 files changed, 70 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/mysqltest_tracking_info.result b/mysql-test/r/mysqltest_tracking_info.result index 16d737dc4e6..142f5237876 100644 --- a/mysql-test/r/mysqltest_tracking_info.result +++ b/mysql-test/r/mysqltest_tracking_info.result @@ -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 +-- 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 Warnings: Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index b9291973ab3..877c8bb1666 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -2872,3 +2872,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 diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result index de01a4e7304..957f7b9bbff 100644 --- a/mysql-test/r/subselect_exists2in.result +++ b/mysql-test/r/subselect_exists2in.result @@ -437,8 +437,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, @@ -593,8 +593,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 diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result index c37c6785b9b..d813f515f83 100644 --- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result @@ -17,38 +17,38 @@ OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,i select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on -set global optimizer_switch=10; -set session optimizer_switch=5; +set global optimizer_switch=4101; +set session optimizer_switch=2058; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off set global optimizer_switch="index_merge_sort_union=on"; set session optimizer_switch="index_merge=off"; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off show global variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +optimizer_switch index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off show session variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off select * from information_schema.global_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +OPTIMIZER_SWITCH index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off set session optimizer_switch="default"; select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,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=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,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=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off set optimizer_switch = replace(@@optimizer_switch, '=off', '=on'); Warnings: Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release diff --git a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test index ef9d8f17832..ada22845f3e 100644 --- a/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test +++ b/mysql-test/suite/sys_vars/t/optimizer_switch_basic.test @@ -19,8 +19,8 @@ select * from information_schema.session_variables where variable_name='optimize # # show that it's writable # -set global optimizer_switch=10; -set session optimizer_switch=5; +set global optimizer_switch=4101; +set session optimizer_switch=2058; select @@global.optimizer_switch; select @@session.optimizer_switch; set global optimizer_switch="index_merge_sort_union=on"; diff --git a/mysql-test/t/mysqltest_tracking_info.test b/mysql-test/t/mysqltest_tracking_info.test index da7732b5011..dc51167137a 100644 --- a/mysql-test/t/mysqltest_tracking_info.test +++ b/mysql-test/t/mysqltest_tracking_info.test @@ -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; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 4dd3c51e4b0..b0c957ad164 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -3851,3 +3851,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 diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test index 1354953e972..2a9947123d4 100644 --- a/mysql-test/t/subselect_exists2in.test +++ b/mysql-test/t/subselect_exists2in.test @@ -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'); @@ -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 diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 2fb5b88687f..45aa625389d 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -701,9 +701,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join) { DBUG_PRINT("info", ("Subquery can't be converted to merged semi-join")); /* Test if the user has set a legal combination of optimizer switches. */ - if (!optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS) && - !optimizer_flag(thd, OPTIMIZER_SWITCH_MATERIALIZATION)) - my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0)); + DBUG_ASSERT(optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS | + OPTIMIZER_SWITCH_MATERIALIZATION)); /* Transform each subquery predicate according to its overloaded transformer. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 2d40943827f..af261299496 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2471,12 +2471,23 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd, "engine_condition_pushdown=on"); return false; } +static bool check_legal_optimizer_switch(sys_var *self, THD *thd, + set_var *var) +{ + if (var->save_result.ulonglong_value & (OPTIMIZER_SWITCH_MATERIALIZATION | + OPTIMIZER_SWITCH_IN_TO_EXISTS)) + { + return false; + } + my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0)); + return true; +} static Sys_var_flagset Sys_optimizer_switch( "optimizer_switch", "Fine-tune the optimizer behavior", SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG), optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT), - NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_legal_optimizer_switch), ON_UPDATE(fix_optimizer_switch)); static Sys_var_charptr Sys_pid_file( From b0df247db675a721198f2d4dbeb098cd57d932a3 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 10 Jul 2020 10:45:04 +0530 Subject: [PATCH 11/20] MDEV-22463: Element_type &Bounds_checked_array::operator[](size_t) [Element_type = Item *]: Assertion `n < m_size' failed. Allocate space for fields inside the window function (arguments, PARTITION BY and ORDER BY clause) in the ref pointer array. All fields inside the window function are part of the temporary table that is required for the window function computation. --- mysql-test/r/win.result | 35 +++++++++++++++++++++++++++++++++++ mysql-test/t/win.test | 16 ++++++++++++++++ sql/sql_lex.cc | 4 +++- sql/sql_lex.h | 13 +++++++++---- sql/sql_parse.cc | 10 ++++++++++ sql/sql_window.cc | 8 ++++++++ 6 files changed, 81 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 71953871295..019cfd6115d 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3808,5 +3808,40 @@ MIN(d) OVER () 1 DROP TABLE t1; # +# MDEV-22463: Element_type &Bounds_checked_array::operator[](size_t) [Element_type = Item *]: +# Assertion `n < m_size' failed +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT, g int, h INT, i INT); +INSERT INTO t1 SELECT seq,seq,seq,seq, seq,seq,seq,seq,seq FROM seq_1_to_5; +SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6); +ROW_NUMBER() OVER w2 +1 +2 +3 +4 +5 +SELECT a FROM t1 ORDER BY ROW_NUMBER() OVER (PARTITION BY -1,1,0,2,3,4,5,6,7,8); +a +1 +2 +3 +4 +5 +SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4); +a b +1 1 +2 2 +3 3 +4 4 +5 5 +SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6); +ROW_NUMBER() OVER w2 +1 +2 +3 +4 +5 +DROP TABLE t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index a768b893432..deed7de2d23 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -1,6 +1,7 @@ # # Window Functions Tests # +--source include/have_sequence.inc --disable_warnings drop table if exists t1,t2; @@ -2481,6 +2482,21 @@ INSERT INTO t1 VALUES (1),(2); SELECT MIN(d) OVER () FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-22463: Element_type &Bounds_checked_array::operator[](size_t) [Element_type = Item *]: +--echo # Assertion `n < m_size' failed +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT, d INT, e INT, f INT, g int, h INT, i INT); +INSERT INTO t1 SELECT seq,seq,seq,seq, seq,seq,seq,seq,seq FROM seq_1_to_5; + +SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6); +--sorted_result +SELECT a FROM t1 ORDER BY ROW_NUMBER() OVER (PARTITION BY -1,1,0,2,3,4,5,6,7,8); +SELECT a,b FROM t1 WINDOW w2 AS (PARTITION BY -1,1,0,2,3,4); +SELECT ROW_NUMBER() OVER w2 FROM t1 WINDOW w2 AS (PARTITION BY -1,0,1,2,3,4,5,6); +DROP TABLE t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2312ec34e7b..c39afdf9e10 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2140,6 +2140,7 @@ void st_select_lex::init_query() n_sum_items= 0; n_child_sum_items= 0; hidden_bit_fields= 0; + fields_in_window_functions= 0; subquery_in_having= explicit_limit= 0; is_item_list_lookup= 0; changed_elements= 0; @@ -2707,7 +2708,8 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) select_n_having_items + select_n_where_fields + order_group_num + - hidden_bit_fields) * 5; + hidden_bit_fields + + fields_in_window_functions) * 5; if (!ref_pointer_array.is_null()) { /* diff --git a/sql/sql_lex.h b/sql/sql_lex.h index d14843d0c24..965c3f29834 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -871,6 +871,14 @@ public: converted to a GROUP BY involving BIT fields. */ uint hidden_bit_fields; + /* + Number of fields used in the definition of all the windows functions. + This includes: + 1) Fields in the arguments + 2) Fields in the PARTITION BY clause + 3) Fields in the ORDER BY clause + */ + uint fields_in_window_functions; enum_parsing_place parsing_place; /* where we are parsing expression */ enum_parsing_place context_analysis_place; /* where we are in prepare */ bool with_sum_func; /* sum function indicator */ @@ -1180,10 +1188,7 @@ public: SQL_I_List win_order_list, Window_frame *win_frame); List window_funcs; - bool add_window_func(Item_window_func *win_func) - { - return window_funcs.push_back(win_func); - } + bool add_window_func(Item_window_func *win_func); bool have_window_funcs() const { return (window_funcs.elements !=0); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 66433d11d8f..2879e394877 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8556,6 +8556,11 @@ bool st_select_lex::add_window_def(THD *thd, win_frame); group_list= thd->lex->save_group_list; order_list= thd->lex->save_order_list; + if (parsing_place != SELECT_LIST) + { + fields_in_window_functions+= win_part_list_ptr->elements + + win_order_list_ptr->elements; + } return (win_def == NULL || window_specs.push_back(win_def)); } @@ -8577,6 +8582,11 @@ bool st_select_lex::add_window_spec(THD *thd, win_frame); group_list= thd->lex->save_group_list; order_list= thd->lex->save_order_list; + if (parsing_place != SELECT_LIST) + { + fields_in_window_functions+= win_part_list_ptr->elements + + win_order_list_ptr->elements; + } thd->lex->win_spec= win_spec; return (win_spec == NULL || window_specs.push_back(win_spec)); } diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 18075d179d5..612c6e692fe 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2969,6 +2969,14 @@ Window_funcs_computation::save_explain_plan(MEM_ROOT *mem_root, return xpl; } + +bool st_select_lex::add_window_func(Item_window_func *win_func) +{ + if (parsing_place != SELECT_LIST) + fields_in_window_functions+= win_func->window_func()->argument_count(); + return window_funcs.push_back(win_func); +} + ///////////////////////////////////////////////////////////////////////////// // Unneeded comments (will be removed when we develop a replacement for // the feature that was attempted here From f73db93329c1d22f9ca5696b46d50d137e6095ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 13 Jul 2020 19:56:20 +0300 Subject: [PATCH 12/20] MDEV-23027 symlink_wsrep_sst_rsync target built when WITH_WSREP is off Only install wsrep scripts and links if WSREP_ON is actually set --- scripts/CMakeLists.txt | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index b139b51e296..536f586a17b 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -316,6 +316,36 @@ ELSE() SET(WSREP_SOURCE wsrep_sst_common ) + + SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan) + ADD_CUSTOM_COMMAND( + OUTPUT ${wsrep_sst_rsync_wan} + COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink + wsrep_sst_rsync + wsrep_sst_rsync_wan + ) + ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync + ALL + DEPENDS ${wsrep_sst_rsync_wan} + ) + INSTALL( + FILES ${wsrep_sst_rsync_wan} + DESTINATION ${INSTALL_BINDIR} + COMPONENT Server + ) + + FOREACH(file ${WSREP_SOURCE}) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh + ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY) + IF(NOT ${file}_COMPONENT) + SET(${file}_COMPONENT Server) + ENDIF() + INSTALL(FILES + ${CMAKE_CURRENT_BINARY_DIR}/${file} + DESTINATION ${INSTALL_BINDIR} + COMPONENT ${${file}_COMPONENT} + ) + ENDFOREACH() ENDIF() IF (NOT WITHOUT_SERVER) SET(SERVER_SCRIPTS @@ -368,35 +398,6 @@ ELSE() COMPONENT ${${file}_COMPONENT} ) ENDFOREACH() - SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan) - ADD_CUSTOM_COMMAND( - OUTPUT ${wsrep_sst_rsync_wan} - COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink - wsrep_sst_rsync - wsrep_sst_rsync_wan - ) - ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync - ALL - DEPENDS ${wsrep_sst_rsync_wan} - ) - INSTALL( - FILES ${wsrep_sst_rsync_wan} - DESTINATION ${INSTALL_BINDIR} - COMPONENT Server - ) - - FOREACH(file ${WSREP_SOURCE}) - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh - ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY) - IF(NOT ${file}_COMPONENT) - SET(${file}_COMPONENT Server) - ENDIF() - INSTALL(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${file} - DESTINATION ${INSTALL_BINDIR} - COMPONENT ${${file}_COMPONENT} - ) - ENDFOREACH() ENDIF() # Install libgcc as mylibgcc.a From 194a720e28ed426552558b32c68577db9f29ab2e Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 10 Jul 2020 17:50:04 +0530 Subject: [PATCH 13/20] MDEV-22890 DEADLOCK of threads detected: row0sel.cc S-LOCK / btr0cur.cc S-LOCK / row0quiesce.cc X-LOCK Problem: ======= - Read operations are always allowed to hold a secondary index leaf latch and then look up the corresponding clustered index record. Flush table operation acquires secondary index latch while holding a clustered index latch. It leads to deadlock violation. Fix: ==== - Flush table operation should acquire secondary index before taking clustered index to avoid deadlock violation with select operation. --- storage/innobase/include/dict0dict.ic | 8 +++++--- storage/xtradb/include/dict0dict.ic | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index bd1d529f753..93a6c4a7cc1 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -1026,16 +1026,18 @@ dict_table_x_lock_indexes( /*======================*/ dict_table_t* table) /*!< in: table */ { - dict_index_t* index; - ut_ad(mutex_own(&dict_sys->mutex)); + dict_index_t* clust_index = dict_table_get_first_index(table); + /* Loop through each index of the table and lock them */ - for (index = dict_table_get_first_index(table); + for (dict_index_t* index = dict_table_get_next_index(clust_index); index != NULL; index = dict_table_get_next_index(index)) { rw_lock_x_lock(dict_index_get_lock(index)); } + + rw_lock_x_lock(dict_index_get_lock(clust_index)); } /*********************************************************************//** diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index 475391a3f75..c5ea95b7c08 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -1026,16 +1026,18 @@ dict_table_x_lock_indexes( /*======================*/ dict_table_t* table) /*!< in: table */ { - dict_index_t* index; - ut_ad(mutex_own(&dict_sys->mutex)); + dict_index_t* clust_index = dict_table_get_first_index(table); + /* Loop through each index of the table and lock them */ - for (index = dict_table_get_first_index(table); + for (dict_index_t* index = dict_table_get_next_index(clust_index); index != NULL; index = dict_table_get_next_index(index)) { rw_lock_x_lock(dict_index_get_lock(index)); } + + rw_lock_x_lock(dict_index_get_lock(clust_index)); } /*********************************************************************//** From e80183dbd595984a42e1265d7a257d8ca14b3bb8 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 14 Jul 2020 13:22:59 +0530 Subject: [PATCH 14/20] MDEV-15662 mariabackup.huge_lsn fails sporadically with "log sequence number is in the future" - Problem is that test case creates iblogfile* files. So existing ibdata pages could point to future LSN. Fix is that taking the backup of data before iblogfile* creation and apply it before exiting the test case. --- mysql-test/suite/mariabackup/huge_lsn.result | 4 ++++ mysql-test/suite/mariabackup/huge_lsn.test | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/mysql-test/suite/mariabackup/huge_lsn.result b/mysql-test/suite/mariabackup/huge_lsn.result index f2202c20968..b519fb1e961 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.result +++ b/mysql-test/suite/mariabackup/huge_lsn.result @@ -17,3 +17,7 @@ SELECT * FROM t; i 1 DROP TABLE t; +# shutdown server +# remove datadir +# xtrabackup move back +# restart server diff --git a/mysql-test/suite/mariabackup/huge_lsn.test b/mysql-test/suite/mariabackup/huge_lsn.test index baf577769c0..9b89530a7f1 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.test +++ b/mysql-test/suite/mariabackup/huge_lsn.test @@ -9,6 +9,10 @@ let INNODB_PAGE_SIZE=`select @@innodb_page_size`; let MYSQLD_DATADIR=`select @@datadir`; call mtr.add_suppression("InnoDB: New log files created"); +let $targetdir_old=$MYSQLTEST_VARDIR/tmp/backup_1; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir_old; +--enable_result_log --source include/shutdown_mysqld.inc perl; @@ -52,3 +56,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir; SELECT * FROM t; DROP TABLE t; rmdir $targetdir; +let $targetdir= $targetdir_old; +exec $XTRABACKUP --prepare --target-dir=$targetdir; +--source include/restart_and_restore.inc +rmdir $targetdir_old; From 6b6c012f330cbbdcdee32333f16813764e5ed466 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 14 Jul 2020 09:36:38 +0200 Subject: [PATCH 15/20] Merge branch '10.4-MDEV-18838' of https://github.com/codership/mariadb-server into 10.2-MDEV-18838 --- mysql-test/suite/galera/r/galera_toi_truncate.result | 6 +++--- mysql-test/suite/galera/t/galera_toi_truncate.test | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result index f299eacda00..c92da869a02 100644 --- a/mysql-test/suite/galera/r/galera_toi_truncate.result +++ b/mysql-test/suite/galera/r/galera_toi_truncate.result @@ -5,12 +5,12 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; connection node_2; SET SESSION wsrep_retry_autocommit = 0; INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; connection node_1; -TRUNCATE TABLE t1;; +TRUNCATE TABLE t1; connection node_2; ERROR 40001: Deadlock: wsrep aborted transaction -connection node_1; -connection node_2; SELECT COUNT(*) AS EXPECT_0 FROM t1; EXPECT_0 0 diff --git a/mysql-test/suite/galera/t/galera_toi_truncate.test b/mysql-test/suite/galera/t/galera_toi_truncate.test index 30e0e802816..5b23a8c3f3e 100644 --- a/mysql-test/suite/galera/t/galera_toi_truncate.test +++ b/mysql-test/suite/galera/t/galera_toi_truncate.test @@ -25,17 +25,18 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_retry_autocommit = 0; --send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8 +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Sending data%' AND INFO LIKE 'INSERT INTO t1 (f1)%'; +--source include/wait_condition.inc + --connection node_1 ---send TRUNCATE TABLE t1; +TRUNCATE TABLE t1; --connection node_2 --error ER_LOCK_DEADLOCK --reap ---connection node_1 ---reap - ---connection node_2 SELECT COUNT(*) AS EXPECT_0 FROM t1; --connection node_1 From dc58987eb7112bd60122114abd56e6f9438f457f Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 14 Jul 2020 14:26:49 +0530 Subject: [PATCH 16/20] MDEV-22765 i_s_fts_index_cache_fill_one_index() is not protect by the lock - i_s_fts_index_cache_fill() should take shared lock of fts cache before accessing index cache to avoid reading stale data. --- storage/innobase/handler/i_s.cc | 3 +++ storage/xtradb/handler/i_s.cc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 21eb9da481e..894e798ee27 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -3375,6 +3375,8 @@ no_fts: conv_str.f_len = sizeof word; conv_str.f_str = word; + rw_lock_s_lock(&cache->lock); + for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { fts_index_cache_t* index_cache; @@ -3385,6 +3387,7 @@ no_fts: index_cache, thd, &conv_str, tables)); } + rw_lock_s_unlock(&cache->lock); dict_table_close(user_table, FALSE, FALSE); rw_lock_s_unlock(&dict_operation_lock); diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 8eb53502da8..8d7612ab16d 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -3367,6 +3367,8 @@ no_fts: conv_str.f_len = sizeof word; conv_str.f_str = word; + rw_lock_s_lock(&cache->lock); + for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { fts_index_cache_t* index_cache; @@ -3377,6 +3379,7 @@ no_fts: index_cache, thd, &conv_str, tables)); } + rw_lock_s_unlock(&cache->lock); dict_table_close(user_table, FALSE, FALSE); rw_lock_s_unlock(&dict_operation_lock); From 8d061996e6531b2809aefb0ed96e0662b2c2882e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 14 Jul 2020 13:21:01 +0300 Subject: [PATCH 17/20] MDEV-23161 avg_count_reset may wrongly be NULL in I_S.INNODB_METRICS This issue was originally reported by Fungo Wang, along with a fix, as MySQL Bug #98990. His suggested fix was applied as part of mysql/mysql-server@a003fc373d1adb3ccea353b5d7d83f6c4c552383 and released in MySQL 5.7.31. i_s_metrics_fill(): Add the missing call to Field::set_notnull(), and simplify some code. --- storage/innobase/handler/i_s.cc | 27 ++++++++++++++------------- storage/xtradb/handler/i_s.cc | 27 ++++++++++++++------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 894e798ee27..145a5708423 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, MariaDB Corporation. 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 @@ -2557,7 +2557,7 @@ i_s_metrics_fill( time_diff = 0; } - /* Unless MONITOR__NO_AVERAGE is marked, we will need + /* Unless MONITOR_NO_AVERAGE is set, we must to calculate the average value. If this is a monitor set owner marked by MONITOR_SET_OWNER, divide the value by another counter (number of calls) designated @@ -2565,8 +2565,9 @@ i_s_metrics_fill( Otherwise average the counter value by the time between the time that the counter is enabled and time it is disabled or time it is sampled. */ - if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) - && (monitor_info->monitor_type & MONITOR_SET_OWNER) + if ((monitor_info->monitor_type + & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER)) + == MONITOR_SET_OWNER && monitor_info->monitor_related_id) { mon_type_t value_start = MONITOR_VALUE_SINCE_START( @@ -2582,18 +2583,18 @@ i_s_metrics_fill( fields[METRIC_AVG_VALUE_START]->set_null(); } - if (MONITOR_VALUE(monitor_info->monitor_related_id)) { - OK(fields[METRIC_AVG_VALUE_RESET]->store( - MONITOR_VALUE(count) - / MONITOR_VALUE( - monitor_info->monitor_related_id), - FALSE)); + if (mon_type_t related_value = + MONITOR_VALUE(monitor_info->monitor_related_id)) { + OK(fields[METRIC_AVG_VALUE_RESET] + ->store(MONITOR_VALUE(count) + / related_value, false)); + fields[METRIC_AVG_VALUE_RESET]->set_notnull(); } else { fields[METRIC_AVG_VALUE_RESET]->set_null(); } - } else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) - && !(monitor_info->monitor_type - & MONITOR_DISPLAY_CURRENT)) { + } else if (!(monitor_info->monitor_type + & (MONITOR_NO_AVERAGE + | MONITOR_DISPLAY_CURRENT))) { if (time_diff) { OK(fields[METRIC_AVG_VALUE_START]->store( (double) MONITOR_VALUE_SINCE_START( diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 8d7612ab16d..9813e993411 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, MariaDB Corporation. 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 @@ -2553,7 +2553,7 @@ i_s_metrics_fill( time_diff = 0; } - /* Unless MONITOR__NO_AVERAGE is marked, we will need + /* Unless MONITOR_NO_AVERAGE is set, we must to calculate the average value. If this is a monitor set owner marked by MONITOR_SET_OWNER, divide the value by another counter (number of calls) designated @@ -2561,8 +2561,9 @@ i_s_metrics_fill( Otherwise average the counter value by the time between the time that the counter is enabled and time it is disabled or time it is sampled. */ - if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) - && (monitor_info->monitor_type & MONITOR_SET_OWNER) + if ((monitor_info->monitor_type + & (MONITOR_NO_AVERAGE | MONITOR_SET_OWNER)) + == MONITOR_SET_OWNER && monitor_info->monitor_related_id) { mon_type_t value_start = MONITOR_VALUE_SINCE_START( @@ -2578,18 +2579,18 @@ i_s_metrics_fill( fields[METRIC_AVG_VALUE_START]->set_null(); } - if (MONITOR_VALUE(monitor_info->monitor_related_id)) { - OK(fields[METRIC_AVG_VALUE_RESET]->store( - MONITOR_VALUE(count) - / MONITOR_VALUE( - monitor_info->monitor_related_id), - FALSE)); + if (mon_type_t related_value = + MONITOR_VALUE(monitor_info->monitor_related_id)) { + OK(fields[METRIC_AVG_VALUE_RESET] + ->store(MONITOR_VALUE(count) + / related_value, false)); + fields[METRIC_AVG_VALUE_RESET]->set_notnull(); } else { fields[METRIC_AVG_VALUE_RESET]->set_null(); } - } else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) - && !(monitor_info->monitor_type - & MONITOR_DISPLAY_CURRENT)) { + } else if (!(monitor_info->monitor_type + & (MONITOR_NO_AVERAGE + | MONITOR_DISPLAY_CURRENT))) { if (time_diff) { OK(fields[METRIC_AVG_VALUE_START]->store( (double) MONITOR_VALUE_SINCE_START( From 142f85142ad5a5ad5bfea057e13916e9b6609520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 14 Jul 2020 13:25:18 +0300 Subject: [PATCH 18/20] Update the InnoDB version number to 5.6.49 There were no InnoDB changes between MySQL 5.6.48 and MySQL 5.6.49. --- mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 2 +- storage/innobase/include/univ.i | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 43a9c199864..1dc12226eda 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -1214,7 +1214,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.48 +-GLOBAL_VALUE 5.6.49 +GLOBAL_VALUE 5.6.47-87.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 8a7685f7798..ee502508839 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -684,7 +684,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.48 +-GLOBAL_VALUE 5.6.49 +GLOBAL_VALUE 5.6.47-87.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 7019dda908b..d5d49a9b193 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2401,7 +2401,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.48 +GLOBAL_VALUE 5.6.49 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index fb3d14a908e..bb355e0fef5 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 48 +#define INNODB_VERSION_BUGFIX 49 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; From 67a03b7c947f5a0cfddbe1acc5e560fc737b0848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 14 Jul 2020 13:32:32 +0300 Subject: [PATCH 19/20] XtraDB 5.6.48-88.0 The only InnoDB changes between Percona XtraDB Server 5.6.47-87.0 and 5.6.48-88.0 are related to InnoDB changes between MySQL 5.6.47 and MySQL 5.6.48, which we had already applied. --- mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff | 2 +- storage/xtradb/include/univ.i | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 1dc12226eda..6181b49aa12 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -1215,7 +1215,7 @@ VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.49 -+GLOBAL_VALUE 5.6.47-87.0 ++GLOBAL_VALUE 5.6.48-88.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index ee502508839..bb59709ef4f 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -685,7 +685,7 @@ VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.49 -+GLOBAL_VALUE 5.6.47-87.0 ++GLOBAL_VALUE 5.6.48-88.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 0b7ab3e389e..c0849bf0e2d 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 47 +#define INNODB_VERSION_BUGFIX 48 #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 87.0 +#define PERCONA_INNODB_VERSION 88.0 #endif /* Enable UNIV_LOG_ARCHIVE in XtraDB */ From 07e89bf7d15ba9e9a3b21d087c20d687446b2ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 14 Jul 2020 15:13:40 +0300 Subject: [PATCH 20/20] MDEV-23163 Merge new release of InnoDB 5.7.31 to 10.2 The only InnoDB change between MySQL 5.7.30 and MySQL 5.7.31 that is applicable to MariaDB Server was applied in commit 8d061996e6531b2809aefb0ed96e0662b2c2882e (MDEV-23161). --- storage/innobase/include/univ.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index dbb1048a2e5..c7474cff4ea 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 7 -#define INNODB_VERSION_BUGFIX 30 +#define INNODB_VERSION_BUGFIX 31 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins;