summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CREDITS3
-rw-r--r--client/mysqltest.cc2
-rw-r--r--extra/CMakeLists.txt11
-rw-r--r--extra/mariabackup/backup_copy.cc3
-rw-r--r--extra/mariabackup/innobackupex.cc2
-rw-r--r--extra/mariabackup/xtrabackup.cc6
-rw-r--r--include/my_service_manager.h (renamed from include/my_systemd.h)11
-rw-r--r--mysql-test/include/start_mysqld.inc3
-rw-r--r--mysql-test/include/wait_until_connected_again.inc6
-rw-r--r--mysql-test/main/connect.result24
-rw-r--r--mysql-test/main/connect.test18
-rw-r--r--mysql-test/main/contributors.result3
-rw-r--r--mysql-test/main/derived_cond_pushdown.result15
-rw-r--r--mysql-test/main/derived_cond_pushdown.test13
-rw-r--r--mysql-test/main/func_misc.result11
-rw-r--r--mysql-test/main/func_misc.test11
-rw-r--r--mysql-test/main/func_str.result37
-rw-r--r--mysql-test/main/func_str.test35
-rw-r--r--mysql-test/main/lock.result16
-rw-r--r--mysql-test/main/lock.test21
-rw-r--r--mysql-test/main/mdev375.result12
-rw-r--r--mysql-test/main/mdev375.test11
-rw-r--r--mysql-test/main/myisam.result7
-rw-r--r--mysql-test/main/myisam.test7
-rw-r--r--mysql-test/main/myisam_recover.result3
-rw-r--r--mysql-test/main/myisam_recover.test3
-rw-r--r--mysql-test/main/mysqld--help,win.rdiff4
-rw-r--r--mysql-test/main/mysqld--help.result4
-rw-r--r--mysql-test/main/mysqltest.test2
-rw-r--r--mysql-test/main/perror.result2
-rw-r--r--mysql-test/main/ps.result2
-rw-r--r--mysql-test/main/sp.result2
-rw-r--r--mysql-test/main/sp.test2
-rw-r--r--mysql-test/main/statistics.result18
-rw-r--r--mysql-test/main/statistics.test19
-rw-r--r--mysql-test/main/variables.result7
-rw-r--r--mysql-test/main/variables.test3
-rw-r--r--mysql-test/main/view.result197
-rw-r--r--mysql-test/main/view.test196
-rwxr-xr-xmysql-test/mysql-test-run.pl1
-rw-r--r--mysql-test/std_data/binlog-header.logbin120 -> 0 bytes
-rw-r--r--mysql-test/suite/binlog_encryption/rpl_typeconv.result80
-rw-r--r--mysql-test/suite/encryption/r/innodb-remove-encryption.result44
-rw-r--r--mysql-test/suite/encryption/t/innodb-remove-encryption.test59
-rw-r--r--mysql-test/suite/galera/disabled.def56
-rw-r--r--mysql-test/suite/galera/include/kill_galera.inc1
-rw-r--r--mysql-test/suite/galera/r/MW-284.result5
-rw-r--r--mysql-test/suite/galera/r/MW-44.result11
-rw-r--r--mysql-test/suite/galera/r/galera_as_master.result2
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_row_image.result14
-rw-r--r--mysql-test/suite/galera/r/galera_gra_log.result18
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_slave.result3
-rw-r--r--mysql-test/suite/galera/r/galera_lock_table.result4
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_simple.result7
-rw-r--r--mysql-test/suite/galera/r/galera_suspend_slave.result4
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result12
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result2
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result3
-rw-r--r--mysql-test/suite/galera/r/lp1376747-2.result3
-rw-r--r--mysql-test/suite/galera/r/lp1376747.result3
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33.result5
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#90.result13
-rw-r--r--mysql-test/suite/galera/r/pxc-421.result4
-rw-r--r--mysql-test/suite/galera/t/MW-284.test9
-rw-r--r--mysql-test/suite/galera/t/MW-44.test5
-rw-r--r--mysql-test/suite/galera/t/galera_as_master.test16
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_fragment.test1
-rw-r--r--mysql-test/suite/galera/t/galera_gra_log.test13
-rw-r--r--mysql-test/suite/galera/t/galera_gtid_slave.test19
-rw-r--r--mysql-test/suite/galera/t/galera_lock_table.test7
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_simple.test7
-rw-r--r--mysql-test/suite/galera/t/galera_suspend_slave.test9
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test2
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test11
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test9
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.test7
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test2
-rw-r--r--mysql-test/suite/galera/t/lp1376747-2.test7
-rw-r--r--mysql-test/suite/galera/t/lp1376747.test7
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#33.test10
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#90.test2
-rw-r--r--mysql-test/suite/galera/t/pxc-421.test10
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_weight.test5
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk.result52
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk.test31
-rw-r--r--mysql-test/suite/innodb/r/mdev-15707.result24
-rw-r--r--mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test5
-rw-r--r--mysql-test/suite/innodb/t/mdev-15707.opt1
-rw-r--r--mysql-test/suite/innodb/t/mdev-15707.test28
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result16
-rw-r--r--mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result16
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test17
-rw-r--r--mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test17
-rw-r--r--mysql-test/suite/rpl/include/type_conversions.test133
-rw-r--r--mysql-test/suite/rpl/r/rpl_typeconv.result80
-rw-r--r--mysql-test/suite/sys_vars/r/host_cache_size_auto.result2
-rw-r--r--mysql-test/suite/sys_vars/r/max_connections_basic.result20
-rw-r--r--mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result20
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result12
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result12
-rw-r--r--mysql-test/suite/sys_vars/r/table_open_cache_basic.result24
-rw-r--r--mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_innodb.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt1
-rw-r--r--mysys/my_addr_resolve.c3
-rw-r--r--sql-common/client.c7
-rw-r--r--sql/contributors.h3
-rw-r--r--sql/item.cc10
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_strfunc.h6
-rw-r--r--sql/mysqld.cc96
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/set_var.h10
-rw-r--r--sql/share/errmsg-utf8.txt4
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_parse.cc34
-rw-r--r--sql/sql_reload.cc2
-rw-r--r--sql/sql_statistics.cc22
-rw-r--r--sql/sql_type.cc56
-rw-r--r--sql/sql_type.h11
-rw-r--r--sql/sys_vars.cc8
-rw-r--r--sql/table.h1
-rw-r--r--storage/innobase/CMakeLists.txt1
-rw-r--r--storage/innobase/buf/buf0dump.cc9
-rw-r--r--storage/innobase/buf/buf0flu.cc13
-rw-r--r--storage/innobase/dict/dict0dict.cc14
-rw-r--r--storage/innobase/fil/fil0crypt.cc57
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/univ.i4
-rw-r--r--storage/innobase/log/log0log.cc60
-rw-r--r--storage/innobase/log/log0recv.cc11
-rw-r--r--storage/innobase/os/os0file.cc96
-rw-r--r--storage/innobase/srv/srv0srv.cc13
-rw-r--r--storage/innobase/trx/trx0roll.cc13
-rw-r--r--storage/oqgraph/graphcore-graph.cc1
-rw-r--r--storage/oqgraph/graphcore.cc1
-rw-r--r--storage/oqgraph/oqgraph_shim.h2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result7
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test10
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db917.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/db917.test4
145 files changed, 1963 insertions, 425 deletions
diff --git a/CREDITS b/CREDITS
index 7572f6f5dd9..1788b6304fe 100644
--- a/CREDITS
+++ b/CREDITS
@@ -5,15 +5,14 @@ The current main sponsors of the MariaDB Foundation are:
Alibaba Cloud https://www.alibabacloud.com/ (2017)
Booking.com https://www.booking.com (2013)
+MariaDB Corporation https://www.mariadb.com (2013)
Microsoft https://microsoft.com/ (2017)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
-MariaDB Corporation https://www.mariadb.com (2013)
Visma https://visma.com (2015)
Acronis http://acronis.com (2016)
Nexedi https://www.nexedi.com (2016)
-Automattic https://automattic.com (2014)
Tencent Game DBA http://tencentdba.com/about (2016)
Tencent TDSQL http://tdsql.org (2016)
Verkkokauppa.com https://www.verkkokauppa.com (2015)
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index efc25f38984..433898aa34d 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -522,7 +522,7 @@ struct st_match_err
struct st_expected_errors
{
- struct st_match_err err[10];
+ struct st_match_err err[12];
uint count;
};
static struct st_expected_errors saved_expected_errors;
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index d3626733bd3..cd099dedf63 100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -73,6 +73,17 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
# We use the InnoDB code directly in case the code changes.
ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM")
+ # Avoid generating Hardware Capabilities due to crc32 instructions
+ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
+ MY_CHECK_CXX_COMPILER_FLAG("-Wa,-nH")
+ IF(have_CXX__Wa__nH)
+ ADD_COMPILE_FLAGS(
+ ../storage/innobase/ut/ut0crc32.cc
+ COMPILE_FLAGS "-Wa,-nH"
+ )
+ ENDIF()
+ ENDIF()
+
SET(INNOBASE_SOURCES
../storage/innobase/buf/buf0checksum.cc
../storage/innobase/ut/ut0crc32.cc
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index a2677f778f4..b15887fee4c 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1816,7 +1816,8 @@ copy_back()
is_ibdata_file = false;
for (Tablespace::const_iterator iter(srv_sys_space.begin()),
end(srv_sys_space.end()); iter != end; ++iter) {
- if (strcmp(iter->name(), filename) == 0) {
+ const char *ibfile = base_name(iter->name());
+ if (strcmp(ibfile, filename) == 0) {
is_ibdata_file = true;
break;
}
diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc
index c15e02cdff3..1e174c0fec8 100644
--- a/extra/mariabackup/innobackupex.cc
+++ b/extra/mariabackup/innobackupex.cc
@@ -241,7 +241,7 @@ static struct my_option ibx_long_options[] =
{"galera-info", OPT_GALERA_INFO, "This options creates the "
"xtrabackup_galera_info file which contains the local node state at "
"the time of the backup. Option should be used when performing the "
- "backup of Percona-XtraDB-Cluster. Has no effect when backup locks "
+ "backup of MariaDB Galera Cluster. Has no effect when backup locks "
"are used to create the backup.",
(uchar *) &opt_ibx_galera_info, (uchar *) &opt_ibx_galera_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 274bf050886..745a6adf8b9 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -812,7 +812,7 @@ struct my_option xb_client_options[] =
{"galera-info", OPT_GALERA_INFO, "This options creates the "
"xtrabackup_galera_info file which contains the local node state at "
"the time of the backup. Option should be used when performing the "
- "backup of Percona-XtraDB-Cluster. Has no effect when backup locks "
+ "backup of MariaDB Galera Cluster. Has no effect when backup locks "
"are used to create the backup.",
(uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -5687,6 +5687,10 @@ static int main_low(char** argv)
xtrabackup_incremental = NULL;
}
+ if (xtrabackup_stream && !xtrabackup_backup) {
+ msg("Warning: --stream parameter is ignored, it only works together with --backup.\n");
+ }
+
if (!xb_init()) {
return(EXIT_FAILURE);
}
diff --git a/include/my_systemd.h b/include/my_service_manager.h
index bef75576422..4d88e992b5e 100644
--- a/include/my_systemd.h
+++ b/include/my_service_manager.h
@@ -16,8 +16,8 @@
*/
-#ifndef MY_SYSTEMD_INCLUDED
-#define MY_SYSTEMD_INCLUDED
+#ifndef MY_SERVICE_MANAGER_INCLUDED
+#define MY_SERVICE_MANAGER_INCLUDED
#if defined(HAVE_SYSTEMD) && !defined(EMBEDDED_LIBRARY)
/*
@@ -26,9 +26,14 @@
*/
#define __STDC_FORMAT_MACROS
#include <systemd/sd-daemon.h>
+/** INTERVAL in seconds followed by printf style status */
+#define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \
+ sd_notifyf(0, "STATUS=" FMTSTR "\nEXTEND_TIMEOUT_USEC=%u\n", ##__VA_ARGS__, INTERVAL * 1000000)
+
#else
#define sd_notify(X, Y)
#define sd_notifyf(E, F, ...)
+#define service_manager_extend_timeout(I, FMTSTR, ...)
#endif
-#endif /* MY_SYSTEMD_INCLUDED */
+#endif /* MY_SERVICE_MANAGER_INCLUDED */
diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc
index 04dff714d49..e31f26aad8c 100644
--- a/mysql-test/include/start_mysqld.inc
+++ b/mysql-test/include/start_mysqld.inc
@@ -16,9 +16,6 @@ if (!$restart_parameters)
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
-# Wait for wsrep
---source include/wait_wsrep_ready.inc
-
# Turn off reconnect again
--disable_reconnect
diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc
index bdd99af2fc1..2e80ea2ed7d 100644
--- a/mysql-test/include/wait_until_connected_again.inc
+++ b/mysql-test/include/wait_until_connected_again.inc
@@ -23,3 +23,9 @@ while ($mysql_errno)
}
--enable_query_log
--enable_result_log
+
+# WSREP: SHOW STATUS queries are allowed even if wsrep
+# is not ready. Make sure wsrep is ready before
+# returning from this script
+
+--source include/wait_wsrep_ready.inc
diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result
index f36483e6d8d..b05d0ea9fea 100644
--- a/mysql-test/main/connect.result
+++ b/mysql-test/main/connect.result
@@ -182,8 +182,16 @@ drop table t1;
CREATE USER mysqltest_u1@localhost;
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
-SET GLOBAL max_connections = 3;
+SET GLOBAL max_connections = 10;
SET GLOBAL event_scheduler = ON;
+connect tmp_con1,localhost,mysqltest_u1,,;
+connect tmp_con2,localhost,mysqltest_u1,,;
+connect tmp_con3,localhost,mysqltest_u1,,;
+connect tmp_con4,localhost,mysqltest_u1,,;
+connect tmp_con5,localhost,mysqltest_u1,,;
+connect tmp_con6,localhost,mysqltest_u1,,;
+connect tmp_con7,localhost,mysqltest_u1,,;
+connection default;
# -- Waiting for Event Scheduler to start...
@@ -227,6 +235,13 @@ event_scheduler
mysqltest_u1
mysqltest_u1
mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
+mysqltest_u1
root
# -- Resetting variables...
@@ -242,6 +257,13 @@ disconnect con_1;
disconnect con_2;
disconnect con_3;
disconnect con_super_1;
+disconnect tmp_con1;
+disconnect tmp_con2;
+disconnect tmp_con3;
+disconnect tmp_con4;
+disconnect tmp_con5;
+disconnect tmp_con6;
+disconnect tmp_con7;
# -- Restoring default connection...
connect default,localhost,root,,test;
diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test
index 20989e70ef9..c2d44c08e22 100644
--- a/mysql-test/main/connect.test
+++ b/mysql-test/main/connect.test
@@ -143,9 +143,18 @@ GRANT USAGE ON *.* TO mysqltest_u1@localhost;
--echo
let $saved_max_connections = `SELECT @@global.max_connections`;
-SET GLOBAL max_connections = 3;
+SET GLOBAL max_connections = 10;
SET GLOBAL event_scheduler = ON;
+connect (tmp_con1,localhost,mysqltest_u1,,);
+connect (tmp_con2,localhost,mysqltest_u1,,);
+connect (tmp_con3,localhost,mysqltest_u1,,);
+connect (tmp_con4,localhost,mysqltest_u1,,);
+connect (tmp_con5,localhost,mysqltest_u1,,);
+connect (tmp_con6,localhost,mysqltest_u1,,);
+connect (tmp_con7,localhost,mysqltest_u1,,);
+connection default;
+
--echo
--echo # -- Waiting for Event Scheduler to start...
let $wait_condition =
@@ -230,6 +239,13 @@ let $wait_condition =
--disconnect con_2
--disconnect con_3
--disconnect con_super_1
+--disconnect tmp_con1
+--disconnect tmp_con2
+--disconnect tmp_con3
+--disconnect tmp_con4
+--disconnect tmp_con5
+--disconnect tmp_con6
+--disconnect tmp_con7
--echo
--echo # -- Restoring default connection...
diff --git a/mysql-test/main/contributors.result b/mysql-test/main/contributors.result
index 927c0bcccbf..36d033f4cb3 100644
--- a/mysql-test/main/contributors.result
+++ b/mysql-test/main/contributors.result
@@ -4,13 +4,12 @@ Booking.com https://www.booking.com Founding member, Platinum Sponsor of the Mar
Alibaba Cloud https://www.alibabacloud.com/ Platinum Sponsor of the MariaDB Foundation
Tencent Cloud https://cloud.tencent.com Platinum Sponsor of the MariaDB Foundation
Microsoft https://microsoft.com/ Platinum Sponsor of the MariaDB Foundation
-MariaDB Corporation https://mariadb.com Founding member, Gold Sponsor of the MariaDB Foundation
+MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the MariaDB Foundation
Visma https://visma.com Gold Sponsor of the MariaDB Foundation
DBS https://dbs.com Gold Sponsor of the MariaDB Foundation
IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation
Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation
Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation
-Auttomattic https://automattic.com Bronze Sponsor of the MariaDB Foundation
Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation
Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index 5edd91faf16..6887ad11284 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -12763,6 +12763,21 @@ EXPLAIN
}
DROP TABLE t1,t2;
#
+# MDEV-15765: pushing condition with temporal constants
+# into constant tables
+#
+select * from (select date('2018-01-01') as d
+union all
+select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
+2018-01-01
+select * from (select date('2018-01-01') as d) as t
+where t.d between date ('2017-01-01') and date ('2019-01-01');
+d
+2018-01-01
+#
# MDEV-10855: Pushdown into derived with window functions
#
set @save_optimizer_switch= @@optimizer_switch;
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 2188cc00533..234f88976c9 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -2208,6 +2208,19 @@ EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-15765: pushing condition with temporal constants
+--echo # into constant tables
+--echo #
+
+select * from (select date('2018-01-01') as d
+ union all
+ select date('2018-01-01') as d) as t
+ where t.d between date ('2017-01-01') and date ('2019-01-01');
+
+select * from (select date('2018-01-01') as d) as t
+ where t.d between date ('2017-01-01') and date ('2019-01-01');
+
# Start of 10.3 tests
--echo #
diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result
index 804a563f401..e7a416f8ea6 100644
--- a/mysql-test/main/func_misc.result
+++ b/mysql-test/main/func_misc.result
@@ -585,6 +585,17 @@ SELECT NAME_CONST('a', -(1)) OR 1;
NAME_CONST('a', -(1)) OR 1
1
#
+# MDEV-15630 uuid() function evaluates at wrong time in query
+#
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
+COUNT(1) uid
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+DROP TABLE t1;
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test
index 9f452e632ec..f144236bfdb 100644
--- a/mysql-test/main/func_misc.test
+++ b/mysql-test/main/func_misc.test
@@ -607,6 +607,17 @@ SELECT NAME_CONST('a', -(1 AND 2)) OR 1;
SELECT NAME_CONST('a', -(1)) OR 1;
--echo #
+--echo # MDEV-15630 uuid() function evaluates at wrong time in query
+--echo #
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+--replace_column 2 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 2b376373f51..07dca08c819 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -4755,6 +4755,43 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select char(0xdf) AS `CHAR(0xDF)`
#
+# MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+session_id varchar(255) DEFAULT NULL,
+directory mediumtext,
+checksum int(10) DEFAULT NULL,
+last_update datetime DEFAULT NULL,
+PRIMARY KEY (id),
+KEY lastupdate (last_update)
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28');
+UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW();
+SELECT directory IS NULL FROM t1;
+directory IS NULL
+0
+DROP TABLE t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL PRIMARY KEY,
+directory mediumtext
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554'));
+SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1;
+AES_DECRYPT(directory,'95F5A1F52A554')
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t1;
+SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554');
+CREATE TABLE t1 (
+id int(11) NOT NULL PRIMARY KEY,
+directory mediumtext
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554'));
+SELECT * FROM t1;
+id directory
+1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t1;
+#
# Start of 10.1 tests
#
#
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index dbb7502a3ec..4165e147768 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -1822,6 +1822,41 @@ EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`);
EXPLAIN EXTENDED SELECT CHAR(0xDF);
--echo #
+--echo # MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data
+--echo #
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ session_id varchar(255) DEFAULT NULL,
+ directory mediumtext,
+ checksum int(10) DEFAULT NULL,
+ last_update datetime DEFAULT NULL,
+ PRIMARY KEY (id),
+ KEY lastupdate (last_update)
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28');
+UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW();
+SELECT directory IS NULL FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL PRIMARY KEY,
+ directory mediumtext
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554'));
+SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1;
+DROP TABLE t1;
+
+SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554');
+CREATE TABLE t1 (
+ id int(11) NOT NULL PRIMARY KEY,
+ directory mediumtext
+) DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554'));
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysql-test/main/lock.result b/mysql-test/main/lock.result
index 00dbb166ffb..e3fd16ee59a 100644
--- a/mysql-test/main/lock.result
+++ b/mysql-test/main/lock.result
@@ -489,3 +489,19 @@ unlock tables;
disconnect con1;
connection default;
drop table t1;
+#
+# MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+LOCK TABLE t1 READ;
+connect con1,localhost,root,,test;
+LOCK TABLE t2 WRITE;
+SET lock_wait_timeout= 1;
+FLUSH TABLES;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+disconnect con1;
+connection default;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/lock.test b/mysql-test/main/lock.test
index 2e164de9b93..2c2c5d42783 100644
--- a/mysql-test/main/lock.test
+++ b/mysql-test/main/lock.test
@@ -598,3 +598,24 @@ unlock tables;
disconnect con1;
connection default;
drop table t1;
+
+--echo #
+--echo # MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+LOCK TABLE t1 READ;
+
+--connect (con1,localhost,root,,test)
+LOCK TABLE t2 WRITE;
+SET lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+FLUSH TABLES;
+
+# Cleanup
+UNLOCK TABLES;
+--disconnect con1
+--connection default
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/main/mdev375.result b/mysql-test/main/mdev375.result
index d7a66ebd6dd..0ae8375ff24 100644
--- a/mysql-test/main/mdev375.result
+++ b/mysql-test/main/mdev375.result
@@ -1,5 +1,13 @@
SET GLOBAL log_warnings=4;
-SET GLOBAL max_connections=2;
+SET GLOBAL max_connections=10;
+connect tmp_con1,localhost,root,,;
+connect tmp_con2,localhost,root,,;
+connect tmp_con3,localhost,root,,;
+connect tmp_con4,localhost,root,,;
+connect tmp_con5,localhost,root,,;
+connect tmp_con6,localhost,root,,;
+connect tmp_con7,localhost,root,,;
+connect tmp_con8,localhost,root,,;
connect con1,localhost,root,,;
SELECT 1;
1
@@ -15,6 +23,6 @@ SELECT 0;
0
show status like "Threads_connected";
Variable_name Value
-Threads_connected 3
+Threads_connected 11
SET GLOBAL log_warnings=default;
SET GLOBAL max_connections=default;
diff --git a/mysql-test/main/mdev375.test b/mysql-test/main/mdev375.test
index 92e403b6513..759f7bd31f0 100644
--- a/mysql-test/main/mdev375.test
+++ b/mysql-test/main/mdev375.test
@@ -4,7 +4,16 @@
--source include/not_embedded.inc
SET GLOBAL log_warnings=4;
-SET GLOBAL max_connections=2;
+SET GLOBAL max_connections=10;
+
+--connect (tmp_con1,localhost,root,,)
+--connect (tmp_con2,localhost,root,,)
+--connect (tmp_con3,localhost,root,,)
+--connect (tmp_con4,localhost,root,,)
+--connect (tmp_con5,localhost,root,,)
+--connect (tmp_con6,localhost,root,,)
+--connect (tmp_con7,localhost,root,,)
+--connect (tmp_con8,localhost,root,,)
--connect (con1,localhost,root,,)
SELECT 1;
diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result
index cbc475cfd8a..4864ef0bb13 100644
--- a/mysql-test/main/myisam.result
+++ b/mysql-test/main/myisam.result
@@ -1938,16 +1938,17 @@ DROP TABLE t1;
#
# BUG#48438 - crash with error in unioned query against merge table and view...
#
-SET GLOBAL table_open_cache=3;
+SET @save_table_open_cache=@@table_open_cache;
+SET GLOBAL table_open_cache=10;
CREATE TABLE t1(a INT);
-SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
+SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE;
1
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
TABLE_ROWS DATA_LENGTH
0 0
DROP TABLE t1;
-SET GLOBAL table_open_cache=DEFAULT;
+SET GLOBAL table_open_cache=@save_table_open_cache;
End of 5.0 tests
create table t1 (a int not null, key `a` (a) key_block_size=1024);
show create table t1;
diff --git a/mysql-test/main/myisam.test b/mysql-test/main/myisam.test
index 24f3ff783c9..63f5f6672f2 100644
--- a/mysql-test/main/myisam.test
+++ b/mysql-test/main/myisam.test
@@ -1220,13 +1220,14 @@ DROP TABLE t1;
--echo #
--echo # BUG#48438 - crash with error in unioned query against merge table and view...
--echo #
-SET GLOBAL table_open_cache=3;
+SET @save_table_open_cache=@@table_open_cache;
+SET GLOBAL table_open_cache=10;
CREATE TABLE t1(a INT);
-SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
+SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4, t1 AS a5, t1 AS a6, t1 AS a7, t1 AS a8, t1 AS a9, t1 AS a10, t1 AS a11 FOR UPDATE;
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DROP TABLE t1;
-SET GLOBAL table_open_cache=DEFAULT;
+SET GLOBAL table_open_cache=@save_table_open_cache;
--echo End of 5.0 tests
diff --git a/mysql-test/main/myisam_recover.result b/mysql-test/main/myisam_recover.result
index 12184ad0ca6..1af3dbf9ad5 100644
--- a/mysql-test/main/myisam_recover.result
+++ b/mysql-test/main/myisam_recover.result
@@ -18,6 +18,7 @@ connection con1;
call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
call mtr.add_suppression(" '\..test.t1'");
+set @save_table_open_cache=@@table_open_cache;
set global table_open_cache=256;
set global table_definition_cache=400;
drop procedure if exists p_create;
@@ -98,7 +99,7 @@ prepare stmt from @drop_table_stmt;
execute stmt;
deallocate prepare stmt;
set @@global.table_definition_cache=default;
-set @@global.table_open_cache=default;
+set @@global.table_open_cache=@save_table_open_cache;
disconnect con1;
connection default;
#
diff --git a/mysql-test/main/myisam_recover.test b/mysql-test/main/myisam_recover.test
index 86a4d16d0f9..316be56609b 100644
--- a/mysql-test/main/myisam_recover.test
+++ b/mysql-test/main/myisam_recover.test
@@ -23,6 +23,7 @@ call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
call mtr.add_suppression(" '\..test.t1'");
+set @save_table_open_cache=@@table_open_cache;
set global table_open_cache=256;
set global table_definition_cache=400;
--disable_warnings
@@ -104,7 +105,7 @@ prepare stmt from @drop_table_stmt;
execute stmt;
deallocate prepare stmt;
set @@global.table_definition_cache=default;
-set @@global.table_open_cache=default;
+set @@global.table_open_cache=@save_table_open_cache;
disconnect con1;
connection default;
--enable_ps_protocol
diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff
index 367744f6f5d..89d2cd36112 100644
--- a/mysql-test/main/mysqld--help,win.rdiff
+++ b/mysql-test/main/mysqld--help,win.rdiff
@@ -105,10 +105,10 @@
sync-relay-log-info 10000
sysdate-is-now FALSE
system-versioning-alter-history ERROR
--table-cache 431
+-table-cache 421
+table-cache 2000
table-definition-cache 400
--table-open-cache 431
+-table-open-cache 421
+table-open-cache 2000
table-open-cache-instances 8
tc-heuristic-recover OFF
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index ef6a49df08b..6c997a9e936 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -1652,9 +1652,9 @@ sync-relay-log 10000
sync-relay-log-info 10000
sysdate-is-now FALSE
system-versioning-alter-history ERROR
-table-cache 431
+table-cache 421
table-definition-cache 400
-table-open-cache 431
+table-open-cache 421
table-open-cache-instances 8
tc-heuristic-recover OFF
tcp-keepalive-interval 0
diff --git a/mysql-test/main/mysqltest.test b/mysql-test/main/mysqltest.test
index d6c68ecf3c2..b545e354040 100644
--- a/mysql-test/main/mysqltest.test
+++ b/mysql-test/main/mysqltest.test
@@ -684,7 +684,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Too many errorcodes specified
--error 1
---exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1
+--exec echo "--error 1,2,3,4,5,6,7,8,9,10,11,12,13" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
diff --git a/mysql-test/main/perror.result b/mysql-test/main/perror.result
index 432a4fd4c04..46554442721 100644
--- a/mysql-test/main/perror.result
+++ b/mysql-test/main/perror.result
@@ -3,4 +3,4 @@ MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d
MySQL error code 1408 (ER_STARTUP): %s: ready for connections.
Version: '%s' socket: '%s' port: %d %s
MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it!
-MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %lu)
+MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u)
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index 45e3f60e431..89de00a38bc 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -821,7 +821,7 @@ Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000'
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
-1048576
+4294967295
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index 5e457fae1e0..582ea33d903 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -7955,7 +7955,7 @@ CLOSE cur1;
end|
set @tmp_toc= @@table_open_cache;
set @tmp_tdc= @@table_definition_cache;
-set global table_open_cache=1;
+set global table_open_cache=10;
set global table_definition_cache=1;
Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '1'
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index c97f6dbba68..7a6fc3e711d 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -9403,7 +9403,7 @@ DELIMITER ;|
set @tmp_toc= @@table_open_cache;
set @tmp_tdc= @@table_definition_cache;
-set global table_open_cache=1;
+set global table_open_cache=10;
set global table_definition_cache=1;
call p1();
diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result
index ffaaf09acc8..8f87b166e8d 100644
--- a/mysql-test/main/statistics.result
+++ b/mysql-test/main/statistics.result
@@ -1664,6 +1664,24 @@ db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_fre
test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL
drop table t1;
#
+# MDEB-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918):
+# Encountered illegal value '' when converting to DECIMAL
+#
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=3, use_stat_tables=preferably;
+create table t1 (id int(10),cost decimal(9,2)) engine=innodb;
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+create temporary table t2 (id int);
+insert into t2 (id) select id from t1 where cost > 0;
+select * from t2;
+id
+set use_stat_tables=@save_use_stat_tables;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1,t2;
+#
# MDEV-9590: Always print "Engine-independent statistic" warnings and
# might be filtering columns unintentionally from engines
#
diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test
index e9ecb56a1cb..368cee0f8c8 100644
--- a/mysql-test/main/statistics.test
+++ b/mysql-test/main/statistics.test
@@ -800,6 +800,25 @@ select db_name, table_name, column_name,
drop table t1;
--echo #
+--echo # MDEB-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918):
+--echo # Encountered illegal value '' when converting to DECIMAL
+--echo #
+
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set optimizer_use_condition_selectivity=3, use_stat_tables=preferably;
+
+create table t1 (id int(10),cost decimal(9,2)) engine=innodb;
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+
+create temporary table t2 (id int);
+insert into t2 (id) select id from t1 where cost > 0;
+select * from t2;
+
+set use_stat_tables=@save_use_stat_tables;
+set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1,t2;
+
+--echo #
--echo # MDEV-9590: Always print "Engine-independent statistic" warnings and
--echo # might be filtering columns unintentionally from engines
--echo #
diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result
index 89b2367cec8..9224aa82e8a 100644
--- a/mysql-test/main/variables.result
+++ b/mysql-test/main/variables.result
@@ -568,6 +568,7 @@ set sql_safe_updates=1;
set sql_select_limit=1;
set sql_select_limit=default;
set sql_warnings=1;
+set @save_table_open_cache=@@table_open_cache;
set global table_open_cache=100;
set default_storage_engine=myisam;
set global thread_cache_size=100;
@@ -748,11 +749,11 @@ Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '-1'
SHOW VARIABLES LIKE 'table_open_cache';
Variable_name Value
-table_open_cache 1
+table_open_cache 10
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
VARIABLE_NAME VARIABLE_VALUE
-TABLE_OPEN_CACHE 1
-SET GLOBAL table_open_cache=DEFAULT;
+TABLE_OPEN_CACHE 10
+SET GLOBAL table_open_cache=@save_table_open_cache;
set character_set_results=NULL;
select ifnull(@@character_set_results,"really null");
ifnull(@@character_set_results,"really null")
diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test
index 4da3cac3a73..fa0bdc251b5 100644
--- a/mysql-test/main/variables.test
+++ b/mysql-test/main/variables.test
@@ -343,6 +343,7 @@ set sql_select_limit=1;
# reset it, so later tests don't get confused
set sql_select_limit=default;
set sql_warnings=1;
+set @save_table_open_cache=@@table_open_cache;
set global table_open_cache=100;
set default_storage_engine=myisam;
set global thread_cache_size=100;
@@ -502,7 +503,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYI
SET GLOBAL table_open_cache=-1;
SHOW VARIABLES LIKE 'table_open_cache';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
-SET GLOBAL table_open_cache=DEFAULT;
+SET GLOBAL table_open_cache=@save_table_open_cache;
#
# Bugs12363: character_set_results is nullable,
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index e61e2d2663d..63207ea6a67 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -5527,6 +5527,203 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
+CREATE TABLE IF NOT EXISTS t0 (f0 INT);
+CREATE TABLE IF NOT EXISTS t1 (f1 INT);
+CREATE TABLE IF NOT EXISTS t2 (f2 INT);
+CREATE TABLE IF NOT EXISTS t3 (f3 INT);
+CREATE TABLE IF NOT EXISTS t4 (f4 INT);
+CREATE TABLE IF NOT EXISTS t5 (f5 INT);
+CREATE TABLE IF NOT EXISTS t6 (f6 INT);
+CREATE TABLE IF NOT EXISTS t7 (f7 INT);
+CREATE TABLE IF NOT EXISTS t8 (f8 INT);
+CREATE TABLE IF NOT EXISTS t9 (f9 INT);
+CREATE TABLE IF NOT EXISTS t10 (f10 INT);
+CREATE TABLE IF NOT EXISTS t11 (f11 INT);
+CREATE TABLE IF NOT EXISTS t12 (f12 INT);
+CREATE TABLE IF NOT EXISTS t13 (f13 INT);
+CREATE TABLE IF NOT EXISTS t14 (f14 INT);
+CREATE TABLE IF NOT EXISTS t15 (f15 INT);
+CREATE TABLE IF NOT EXISTS t16 (f16 INT);
+CREATE TABLE IF NOT EXISTS t17 (f17 INT);
+CREATE TABLE IF NOT EXISTS t18 (f18 INT);
+CREATE TABLE IF NOT EXISTS t19 (f19 INT);
+CREATE TABLE IF NOT EXISTS t20 (f20 INT);
+CREATE TABLE IF NOT EXISTS t21 (f21 INT);
+CREATE TABLE IF NOT EXISTS t22 (f22 INT);
+CREATE TABLE IF NOT EXISTS t23 (f23 INT);
+CREATE TABLE IF NOT EXISTS t24 (f24 INT);
+CREATE TABLE IF NOT EXISTS t25 (f25 INT);
+CREATE TABLE IF NOT EXISTS t26 (f26 INT);
+CREATE TABLE IF NOT EXISTS t27 (f27 INT);
+CREATE TABLE IF NOT EXISTS t28 (f28 INT);
+CREATE TABLE IF NOT EXISTS t29 (f29 INT);
+CREATE TABLE IF NOT EXISTS t30 (f30 INT);
+CREATE TABLE IF NOT EXISTS t31 (f31 INT);
+CREATE TABLE IF NOT EXISTS t32 (f32 INT);
+CREATE TABLE IF NOT EXISTS t33 (f33 INT);
+CREATE TABLE IF NOT EXISTS t34 (f34 INT);
+CREATE TABLE IF NOT EXISTS t35 (f35 INT);
+CREATE TABLE IF NOT EXISTS t36 (f36 INT);
+CREATE TABLE IF NOT EXISTS t37 (f37 INT);
+CREATE TABLE IF NOT EXISTS t38 (f38 INT);
+CREATE TABLE IF NOT EXISTS t39 (f39 INT);
+CREATE TABLE IF NOT EXISTS t40 (f40 INT);
+CREATE TABLE IF NOT EXISTS t41 (f41 INT);
+CREATE TABLE IF NOT EXISTS t42 (f42 INT);
+CREATE TABLE IF NOT EXISTS t43 (f43 INT);
+CREATE TABLE IF NOT EXISTS t44 (f44 INT);
+CREATE TABLE IF NOT EXISTS t45 (f45 INT);
+CREATE TABLE IF NOT EXISTS t46 (f46 INT);
+CREATE TABLE IF NOT EXISTS t47 (f47 INT);
+CREATE TABLE IF NOT EXISTS t48 (f48 INT);
+CREATE TABLE IF NOT EXISTS t49 (f49 INT);
+CREATE TABLE IF NOT EXISTS t50 (f50 INT);
+CREATE TABLE IF NOT EXISTS t51 (f51 INT);
+CREATE TABLE IF NOT EXISTS t52 (f52 INT);
+CREATE TABLE IF NOT EXISTS t53 (f53 INT);
+CREATE TABLE IF NOT EXISTS t54 (f54 INT);
+CREATE TABLE IF NOT EXISTS t55 (f55 INT);
+CREATE TABLE IF NOT EXISTS t56 (f56 INT);
+CREATE TABLE IF NOT EXISTS t57 (f57 INT);
+CREATE TABLE IF NOT EXISTS t58 (f58 INT);
+CREATE TABLE IF NOT EXISTS t59 (f59 INT);
+CREATE TABLE IF NOT EXISTS t60 (f60 INT);
+CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60;
+EXPLAIN
+SELECT t0.*
+FROM t0
+JOIN t1
+ON t1.f1 = t0.f0
+LEFT JOIN t2
+ON t0.f0 = t2.f2
+LEFT JOIN t3
+ON t0.f0 = t3.f3
+LEFT JOIN t4
+ON t0.f0 = t4.f4
+LEFT JOIN t5
+ON t4.f4 = t5.f5
+LEFT JOIN t6
+ON t0.f0 = t6.f6
+LEFT JOIN t7
+ON t0.f0 = t7.f7
+LEFT JOIN t8
+ON t0.f0 = t8.f8
+LEFT JOIN t9
+ON t0.f0 = t9.f9
+LEFT JOIN t10
+ON t0.f0 = t10.f10
+LEFT JOIN t11
+ON t0.f0 = t11.f11
+LEFT JOIN t12
+ON t0.f0 = t12.f12
+LEFT JOIN t13
+ON t0.f0 = t13.f13
+LEFT JOIN t14
+ON t0.f0 = t14.f14
+LEFT JOIN t15
+ON t0.f0 = t15.f15
+LEFT JOIN t16
+ON t0.f0 = t16.f16
+LEFT JOIN t17
+ON t0.f0 = t17.f17
+LEFT JOIN t18
+ON t0.f0 = t18.f18
+LEFT JOIN t19
+ON t18.f18 = t19.f19
+LEFT JOIN t20
+ON t20.f20 = t19.f19
+LEFT JOIN t21
+ON t20.f20 = t21.f21
+LEFT JOIN t22
+ON t19.f19 = t22.f22
+LEFT JOIN t23
+ON t23.f23 = t0.f0
+LEFT JOIN t24
+ON t24.f24 = t23.f23
+LEFT JOIN t25
+ON t0.f0 = t25.f25
+LEFT JOIN t26
+ON t26.f26 = t0.f0
+LEFT JOIN t27
+ON t27.f27 = t0.f0
+LEFT JOIN t28
+ON t0.f0 = t28.f28
+LEFT JOIN t29
+ON t0.f0 = t29.f29
+LEFT JOIN t30
+ON t30.f30 = t0.f0
+LEFT JOIN t31
+ON t0.f0 = t31.f31
+LEFT JOIN t32
+ON t32.f32 = t31.f31
+LEFT JOIN t33
+ON t33.f33 = t0.f0
+LEFT JOIN t34
+ON t33.f33 = t34.f34
+LEFT JOIN t35
+ON t33.f33 = t35.f35
+LEFT JOIN t36
+ON t36.f36 = t0.f0
+LEFT JOIN t37
+ON t32.f32 = t37.f37
+LEFT JOIN t38
+ON t31.f31 = t38.f38
+LEFT JOIN t39
+ON t39.f39 = t0.f0
+LEFT JOIN t40
+ON t40.f40 = t39.f39
+LEFT JOIN t41
+ON t41.f41 = t0.f0
+LEFT JOIN t42
+ON t42.f42 = t41.f41
+LEFT JOIN t43
+ON t43.f43 = t41.f41
+LEFT JOIN t44
+ON t44.f44 = t0.f0
+LEFT JOIN t45
+ON t45.f45 = t0.f0
+LEFT JOIN t46
+ON t46.f46 = t0.f0
+LEFT JOIN t47
+ON t47.f47 = t0.f0
+LEFT JOIN t48
+ON t48.f48 = t0.f0
+LEFT JOIN t49
+ON t0.f0 = t49.f49
+LEFT JOIN t50
+ON t0.f0 = t50.f50
+LEFT JOIN t51
+ON t0.f0 = t51.f51
+LEFT JOIN t52
+ON t52.f52 = t0.f0
+LEFT JOIN t53
+ON t53.f53 = t0.f0
+LEFT JOIN t54
+ON t54.f54 = t0.f0
+LEFT JOIN t55
+ON t55.f55 = t0.f0
+LEFT JOIN t56
+ON t56.f56 = t0.f0
+LEFT JOIN t57
+ON t57.f57 = t0.f0
+LEFT JOIN t58
+ON t58.f58 = t57.f57
+LEFT JOIN t59
+ON t36.f36 = t59.f59
+LEFT JOIN v60
+ON t36.f36 = v60.f60
+;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9,
+t10, t11, t12, t13, t14, t15, t16, t17, t18,
+t19, t20, t21, t22, t23, t24, t25, t26, t27,
+t28, t29, t30, t31, t32, t33, t34, t35, t36,
+t37, t38, t39, t40, t41, t42, t43, t44, t45,
+t46, t47, t48, t49, t50, t51, t52, t53, t54,
+t55, t56, t57, t58, t59,t60;
+drop view v60;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index f78ddd6f49e..82ef38f0eb6 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -5419,6 +5419,202 @@ SHOW CREATE VIEW v1;
drop view v1;
drop table t1;
+CREATE TABLE IF NOT EXISTS t0 (f0 INT);
+CREATE TABLE IF NOT EXISTS t1 (f1 INT);
+CREATE TABLE IF NOT EXISTS t2 (f2 INT);
+CREATE TABLE IF NOT EXISTS t3 (f3 INT);
+CREATE TABLE IF NOT EXISTS t4 (f4 INT);
+CREATE TABLE IF NOT EXISTS t5 (f5 INT);
+CREATE TABLE IF NOT EXISTS t6 (f6 INT);
+CREATE TABLE IF NOT EXISTS t7 (f7 INT);
+CREATE TABLE IF NOT EXISTS t8 (f8 INT);
+CREATE TABLE IF NOT EXISTS t9 (f9 INT);
+CREATE TABLE IF NOT EXISTS t10 (f10 INT);
+CREATE TABLE IF NOT EXISTS t11 (f11 INT);
+CREATE TABLE IF NOT EXISTS t12 (f12 INT);
+CREATE TABLE IF NOT EXISTS t13 (f13 INT);
+CREATE TABLE IF NOT EXISTS t14 (f14 INT);
+CREATE TABLE IF NOT EXISTS t15 (f15 INT);
+CREATE TABLE IF NOT EXISTS t16 (f16 INT);
+CREATE TABLE IF NOT EXISTS t17 (f17 INT);
+CREATE TABLE IF NOT EXISTS t18 (f18 INT);
+CREATE TABLE IF NOT EXISTS t19 (f19 INT);
+CREATE TABLE IF NOT EXISTS t20 (f20 INT);
+CREATE TABLE IF NOT EXISTS t21 (f21 INT);
+CREATE TABLE IF NOT EXISTS t22 (f22 INT);
+CREATE TABLE IF NOT EXISTS t23 (f23 INT);
+CREATE TABLE IF NOT EXISTS t24 (f24 INT);
+CREATE TABLE IF NOT EXISTS t25 (f25 INT);
+CREATE TABLE IF NOT EXISTS t26 (f26 INT);
+CREATE TABLE IF NOT EXISTS t27 (f27 INT);
+CREATE TABLE IF NOT EXISTS t28 (f28 INT);
+CREATE TABLE IF NOT EXISTS t29 (f29 INT);
+CREATE TABLE IF NOT EXISTS t30 (f30 INT);
+CREATE TABLE IF NOT EXISTS t31 (f31 INT);
+CREATE TABLE IF NOT EXISTS t32 (f32 INT);
+CREATE TABLE IF NOT EXISTS t33 (f33 INT);
+CREATE TABLE IF NOT EXISTS t34 (f34 INT);
+CREATE TABLE IF NOT EXISTS t35 (f35 INT);
+CREATE TABLE IF NOT EXISTS t36 (f36 INT);
+CREATE TABLE IF NOT EXISTS t37 (f37 INT);
+CREATE TABLE IF NOT EXISTS t38 (f38 INT);
+CREATE TABLE IF NOT EXISTS t39 (f39 INT);
+CREATE TABLE IF NOT EXISTS t40 (f40 INT);
+CREATE TABLE IF NOT EXISTS t41 (f41 INT);
+CREATE TABLE IF NOT EXISTS t42 (f42 INT);
+CREATE TABLE IF NOT EXISTS t43 (f43 INT);
+CREATE TABLE IF NOT EXISTS t44 (f44 INT);
+CREATE TABLE IF NOT EXISTS t45 (f45 INT);
+CREATE TABLE IF NOT EXISTS t46 (f46 INT);
+CREATE TABLE IF NOT EXISTS t47 (f47 INT);
+CREATE TABLE IF NOT EXISTS t48 (f48 INT);
+CREATE TABLE IF NOT EXISTS t49 (f49 INT);
+CREATE TABLE IF NOT EXISTS t50 (f50 INT);
+CREATE TABLE IF NOT EXISTS t51 (f51 INT);
+CREATE TABLE IF NOT EXISTS t52 (f52 INT);
+CREATE TABLE IF NOT EXISTS t53 (f53 INT);
+CREATE TABLE IF NOT EXISTS t54 (f54 INT);
+CREATE TABLE IF NOT EXISTS t55 (f55 INT);
+CREATE TABLE IF NOT EXISTS t56 (f56 INT);
+CREATE TABLE IF NOT EXISTS t57 (f57 INT);
+CREATE TABLE IF NOT EXISTS t58 (f58 INT);
+CREATE TABLE IF NOT EXISTS t59 (f59 INT);
+CREATE TABLE IF NOT EXISTS t60 (f60 INT);
+CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60;
+
+EXPLAIN
+ SELECT t0.*
+FROM t0
+JOIN t1
+ ON t1.f1 = t0.f0
+LEFT JOIN t2
+ ON t0.f0 = t2.f2
+LEFT JOIN t3
+ ON t0.f0 = t3.f3
+LEFT JOIN t4
+ ON t0.f0 = t4.f4
+LEFT JOIN t5
+ ON t4.f4 = t5.f5
+LEFT JOIN t6
+ ON t0.f0 = t6.f6
+LEFT JOIN t7
+ ON t0.f0 = t7.f7
+LEFT JOIN t8
+ ON t0.f0 = t8.f8
+LEFT JOIN t9
+ ON t0.f0 = t9.f9
+LEFT JOIN t10
+ ON t0.f0 = t10.f10
+LEFT JOIN t11
+ ON t0.f0 = t11.f11
+LEFT JOIN t12
+ ON t0.f0 = t12.f12
+LEFT JOIN t13
+ ON t0.f0 = t13.f13
+LEFT JOIN t14
+ ON t0.f0 = t14.f14
+LEFT JOIN t15
+ ON t0.f0 = t15.f15
+LEFT JOIN t16
+ ON t0.f0 = t16.f16
+LEFT JOIN t17
+ ON t0.f0 = t17.f17
+LEFT JOIN t18
+ ON t0.f0 = t18.f18
+LEFT JOIN t19
+ ON t18.f18 = t19.f19
+LEFT JOIN t20
+ ON t20.f20 = t19.f19
+LEFT JOIN t21
+ ON t20.f20 = t21.f21
+LEFT JOIN t22
+ ON t19.f19 = t22.f22
+LEFT JOIN t23
+ ON t23.f23 = t0.f0
+LEFT JOIN t24
+ ON t24.f24 = t23.f23
+LEFT JOIN t25
+ ON t0.f0 = t25.f25
+LEFT JOIN t26
+ ON t26.f26 = t0.f0
+LEFT JOIN t27
+ ON t27.f27 = t0.f0
+LEFT JOIN t28
+ ON t0.f0 = t28.f28
+LEFT JOIN t29
+ ON t0.f0 = t29.f29
+LEFT JOIN t30
+ ON t30.f30 = t0.f0
+LEFT JOIN t31
+ ON t0.f0 = t31.f31
+LEFT JOIN t32
+ ON t32.f32 = t31.f31
+LEFT JOIN t33
+ ON t33.f33 = t0.f0
+LEFT JOIN t34
+ ON t33.f33 = t34.f34
+LEFT JOIN t35
+ ON t33.f33 = t35.f35
+LEFT JOIN t36
+ ON t36.f36 = t0.f0
+LEFT JOIN t37
+ ON t32.f32 = t37.f37
+LEFT JOIN t38
+ ON t31.f31 = t38.f38
+LEFT JOIN t39
+ ON t39.f39 = t0.f0
+LEFT JOIN t40
+ ON t40.f40 = t39.f39
+LEFT JOIN t41
+ ON t41.f41 = t0.f0
+LEFT JOIN t42
+ ON t42.f42 = t41.f41
+LEFT JOIN t43
+ ON t43.f43 = t41.f41
+LEFT JOIN t44
+ ON t44.f44 = t0.f0
+LEFT JOIN t45
+ ON t45.f45 = t0.f0
+LEFT JOIN t46
+ ON t46.f46 = t0.f0
+LEFT JOIN t47
+ ON t47.f47 = t0.f0
+LEFT JOIN t48
+ ON t48.f48 = t0.f0
+LEFT JOIN t49
+ ON t0.f0 = t49.f49
+LEFT JOIN t50
+ ON t0.f0 = t50.f50
+LEFT JOIN t51
+ ON t0.f0 = t51.f51
+LEFT JOIN t52
+ ON t52.f52 = t0.f0
+LEFT JOIN t53
+ ON t53.f53 = t0.f0
+LEFT JOIN t54
+ ON t54.f54 = t0.f0
+LEFT JOIN t55
+ ON t55.f55 = t0.f0
+LEFT JOIN t56
+ ON t56.f56 = t0.f0
+LEFT JOIN t57
+ ON t57.f57 = t0.f0
+LEFT JOIN t58
+ ON t58.f58 = t57.f57
+LEFT JOIN t59
+ ON t36.f36 = t59.f59
+LEFT JOIN v60
+ ON t36.f36 = v60.f60
+;
+drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9,
+t10, t11, t12, t13, t14, t15, t16, t17, t18,
+t19, t20, t21, t22, t23, t24, t25, t26, t27,
+t28, t29, t30, t31, t32, t33, t34, t35, t36,
+t37, t38, t39, t40, t41, t42, t43, t44, t45,
+t46, t47, t48, t49, t50, t51, t52, t53, t54,
+t55, t56, t57, t58, t59,t60;
+drop view v60;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index a762524825c..63f8f07a63a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -4460,6 +4460,7 @@ sub extract_warning_lines ($$) {
qr|SSL error: Failed to set ciphers to use|,
qr/Plugin 'InnoDB' will be forced to shutdown/,
qr|Could not increase number of max_open_files to more than|,
+ qr|Changed limits: max_open_files|,
qr/InnoDB: Error table encrypted but encryption service not available.*/,
qr/InnoDB: Could not find a valid tablespace file for*/,
qr/InnoDB: Tablespace open failed for*/,
diff --git a/mysql-test/std_data/binlog-header.log b/mysql-test/std_data/binlog-header.log
deleted file mode 100644
index c415a57e616..00000000000
--- a/mysql-test/std_data/binlog-header.log
+++ /dev/null
Binary files differ
diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.result b/mysql-test/suite/binlog_encryption/rpl_typeconv.result
index fa7deca3cff..cb50c69aa55 100644
--- a/mysql-test/suite/binlog_encryption/rpl_typeconv.result
+++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.result
@@ -42,6 +42,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -50,6 +54,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -58,6 +66,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -66,6 +78,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -212,6 +228,22 @@ LONGBLOB COMPRE BLOB <Correct error>
LONGBLOB COMPRE MEDIUMBLOB <Correct error>
LONGBLOB COMPRE LONGBLOB <Correct error>
LONGBLOB COMPRE VARBINARY(65500 <Correct error>
+TINYBLOB BLOB <Correct error>
+TINYBLOB MEDIUMBLOB <Correct error>
+TINYBLOB LONGBLOB <Correct error>
+TINYBLOB VARBINARY(255) <Correct error>
+BLOB TINYBLOB <Correct error>
+BLOB MEDIUMBLOB <Correct error>
+BLOB LONGBLOB <Correct error>
+BLOB VARBINARY(65500 <Correct error>
+MEDIUMBLOB TINYBLOB <Correct error>
+MEDIUMBLOB BLOB <Correct error>
+MEDIUMBLOB LONGBLOB <Correct error>
+MEDIUMBLOB VARBINARY(65500 <Correct error>
+LONGBLOB TINYBLOB <Correct error>
+LONGBLOB BLOB <Correct error>
+LONGBLOB MEDIUMBLOB <Correct error>
+LONGBLOB VARBINARY(65500 <Correct error>
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
@@ -353,6 +385,22 @@ LONGBLOB COMPRE BLOB ALL_NON_LOSSY <Correct error>
LONGBLOB COMPRE MEDIUMBLOB ALL_NON_LOSSY <Correct error>
LONGBLOB COMPRE LONGBLOB ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB VARBINARY(255) ALL_NON_LOSSY <Correct value>
+BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
+BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+BLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY <Correct error>
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
@@ -494,6 +542,22 @@ LONGBLOB COMPRE BLOB ALL_LOSSY <Correct value>
LONGBLOB COMPRE MEDIUMBLOB ALL_LOSSY <Correct value>
LONGBLOB COMPRE LONGBLOB ALL_LOSSY <Correct error>
LONGBLOB COMPRE VARBINARY(65500 ALL_LOSSY <Correct value>
+TINYBLOB BLOB ALL_LOSSY <Correct error>
+TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
+TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
+TINYBLOB VARBINARY(255) ALL_LOSSY <Correct error>
+BLOB TINYBLOB ALL_LOSSY <Correct value>
+BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
+BLOB LONGBLOB ALL_LOSSY <Correct error>
+BLOB VARBINARY(65500 ALL_LOSSY <Correct value>
+MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
+MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
+MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
+MEDIUMBLOB VARBINARY(65500 ALL_LOSSY <Correct value>
+LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
+LONGBLOB BLOB ALL_LOSSY <Correct value>
+LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
+LONGBLOB VARBINARY(65500 ALL_LOSSY <Correct value>
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
@@ -635,6 +699,22 @@ LONGBLOB COMPRE BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB VARBINARY(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
DROP TABLE type_conversions;
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
connection master;
diff --git a/mysql-test/suite/encryption/r/innodb-remove-encryption.result b/mysql-test/suite/encryption/r/innodb-remove-encryption.result
new file mode 100644
index 00000000000..3b0ce29218b
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-remove-encryption.result
@@ -0,0 +1,44 @@
+set global innodb_file_per_table=OFF;
+call mtr.add_suppression("mysqld: file-key-management-filename is not set");
+call mtr.add_suppression("Plugin 'file_key_management' init function returned error.");
+call mtr.add_suppression("Plugin 'file_key_management' registration as a ENCRYPTION failed.");
+flush tables;
+create table t1(a int not null primary key, b char(200)) engine=innodb;
+
+# Restart server with encryption
+# Wait until encryption threads have encrypted all tablespaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+innodb_system
+mysql/innodb_index_stats
+mysql/innodb_table_stats
+mysql/transaction_registry
+# Success!
+SELECT * from t1;
+a b
+# Now turn off encryption and wait for threads to decrypt all tablespaces
+SET GLOBAL innodb_encrypt_tables = off;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+innodb_system
+mysql/innodb_index_stats
+mysql/innodb_table_stats
+mysql/transaction_registry
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+# Success!
+
+# Restart server with no encryption setup, there should be no crashes
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+NAME
+innodb_system
+mysql/innodb_index_stats
+mysql/innodb_table_stats
+mysql/transaction_registry
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+NAME
+SELECT * from t1;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/suite/encryption/t/innodb-remove-encryption.test b/mysql-test/suite/encryption/t/innodb-remove-encryption.test
new file mode 100644
index 00000000000..24e00a00a02
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-remove-encryption.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+# Test uses restart
+--source include/not_embedded.inc
+--source filekeys_plugin.inc
+
+#
+# MDEV-15566: System tablespace does not easily key rotate to unencrypted
+#
+
+set global innodb_file_per_table=OFF;
+
+call mtr.add_suppression("mysqld: file-key-management-filename is not set");
+call mtr.add_suppression("Plugin 'file_key_management' init function returned error.");
+call mtr.add_suppression("Plugin 'file_key_management' registration as a ENCRYPTION failed.");
+flush tables;
+
+create table t1(a int not null primary key, b char(200)) engine=innodb;
+
+--echo
+--echo # Restart server with encryption
+-- let $restart_parameters=--plugin-load-add=$FILE_KEY_MANAGEMENT_SO --loose-file-key-management --loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt --file-key-management-encryption-algorithm=aes_cbc --innodb-encrypt-tables=ON --innodb-encryption-threads=4 --innodb-tablespaces-encryption --innodb-encryption-rotate-key-age=15
+-- source include/restart_mysqld.inc
+
+--echo # Wait until encryption threads have encrypted all tablespaces
+
+--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND ROTATING_OR_FLUSHING = 0;
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+--echo # Success!
+
+SELECT * from t1;
+
+--echo # Now turn off encryption and wait for threads to decrypt all tablespaces
+SET GLOBAL innodb_encrypt_tables = off;
+
+--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+--echo # Success!
+
+--echo
+--echo # Restart server with no encryption setup, there should be no crashes
+--let $restart_parameters=--skip-file-key-management --innodb-encrypt-tables=OFF --innodb-encryption-threads=0 --innodb-tablespaces-encryption
+-- source include/restart_mysqld.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+
+SELECT * from t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 9b7e442a290..9c25a63be3b 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -9,54 +9,32 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-galera_gra_log : MDEV-13549 Galera test failures
-galera_flush : MDEV-13549 Galera test failures
+
+galera_flush : MariaDB does not have global.thread_statistics
galera_account_management : MariaDB 10.0 does not support ALTER USER
-galera_binlog_row_image : MariaDB 10.0 does not support binlog_row_image
galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
-GAL-419 : MDEV-13549 Galera test failures
-galera_toi_ddl_fk_insert : MDEV-13549 Galera test failures
-galera_var_notify_cmd : MDEV-13549 Galera test failures
-mysql-wsrep#90 : MDEV-13549 Galera test failures
+galera_migrate : MariaDB does not support START SLAVE USER
galera_as_master_gtid : Requires MySQL GTID
galera_as_master_gtid_change_master : Requires MySQL GTID
-galera_as_slave_replication_bundle : MDEV-13549 Galera test failures
galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
-galera_gcs_fragment : MDEV-13549 Galera test failures
+GAL-419 : MDEV-13549 Galera test failures
+galera_var_notify_cmd : MDEV-13549 Galera test failures
+galera_as_slave_replication_bundle : MDEV-13549 Galera test failures
galera_gcache_recover : MDEV-13549 Galera test failures
galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures
galera_gcache_recover_manytrx : MDEV-13549 Galera test failures
galera_ist_mysqldump : MDEV-13549 Galera test failures
-mysql-wsrep#31 : MDEV-13549 Galera test failures
-galera_migrate : MariaDB 10.0 does not support START SLAVE USER
-galera_concurrent_ctas : MDEV-13549 Galera test failures
-galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures
-mysql-wsrep#33 : MDEV-13549 Galera test failures
-galera_var_auto_inc_control_on : MDEV-13549 Galera test failures
-MW-44 : MDEV-13549 Galera test failures
-galera_var_retry_autocommit : MDEV-13549 Galera test failures
-pxc-421 : MDEV-13549 Galera test failures
-lp1376747-2 : MDEV-13549 Galera test failures
-lp1376747 : MDEV-13549 Galera test failures
-galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures
-galera_parallel_simple : MDEV-13549 Galera test failures
-galera_admin : MDEV-13549 Galera test failures
-MW-286 : MDEV-13549 Galera test failures 10.1
-galera_as_master: MDEV-13549 Galera test failures 10.1
-galera_pc_ignore_sb : MDEV-13549 Galera test failures 10.1
-galera_lock_table : MDEV-13549 Galera test failures 10.1
-MW-284 : MDEV-13549 Galera test failures 10.1
-galera_as_slave : MDEV-13549 Galera test failures 10.1
+galera.MW-329 : wsrep_local_replays not stable
+galera.MW-328A : have_deadlocks test not stable
+galera_var_retry_autocommit: MDEV-15794 Test failure on galera.galera_var_retry_autocommit
+galera_var_auto_inc_control_on: MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on
+pxc-421 : MDEV-15804 Test failure on galera.pxc-421
+query_cache : MDEV-15805 Test failure on galera.query_cache
+galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log
+galera.MW-44 : MDEV-15809 Test failure on galera.MW-44
+galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
galera_kill_applier : race condition at the start of the test
-GAL-480 : "Lost connection to MySQL"
-MW-328C: MDEV-13549 Galera test failures 10.1
-MW-328A: MDEV-13549 Galera test failures 10.1
-MW-328B: MDEV-13549 Galera test failures 10.1
-MW-328: MDEV-13549 Galera test failures 10.1
-galera_suspend_slave: MDEV-13549 Galera test failures 10.1
galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
-galera_gtid : MDEV-13549 Galera test failures 10.1
-galera_gtid_slave : MDEV-13549 Galera test failures 10.1
-galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1
-galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1
+GAL-480 : "Lost connection to MySQL"
+galera_concurrent_ctas : MDEV-15845 Test failure on galera.galera_concurrent_ctas
diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc
index c61bad8e19d..d7f665df6c7 100644
--- a/mysql-test/suite/galera/include/kill_galera.inc
+++ b/mysql-test/suite/galera/include/kill_galera.inc
@@ -1,7 +1,6 @@
--echo Killing server ...
# Write file to make mysql-test-run.pl expect the crash, but don't start it
---source include/wait_until_connected_again.inc
--let $_server_id= `SELECT @@server_id`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--exec echo "wait" > $_expect_file_name
diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result
index bfb1301f7bd..0f6c0be25fe 100644
--- a/mysql-test/suite/galera/r/MW-284.result
+++ b/mysql-test/suite/galera/r/MW-284.result
@@ -23,3 +23,8 @@ STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('failed registering on master');
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
+connection node_1;
+RESET MASTER;
+CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
+connection node_2;
+CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result
index c007779bc79..7ae34440f7a 100644
--- a/mysql-test/suite/galera/r/MW-44.result
+++ b/mysql-test/suite/galera/r/MW-44.result
@@ -1,8 +1,18 @@
+SET @@global.wsrep_replicate_myisam=OFF;
connection node_1;
TRUNCATE TABLE mysql.general_log;
+SELECT COUNT(*) from mysql.general_log;
+COUNT(*)
+1
connection node_2;
TRUNCATE TABLE mysql.general_log;
+SELECT COUNT(*) from mysql.general_log;
+COUNT(*)
+1
connection node_1;
+SELECT COUNT(*) from mysql.general_log;
+COUNT(*)
+1
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
@@ -16,3 +26,4 @@ SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%';
COUNT(*) = 0
1
DROP TABLE t1;
+SET @@global.wsrep_replicate_myisam=Default;
diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result
index 9d1262724d2..2a7262359fa 100644
--- a/mysql-test/suite/galera/r/galera_as_master.result
+++ b/mysql-test/suite/galera/r/galera_as_master.result
@@ -53,3 +53,5 @@ connection node_3;
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
+connection node_1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_binlog_row_image.result b/mysql-test/suite/galera/r/galera_binlog_row_image.result
index a1f0fb455f3..d54db61105e 100644
--- a/mysql-test/suite/galera/r/galera_binlog_row_image.result
+++ b/mysql-test/suite/galera/r/galera_binlog_row_image.result
@@ -1,3 +1,4 @@
+connection node_1;
SET SESSION binlog_row_image=minimal;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB;
@@ -5,6 +6,7 @@ CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1);
+connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
COUNT(*) = 1
1
@@ -14,9 +16,11 @@ COUNT(*) = 1
SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1;
COUNT(*) = 1
1
+connection node_1;
UPDATE t1 SET f1 = 2 WHERE f1 = 1;
UPDATE t2 SET f1 = 2 WHERE f1 = 1;
UPDATE t3 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
COUNT(*) = 1
1
@@ -26,9 +30,11 @@ COUNT(*) = 1
SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2;
COUNT(*) = 1
1
+connection node_1;
DELETE FROM t1;
DELETE FROM t2;
DELETE FROM t3;
+connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
@@ -41,34 +47,42 @@ COUNT(*) = 0
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+connection node_1;
SET SESSION binlog_row_image=noblob;
CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('abc', 1);
INSERT INTO t2 VALUES ('abc');
+connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc';
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc';
COUNT(*) = 1
1
+connection node_1;
UPDATE t1 SET f1 = 'xyz';
UPDATE t2 SET f1 = 'xyz';
+connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz';
COUNT(*) = 1
1
+connection node_1;
UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2;
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
COUNT(*) = 1
1
+connection node_1;
DELETE FROM t1;
DELETE FROM t2;
+connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result
index 9f5cbdd75fc..e45882db523 100644
--- a/mysql-test/suite/galera/r/galera_gra_log.result
+++ b/mysql-test/suite/galera/r/galera_gra_log.result
@@ -1,6 +1,9 @@
+connection node_2;
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
+connection node_1;
CREATE TABLE t1 (f1 INTEGER);
+connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
@@ -8,22 +11,13 @@ COUNT(*) = 0
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
-# at 4
-<ISO TIMESTAMP> server id 2 end_log_pos 120 Start: binlog v 4, server v 5.6.24-debug-log created 150804 11:37:14 at startup
-# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
-BINLOG '
-unnAVQ8CAAAAdAAAAHgAAAABAAQANS42LjI0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAC6ecBVEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAKNu
-Jfk=
-'/*!*/;
-# at 120
-<ISO TIMESTAMP> server id 1 end_log_pos 91 Query thread_id=<QUERY_THREAD_ID> exec_time=0 error_code=0
+ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=<TIMESTAMP>/*!*/;
SET @@session.pseudo_thread_id=<PSEUDO_THREAD_ID>/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
-SET @@session.sql_mode=1073741824/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result
index 0b6306bdc6a..f8ca6322d22 100644
--- a/mysql-test/suite/galera/r/galera_gtid_slave.result
+++ b/mysql-test/suite/galera/r/galera_gtid_slave.result
@@ -25,7 +25,6 @@ SELECT @@global.gtid_binlog_state;
1-1-4,2-2-2,2-3-3
connection node_1;
DROP TABLE t1,t2;
-reset master;
connection node_2;
connection node_3;
connection node_2;
@@ -34,3 +33,5 @@ RESET SLAVE ALL;
reset master;
connection node_3;
reset master;
+connection node_1;
+reset master;
diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result
index c15f61d298e..ce529deb22c 100644
--- a/mysql-test/suite/galera/r/galera_lock_table.result
+++ b/mysql-test/suite/galera/r/galera_lock_table.result
@@ -1,6 +1,10 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+test/t2
LOCK TABLE t1 READ;
connection node_1;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result
index 3b10815c63d..3f657a0479e 100644
--- a/mysql-test/suite/galera/r/galera_parallel_simple.result
+++ b/mysql-test/suite/galera/r/galera_parallel_simple.result
@@ -1,7 +1,13 @@
CREATE TABLE t1 (id INT) ENGINE=InnoDB;
CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+connection node_2;
SET GLOBAL wsrep_slave_threads = 2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+test/t2
LOCK TABLE t1 WRITE;
+connection node_1;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1);
@@ -14,6 +20,7 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
+connection node_2;
SET SESSION wsrep_sync_wait = 0;
UNLOCK TABLES;
SET SESSION wsrep_sync_wait = 15;
diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result
index 384d91f1d49..3b950e82e33 100644
--- a/mysql-test/suite/galera/r/galera_suspend_slave.result
+++ b/mysql-test/suite/galera/r/galera_suspend_slave.result
@@ -6,13 +6,13 @@ connection node_2;
disconnect node_2;
connection node_1;
Suspending node_2 ...
+SET SESSION wsrep_sync_wait = 0;
INSERT INTO t1 VALUES (1);
Got one of the listed errors
Resuming node_2 ...
-SET SESSION wsrep_sync_wait = 1;
INSERT INTO t1 VALUES (1);
connection node_2a;
-SET SESSION wsrep_sync_wait = 1;
+SET SESSION wsrep_sync_wait = 0;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
index 81781fbeae7..1726bb6445f 100644
--- a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
@@ -9,7 +9,7 @@ CREATE TABLE child (
id INT PRIMARY KEY AUTO_INCREMENT,
parent_id INT
) ENGINE=InnoDB;
-INSERT INTO parent VALUES (DEFAULT, 0);
+INSERT INTO parent VALUES (1, 0);
INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
index c1bb065975b..0cbba2fa124 100644
--- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
@@ -1,4 +1,10 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE
+2
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+VARIABLE_VALUE
+0
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
@@ -7,6 +13,12 @@ SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_
1
INSERT INTO t1 VALUES (DEFAULT, 'node1');;
INSERT INTO t1 VALUES (DEFAULT, 'node2');;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE
+2
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+VARIABLE_VALUE
+1
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
index 79fe64f2783..3f0a63ab9d7 100644
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -110,6 +110,8 @@ INSERT INTO t1 VALUES (DEFAULT);
INSERT INTO t1 VALUES (DEFAULT);
DROP TABLE t1;
connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
COUNT(*) = 1
1
diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
index 5324d1c11dd..99c680c7b12 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
@@ -4,6 +4,9 @@ INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
connection node_2;
+SELECT COUNT(*) = 100000 FROM t1;
+COUNT(*) = 100000
+1
SET GLOBAL wsrep_desync = TRUE;
SET SESSION wsrep_on = FALSE;
ALTER TABLE t1 ADD PRIMARY KEY (f1);
diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result
index dba3eb45af5..b85e130f4f4 100644
--- a/mysql-test/suite/galera/r/lp1376747-2.result
+++ b/mysql-test/suite/galera/r/lp1376747-2.result
@@ -1,6 +1,9 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
FLUSH TABLES t1 FOR EXPORT;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result
index 4858835c83f..16d4fa3fc52 100644
--- a/mysql-test/suite/galera/r/lp1376747.result
+++ b/mysql-test/suite/galera/r/lp1376747.result
@@ -1,6 +1,9 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
FLUSH TABLES t1 WITH READ LOCK;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
index 1c4bbc3f369..fc3db249c25 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#33.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -1,4 +1,6 @@
Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
@@ -98,5 +100,4 @@ CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
+Restarting server ...
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#90.result b/mysql-test/suite/galera/r/mysql-wsrep#90.result
index da57b9d0068..0b8f55e6219 100644
--- a/mysql-test/suite/galera/r/mysql-wsrep#90.result
+++ b/mysql-test/suite/galera/r/mysql-wsrep#90.result
@@ -1,31 +1,44 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
SET GLOBAL wsrep_OSU_method = "RSU";
SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_OSU_method = "TOI";
SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
+connection node_2;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
+connection node_1;
DROP TABLE t1;
+SET DEBUG_SYNC = 'RESET';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
SET GLOBAL wsrep_OSU_method = "TOI";
SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connection node_1a;
SET SESSION wsrep_sync_wait = 0;
SET GLOBAL wsrep_OSU_method = "RSU";
SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
INSERT INTO t1 VALUES (1,2);
+connection node_2;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
INSERT INTO t1 VALUES (3,4);
+connection node_1;
DROP TABLE t1;
SET GLOBAL WSREP_OSU_METHOD = TOI;
+SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/galera/r/pxc-421.result b/mysql-test/suite/galera/r/pxc-421.result
index 38bf64f20c5..d60c7c4540e 100644
--- a/mysql-test/suite/galera/r/pxc-421.result
+++ b/mysql-test/suite/galera/r/pxc-421.result
@@ -1,4 +1,6 @@
connection node_1;
+connection node_2;
+connection node_1;
set GLOBAL wsrep_slave_threads=26;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
@@ -32,7 +34,6 @@ SET GLOBAL wsrep_slave_threads = 1;
SELECT COUNT(*) FROM t1;
COUNT(*)
16
-SET GLOBAL auto_increment_offset = 2;
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
@@ -42,4 +43,3 @@ Variable_name Value
wsrep_slave_threads 12
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
-SET GLOBAL auto_increment_offset = 1;
diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test
index 7add82f1227..5e17baa1bdb 100644
--- a/mysql-test/suite/galera/t/MW-284.test
+++ b/mysql-test/suite/galera/t/MW-284.test
@@ -24,7 +24,6 @@ SET global wsrep_sync_wait=0;
--connection node_3
START SLAVE;
---sleep 1
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Connecting
--source include/wait_for_slave_param.inc
@@ -38,6 +37,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--source include/wait_for_slave_to_start.inc
--connection node_1
+--source include/galera_wait_ready.inc
INSERT INTO t1 VALUES (1);
--connection node_3
@@ -61,3 +61,10 @@ RESET SLAVE ALL;
CALL mtr.add_suppression('failed registering on master');
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
+
+--connection node_1
+RESET MASTER;
+CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
+
+--connection node_2
+CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test
index 133676b9141..2b27e69893c 100644
--- a/mysql-test/suite/galera/t/MW-44.test
+++ b/mysql-test/suite/galera/t/MW-44.test
@@ -5,15 +5,19 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+SET @@global.wsrep_replicate_myisam=OFF;
--connection node_1
TRUNCATE TABLE mysql.general_log;
+SELECT COUNT(*) from mysql.general_log;
--sleep 1
--connection node_2
TRUNCATE TABLE mysql.general_log;
+SELECT COUNT(*) from mysql.general_log;
--sleep 1
--connection node_1
+SELECT COUNT(*) from mysql.general_log;
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
@@ -25,3 +29,4 @@ SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argu
--connection node_2
SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%';
DROP TABLE t1;
+SET @@global.wsrep_replicate_myisam=Default;
diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test
index a56fb6dc976..49f3c993256 100644
--- a/mysql-test/suite/galera/t/galera_as_master.test
+++ b/mysql-test/suite/galera/t/galera_as_master.test
@@ -27,7 +27,6 @@ CREATE TABLE test.t3 AS SELECT * from t1;
SET SQL_LOG_BIN=ON;
INSERT INTO t1 VALUES(3);
CREATE TABLE test.t4 AS SELECT * from t1;
---save_master_pos
--connection node_2
SELECT * FROM t1;
@@ -36,7 +35,12 @@ SELECT * FROM t3;
SELECT * FROM t4;
--connection node_3
---sync_with_master
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t4;
+--source include/wait_condition.inc
+
SHOW TABLES;
SELECT * FROM t1;
@@ -45,15 +49,19 @@ SELECT * FROM t4;
--echo # Cleanup
--connection node_1
DROP TABLE t1, t4;
---save_master_pos
SET SQL_LOG_BIN=OFF;
DROP TABLE t2, t3;
--connection node_3
---sync_with_master
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't4';
+--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
+--connection node_1
+RESET MASTER;
diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.test b/mysql-test/suite/galera/t/galera_gcs_fragment.test
index ae1e0d8bab0..0436e312f6e 100644
--- a/mysql-test/suite/galera/t/galera_gcs_fragment.test
+++ b/mysql-test/suite/galera/t/galera_gcs_fragment.test
@@ -1,6 +1,7 @@
# Test fragmentation over configuration changes
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source suite/galera/include/galera_have_debug_sync.inc
# Prepare table
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT);
diff --git a/mysql-test/suite/galera/t/galera_gra_log.test b/mysql-test/suite/galera/t/galera_gra_log.test
index 5329dc24546..adb37de9188 100644
--- a/mysql-test/suite/galera/t/galera_gra_log.test
+++ b/mysql-test/suite/galera/t/galera_gra_log.test
@@ -19,17 +19,10 @@ CREATE TABLE t1 (f1 INTEGER);
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
-# Compose a valid binlog from a header file and the GRA file
+# Make sure the GRA file produced is readable and contains the failure
---let $gra_binlog_file = $MYSQLTEST_VARDIR/tmp/gra.log
---exec rm -rf $gra_binlog_file
-
---exec cp std_data/binlog-header.log $gra_binlog_file
---exec cat $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log >> $gra_binlog_file
-
-# Make sure the binlog thus produced is readable and contains the failure
---replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /#[0-9]+ +[0-9]+:[0-9]+:[0-9]+/<ISO TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/ /thread_id=[0-9]+/thread_id=<QUERY_THREAD_ID>/
---exec $MYSQL_BINLOG $gra_binlog_file
+--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
SET SESSION wsrep_on=ON;
diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test
index 8ef87452a5b..19bfd8e17db 100644
--- a/mysql-test/suite/galera/t/galera_gtid_slave.test
+++ b/mysql-test/suite/galera/t/galera_gtid_slave.test
@@ -38,7 +38,13 @@ SELECT @@global.gtid_binlog_state;
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
---sleep 1
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t2;
+--source include/wait_condition.inc
+
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
@@ -52,14 +58,6 @@ SELECT @@global.gtid_binlog_state;
--connection node_1
DROP TABLE t1,t2;
-reset master;
-#
-# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
-# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
-# warning is also reported by MTR, which is also weird.
-#
-
---sleep 1
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
@@ -76,3 +74,6 @@ reset master;
--connection node_3
reset master;
+
+--connection node_1
+reset master;
diff --git a/mysql-test/suite/galera/t/galera_lock_table.test b/mysql-test/suite/galera/t/galera_lock_table.test
index 0bcaf646917..3e365036405 100644
--- a/mysql-test/suite/galera/t/galera_lock_table.test
+++ b/mysql-test/suite/galera/t/galera_lock_table.test
@@ -14,6 +14,13 @@ CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
--sleep 1
--connection node_2
+
+# Wait until above DDL's are replicated
+--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+
LOCK TABLE t1 READ;
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test
index 41cd0c8e6fa..2cd840123cf 100644
--- a/mysql-test/suite/galera/t/galera_parallel_simple.test
+++ b/mysql-test/suite/galera/t/galera_parallel_simple.test
@@ -13,6 +13,13 @@ CREATE TABLE t2 (id INT) ENGINE=InnoDB;
--connection node_2
SET GLOBAL wsrep_slave_threads = 2;
+
+# Wait until above DDL's are replicated
+--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+
LOCK TABLE t1 WRITE;
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test
index aa4543cf81c..6f0f8014397 100644
--- a/mysql-test/suite/galera/t/galera_suspend_slave.test
+++ b/mysql-test/suite/galera/t/galera_suspend_slave.test
@@ -29,6 +29,11 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
exit(0);
EOF
+SET SESSION wsrep_sync_wait = 0;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
--error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (1);
@@ -41,8 +46,6 @@ INSERT INTO t1 VALUES (1);
exit(0);
EOF
-SET SESSION wsrep_sync_wait = 1;
---sleep 10
--source include/wait_until_ready.inc
INSERT INTO t1 VALUES (1);
@@ -51,7 +54,7 @@ INSERT INTO t1 VALUES (1);
--source include/galera_connect.inc
--connection node_2a
-SET SESSION wsrep_sync_wait = 1;
+SET SESSION wsrep_sync_wait = 0;
--source include/wait_until_ready.inc
SELECT COUNT(*) = 1 FROM t1;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
index 1f446938775..9f161afc52e 100644
--- a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test
@@ -20,7 +20,7 @@ CREATE TABLE child (
parent_id INT
) ENGINE=InnoDB;
-INSERT INTO parent VALUES (DEFAULT, 0);
+INSERT INTO parent VALUES (1, 0);
--connection node_2
--send INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test
index 821f7a6eb2c..dbd2510cba3 100644
--- a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test
@@ -17,12 +17,23 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
--reap
INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
+--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
--connection node_1
--reap
+
+--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
new file mode 100644
index 00000000000..0a03610888c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
@@ -0,0 +1 @@
+--wsrep-auto-increment-control=ON
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
index d65a35be4d1..6abaecb144b 100644
--- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.test
@@ -5,6 +5,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
--connection node_1
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
@@ -12,6 +17,8 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE
# auto_increment_increment is equal to the number of nodes
# auto_increment_offset is equal to the ID of the node
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
@@ -27,6 +34,8 @@ SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_
--connection node_2
--reap
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
SELECT @@global.auto_increment_offset = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index') + 1;
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test
index 3896b1d48cf..e5986f7ee12 100644
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@ -86,6 +86,13 @@ INSERT INTO t1 VALUES (DEFAULT);
DROP TABLE t1;
--connection node_2
+
+# Wait until above DDL is replicated
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+
#
# make sure that we are left with exactly one applier thread before we leaving the test
#
diff --git a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test
index 3c7988a4924..ecf255f59c3 100644
--- a/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test
+++ b/mysql-test/suite/galera/t/galera_wsrep_desync_wsrep_on.test
@@ -17,6 +17,8 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
--connection node_2
+SELECT COUNT(*) = 100000 FROM t1;
+
SET GLOBAL wsrep_desync = TRUE;
SET SESSION wsrep_on = FALSE;
diff --git a/mysql-test/suite/galera/t/lp1376747-2.test b/mysql-test/suite/galera/t/lp1376747-2.test
index 360681d7674..c570dd7d143 100644
--- a/mysql-test/suite/galera/t/lp1376747-2.test
+++ b/mysql-test/suite/galera/t/lp1376747-2.test
@@ -5,6 +5,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
+
+# Wait until above DDL's are replicated
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+
FLUSH TABLES t1 FOR EXPORT;
--connection node_1
diff --git a/mysql-test/suite/galera/t/lp1376747.test b/mysql-test/suite/galera/t/lp1376747.test
index 769bb665c77..7daa544686f 100644
--- a/mysql-test/suite/galera/t/lp1376747.test
+++ b/mysql-test/suite/galera/t/lp1376747.test
@@ -5,6 +5,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
+
+# Wait until above DDL's are replicated
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+
FLUSH TABLES t1 WITH READ LOCK;
--connection node_1
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.test b/mysql-test/suite/galera/t/mysql-wsrep#33.test
index acc7c735849..351e457f165 100644
--- a/mysql-test/suite/galera/t/mysql-wsrep#33.test
+++ b/mysql-test/suite/galera/t/mysql-wsrep#33.test
@@ -3,6 +3,9 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--let $node_1=node_1
+--let $node_2=node_2
+--source suite/galera/include/auto_increment_offset_save.inc
--source suite/galera/include/galera_sst_set_mysqldump.inc
--source suite/galera/include/galera_st_disconnect_slave.inc
@@ -10,9 +13,8 @@
--source suite/galera/include/galera_sst_restore.inc
--connection node_2
-# We have to manually restore global_log and slow_query_log due to mysql-wsrep#108
-# Otherwise MTR's check_testcases complains
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
+--echo Restarting server ...
+--source include/restart_mysqld.inc
+--source suite/galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#90.test b/mysql-test/suite/galera/t/mysql-wsrep#90.test
index 5af86fb2872..11ef6416526 100644
--- a/mysql-test/suite/galera/t/mysql-wsrep#90.test
+++ b/mysql-test/suite/galera/t/mysql-wsrep#90.test
@@ -31,6 +31,7 @@ SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--connection node_1
DROP TABLE t1;
+SET DEBUG_SYNC = 'RESET';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
@@ -63,3 +64,4 @@ INSERT INTO t1 VALUES (3,4);
DROP TABLE t1;
SET GLOBAL WSREP_OSU_METHOD = TOI;
+SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/galera/t/pxc-421.test b/mysql-test/suite/galera/t/pxc-421.test
index 381f9bb4494..7bb2354853b 100644
--- a/mysql-test/suite/galera/t/pxc-421.test
+++ b/mysql-test/suite/galera/t/pxc-421.test
@@ -6,6 +6,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
--connection node_1
--let $wsrep_slave_1 = `SELECT @@wsrep_slave_threads`
set GLOBAL wsrep_slave_threads=26;
@@ -54,12 +59,11 @@ show global variables like 'wsrep_slave_threads';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_2
SELECT COUNT(*) FROM t1;
-SET GLOBAL auto_increment_offset = 2;
-
--connection node_1
SELECT COUNT(*) FROM t1;
show global variables like 'wsrep_slave_threads';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_1
DROP TABLE t1;
-SET GLOBAL auto_increment_offset = 1;
+--source include/auto_increment_offset_restore.inc
+
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
index c118b7481bc..d69881aa5eb 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test
@@ -9,16 +9,12 @@
--connection node_1
SET GLOBAL wsrep_provider_options = 'pc.weight=3';
-
---source include/wait_until_connected_again.inc
--source include/galera_suspend.inc
--sleep 10
--connection node_2
# Do not wait for causality as we are no longer in the primary component
SET SESSION wsrep_sync_wait=0;
---source include/wait_until_connected_again.inc
-
SET SESSION wsrep_on=OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
--source include/wait_condition.inc
@@ -39,7 +35,6 @@ SHOW STATUS LIKE 'wsrep_local_state_comment';
--source include/galera_connect.inc
--connection node_3
SET SESSION wsrep_sync_wait=0;
---source include/wait_until_connected_again.inc
SHOW STATUS LIKE 'wsrep_cluster_size';
SHOW STATUS LIKE 'wsrep_cluster_status';
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
index 1584c433009..732fa7c3f57 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
@@ -688,3 +688,55 @@ SELECT f1, f3 FROM t2;
f1 f3
3 2
DROP TABLE t2, t1;
+#
+# MDEV-15553 Assertion failed in dict_table_get_col_name
+#
+CREATE TABLE t1 (
+c1 TIMESTAMP,
+c2 YEAR,
+c3 TIME,
+c4 CHAR(10),
+v1 TIMESTAMP AS (c1) VIRTUAL,
+v2 YEAR AS (c2) VIRTUAL,
+v3 TIME AS (c3) VIRTUAL,
+v4 CHAR(10) AS (c4) VIRTUAL
+) ENGINE=InnoDB;
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+SET foreign_key_checks=0;
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk' in the foreign table 't1'
+ALTER TABLE t1 ADD INDEX(v4);
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+SET foreign_key_checks=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `c2` year(4) DEFAULT NULL,
+ `c3` time DEFAULT NULL,
+ `c4` char(10) DEFAULT NULL,
+ `v1` timestamp GENERATED ALWAYS AS (`c1`) VIRTUAL,
+ `v2` year(4) GENERATED ALWAYS AS (`c2`) VIRTUAL,
+ `v3` time GENERATED ALWAYS AS (`c3`) VIRTUAL,
+ `v4` char(10) GENERATED ALWAYS AS (`c4`) VIRTUAL,
+ KEY `v4` (`v4`),
+ CONSTRAINT `fk` FOREIGN KEY (`v4`) REFERENCES `nosuch` (`col`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP FOREIGN KEY fk;
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `c2` year(4) DEFAULT NULL,
+ `c3` time DEFAULT NULL,
+ `c4` char(10) DEFAULT NULL,
+ `v1` timestamp GENERATED ALWAYS AS (`c1`) VIRTUAL,
+ `v2` year(4) GENERATED ALWAYS AS (`c2`) VIRTUAL,
+ `v3` time GENERATED ALWAYS AS (`c3`) VIRTUAL,
+ `v4` char(10) GENERATED ALWAYS AS (`c4`) VIRTUAL,
+ KEY `v4` (`v4`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
index 6b02b0adbbe..92776aa407d 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
@@ -576,3 +576,34 @@ UPDATE t1 SET f1 = 3;
EXPLAIN SELECT f1, f3 FROM t2;
SELECT f1, f3 FROM t2;
DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-15553 Assertion failed in dict_table_get_col_name
+--echo #
+CREATE TABLE t1 (
+ c1 TIMESTAMP,
+ c2 YEAR,
+ c3 TIME,
+ c4 CHAR(10),
+ v1 TIMESTAMP AS (c1) VIRTUAL,
+ v2 YEAR AS (c2) VIRTUAL,
+ v3 TIME AS (c3) VIRTUAL,
+ v4 CHAR(10) AS (c4) VIRTUAL
+) ENGINE=InnoDB;
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+SET foreign_key_checks=0;
+--error ER_FK_NO_INDEX_CHILD
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+ALTER TABLE t1 ADD INDEX(v4);
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+SET foreign_key_checks=1;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP FOREIGN KEY fk;
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
+SHOW CREATE TABLE t1;
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/mdev-15707.result b/mysql-test/suite/innodb/r/mdev-15707.result
new file mode 100644
index 00000000000..3967ce48b62
--- /dev/null
+++ b/mysql-test/suite/innodb/r/mdev-15707.result
@@ -0,0 +1,24 @@
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(255),
+INDEX(b))
+ENGINE=InnoDB;
+INSERT INTO t1(b) SELECT UUID();
+BEGIN;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+INSERT INTO t1(b) SELECT UUID() FROM t1;
+COMMIT;
+UPDATE t1 SET b=UUID();
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
index bfb5081d336..1fb7c6d0f77 100644
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
@@ -10,10 +10,7 @@
# #
######################################################################
-# Don't test this under valgrind, memory leaks will occur due restart
---source include/not_valgrind.inc
-# Test restart the server and "shutdown_server" looks for pid file
-# which is not there with embedded mode
+# Embedded server tests do not support restarting
--source include/not_embedded.inc
#------------------------------------------------------------------------------
diff --git a/mysql-test/suite/innodb/t/mdev-15707.opt b/mysql-test/suite/innodb/t/mdev-15707.opt
new file mode 100644
index 00000000000..fec3463c6d0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/mdev-15707.opt
@@ -0,0 +1 @@
+--innodb --innodb-buffer-pool-size=5MB --innodb-read-io-threads=1 --innodb-doublewrite=0 --innodb-flush-log-at-trx-commit=0 \ No newline at end of file
diff --git a/mysql-test/suite/innodb/t/mdev-15707.test b/mysql-test/suite/innodb/t/mdev-15707.test
new file mode 100644
index 00000000000..46e1ee7ce57
--- /dev/null
+++ b/mysql-test/suite/innodb/t/mdev-15707.test
@@ -0,0 +1,28 @@
+--source include/windows.inc
+
+# Deadlock in conjunction with the innodb change buffering.
+
+# When innodb change buffering kicks in, i.e secondary non-unique index
+# does not fit into the bufferpool, then, on Windows, innodb
+# background threads could deadlock whenever index page is
+# read, and the page needs load/merge change buffer.
+# The test tries to reproduce this situation, by creating index
+# that does not fit into bufferpool, and doing a large update.
+
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(255),
+INDEX(b))
+ENGINE=InnoDB;
+
+INSERT INTO t1(b) SELECT UUID();
+BEGIN;
+let $i=`select cast(log2(@@innodb_buffer_pool_size/255) as int)`;
+while ($i)
+{
+ INSERT INTO t1(b) SELECT UUID() FROM t1;
+ dec $i;
+}
+COMMIT;
+UPDATE t1 SET b=UUID();
+DROP TABLE t1; \ No newline at end of file
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
index f294b441411..357aa07f08d 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
@@ -561,8 +561,15 @@ disconnect con4a;
disconnect con4b;
disconnect con4c;
set global max_user_connections = 0;
-set global max_connections = 3;
+set global max_connections = 10;
flush user_resources;
+connect tmp_con1,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con2,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con3,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con4,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con5,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con6,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con7,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
connect con5a,"127.0.0.1",quota,,test,$MASTER_MYPORT,;
select "Con4a is alive";
Con4a is alive
@@ -697,6 +704,13 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
disconnect con5a;
disconnect con5b;
+disconnect tmp_con1;
+disconnect tmp_con2;
+disconnect tmp_con3;
+disconnect tmp_con4;
+disconnect tmp_con5;
+disconnect tmp_con6;
+disconnect tmp_con7;
set global max_connections = @saved_max_connections;
set global max_user_connections = @saved_max_user_connections;
drop user 'quota'@'santa.claus.ipv4.example.com';
diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
index d97fe0a82ff..8fe9a0954a3 100644
--- a/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
+++ b/mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
@@ -561,8 +561,15 @@ disconnect con4a;
disconnect con4b;
disconnect con4c;
set global max_user_connections = 0;
-set global max_connections = 3;
+set global max_connections = 10;
flush user_resources;
+connect tmp_con1,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con2,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con3,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con4,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con5,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con6,"::1",quota,,test,$MASTER_MYPORT,;
+connect tmp_con7,"::1",quota,,test,$MASTER_MYPORT,;
connect con5a,"::1",quota,,test,$MASTER_MYPORT,;
select "Con4a is alive";
Con4a is alive
@@ -697,6 +704,13 @@ FIRST_ERROR_SEEN set
LAST_ERROR_SEEN set
disconnect con5a;
disconnect con5b;
+disconnect tmp_con1;
+disconnect tmp_con2;
+disconnect tmp_con3;
+disconnect tmp_con4;
+disconnect tmp_con5;
+disconnect tmp_con6;
+disconnect tmp_con7;
set global max_connections = @saved_max_connections;
set global max_user_connections = @saved_max_user_connections;
drop user 'quota'@'santa.claus.ipv6.example.com';
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
index 3bf5ef3b68d..4eb630f6350 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
@@ -176,9 +176,17 @@ disconnect con4c;
--source ../include/wait_for_pfs_thread_count.inc
set global max_user_connections = 0;
-set global max_connections = 3;
+set global max_connections = 10;
flush user_resources;
+connect (tmp_con1,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con2,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con3,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con4,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con5,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con6,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con7,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
+
connect (con5a,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
select "Con4a is alive";
select current_user();
@@ -233,6 +241,13 @@ connect (con5d,"127.0.0.1",quota,,test,$MASTER_MYPORT,);
disconnect con5a;
disconnect con5b;
+--disconnect tmp_con1
+--disconnect tmp_con2
+--disconnect tmp_con3
+--disconnect tmp_con4
+--disconnect tmp_con5
+--disconnect tmp_con6
+--disconnect tmp_con7
# Wait for all disconnects
--source ../include/wait_for_pfs_thread_count.inc
diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
index 0ced79544a3..8948ea45e37 100644
--- a/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
+++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
@@ -177,9 +177,17 @@ disconnect con4c;
--source ../include/wait_for_pfs_thread_count.inc
set global max_user_connections = 0;
-set global max_connections = 3;
+set global max_connections = 10;
flush user_resources;
+connect (tmp_con1,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con2,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con3,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con4,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con5,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con6,"::1",quota,,test,$MASTER_MYPORT,);
+connect (tmp_con7,"::1",quota,,test,$MASTER_MYPORT,);
+
connect (con5a,"::1",quota,,test,$MASTER_MYPORT,);
select "Con4a is alive";
select current_user();
@@ -215,6 +223,13 @@ connect (con5d,"::1",quota,,test,$MASTER_MYPORT,);
disconnect con5a;
disconnect con5b;
+--disconnect tmp_con1
+--disconnect tmp_con2
+--disconnect tmp_con3
+--disconnect tmp_con4
+--disconnect tmp_con5
+--disconnect tmp_con6
+--disconnect tmp_con7
# Wait for all disconnects
--source ../include/wait_for_pfs_thread_count.inc
diff --git a/mysql-test/suite/rpl/include/type_conversions.test b/mysql-test/suite/rpl/include/type_conversions.test
index 50fec23f6c9..dc8706a7ec1 100644
--- a/mysql-test/suite/rpl/include/type_conversions.test
+++ b/mysql-test/suite/rpl/include/type_conversions.test
@@ -1043,8 +1043,139 @@ let $can_convert = $if_is_lossy;
source suite/rpl/include/check_type.inc;
SET column_compression_threshold=DEFAULT;
---echo # End of MDEV-15833
+--echo # End of MDEV-15821
+
+
+--echo #
+--echo # MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+--echo #
+
+# TINYBLOB
+
+let $source_type= TINYBLOB;
+let $target_type= BLOB;
+let $source_value= REPEAT('a',250);
+let $target_value= REPEAT('a',250);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= TINYBLOB;
+let $target_type= MEDIUMBLOB;
+let $source_value= REPEAT('a',250);
+let $target_value= REPEAT('a',250);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= TINYBLOB;
+let $target_type= LONGBLOB;
+let $source_value= REPEAT('a',250);
+let $target_value= REPEAT('a',250);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= TINYBLOB;
+let $target_type= VARBINARY(255);
+let $source_value= REPEAT('a',250);
+let $target_value= REPEAT('a',250);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+
+# BLOB
+
+let $source_type= BLOB;
+let $target_type= TINYBLOB;
+let $source_value= REPEAT('a',64000);
+let $target_value= REPEAT('a',255);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= BLOB;
+let $target_type= MEDIUMBLOB;
+let $source_value= REPEAT('a',64000);
+let $target_value= REPEAT('a',64000);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= BLOB;
+let $target_type= LONGBLOB;
+let $source_value= REPEAT('a',64000);
+let $target_value= REPEAT('a',64000);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= BLOB;
+let $target_type= VARBINARY(65500);
+let $source_value= REPEAT('a',65535);
+let $target_value= REPEAT('a',65500);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+# MEDIUMBLOB
+
+let $source_type= MEDIUMBLOB;
+let $target_type= TINYBLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',255);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= MEDIUMBLOB;
+let $target_type= BLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',65535);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+# This failed before the fix
+let $source_type= MEDIUMBLOB;
+let $target_type= LONGBLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',66000);
+let $can_convert = $if_is_non_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= MEDIUMBLOB;
+let $target_type= VARBINARY(65500);
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',65500);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+
+# LONGBLOB
+
+let $source_type= LONGBLOB;
+let $target_type= TINYBLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',255);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= LONGBLOB;
+let $target_type= BLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',65535);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+# This failed before the fix
+let $source_type= LONGBLOB;
+let $target_type= MEDIUMBLOB;
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',66000);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+let $source_type= LONGBLOB;
+let $target_type= VARBINARY(65500);
+let $source_value= REPEAT('a',66000);
+let $target_value= REPEAT('a',65500);
+let $can_convert = $if_is_lossy;
+source suite/rpl/include/check_type.inc;
+
+--echo # End of MDEV-15833
+
--source include/rpl_reset.inc
enable_query_log;
diff --git a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result
index fa7deca3cff..cb50c69aa55 100644
--- a/mysql-test/suite/rpl/r/rpl_typeconv.result
+++ b/mysql-test/suite/rpl/r/rpl_typeconv.result
@@ -42,6 +42,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -50,6 +54,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -58,6 +66,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -66,6 +78,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY';
#
# MDEV-15821 Row format replication from LONGBLOB COMPRESSED to LONGBLOB does not work
#
+# End of MDEV-15821
+#
+# MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values
+#
# End of MDEV-15833
include/rpl_reset.inc
connection slave;
@@ -212,6 +228,22 @@ LONGBLOB COMPRE BLOB <Correct error>
LONGBLOB COMPRE MEDIUMBLOB <Correct error>
LONGBLOB COMPRE LONGBLOB <Correct error>
LONGBLOB COMPRE VARBINARY(65500 <Correct error>
+TINYBLOB BLOB <Correct error>
+TINYBLOB MEDIUMBLOB <Correct error>
+TINYBLOB LONGBLOB <Correct error>
+TINYBLOB VARBINARY(255) <Correct error>
+BLOB TINYBLOB <Correct error>
+BLOB MEDIUMBLOB <Correct error>
+BLOB LONGBLOB <Correct error>
+BLOB VARBINARY(65500 <Correct error>
+MEDIUMBLOB TINYBLOB <Correct error>
+MEDIUMBLOB BLOB <Correct error>
+MEDIUMBLOB LONGBLOB <Correct error>
+MEDIUMBLOB VARBINARY(65500 <Correct error>
+LONGBLOB TINYBLOB <Correct error>
+LONGBLOB BLOB <Correct error>
+LONGBLOB MEDIUMBLOB <Correct error>
+LONGBLOB VARBINARY(65500 <Correct error>
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
@@ -353,6 +385,22 @@ LONGBLOB COMPRE BLOB ALL_NON_LOSSY <Correct error>
LONGBLOB COMPRE MEDIUMBLOB ALL_NON_LOSSY <Correct error>
LONGBLOB COMPRE LONGBLOB ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+TINYBLOB VARBINARY(255) ALL_NON_LOSSY <Correct value>
+BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
+BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+BLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
+MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
+LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
+LONGBLOB VARBINARY(65500 ALL_NON_LOSSY <Correct error>
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY <Correct error>
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
@@ -494,6 +542,22 @@ LONGBLOB COMPRE BLOB ALL_LOSSY <Correct value>
LONGBLOB COMPRE MEDIUMBLOB ALL_LOSSY <Correct value>
LONGBLOB COMPRE LONGBLOB ALL_LOSSY <Correct error>
LONGBLOB COMPRE VARBINARY(65500 ALL_LOSSY <Correct value>
+TINYBLOB BLOB ALL_LOSSY <Correct error>
+TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
+TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
+TINYBLOB VARBINARY(255) ALL_LOSSY <Correct error>
+BLOB TINYBLOB ALL_LOSSY <Correct value>
+BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
+BLOB LONGBLOB ALL_LOSSY <Correct error>
+BLOB VARBINARY(65500 ALL_LOSSY <Correct value>
+MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
+MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
+MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
+MEDIUMBLOB VARBINARY(65500 ALL_LOSSY <Correct value>
+LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
+LONGBLOB BLOB ALL_LOSSY <Correct value>
+LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
+LONGBLOB VARBINARY(65500 ALL_LOSSY <Correct value>
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
@@ -635,6 +699,22 @@ LONGBLOB COMPRE BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB COMPRE VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+TINYBLOB VARBINARY(255) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+BLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+MEDIUMBLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
+LONGBLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY <Correct value>
DROP TABLE type_conversions;
call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677");
connection master;
diff --git a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
index a9a683e017b..a0a849c1d7a 100644
--- a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
+++ b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result
@@ -1,3 +1,3 @@
select @@global.host_cache_size;
@@global.host_cache_size
-653
+632
diff --git a/mysql-test/suite/sys_vars/r/max_connections_basic.result b/mysql-test/suite/sys_vars/r/max_connections_basic.result
index c215f2130c7..b4d23427e41 100644
--- a/mysql-test/suite/sys_vars/r/max_connections_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_connections_basic.result
@@ -27,20 +27,24 @@ SELECT @@global.max_connections;
@@global.max_connections
65536
SET @@global.max_connections = 1;
+Warnings:
+Warning 1292 Truncated incorrect max_connections value: '1'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
SET @@global.max_connections = 2;
+Warnings:
+Warning 1292 Truncated incorrect max_connections value: '2'
SELECT @@global.max_connections;
@@global.max_connections
-2
+10
'#--------------------FN_DYNVARS_074_04-------------------------#'
SET @@global.max_connections = -1;
Warnings:
Warning 1292 Truncated incorrect max_connections value: '-1'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
SET @@global.max_connections = 100000000000;
Warnings:
Warning 1292 Truncated incorrect max_connections value: '100000000000'
@@ -57,13 +61,13 @@ Warnings:
Warning 1292 Truncated incorrect max_connections value: '-1024'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
SET @@global.max_connections = 0;
Warnings:
Warning 1292 Truncated incorrect max_connections value: '0'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
SET @@global.max_connections = 100001;
Warnings:
Warning 1292 Truncated incorrect max_connections value: '100001'
@@ -98,15 +102,17 @@ WHERE VARIABLE_NAME='max_connections';
1
'#---------------------FN_DYNVARS_074_07----------------------#'
SET @@global.max_connections = TRUE;
+Warnings:
+Warning 1292 Truncated incorrect max_connections value: '1'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
SET @@global.max_connections = FALSE;
Warnings:
Warning 1292 Truncated incorrect max_connections value: '0'
SELECT @@global.max_connections;
@@global.max_connections
-1
+10
'#---------------------FN_DYNVARS_074_08----------------------#'
SET @@global.max_connections = 5000;
SELECT @@max_connections = @@global.max_connections;
diff --git a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result
index 9ee2e170051..453f6953406 100644
--- a/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_prepared_stmt_count_basic.result
@@ -46,40 +46,40 @@ Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '100000000000'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
+4294967295
SET @@global.max_prepared_stmt_count = 10000.01;
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
+4294967295
SET @@global.max_prepared_stmt_count = -1024;
Warnings:
Warning 1292 Truncated incorrect max_prepared_stmt_count value: '-1024'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
0
-SET @@global.max_prepared_stmt_count = 1048577;
+SET @@global.max_prepared_stmt_count = 4294967296;
Warnings:
-Warning 1292 Truncated incorrect max_prepared_stmt_count value: '1048577'
+Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4294967296'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
-SET @@global.max_prepared_stmt_count = 104857612;
+4294967295
+SET @@global.max_prepared_stmt_count = 4294967295*1024;
Warnings:
-Warning 1292 Truncated incorrect max_prepared_stmt_count value: '104857612'
+Warning 1292 Truncated incorrect max_prepared_stmt_count value: '4398046510080'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
+4294967295
SET @@global.max_prepared_stmt_count = ON;
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
+4294967295
SET @@global.max_prepared_stmt_count = 'test';
ERROR 42000: Incorrect argument type to variable 'max_prepared_stmt_count'
SELECT @@global.max_prepared_stmt_count;
@@global.max_prepared_stmt_count
-1048576
+4294967295
'#-------------------FN_DYNVARS_081_05----------------------------#'
SET @@session.max_prepared_stmt_count = 4096;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index c33934cddb6..b81a1ac58dd 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -2036,7 +2036,7 @@ DEFAULT_VALUE 151
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of simultaneous clients allowed
-NUMERIC_MIN_VALUE 1
+NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 100000
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -2174,10 +2174,10 @@ GLOBAL_VALUE 16382
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16382
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum number of prepared statements in the server
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 1048576
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -4102,13 +4102,13 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
SESSION_VALUE NULL
-GLOBAL_VALUE 2000
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 100
+GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
-NUMERIC_MIN_VALUE 1
+NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 67786cca5fb..388bd485c71 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -2232,7 +2232,7 @@ DEFAULT_VALUE 151
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of simultaneous clients allowed
-NUMERIC_MIN_VALUE 1
+NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 100000
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
@@ -2370,10 +2370,10 @@ GLOBAL_VALUE 16382
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16382
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Maximum number of prepared statements in the server
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 1048576
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5054,13 +5054,13 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE
SESSION_VALUE NULL
-GLOBAL_VALUE 2000
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
+GLOBAL_VALUE 100
+GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached open tables
-NUMERIC_MIN_VALUE 1
+NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 1048576
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
index 4e9190e022d..2130723e5ff 100644
--- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
+++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.table_open_cache ;
SELECT @start_value;
@start_value
-2000
+421
'#--------------------FN_DYNVARS_001_01------------------------#'
SET @@global.table_open_cache = 99;
SET @@global.table_open_cache = DeFAULT;
@@ -15,13 +15,17 @@ SELECT @@global.table_open_cache = 400;
0
'#--------------------FN_DYNVARS_001_03------------------------#'
SET @@global.table_open_cache = 8;
+Warnings:
+Warning 1292 Truncated incorrect table_open_cache value: '8'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-8
+10
SET @@global.table_open_cache = 1;
+Warnings:
+Warning 1292 Truncated incorrect table_open_cache value: '1'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
SET @@global.table_open_cache = 1073741824;
Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '1073741824'
@@ -42,7 +46,7 @@ Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '-1'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
SET @@global.table_open_cache = 100000000000;
Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '100000000000'
@@ -54,13 +58,13 @@ Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '-1024'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
SET @@global.table_open_cache = 0;
Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '0'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
SET @@global.table_open_cache = 10000.01;
ERROR 42000: Incorrect argument type to variable 'table_open_cache'
SET @@global.table_open_cache = ON;
@@ -78,15 +82,17 @@ SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL
1
'#---------------------FN_DYNVARS_001_09----------------------#'
SET @@global.table_open_cache = TRUE;
+Warnings:
+Warning 1292 Truncated incorrect table_open_cache value: '1'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
SET @@global.table_open_cache = FALSE;
Warnings:
Warning 1292 Truncated incorrect table_open_cache value: '0'
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-1
+10
'#---------------------FN_DYNVARS_001_10----------------------#'
SET @@global.table_open_cache = 10;
SELECT @@table_open_cache = @@global.table_open_cache ;
@@ -102,4 +108,4 @@ ERROR 42S22: Unknown column 'table_open_cache' in 'field list'
SET @@global.table_open_cache = @start_value;
SELECT @@global.table_open_cache ;
@@global.table_open_cache
-2000
+421
diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test
index a1961a61a40..799dd0c8555 100644
--- a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test
+++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test
@@ -92,9 +92,9 @@ SET @@global.max_prepared_stmt_count = 10000.01;
SELECT @@global.max_prepared_stmt_count;
SET @@global.max_prepared_stmt_count = -1024;
SELECT @@global.max_prepared_stmt_count;
-SET @@global.max_prepared_stmt_count = 1048577;
+SET @@global.max_prepared_stmt_count = 4294967296;
SELECT @@global.max_prepared_stmt_count;
-SET @@global.max_prepared_stmt_count = 104857612;
+SET @@global.max_prepared_stmt_count = 4294967295*1024;
SELECT @@global.max_prepared_stmt_count;
--Error ER_WRONG_TYPE_FOR_VAR
diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt
index 462e83d98b6..c3eec59bc17 100644
--- a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt
+++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt
@@ -1 +1,2 @@
--loose-innodb-flush-log-at-timeout=3
+--table_open_cache=200
diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt
new file mode 100644
index 00000000000..c3f0d3bd51f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_server_embedded.opt
@@ -0,0 +1 @@
+--table_open_cache=100
diff --git a/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt
new file mode 100644
index 00000000000..c3f0d3bd51f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/sysvars_server_notembedded.opt
@@ -0,0 +1 @@
+--table_open_cache=100
diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c
index b518d22780f..c16f269d574 100644
--- a/mysys/my_addr_resolve.c
+++ b/mysys/my_addr_resolve.c
@@ -226,8 +226,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary));
}
offset = info.dli_fbase;
- len= my_snprintf(input, sizeof(input), "%llx\n",
- (longlong) (ptr - offset));
+ len= my_snprintf(input, sizeof(input), "%08x\n", (ulonglong)(ptr - offset));
if (write(in[1], input, len) <= 0)
return 3;
diff --git a/sql-common/client.c b/sql-common/client.c
index 94f50eae30b..00573de415b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1815,7 +1815,8 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
*/
#ifdef HAVE_X509_check_host
- ret_validation= X509_check_host(server_cert, server_hostname, 0, 0, 0) != 1;
+ ret_validation= X509_check_host(server_cert, server_hostname,
+ strlen(server_hostname), 0, 0) != 1;
#else
subject= X509_get_subject_name(server_cert);
cn_loc= X509_NAME_get_index_by_NID(subject, NID_commonName, -1);
@@ -2505,10 +2506,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
if (mysql->client_flag & CLIENT_MULTI_STATEMENTS)
mysql->client_flag|= CLIENT_MULTI_RESULTS;
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+#ifdef HAVE_OPENSSL
if (mysql->options.use_ssl)
mysql->client_flag|= CLIENT_SSL;
-#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/
+#endif /* HAVE_OPENSSL */
if (mpvio->db)
mysql->client_flag|= CLIENT_CONNECT_WITH_DB;
diff --git a/sql/contributors.h b/sql/contributors.h
index 7369dcd141d..a0d05af3fa6 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -41,13 +41,12 @@ struct show_table_contributors_st show_table_contributors[]= {
{"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"},
- {"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"},
+ {"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
{"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
{"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"},
{"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
{"Acronis", "http://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Auttomattic", "https://automattic.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
{"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
diff --git a/sql/item.cc b/sql/item.cc
index dd12d9a476f..56af69be427 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -10002,6 +10002,8 @@ Item *Item_cache_int::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
new_item= null_value ?
(Item*) new (thd->mem_root) Item_null(thd) :
(Item*) new (thd->mem_root) Item_int(thd, val_int(), max_length);
@@ -10164,6 +10166,8 @@ Item *Item_cache_temporal::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
return new (thd->mem_root) Item_null(thd);
else
@@ -10244,6 +10248,8 @@ Item *Item_cache_real::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
new_item= null_value ?
(Item*) new (thd->mem_root) Item_null(thd) :
(Item*) new (thd->mem_root) Item_float(thd, val_real(),
@@ -10307,6 +10313,8 @@ Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
new_item= (Item*) new (thd->mem_root) Item_null(thd);
else
@@ -10402,6 +10410,8 @@ Item *Item_cache_str::convert_to_basic_const_item(THD *thd)
{
Item *new_item;
DBUG_ASSERT(value_cached || example != 0);
+ if (!value_cached)
+ cache_value();
if (null_value)
new_item= (Item*) new (thd->mem_root) Item_null(thd);
else
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c6b0ae7fba8..85e578f4595 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -317,7 +317,7 @@ String *Item_aes_crypt::val_str(String *str2)
{
DBUG_ASSERT(fixed == 1);
StringBuffer<80> user_key_buf;
- String *sptr= args[0]->val_str(&str_value);
+ String *sptr= args[0]->val_str(&tmp_value);
String *user_key= args[1]->val_str(&user_key_buf);
uint32 aes_length;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 18cda491efd..cff9fdee072 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -212,6 +212,7 @@ class Item_aes_crypt :public Item_str_binary_checksum_func
protected:
int what;
+ String tmp_value;
public:
Item_aes_crypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {}
@@ -221,8 +222,8 @@ public:
class Item_func_aes_encrypt :public Item_aes_crypt
{
public:
- Item_func_aes_encrypt(THD *thd, Item *a, Item *b):
- Item_aes_crypt(thd, a, b) {}
+ Item_func_aes_encrypt(THD *thd, Item *a, Item *b)
+ :Item_aes_crypt(thd, a, b) {}
void fix_length_and_dec();
const char *func_name() const { return "aes_encrypt"; }
Item *get_copy(THD *thd)
@@ -1629,6 +1630,7 @@ public:
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
fix_char_length(MY_UUID_STRING_LENGTH);
}
+ table_map used_tables() const { return RAND_TABLE_BIT; }
const char *func_name() const{ return "uuid"; }
String *val_str(String *);
bool check_vcol_func_processor(void *arg)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index edac9d466f7..9de6d090945 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -117,7 +117,7 @@
#include <poll.h>
#endif
-#include <my_systemd.h>
+#include <my_service_manager.h>
#define mysqld_charset &my_charset_latin1
@@ -547,7 +547,7 @@ bool max_user_connections_checking=0;
Limit of the total number of prepared statements in the server.
Is necessary to protect the server against out-of-memory attacks.
*/
-ulong max_prepared_stmt_count;
+uint max_prepared_stmt_count;
/**
Current total number of prepared statements in the server. This number
is exact, and therefore may not be equal to the difference between
@@ -558,7 +558,7 @@ ulong max_prepared_stmt_count;
two different connections, this counts as two distinct prepared
statements.
*/
-ulong prepared_stmt_count=0;
+uint prepared_stmt_count=0;
my_thread_id global_thread_id= 0;
ulong current_pid;
ulong slow_launch_threads = 0;
@@ -4461,11 +4461,20 @@ static int init_common_variables()
/* connections and databases needs lots of files */
{
- uint files, wanted_files, max_open_files;
+ uint files, wanted_files, max_open_files, min_tc_size, extra_files,
+ min_connections;
+ ulong org_max_connections, org_tc_size;
+ /* Number of files reserved for temporary files */
+ extra_files= 30;
+ min_connections= 10;
/* MyISAM requires two file handles per table. */
- wanted_files= (10 + max_connections + extra_max_connections +
+ wanted_files= (extra_files + max_connections + extra_max_connections +
tc_size * 2);
+ min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN);
+ org_max_connections= max_connections;
+ org_tc_size= tc_size;
+
/*
We are trying to allocate no less than max_connections*5 file
handles (i.e. we are trying to set the limit so that they will
@@ -4477,44 +4486,49 @@ static int init_common_variables()
requested (value of wanted_files).
*/
max_open_files= MY_MAX(MY_MAX(wanted_files,
- (max_connections + extra_max_connections)*5),
- open_files_limit);
+ (max_connections + extra_max_connections)*5),
+ open_files_limit);
files= my_set_max_open_files(max_open_files);
+ SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong);
- if (files < wanted_files)
- {
- if (!open_files_limit || IS_SYSVAR_AUTOSIZE(&open_files_limit))
- {
- /*
- If we have requested too much file handles than we bring
- max_connections in supported bounds.
- */
- SYSVAR_AUTOSIZE(max_connections,
- (ulong) MY_MIN(files-10-TABLE_OPEN_CACHE_MIN*2, max_connections));
- /*
- Decrease tc_size according to max_connections, but
- not below TABLE_OPEN_CACHE_MIN. Outer MY_MIN() ensures that we
- never increase tc_size automatically (that could
- happen if max_connections is decreased above).
- */
- SYSVAR_AUTOSIZE(tc_size,
- (ulong) MY_MIN(MY_MAX((files - 10 - max_connections) / 2,
- TABLE_OPEN_CACHE_MIN), tc_size));
- DBUG_PRINT("warning",
- ("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
- files, max_connections, tc_size));
- if (global_system_variables.log_warnings > 1)
- sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
- files, max_connections, tc_size);
- }
- else if (global_system_variables.log_warnings)
- sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
- }
- SYSVAR_AUTOSIZE(open_files_limit, files);
- }
+ if (files < wanted_files && global_system_variables.log_warnings)
+ sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
+
+ /*
+ If we have requested too much file handles than we bring
+ max_connections in supported bounds. Still leave at least
+ 'min_connections' connections
+ */
+ SYSVAR_AUTOSIZE_IF_CHANGED(max_connections,
+ (ulong) MY_MAX(MY_MIN(files- extra_files-
+ min_tc_size*2,
+ max_connections),
+ min_connections),
+ ulong);
+ /*
+ Decrease tc_size according to max_connections, but
+ not below min_tc_size. Outer MY_MIN() ensures that we
+ never increase tc_size automatically (that could
+ happen if max_connections is decreased above).
+ */
+ SYSVAR_AUTOSIZE_IF_CHANGED(tc_size,
+ (ulong) MY_MIN(MY_MAX((files - extra_files -
+ max_connections) / 2,
+ min_tc_size),
+ tc_size), ulong);
+ DBUG_PRINT("warning",
+ ("Current limits: max_open_files: %u max_connections: %ld table_cache: %ld",
+ files, max_connections, tc_size));
+ if (global_system_variables.log_warnings > 1 &&
+ (max_connections < org_max_connections ||
+ tc_size < org_tc_size))
+ sql_print_warning("Changed limits: max_open_files: %u max_connections: %lu (was %lu) table_cache: %lu (was %lu)",
+ files, max_connections, org_max_connections,
+ tc_size, org_tc_size);
+ }
/*
- Max_connections is now set.
+ Max_connections and tc_cache are now set.
Now we can fix other variables depending on this variable.
*/
@@ -6677,7 +6691,7 @@ void handle_connections_sockets()
#endif
sd_notify(0, "READY=1\n"
- "STATUS=Taking your SQL requests now...");
+ "STATUS=Taking your SQL requests now...\n");
DBUG_PRINT("general",("Waiting for connections."));
MAYBE_BROKEN_SYSCALL;
@@ -6879,7 +6893,7 @@ void handle_connections_sockets()
create_new_thread(connect);
}
sd_notify(0, "STOPPING=1\n"
- "STATUS=Shutdown in progress");
+ "STATUS=Shutdown in progress\n");
DBUG_VOID_RETURN;
}
diff --git a/sql/mysqld.h b/sql/mysqld.h
index e695c2d4d4c..7a616097338 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -240,7 +240,7 @@ extern uint slave_net_timeout;
extern int max_user_connections;
extern volatile ulong cached_thread_count;
extern ulong what_to_log,flush_time;
-extern ulong max_prepared_stmt_count, prepared_stmt_count;
+extern uint max_prepared_stmt_count, prepared_stmt_count;
extern ulong open_files_limit;
extern ulonglong binlog_cache_size, binlog_stmt_cache_size, binlog_file_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
diff --git a/sql/set_var.h b/sql/set_var.h
index 9014a9c4936..82afb3ceea6 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -401,6 +401,16 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free);
set_sys_var_value_origin(&VAR, sys_var::AUTO); \
} while(0)
+#define SYSVAR_AUTOSIZE_IF_CHANGED(VAR,VAL,TYPE) \
+ do { \
+ TYPE tmp= (VAL); \
+ if (VAR != tmp) \
+ { \
+ VAR= (VAL); \
+ set_sys_var_value_origin(&VAR, sys_var::AUTO); \
+ } \
+ } while(0)
+
void set_sys_var_value_origin(void *ptr, enum sys_var::where here);
enum sys_var::where get_sys_var_value_origin(void *ptr);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index c0b3a881b8c..17192663381 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -5749,8 +5749,8 @@ ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ger "AGGREGATE wird bei gespeicherten Funktionen nicht unterstützt"
ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
- eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
- ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %lu)"
+ eng "Can't create more than max_prepared_stmt_count statements (current value: %u)"
+ ger "Kann nicht mehr Anweisungen als max_prepared_stmt_count erzeugen (aktueller Wert: %u)"
ER_VIEW_RECURSIVE
eng "%`s.%`s contains view recursion"
ger "%`s.%`s enthält View-Rekursion"
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3354a2fdf1b..5ce6a6b001c 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -484,7 +484,8 @@ err_with_reopen:
old locks. This should always succeed (unless some external process
has removed the tables)
*/
- result= thd->locked_tables_list.reopen_tables(thd);
+ if (thd->locked_tables_list.reopen_tables(thd))
+ result= true;
/*
Since downgrade_lock() won't do anything with shared
metadata lock it is much simpler to go through all open tables rather
diff --git a/sql/sql_const.h b/sql/sql_const.h
index 65742235bee..e28a0649f04 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -127,7 +127,7 @@
#define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16
#define SEQUENCES_HASH_SIZE 16
-#define TABLE_OPEN_CACHE_MIN 400
+#define TABLE_OPEN_CACHE_MIN 200
#define TABLE_OPEN_CACHE_DEFAULT 2000
#define TABLE_DEF_CACHE_DEFAULT 400
/**
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index f85d25525d4..27edfa47799 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1358,22 +1358,27 @@ bool do_command(THD *thd)
command= fetch_command(thd, packet);
#ifdef WITH_WSREP
- /*
- Bail out if DB snapshot has not been installed.
- */
- if (thd->variables.wsrep_on && !thd->wsrep_applier &&
- (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
- (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0)
+ if (WSREP(thd))
{
- thd->protocol->end_statement();
+ /*
+ Bail out if DB snapshot has not been installed.
+ */
+ if (!thd->wsrep_applier &&
+ (!wsrep_ready || wsrep_reject_queries != WSREP_REJECT_NONE) &&
+ (server_command_flags[command] & CF_SKIP_WSREP_CHECK) == 0)
+ {
+ my_message(ER_UNKNOWN_COM_ERROR,
+ "WSREP has not yet prepared node for application use", MYF(0));
+ thd->protocol->end_statement();
- /* Performance Schema Interface instrumentation end. */
- MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
- thd->m_statement_psi= NULL;
- thd->m_digest= NULL;
+ /* Performance Schema Interface instrumentation end. */
+ MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
+ thd->m_statement_psi= NULL;
+ thd->m_digest= NULL;
- return_value= FALSE;
- goto out;
+ return_value= FALSE;
+ goto out;
+ }
}
#endif
@@ -3439,8 +3444,7 @@ mysql_execute_command(THD *thd)
* allow SET and SHOW queries and reads from information schema
* and dirty reads (if configured)
*/
- if (thd->variables.wsrep_on &&
- !thd->wsrep_applier &&
+ if (!thd->wsrep_applier &&
!(wsrep_ready && wsrep_reject_queries == WSREP_REJECT_NONE) &&
!(thd->variables.wsrep_dirty_reads &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index b8f0023eefb..6c1a4a32fb4 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -30,6 +30,7 @@
#include "sql_show.h"
#include "debug_sync.h"
#include "des_key_file.h"
+#include "transaction.h"
static void disable_checkpoints(THD *thd);
@@ -593,6 +594,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
return FALSE;
error_reset_bits:
+ trans_rollback_stmt(thd);
close_thread_tables(thd);
thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
error:
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 26fdce12e7f..e62a49f71ea 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3081,18 +3081,19 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
return FALSE;
/*
- Do not read statistics for any query over non-user tables.
- If the query references some statistical tables, but not all
- of them, reading the statistics may lead to a deadlock
- */
+ Do not read statistics for any query that explicity involves
+ statistical tables, failure to to do so we may end up
+ in a deadlock.
+ */
+
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{
if (!tl->is_view_or_derived() && tl->table)
{
TABLE_SHARE *table_share= tl->table->s;
if (table_share &&
- (table_share->table_category != TABLE_CATEGORY_USER ||
- table_share->tmp_table != NO_TMP_TABLE))
+ table_share->table_category != TABLE_CATEGORY_USER
+ && is_stat_table(&tl->db, &tl->alias))
return FALSE;
}
}
@@ -3767,6 +3768,15 @@ double get_column_range_cardinality(Field *field,
if (!col_stats)
return tab_records;
+ /*
+ Use statistics for a table only when we have actually read
+ the statistics from the stat tables. For example due to
+ chances of getting a deadlock we disable reading statistics for
+ a table.
+ */
+
+ if (!table->stats_is_read)
+ return tab_records;
double col_nulls= tab_records * col_stats->get_nulls_ratio();
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 6354dc603fd..421ff0ed0f1 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -1365,27 +1365,6 @@ Field *Type_handler_varchar_compressed::make_conversion_table_field(TABLE *table
}
-Field *Type_handler_tiny_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 1, target->charset());
-}
-
-
-Field *Type_handler_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 2, target->charset());
-}
-
Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
uint metadata,
@@ -1403,28 +1382,6 @@ Field *Type_handler_blob_compressed::make_conversion_table_field(TABLE *table,
}
-Field *Type_handler_medium_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 3, target->charset());
-}
-
-
-Field *Type_handler_long_blob::make_conversion_table_field(TABLE *table,
- uint metadata,
- const Field *target)
- const
-{
- return new(table->in_use->mem_root)
- Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
- table->s, 4, target->charset());
-}
-
-
#ifdef HAVE_SPATIAL
const Name Type_handler_geometry::m_name_geometry(STRING_WITH_LEN("geometry"));
@@ -5770,6 +5727,19 @@ void Type_handler_datetime_common::Item_param_set_param_func(Item_param *param,
param->set_param_datetime(pos, len);
}
+Field *Type_handler_blob_common::make_conversion_table_field(TABLE *table,
+ uint metadata,
+ const Field *target)
+ const
+{
+ uint pack_length= metadata & 0x00ff;
+ if (pack_length < 1 || pack_length > 4)
+ return NULL; // Broken binary log?
+ return new(table->in_use->mem_root)
+ Field_blob(NULL, (uchar *) "", 1, Field::NONE, &empty_clex_str,
+ table->s, pack_length, target->charset());
+}
+
void Type_handler_timestamp_common::Item_param_set_param_func(Item_param *param,
uchar **pos,
diff --git a/sql/sql_type.h b/sql/sql_type.h
index db03b77d48f..dd37e2ba96c 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -2964,6 +2964,8 @@ class Type_handler_blob_common: public Type_handler_longstr
{
public:
virtual ~Type_handler_blob_common() { }
+ Field *make_conversion_table_field(TABLE *, uint metadata,
+ const Field *target) const;
const Type_handler *type_handler_for_tmp_table(const Item *item) const
{
return blob_type_handler(item);
@@ -2988,6 +2990,7 @@ public:
Type_all_attributes *atrr,
Item **items, uint nitems) const;
void Item_param_setup_conversion(THD *thd, Item_param *) const;
+
};
@@ -2999,8 +3002,6 @@ public:
const Name name() const { return m_name_tinyblob; }
enum_field_types field_type() const { return MYSQL_TYPE_TINY_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3016,8 +3017,6 @@ public:
const Name name() const { return m_name_mediumblob; }
enum_field_types field_type() const { return MYSQL_TYPE_MEDIUM_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3035,8 +3034,6 @@ public:
uint32 calc_pack_length(uint32 length) const;
Item *create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
@@ -3052,8 +3049,6 @@ public:
const Name name() const { return m_name_blob; }
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
uint32 calc_pack_length(uint32 length) const;
- Field *make_conversion_table_field(TABLE *, uint metadata,
- const Field *target) const;
Field *make_table_field(const LEX_CSTRING *name,
const Record_addr &addr,
const Type_all_attributes &attr,
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 101c30237bf..d0c0662c0a0 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1491,7 +1491,7 @@ static bool fix_max_connections(sys_var *self, THD *thd, enum_var_type type)
static Sys_var_ulong Sys_max_connections(
"max_connections", "The number of simultaneous clients allowed",
PARSED_EARLY GLOBAL_VAR(max_connections), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 100000),
+ VALID_RANGE(10, 100000),
DEFAULT(MAX_CONNECTIONS_DEFAULT), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
@@ -2219,11 +2219,11 @@ static Sys_var_ulong Sys_max_long_data_size(
BLOCK_SIZE(1));
static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
-static Sys_var_ulong Sys_max_prepared_stmt_count(
+static Sys_var_uint Sys_max_prepared_stmt_count(
"max_prepared_stmt_count",
"Maximum number of prepared statements in the server",
GLOBAL_VAR(max_prepared_stmt_count), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1),
+ VALID_RANGE(0, UINT_MAX32), DEFAULT(16382), BLOCK_SIZE(1),
&PLock_prepared_stmt_count);
static Sys_var_ulong Sys_max_recursive_iterations(
@@ -3469,7 +3469,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(1, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
+ VALID_RANGE(10, 1024*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_table_open_cache));
diff --git a/sql/table.h b/sql/table.h
index 32e99db880f..ac382e5aa94 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2537,6 +2537,7 @@ struct TABLE_LIST
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
(alias.str ? alias.str : "<NULL>"),
get_unit()));
+ derived= get_unit();
derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
DTYPE_TABLE | DTYPE_MATERIALIZE);
set_check_materialized();
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index dc61f773e96..e588fae47e5 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -162,7 +162,6 @@ IF(NOT TARGET innobase)
RETURN()
ENDIF()
-INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
# A GCC bug causes crash when compiling these files on ARM64 with -O1+
# Compile them with -O0 as a workaround.
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 0998b1bc49c..3cdf0160f25 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -45,6 +45,7 @@ Created April 08, 2011 Vasil Dimov
#include <algorithm>
#include "mysql/service_wsrep.h" /* wsrep_recovery */
+#include <my_service_manager.h>
enum status_severity {
STATUS_INFO,
@@ -390,6 +391,14 @@ buf_dump(
/* leave tmp_filename to exist */
return;
}
+ if ( (j % 1024) == 0) {
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Dumping buffer pool "
+ ULINTPF "/" ULINTPF ", "
+ "page " ULINTPF "/" ULINTPF,
+ i + 1, srv_buf_pool_instances,
+ j + 1, n_pages);
+ }
}
ut_free(dump);
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 10d7c727fac..4bd99ccd7d8 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -62,6 +62,8 @@ static const int buf_flush_page_cleaner_priority = -20;
modification lsn */
static const ulint buf_flush_wait_flushed_sleep_time = 10000;
+#include <my_service_manager.h>
+
/** Number of pages flushed through non flush_list flushes. */
static ulint buf_lru_flush_page_count = 0;
@@ -642,6 +644,17 @@ buf_flush_remove(
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+#if 0 // FIXME: Rate-limit the output. Move this to the page cleaner?
+ if (UNIV_UNLIKELY(srv_shutdown_state == SRV_SHUTDOWN_FLUSH_PHASE)) {
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Flush and remove page with tablespace id %u"
+ ", Poolid " ULINTPF ", flush list length " ULINTPF,
+ bpage->space, buf_pool->instance_no,
+ UT_LIST_GET_LEN(buf_pool->flush_list));
+ }
+#endif
+
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_flush_list);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index e6ec915c0b3..08d489a63c4 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -4342,8 +4342,10 @@ dict_foreign_push_index_error(
const char* col_name;
field = dict_index_get_nth_field(err_index, err_col);
- col_name = dict_table_get_col_name(
- table, dict_col_get_no(field->col));
+ col_name = dict_col_is_virtual(field->col)
+ ? "(null)"
+ : dict_table_get_col_name(
+ table, dict_col_get_no(field->col));
fprintf(ef,
"%s table %s with foreign key constraint"
" failed. Field type or character set for column '%s' "
@@ -6897,10 +6899,6 @@ dict_foreign_qualify_index(
return(false);
}
- col_name = col_names
- ? col_names[col_no]
- : dict_table_get_col_name(table, col_no);
-
if (dict_col_is_virtual(field->col)) {
for (ulint j = 0; j < table->n_v_def; j++) {
col_name = dict_table_get_v_col_name(table, j);
@@ -6908,6 +6906,10 @@ dict_foreign_qualify_index(
break;
}
}
+ } else {
+ col_name = col_names
+ ? col_names[col_no]
+ : dict_table_get_col_name(table, col_no);
}
if (0 != innobase_strcasecmp(columns[i], col_name)) {
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index b4fead7335a..6b6faa370cf 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2017, MariaDB Corporation.
+Copyright (c) 2014, 2018, MariaDB Corporation. All Rights Reserved.
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
@@ -95,17 +95,17 @@ extern my_bool srv_background_scrub_data_compressed;
/***********************************************************************
Check if a key needs rotation given a key_state
-@param[in] encrypt_mode Encryption mode
+@param[in] crypt_data Encryption information
@param[in] key_version Current key version
@param[in] latest_key_version Latest key version
@param[in] rotate_key_age when to rotate
@return true if key needs rotation, false if not */
static bool
fil_crypt_needs_rotation(
- fil_encryption_t encrypt_mode,
- uint key_version,
- uint latest_key_version,
- uint rotate_key_age)
+ const fil_space_crypt_t* crypt_data,
+ uint key_version,
+ uint latest_key_version,
+ uint rotate_key_age)
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************
@@ -164,7 +164,8 @@ fil_crypt_get_latest_key_version(
if (crypt_data->is_key_found()) {
- if (fil_crypt_needs_rotation(crypt_data->encryption,
+ if (fil_crypt_needs_rotation(
+ crypt_data,
crypt_data->min_key_version,
key_version,
srv_fil_crypt_rotate_key_age)) {
@@ -904,17 +905,17 @@ fil_crypt_get_key_state(
/***********************************************************************
Check if a key needs rotation given a key_state
-@param[in] encrypt_mode Encryption mode
+@param[in] crypt_data Encryption information
@param[in] key_version Current key version
@param[in] latest_key_version Latest key version
@param[in] rotate_key_age when to rotate
@return true if key needs rotation, false if not */
static bool
fil_crypt_needs_rotation(
- fil_encryption_t encrypt_mode,
- uint key_version,
- uint latest_key_version,
- uint rotate_key_age)
+ const fil_space_crypt_t* crypt_data,
+ uint key_version,
+ uint latest_key_version,
+ uint rotate_key_age)
{
if (key_version == ENCRYPTION_KEY_VERSION_INVALID) {
return false;
@@ -927,13 +928,20 @@ fil_crypt_needs_rotation(
}
if (latest_key_version == 0 && key_version != 0) {
- if (encrypt_mode == FIL_ENCRYPTION_DEFAULT) {
+ if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT) {
/* this is rotation encrypted => unencrypted */
return true;
}
return false;
}
+ if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT
+ && crypt_data->type == CRYPT_SCHEME_1
+ && srv_encrypt_tables == 0 ) {
+ /* This is rotation encrypted => unencrypted */
+ return true;
+ }
+
/* this is rotation encrypted => encrypted,
* only reencrypt if key is sufficiently old */
if (key_version + rotate_key_age < latest_key_version) {
@@ -949,10 +957,17 @@ static inline
void
fil_crypt_read_crypt_data(fil_space_t* space)
{
- if (space->crypt_data || space->size) {
+ if (space->crypt_data || space->size
+ || !fil_space_get_size(space->id)) {
/* The encryption metadata has already been read, or
the tablespace is not encrypted and the file has been
- opened already. */
+ opened already, or the file cannot be accessed,
+ likely due to a concurrent TRUNCATE or
+ RENAME or DROP (possibly as part of ALTER TABLE).
+ FIXME: The file can become unaccessible any time
+ after this check! We should really remove this
+ function and instead make crypt_data an integral
+ part of fil_space_t. */
return;
}
@@ -1213,9 +1228,10 @@ fil_crypt_space_needs_rotation(
}
bool need_key_rotation = fil_crypt_needs_rotation(
- crypt_data->encryption,
+ crypt_data,
crypt_data->min_key_version,
- key_state->key_version, key_state->rotate_key_age);
+ key_state->key_version,
+ key_state->rotate_key_age);
crypt_data->rotate_state.scrubbing.is_active =
btr_scrub_start_space(space->id, &state->scrub_data);
@@ -1811,9 +1827,10 @@ fil_crypt_rotate_page(
ut_ad(kv == 0);
ut_ad(page_get_space_id(frame) == 0);
} else if (fil_crypt_needs_rotation(
- crypt_data->encryption,
- kv, key_state->key_version,
- key_state->rotate_key_age)) {
+ crypt_data,
+ kv,
+ key_state->key_version,
+ key_state->rotate_key_age)) {
mtr.set_named_space(space);
modified = true;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index c13237ce18d..d3857918c1c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -58,7 +58,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
// MYSQL_PLUGIN_IMPORT extern my_bool lower_case_file_system;
// MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[];
-#include <my_systemd.h>
+#include <my_service_manager.h>
#include <key.h>
/* Include necessary InnoDB headers */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index ba1256feac2..49284f2dbc8 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -61,6 +61,10 @@ component, i.e. we show M.N.P as M.N */
IB_TO_STR(INNODB_VERSION_MAJOR) "." \
IB_TO_STR(INNODB_VERSION_MINOR) "/en/"
+/** How far ahead should we tell the service manager the timeout
+(time in seconds) */
+#define INNODB_EXTEND_TIMEOUT_INTERVAL 30
+
#ifdef MYSQL_DYNAMIC_PLUGIN
/* In the dynamic plugin, redefine some externally visible symbols
in order not to conflict with the symbols of a builtin InnoDB. */
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 1047e93153a..1f217cf3526 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -33,6 +33,7 @@ Created 12/9/1995 Heikki Tuuri
#include "ha_prototypes.h"
#include <debug_sync.h>
+#include <my_service_manager.h>
#include "log0log.h"
#include "log0crypt.h"
@@ -1132,6 +1133,12 @@ log_write_up_to(
return;
}
+ if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "log write up to: " LSN_PF,
+ lsn);
+ }
+
loop:
ut_ad(++loop_count < 128);
@@ -1905,7 +1912,9 @@ loop:
os_event_set(recv_sys->flush_start);
}
}
- os_thread_sleep(100000);
+#define COUNT_INTERVAL 600U
+#define CHECK_INTERVAL 100000U
+ os_thread_sleep(CHECK_INTERVAL);
count++;
@@ -1918,7 +1927,11 @@ loop:
&& srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
? trx_sys.any_active_transactions() : 0) {
- if (srv_print_verbose_log && count > 600) {
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %lu active transactions to finish",
+ (ulong) total_trx);
ib::info() << "Waiting for " << total_trx << " active"
<< " transactions to finish";
@@ -1956,7 +1969,10 @@ loop:
if (thread_name) {
ut_ad(!srv_read_only_mode);
wait_suspend_loop:
- if (srv_print_verbose_log && count > 600) {
+ service_manager_extend_timeout(
+ COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for %s to exit", thread_name);
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
ib::info() << "Waiting for " << thread_name
<< "to exit";
count = 0;
@@ -1991,12 +2007,16 @@ wait_suspend_loop:
before proceeding further. */
count = 0;
+ service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for page cleaner");
while (buf_page_cleaner_is_active) {
++count;
- os_thread_sleep(100000);
- if (srv_print_verbose_log && count > 600) {
- ib::info() << "Waiting for page_cleaner to"
- " finish flushing of buffer pool";
+ os_thread_sleep(CHECK_INTERVAL);
+ if (srv_print_verbose_log && count > COUNT_INTERVAL) {
+ service_manager_extend_timeout(COUNT_INTERVAL * CHECK_INTERVAL/1000000 * 2,
+ "Waiting for page cleaner");
+ ib::info() << "Waiting for page_cleaner to "
+ "finish flushing of buffer pool";
count = 0;
}
}
@@ -2067,6 +2087,8 @@ wait_suspend_loop:
}
if (!srv_read_only_mode) {
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "ensuring dirty buffer pool are written to log");
log_make_checkpoint_at(LSN_MAX, TRUE);
log_mutex_enter();
@@ -2082,22 +2104,6 @@ wait_suspend_loop:
goto loop;
}
- fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
- fil_flush_file_spaces(FIL_TYPE_LOG);
-
- /* The call fil_write_flushed_lsn_to_data_files() will
- bypass the buffer pool: therefore it is essential that
- the buffer pool has been completely flushed to disk! */
-
- if (!buf_all_freed()) {
- if (srv_print_verbose_log && count > 600) {
- ib::info() << "Waiting for dirty buffer pages"
- " to be flushed";
- count = 0;
- }
-
- goto loop;
- }
} else {
lsn = srv_start_lsn;
}
@@ -2107,8 +2113,9 @@ wait_suspend_loop:
/* Make some checks that the server really is quiet */
ut_a(srv_get_active_thread_type() == SRV_NONE);
- bool freed = buf_all_freed();
- ut_a(freed);
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Free innodb buffer pool");
+ buf_all_freed();
ut_a(lsn == log_sys->lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
@@ -2134,9 +2141,6 @@ wait_suspend_loop:
/* Make some checks that the server really is quiet */
ut_a(srv_get_active_thread_type() == SRV_NONE);
- freed = buf_all_freed();
- ut_a(freed);
-
ut_a(lsn == log_sys->lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 730f5caa081..e44c306c6a3 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -30,7 +30,7 @@ Created 9/20/1997 Heikki Tuuri
#include <vector>
#include <map>
#include <string>
-#include <my_systemd.h>
+#include <my_service_manager.h>
#include "log0recv.h"
@@ -731,8 +731,9 @@ loop:
if (recv_sys->report(ut_time())) {
ib::info() << "Read redo log up to LSN=" << *start_lsn;
- sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF,
- *start_lsn);
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Read redo log up to LSN=" LSN_PF,
+ *start_lsn);
}
if (*start_lsn != end_lsn) {
@@ -1867,8 +1868,8 @@ recv_recover_page(bool just_read_in, buf_block_t* block)
if (ulint n = --recv_sys->n_addrs) {
if (recv_sys->report(time)) {
ib::info() << "To recover: " << n << " pages from log";
- sd_notifyf(0, "STATUS=To recover: " ULINTPF
- " pages from log", n);
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n);
}
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 69469f787dc..6bbda59188d 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -107,8 +107,9 @@ static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
#else
/** Umask for creating files */
static ulint os_innodb_umask = 0;
-static HANDLE completion_port;
-static HANDLE read_completion_port;
+static HANDLE data_completion_port;
+static HANDLE log_completion_port;
+
static DWORD fls_sync_io = FLS_OUT_OF_INDEXES;
#define IOCP_SHUTDOWN_KEY (ULONG_PTR)-1
#endif /* _WIN32 */
@@ -443,11 +444,17 @@ public:
#endif /* LINUX_NATIVE_AIO */
#ifdef WIN_ASYNC_IO
-
+ HANDLE m_completion_port;
/** Wake up all AIO threads in Windows native aio */
static void wake_at_shutdown() {
- PostQueuedCompletionStatus(completion_port, 0, IOCP_SHUTDOWN_KEY, NULL);
- PostQueuedCompletionStatus(read_completion_port, 0, IOCP_SHUTDOWN_KEY, NULL);
+ AIO *all_arrays[] = {s_reads, s_writes, s_log, s_ibuf };
+ for (size_t i = 0; i < array_elements(all_arrays); i++) {
+ AIO *a = all_arrays[i];
+ if (a) {
+ PostQueuedCompletionStatus(a->m_completion_port, 0,
+ IOCP_SHUTDOWN_KEY, 0);
+ }
+ }
}
#endif /* WIN_ASYNC_IO */
@@ -3508,15 +3515,11 @@ SyncFileIO::execute(Slot* slot)
struct WinIoInit
{
WinIoInit() {
- completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
- read_completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); ut_a(completion_port && read_completion_port);
fls_sync_io = FlsAlloc(win_free_syncio_event);
ut_a(fls_sync_io != FLS_OUT_OF_INDEXES);
}
~WinIoInit() {
- CloseHandle(completion_port);
- CloseHandle(read_completion_port);
FlsFree(fls_sync_io);
}
};
@@ -4248,11 +4251,17 @@ os_file_create_func(
*success = true;
if (srv_use_native_aio && ((attributes & FILE_FLAG_OVERLAPPED) != 0)) {
- /* Bind the file handle to completion port */
- ut_a(CreateIoCompletionPort(file, completion_port, 0, 0));
+ /* Bind the file handle to completion port. Completion port
+ might not be created yet, in some stages of backup, but
+ must always be there for the server.*/
+ HANDLE port =(type == OS_LOG_FILE)?
+ log_completion_port : data_completion_port;
+ ut_a(port || srv_operation != SRV_OPERATION_NORMAL);
+ if (port) {
+ ut_a(CreateIoCompletionPort(file, port, 0, 0));
+ }
}
}
-
} while (retry);
return(file);
@@ -5653,6 +5662,15 @@ os_aio_handler(
return(err);
}
+#ifdef WIN_ASYNC_IO
+static HANDLE new_completion_port()
+{
+ HANDLE h = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
+ ut_a(h);
+ return h;
+}
+#endif
+
/** Constructor
@param[in] id The latch ID
@param[in] n Number of AIO slots
@@ -5669,6 +5687,9 @@ AIO::AIO(
,m_aio_ctx(),
m_events(m_slots.size())
# endif /* LINUX_NATIVE_AIO */
+#ifdef WIN_ASYNC_IO
+ ,m_completion_port(new_completion_port())
+#endif
{
ut_a(n > 0);
ut_a(m_n_segments > 0);
@@ -5835,6 +5856,9 @@ AIO::~AIO()
ut_free(m_aio_ctx);
}
#endif /* LINUX_NATIVE_AIO */
+#if defined(WIN_ASYNC_IO)
+ CloseHandle(m_completion_port);
+#endif
m_slots.clear();
}
@@ -5921,6 +5945,12 @@ AIO::start(
return(false);
}
+#ifdef WIN_ASYNC_IO
+ data_completion_port = s_writes->m_completion_port;
+ log_completion_port =
+ s_log ? s_log->m_completion_port : data_completion_port;
+#endif
+
n_segments += n_writers;
for (ulint i = start + n_readers; i < n_segments; ++i) {
@@ -6408,8 +6438,7 @@ therefore no other thread is allowed to do the freeing!
@param[out] type OS_FILE_WRITE or ..._READ
@return DB_SUCCESS or error code */
-#define READ_SEGMENT(s) (s < srv_n_read_io_threads)
-#define WRITE_SEGMENT(s) !READ_SEGMENT(s)
+
static
dberr_t
@@ -6432,8 +6461,11 @@ os_aio_windows_handler(
we do not have to acquire the protecting mutex yet */
ut_ad(os_aio_validate_skip());
+ AIO *my_array;
+ AIO::get_array_and_local_segment(&my_array, segment);
- HANDLE port = READ_SEGMENT(segment) ? read_completion_port : completion_port;
+ HANDLE port = my_array->m_completion_port;
+ ut_ad(port);
for (;;) {
DWORD len;
ret = GetQueuedCompletionStatus(port, &len, &key,
@@ -6455,25 +6487,26 @@ os_aio_windows_handler(
}
slot->n_bytes= len;
+ ut_a(slot->array);
+ HANDLE slot_port = slot->array->m_completion_port;
+ if (slot_port != port) {
+ /* there are no redirections between data and log */
+ ut_ad(port == data_completion_port);
+ ut_ad(slot_port != log_completion_port);
- if (WRITE_SEGMENT(segment) && slot->type.is_read()) {
/*
- Redirect read completions to the dedicated completion port
- and thread. We need to split read and write threads. If we do not
- do that, and just allow all io threads process all IO, it is possible
- to get stuck in a deadlock in buffer pool code,
-
- Currently, the problem is solved this way - "write io" threads
- always get all completion notifications, from both async reads and
- writes. Write completion is handled in the same thread that gets it.
- Read completion is forwarded via PostQueueCompletionStatus())
- to the second completion port dedicated solely to reads. One of the
- "read io" threads waiting on this port will finally handle the IO.
-
- Forwarding IO completion this way costs a context switch , and this
- seems tolerable since asynchronous reads are by far less frequent.
+ Redirect completions to the dedicated completion port
+ and threads.
+
+ "Write array" threads receive write,read and ibuf
+ notifications, read and ibuf completions are redirected.
+
+ Forwarding IO completion this way costs a context switch,
+ and this seems tolerable since asynchronous reads are by
+ far less frequent.
*/
- ut_a(PostQueuedCompletionStatus(read_completion_port, len, key, &slot->control));
+ ut_a(PostQueuedCompletionStatus(slot_port,
+ len, key, &slot->control));
}
else {
break;
@@ -6534,7 +6567,6 @@ os_aio_windows_handler(
err = AIOHandler::post_io_processing(slot);
}
- ut_a(slot->array);
slot->array->release_with_mutex(slot);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 248bd184dbf..c7fac33bd79 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -78,6 +78,12 @@ Created 10/8/1995 Heikki Tuuri
#include "fil0pagecompress.h"
#include "btr0scrub.h"
+#include <my_service_manager.h>
+
+#ifdef WITH_WSREP
+extern int wsrep_debug;
+extern int wsrep_trx_is_aborting(void *thd_ptr);
+#endif
/* The following is the maximum allowed duration of a lock wait. */
UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT;
@@ -2634,6 +2640,13 @@ srv_do_purge(ulint* n_total_purged)
*n_total_purged += n_pages_purged;
+ if (n_pages_purged) {
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "InnoDB " ULINTPF " pages purged", n_pages_purged);
+ /* The previous round still did some work. */
+ continue;
+ }
} while (n_pages_purged > 0
&& purge_sys.state == PURGE_STATE_RUN
&& !srv_purge_should_exit());
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index bd994dec765..10f2288635e 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -25,7 +25,7 @@ Created 3/26/1996 Heikki Tuuri
*******************************************************/
#include "my_config.h"
-#include <my_systemd.h>
+#include <my_service_manager.h>
#include "ha_prototypes.h"
#include "trx0roll.h"
@@ -756,10 +756,17 @@ void trx_roll_report_progress()
trx_sys.rw_trx_hash.iterate_no_dups(
reinterpret_cast<my_hash_walk_action>
(trx_roll_count_callback), &arg);
+
+ if (arg.n_rows > 0) {
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "To roll back: " UINT32PF " transactions, "
+ UINT64PF " rows", arg.n_trx, arg.n_rows);
+ }
+
ib::info() << "To roll back: " << arg.n_trx
<< " transactions, " << arg.n_rows << " rows";
- sd_notifyf(0, "STATUS=To roll back: " UINT32PF " transactions,"
- " " UINT64PF " rows", arg.n_trx, arg.n_rows);
+
}
}
diff --git a/storage/oqgraph/graphcore-graph.cc b/storage/oqgraph/graphcore-graph.cc
index 6decce601fe..42366787340 100644
--- a/storage/oqgraph/graphcore-graph.cc
+++ b/storage/oqgraph/graphcore-graph.cc
@@ -22,6 +22,5 @@
======================================================================
*/
-#include "graphcore-config.h"
#include "graphcore-graph.h"
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index 31284a7e9a1..d8f1fcc9b00 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -25,7 +25,6 @@
#include <string.h>
#include <cstdlib>
-#include "graphcore-config.h"
#include "graphcore-graph.h"
#include <set>
diff --git a/storage/oqgraph/oqgraph_shim.h b/storage/oqgraph/oqgraph_shim.h
index f24732af4ef..df578c9e4d0 100644
--- a/storage/oqgraph/oqgraph_shim.h
+++ b/storage/oqgraph/oqgraph_shim.h
@@ -24,8 +24,8 @@
#pragma once
-#include "oqgraph_thunk.h"
#include "oqgraph_judy.h"
+#include "oqgraph_thunk.h"
#define BOOST_NO_HASH 1
#define BOOST_NO_SLIST 1
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
index 27b1fd1e9af..9674b2b0c15 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
@@ -81,3 +81,10 @@ ROCKSDB_DDL Gamma
ROCKSDB_INDEX_FILE_MAP Gamma
ROCKSDB_LOCKS Gamma
ROCKSDB_TRX Gamma
+#
+# MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || ...
+#
+CREATE TABLE t1 (i INT) ENGINE=RocksDB;
+FLUSH TABLE t1 FOR EXPORT;
+ERROR HY000: Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
index 980f2e302b2..681e3d2d63f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
@@ -73,3 +73,13 @@ set global rocksdb_strict_collation_check=@tmp_rscc;
--echo #
select plugin_name, plugin_maturity from information_schema.plugins where plugin_name like '%rocksdb%';
+
+--echo #
+--echo # MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || ...
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=RocksDB;
+--error ER_ILLEGAL_HA
+FLUSH TABLE t1 FOR EXPORT;
+DROP TABLE t1;
+
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result
index 9c29033429e..9276664f84f 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db917.result
@@ -1,8 +1,8 @@
drop table if exists t1;
set @orig_table_open_cache = @@global.table_open_cache;
create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb);
-lock tables t1 read;
-set @@global.table_open_cache = 1;
+lock tables t1 read,t1 as t2 read,t1 as t3 read, t1 as t4 read, t1 as t5 read, t1 as t6 read, t1 as t7 read, t1 as t8 read, t1 as t9 read, t1 as t10 read;
+set @@global.table_open_cache = 10;
begin;
insert into t1 values(1),(1);
select * from t1 where c like _ucs2 0x039C0025 collate ucs2_unicode_ci;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test b/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test
index ae94d7b30de..781fdb012f1 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/db917.test
@@ -7,8 +7,8 @@ drop table if exists t1;
enable_warnings;
set @orig_table_open_cache = @@global.table_open_cache;
create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb);
-lock tables t1 read;
-set @@global.table_open_cache = 1;
+lock tables t1 read,t1 as t2 read,t1 as t3 read, t1 as t4 read, t1 as t5 read, t1 as t6 read, t1 as t7 read, t1 as t8 read, t1 as t9 read, t1 as t10 read;
+set @@global.table_open_cache = 10;
begin;
insert into t1 values(1),(1);
# when the bug is present, this results in a lock wait timeout