diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-02-16 13:34:45 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-02-16 13:34:45 +0200 |
commit | 2e431ff7e69d9c887777cc597ccf5cfb446e13d8 (patch) | |
tree | 98be0df7531bbe1f26e1f339cf18430556bca933 | |
parent | 80b4fa54e1d38c8f90f6b94240c583aa9d4627b7 (diff) | |
parent | 1fd00998390a7487e42f5e29472e99354159c8bc (diff) | |
download | mariadb-git-2e431ff7e69d9c887777cc597ccf5cfb446e13d8.tar.gz |
Merge 10.11 into 11.0
493 files changed, 7019 insertions, 2603 deletions
@@ -9,6 +9,7 @@ MariaDB Corporation https://www.mariadb.com (2013) Microsoft https://microsoft.com/ (2017) ServiceNow https://servicenow.com (2019) SIT https://sit.org (2022) +Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) Automattic https://automattic.com (2019) diff --git a/client/mysql.cc b/client/mysql.cc index 9971410c0d8..eb6508903b6 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3820,7 +3820,10 @@ print_table_data(MYSQL_RES *result) { print_field_types(result); if (!mysql_num_rows(result)) + { + my_afree((uchar*) num_flag); return; + } mysql_field_seek(result,0); } separator.copy("+",1,charset_info); diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 3b2dc78040e..ad50f64d663 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -566,14 +566,14 @@ static int file_exists(char * filename) @retval int error = 1, success = 0 */ -static int search_dir(const char * base_path, const char *tool_name, +static int search_dir(const char *base_path, const char *tool_name, const char *subdir, char *tool_path) { char new_path[FN_REFLEN]; char source_path[FN_REFLEN]; - strcpy(source_path, base_path); - strcat(source_path, subdir); + safe_strcpy(source_path, sizeof(source_path), base_path); + safe_strcat(source_path, sizeof(source_path), subdir); fn_format(new_path, tool_name, source_path, "", MY_UNPACK_FILENAME); if (file_exists(new_path)) { @@ -629,7 +629,7 @@ static int load_plugin_data(char *plugin_name, char *config_file) FILE *file_ptr; char path[FN_REFLEN]; char line[1024]; - char *reason= 0; + const char *reason= 0; char *res; int i= -1; @@ -640,14 +640,14 @@ static int load_plugin_data(char *plugin_name, char *config_file) } if (!file_exists(opt_plugin_ini)) { - reason= (char *)"File does not exist."; + reason= "File does not exist."; goto error; } file_ptr= fopen(opt_plugin_ini, "r"); if (file_ptr == NULL) { - reason= (char *)"Cannot open file."; + reason= "Cannot open file."; goto error; } @@ -657,17 +657,20 @@ static int load_plugin_data(char *plugin_name, char *config_file) /* Read plugin components */ while (i < 16) { + size_t line_len; + res= fgets(line, sizeof(line), file_ptr); + line_len= strlen(line); + /* strip /n */ - if (line[strlen(line)-1] == '\n') - { - line[strlen(line)-1]= '\0'; - } + if (line[line_len - 1] == '\n') + line[line_len - 1]= '\0'; + if (res == NULL) { if (i < 1) { - reason= (char *)"Bad format in plugin configuration file."; + reason= "Bad format in plugin configuration file."; fclose(file_ptr); goto error; } @@ -680,14 +683,19 @@ static int load_plugin_data(char *plugin_name, char *config_file) if (i == -1) /* if first pass, read this line as so_name */ { /* Add proper file extension for soname */ - strcat(line, FN_SOEXT); + if (safe_strcpy(line + line_len - 1, sizeof(line), FN_SOEXT)) + { + reason= "Plugin name too long."; + fclose(file_ptr); + goto error; + } /* save so_name */ plugin_data.so_name= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME|MY_ZEROFILL)); i++; } else { - if (strlen(line) > 0) + if (line_len > 0) { plugin_data.components[i]= my_strdup(PSI_NOT_INSTRUMENTED, line, MYF(MY_WME)); i++; @@ -776,14 +784,13 @@ static int check_options(int argc, char **argv, char *operation) /* read the plugin config file and check for match against argument */ else { - if (strlen(argv[i]) + 4 + 1 > FN_REFLEN) + if (safe_strcpy(plugin_name, sizeof(plugin_name), argv[i]) || + safe_strcpy(config_file, sizeof(config_file), argv[i]) || + safe_strcat(config_file, sizeof(config_file), ".ini")) { fprintf(stderr, "ERROR: argument is too long.\n"); return 1; } - strcpy(plugin_name, argv[i]); - strcpy(config_file, argv[i]); - strcat(config_file, ".ini"); } } @@ -852,35 +859,30 @@ static int check_options(int argc, char **argv, char *operation) static int process_options(int argc, char *argv[], char *operation) { int error= 0; - int i= 0; /* Parse and execute command-line options */ if ((error= handle_options(&argc, &argv, my_long_options, get_one_option))) - goto exit; + return error; /* If the print defaults option used, exit. */ if (opt_print_defaults) - { - error= -1; - goto exit; - } + return -1; /* Add a trailing directory separator if not present */ if (opt_basedir) { - i= (int)strlength(opt_basedir); - if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2) + size_t basedir_len= strlength(opt_basedir); + if (opt_basedir[basedir_len - 1] != FN_LIBCHAR || + opt_basedir[basedir_len - 1] != FN_LIBCHAR2) { char buff[FN_REFLEN]; - memset(buff, 0, sizeof(buff)); - - strncpy(buff, opt_basedir, sizeof(buff) - 1); -#ifdef _WIN32 - strncat(buff, "/", sizeof(buff) - strlen(buff) - 1); -#else - strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1); -#endif - buff[sizeof(buff) - 1]= 0; + if (basedir_len + 2 > FN_REFLEN) + return -1; + + memcpy(buff, opt_basedir, basedir_len); + buff[basedir_len]= '/'; + buff[basedir_len + 1]= '\0'; + my_free(opt_basedir); opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, buff, MYF(MY_FAE)); } @@ -892,10 +894,7 @@ static int process_options(int argc, char *argv[], char *operation) generated when the defaults were read from the file, exit. */ if (!opt_no_defaults && ((error= get_default_values()))) - { - error= -1; - goto exit; - } + return -1; /* Check to ensure required options are present and validate the operation. @@ -903,11 +902,9 @@ static int process_options(int argc, char *argv[], char *operation) read a configuration file named <plugin_name>.ini from the --plugin-dir or --plugin-ini location if the --plugin-ini option presented. */ - strcpy(operation, ""); - if ((error = check_options(argc, argv, operation))) - { - goto exit; - } + operation[0]= '\0'; + if ((error= check_options(argc, argv, operation))) + return error; if (opt_verbose) { @@ -919,8 +916,7 @@ static int process_options(int argc, char *argv[], char *operation) printf("# lc_messages_dir = %s\n", opt_lc_messages_dir); } -exit: - return error; + return 0; } diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index bbcc1179bae..d7fc64d730a 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -321,8 +321,8 @@ class Load_log_processor } public: - Load_log_processor() {} - ~Load_log_processor() {} + Load_log_processor() = default; + ~Load_log_processor() = default; int init() { diff --git a/client/mysqldump.c b/client/mysqldump.c index b28bc32897e..ebfaec5e693 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2633,7 +2633,7 @@ static uint dump_events_for_db(char *db) if (mysql_query_with_error_report(mysql, &event_list_res, "show events")) DBUG_RETURN(0); - strcpy(delimiter, ";"); + safe_strcpy(delimiter, sizeof(delimiter), ";"); if (mysql_num_rows(event_list_res) > 0) { if (opt_xml) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d3e5f96faea..75e9e913074 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6245,7 +6245,9 @@ int do_done(struct st_command *command) if (*cur_block->delim) { /* Restore "old" delimiter after false if block */ - strcpy (delimiter, cur_block->delim); + if (safe_strcpy(delimiter, sizeof(delimiter), cur_block->delim)) + die("Delimiter too long, truncated"); + delimiter_length= strlen(delimiter); } /* Pop block from stack, goto next line */ @@ -6500,10 +6502,12 @@ void do_block(enum block_cmd cmd, struct st_command* command) if (cur_block->ok) { cur_block->delim[0]= '\0'; - } else + } + else { /* Remember "old" delimiter if entering a false if block */ - strcpy (cur_block->delim, delimiter); + if (safe_strcpy(cur_block->delim, sizeof(cur_block->delim), delimiter)) + die("Delimiter too long, truncated"); } DBUG_PRINT("info", ("OK: %d", cur_block->ok)); @@ -11900,9 +11904,8 @@ static int setenv(const char *name, const char *value, int overwrite) char *envvar= (char *)malloc(buflen); if(!envvar) return ENOMEM; - strcpy(envvar, name); - strcat(envvar, "="); - strcat(envvar, value); + + snprintf(envvar, buflen, "%s=%s", name, value); putenv(envvar); return 0; } diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index feed89be5f2..fab3305b3ff 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -158,8 +158,8 @@ IF(WIN32) OPTION(SIGNCODE "Sign executables and dlls with digital certificate" OFF) MARK_AS_ADVANCED(SIGNCODE) IF(SIGNCODE) - SET(SIGNTOOL_PARAMETERS - /a /t http://timestamp.globalsign.com/?signature=sha2 + SET(SIGNTOOL_PARAMETERS + /a /fd SHA256 /t http://timestamp.globalsign.com/?signature=sha2 CACHE STRING "parameters for signtool (list)") IF(NOT SIGNTOOL_EXECUTABLE) FILE(GLOB path_list diff --git a/dbug/dbug.c b/dbug/dbug.c index a6d893e3f49..ac645c64454 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -86,7 +86,7 @@ #include <m_string.h> #include <errno.h> #ifdef HAVE_gcov -extern void __gcov_flush(); +#include <gcov.h> #endif #ifndef DBUG_OFF @@ -511,7 +511,7 @@ static int DbugParse(CODE_STATE *cs, const char *control) stack->delay= stack->next->delay; stack->maxdepth= stack->next->maxdepth; stack->sub_level= stack->next->sub_level; - strcpy(stack->name, stack->next->name); + safe_strcpy(stack->name, sizeof(stack->name), stack->next->name); stack->out_file= stack->next->out_file; stack->out_file->used++; if (stack->next == &init_settings) @@ -2212,7 +2212,7 @@ void _db_suicide_() fprintf(stderr, "SIGKILL myself\n"); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif retval= kill(getpid(), SIGKILL); @@ -2262,7 +2262,7 @@ my_bool _db_my_assert(const char *file, int line, const char *msg) fprintf(stderr, "%s:%d: assert: %s\n", file, line, msg); fflush(stderr); #ifdef HAVE_gcov - __gcov_flush(); + __gcov_dump(); #endif } return a; diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index f82cc7eb375..68a8ce34283 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -104,13 +104,6 @@ fi case "${LSBNAME}" in # Debian - stretch) - # MDEV-16525 libzstd-dev-1.1.3 minimum version - sed -e '/libzstd-dev/d' \ - -e 's/libcurl4/libcurl3/g' -i debian/control - remove_rocksdb_tools - disable_pmem - ;& buster) disable_libfmt replace_uring_with_aio diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 1f7f341e397..eaaeb0c36a5 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -773,7 +773,7 @@ parse_page( { unsigned long long id; uint16_t undo_page_type; - char str[20]={'\0'}; + const char *str; ulint n_recs; uint32_t page_no, left_page_no, right_page_no; ulint data_bytes; @@ -781,11 +781,7 @@ parse_page( ulint size_range_id; /* Check whether page is doublewrite buffer. */ - if(skip_page) { - strcpy(str, "Double_write_buffer"); - } else { - strcpy(str, "-"); - } + str = skip_page ? "Double_write_buffer" : "-"; switch (fil_page_get_type(page)) { diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 8647f5f005c..c3b909fc9b9 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -58,6 +58,9 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include "backup_debug.h" #include "backup_mysql.h" #include <btr0btr.h> +#ifdef _WIN32 +#include <direct.h> /* rmdir */ +#endif #ifdef _WIN32 #include <aclapi.h> @@ -1562,7 +1565,49 @@ bool backup_finish() return(true); } -bool + +/* + Drop all empty database directories in the base backup + that do not exists in the icremental backup. + + This effectively re-plays all DROP DATABASE statements happened + in between base backup and incremental backup creation time. + + Note, only checking if base_dir/db/ is empty is not enough, + because inc_dir/db/db.opt might have been dropped for some reasons, + which may also result into empty base_dir/db/. + + Only the fact that at the same time: + - base_dir/db/ exists + - inc_dir/db/ does not exist + means that DROP DATABASE happened. +*/ +static void +ibx_incremental_drop_databases(const char *base_dir, + const char *inc_dir) +{ + datadir_node_t node; + datadir_node_init(&node); + datadir_iter_t *it = datadir_iter_new(base_dir); + + while (datadir_iter_next(it, &node)) { + if (node.is_empty_dir) { + char path[FN_REFLEN]; + snprintf(path, sizeof(path), "%s/%s", + inc_dir, node.filepath_rel); + if (!directory_exists(path, false)) { + msg("Removing %s", node.filepath); + rmdir(node.filepath); + } + } + + } + datadir_iter_free(it); + datadir_node_free(&node); +} + + +static bool ibx_copy_incremental_over_full() { const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI", @@ -1645,6 +1690,8 @@ ibx_copy_incremental_over_full() } copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true); } + ibx_incremental_drop_databases(xtrabackup_target_dir, + xtrabackup_incremental_dir); } diff --git a/extra/mariabackup/xbcloud.cc b/extra/mariabackup/xbcloud.cc index fed937be834..cee76e5f3d7 100644 --- a/extra/mariabackup/xbcloud.cc +++ b/extra/mariabackup/xbcloud.cc @@ -1676,8 +1676,11 @@ container_list_add_object(container_list *list, const char *name, list->object_count += object_count_step; } assert(list->idx <= list->object_count); - strcpy(list->objects[list->idx].name, name); - strcpy(list->objects[list->idx].hash, hash); + safe_strcpy(list->objects[list->idx].name, + sizeof(list->objects[list->idx].name), name); + safe_strcpy(list->objects[list->idx].hash, + sizeof(list->objects[list->idx].hash), hash); + list->objects[list->idx].bytes = bytes; ++list->idx; } diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index e0ea4a17ab8..055e8ab85ec 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1294,7 +1294,7 @@ struct my_option xb_client_options[]= { {"rsync", OPT_RSYNC, "Uses the rsync utility to optimize local file " - "transfers. When this option is specified, innobackupex uses rsync " + "transfers. When this option is specified, " XB_TOOL_NAME " uses rsync " "to copy all non-InnoDB files instead of spawning a separate cp for " "each file, which can be much faster for servers with a large number " "of databases or tables. This option cannot be used together with " @@ -1402,7 +1402,7 @@ struct my_option xb_client_options[]= { {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE, "This option specifies which types of queries are allowed to complete " - "before innobackupex will issue the global lock. Default is all.", + "before " XB_TOOL_NAME " will issue the global lock. Default is all.", (uchar *) &opt_lock_wait_query_type, (uchar *) &opt_lock_wait_query_type, &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0, 0}, @@ -1422,26 +1422,26 @@ struct my_option xb_client_options[]= { NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT, - "This option specifies the number of seconds innobackupex waits " + "This option specifies the number of seconds " XB_TOOL_NAME " waits " "between starting FLUSH TABLES WITH READ LOCK and killing those " "queries that block it. Default is 0 seconds, which means " - "innobackupex will not attempt to kill any queries.", + XB_TOOL_NAME " will not attempt to kill any queries.", (uchar *) &opt_kill_long_queries_timeout, (uchar *) &opt_kill_long_queries_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT, - "This option specifies time in seconds that innobackupex should wait " + "This option specifies time in seconds that " XB_TOOL_NAME " should wait " "for queries that would block FTWRL before running it. If there are " - "still such queries when the timeout expires, innobackupex terminates " - "with an error. Default is 0, in which case innobackupex does not " + "still such queries when the timeout expires, " XB_TOOL_NAME " terminates " + "with an error. Default is 0, in which case " XB_TOOL_NAME " does not " "wait for queries to complete and starts FTWRL immediately.", (uchar *) &opt_lock_wait_timeout, (uchar *) &opt_lock_wait_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD, "This option specifies the query run time threshold which is used by " - "innobackupex to detect long-running queries with a non-zero value " + XB_TOOL_NAME " to detect long-running queries with a non-zero value " "of --ftwrl-wait-timeout. FTWRL is not started until such " "long-running queries exist. This option has no effect if " "--ftwrl-wait-timeout is 0. Default value is 60 seconds.", @@ -3106,7 +3106,8 @@ static bool xtrabackup_copy_logfile() mysql_mutex_lock(&recv_sys.mutex); } - msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); + if (verbose) + msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); return false; } @@ -3149,7 +3150,7 @@ static void log_copying_thread() my_thread_end(); } -/** whether io_watching_thread() is active; protected by log_sys.mutex */ +/** whether io_watching_thread() is active; protected by recv_sys.mutex */ static bool have_io_watching_thread; /* io throttle watching (rough) */ @@ -4431,11 +4432,13 @@ static bool xtrabackup_backup_low() return false; } - if(!xtrabackup_incremental) { - strcpy(metadata_type, "full-backuped"); + if (!xtrabackup_incremental) { + safe_strcpy(metadata_type, sizeof(metadata_type), + "full-backuped"); metadata_from_lsn = 0; } else { - strcpy(metadata_type, "incremental"); + safe_strcpy(metadata_type, sizeof(metadata_type), + "incremental"); metadata_from_lsn = incremental_lsn; } metadata_last_lsn = recv_sys.lsn; @@ -6025,7 +6028,8 @@ error: if (ok) { char filename[FN_REFLEN]; - strcpy(metadata_type, "log-applied"); + safe_strcpy(metadata_type, sizeof(metadata_type), + "log-applied"); if(xtrabackup_incremental && metadata_to_lsn < incremental_to_lsn) diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 3796c9ec698..d2a5e31645b 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include "changed_page_bitmap.h" #include <set> +#define XB_TOOL_NAME "mariadb-backup" #define XB_HISTORY_TABLE "mysql.mariadb_backup_history" struct xb_delta_info_t diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt index 5f446663dc8..390a618ac91 100644 --- a/extra/wolfssl/CMakeLists.txt +++ b/extra/wolfssl/CMakeLists.txt @@ -12,6 +12,9 @@ IF(MSVC_INTEL) SET(WOLFSSL_X86_64_BUILD 1) SET(HAVE_INTEL_RDSEED 1) SET(HAVE_INTEL_RDRAND 1) +ELSEIF(CMAKE_ASM_COMPILER_ID MATCHES "Clang" AND CMAKE_VERSION VERSION_LESS 3.16) + + # WolfSSL 5.5.4 bug workaround below does not work, due to some CMake bug ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64") SET(WOLFSSL_X86_64_BUILD 1) IF(CMAKE_C_COMPILER_ID MATCHES GNU AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) diff --git a/include/ilist.h b/include/ilist.h index 265f0e2d57e..3349959e17e 100644 --- a/include/ilist.h +++ b/include/ilist.h @@ -27,12 +27,11 @@ // Derive your class from this struct to insert to a linked list. template <class Tag= void> struct ilist_node { - ilist_node() noexcept #ifndef DBUG_OFF - : next(NULL), prev(NULL) + ilist_node() noexcept : next(NULL), prev(NULL) {} +#else + ilist_node() = default; #endif - { - } ilist_node(ilist_node *next, ilist_node *prev) noexcept : next(next), prev(prev) diff --git a/include/m_string.h b/include/m_string.h index 7130a41438f..9e35be404ec 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -226,6 +226,44 @@ static inline void lex_string_set3(LEX_CSTRING *lex_str, const char *c_str, lex_str->length= len; } +/* + Copies src into dst and ensures dst is a NULL terminated C string. + + Returns 1 if the src string was truncated due to too small size of dst. + Returns 0 if src completely fit within dst. Pads the remaining dst with '\0' + + Note: dst_size must be > 0 +*/ +static inline int safe_strcpy(char *dst, size_t dst_size, const char *src) +{ + memset(dst, '\0', dst_size); + strncpy(dst, src, dst_size - 1); + /* + If the first condition is true, we are guaranteed to have src length + >= (dst_size - 1), hence safe to access src[dst_size - 1]. + */ + if (dst[dst_size - 2] != '\0' && src[dst_size - 1] != '\0') + return 1; /* Truncation of src. */ + return 0; +} + +/* + Appends src to dst and ensures dst is a NULL terminated C string. + + Returns 1 if the src string was truncated due to too small size of dst. + Returns 0 if src completely fit within the remaining dst space. Pads the + remaining dst with '\0'. + + Note: dst_size must be > 0 +*/ +static inline int safe_strcat(char *dst, size_t dst_size, const char *src) +{ + size_t init_len= strlen(dst); + if (init_len >= dst_size - 1) + return 1; + return safe_strcpy(dst + init_len, dst_size - init_len, src); +} + #ifdef __cplusplus static inline char *safe_str(char *str) { return str ? str : const_cast<char*>(""); } diff --git a/include/my_atomic_wrapper.h b/include/my_atomic_wrapper.h index e45aba9d22b..7b35b14d3b7 100644 --- a/include/my_atomic_wrapper.h +++ b/include/my_atomic_wrapper.h @@ -39,7 +39,7 @@ public: Atomic_relaxed(const Atomic_relaxed<Type> &rhs) { m.store(rhs, std::memory_order_relaxed); } Atomic_relaxed(Type val) : m(val) {} - Atomic_relaxed() {} + Atomic_relaxed() = default; Type load(std::memory_order o= std::memory_order_relaxed) const { return m.load(o); } diff --git a/include/my_counter.h b/include/my_counter.h index c5cbe296df0..f85b8e80bd7 100644 --- a/include/my_counter.h +++ b/include/my_counter.h @@ -31,7 +31,7 @@ public: Atomic_counter(const Atomic_counter<Type> &rhs) { m_counter.store(rhs, std::memory_order_relaxed); } Atomic_counter(Type val): m_counter(val) {} - Atomic_counter() {} + Atomic_counter() = default; Type operator++(int) { return add(1); } Type operator--(int) { return sub(1); } diff --git a/include/span.h b/include/span.h index 0e8516933c6..4ea200f5494 100644 --- a/include/span.h +++ b/include/span.h @@ -81,7 +81,7 @@ public: span(const span &other) : data_(other.data_), size_(other.size_) {} - ~span(){}; + ~span() = default; span &operator=(const span &other) { diff --git a/mysql-test/include/ctype_casefolding.inc b/mysql-test/include/ctype_casefolding.inc new file mode 100644 index 00000000000..4ee402c95ad --- /dev/null +++ b/mysql-test/include/ctype_casefolding.inc @@ -0,0 +1,18 @@ +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +# Uncode code points that have a variable length case mapping in utf8 +# (e.g. LOWER('2-byte-character') -> '3-byte-character' +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +DROP TABLE case_folding; diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 9ed206b2c22..17c8dd3ed4e 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -11,6 +11,7 @@ # [--let $rpl_skip_start_slave= 1] # [--let $rpl_debug= 1] # [--let $slave_timeout= NUMBER] +# [--let $rpl_server_skip_log_bin= 1] # --source include/master-slave.inc # # Parameters: diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 4ee4cccdc20..acb9104ae6f 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -73,6 +73,7 @@ # before CHANGE MASTER and START SLAVE. RESET MASTER and RESET # SLAVE are suppressed if $rpl_skip_reset_master_and_slave is # set. +# Also see $rpl_server_skip_log_bin. # # $rpl_skip_change_master # By default, this script issues CHANGE MASTER so that all slaves @@ -94,6 +95,10 @@ # Timeout used when waiting for the slave threads to start. # See include/wait_for_slave_param.inc # +# $rpl_server_skip_log_bin +# When $rpl_skip_reset_master_and_slave is not set +# RESET MASTER does not report ER_FLUSH_MASTER_BINLOG_CLOSED +# on any server. # # ==== Side effects ==== # @@ -161,7 +166,16 @@ while ($_rpl_server) USE test; if (!$rpl_skip_reset_master_and_slave) { - RESET MASTER; + if (!$rpl_server_skip_log_bin) + { + --error 0 + RESET MASTER; + } + if ($rpl_server_skip_log_bin) + { + --error 0,ER_FLUSH_MASTER_BINLOG_CLOSED + RESET MASTER; + } SET GLOBAL gtid_slave_pos= ""; RESET SLAVE; } diff --git a/mysql-test/include/world.inc b/mysql-test/include/world.inc index a6f877ce0cd..91ea66ef731 100644 --- a/mysql-test/include/world.inc +++ b/mysql-test/include/world.inc @@ -215,7 +215,7 @@ INSERT IGNORE INTO Country VALUES ('TCD','Chad',1284000.00,7651000,3337), ('CZE','Czech Republic',78866.00,10278100,3339), ('TUN','Tunisia',163610.00,9586000,3349), -('TUR','Turkey',774815.00,66591000,3358), +('TUR','Türkiye',774815.00,66591000,3358), ('TKM','Turkmenistan',488100.00,4459000,3419), ('TCA','Turks and Caicos Islands',430.00,17000,3423), ('TUV','Tuvalu',26.00,12000,3424), diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 7114ff1e072..ed416e7b355 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -5792,6 +5792,178 @@ r 3 drop table t1,t2,t3,x; # +# MDEV-30248: Embedded non-recursive CTE referring to base table 'x' +# within a CTE with name 'x' used in a subquery from +# select list of another CTE +# +CREATE TABLE x (a int) ENGINE=MyISAM; +INSERT INTO x VALUES (3),(7),(1); +CREATE TABLE t1 (b int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1); +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +3 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +c +3 +WITH x AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT x.c from x; +c +1 +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) +SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b +) AS c +) +SELECT cte.c from cte; +c +2 +DROP TABLE x; +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) +SELECT b FROM x AS r +) AS c +) +SELECT cte.c FROM cte; +ERROR 42S02: Table 'test.x' doesn't exist +WITH x AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) +SELECT b FROM x AS r +) AS c +) +SELECT x.c from x; +ERROR 42S02: Table 'test.x' doesn't exist +WITH cte AS +( +SELECT +( +WITH x AS +(WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) +SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b +) AS c +) +SELECT cte.c from cte; +ERROR 42S02: Table 'test.x' doesn't exist +DROP TABLE t1; +# # End of 10.3 tests # # diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 06237c7b5dc..4a21c12a9f8 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -3878,6 +3878,129 @@ select * from cte; drop table t1,t2,t3,x; --echo # +--echo # MDEV-30248: Embedded non-recursive CTE referring to base table 'x' +--echo # within a CTE with name 'x' used in a subquery from +--echo # select list of another CTE +--echo # + +CREATE TABLE x (a int) ENGINE=MyISAM; +INSERT INTO x VALUES (3),(7),(1); +CREATE TABLE t1 (b int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1); + +let $q1= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q1; + +let $q2= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT b FROM t1) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q2; + +let $q3= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH y AS (SELECT a FROM x AS t) SELECT b FROM t1) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q3; + + +let $q4= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH y(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM y) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q4; + +let $q5= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x(b) AS (SELECT a FROM x AS t LIMIT 1) SELECT b FROM x) + SELECT b FROM x AS r + ) AS c +) +SELECT cte.c FROM cte; +eval $q5; + +let $q6= +WITH x AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 1 AS b) + SELECT b FROM x AS r + ) AS c +) +SELECT x.c from x; +eval $q6; + +let $q7= +WITH cte AS +( + SELECT + ( + WITH x AS + (WITH x AS (SELECT a FROM x AS t) SELECT 2 AS b) + SELECT r1.b FROM x AS r1, x AS r2 WHERE r1.b=r2.b + ) AS c +) +SELECT cte.c from cte; +eval $q7; + + +DROP TABLE x; + +--ERROR ER_NO_SUCH_TABLE +eval $q1; +--ERROR ER_NO_SUCH_TABLE +eval $q2; +--ERROR ER_NO_SUCH_TABLE +eval $q3; +--ERROR ER_NO_SUCH_TABLE +eval $q4; +--ERROR ER_NO_SUCH_TABLE +eval $q5; +--ERROR ER_NO_SUCH_TABLE +eval $q6; +--ERROR ER_NO_SUCH_TABLE +eval $q7; + +DROP TABLE t1; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/ctype_ldml.result b/mysql-test/main/ctype_ldml.result index df009b77bca..efafa9dc041 100644 --- a/mysql-test/main/ctype_ldml.result +++ b/mysql-test/main/ctype_ldml.result @@ -3041,6 +3041,51 @@ SELECT 'chž'< 'i'; SELECT 'a' COLLATE utf8_czech_test_bad_w2; ERROR HY000: Unknown collation: 'utf8_czech_test_bad_w2' # +# End of 10.2 tests +# +# +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb4 COLLATE utf8mb4_test_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_test_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests +# +# # MDEV-7947 my_charset_same: strcmp() takes 0.37% in OLTP RO # SHOW COLLATION LIKE 'latin1_test_replace'; @@ -3048,6 +3093,9 @@ Collation Charset Id Default Compiled Sortlen SELECT 'foo' = 'foo ' COLLATE latin1_test_replace; ERROR HY000: Unknown collation: 'latin1_test_replace' # +# End of 10.5 tests +# +# # MDEV-27042 UCA: Resetting contractions to ignorable does not work well # CREATE TABLE t1 ( @@ -3082,6 +3130,9 @@ tèl.123 10020E8B0F2E025D0E2A0E2B0E2C tex.123 10020E8B105A025D0E2A0E2B0E2C DROP TABLE t1; # +# End of 10.8 tests +# +# # MDEV-27009 Add UCA-14.0.0 collations # CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_test01_as_ci, comment VARCHAR(128)); @@ -3178,3 +3229,6 @@ is_400 0 is_520 0 is_1400 1 DROP TABLE t1; +# +# End of 10.10 tests +# diff --git a/mysql-test/main/ctype_ldml.test b/mysql-test/main/ctype_ldml.test index ed3234970bb..5ee56c3b950 100644 --- a/mysql-test/main/ctype_ldml.test +++ b/mysql-test/main/ctype_ldml.test @@ -611,6 +611,27 @@ SELECT 'chž'< 'i'; --error ER_UNKNOWN_COLLATION SELECT 'a' COLLATE utf8_czech_test_bad_w2; +--echo # +--echo # End of 10.2 tests +--echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_test_520_nopad_ci; +--source include/ctype_casefolding.inc + + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # MDEV-7947 my_charset_same: strcmp() takes 0.37% in OLTP RO @@ -620,6 +641,9 @@ SHOW COLLATION LIKE 'latin1_test_replace'; --error ER_UNKNOWN_COLLATION SELECT 'foo' = 'foo ' COLLATE latin1_test_replace; +--echo # +--echo # End of 10.5 tests +--echo # --echo # --echo # MDEV-27042 UCA: Resetting contractions to ignorable does not work well @@ -640,6 +664,9 @@ SELECT * FROM t1 WHERE phone<>'123' ORDER BY BINARY phone; SELECT phone, HEX(WEIGHT_STRING(phone)) FROM t1 ORDER BY phone, BINARY phone; DROP TABLE t1; +--echo # +--echo # End of 10.8 tests +--echo # --echo # --echo # MDEV-27009 Add UCA-14.0.0 collations @@ -669,3 +696,7 @@ FROM t1 ORDER BY a, HEX(a); --horizontal_results DROP TABLE t1; + +--echo # +--echo # End of 10.10 tests +--echo # diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index a2f9822131b..b567137df1e 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -8204,7 +8204,7 @@ INSERT INTO t1 VALUES (_utf32 0x2CEE); SELECT hex(c), hex(lower(c)), hex(upper(c)), hex(weight_string(c)), c FROM t1 ORDER BY c, BINARY c; hex(c) hex(lower(c)) hex(upper(c)) hex(weight_string(c)) c -C8BA C8BA 1214 Ⱥ +C8BA E2B1A5 C8BA 1214 Ⱥ E2B1A5 E2B1A5 C8BA 1214 â±¥ C680 C680 C983 122D Æ€ C983 C680 C983 122D Ƀ @@ -8229,7 +8229,7 @@ E2B1AA E2B1AA E2B1A9 1328 ⱪ C8BD C69A C8BD 133B Ƚ E2B1A0 E2B1A1 E2B1A0 133F â± E2B1A1 E2B1A1 E2B1A0 133F ⱡ -C9AB C9AB 1340 É« +C9AB C9AB E2B1A2 1340 É« E2B1A2 C9AB E2B1A2 1340 â±¢ E1B5BD E1B5BD E2B1A3 13B8 áµ½ E2B1A3 E1B5BD E2B1A3 13B8 â±£ @@ -8237,11 +8237,11 @@ C98A C98B C98A 13D2 ÉŠ C98B C98B C98A 13D2 É‹ C98C C98D C98C 13E4 ÉŒ C98D C98D C98C 13E4 É -C9BD C9BD 13FC ɽ +C9BD C9BD E2B1A4 13FC ɽ E2B1A4 C9BD E2B1A4 13FC Ɽ EA9CA8 EA9CA9 EA9CA8 143314AD Ꜩ EA9CA9 EA9CA9 EA9CA8 143314AD ꜩ -C8BE C8BE 143C Ⱦ +C8BE E2B1A6 C8BE 143C Ⱦ E2B1A6 E2B1A6 C8BE 143C ⱦ C984 CA89 C984 145B É„ CA89 CA89 C984 145B ʉ diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 6d50a6cee2e..7a40c361e81 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -11384,6 +11384,181 @@ a # End of 10.3 tests # # +# Start of 10.4 tests +# +# +# MDEV-27653 long uniques don't work with unicode collations +# +SET NAMES utf8mb3; +CREATE TABLE t1 ( +a CHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a CHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a VARCHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a VARCHAR(30) COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 (a TEXT COLLATE utf8mb3_general_ci UNIQUE); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +CREATE TABLE t1 ( +a LONGTEXT COLLATE utf8mb3_general_ci, +UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`(10)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +SELECT * FROM t1; +a +a +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +INSERT INTO t1 VALUES ('A'); +ERROR 23000: Duplicate entry 'A' for key 'a' +INSERT INTO t1 VALUES ('Ä'); +ERROR 23000: Duplicate entry 'Ä' for key 'a' +INSERT INTO t1 VALUES ('Ấ'); +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +Ấ 3 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check error Upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it! +ALTER TABLE t1 FORCE; +ERROR 23000: Duplicate entry 'ä' for key 'a' +DELETE FROM t1 WHERE OCTET_LENGTH(a)>1; +ALTER TABLE t1 FORCE; +INSERT INTO t1 VALUES ('ä'); +ERROR 23000: Duplicate entry 'ä' for key 'a' +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +ALTER IGNORE TABLE t1 FORCE; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +DROP TABLE t1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +ä 2 +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair Warning Number of rows changed from 2 to 1 +test.t1 repair status OK +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +a OCTET_LENGTH(a) +a 1 +DROP TABLE t1; +# +# End of 10.4 tests +# +# # Start of 10.5 tests # # diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index c27dc97a69f..a875fe51f3a 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -2314,6 +2314,164 @@ VALUES (_latin1 0xDF) UNION VALUES(_utf8'a' COLLATE utf8_bin); --echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-27653 long uniques don't work with unicode collations +--echo # + +SET NAMES utf8mb3; + +# CHAR + +CREATE TABLE t1 ( + a CHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a CHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# VARCHAR + +CREATE TABLE t1 ( + a VARCHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a VARCHAR(30) COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# TEXT + +CREATE TABLE t1 (a TEXT COLLATE utf8mb3_general_ci UNIQUE); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + a LONGTEXT COLLATE utf8mb3_general_ci, + UNIQUE KEY(a(10)) USING HASH +); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('a'); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +SELECT * FROM t1; +DROP TABLE t1; + + +# Testing upgrade: +# Prior to MDEV-27653, the UNIQUE HASH function errorneously +# took into account string octet length. +# Old tables should still open and work, but with wrong results. + +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +CHECK TABLE t1; + +# There is already a one byte value 'a' in the table +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('A'); + +# There is already a two-byte value 'ä' in the table +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('Ä'); + +# There were no three-byte values in the table so far. +# The below value violates UNIQUE, but it gets inserted. +# This is wrong but expected for a pre-MDEV-27653 table. +INSERT INTO t1 VALUES ('Ấ'); +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +CHECK TABLE t1; + +# ALTER FORCE fails: it tries to rebuild the table +# with a correct UNIQUE HASH function, but there are duplicates! +--error ER_DUP_ENTRY +ALTER TABLE t1 FORCE; + +# Let's remove all duplicate values, so only the one-byte 'a' stays. +# ALTER..FORCE should work after that. +DELETE FROM t1 WHERE OCTET_LENGTH(a)>1; +ALTER TABLE t1 FORCE; + +# Make sure that 'a' and 'ä' cannot co-exists any more, +# because the table was recreated with a correct UNIQUE HASH function. +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES ('ä'); +DROP TABLE t1; + +# +# Testing an old table with ALTER IGNORE. +# The table is expected to rebuild with a new hash function, +# duplicates go away. +# +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +ALTER IGNORE TABLE t1 FORCE; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +DROP TABLE t1; + +# +# Testing an old table with REPAIR. +# The table is expected to rebuild with a new hash function, +# duplicates go away. +# +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI $MYSQLD_DATADIR/test/t1.MYI; +SHOW CREATE TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +REPAIR TABLE t1; +SELECT a, OCTET_LENGTH(a) FROM t1 ORDER BY BINARY a; +DROP TABLE t1; + +--echo # +--echo # End of 10.4 tests +--echo # + + +--echo # --echo # Start of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_utf8_uca.result b/mysql-test/main/ctype_utf8_uca.result index 700d4c40193..e31acf8edc4 100644 --- a/mysql-test/main/ctype_utf8_uca.result +++ b/mysql-test/main/ctype_utf8_uca.result @@ -588,6 +588,180 @@ DROP TABLE t1; # End of 10.2 tests # # +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_ci /*Unicode-4.0 folding*/; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A C8BA C8BA Ⱥ +23E C8BE C8BE Ⱦ +23F C8BF C8BF È¿ +240 C980 C980 É€ +250 C990 C990 É +251 C991 C991 É‘ +252 C992 C992 É’ +26B C9AB C9AB É« +271 C9B1 C9B1 ɱ +27D C9BD C9BD ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_520_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_myanmar_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_myanmar_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests +# +# # Start of 10.10 tests # # diff --git a/mysql-test/main/ctype_utf8_uca.test b/mysql-test/main/ctype_utf8_uca.test index 6ac5060a976..946649417ae 100644 --- a/mysql-test/main/ctype_utf8_uca.test +++ b/mysql-test/main/ctype_utf8_uca.test @@ -22,6 +22,35 @@ SET NAMES utf8 COLLATE utf8_unicode_nopad_ci; --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_ci /*Unicode-4.0 folding*/; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_unicode_520_nopad_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_myanmar_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb3 COLLATE utf8mb3_thai_520_w2; +--source include/ctype_casefolding.inc + + +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # Start of 10.10 tests --echo # @@ -47,7 +76,6 @@ SELECT f1(); DROP FUNCTION f1; SET NAMES utf8mb3; - --echo # --echo # End of 10.10 tests --echo # diff --git a/mysql-test/main/ctype_utf8mb4_uca.result b/mysql-test/main/ctype_utf8mb4_uca.result index 658e84fa644..195c47e0360 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.result +++ b/mysql-test/main/ctype_utf8mb4_uca.result @@ -6606,7 +6606,178 @@ SET NAMES utf8mb4; # End of 10.2 tests # # -# End of 10.9 tests +# Start of 10.3 tests +# +# +# MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +# +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci /*Unicode-4.0 folding*/; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A C8BA C8BA Ⱥ +23E C8BE C8BE Ⱦ +23F C8BF C8BF È¿ +240 C980 C980 É€ +250 C990 C990 É +251 C991 C991 É‘ +252 C992 C992 É’ +26B C9AB C9AB É« +271 C9B1 C9B1 ɱ +27D C9BD C9BD ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_myanmar_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +SET NAMES utf8mb4 COLLATE utf8mb4_thai_520_w2; +CREATE OR REPLACE TABLE case_folding AS SELECT 0 AS code, SPACE(32) AS c LIMIT 0; +SHOW CREATE TABLE case_folding; +Table Create Table +case_folding CREATE TABLE `case_folding` ( + `code` int(1) NOT NULL, + `c` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO case_folding (code) VALUES +(0x23A), +(0x23E), +(0x23F), +(0x240), +(0x250), +(0x251), +(0x252), +(0x26B), +(0x271), +(0x27D); +UPDATE case_folding SET c=CHAR(code USING ucs2); +SELECT HEX(code), HEX(LOWER(c)), HEX(UPPER(c)), c FROM case_folding; +HEX(code) HEX(LOWER(c)) HEX(UPPER(c)) c +23A E2B1A5 C8BA Ⱥ +23E E2B1A6 C8BE Ⱦ +23F C8BF E2B1BE È¿ +240 C980 E2B1BF É€ +250 C990 E2B1AF É +251 C991 E2B1AD É‘ +252 C992 E2B1B0 É’ +26B C9AB E2B1A2 É« +271 C9B1 E2B1AE ɱ +27D C9BD E2B1A4 ɽ +DROP TABLE case_folding; +# +# End of 10.3 tests # # # MDEV-27009 Add UCA-14.0.0 collations @@ -11208,5 +11379,5 @@ DROP TABLE t1; DROP PROCEDURE exec_verbose; DROP PROCEDURE test_styles; # -# End of 10.9 tests +# End of 10.10 tests # diff --git a/mysql-test/main/ctype_utf8mb4_uca.test b/mysql-test/main/ctype_utf8mb4_uca.test index 9ef001fd378..b4cfc910336 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.test +++ b/mysql-test/main/ctype_utf8mb4_uca.test @@ -109,8 +109,33 @@ SET NAMES utf8mb4; --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-30556 UPPER() returns an empty string for U+0251 in Unicode-5.2.0+ collations for utf8 +--echo # + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci /*Unicode-4.0 folding*/; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci; +--source include/ctype_casefolding.inc + +SET NAMES utf8mb4 COLLATE utf8mb4_thai_520_w2; +--source include/ctype_casefolding.inc + + --echo # ---echo # End of 10.9 tests +--echo # End of 10.3 tests --echo # --echo # @@ -402,5 +427,5 @@ DROP PROCEDURE exec_verbose; DROP PROCEDURE test_styles; --echo # ---echo # End of 10.9 tests +--echo # End of 10.10 tests --echo # diff --git a/mysql-test/main/debug_sync.result b/mysql-test/main/debug_sync.result index bb9ae1a417d..4c1711a6d6b 100644 --- a/mysql-test/main/debug_sync.result +++ b/mysql-test/main/debug_sync.result @@ -2,7 +2,7 @@ SET DEBUG_SYNC= 'RESET'; DROP TABLE IF EXISTS t1; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2'; SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3'; @@ -150,34 +150,34 @@ SET @myvar= 'now SIGNAL from_myvar'; SET DEBUG_SYNC= @myvar; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_myvar' +debug_sync ON - current signals: 'from_myvar' SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24); SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'from_function' +debug_sync ON - current signals: 'from_myvar,from_function' SET DEBUG_SYNC= 'now SIGNAL something'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'something' +debug_sync ON - current signals: 'something,from_function,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; Warnings: Warning #### debug sync point wait timed out SET DEBUG_SYNC= 'now SIGNAL nothing'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - current signals: 'something,from_function,nothing,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0'; SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 'nothing' +debug_sync ON - current signals: 'something,from_function,from_myvar' SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0'; SET DEBUG_SYNC= 'now HIT_LIMIT 1'; ERROR HY000: debug sync point hit limit reached SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2'; SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2'; SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2'; @@ -190,23 +190,30 @@ SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2'; SET DEBUG_SYNC= 'p4a TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's4' +debug_sync ON - current signals: 's4' SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's1' +debug_sync ON - current signals: 's4,s1' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's7' +debug_sync ON - current signals: 's1,s7,s4' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's9' +debug_sync ON - current signals: 's1,s7,s4,s9' SET DEBUG_SYNC= 'p3abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's1,s3,s4,s9,s7' +SET DEBUG_SYNC= 'now WAIT_FOR s9'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SET DEBUG_SYNC= 'now WAIT_FOR s4'; +SET DEBUG_SYNC= 'now WAIT_FOR s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p1abcd CLEAR'; SET DEBUG_SYNC= 'p2abc CLEAR'; SET DEBUG_SYNC= 'p5abcde CLEAR'; @@ -219,19 +226,19 @@ SET DEBUG_SYNC= 'p7 CLEAR'; SET DEBUG_SYNC= 'p1abcd TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p7 TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: 's3' +debug_sync ON - current signals: 's3' SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' CREATE USER mysqltest_1@localhost; GRANT SUPER ON *.* TO mysqltest_1@localhost; connect con1,localhost,mysqltest_1,,; @@ -292,4 +299,24 @@ disconnect con1; disconnect con2; connection default; DROP TABLE t1; +# +# Test NO_CLEAR_EVENT flag. The signal should still be visible after +# the wait has completed succesfully. +# +SET DEBUG_SYNC= 'now SIGNAL s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's1' +SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's1' +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: '' +SET DEBUG_SYNC= 'now SIGNAL s1,s2,s5,s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +Variable_name Value +debug_sync ON - current signals: 's2,s7,s1,s5' SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/debug_sync.test b/mysql-test/main/debug_sync.test index 89414939f59..6e75ba9624c 100644 --- a/mysql-test/main/debug_sync.test +++ b/mysql-test/main/debug_sync.test @@ -231,15 +231,12 @@ SHOW VARIABLES LIKE 'DEBUG_SYNC'; # immediately after setting of the DEBUG_SYNC variable. # So it is executed before the SET statement ends. # -# NOTE: There is only one global signal (say "signal post" or "flag mast"). -# A SIGNAL action writes its signal into it ("sets a flag"). -# The signal persists until explicitly overwritten. +# NOTE: There can be multiple active signals at the same time. +# A SIGNAL action appends its signal into signals set. +# The signal persists until waited on. # To avoid confusion for later tests, it is recommended to clear -# the signal by signalling "empty" ("setting the 'empty' flag"): -# SET DEBUG_SYNC= 'now SIGNAL empty'; -# Preferably you can reset the whole facility with: +# the signal set by running # SET DEBUG_SYNC= 'RESET'; -# The signal is then '' (really empty) which connot be done otherwise. # # @@ -298,6 +295,16 @@ SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; SET DEBUG_SYNC= 'p3abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; + +# +# Wait for all signals currently active except s3. +# +SET DEBUG_SYNC= 'now WAIT_FOR s9'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SET DEBUG_SYNC= 'now WAIT_FOR s4'; +SET DEBUG_SYNC= 'now WAIT_FOR s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + # # Clear the actions. # @@ -320,7 +327,7 @@ SHOW VARIABLES LIKE 'DEBUG_SYNC'; SET DEBUG_SYNC= 'p9abcdef TEST'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; # -# Now cleanup. Actions are clear already, but signal needs to be cleared. +# Now cleanup. Actions are clear already, but s3 signal needs to be cleared. # SET DEBUG_SYNC= 'RESET'; SHOW VARIABLES LIKE 'DEBUG_SYNC'; @@ -418,10 +425,24 @@ disconnect con2; connection default; DROP TABLE t1; +--echo # +--echo # Test NO_CLEAR_EVENT flag. The signal should still be visible after +--echo # the wait has completed succesfully. +--echo # +SET DEBUG_SYNC= 'now SIGNAL s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +SET DEBUG_SYNC= 'now WAIT_FOR s1 NO_CLEAR_EVENT'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; +SET DEBUG_SYNC= 'now WAIT_FOR s1'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + +SET DEBUG_SYNC= 'now SIGNAL s1,s2,s5,s7'; +SHOW VARIABLES LIKE 'DEBUG_SYNC'; + + # # Cleanup after test case. -# Otherwise signal would contain 'flushed' here, -# which could confuse the next test. +# Otherwise signal would confuse the next test. # SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index 830f60aa3c7..900c14c5578 100644 --- a/mysql-test/main/delete.result +++ b/mysql-test/main/delete.result @@ -532,3 +532,35 @@ DELETE v2 FROM v2; ERROR HY000: Can not delete from join view 'test.v2' DROP VIEW v2, v1; DROP TABLE t1, t2; +End of 5.5 tests +# +# MDEV-30586: DELETE with WHERE containing nested subquery +# with set function aggregated in outer subquery +# +create table t1 (a int); +insert into t1 values (3), (7), (1); +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); +select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +a +7 +delete from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +select * from t1 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +a +update t1 set t1.a=t1.a+10 +where t1.a in (select t3.a from t3 group by t3.a +having t3.a > any (select t2.b from t2 +where t2.b*10 < sum(t3.b))); +drop table t1,t2,t3; +End of 10.4 tests diff --git a/mysql-test/main/delete.test b/mysql-test/main/delete.test index b95919ee4a4..733384193e5 100644 --- a/mysql-test/main/delete.test +++ b/mysql-test/main/delete.test @@ -583,3 +583,44 @@ DELETE v2 FROM v2; DROP VIEW v2, v1; DROP TABLE t1, t2; + +--echo End of 5.5 tests + +--echo # +--echo # MDEV-30586: DELETE with WHERE containing nested subquery +--echo # with set function aggregated in outer subquery +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +create table t2 (b int); +insert into t2 values (2), (1), (4), (7); + +create table t3 (a int, b int); +insert into t3 values (2,10), (7,30), (2,30), (1,10), (7,40); + +let $c= + t1.a in (select t3.a from t3 group by t3.a + having t3.a > any (select t2.b from t2 + where t2.b*10 < sum(t3.b))); + +eval +select * from t1 + where $c; + +eval +delete from t1 + where $c; + +eval +select * from t1 + where $c; + +eval +update t1 set t1.a=t1.a+10 + where $c; + +drop table t1,t2,t3; + +--echo End of 10.4 tests diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index acc52daed43..122c4c08520 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -22509,6 +22509,69 @@ DROP TABLE transaction_items; DROP TABLE transactions; DROP TABLE charges; DROP TABLE ledgers; +# +# MDEV-30081: Splitting from a constant mergeable derived table +# used in inner part of an outer join. +# +CREATE TABLE t1 ( id int PRIMARY KEY ) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(4),(7); +CREATE TABLE t2 ( +id int, id1 int, wid int, PRIMARY KEY (id), KEY (id1), KEY (wid) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,4,6),(7,7,7); +CREATE TABLE t3 ( +wid int, wtid int, otid int, oid int, +PRIMARY KEY (wid), KEY (wtid), KEY (otid), KEY (oid) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6,30,6,6),(7,17,7,7); +CREATE TABLE t4 ( id int, a int, PRIMARY KEY (id), KEY (a) ) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); +CREATE TABLE t5 ( +id int, id1 int, PRIMARY KEY (id), KEY id1 (id1) +) ENGINE=MyISAM ; +INSERT INTO t5 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); +ANALYZE TABLE t1,t2,t3,t4,t5; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +test.t4 analyze status Engine-independent statistics collected +test.t4 analyze status OK +test.t5 analyze status Engine-independent statistics collected +test.t5 analyze status OK +CREATE VIEW v1 AS (SELECT id1 FROM t5 GROUP BY id1); +SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM +t1, t2, t3 +LEFT JOIN +(SELECT t4.* FROM t4 WHERE t4.a=3) dt +ON t3.oid = dt.id AND t3.otid = 14 +LEFT JOIN v1 +ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; +wid wtid otid oid t1_id t2_id id a id1 +7 17 7 7 7 7 NULL NULL NULL +EXPLAIN SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM +t1, t2, t3 +LEFT JOIN +(SELECT t4.* FROM t4 WHERE t4.a=3) dt +ON t3.oid = dt.id AND t3.otid = 14 +LEFT JOIN v1 +ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 const PRIMARY,oid PRIMARY 4 const 1 +1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t4 const PRIMARY,a NULL NULL NULL 0 Impossible ON condition +1 PRIMARY <derived3> ref key0 key0 5 const 0 Using where +3 LATERAL DERIVED t5 ref id1 id1 5 const 0 Using index +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4,t5; # End of 10.3 tests # # MDEV-18679: materialized view with SELECT S containing materialized diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index 2f2e72fb09f..26b44488e1d 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -4071,6 +4071,55 @@ DROP TABLE transactions; DROP TABLE charges; DROP TABLE ledgers; + +--echo # +--echo # MDEV-30081: Splitting from a constant mergeable derived table +--echo # used in inner part of an outer join. +--echo # + + CREATE TABLE t1 ( id int PRIMARY KEY ) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(4),(7); + +CREATE TABLE t2 ( + id int, id1 int, wid int, PRIMARY KEY (id), KEY (id1), KEY (wid) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,4,6),(7,7,7); + +CREATE TABLE t3 ( + wid int, wtid int, otid int, oid int, + PRIMARY KEY (wid), KEY (wtid), KEY (otid), KEY (oid) +) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6,30,6,6),(7,17,7,7); + +CREATE TABLE t4 ( id int, a int, PRIMARY KEY (id), KEY (a) ) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); + +CREATE TABLE t5 ( + id int, id1 int, PRIMARY KEY (id), KEY id1 (id1) +) ENGINE=MyISAM ; +INSERT INTO t5 VALUES (1,17),(2,15),(3,49),(4,3),(5,45),(6,38),(7,17); + +ANALYZE TABLE t1,t2,t3,t4,t5; + +CREATE VIEW v1 AS (SELECT id1 FROM t5 GROUP BY id1); + +let $q= +SELECT t3.*, t1.id AS t1_id, t2.id AS t2_id, dt.*, v1.* +FROM + t1, t2, t3 + LEFT JOIN + (SELECT t4.* FROM t4 WHERE t4.a=3) dt + ON t3.oid = dt.id AND t3.otid = 14 + LEFT JOIN v1 + ON (v1.id1 = dt.a) +WHERE t3.oid = t1.id AND t3.oid = t2.id AND t3.wid = 7; + +eval $q; +eval EXPLAIN $q; + +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4,t5; + --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/empty_table.result b/mysql-test/main/empty_table.result index 2bca3e792fa..90aec2eda3b 100644 --- a/mysql-test/main/empty_table.result +++ b/mysql-test/main/empty_table.result @@ -16,3 +16,61 @@ ERROR 42S02: Table 'test.t2' doesn't exist show status like "Empty_queries"; Variable_name Value Empty_queries 2 +# End of 4.1 tests +# +# MDEV-30333 Wrong result with not_null_range_scan and LEFT JOIN with empty table +# +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (1),(2); +CREATE TABLE t2 (c INT) ENGINE=MyISAM; +SET optimizer_switch= 'not_null_range_scan=off'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` is null order by `test`.`t1`.`b` +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +SET optimizer_switch = 'not_null_range_scan=on'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` is null order by `test`.`t1`.`b` +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +flush tables; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +b +1 +2 +drop table t1,t2; +# Second test in MDEV-30333 +CREATE TABLE t1 (a int, b varchar(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (69,'foo'),(71,'bar'); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (d int, e int, KEY(e)) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +a b c d e +69 foo 1 NULL NULL +71 bar 1 NULL NULL +69 foo 2 NULL NULL +71 bar 2 NULL NULL +SET optimizer_switch = 'not_null_range_scan=on'; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +a b c d e +69 foo 1 NULL NULL +71 bar 1 NULL NULL +69 foo 2 NULL NULL +71 bar 2 NULL NULL +DROP TABLE t1, t2, t3; +set @@optimizer_switch=@save_optimizer_switch; +End of 10.5 tests diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test index 754671868ba..a17b0c897d5 100644 --- a/mysql-test/main/empty_table.test +++ b/mysql-test/main/empty_table.test @@ -21,4 +21,38 @@ drop table t1; select * from t2; show status like "Empty_queries"; -# End of 4.1 tests +--echo # End of 4.1 tests + +--echo # +--echo # MDEV-30333 Wrong result with not_null_range_scan and LEFT JOIN with empty table +--echo # + +set @save_optimizer_switch=@@optimizer_switch; +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES (1),(2); +CREATE TABLE t2 (c INT) ENGINE=MyISAM; +SET optimizer_switch= 'not_null_range_scan=off'; # Default +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SET optimizer_switch = 'not_null_range_scan=on'; +explain extended SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +flush tables; +SELECT b FROM t1 LEFT JOIN t2 ON t2.c = a WHERE a IS NULL ORDER BY b; +drop table t1,t2; + +--echo # Second test in MDEV-30333 + +CREATE TABLE t1 (a int, b varchar(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (69,'foo'),(71,'bar'); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (d int, e int, KEY(e)) ENGINE=MyISAM; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +SET optimizer_switch = 'not_null_range_scan=on'; +SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t3.e = t3.d ON 1; +DROP TABLE t1, t2, t3; +set @@optimizer_switch=@save_optimizer_switch; + +--echo End of 10.5 tests + diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result index dde04bfb05b..1be71f24582 100644 --- a/mysql-test/main/fetch_first.result +++ b/mysql-test/main/fetch_first.result @@ -1432,3 +1432,31 @@ a bar foo DROP TABLE t; +# +# MDEV-30324: Wrong result upon SELECT DISTINCT .. WITH TIES using index +# +CREATE TABLE t1 (a int, b char(3), KEY (a)); +INSERT INTO t1 VALUES (2,'foo'),(3,'bar'),(3,'bar'),(3,'zzz'); +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 1 Using temporary +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +a b +2 foo +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 2 Using temporary +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +a b +2 foo +3 bar +3 zzz +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 5 NULL 3 Using temporary +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +a b +2 foo +3 bar +3 zzz +DROP TABLE t1; diff --git a/mysql-test/main/fetch_first.test b/mysql-test/main/fetch_first.test index 3cec50257fe..1f4b46011b5 100644 --- a/mysql-test/main/fetch_first.test +++ b/mysql-test/main/fetch_first.test @@ -1072,3 +1072,22 @@ SELECT a FROM t ORDER BY a FETCH FIRST 2 ROWS WITH TIES; # Cleanup DROP TABLE t; + +--echo # +--echo # MDEV-30324: Wrong result upon SELECT DISTINCT .. WITH TIES using index +--echo # +CREATE TABLE t1 (a int, b char(3), KEY (a)); +INSERT INTO t1 VALUES (2,'foo'),(3,'bar'),(3,'bar'),(3,'zzz'); + +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 1 ROWS WITH TIES; +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 2 ROWS WITH TIES; +EXPLAIN SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; +--sorted_result +SELECT DISTINCT a, b FROM t1 ORDER BY a FETCH FIRST 3 ROWS WITH TIES; + +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 8456b71c4dc..213cc798a6d 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1623,6 +1623,21 @@ id doc {"$oid":"611c0a463b150154132f6636"} { "_id" : { "$oid" : "611c0a463b150154132f6636" }, "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : 1.0 } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } DROP TABLE arrNestTest; # +# MDEV-30412 JSON_OBJECTAGG doesn't escape double quote in key +# +SELECT JSON_OBJECTAGG('"', 1); +JSON_OBJECTAGG('"', 1) +{"\"":1} +SELECT JSON_OBJECTAGG('\"', 1); +JSON_OBJECTAGG('\"', 1) +{"\"":1} +SELECT JSON_OBJECTAGG('\\', 1); +JSON_OBJECTAGG('\\', 1) +{"\\":1} +# +# End of 10.5 tests +# +# # MDEV-26054 Server crashes in Item_func_json_arrayagg::get_str_from_field # CREATE TABLE t (a VARCHAR(8)); @@ -1649,7 +1664,7 @@ JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, {"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"} DROP TABLE t; # -# End of 10.5 tests +# End of 10.6 tests # # # Beginning of 10.9 tests @@ -2536,9 +2551,6 @@ JSON_EXTRACT(j, '$[*]') [{"key1": 3, "key2": 3}, {"key3": 3, "key4": 3}, {"key5": 3}] DROP TABLE t1; # -# End of 10.9 Test -# -# # MDEV-29381: JSON paths containing dashes are reported as syntax errors in procedures # SELECT JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"'); @@ -2547,3 +2559,6 @@ JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"') SELECT JSON_EXTRACT('{ "my-key": 1 }', '$.my-key'); JSON_EXTRACT('{ "my-key": 1 }', '$.my-key') 1 +# +# End of 10.9 Test +# diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index d00ceeb83e2..93d8c2a7d6a 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1068,6 +1068,18 @@ SELECT * FROM arrNestTest; DROP TABLE arrNestTest; --echo # +--echo # MDEV-30412 JSON_OBJECTAGG doesn't escape double quote in key +--echo # + +SELECT JSON_OBJECTAGG('"', 1); +SELECT JSON_OBJECTAGG('\"', 1); +SELECT JSON_OBJECTAGG('\\', 1); + +--echo # +--echo # End of 10.5 tests +--echo # + +--echo # --echo # MDEV-26054 Server crashes in Item_func_json_arrayagg::get_str_from_field --echo # @@ -1078,7 +1090,6 @@ SELECT JSON_ARRAYAGG(a) AS f FROM v; DROP VIEW v; DROP TABLE t; - --echo # --echo # MDEV-29264 JSON functions overflow error based ON LONGTEXT field --echo # @@ -1090,8 +1101,9 @@ SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJE DROP TABLE t; --echo # ---echo # End of 10.5 tests +--echo # End of 10.6 tests --echo # + --echo # --echo # Beginning of 10.9 tests --echo # @@ -1734,12 +1746,12 @@ SELECT JSON_EXTRACT(j, '$[*]') FROM t1 ; DROP TABLE t1; --echo # ---echo # End of 10.9 Test ---echo # - ---echo # --echo # MDEV-29381: JSON paths containing dashes are reported as syntax errors in procedures --echo # SELECT JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"'); SELECT JSON_EXTRACT('{ "my-key": 1 }', '$.my-key'); + +--echo # +--echo # End of 10.9 Test +--echo # diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 0965ac8a555..eddae76a724 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -1046,7 +1046,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1254,7 +1254,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1517,7 +1517,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1714,7 +1714,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -1911,7 +1911,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -2108,7 +2108,7 @@ Taiwan NULL Tanzania NULL Thailand NULL Czech Republic NULL -Turkey NULL +Türkiye NULL Uganda NULL Ukraine NULL Hungary NULL @@ -2752,7 +2752,7 @@ SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; Name Name Alexandria Egypt -Ankara Turkey +Ankara Türkiye Baghdad Iraq Bangkok Thailand Berlin Germany @@ -2766,7 +2766,7 @@ Delhi India Dhaka Bangladesh Harbin China Ho Chi Minh City Vietnam -Istanbul Turkey +Istanbul Türkiye Jakarta Indonesia Jokohama [Yokohama] Japan Kanton [Guangzhou] China @@ -2809,7 +2809,7 @@ SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; Name Name Alexandria Egypt -Ankara Turkey +Ankara Türkiye Baghdad Iraq Bangkok Thailand Berlin Germany @@ -2823,7 +2823,7 @@ Delhi India Dhaka Bangladesh Harbin China Ho Chi Minh City Vietnam -Istanbul Turkey +Istanbul Türkiye Jakarta Indonesia Jokohama [Yokohama] Japan Kanton [Guangzhou] China diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index 4c2fbcf1dd6..283ea870a5f 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -1,3 +1,6 @@ +# +# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list +# create table t1 (a int, b int, c int, d int, e int); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), @@ -11,6 +14,9 @@ load data infile 'load.data' into table tmp; delete from tmp; drop table t1; drop table tmp; +# +# MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob +# create table t1 (b blob) engine=innodb; alter table t1 add unique (b); alter table t1 force; @@ -21,12 +27,18 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `b` (`b`) USING HASH ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; +# +# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob +# create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam; insert into t1 values (1,'foo'); replace into t1 (pk) values (1); alter table t1 force; replace into t1 (pk) values (1); drop table t1; +# +# MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob +# create table t1 (t time, unique(t)) engine=innodb; insert into t1 values (null),(null); alter ignore table t1 modify t text not null default ''; @@ -34,6 +46,9 @@ Warnings: Warning 1265 Data truncated for column 't' at row 1 Warning 1265 Data truncated for column 't' at row 2 drop table t1; +# +# MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob +# create table t1 ( pk int, f text, primary key (pk), unique(f)) with system versioning; insert into t1 values (1,'foo'); update t1 set f = 'bar'; @@ -50,20 +65,32 @@ pk f row_end > DATE'2030-01-01' 1 foo 0 1 bar 0 drop table t1; +# +# MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob +# create temporary table t1 (f blob, unique(f)) engine=innodb; insert into t1 values (1); replace into t1 values (1); drop table t1; +# +# MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table +# create table t (b blob, unique(b)) engine=myisam; insert into t values ('foo'); replace into t values ('foo'); drop table t; +# +# MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index +# CREATE TABLE t1 (f INT, x BLOB, UNIQUE (x)); INSERT INTO t1 VALUES (1,'foo'); ALTER TABLE t1 DROP x, ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY UPDATE t1 SET x = 'bar'; DROP TABLE t1; +# +# MDEV-18799 Long unique does not work after failed alter table +# create table t1(a blob unique , b blob); insert into t1 values(1,1),(2,1); alter table t1 add unique(b); @@ -86,16 +113,26 @@ Ignored NO insert into t1 values(1,1); ERROR 23000: Duplicate entry '1' for key 'a' DROP TABLE t1; +# +# MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key +# CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=MyISAM; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; +# +# MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in +# row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" +# CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=InnoDB; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; +# +# MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index +# CREATE TEMPORARY TABLE t1 (f BLOB, UNIQUE(f)) ENGINE=InnoDB ROW_FORMAT=COMPACT; ALTER TABLE t1 ADD KEY (f); ERROR HY000: Index column size too large. The maximum column size is 767 bytes @@ -103,17 +140,29 @@ TRUNCATE TABLE t1; SELECT * FROM t1 WHERE f LIKE 'foo'; f DROP TABLE t1; +# +# MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in +# ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key +# CREATE TABLE t1 (a INT, UNIQUE ind USING HASH (a)) ENGINE=InnoDB; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b a INT; Warnings: Note 1054 Unknown column 'b' in 't1' DROP TABLE t1; +# +# MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow +# in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index +# CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; ALTER TABLE t1 DROP x; ERROR 42000: Can't DROP COLUMN `x`; check that it exists SELECT * FROM t1 WHERE f LIKE 'foo'; f DROP TABLE t1; +# +# MDEV-18800 Server crash in instant_alter_column_possible or +# Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key +# CREATE TABLE t1 (pk INT, PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB; show keys from t1;; Table t1 @@ -132,6 +181,9 @@ Index_comment Ignored NO ALTER TABLE t1 ADD INDEX (pk); DROP TABLE t1; +# +# MDEV-18922 Alter on long unique varchar column makes result null +# CREATE TABLE t1 (b int, a varchar(4000)); INSERT INTO t1 VALUES (1, 2),(2,3),(3,4); ALTER TABLE t1 ADD UNIQUE INDEX (a); @@ -146,6 +198,10 @@ a 3 4 drop table t1; +# +# MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags +# & (1<< 30)' failed in setup_keyinfo_hash +# CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; ALTER TABLE t1 DROP KEY f, ADD INDEX idx1(f), ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY @@ -161,6 +217,9 @@ insert into t1 values(1,1); ERROR 23000: Duplicate entry '1-1' for key 'a' alter table t1 add column c int; drop table t1; +# +# MDEV-18889 Long unique on virtual fields crashes server +# create table t1(a blob , b blob as (a) unique); insert into t1 values(1, default); insert into t1 values(1, default); @@ -174,6 +233,9 @@ insert into t1(a,b) values(2,2); insert into t1(a,b) values(2,3); insert into t1(a,b) values(3,2); drop table t1; +# +# MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN +# CREATE TABLE t1 ( a CHAR(128), b CHAR(128) AS (a), @@ -189,6 +251,9 @@ c varchar(5000), UNIQUE(c,b(64)) ) ENGINE=InnoDB; drop table t1; +# +# MDEV-18967 Load data in system version with long unique does not work +# CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -198,6 +263,9 @@ select * from t1; data A DROP TABLE t1; +# +# MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) +# CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -216,12 +284,16 @@ SELECT * FROM t1; data f o +# This should be equivalent to the REPLACE above LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; SELECT * FROM t1; data f o DROP TABLE t1; +# +# MDEV-18953 Hash index on partial char field not working +# create table t1 ( c char(10) character set utf8mb4, unique key a using hash (c(1)) @@ -238,10 +310,16 @@ ERROR 23000: Duplicate entry 'Ð' for key 'a' insert into t1 values ('ббб'); ERROR 23000: Duplicate entry 'Ð' for key 'a' drop table t1; +# +# MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map +# CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (2); REPLACE INTO t1 VALUES (2); DROP TABLE t1; +# +# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' +# set innodb_lock_wait_timeout= 10; CREATE TABLE t1 ( id int primary key, @@ -268,11 +346,20 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction disconnect con1; connection default; DROP TABLE t1, t2; +# +# MDEV-18791 Wrong error upon creating Aria table with long index on BLOB +# CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria; ERROR 42000: Specified key was too long; max key length is 2300 bytes +# +# MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes +# create table t1(a int, unique(a) using hash); #BULK insert > 100 rows (MI_MIN_ROWS_TO_DISABLE_INDEXES) drop table t1; +# +# MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB +# SET binlog_row_image= NOBLOB; CREATE TABLE t1 (pk INT PRIMARY KEY, a text ,UNIQUE(a) using hash); INSERT INTO t1 VALUES (1,'foo'); @@ -280,6 +367,9 @@ create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2))); INSERT INTO t2 VALUES (1, 'foo', default); DROP TABLE t1, t2; SET binlog_row_image= FULL; +# +# MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length +# CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM; show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored @@ -317,6 +407,9 @@ ERROR 23000: Duplicate entry '1' for key 'v2' update t1,t2 set v1 = v2 , v5 = 0; ERROR 23000: Duplicate entry '-128' for key 'v1' drop table t1, t2; +# +# MDEV-23264 Unique blobs allow duplicate values upon UPDATE +# CREATE TABLE t1 (f TEXT UNIQUE); INSERT INTO t1 VALUES (NULL),(NULL); UPDATE t1 SET f = ''; @@ -346,6 +439,18 @@ partition n0 values less than (10), partition n1 values less than (50)); drop table t1; # +# MDEV-29199 Unique hash key is ignored upon INSERT ... SELECT into non-empty MyISAM table +# +create table t1 (a int, b text, unique(b)) engine=MyISAM; +insert into t1 values (0,'aa'); +insert into t1 (a,b) select 1,'xxx' from seq_1_to_5; +ERROR 23000: Duplicate entry 'xxx' for key 'b' +select * from t1; +a b +0 aa +1 xxx +drop table t1; +# # End of 10.4 tests # # diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 8d1accd6cd3..27bb402bd8b 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -1,9 +1,10 @@ --source include/have_innodb.inc --source include/have_partition.inc +--source include/have_sequence.inc -# -# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list -# +--echo # +--echo # MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list +--echo # create table t1 (a int, b int, c int, d int, e int); insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), @@ -20,18 +21,18 @@ drop table t1; --remove_file $datadir/test/load.data drop table tmp; -# -# MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob -# +--echo # +--echo # MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob +--echo # create table t1 (b blob) engine=innodb; alter table t1 add unique (b); alter table t1 force; show create table t1; drop table t1; -# -# MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob -# +--echo # +--echo # MDEV-18713 Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed in test_if_reopen upon REPLACE into table with key on blob +--echo # create table t1 (pk int, b blob, primary key(pk), unique(b)) engine=myisam; insert into t1 values (1,'foo'); replace into t1 (pk) values (1); @@ -39,17 +40,17 @@ alter table t1 force; replace into t1 (pk) values (1); drop table t1; -# -# MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob -# +--echo # +--echo # MDEV-18722 Assertion `templ->mysql_null_bit_mask' failed in row_sel_store_mysql_rec upon modifying indexed column into blob +--echo # create table t1 (t time, unique(t)) engine=innodb; insert into t1 values (null),(null); alter ignore table t1 modify t text not null default ''; drop table t1; -# -# MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob -# +--echo # +--echo # MDEV-18720 Assertion `inited==NONE' failed in ha_index_init upon update on versioned table with key on blob +--echo # create table t1 ( pk int, f text, primary key (pk), unique(f)) with system versioning; insert into t1 values (1,'foo'); update t1 set f = 'bar'; @@ -59,25 +60,25 @@ select * from t1; select pk, f, row_end > DATE'2030-01-01' from t1 for system_time all; drop table t1; -# -# MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob -# +--echo # +--echo # MDEV-18747 InnoDB: Failing assertion: table->get_ref_count() == 0 upon dropping temporary table with unique blob +--echo # create temporary table t1 (f blob, unique(f)) engine=innodb; insert into t1 values (1); replace into t1 values (1); drop table t1; -# -# MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table -# +--echo # +--echo # MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table +--echo # create table t (b blob, unique(b)) engine=myisam; insert into t values ('foo'); replace into t values ('foo'); drop table t; -# -# MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index -# +--echo # +--echo # MDEV-18790 Server crash in fields_in_hash_keyinfo after unsuccessful attempt to drop BLOB with long index +--echo # CREATE TABLE t1 (f INT, x BLOB, UNIQUE (x)); INSERT INTO t1 VALUES (1,'foo'); --error ER_ALTER_OPERATION_NOT_SUPPORTED @@ -85,9 +86,9 @@ ALTER TABLE t1 DROP x, ALGORITHM=INPLACE; UPDATE t1 SET x = 'bar'; DROP TABLE t1; -# -# MDEV-18799 Long unique does not work after failed alter table -# +--echo # +--echo # MDEV-18799 Long unique does not work after failed alter table +--echo # create table t1(a blob unique , b blob); insert into t1 values(1,1),(2,1); --error ER_DUP_ENTRY @@ -97,28 +98,28 @@ alter table t1 add unique(b); insert into t1 values(1,1); DROP TABLE t1; -# -# MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key -# +--echo # +--echo # MDEV-18792 ASAN unknown-crash in _mi_pack_key upon UPDATE after failed ALTER on a table with long BLOB key +--echo # CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=MyISAM; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; -# -# MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in -# row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" -# +--echo # +--echo # MDEV-18793 Assertion `0' failed in row_sel_convert_mysql_key_to_innobase, ASAN unknown-crash in +--echo # row_mysql_store_col_in_innobase_format, warning " InnoDB: Using a partial-field key prefix in search" +--echo # CREATE TABLE t1 (a TEXT, b INT, UNIQUE(a)) ENGINE=InnoDB; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; UPDATE t1 SET b = 0 WHERE a = 'foo'; DROP TABLE t1; -# -# MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index -# +--echo # +--echo # MDEV-18795 InnoDB: Failing assertion: field->prefix_len > 0 upon DML on table with BLOB index +--echo # CREATE TEMPORARY TABLE t1 (f BLOB, UNIQUE(f)) ENGINE=InnoDB ROW_FORMAT=COMPACT; --error ER_INDEX_COLUMN_TOO_LONG ALTER TABLE t1 ADD KEY (f); @@ -126,36 +127,36 @@ TRUNCATE TABLE t1; SELECT * FROM t1 WHERE f LIKE 'foo'; DROP TABLE t1; -# -# MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in -# ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key -# +--echo # +--echo # MDEV-18798 InnoDB: No matching column for `DB_ROW_HASH_1`and server crash in +--echo # ha_innobase::commit_inplace_alter_table upon ALTER on table with UNIQUE key +--echo # CREATE TABLE t1 (a INT, UNIQUE ind USING HASH (a)) ENGINE=InnoDB; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b a INT; DROP TABLE t1; -# -# MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow -# in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index -# +--echo # +--echo # MDEV-18801 InnoDB: Failing assertion: field->col->mtype == type or ASAN heap-buffer-overflow +--echo # in row_sel_convert_mysql_key_to_innobase upon SELECT on table with long index +--echo # CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; --error ER_CANT_DROP_FIELD_OR_KEY ALTER TABLE t1 DROP x; SELECT * FROM t1 WHERE f LIKE 'foo'; DROP TABLE t1; -# -# MDEV-18800 Server crash in instant_alter_column_possible or -# Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key -# +--echo # +--echo # MDEV-18800 Server crash in instant_alter_column_possible or +--echo # Assertion `!pk->has_virtual()' failed in instant_alter_column_possible upon adding key +--echo # CREATE TABLE t1 (pk INT, PRIMARY KEY USING HASH (pk)) ENGINE=InnoDB; --query_vertical show keys from t1; ALTER TABLE t1 ADD INDEX (pk); DROP TABLE t1; -# -# MDEV-18922 Alter on long unique varchar column makes result null -# +--echo # +--echo # MDEV-18922 Alter on long unique varchar column makes result null +--echo # CREATE TABLE t1 (b int, a varchar(4000)); INSERT INTO t1 VALUES (1, 2),(2,3),(3,4); ALTER TABLE t1 ADD UNIQUE INDEX (a); @@ -163,10 +164,10 @@ SELECT * FROM t1; SELECT a FROM t1; drop table t1; -# -# MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags -# & (1<< 30)' failed in setup_keyinfo_hash -# +--echo # +--echo # MDEV-18809 Server crash in fields_in_hash_keyinfo or Assertion `key_info->key_part->field->flags +--echo # & (1<< 30)' failed in setup_keyinfo_hash +--echo # CREATE TABLE t1 (f VARCHAR(4096), UNIQUE(f)) ENGINE=InnoDB; --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 DROP KEY f, ADD INDEX idx1(f), ALGORITHM=INSTANT; @@ -181,9 +182,9 @@ insert into t1 values(1,1); alter table t1 add column c int; drop table t1; -# -# MDEV-18889 Long unique on virtual fields crashes server -# +--echo # +--echo # MDEV-18889 Long unique on virtual fields crashes server +--echo # create table t1(a blob , b blob as (a) unique); insert into t1 values(1, default); --error ER_DUP_ENTRY @@ -199,9 +200,9 @@ insert into t1(a,b) values(2,3); insert into t1(a,b) values(3,2); drop table t1; -# -# MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN -# +--echo # +--echo # MDEV-18888 Server crashes in Item_field::register_field_in_read_map upon MODIFY COLUMN +--echo # CREATE TABLE t1 ( a CHAR(128), b CHAR(128) AS (a), @@ -218,9 +219,9 @@ CREATE TABLE t1 ( ) ENGINE=InnoDB; drop table t1; -# -# MDEV-18967 Load data in system version with long unique does not work -# +--echo # +--echo # MDEV-18967 Load data in system version with long unique does not work +--echo # CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); SELECT * INTO OUTFILE 'load.data' from t1; @@ -231,9 +232,9 @@ DROP TABLE t1; --let $datadir= `select @@datadir` --remove_file $datadir/test/load.data -# -# MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) -# +--echo # +--echo # MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column) +--echo # CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); @@ -245,16 +246,16 @@ ALTER TABLE t1 ADD SYSTEM VERSIONING ; SELECT * FROM t1; REPLACE INTO t1 VALUES ('f'), ('o'), ('o'); SELECT * FROM t1; -# This should be equivalent to the REPLACE above +--echo # This should be equivalent to the REPLACE above LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; SELECT * FROM t1; DROP TABLE t1; --let $datadir= `select @@datadir` --remove_file $datadir/test/load.data -# -# MDEV-18953 Hash index on partial char field not working -# +--echo # +--echo # MDEV-18953 Hash index on partial char field not working +--echo # create table t1 ( c char(10) character set utf8mb4, unique key a using hash (c(1)) @@ -267,17 +268,17 @@ insert into t1 values ('бб'); insert into t1 values ('ббб'); drop table t1; -# -# MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map -# +--echo # +--echo # MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map +--echo # CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (2); REPLACE INTO t1 VALUES (2); DROP TABLE t1; -# -# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' -# +--echo # +--echo # MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key' +--echo # set innodb_lock_wait_timeout= 10; @@ -317,15 +318,15 @@ INSERT IGNORE INTO t1 VALUES (4, 1)/*4*/; --connection default DROP TABLE t1, t2; -# -# MDEV-18791 Wrong error upon creating Aria table with long index on BLOB -# +--echo # +--echo # MDEV-18791 Wrong error upon creating Aria table with long index on BLOB +--echo # --error ER_TOO_LONG_KEY CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria; -# -# MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes -# +--echo # +--echo # MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes +--echo # create table t1(a int, unique(a) using hash); --let $count=150 --let insert_stmt= insert into t1 values(200) @@ -340,9 +341,9 @@ while ($count) --enable_query_log drop table t1; -# -# MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB -# +--echo # +--echo # MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB +--echo # --source include/have_binlog_format_row.inc SET binlog_row_image= NOBLOB; @@ -352,20 +353,17 @@ INSERT INTO t1 VALUES (1,'foo'); create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2))); INSERT INTO t2 VALUES (1, 'foo', default); -# Cleanup DROP TABLE t1, t2; SET binlog_row_image= FULL; -# -# MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length -# +--echo # +--echo # MDEV-22719 Long unique keys are not created when individual key_part->length < max_key_length but SUM(key_parts->length) > max_key_length +--echo # CREATE TABLE t1 (a int, b VARCHAR(1000), UNIQUE (a,b)) ENGINE=MyISAM; show index from t1; CREATE TABLE t2 (a varchar(900), b VARCHAR(900), UNIQUE (a,b)) ENGINE=MyISAM; show index from t2; - -# Cleanup DROP TABLE t1,t2; --echo # @@ -397,9 +395,9 @@ update t1 set v2 = 1, v3 = -128; update t1,t2 set v1 = v2 , v5 = 0; drop table t1, t2; -# -# MDEV-23264 Unique blobs allow duplicate values upon UPDATE -# +--echo # +--echo # MDEV-23264 Unique blobs allow duplicate values upon UPDATE +--echo # CREATE TABLE t1 (f TEXT UNIQUE); INSERT INTO t1 VALUES (NULL),(NULL); @@ -436,6 +434,16 @@ alter table t1 reorganize partition p1 into ( drop table t1; --echo # +--echo # MDEV-29199 Unique hash key is ignored upon INSERT ... SELECT into non-empty MyISAM table +--echo # +create table t1 (a int, b text, unique(b)) engine=MyISAM; +insert into t1 values (0,'aa'); +--error ER_DUP_ENTRY +insert into t1 (a,b) select 1,'xxx' from seq_1_to_5; +select * from t1; +drop table t1; + +--echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index 674dc79fe12..bf011f66be0 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -1269,3 +1269,120 @@ EXPLAIN } } DROP TABLES t1, t2; +# End of 10.3 tests +# +# MDEV-28538: multi-table UPDATE/DELETE with possible exists-to-in +# +create table t1 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t1 values +(1,1,1),(3,2,2),(1,3,3), +(2,1,4),(2,2,5),(4,3,6), +(2,4,7),(2,5,8); +create table t2 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t2 values +(1,7,1),(1,8,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +create table t3 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t3 values +(1,1,1),(1,2,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +insert into t3 select c1+1, c2+2, c3 from t3; +insert into t3 select c1, c2+2, c3 from t3; +analyze table t1,t2,t3 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +explain select * from t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY t2 range idx idx 5 NULL 3 Using index condition; Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 +explain delete from t1 using t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY t2 range idx idx 5 NULL 3 Using where; FirstMatch(t1) +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 Using index +explain update t1,t3 set t1.c1 = t1.c1+10 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL idx NULL NULL NULL 8 Using where +1 PRIMARY t2 range idx idx 5 NULL 3 Using where; FirstMatch(t1) +1 PRIMARY t3 ref idx idx 5 test.t1.c2 3 Using index +create table t as select * from t1; +select * from t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +c1 c2 c3 c1 c2 c3 +2 1 4 1 1 1 +2 1 4 2 1 4 +2 2 5 1 2 2 +2 2 5 2 2 5 +2 4 7 2 4 7 +2 4 7 2 4 2 +2 4 7 3 4 5 +2 4 7 1 4 2 +2 4 7 2 4 5 +2 5 8 2 5 8 +2 5 8 2 5 3 +2 5 8 3 5 6 +2 5 8 1 5 3 +2 5 8 2 5 6 +2 5 8 2 5 1 +2 5 8 3 5 4 +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +2 1 4 +2 2 5 +4 3 6 +2 4 7 +2 5 8 +delete from t1 using t1,t3 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +4 3 6 +truncate table t1; +insert into t1 select * from t; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +update t1,t3 set t1.c1 = t1.c1+10 +where t1.c2 = t3.c2 and +t1.c1 > 1 and +exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); +select * from t1; +c1 c2 c3 +1 1 1 +3 2 2 +1 3 3 +12 1 4 +12 2 5 +4 3 6 +12 4 7 +12 5 8 +drop table t1,t2,t3,t; +# End of 10.4 tests diff --git a/mysql-test/main/multi_update.test b/mysql-test/main/multi_update.test index 6ec3de6a78b..b9ceb458db6 100644 --- a/mysql-test/main/multi_update.test +++ b/mysql-test/main/multi_update.test @@ -1133,3 +1133,73 @@ EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=2 WHERE t2.part=1 AND EXPLAIN FORMAT=JSON UPDATE t2 JOIN t1 USING(a) SET t2.part=3 WHERE t2.part=2 AND t1.part=2; DROP TABLES t1, t2; + +--echo # End of 10.3 tests + +--echo # +--echo # MDEV-28538: multi-table UPDATE/DELETE with possible exists-to-in +--echo # + +create table t1 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t1 values +(1,1,1),(3,2,2),(1,3,3), +(2,1,4),(2,2,5),(4,3,6), +(2,4,7),(2,5,8); + +create table t2 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t2 values +(1,7,1),(1,8,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); + +create table t3 (c1 int, c2 int, c3 int, index idx(c2)); +insert into t3 values +(1,1,1),(1,2,2),(1,3,3), +(2,1,4),(2,2,5),(2,3,6), +(2,4,7),(2,5,8); +insert into t3 select c1+1, c2+2, c3 from t3; +insert into t3 select c1, c2+2, c3 from t3; + +analyze table t1,t2,t3 persistent for all; + +let $c= + t1.c2 = t3.c2 and + t1.c1 > 1 and + exists (select 'X' from t2 where t2.c1 = t1.c1 and t2.c2 > 4); + +let $q1= +select * from t1,t3 +where $c; + +eval explain $q1; + +let $q2= +delete from t1 using t1,t3 +where $c; + +eval explain $q2; + +let $q3= +update t1,t3 set t1.c1 = t1.c1+10 +where $c; + +eval explain $q3; + +create table t as select * from t1; + +eval $q1; +select * from t1; + +eval $q2; +select * from t1; + +truncate table t1; +insert into t1 select * from t; +analyze table t1 persistent for all; + +eval $q3; +select * from t1; + +drop table t1,t2,t3,t; + +--echo # End of 10.4 tests diff --git a/mysql-test/main/select,ps.rdiff b/mysql-test/main/select,ps.rdiff new file mode 100644 index 00000000000..7cbcd2be98e --- /dev/null +++ b/mysql-test/main/select,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select.reject 2023-02-01 13:44:11.026958614 +0100 +@@ -5661,6 +5661,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index bf19d5e9b4e..bdeeb494a14 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -5689,4 +5689,60 @@ EXECUTE stmt; COUNT(DISTINCT a) 3 DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test index 95b66d69255..bc06431a05a 100644 --- a/mysql-test/main/select.test +++ b/mysql-test/main/select.test @@ -3,6 +3,7 @@ # --source include/no_valgrind_without_big.inc +--source include/protocol.inc # # Simple select test @@ -4765,4 +4766,46 @@ EXECUTE stmt; --enable_warnings DROP TABLE t1; +--echo # +--echo # MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +--echo # failed in Item_cond::remove_eq_conds on SELECT +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--echo # Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); + +--enable_prepare_warnings +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +--disable_prepare_warnings + +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +EXECUTE stmt; + +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; + +--echo # Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); + +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +EXECUTE stmt; + +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; + +DROP TABLE t1; +DROP VIEW v1, v2; + --echo End of 10.0 tests diff --git a/mysql-test/main/select_jcl6,ps.rdiff b/mysql-test/main/select_jcl6,ps.rdiff new file mode 100644 index 00000000000..18652a0683b --- /dev/null +++ b/mysql-test/main/select_jcl6,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select_jcl6.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select_jcl6.reject 2023-02-01 13:44:10.722958771 +0100 +@@ -5672,6 +5672,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index 4001a6db81a..791e7983508 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -5700,6 +5700,62 @@ EXECUTE stmt; COUNT(DISTINCT a) 3 DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests set join_cache_level=default; set @@optimizer_switch=@save_optimizer_switch_jcl6; diff --git a/mysql-test/main/select_pkeycache,ps.rdiff b/mysql-test/main/select_pkeycache,ps.rdiff new file mode 100644 index 00000000000..320a402fefc --- /dev/null +++ b/mysql-test/main/select_pkeycache,ps.rdiff @@ -0,0 +1,12 @@ +--- mysql-test/main/select_pkeycache.result 2023-01-31 09:30:58.151377805 +0100 ++++ mysql-test/main/select_pkeycache.reject 2023-02-01 13:43:21.742985365 +0100 +@@ -5661,6 +5661,8 @@ + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1249 Select 2 was reduced during optimization ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 ++Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) + PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; + diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index bf19d5e9b4e..bdeeb494a14 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -5689,4 +5689,60 @@ EXECUTE stmt; COUNT(DISTINCT a) 3 DROP TABLE t1; +# +# MDEV-29294: Assertion `functype() == ((Item_cond *) new_item)->functype()' +# failed in Item_cond::remove_eq_conds on SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Test for nested OR conditions: +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +a +1 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using temporary +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 +Note 1249 Select 2 was reduced during optimization +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and (1 or <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select 3 from DUAL where `test`.`t1`.`a` = `test`.`t1`.`a`)) = 3) +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 AND + (3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = 1 AND +(3 = 0 OR (SELECT a = 1 OR (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v1; +a +1 +# Test for nested AND conditions: +SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +a +1 +PREPARE stmt FROM 'SELECT * FROM t1 WHERE a = 1 OR + (3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3))'; +EXECUTE stmt; +a +1 +EXECUTE stmt; +a +1 +CREATE VIEW v2 AS SELECT * FROM t1 WHERE a = 1 OR +(3 = 3 AND (SELECT a = 1 AND (SELECT 3 WHERE a = a) = 3)); +SELECT * FROM v2; +a +1 +DROP TABLE t1; +DROP VIEW v1, v2; End of 10.0 tests diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 5ecb439bacc..3aa9fd1d306 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1368,7 +1368,7 @@ WORLD CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1439,7 +1439,7 @@ WORLD CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1451,7 +1451,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1530,7 +1530,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index a4cf71f9806..7b7cc86642c 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -1728,7 +1728,7 @@ WORLD CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1799,7 +1799,7 @@ WORLD CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -1811,7 +1811,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 @@ -3529,7 +3529,7 @@ WORLD_INNODB CITY Name A Coruña (La Coruña) Ãœrgenc 0.0000 8.6416 1.0195 WORLD_INNODB CITY Population 42 10500000 0.0000 4.0000 1.0467 WORLD_INNODB COUNTRY Capital 1 4074 0.0293 4.0000 1.0000 WORLD_INNODB COUNTRY Code ABW ZWE 0.0000 3.0000 1.0000 -WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1088 1.0000 +WORLD_INNODB COUNTRY Name Afghanistan Zimbabwe 0.0000 10.1172 1.0000 WORLD_INNODB COUNTRY Population 0 1277558000 0.0000 4.0000 1.0575 WORLD_INNODB COUNTRY SurfaceArea 0.40 17075400.00 0.0000 4.0000 1.0042 WORLD_INNODB COUNTRYLANGUAGE Country ABW ZWE 0.0000 3.0000 4.2232 diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index d69ebf736d2..a64d393ee66 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -1320,6 +1320,28 @@ CASE WHEN a THEN DEFAULT(a) END DROP TABLE t1; SET timestamp=DEFAULT; # +# MDEV-27653 long uniques don't work with unicode collations +# +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +INSERT INTO t1 SELECT MAX(a) FROM t1; +ERROR 23000: Duplicate entry '2001-01-01 11:20:30' for key 'a' +SELECT * FROM t1; +a +2001-01-01 11:20:30 +DROP TABLE t1; +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET time_zone=DEFAULT; +# # End of 10.4 tests # # diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index b5b1fb02f40..8edd52fec2a 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -878,6 +878,27 @@ DROP TABLE t1; SET timestamp=DEFAULT; --echo # +--echo # MDEV-27653 long uniques don't work with unicode collations +--echo # + +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +--error ER_DUP_ENTRY +INSERT INTO t1 SELECT MAX(a) FROM t1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a timestamp, UNIQUE KEY(a) USING HASH); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET time_zone='+01:00'; +CHECK TABLE t1; +DROP TABLE t1; +SET time_zone=DEFAULT; + +--echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/update_use_source.result b/mysql-test/main/update_use_source.result index 91b2f7c8890..d61bff04e0d 100644 --- a/mysql-test/main/update_use_source.result +++ b/mysql-test/main/update_use_source.result @@ -76,7 +76,7 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -2 DEPENDENT SUBQUERY a ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1) start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -317,7 +317,7 @@ rollback; explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index +1 PRIMARY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index; FirstMatch(t1) start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -557,8 +557,8 @@ rollback; # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +1 PRIMARY a index t1_c2 t1_c2 10 NULL 8 Using where; Using index; LooseScan +1 PRIMARY t1 ref t1_c2 t1_c2 5 test.a.c2 1 start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -799,8 +799,8 @@ rollback; # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +1 PRIMARY a index t1_c2 t1_c2 10 NULL 8 Using where; Using index; LooseScan +1 PRIMARY t1 ref t1_c2 t1_c2 5 test.a.c2 1 start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 04fa4c0bf16..e8d24994140 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -4459,6 +4459,46 @@ pk a bit_or DROP TABLE t2; DROP TABLE t1; # +# MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | +# +CREATE TABLE t1 (i1 int, a int); +INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3); +CREATE TABLE t2 (i2 int); +INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3); +SELECT +a, +RANK() OVER (ORDER BY SUM(DISTINCT i1)) +FROM +t1, t2 WHERE t2.i2 = t1.i1 +GROUP BY +a; +a RANK() OVER (ORDER BY SUM(DISTINCT i1)) +1 1 +2 2 +3 3 +DROP TABLE t1, t2; +# +# MDEV-17014: Crash server using ROW_NUMBER() OVER (PARTITION ..) +# +CREATE TABLE t1 (UID BIGINT); +CREATE TABLE t2 (UID BIGINT); +CREATE TABLE t3 (UID BIGINT); +insert into t1 VALUES (1),(2); +insert into t2 VALUES (1),(2); +insert into t3 VALUES (1),(2); +SELECT +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +FROM t1 TT1, +t2 TT2, +t3 TT3 +WHERE TT3.UID = TT1.UID AND TT2.UID = TT3.UID +GROUP BY TT1.UID +; +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +1 +1 +DROP TABLE t1, t2, t3; +# # End of 10.3 tests # # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 56663a0ad88..480eca274cf 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2828,6 +2828,46 @@ DROP TABLE t2; DROP TABLE t1; +--echo # +--echo # MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | +--echo # + +CREATE TABLE t1 (i1 int, a int); +INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3); + +CREATE TABLE t2 (i2 int); +INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3); + +SELECT + a, + RANK() OVER (ORDER BY SUM(DISTINCT i1)) +FROM + t1, t2 WHERE t2.i2 = t1.i1 +GROUP BY + a; + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-17014: Crash server using ROW_NUMBER() OVER (PARTITION ..) +--echo # +CREATE TABLE t1 (UID BIGINT); +CREATE TABLE t2 (UID BIGINT); +CREATE TABLE t3 (UID BIGINT); + +insert into t1 VALUES (1),(2); +insert into t2 VALUES (1),(2); +insert into t3 VALUES (1),(2); +SELECT +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +FROM t1 TT1, + t2 TT2, + t3 TT3 +WHERE TT3.UID = TT1.UID AND TT2.UID = TT3.UID +GROUP BY TT1.UID +; + +DROP TABLE t1, t2, t3; --echo # --echo # End of 10.3 tests diff --git a/mysql-test/main/win_orderby.result b/mysql-test/main/win_orderby.result index bf4a40a4db3..1a9860c1c76 100644 --- a/mysql-test/main/win_orderby.result +++ b/mysql-test/main/win_orderby.result @@ -24,3 +24,66 @@ pk count(a) over (order by pk rows between 2 preceding and 2 following) 28 5 27 5 drop table t0,t1; +# +# MDEV-30052: Crash with a query containing nested WINDOW clauses +# +CREATE TABLE t1 (c INT); +insert into t1 values (1),(2); +UPDATE t1 SET c=1 +WHERE c=2 +ORDER BY +(1 IN (( +SELECT * +FROM (SELECT * FROM t1) AS v1 +GROUP BY c +WINDOW v2 AS (ORDER BY +(SELECT * +FROM t1 +GROUP BY c +WINDOW v3 AS (PARTITION BY c) +) +) +)) +); +drop table t1; +# +# MDEV-29359: Server crashed with heap-use-after-free in +# Field::is_null(long long) const (Just testcase) +# +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (-1),(0),(84); +SELECT +id IN (SELECT id +FROM t1 +WINDOW w AS (ORDER BY (SELECT 1 +FROM t1 +WHERE +EXISTS ( SELECT id +FROM t1 +GROUP BY id +WINDOW w2 AS (ORDER BY id) +) +) +) +) +FROM t1; +id IN (SELECT id +FROM t1 +WINDOW w AS (ORDER BY (SELECT 1 +FROM t1 +WHERE +EXISTS ( SELECT id +FROM t1 +GROUP BY id +WINDOW w2 AS (ORDER BY id) +) +) +) +) +1 +1 +1 +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/win_orderby.test b/mysql-test/main/win_orderby.test index 7f02a582ea0..65421fc095c 100644 --- a/mysql-test/main/win_orderby.test +++ b/mysql-test/main/win_orderby.test @@ -33,3 +33,58 @@ limit 4; --disable_view_protocol drop table t0,t1; + + +--echo # +--echo # MDEV-30052: Crash with a query containing nested WINDOW clauses +--echo # + +CREATE TABLE t1 (c INT); +insert into t1 values (1),(2); +UPDATE t1 SET c=1 +WHERE c=2 +ORDER BY + (1 IN (( + SELECT * + FROM (SELECT * FROM t1) AS v1 + GROUP BY c + WINDOW v2 AS (ORDER BY + (SELECT * + FROM t1 + GROUP BY c + WINDOW v3 AS (PARTITION BY c) + ) + ) + )) + ); +drop table t1; + +--echo # +--echo # MDEV-29359: Server crashed with heap-use-after-free in +--echo # Field::is_null(long long) const (Just testcase) +--echo # + +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (-1),(0),(84); + +SELECT + id IN (SELECT id + FROM t1 + WINDOW w AS (ORDER BY (SELECT 1 + FROM t1 + WHERE + EXISTS ( SELECT id + FROM t1 + GROUP BY id + WINDOW w2 AS (ORDER BY id) + ) + ) + ) + ) +FROM t1; + +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 5ab50a4f88b..65c17801b16 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -145,6 +145,7 @@ my $opt_start_exit; my $start_only; my $file_wsrep_provider; my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far. +my $test_name_for_report; our @global_suppressions; @@ -515,12 +516,9 @@ sub main { } if ( not @$completed ) { - my $test_name= mtr_grab_file($path_testlog); - if (defined($test_name)) + if ($test_name_for_report) { - $test_name =~ s/^CURRENT_TEST:\s//; - chomp($test_name); - my $tinfo = My::Test->new(name => $test_name); + my $tinfo = My::Test->new(name => $test_name_for_report); $tinfo->{result}= 'MTR_RES_FAILED'; $tinfo->{comment}=' '; mtr_report_test($tinfo); @@ -3744,8 +3742,8 @@ sub resfile_report_test ($) { sub run_testcase ($$) { my ($tinfo, $server_socket)= @_; my $print_freq=20; - - mtr_verbose("Running test:", $tinfo->{name}); + $test_name_for_report= $tinfo->{name}; + mtr_verbose("Running test:", $test_name_for_report); $ENV{'MTR_TEST_NAME'} = $tinfo->{name}; resfile_report_test($tinfo) if $opt_resfile; @@ -5134,12 +5132,10 @@ sub mysqld_start ($$) { if (!$rc) { # Report failure about the last test case before exit - my $test_name= mtr_grab_file($path_current_testlog); - $test_name =~ s/^CURRENT_TEST:\s//; - my $tinfo = My::Test->new(name => $test_name); + my $tinfo = My::Test->new(name => $test_name_for_report); $tinfo->{result}= 'MTR_RES_FAILED'; $tinfo->{failures}= 1; - $tinfo->{logfile}=get_log_from_proc($mysqld->{'proc'}, $tinfo->{name}); + $tinfo->{logfile}=get_log_from_proc($mysqld->{'proc'}, $test_name_for_report); report_option('verbose', 1); mtr_report_test($tinfo); } diff --git a/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD Binary files differnew file mode 100644 index 00000000000..5f1ad998c00 --- /dev/null +++ b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYD diff --git a/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI Binary files differnew file mode 100644 index 00000000000..7a748abbae5 --- /dev/null +++ b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.MYI diff --git a/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm Binary files differnew file mode 100644 index 00000000000..5a4cec72324 --- /dev/null +++ b/mysql-test/std_data/mysql_upgrade/mdev27653_100422_myisam_text.frm diff --git a/mysql-test/suite/binlog/r/innodb_rc_insert_before_delete.result b/mysql-test/suite/binlog/r/innodb_rc_insert_before_delete.result new file mode 100644 index 00000000000..d4bd5ee07bf --- /dev/null +++ b/mysql-test/suite/binlog/r/innodb_rc_insert_before_delete.result @@ -0,0 +1,53 @@ +RESET MASTER; +connect pause_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t VALUES (10, 100); +connect con1,localhost,root; +BEGIN; +SELECT * FROM t WHERE sk = 100 FOR UPDATE; +pk sk +10 100 +connect con2,localhost,root; +SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started"; +INSERT INTO t VALUES (5, 100) # trx 1; +connect con3,localhost,root; +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC="now WAIT_FOR insert_wait_started"; +SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting"; +BEGIN; +UPDATE t SET sk = 200 WHERE sk = 100; # trx 2; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting"; +DELETE FROM t WHERE sk=100; +COMMIT; +disconnect con1; +connection con2; +disconnect con2; +connection con3; +must be logged in ROW format as the only event of trx 2 (con3) +INSERT INTO t VALUES (11, 101); +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; DELETE FROM t WHERE sk=100 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5, 100) # trx 1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t VALUES (11, 101) +master-bin.000001 # Table_map # # table_id: # (test.t) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +disconnect con3; +connection default; +SELECT * FROM t; +pk sk +5 100 +11 101 +disconnect pause_purge; +SET DEBUG_SYNC="RESET"; +DROP TABLE t; diff --git a/mysql-test/suite/binlog/t/innodb_rc_insert_before_delete.test b/mysql-test/suite/binlog/t/innodb_rc_insert_before_delete.test new file mode 100644 index 00000000000..228d9778f56 --- /dev/null +++ b/mysql-test/suite/binlog/t/innodb_rc_insert_before_delete.test @@ -0,0 +1,92 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_mixed.inc +--source include/count_sessions.inc + +RESET MASTER; + +# MDEV-30010 merely adds is a Read-Committed version MDEV-30225 test +# solely to prove the RC isolation yields ROW binlog format as it is +# supposed to: +# https://mariadb.com/kb/en/unsafe-statements-for-statement-based-replication/#isolation-levels. +# The original MDEV-30225 test is adapted to the RC to create +# a similar safisticated scenario which does not lead to any deadlock though. + +--connect (pause_purge,localhost,root) +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connection default +CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t VALUES (10, 100); + +--connect (con1,localhost,root) +BEGIN; # trx 0 +SELECT * FROM t WHERE sk = 100 FOR UPDATE; + +--connect (con2,localhost,root) +SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started"; +# trx 1 is locked on try to read the record in secondary index during duplicates +# check. It's the first in waiting queue, that's why it will be woken up firstly +# when trx 0 commits. +--send INSERT INTO t VALUES (5, 100) # trx 1 + +--connect (con3,localhost,root) +SET TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET DEBUG_SYNC="now WAIT_FOR insert_wait_started"; +SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting"; +# trx 2 can delete (5, 100) on master, but not on slave, as on slave trx 1 +# can insert (5, 100) after trx 2 positioned it's cursor. Trx 2 lock is placed +# in waiting queue after trx 1 lock, but its persistent cursor position was +# stored on (100, 10) record in secondary index before suspending. After trx 1 +# is committed, trx 2 will restore persistent cursor position on (100, 10). As +# (100, 5) secondary index record was inserted before (100, 10) in logical +# order, and (100, 10) record is delete-marked, trx 2 just continues scanning. +# +# Note. There can be several records with the same key in unique secondary +# index, but only one of them must be non-delete-marked. That's why when we do +# point query, cursor position is set in the first record in logical order, and +# then records are iterated until either non-delete-marked record is found or +# all records with the same unique fields are iterated. + +# to prepare showing interesting binlog events +--let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) +BEGIN; +--send UPDATE t SET sk = 200 WHERE sk = 100; # trx 2 + +--connection con1 +SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting"; +DELETE FROM t WHERE sk=100; # trx 0 +COMMIT; +--disconnect con1 + +--connection con2 +--reap +--disconnect con2 + +--connection con3 +--error 0 +--reap +if (`SELECT ROW_COUNT() > 0`) +{ + --echo unexpected effective UPDATE + --die +} +--echo must be logged in ROW format as the only event of trx 2 (con3) +INSERT INTO t VALUES (11, 101); +COMMIT; +--source include/show_binlog_events.inc +--disconnect con3 + +--connection default +# If the bug is not fixed, we will see the row inserted by trx 1 here. This can +# cause duplicate key error on slave, when some other trx tries in insert row +# with the same secondary key, as was inserted by trx 1, and not deleted by trx +# 2. +SELECT * FROM t; + +--disconnect pause_purge +SET DEBUG_SYNC="RESET"; +DROP TABLE t; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result index fd6ce1d979a..6482a5d960d 100644 --- a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result +++ b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result @@ -4,6 +4,7 @@ call mtr.add_suppression("InnoDB: Recovery cannot access file"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error\\."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page "); call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9][0-9]*, page number=0\\] of corrupted file '.*test.t[1-5]\\.ibd'"); call mtr.add_suppression("InnoDB: Failed to read page .* from file '.*'"); call mtr.add_suppression("InnoDB: OPT_PAGE_CHECKSUM mismatch"); diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 103d8740087..5654946d786 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -4465,6 +4465,46 @@ pk a bit_or DROP TABLE t2; DROP TABLE t1; # +# MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null | +# +CREATE TABLE t1 (i1 int, a int); +INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3); +CREATE TABLE t2 (i2 int); +INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3); +SELECT +a, +RANK() OVER (ORDER BY SUM(DISTINCT i1)) +FROM +t1, t2 WHERE t2.i2 = t1.i1 +GROUP BY +a; +a RANK() OVER (ORDER BY SUM(DISTINCT i1)) +1 1 +2 2 +3 3 +DROP TABLE t1, t2; +# +# MDEV-17014: Crash server using ROW_NUMBER() OVER (PARTITION ..) +# +CREATE TABLE t1 (UID BIGINT); +CREATE TABLE t2 (UID BIGINT); +CREATE TABLE t3 (UID BIGINT); +insert into t1 VALUES (1),(2); +insert into t2 VALUES (1),(2); +insert into t3 VALUES (1),(2); +SELECT +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +FROM t1 TT1, +t2 TT2, +t3 TT3 +WHERE TT3.UID = TT1.UID AND TT2.UID = TT3.UID +GROUP BY TT1.UID +; +ROW_NUMBER() OVER (PARTITION BY GROUP_CONCAT(TT1.UID)) +1 +1 +DROP TABLE t1, t2, t3; +# # End of 10.3 tests # # diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test index 2624bb6ff9c..1eca1d8cf73 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test +++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test @@ -9,6 +9,7 @@ call mtr.add_suppression("InnoDB: Recovery cannot access file"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error\\."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); +call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page "); call mtr.add_suppression("InnoDB: Cannot apply log to \\[page id: space=[1-9][0-9]*, page number=0\\] of corrupted file '.*test.t[1-5]\\.ibd'"); call mtr.add_suppression("InnoDB: Failed to read page .* from file '.*'"); call mtr.add_suppression("InnoDB: OPT_PAGE_CHECKSUM mismatch"); diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 849dffc7018..bcf6078f624 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,3 +26,4 @@ galera_var_ignore_apply_errors : 28: "Server did not transition to READY state" galera_bf_kill_debug : timeout after 900 seconds galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos' galera_parallel_simple : timeout related to wsrep_sync_wait +galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test diff --git a/mysql-test/suite/galera/r/MDEV-24143.result b/mysql-test/suite/galera/r/MDEV-24143.result deleted file mode 100644 index 860d8a35834..00000000000 --- a/mysql-test/suite/galera/r/MDEV-24143.result +++ /dev/null @@ -1,23 +0,0 @@ -connection node_2; -connection node_1; -CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME); -SELECT get_lock ('test2', 0); -get_lock ('test2', 0) -1 -DROP TABLE t1; -CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1 VALUES (1); -SET SESSION wsrep_trx_fragment_size=10; -SET SESSION autocommit=0; -SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC; -c1 -INSERT INTO t1 VALUES (4),(3),(1),(2); -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE; -ERROR 42S01: Table 't1' already exists -ALTER TABLE t1 DROP COLUMN c2; -ERROR 42000: Can't DROP COLUMN `c2`; check that it exists -SELECT get_lock ('test', 1.5); -get_lock ('test', 1.5) -1 -DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_UK_conflict.result b/mysql-test/suite/galera/r/galera_UK_conflict.result index 402289d7ef8..b0420d58ede 100644 --- a/mysql-test/suite/galera/r/galera_UK_conflict.result +++ b/mysql-test/suite/galera/r/galera_UK_conflict.result @@ -144,7 +144,6 @@ SET debug_sync='RESET'; connection node_1; SET GLOBAL wsrep_slave_threads = DEFAULT; connection node_2; -SET SESSION wsrep_sync_wait=15; SELECT * FROM t1; f1 f2 f3 1 1 0 diff --git a/mysql-test/suite/galera/r/galera_backup_start.result b/mysql-test/suite/galera/r/galera_backup_start.result new file mode 100644 index 00000000000..253a0ce7416 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_backup_start.result @@ -0,0 +1,6 @@ +connection node_2; +connection node_1; +BACKUP STAGE START; +START TRANSACTION; +COMMIT; +BACKUP STAGE END; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result deleted file mode 100644 index 0ef2a1a72c6..00000000000 --- a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result +++ /dev/null @@ -1,18 +0,0 @@ -connection node_2; -connection node_1; -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -connection node_2a; -SELECT GET_LOCK("foo", 1000); -GET_LOCK("foo", 1000) -1 -connection node_2; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT GET_LOCK("foo", 1000);; -connection node_1; -INSERT INTO t1 VALUES (1); -connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -wsrep_local_aborts_increment -1 -DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_locks_funcs.result b/mysql-test/suite/galera/r/galera_locks_funcs.result new file mode 100644 index 00000000000..25d3bbe28f5 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_locks_funcs.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB; +INSERT INTO t values (1,1); +SELECT GET_LOCK('a',1); +ERROR 42000: This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)' +SELECT * FROM t; +c c2 +1 1 +SELECT RELEASE_LOCK('a'); +ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)' +SELECT RELEASE_ALL_LOCKS(); +ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)' +SHOW WARNINGS; +Level Code Message +Error 1235 This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)' +COMMIT; +DROP TABLE t; diff --git a/mysql-test/suite/galera/t/MDEV-24143.test b/mysql-test/suite/galera/t/MDEV-24143.test deleted file mode 100644 index e58f147cb7c..00000000000 --- a/mysql-test/suite/galera/t/MDEV-24143.test +++ /dev/null @@ -1,20 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_sequence.inc - -CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME); -SELECT get_lock ('test2', 0); -DROP TABLE t1; -CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1 VALUES (1); -SET SESSION wsrep_trx_fragment_size=10; -SET SESSION autocommit=0; -SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC; ---error ER_LOCK_DEADLOCK -INSERT INTO t1 VALUES (4),(3),(1),(2); ---error ER_TABLE_EXISTS_ERROR -CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE; ---error ER_CANT_DROP_FIELD_OR_KEY -ALTER TABLE t1 DROP COLUMN c2; -SELECT get_lock ('test', 1.5); -DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_UK_conflict.test b/mysql-test/suite/galera/t/galera_UK_conflict.test index fb4cdb416c3..7a14821cc32 100644 --- a/mysql-test/suite/galera/t/galera_UK_conflict.test +++ b/mysql-test/suite/galera/t/galera_UK_conflict.test @@ -140,6 +140,14 @@ SELECT * FROM t1; # original state in node 1 INSERT INTO t1 VALUES (7,7,7); INSERT INTO t1 VALUES (8,8,8); +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1 +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; DROP TABLE t1; @@ -268,7 +276,6 @@ SET debug_sync='RESET'; SET GLOBAL wsrep_slave_threads = DEFAULT; --connection node_2 -SET SESSION wsrep_sync_wait=15; SELECT * FROM t1; # replicate some transactions, so that wsrep slave thread count can reach @@ -276,4 +283,13 @@ SELECT * FROM t1; INSERT INTO t1 VALUES (7,7,7); INSERT INTO t1 VALUES (8,8,8); +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 7 FROM t1 +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; + DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_backup_start.test b/mysql-test/suite/galera/t/galera_backup_start.test new file mode 100644 index 00000000000..4489e9ff582 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_backup_start.test @@ -0,0 +1,6 @@ +--source include/galera_cluster.inc + +BACKUP STAGE START; +START TRANSACTION; +COMMIT; +BACKUP STAGE END; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test b/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test deleted file mode 100644 index 72fc1c5b583..00000000000 --- a/mysql-test/suite/galera/t/galera_bf_abort_get_lock.test +++ /dev/null @@ -1,36 +0,0 @@ ---source include/galera_cluster.inc ---source include/have_innodb.inc - -# -# Test a local transaction being aborted by a slave one while it is running a GET_LOCK() -# - -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; - ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a -SELECT GET_LOCK("foo", 1000); - ---connection node_2 -SET AUTOCOMMIT=OFF; ---let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` -INSERT INTO t1 VALUES (1); ---send SELECT GET_LOCK("foo", 1000); - ---connection node_1 -INSERT INTO t1 VALUES (1); - ---connection node_2 ---error ER_LOCK_DEADLOCK ---reap - ---let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` - -# Check that wsrep_local_bf_aborts has been incremented by exactly 1 ---disable_query_log ---eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; ---enable_query_log - -DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_bf_kill_debug.test b/mysql-test/suite/galera/t/galera_bf_kill_debug.test index c322f283757..6706734cc36 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill_debug.test +++ b/mysql-test/suite/galera/t/galera_bf_kill_debug.test @@ -84,7 +84,7 @@ SET DEBUG_SYNC = "now SIGNAL continue_kill"; --reap --connection node_2a ---error 0,1213,2013 +--error 0,1213,2013,2026 select * from t1; --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test index 8f0f0ed65ea..214d5166781 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -205,8 +205,3 @@ CALL mtr.add_suppression("conflict state 7 after post commit"); # Warning happens when the cluster is started for the first time CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); - ---connection node_2 -call mtr.add_suppression("Error in Log_event::read_log_event():.*"); -CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); - diff --git a/mysql-test/suite/galera/t/galera_locks_funcs.test b/mysql-test/suite/galera/t/galera_locks_funcs.test new file mode 100644 index 00000000000..42838e9585c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_locks_funcs.test @@ -0,0 +1,18 @@ +--source include/galera_cluster.inc + +CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB; +INSERT INTO t values (1,1); +--error ER_NOT_SUPPORTED_YET +SELECT GET_LOCK('a',1); +SHOW WARNINGS; +SELECT * FROM t; +--error ER_NOT_SUPPORTED_YET +SELECT RELEASE_LOCK('a'); +SHOW WARNINGS; +# New in 10.5 +--error ER_NOT_SUPPORTED_YET +SELECT RELEASE_ALL_LOCKS(); +SHOW WARNINGS; +COMMIT; +DROP TABLE t; + diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test index eefa154a2d9..fb86b69d95a 100644 --- a/mysql-test/suite/galera/t/galera_var_reject_queries.test +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -30,7 +30,7 @@ SELECT * FROM t1; SET GLOBAL wsrep_reject_queries = ALL_KILL; --connection node_1a ---error ER_CONNECTION_KILLED,2013,2006 +--error ER_CONNECTION_KILLED,2013,2006,2026 SELECT * FROM t1; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result index 72ae28e9652..8c9e5966b2e 100644 --- a/mysql-test/suite/innodb/r/alter_copy.result +++ b/mysql-test/suite/innodb/r/alter_copy.result @@ -51,7 +51,7 @@ ADD INDEX(a,b,d), ADD INDEX(a,d,b), ADD INDEX(b,c,d), ADD INDEX(b,d,c), ALGORITHM=COPY; connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; -# restart: --innodb-force-recovery=3 +# restart: --innodb-force-recovery=3 --debug_dbug=+d,recv_ran_out_of_buffer disconnect hang; FTS_INDEX_1.ibd FTS_INDEX_2.ibd diff --git a/mysql-test/suite/innodb/r/innodb_scrub.result b/mysql-test/suite/innodb/r/innodb_scrub.result index 1a4db0b541e..f824a1d0858 100644 --- a/mysql-test/suite/innodb/r/innodb_scrub.result +++ b/mysql-test/suite/innodb/r/innodb_scrub.result @@ -10,3 +10,22 @@ FLUSH TABLE t1 FOR EXPORT; UNLOCK TABLES; NOT FOUND /unicycle|repairman/ in t1.ibd DROP TABLE t1; +# +# MDEV-30527 Assertion !m_freed_pages in mtr_t::start() +# on DROP TEMPORARY TABLE +# +SET @scrub= @@GLOBAL.innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_immediate_scrub_data_uncompressed= 1; +SET @fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +DROP TABLE t; +SET GLOBAL innodb_file_per_table=@fpt; +Warnings: +Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT 1; +DROP TABLE tmp; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED= @scrub; +# End of 10.6 tests diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index 429e0174f9d..eedfb681929 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -405,3 +405,21 @@ nb_corrupted_rows 0 DROP TABLE t1; # End of 10.7 tests +# +# MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) +# during bulk insert +# +CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL, +f3 TEXT NOT NULL, f4 TEXT NOT NULL, +f5 TEXT NOT NULL, f6 TEXT NOT NULL, +PRIMARY KEY(f6(10)))ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES +(repeat('a', 200), repeat('b', 200), repeat('c', 200), +repeat('d', 200), repeat('e', 200), repeat('f', 200)), +(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000), +repeat('e', 12000), repeat('f', 12000), repeat('f', 12000)); +ERROR HY000: Got error 1 "Operation not permitted" during COMMIT +COMMIT; +DROP TABLE t1; +# End of 10.8 tests diff --git a/mysql-test/suite/innodb/r/mdev-14846.result b/mysql-test/suite/innodb/r/mdev-14846.result index b41f6e6bf97..b5d8dcbec19 100644 --- a/mysql-test/suite/innodb/r/mdev-14846.result +++ b/mysql-test/suite/innodb/r/mdev-14846.result @@ -31,6 +31,7 @@ pk f1 f2 f3 3 t q 1 5 z t NULL SET DEBUG_SYNC='now SIGNAL default_dml'; +SET DEBUG_SYNC='now SIGNAL con2_dml'; connection default; SET DEBUG_SYNC='now WAIT_FOR default_dml'; explain UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 IGNORE INDEX (f1) WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'; @@ -40,7 +41,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL # Using where UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 IGNORE INDEX (f1) WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h'; connect con2,localhost,root,,test; -set debug_sync='now WAIT_FOR default_dml'; +set debug_sync='now WAIT_FOR con2_dml'; SET DEBUG_SYNC='now SIGNAL con1_dml2'; disconnect con2; connection con1; diff --git a/mysql-test/suite/innodb/r/purge_thread_shutdown.result b/mysql-test/suite/innodb/r/purge_thread_shutdown.result index 85ac77e6d49..747fe91c966 100644 --- a/mysql-test/suite/innodb/r/purge_thread_shutdown.result +++ b/mysql-test/suite/innodb/r/purge_thread_shutdown.result @@ -22,6 +22,6 @@ delete from t1 where a=3; set global innodb_fast_shutdown=0; ERROR 42000: Variable 'innodb_fast_shutdown' can't be set to the value of '0' kill ID; -ERROR 70100: Connection was killed +Got one of the listed errors # restart drop table t1; diff --git a/mysql-test/suite/innodb/r/recovery_memory.result b/mysql-test/suite/innodb/r/recovery_memory.result index 4fa31009130..9aba9bccdb3 100644 --- a/mysql-test/suite/innodb/r/recovery_memory.result +++ b/mysql-test/suite/innodb/r/recovery_memory.result @@ -1,3 +1,7 @@ +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); CREATE TABLE t1(c TEXT, KEY(c(3072)))ENGINE=InnoDB; CREATE PROCEDURE dorepeat() LOOP @@ -10,3 +14,19 @@ CALL dorepeat(); connection default; # restart: --innodb_buffer_pool_size=5242880 DROP TABLE t1; +DROP PROCEDURE dorepeat; +# +# MDEV-30552 InnoDB recovery crashes when error +# handling scenario +# +SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +# restart: with restart_parameters +# restart +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test index 90f2171d10b..b62f812f4b7 100644 --- a/mysql-test/suite/innodb/t/alter_copy.test +++ b/mysql-test/suite/innodb/t/alter_copy.test @@ -57,7 +57,7 @@ ALTER TABLE t ADD INDEX(b,c,d,a),ADD INDEX(b,c,a,d),ADD INDEX(b,a,c,d),ADD INDEX connection default; SET DEBUG_SYNC='now WAIT_FOR hung'; let $shutdown_timeout=0; ---let $restart_parameters= --innodb-force-recovery=3 +--let $restart_parameters= --innodb-force-recovery=3 --debug_dbug="+d,recv_ran_out_of_buffer" --source include/restart_mysqld.inc disconnect hang; let $shutdown_timeout=; diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test index 0a9839b612a..84977925548 100644 --- a/mysql-test/suite/innodb/t/innodb_bug51920.test +++ b/mysql-test/suite/innodb/t/innodb_bug51920.test @@ -38,7 +38,7 @@ let $wait_condition = # depending on platform. # connection con1; --- error 1317, 2006, 2013, ER_CONNECTION_KILLED +-- error 1317, 2006, 2013, ER_CONNECTION_KILLED, 2026 reap; connection default; DROP TABLE bug51920; diff --git a/mysql-test/suite/innodb/t/innodb_scrub.test b/mysql-test/suite/innodb/t/innodb_scrub.test index c7d06187e9f..8fe460da4d3 100644 --- a/mysql-test/suite/innodb/t/innodb_scrub.test +++ b/mysql-test/suite/innodb/t/innodb_scrub.test @@ -27,3 +27,19 @@ FLUSH TABLE t1 FOR EXPORT; UNLOCK TABLES; -- source include/search_pattern_in_file.inc DROP TABLE t1; + +--echo # +--echo # MDEV-30527 Assertion !m_freed_pages in mtr_t::start() +--echo # on DROP TEMPORARY TABLE +--echo # +SET @scrub= @@GLOBAL.innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_immediate_scrub_data_uncompressed= 1; +SET @fpt=@@GLOBAL.innodb_file_per_table; +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE t ENGINE=InnoDB AS SELECT 1; +DROP TABLE t; +SET GLOBAL innodb_file_per_table=@fpt; +CREATE TEMPORARY TABLE tmp ENGINE=InnoDB AS SELECT 1; +DROP TABLE tmp; +SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED= @scrub; +--echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.opt b/mysql-test/suite/innodb/t/insert_into_empty.opt new file mode 100644 index 00000000000..c856c2d215a --- /dev/null +++ b/mysql-test/suite/innodb/t/insert_into_empty.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=65536 diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 64043e383dc..ee32a2d7cac 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -424,3 +424,22 @@ SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_ DROP TABLE t1; --echo # End of 10.7 tests + +--echo # +--echo # MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) +--echo # during bulk insert +--echo # +CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL, + f3 TEXT NOT NULL, f4 TEXT NOT NULL, + f5 TEXT NOT NULL, f6 TEXT NOT NULL, + PRIMARY KEY(f6(10)))ENGINE=InnoDB; +BEGIN; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 VALUES + (repeat('a', 200), repeat('b', 200), repeat('c', 200), + repeat('d', 200), repeat('e', 200), repeat('f', 200)), + (repeat('b', 20000), repeat('c', 16000), repeat('d', 12000), + repeat('e', 12000), repeat('f', 12000), repeat('f', 12000)); +COMMIT; +DROP TABLE t1; +--echo # End of 10.8 tests diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test index 079a066cec5..a576d244007 100644 --- a/mysql-test/suite/innodb/t/mdev-14846.test +++ b/mysql-test/suite/innodb/t/mdev-14846.test @@ -35,6 +35,7 @@ SET DEBUG_SYNC='now WAIT_FOR con1_dml'; begin; SELECT * FROM t1 for update; # Holds x lock of all records in the table t1 SET DEBUG_SYNC='now SIGNAL default_dml'; +SET DEBUG_SYNC='now SIGNAL con2_dml'; --connection default SET DEBUG_SYNC='now WAIT_FOR default_dml'; @@ -44,7 +45,7 @@ explain UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) # It holds the lock of all record in t3 and tries to acquire record lock for the table t1. --connect (con2,localhost,root,,test) -set debug_sync='now WAIT_FOR default_dml'; +set debug_sync='now WAIT_FOR con2_dml'; let $wait_condition= select count(*) > 0 from information_schema.innodb_lock_waits; --source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/purge_thread_shutdown.test b/mysql-test/suite/innodb/t/purge_thread_shutdown.test index 5be29b7a6a3..447f1fd3804 100644 --- a/mysql-test/suite/innodb/t/purge_thread_shutdown.test +++ b/mysql-test/suite/innodb/t/purge_thread_shutdown.test @@ -36,7 +36,7 @@ set global innodb_fast_shutdown=0; # the error code let $me=`select concat(' ', connection_id())`; replace_result $me ID; -error ER_CONNECTION_KILLED; +error ER_CONNECTION_KILLED, 2026; eval kill $me; source include/start_mysqld.inc; diff --git a/mysql-test/suite/innodb/t/recovery_memory.test b/mysql-test/suite/innodb/t/recovery_memory.test index d9afd52c499..145b39d56f6 100644 --- a/mysql-test/suite/innodb/t/recovery_memory.test +++ b/mysql-test/suite/innodb/t/recovery_memory.test @@ -1,5 +1,11 @@ --source include/have_innodb.inc --source include/big_test.inc +--source include/have_sequence.inc +--source include/maybe_debug.inc +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); CREATE TABLE t1(c TEXT, KEY(c(3072)))ENGINE=InnoDB; DELIMITER |; @@ -19,3 +25,27 @@ let $shutdown_timeout=0; let $restart_parameters=--innodb_buffer_pool_size=5242880; --source include/restart_mysqld.inc DROP TABLE t1; +DROP PROCEDURE dorepeat; + +--echo # +--echo # MDEV-30552 InnoDB recovery crashes when error +--echo # handling scenario +--echo # +if ($have_debug) { +SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug="+d,ibuf_init_corrupt"; +} +if (!$have_debug) { +--echo SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; +let $restart_parameters=--innodb_buffer_pool_size=5242880; +} +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT * FROM seq_1_to_65536; +let $restart_noprint=1; +let $shutdown_timeout=0; +--source include/restart_mysqld.inc +let $restart_noprint=0; +let $restart_parameters=; +--source include/restart_mysqld.inc +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test index 5d7e5d51696..6b2cd6b9b2c 100644 --- a/mysql-test/suite/innodb/t/temporary_table.test +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -143,7 +143,7 @@ let $counter= 5000; let $mysql_errno= 9999; while ($mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013 + --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,2026 select 1; dec $counter; diff --git a/mysql-test/suite/mariabackup/full_backup_win.result b/mysql-test/suite/mariabackup/full_backup_win.result new file mode 100644 index 00000000000..940c7056d3f --- /dev/null +++ b/mysql-test/suite/mariabackup/full_backup_win.result @@ -0,0 +1,12 @@ +# +# MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered' +# +# xtrabackup backup +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/mariabackup/full_backup_win.test b/mysql-test/suite/mariabackup/full_backup_win.test new file mode 100644 index 00000000000..5a1d1c38026 --- /dev/null +++ b/mysql-test/suite/mariabackup/full_backup_win.test @@ -0,0 +1,24 @@ +--source include/windows.inc + +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; + +--echo # +--echo # MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered' +--echo # + +echo # xtrabackup backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb_flush_method=normal --backup --target-dir=$targetdir; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --innodb-flush-method=async_unbuffered --target-dir=$targetdir; +-- source include/restart_and_restore.inc +--enable_result_log + +rmdir $targetdir; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/suite/mariabackup/incremental_drop_db.result b/mysql-test/suite/mariabackup/incremental_drop_db.result new file mode 100644 index 00000000000..3a6c89f8de0 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_drop_db.result @@ -0,0 +1,30 @@ +call mtr.add_suppression("InnoDB: New log files created"); +# +# Start of 10.3 tests +# +# +# MDEV-23335 MariaBackup Incremental Does Not Reflect Dropped/Created Databases +# +CREATE DATABASE db1; +CREATE DATABASE db2; +CREATE TABLE db1.t1 (a INT) ENGINE=MyISAM; +CREATE TABLE db1.t2 (a INT) ENGINE=InnoDB; +# Create base backup +DROP DATABASE db1; +# Create incremental backup +# Remove incremental_dir/db2/db.opt file to make incremental_dir/db2/ empty +# Prepare base backup, apply incremental one +# shutdown server +# remove datadir +# xtrabackup move back +# restart +# Expect no 'db1' in the output, because it was really dropped. +# Expect 'db2' in the ouput, because it was not dropped! +# (its incremental directory was emptied only) +SHOW DATABASES LIKE 'db%'; +Database (db%) +db2 +DROP DATABASE db2; +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/mariabackup/incremental_drop_db.test b/mysql-test/suite/mariabackup/incremental_drop_db.test new file mode 100644 index 00000000000..de270435e9d --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_drop_db.test @@ -0,0 +1,68 @@ +--source include/have_innodb.inc +call mtr.add_suppression("InnoDB: New log files created"); + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-23335 MariaBackup Incremental Does Not Reflect Dropped/Created Databases +--echo # + +--let $datadir=`SELECT @@datadir` +--let $basedir=$MYSQLTEST_VARDIR/tmp/backup +--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1 + +# Create two databases: +# - db1 is dropped normally below +# - db2 is used to cover a corner case: its db.opt file is removed + +# Incremental backup contains: +# - no directory for db1 +# - an empty directory for db2 (after we remove db2/db.opt) + + +CREATE DATABASE db1; +CREATE DATABASE db2; + +# Add some tables to db1 +CREATE TABLE db1.t1 (a INT) ENGINE=MyISAM; +CREATE TABLE db1.t2 (a INT) ENGINE=InnoDB; + +--echo # Create base backup +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir +--enable_result_log + +DROP DATABASE db1; + +--echo # Create incremental backup +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir + +--echo # Remove incremental_dir/db2/db.opt file to make incremental_dir/db2/ empty +--remove_file $incremental_dir/db2/db.opt + + +--echo # Prepare base backup, apply incremental one +--disable_result_log +--exec $XTRABACKUP --prepare --target-dir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir +--enable_result_log + +--let $targetdir=$basedir +--source include/restart_and_restore.inc +--enable_result_log + +--echo # Expect no 'db1' in the output, because it was really dropped. +--echo # Expect 'db2' in the ouput, because it was not dropped! +--echo # (its incremental directory was emptied only) + +SHOW DATABASES LIKE 'db%'; +DROP DATABASE db2; + +--rmdir $basedir +--rmdir $incremental_dir + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/multi_source/gtid.result b/mysql-test/suite/multi_source/gtid.result index dde53ca67b4..6530bb744ac 100644 --- a/mysql-test/suite/multi_source/gtid.result +++ b/mysql-test/suite/multi_source/gtid.result @@ -47,12 +47,8 @@ connection master2; INSERT INTO t2 VALUES (2, "switch1"); INSERT INTO t3 VALUES (202, "switch1 b"); connection slave2; -CHANGE MASTER 'slave1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead -CHANGE MASTER 'slave2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER 'slave1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root'; +CHANGE MASTER 'slave2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root'; SET default_master_connection = 'slave1'; START SLAVE; include/wait_for_slave_to_start.inc @@ -79,9 +75,7 @@ INSERT INTO t3 VALUES (204, "switch 3 b"); connection slave2; include/sync_with_master_gtid.inc connection slave1; -CHANGE MASTER TO master_port=MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO master_port=MYPORT_4, master_host='127.0.0.1', master_user='root'; START SLAVE; SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/multi_source/gtid.test b/mysql-test/suite/multi_source/gtid.test index c81ca20a254..9fc7a66893c 100644 --- a/mysql-test/suite/multi_source/gtid.test +++ b/mysql-test/suite/multi_source/gtid.test @@ -73,9 +73,9 @@ INSERT INTO t3 VALUES (202, "switch1 b"); --connection slave2 --replace_result $SERVER_MYPORT_1 MYPORT_1 -eval CHANGE MASTER 'slave1' TO master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; +eval CHANGE MASTER 'slave1' TO master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root'; --replace_result $SERVER_MYPORT_2 MYPORT_2 -eval CHANGE MASTER 'slave2' TO master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; +eval CHANGE MASTER 'slave2' TO master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root'; SET default_master_connection = 'slave1'; START SLAVE; --source include/wait_for_slave_to_start.inc @@ -125,7 +125,7 @@ INSERT INTO t3 VALUES (204, "switch 3 b"); --connection slave1 --replace_result $SERVER_MYPORT_4 MYPORT_4 -eval CHANGE MASTER TO master_port=$SERVER_MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; +eval CHANGE MASTER TO master_port=$SERVER_MYPORT_4, master_host='127.0.0.1', master_user='root'; START SLAVE; --let $wait_condition= SELECT (SELECT COUNT(*) FROM t1)=3 AND (SELECT COUNT(*) FROM t2)=4 AND (SELECT COUNT(*) FROM t3)=7 --source include/wait_condition.inc diff --git a/mysql-test/suite/plugins/r/locales.result b/mysql-test/suite/plugins/r/locales.result index 2ea88493705..e906d27c21e 100644 --- a/mysql-test/suite/plugins/r/locales.result +++ b/mysql-test/suite/plugins/r/locales.result @@ -1,3 +1,4 @@ +SET names utf8; select * from information_schema.locales; ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOUSAND_SEP ERROR_MESSAGE_LANGUAGE 0 en_US English - United States 9 9 . , english @@ -52,7 +53,7 @@ ID NAME DESCRIPTION MAX_MONTH_NAME_LENGTH MAX_DAY_NAME_LENGTH DECIMAL_POINT THOU 49 ta_IN Tamil - India 10 8 . , english 50 te_IN Telugu - India 10 9 . , english 51 th_TH Thai - Thailand 10 8 . , english -52 tr_TR Turkish - Turkey 7 9 , . english +52 tr_TR Turkish - Türkiye 7 9 , . english 53 uk_UA Ukrainian - Ukraine 8 9 , . ukrainian 54 ur_PK Urdu - Pakistan 6 6 . , english 55 vi_VN Vietnamese - Vietnam 16 11 , . english @@ -165,7 +166,7 @@ Id Name Description Error_Message_Language 49 ta_IN Tamil - India english 50 te_IN Telugu - India english 51 th_TH Thai - Thailand english -52 tr_TR Turkish - Turkey english +52 tr_TR Turkish - Türkiye english 53 uk_UA Ukrainian - Ukraine ukrainian 54 ur_PK Urdu - Pakistan english 55 vi_VN Vietnamese - Vietnam english diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index ae40d54e8df..212f27fdf84 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -521,3 +521,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0 +# +# MDEV-27631 Assertion `global_status_var.global_memory_used == 0' failed in mysqld_exit +# +install plugin server_audit soname 'server_audit'; +uninstall plugin server_audit; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown diff --git a/mysql-test/suite/plugins/t/locales.test b/mysql-test/suite/plugins/t/locales.test index a3afe75046f..2b4d56433d9 100644 --- a/mysql-test/suite/plugins/t/locales.test +++ b/mysql-test/suite/plugins/t/locales.test @@ -2,6 +2,7 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'lo { --skip LOCALES plugin is not active } +SET names utf8; select * from information_schema.locales; show locales; diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 3a78a4049e8..1beeaff7538 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -235,3 +235,8 @@ uninstall plugin server_audit; cat_file $MYSQLD_DATADIR/server_audit.log; remove_file $MYSQLD_DATADIR/server_audit.log; +--echo # +--echo # MDEV-27631 Assertion `global_status_var.global_memory_used == 0' failed in mysqld_exit +--echo # +install plugin server_audit soname 'server_audit'; +uninstall plugin server_audit; diff --git a/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc b/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc new file mode 100644 index 00000000000..74cde5de1db --- /dev/null +++ b/mysql-test/suite/rpl/include/create_or_drop_sync_func.inc @@ -0,0 +1,75 @@ +# Creates or drops a stored function as a part of debug-sync based +# synchronization mechanism between replication servers. +# +# Parameters: +# $create_or_drop= [create] +# $server_master = [master] +# $server_slave = [slave] +if (!$create_or_drop) +{ + --let $create_or_drop=create +} + +if (`select strcmp('$create_or_drop', 'create') = 0`) +{ + if (!$server_master) + { + --let $server_master=master + } + if (!$server_slave) + { + --let $server_slave=slave + } + + --connection $server_master + # Use a stored function to inject a debug_sync into the appropriate THD. + # The function does nothing on the master, and on the slave it injects the + # desired debug_sync action(s). + SET sql_log_bin=0; + --delimiter || + CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END + || + --delimiter ; + SET sql_log_bin=1; + + --connection $server_slave + + SET sql_log_bin=0; + --delimiter || + CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END + || + --delimiter ; +SET sql_log_bin=1; +} + +if (`select strcmp('$create_or_drop', 'drop') = 0`) +{ + if (!$server_slave) + { + --let $server_slave=slave= + } + if (!$server_master) + { + --let $server_master=master + } + --connection $server_slave + SET DEBUG_SYNC='RESET'; + + --connection $server_master + SET DEBUG_SYNC='RESET'; + DROP FUNCTION foo; +} diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result index 9d394a220d5..7cf72ed15e4 100644 --- a/mysql-test/suite/rpl/r/parallel_backup.result +++ b/mysql-test/suite/rpl/r/parallel_backup.result @@ -8,6 +8,8 @@ connection master; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; INSERT INTO t1 VALUES(100); connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); include/stop_slave.inc SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; @@ -31,6 +33,167 @@ connection backup_slave; BACKUP STAGE END; connection slave; include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc connection slave; include/stop_slave.inc SET @@global.slave_parallel_threads= @old_parallel_threads; diff --git a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result new file mode 100644 index 00000000000..b89cb154f24 --- /dev/null +++ b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result @@ -0,0 +1,207 @@ +# Specialized --log-slave-updates = 0 version of parallel_backup test. +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# MDEV-30423: dealock XA COMMIT vs BACKUP +include/master-slave.inc +[connection master] +# +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# replication +# +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; +INSERT INTO t1 VALUES(100); +connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); +include/stop_slave.inc +SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; +connection master; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +connect aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BEGIN; +INSERT INTO t1 VALUES (1); +connection slave; +include/start_slave.inc +connection aux_slave; +connect backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result new file mode 100644 index 00000000000..111bc7fb76f --- /dev/null +++ b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result @@ -0,0 +1,207 @@ +# Specialized --skip-log-bin slave version of parallel_backup test. +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# MDEV-30423: dealock XA COMMIT vs BACKUP +include/master-slave.inc +[connection master] +# +# MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +# replication +# +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; +INSERT INTO t1 VALUES(100); +connection slave; +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); +include/stop_slave.inc +SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; +connection master; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +connect aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BEGIN; +INSERT INTO t1 VALUES (1); +connection slave; +include/start_slave.inc +connection aux_slave; +connect backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +# MDEV-30423: dealock XA COMMIT vs BACKUP +# +# Normal XA COMMIT +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (102); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (101); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (102); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Normal XA ROLLBACK +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (104); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (103); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (104); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +# +# Errored out XA COMMIT +connection slave; +include/stop_slave.inc +Warnings: +Note 1255 Slave already has been stopped +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (106); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (105); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (106); +connection master; +XA COMMIT '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Errored out XA ROLLBACK +connection slave; +include/stop_slave.inc +connection master; +connection aux_slave; +BEGIN; +INSERT INTO t1 VALUES (108); +connection master; +XA START '1'; +INSERT INTO t1 VALUES (107); +XA END '1'; +XA PREPARE '1'; +connection master1; +INSERT INTO t1 VALUES (108); +connection master; +XA ROLLBACK '1'; +include/save_master_gtid.inc +connection slave; +SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; +SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; +SET @@global.innodb_lock_wait_timeout =1; +SET @@global.slave_transaction_retries=0; +include/start_slave.inc +connection aux_slave; +# Xid '1' must be in the output: +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 1 +connection backup_slave; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/stop_slave.inc +SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; +SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result index 96b14bc1d9c..b913a49b509 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result @@ -4,9 +4,7 @@ connection master; SET GLOBAL LOG_WARNINGS=2; connection slave; include/stop_slave.inc -CHANGE MASTER TO MASTER_USE_GTID=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; include/start_slave.inc connection master; "Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')" diff --git a/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result b/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result new file mode 100644 index 00000000000..b00a8a5e1d7 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_delayed_parallel_slave_sbm.result @@ -0,0 +1,72 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +change master to master_delay=3, master_use_gtid=Slave_Pos; +set @@GLOBAL.slave_parallel_threads=2; +include/start_slave.inc +connection master; +create table t1 (a int); +include/sync_slave_sql_with_master.inc +# +# Pt 1) Ensure SBM is updated immediately upon arrival of the next event +# Lock t1 on slave so the first received transaction does not complete/commit +connection slave; +LOCK TABLES t1 WRITE; +connection master; +# Sleep 2 to allow a buffer between events for SBM check +insert into t1 values (0); +include/save_master_gtid.inc +connection slave; +# Waiting for transaction to arrive on slave and begin SQL Delay.. +# Validating SBM is updated on event arrival.. +# ..done +connection slave; +UNLOCK TABLES; +include/sync_with_master_gtid.inc +# +# Pt 2) If the SQL thread has not entered an idle state, ensure +# following events do not update SBM +# Stop slave IO thread so it receives both events together on restart +connection slave; +include/stop_slave_io.inc +connection master; +# Sleep 2 to allow a buffer between events for SBM check +insert into t1 values (1); +# Sleep 3 to create gap between events +insert into t1 values (2); +include/save_master_pos.inc +connection slave; +LOCK TABLES t1 WRITE; +SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event"; +START SLAVE IO_THREAD; +# Before we start processing the events, we ensure both transactions +# were written into the relay log. Otherwise, if the IO thread takes too +# long to queue the events, the sql thread can think it has caught up +# too quickly. +SET DEBUG_SYNC='now WAIT_FOR paused_on_event'; +include/sync_io_with_master.inc +SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; +# Wait for first transaction to complete SQL delay and begin execution.. +# Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle.. +# ..and that SBM wasn't calculated using prior committed transactions +# ..done +connection slave; +UNLOCK TABLES; +# +# Cleanup +# Reset master_delay +include/stop_slave.inc +CHANGE MASTER TO master_delay=0; +set @@GLOBAL.slave_parallel_threads=4; +SET @@global.debug_dbug=""; +SET DEBUG_SYNC='RESET'; +include/start_slave.inc +connection master; +DROP TABLE t1; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/rpl_end.inc +# End of rpl_delayed_parallel_slave_sbm.test diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index fc8e69af861..2f764fe4a0d 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -14,9 +14,7 @@ call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed regis SET sql_log_bin=1; include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; connection server_1; INSERT INTO t1 VALUES (2,1); INSERT INTO t1 VALUES (3,1); diff --git a/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result b/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result index 302bf182ac2..4b2652ece8f 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result @@ -3,9 +3,7 @@ include/master-slave.inc CREATE TABLE t1 (i INT); connection slave; include/stop_slave.inc -CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO MASTER_DELAY= 10; include/start_slave.inc connection master; INSERT INTO t1 VALUES (1); @@ -16,7 +14,7 @@ connection slave; # Asserted this: One row shoule be found in table t1. "======= Clean up ========" STOP SLAVE; -CHANGE MASTER TO MASTER_USE_GTID=no, MASTER_DELAY=0; +CHANGE MASTER TO MASTER_DELAY=0; START SLAVE; connection master; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result index 19229a3c6c2..92430be199a 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result @@ -12,24 +12,12 @@ RETURN s; END| connection server_2; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_3; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_4; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_5; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_1; SET gtid_domain_id= 1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -347,9 +335,7 @@ a b *** Now let the old master join up as slave. *** connection server_1; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -master_user = "root", master_use_gtid = current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +master_user = "root", master_use_gtid = slave_pos, master_demote_to_slave=1; include/start_slave.inc SELECT * FROM t1 ORDER BY a; a @@ -387,8 +373,6 @@ a b connection server_1; include/stop_slave.inc RESET SLAVE ALL; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' connection server_2; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result index e61df488d62..9524dafb524 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result @@ -12,9 +12,7 @@ include/wait_for_slave_to_stop.inc reset slave all; connection server_1; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -master_user='root', MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +master_user='root', MASTER_USE_GTID=SLAVE_POS, master_demote_to_slave=1; include/start_slave.inc include/wait_for_slave_to_start.inc connection server_2; @@ -24,9 +22,7 @@ insert into t1 values (4); flush logs; connection server_3; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc select * from t1 order by n; n @@ -57,20 +53,14 @@ connection server_1; include/stop_slave.inc include/wait_for_slave_to_stop.inc reset slave all; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' connection server_2; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -master_user = 'root', MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +master_user = 'root', MASTER_USE_GTID=SLAVE_POS, master_demote_to_slave=1; include/start_slave.inc connection server_3; include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc connection server_1; drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_misc.result b/mysql-test/suite/rpl/r/rpl_gtid_misc.result index ad77aa2350e..c4a64a13753 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_misc.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_misc.result @@ -9,9 +9,6 @@ include/stop_slave.inc SET sql_log_bin= 0; INSERT INTO t1 VALUES (1); SET sql_log_bin= 1; -CHANGE MASTER TO master_use_gtid= current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection master; CREATE TEMPORARY TABLE t2 LIKE t1; INSERT INTO t2 VALUE (1); diff --git a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result index de5f30696fe..8b896560d39 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result @@ -21,9 +21,7 @@ a b include/stop_slave.inc connection server_1; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT, -master_user = 'root', master_use_gtid = current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +master_user = 'root'; START SLAVE; include/wait_for_slave_to_start.inc connection server_2; @@ -48,16 +46,11 @@ a b 4 2 include/stop_slave.inc RESET SLAVE; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' INSERT INTO t1 VALUES (5, 1); INSERT INTO t1 VALUES (6, 1); include/save_master_gtid.inc connection server_2; -CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -master_use_gtid = current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT; START SLAVE; include/sync_with_master_gtid.inc SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result index 6282e116733..f9d6cd3b743 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result @@ -1,10 +1,4 @@ include/rpl_init.inc [topology=1->2] -connection server_2; -include/stop_slave.inc -CHANGE MASTER TO master_use_gtid= current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead -include/start_slave.inc connection server_1; CREATE TABLE t1 (a INT); FLUSH LOGS; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_sort.result b/mysql-test/suite/rpl/r/rpl_gtid_sort.result index bb1fb28e0e9..46a65e7d865 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_sort.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_sort.result @@ -58,9 +58,7 @@ SHOW VARIABLES LIKE 'gtid_binlog_state'; Variable_name Value gtid_binlog_state CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc SHOW VARIABLES LIKE 'gtid_binlog_pos'; Variable_name Value diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result index 846854f8668..e38eddcc97a 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result @@ -11,9 +11,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; connection server_2; SET GLOBAL gtid_slave_pos=""; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc SELECT * FROM t1; a @@ -35,9 +33,7 @@ master-bin.000003 # connection server_2; SET GLOBAL gtid_slave_pos=""; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; START SLAVE; include/wait_for_slave_io_error.inc [errno=1236] include/stop_slave.inc @@ -59,9 +55,7 @@ include/save_master_gtid.inc connection server_2; SET GLOBAL gtid_slave_pos='0-1-3'; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc include/sync_with_master_gtid.inc SELECT * FROM t1 ORDER by a; @@ -96,16 +90,12 @@ connection server_2; connection server_2; include/stop_slave.inc RESET SLAVE ALL; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' RESET MASTER; connection server_1; RESET MASTER; connection server_2; SET GLOBAL gtid_slave_pos=''; -CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos; include/start_slave.inc connection server_1; CREATE TABLE t1 (a INT PRIMARY KEY); @@ -129,8 +119,6 @@ connection server_2; include/stop_slave.inc DROP TABLE t1; RESET SLAVE; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' SET GLOBAL gtid_slave_pos=""; Warnings: Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos @@ -162,9 +150,7 @@ Using_Gtid = 'No' START SLAVE; include/wait_for_slave_sql_error.inc [errno=1050] STOP SLAVE IO_THREAD; -CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS; include/start_slave.inc connection server_1; INSERT INTO t1 VALUES(3); @@ -223,9 +209,9 @@ include/sync_with_master_gtid.inc SELECT * FROM t1; a 10 -SELECT 'Current_Pos' AS Using_Gtid; +SELECT 'Slave_Pos' AS Using_Gtid; Using_Gtid -Current_Pos +Slave_Pos SELECT '0-1-2' AS Gtid_Slave_Pos; Gtid_Slave_Pos 0-1-2 @@ -252,8 +238,6 @@ connection server_2; include/stop_slave.inc DROP TABLE t1; RESET SLAVE ALL; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' CHANGE MASTER TO MASTER_USE_GTID=NO; RESET MASTER; SET GLOBAL gtid_slave_pos= ""; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result index 2bdfcb14123..ae0050c353a 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result @@ -7,9 +7,6 @@ connection server_2; include/stop_slave.inc Master_Log_File = 'master-bin.000001' Using_Gtid = 'Slave_Pos' -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead FLUSH LOGS; connection server_1; FLUSH LOGS; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result index 85b066608e5..029d2367e50 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_until.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result @@ -29,9 +29,7 @@ ERROR HY000: Slave is already running include/stop_slave_io.inc START SLAVE UNTIL master_gtid_pos = ""; ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +CHANGE MASTER TO master_use_gtid=slave_pos; connection server_1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); @@ -60,7 +58,7 @@ a include/stop_slave.inc START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200,0-1-300"; include/wait_for_slave_to_start.inc -Using_Gtid = 'Current_Pos' +Using_Gtid = 'Slave_Pos' Until_Condition = 'Gtid' connection server_1; INSERT INTO t1 VALUES (3); @@ -205,8 +203,6 @@ include/start_slave.inc connection server_2; include/stop_slave.inc RESET SLAVE ALL; -Warnings: -Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' RESET MASTER; SET GLOBAL gtid_slave_pos=''; connection server_1; @@ -219,9 +215,7 @@ RESET MASTER; INSERT INTO t1 VALUES (10); connection server_2; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -master_user = "root", master_use_gtid = current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead +master_user = "root", master_use_gtid = slave_pos; START SLAVE UNTIL master_gtid_pos = '0-1-2'; include/wait_for_slave_to_start.inc connection server_1; diff --git a/mysql-test/suite/rpl/r/rpl_mdev6386.result b/mysql-test/suite/rpl/r/rpl_mdev6386.result index d62543d8488..63ce594a604 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev6386.result +++ b/mysql-test/suite/rpl/r/rpl_mdev6386.result @@ -10,9 +10,6 @@ SET sql_log_bin= 0; CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); INSERT INTO t1 VALUES (1, 2); SET sql_log_bin= 1; -CHANGE MASTER TO master_use_gtid= current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead Contents on slave before: SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/rpl/r/rpl_parallel_analyze.result b/mysql-test/suite/rpl/r/rpl_parallel_analyze.result new file mode 100644 index 00000000000..c0a2abbc1ee --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_analyze.result @@ -0,0 +1,76 @@ +include/master-slave.inc +[connection master] +# Initialize +connection slave; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +# Setup data +connection master; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE ta (a int); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +connection master; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +RETURN x; +END +|| +SET sql_log_bin=1; +connection slave; +SET sql_log_bin=0; +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) +RETURNS INT DETERMINISTIC +BEGIN +IF d1 != '' THEN +SET debug_sync = d1; +END IF; +IF d2 != '' THEN +SET debug_sync = d2; +END IF; +RETURN x; +END +|| +SET sql_log_bin=1; +include/stop_slave.inc +SET @old_parallel_threads =@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode =@@GLOBAL.slave_parallel_mode; +SET @old_gtid_strict_mode =@@GLOBAL.gtid_strict_mode; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode=conservative; +SET GLOBAL gtid_strict_mode=ON; +include/start_slave.inc +connection master; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format=statement; +INSERT INTO t1 VALUES (foo(1, 'rpl_parallel_after_mark_start_commit WAIT_FOR sig_go', '')); +ANALYZE TABLE ta; +Table Op Msg_type Msg_text +test.ta analyze status Engine-independent statistics collected +test.ta analyze status Table is already up to date +include/save_master_gtid.inc +connection slave; +SELECT info FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"; +info +ANALYZE TABLE ta +set @@debug_sync="now signal sig_go"; +include/sync_with_master_gtid.inc +# Cleanup +connection master; +DROP TABLE t1,ta; +connection slave; +SET DEBUG_SYNC='RESET'; +connection master; +SET DEBUG_SYNC='RESET'; +DROP FUNCTION foo; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads; +SET @@GLOBAL.slave_parallel_mode =@old_parallel_mode; +SET @@GLOBAL.gtid_strict_mode =@old_gtid_strict_mode; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result index ed297d10f2a..2e5ac97bf4d 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result @@ -4,9 +4,6 @@ connection server_2; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; include/stop_slave.inc SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead include/start_slave.inc *** MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication *** connection server_1; diff --git a/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result index 13508815877..ba59650983b 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result @@ -17,16 +17,10 @@ SET GLOBAL binlog_commit_wait_usec=2000000; SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates; SET GLOBAL binlog_direct_non_transactional_updates=OFF; SET SESSION binlog_direct_non_transactional_updates=OFF; -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_3; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; include/stop_slave.inc SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead connection server_1; BEGIN; CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=MEMORY; diff --git a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result index 9519bffaa27..e9bff03bd41 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result @@ -4,9 +4,6 @@ connection server_2; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; include/stop_slave.inc SET GLOBAL slave_parallel_threads=5; -CHANGE MASTER TO master_use_gtid= current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead include/start_slave.inc connection server_1; CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100) CHARACTER SET utf8); diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result index 2c3b694c45d..bf9d9be0ec6 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result @@ -4,9 +4,6 @@ connection master; set global binlog_alter_two_phase=true; connection slave; include/stop_slave.inc -change master to master_use_gtid= current_pos; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead set global gtid_strict_mode=1; # Legacy Master Slave connect master_node,127.0.0.1,root,,$db_name, $M_port; diff --git a/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result b/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result index e58ea5eb0f2..1babddf9a6e 100644 --- a/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result +++ b/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result @@ -3,9 +3,6 @@ include/master-slave.inc *** MDEV-9383: Server fails to read master.info after upgrade 10.0 -> 10.1 *** connection slave; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=CURRENT_POS; -Warnings: -Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead include/rpl_stop_server.inc [server_number=2] include/rpl_start_server.inc [server_number=2] connection master; diff --git a/mysql-test/suite/rpl/t/parallel_backup.test b/mysql-test/suite/rpl/t/parallel_backup.test index 964e2a30309..4f5ffa9f291 100644 --- a/mysql-test/suite/rpl/t/parallel_backup.test +++ b/mysql-test/suite/rpl/t/parallel_backup.test @@ -15,6 +15,9 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb; INSERT INTO t1 VALUES(100); --sync_slave_with_master +call mtr.add_suppression("Deadlock found when trying to get lock"); +call mtr.add_suppression("Commit failed due to failure of an earlier commit"); + --source include/stop_slave.inc SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; @@ -64,6 +67,32 @@ BACKUP STAGE END; --let $diff_tables= master:t1,slave:t1 --source include/diff_tables.inc +# +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +# Prove XA "COMPLETE" 'xid' does not dealock similary to the normal trx case. +# The slave binlog group commit leader is blocked by a local trx like in +# the above normal trx case. +# [Notice a reuse of t1,aux_conn from above.] +# +--let $complete = COMMIT +--source parallel_backup_xa.inc +--let $complete = ROLLBACK +--source parallel_backup_xa.inc + +--let $slave_ooo_error = 1 +--let $complete = COMMIT +--source parallel_backup_xa.inc +--connection slave +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +--let $slave_ooo_error = 1 +--let $complete = ROLLBACK +--source parallel_backup_xa.inc +--connection slave +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + # Clean up. --connection slave diff --git a/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt b/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt new file mode 100644 index 00000000000..2f2a9c436fc --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_lsu_off-slave.opt @@ -0,0 +1,2 @@ +--log-slave-updates=0 + diff --git a/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test b/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test new file mode 100644 index 00000000000..8e2663077b2 --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_lsu_off.test @@ -0,0 +1,7 @@ +# +--echo # Specialized --log-slave-updates = 0 version of parallel_backup test. +# +--echo # MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +--let $rpl_skip_reset_master_and_slave = 1 +--source parallel_backup.test diff --git a/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt new file mode 100644 index 00000000000..a02b6d05829 --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off-slave.opt @@ -0,0 +1 @@ +--skip-log-bin
\ No newline at end of file diff --git a/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test new file mode 100644 index 00000000000..7cefbdb3ddd --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_slave_binlog_off.test @@ -0,0 +1,7 @@ +# +--echo # Specialized --skip-log-bin slave version of parallel_backup test. +# +--echo # MDEV-21953: deadlock between BACKUP STAGE BLOCK_COMMIT and parallel +--echo # MDEV-30423: dealock XA COMMIT vs BACKUP +--let $rpl_server_skip_log_bin= 1 +--source parallel_backup.test diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa.inc b/mysql-test/suite/rpl/t/parallel_backup_xa.inc new file mode 100644 index 00000000000..2d831199aa8 --- /dev/null +++ b/mysql-test/suite/rpl/t/parallel_backup_xa.inc @@ -0,0 +1,79 @@ +# Invoked from parallel_backup.test +# Parameters: +# $complete = COMMIT or ROLLBACK +# $slave_ooo_error = 1 means slave group commit did not succeed +# +--let $kind = Normal +if ($slave_ooo_error) +{ + --let $kind = Errored out +} +--echo # +--echo # $kind XA $complete + +--connection slave +--source include/stop_slave.inc + +--connection master +# val_0 is the first value to insert on master in prepared xa +# val_1 is the next one to insert which is the value to block on slave +--let $val_0 = `SELECT max(a)+1 FROM t1` +--let $val_1 = $val_0 +--inc $val_1 + +--connection aux_slave +BEGIN; +--eval INSERT INTO t1 VALUES ($val_1) + +--connection master +XA START '1'; +--eval INSERT INTO t1 VALUES ($val_0) +XA END '1'; +XA PREPARE '1'; +--connection master1 +--eval INSERT INTO t1 VALUES ($val_1) +--connection master +--eval XA $complete '1' +--source include/save_master_gtid.inc + +--connection slave +if ($slave_ooo_error) +{ + SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; + SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; + SET @@global.innodb_lock_wait_timeout =1; + SET @@global.slave_transaction_retries=0; +} +--source include/start_slave.inc +--connection aux_slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc +--echo # Xid '1' must be in the output: +XA RECOVER; +--connection backup_slave + BACKUP STAGE START; +--send BACKUP STAGE BLOCK_COMMIT +--connection aux_slave + --sleep 1 + if ($slave_ooo_error) + { + --let $wait_condition= SELECT COUNT(*) = 0 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" + --source include/wait_condition.inc + } + ROLLBACK; +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for backup lock" +--source include/wait_condition.inc +--connection backup_slave + --reap + BACKUP STAGE END; +--connection slave +if (!$slave_ooo_error) +{ + --source include/sync_with_master_gtid.inc +} +--source include/stop_slave.inc +if ($slave_ooo_error) +{ + SET @@global.innodb_lock_wait_timeout = @sav_innodb_lock_wait_timeout; + SET @@global.slave_transaction_retries= @sav_slave_transaction_retries; +} diff --git a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test index f26e9565671..bba41295d16 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test @@ -8,7 +8,7 @@ # Steps: # 0 - Have LOG_WARNINGS=2 # 1 - On a fresh slave server which has not replicated any GTIDs execute -# "CHANGE MASTER TO MASTER_USE_GTID=current_pos;" command. Start the +# "CHANGE MASTER TO MASTER_USE_GTID=slave_pos;" command. Start the # slave. # 2 - In Master error log verify that pattern "using_gtid(1), gtid('')" is # present. @@ -43,7 +43,7 @@ SET GLOBAL LOG_WARNINGS=2; --connection slave --source include/stop_slave.inc -CHANGE MASTER TO MASTER_USE_GTID=current_pos; +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; --source include/start_slave.inc --connection master diff --git a/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt new file mode 100644 index 00000000000..9eea6a54b68 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm-slave.opt @@ -0,0 +1 @@ +--slave-parallel-threads=4 diff --git a/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test new file mode 100644 index 00000000000..1ac1bc14468 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_delayed_parallel_slave_sbm.test @@ -0,0 +1,150 @@ +# +# This test ensures that after a delayed parallel slave has idled, i.e. +# executed everything in its relay log, the next event group that the SQL +# thread reads from the relay log will immediately be used in the +# Seconds_Behind_Master. In particular, it ensures that the calculation for +# Seconds_Behind_Master is based on the timestamp of the new transaction, +# rather than the last committed transaction. +# +# References: +# MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel +# Replicas +# + +--source include/master-slave.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--connection slave +--source include/stop_slave.inc +--let $old_debug_dbug= `SELECT @@global.debug_dbug` +--let $master_delay= 3 +--eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos +--let $old_slave_threads= `SELECT @@GLOBAL.slave_parallel_threads` +set @@GLOBAL.slave_parallel_threads=2; +--source include/start_slave.inc + +--connection master +create table t1 (a int); +--source include/sync_slave_sql_with_master.inc + +--echo # +--echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event + +--echo # Lock t1 on slave so the first received transaction does not complete/commit +--connection slave +LOCK TABLES t1 WRITE; + +--connection master +--echo # Sleep 2 to allow a buffer between events for SBM check +sleep 2; + +--let $ts_trx_before_ins= `SELECT UNIX_TIMESTAMP()` +--let insert_ctr= 0 +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--source include/save_master_gtid.inc + +--connection slave + +--echo # Waiting for transaction to arrive on slave and begin SQL Delay.. +--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; +--source include/wait_condition.inc + +--echo # Validating SBM is updated on event arrival.. +--let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) +--let $seconds_since_idling= `SELECT UNIX_TIMESTAMP() - $ts_trx_before_ins` +if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`) +{ + --echo # SBM was $sbm_trx1_arrive yet shouldn't have been larger than $seconds_since_idling + 1 (for possible negative clock_diff_with_master) + --die Seconds_Behind_Master should reset after idling +} +--echo # ..done + +--connection slave +UNLOCK TABLES; +--source include/sync_with_master_gtid.inc + +--echo # +--echo # Pt 2) If the SQL thread has not entered an idle state, ensure +--echo # following events do not update SBM + +--echo # Stop slave IO thread so it receives both events together on restart +--connection slave +--source include/stop_slave_io.inc + +--connection master + +--echo # Sleep 2 to allow a buffer between events for SBM check +sleep 2; +--let $ts_trxpt2_before_ins= `SELECT UNIX_TIMESTAMP()` +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--echo # Sleep 3 to create gap between events +sleep 3; +--eval insert into t1 values ($insert_ctr) +--inc $insert_ctr +--let $ts_trx_after_ins= `SELECT UNIX_TIMESTAMP()` +--source include/save_master_pos.inc + +--connection slave +LOCK TABLES t1 WRITE; + +SET @@global.debug_dbug="+d,pause_sql_thread_on_next_event"; + +START SLAVE IO_THREAD; + +--echo # Before we start processing the events, we ensure both transactions +--echo # were written into the relay log. Otherwise, if the IO thread takes too +--echo # long to queue the events, the sql thread can think it has caught up +--echo # too quickly. +SET DEBUG_SYNC='now WAIT_FOR paused_on_event'; +--source include/sync_io_with_master.inc +SET @@global.debug_dbug="-d,pause_sql_thread_on_next_event"; +SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; + +--echo # Wait for first transaction to complete SQL delay and begin execution.. +--let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker'; +--source include/wait_condition.inc + +--echo # Validate SBM calculation doesn't use the second transaction because SQL thread shouldn't have gone idle.. +--let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) +--let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()` +if (`SELECT $sbm_after_trx_no_idle < $timestamp_trxpt2_arrive - $ts_trx_after_ins`) +{ + --let $cmpv= `SELECT $timestamp_trxpt2_arrive - $ts_trx_after_ins` + --echo # SBM $sbm_after_trx_no_idle was more recent than time since last transaction ($cmpv seconds) + --die Seconds_Behind_Master should not have used second transaction timestamp +} +--let $seconds_since_idling= `SELECT ($timestamp_trxpt2_arrive - $ts_trxpt2_before_ins)` +--echo # ..and that SBM wasn't calculated using prior committed transactions +if (`SELECT $sbm_after_trx_no_idle > ($seconds_since_idling + 1)`) +{ + --echo # SBM was $sbm_after_trx_no_idle yet shouldn't have been larger than $seconds_since_idling + 1 (for possible negative clock_diff_with_master) + --die Seconds_Behind_Master calculation should not have used prior committed transaction +} +--echo # ..done + +--connection slave +UNLOCK TABLES; + +--echo # +--echo # Cleanup + +--echo # Reset master_delay +--source include/stop_slave.inc +--eval CHANGE MASTER TO master_delay=0 +--eval set @@GLOBAL.slave_parallel_threads=$old_slave_threads +--eval SET @@global.debug_dbug="$old_debug_dbug" +SET DEBUG_SYNC='RESET'; +--source include/start_slave.inc + +--connection master +DROP TABLE t1; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source include/rpl_end.inc +--echo # End of rpl_delayed_parallel_slave_sbm.test diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index d0af69a65ed..1249a0f619e 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -27,7 +27,7 @@ SET sql_log_bin=1; --source include/stop_slave.inc --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; --connection server_1 INSERT INTO t1 VALUES (2,1); diff --git a/mysql-test/suite/rpl/t/rpl_gtid_excess_initial_delay.test b/mysql-test/suite/rpl/t/rpl_gtid_excess_initial_delay.test index d840b67e9e8..6b1eec1984b 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_excess_initial_delay.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_excess_initial_delay.test @@ -7,7 +7,7 @@ # # Steps: # 0 - Stop the slave and execute CHANGE MASTER command with -# master_use_gtid= curren_pos and master_delay= 10 +# master_delay= 10 # 1 - On slave introduce a sleep of 15 seconds and check that the # Seconds_Behind_Master is within specified master_delay limit. It should # not be more that "10" seconds. @@ -23,7 +23,7 @@ CREATE TABLE t1 (i INT); --sync_slave_with_master --source include/stop_slave.inc -CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10; +CHANGE MASTER TO MASTER_DELAY= 10; --source include/start_slave.inc --connection master @@ -47,7 +47,7 @@ INSERT INTO t1 VALUES (1); --echo "======= Clean up ========" STOP SLAVE; -CHANGE MASTER TO MASTER_USE_GTID=no, MASTER_DELAY=0; +CHANGE MASTER TO MASTER_DELAY=0; START SLAVE; --connection master diff --git a/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test b/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test index bd5343d7558..064c70b123d 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test @@ -31,22 +31,18 @@ delimiter ;| --connection server_2 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; --connection server_3 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; --connection server_4 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; --connection server_5 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=current_pos; # Create three separate replication streams on master server_1. @@ -225,7 +221,7 @@ SELECT * FROM t4 ORDER BY a,b; --connection server_1 --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - master_user = "root", master_use_gtid = current_pos; + master_user = "root", master_use_gtid = slave_pos, master_demote_to_slave=1; --source include/start_slave.inc --sync_with_master SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test index 01259eb5765..f52e51c2413 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test @@ -24,7 +24,7 @@ reset slave all; connection server_1; --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - master_user='root', MASTER_USE_GTID=CURRENT_POS; + master_user='root', MASTER_USE_GTID=SLAVE_POS, master_demote_to_slave=1; source include/start_slave.inc; source include/wait_for_slave_to_start.inc; @@ -38,7 +38,7 @@ save_master_pos; connection server_3; --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; source include/start_slave.inc; sync_with_master; @@ -56,14 +56,14 @@ reset slave all; connection server_2; --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - master_user = 'root', MASTER_USE_GTID=CURRENT_POS; + master_user = 'root', MASTER_USE_GTID=SLAVE_POS, master_demote_to_slave=1; source include/start_slave.inc; connection server_3; source include/stop_slave.inc; --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; source include/start_slave.inc; connection server_1; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_misc.test b/mysql-test/suite/rpl/t/rpl_gtid_misc.test index 66d98ec8025..a78b74714a5 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_misc.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_misc.test @@ -13,7 +13,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY); SET sql_log_bin= 0; INSERT INTO t1 VALUES (1); SET sql_log_bin= 1; -CHANGE MASTER TO master_use_gtid= current_pos; --connection master diff --git a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test index a5caebf0276..e140f335963 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test @@ -25,7 +25,7 @@ SELECT * FROM t1 ORDER BY a; --connection server_1 --replace_result $SLAVE_MYPORT SLAVE_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT, - master_user = 'root', master_use_gtid = current_pos; + master_user = 'root'; START SLAVE; --source include/wait_for_slave_to_start.inc @@ -49,8 +49,7 @@ INSERT INTO t1 VALUES (6, 1); --connection server_2 --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - master_use_gtid = current_pos; +eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT; START SLAVE; --source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test index bc28ebddf5e..1452d6b01f0 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_reconnect.test @@ -4,11 +4,6 @@ --source include/have_debug.inc ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid= current_pos; ---source include/start_slave.inc - --connection server_1 CREATE TABLE t1 (a INT); FLUSH LOGS; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_sort.test b/mysql-test/suite/rpl/t/rpl_gtid_sort.test index dc3b18aa897..c31ba877bbf 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_sort.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_sort.test @@ -47,7 +47,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_state'; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; --source include/start_slave.inc --sync_with_master SHOW VARIABLES LIKE 'gtid_binlog_pos'; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test index a7c93ff7ed5..c7bcc1bb97e 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test @@ -19,7 +19,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; SET GLOBAL gtid_slave_pos=""; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; --source include/start_slave.inc --sync_with_master SELECT * FROM t1; @@ -46,7 +46,7 @@ INSERT INTO t1 VALUES (2); SET GLOBAL gtid_slave_pos=""; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; START SLAVE; --let $slave_io_errno= 1236 --source include/wait_for_slave_io_error.inc @@ -73,7 +73,7 @@ INSERT INTO t1 VALUES(3); SET GLOBAL gtid_slave_pos='0-1-3'; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=CURRENT_POS; + MASTER_USE_GTID=SLAVE_POS; --source include/start_slave.inc --source include/sync_with_master_gtid.inc SELECT * FROM t1 ORDER by a; @@ -118,7 +118,7 @@ RESET MASTER; --connection server_2 SET GLOBAL gtid_slave_pos=''; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=current_pos; +eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos; --source include/start_slave.inc --connection server_1 @@ -199,7 +199,7 @@ START SLAVE; # Going back to using GTID should fix things. STOP SLAVE IO_THREAD; -CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS; +CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS; --source include/start_slave.inc --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index 2cf184a3401..7fb457f6d7f 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -21,7 +21,6 @@ INSERT INTO t1 VALUES (1); --let $status_items= Master_Log_File,Using_Gtid --source include/show_slave_status.inc -CHANGE MASTER TO master_use_gtid=current_pos; # Now try to restart the slave mysqld server without starting the slave first # threads after the CHANGE MASTER. diff --git a/mysql-test/suite/rpl/t/rpl_gtid_until.test b/mysql-test/suite/rpl/t/rpl_gtid_until.test index 49baf7e68e6..c89cea23e93 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_until.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_until.test @@ -45,7 +45,7 @@ START SLAVE UNTIL master_gtid_pos = ""; --error ER_UNTIL_REQUIRES_USING_GTID START SLAVE UNTIL master_gtid_pos = ""; -CHANGE MASTER TO master_use_gtid=current_pos; +CHANGE MASTER TO master_use_gtid=slave_pos; --connection server_1 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -224,7 +224,7 @@ INSERT INTO t1 VALUES (10); --connection server_2 --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - master_user = "root", master_use_gtid = current_pos; + master_user = "root", master_use_gtid = slave_pos; eval START SLAVE UNTIL master_gtid_pos = '$until_condition'; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_mdev6386.test b/mysql-test/suite/rpl/t/rpl_mdev6386.test index e6fb72dc788..f969d656ffb 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev6386.test +++ b/mysql-test/suite/rpl/t/rpl_mdev6386.test @@ -13,7 +13,6 @@ SET sql_log_bin= 0; CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); INSERT INTO t1 VALUES (1, 2); SET sql_log_bin= 1; -CHANGE MASTER TO master_use_gtid= current_pos; --echo Contents on slave before: SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_analyze.test b/mysql-test/suite/rpl/t/rpl_parallel_analyze.test new file mode 100644 index 00000000000..921c6f02904 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_analyze.test @@ -0,0 +1,84 @@ +# The test file is created to prove fixes to +# MDEV-30323 Some DDLs like ANALYZE can complete on parallel slave out of order +# Debug-sync tests aiming at parallel replication of ADMIN commands +# are welcome here. + +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--echo # Initialize +--connection slave +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; + +--echo # Setup data +--connection master +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE ta (a int); +--let $pre_load_gtid=`SELECT @@last_gtid` +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source suite/rpl/include/create_or_drop_sync_func.inc + +# configure MDEV-30323 slave +--source include/stop_slave.inc +SET @old_parallel_threads =@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode =@@GLOBAL.slave_parallel_mode; +SET @old_gtid_strict_mode =@@GLOBAL.gtid_strict_mode; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode=conservative; +SET GLOBAL gtid_strict_mode=ON; +--source include/start_slave.inc + +# MDEV-30323 setup needs two group of events the first of which is a DML +# and ANALYZE is the 2nd. +# The latter is made to race in slave execution over the DML thanks +# to a DML latency simulation. +# In the fixed case the race-over should not be a problem: ultimately +# ANALYZE must wait for its turn to update slave@@global.gtid_binlog_pos. +# Otherwise the reported OOO error must be issued. + +--connection master +SET @old_format= @@SESSION.binlog_format; +SET binlog_format=statement; +INSERT INTO t1 VALUES (foo(1, 'rpl_parallel_after_mark_start_commit WAIT_FOR sig_go', '')); + +ANALYZE TABLE ta; +--source include/save_master_gtid.inc + +--connection slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +SELECT info FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit"; +if (`select strcmp(@@global.gtid_binlog_pos, '$pre_load_gtid') <> 0 or strcmp(@@global.gtid_slave_pos, '$pre_load_gtid') <> 0`) +{ + --let $bs=`SELECT @@global.gtid_binlog_pos` + --let $es=`SELECT @@global.gtid_slave_pos` + --echo Mismatch between expected $pre_load_gtid state and the actual binlog state " @@global.gtid_binlog_pos = $bs or/and slave execution state @@global.gtid_slave_pos = $es. + --die +} + +set @@debug_sync="now signal sig_go"; +--source include/sync_with_master_gtid.inc + +--echo # Cleanup +--connection master +DROP TABLE t1,ta; +--let $create_or_drop=drop +--source suite/rpl/include/create_or_drop_sync_func.inc + +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @@GLOBAL.slave_parallel_threads=@old_parallel_threads; +SET @@GLOBAL.slave_parallel_mode =@old_parallel_mode; +SET @@GLOBAL.gtid_strict_mode =@old_gtid_strict_mode; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test b/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test index 981c6216376..3a5af7bd4a9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_mdev6589.test @@ -7,7 +7,6 @@ SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=current_pos; --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test index 4125394ef80..da8a996f570 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_multilevel2.test @@ -25,7 +25,6 @@ SET GLOBAL binlog_commit_wait_usec=2000000; SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates; SET GLOBAL binlog_direct_non_transactional_updates=OFF; SET SESSION binlog_direct_non_transactional_updates=OFF; -CHANGE MASTER TO master_use_gtid=current_pos; --connection server_3 --sync_with_master @@ -33,7 +32,6 @@ CHANGE MASTER TO master_use_gtid=current_pos; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=current_pos; --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test index edb854842e1..3684763dad7 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test @@ -12,7 +12,6 @@ SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=5; -CHANGE MASTER TO master_use_gtid= current_pos; --source include/start_slave.inc --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test index 5c78eb290c8..f655d3c10ba 100644 --- a/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test +++ b/mysql-test/suite/rpl/t/rpl_start_alter_mysqlbinlog_1.test @@ -1,6 +1,6 @@ # # Start Alter with binlog applied using mysqlbinlog -# single maser with only one domain id +# single master with only one domain id # --source include/have_innodb.inc --source include/have_debug.inc @@ -10,7 +10,6 @@ set global binlog_alter_two_phase=true; --connection slave --source include/stop_slave.inc -change master to master_use_gtid= current_pos; set global gtid_strict_mode=1; --echo # Legacy Master Slave diff --git a/mysql-test/suite/rpl/t/rpl_upgrade_master_info.test b/mysql-test/suite/rpl/t/rpl_upgrade_master_info.test index 42b375c4579..fb0e3cf48f7 100644 --- a/mysql-test/suite/rpl/t/rpl_upgrade_master_info.test +++ b/mysql-test/suite/rpl/t/rpl_upgrade_master_info.test @@ -4,7 +4,6 @@ --connection slave --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=CURRENT_POS; --let $datadir= `SELECT @@datadir` --let $rpl_server_number= 2 diff --git a/mysql-test/suite/stress/r/deadlock_drop_table.result b/mysql-test/suite/stress/r/deadlock_drop_table.result index 326f694e8d9..7e549157c81 100644 --- a/mysql-test/suite/stress/r/deadlock_drop_table.result +++ b/mysql-test/suite/stress/r/deadlock_drop_table.result @@ -19,11 +19,12 @@ a b c 1 NULL NULL set debug_sync='now SIGNAL go'; set debug_sync='now WAIT_FOR parked2'; -set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; drop table t1;; connection con2; set debug_sync='now WAIT_FOR waiting'; set debug_sync='now SIGNAL go2'; +set debug_sync='now SIGNAL go3'; connection default; connection con1; connection default; diff --git a/mysql-test/suite/stress/t/deadlock_drop_table.test b/mysql-test/suite/stress/t/deadlock_drop_table.test index 0ec19f87389..b4f8f2201e0 100644 --- a/mysql-test/suite/stress/t/deadlock_drop_table.test +++ b/mysql-test/suite/stress/t/deadlock_drop_table.test @@ -20,15 +20,12 @@ set debug_sync='now WAIT_FOR parked'; select * from t1; set debug_sync='now SIGNAL go'; set debug_sync='now WAIT_FOR parked2'; -set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go2'; +set debug_sync='before_wait_for_refs SIGNAL waiting WAIT_FOR go3'; --send drop table t1; --connection con2 set debug_sync='now WAIT_FOR waiting'; set debug_sync='now SIGNAL go2'; - -# Write out show processlist if the debug sync point times out -let $wait_condition= select count(*)=0 from information_schema.processlist where state like "%debug%"; -source include/wait_condition.inc; +set debug_sync='now SIGNAL go3'; --connection default --reap diff --git a/mysql-test/suite/sys_vars/r/debug_sync_basic.result b/mysql-test/suite/sys_vars/r/debug_sync_basic.result index 6ebb46dd662..11506cac2c2 100644 --- a/mysql-test/suite/sys_vars/r/debug_sync_basic.result +++ b/mysql-test/suite/sys_vars/r/debug_sync_basic.result @@ -2,17 +2,17 @@ select @@global.debug_sync; ERROR HY000: Variable 'debug_sync' is a SESSION variable select @@session.debug_sync; @@session.debug_sync -ON - current signal: '' +ON - current signals: '' show global variables like "debug_sync"; Variable_name Value show session variables like "debug_sync"; Variable_name Value -debug_sync ON - current signal: '' +debug_sync ON - current signals: '' select * from information_schema.global_variables where variable_name="debug_sync"; VARIABLE_NAME VARIABLE_VALUE select * from information_schema.session_variables where variable_name="debug_sync"; VARIABLE_NAME VARIABLE_VALUE -DEBUG_SYNC ON - current signal: '' +DEBUG_SYNC ON - current signals: '' set @@session.debug_sync=1; ERROR 42000: Incorrect argument type to variable 'debug_sync' set @@session.debug_sync=1.1; diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug.result b/mysql-test/suite/sys_vars/r/sysvars_debug.result index 0d77b0211a1..fc04ac83210 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_debug.result +++ b/mysql-test/suite/sys_vars/r/sysvars_debug.result @@ -77,7 +77,7 @@ READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL GLOBAL_VALUE_PATH NULL VARIABLE_NAME DEBUG_SYNC -SESSION_VALUE ON - current signal: '' +SESSION_VALUE ON - current signals: '' GLOBAL_VALUE NULL GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test index 5c343cee9ab..1de4ae88cfb 100644 --- a/mysql-test/suite/sys_vars/t/completion_type_func.test +++ b/mysql-test/suite/sys_vars/t/completion_type_func.test @@ -146,7 +146,7 @@ COMMIT; --echo ## Inserting rows should give error here because connection should ## --echo ## disconnect after using COMMIT ## ---Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014 +--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014,2026 INSERT INTO t1 VALUES(4,'Record_4'); connection test_con2; @@ -160,7 +160,7 @@ INSERT INTO t1 VALUES(12,'Record_12'); ROLLBACK; --echo ## Expect a failure due to COMMIT/ROLLBACK AND RELEASE behavior ## ---Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014 +--Error 2006,2013,ER_QUERY_INTERRUPTED,ER_CONNECTION_KILLED,5014,2026 INSERT INTO t1 VALUES(4,'Record_4'); connection default; diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test index b1b2f9fdda9..cce150aec02 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test +++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test @@ -43,7 +43,7 @@ let $counter= 80; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014 + --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014,2026 show status; dec $counter; diff --git a/mysys/charset.c b/mysys/charset.c index 2b74b7c8c16..9a049689dce 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -393,6 +393,8 @@ static int add_collation(struct charset_info_st *cs) &my_charset_utf8mb4_unicode_ci, cs); newcs->m_ctype= my_charset_utf8mb4_unicode_ci.m_ctype; + if (init_state_maps(newcs)) + return MY_XML_ERROR; newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif } diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 9cc1e19772b..b5193a9cd8e 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -376,7 +376,7 @@ uchar *my_large_malloc(size_t *size, myf my_flags) ptr= NULL; if (my_flags & MY_WME) { - if (large_page_size) + if (large_page_size && errno == ENOMEM) { my_printf_error(EE_OUTOFMEMORY, "Couldn't allocate %zu bytes (Large/HugeTLB memory " diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 844d8a0b28f..f203bba4d8d 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -34,6 +34,9 @@ #include <execinfo.h> #endif +#ifdef HAVE_gcov +#include <gcov.h> +#endif /** Default handler for printing stacktrace */ @@ -409,9 +412,6 @@ end: /* Produce a core for the thread */ void my_write_core(int sig) { -#ifdef HAVE_gcov - extern void __gcov_flush(void); -#endif signal(sig, SIG_DFL); #ifdef HAVE_gcov /* @@ -419,7 +419,7 @@ void my_write_core(int sig) information from this process, causing gcov output to be incomplete. So we force the writing of coverage information here before terminating. */ - __gcov_flush(); + __gcov_dump(); #endif pthread_kill(pthread_self(), sig); #if defined(P_MYID) && !defined(SCO) diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc index 4d7ebc7bd27..00447e73d79 100644 --- a/mysys_ssl/my_crypt.cc +++ b/mysys_ssl/my_crypt.cc @@ -101,7 +101,7 @@ public: uchar source_tail[MY_AES_BLOCK_SIZE]; MyCTX_nopad() : MyCTX() { } - ~MyCTX_nopad() { } + ~MyCTX_nopad() = default; int init(const EVP_CIPHER *cipher, int encrypt, const uchar *key, uint klen, const uchar *iv, uint ivlen) diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 937b1177ae4..db24e33a141 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -189,9 +189,7 @@ database::database(const config& c) { } -database::~database() -{ -} +database::~database() = default; dbcontext_ptr database::create_context(bool for_write) volatile @@ -226,9 +224,7 @@ dbcontext::dbcontext(volatile database *d, bool for_write) user_level_lock_timeout = d->get_conf().get_int("wrlock_timeout", 12); } -dbcontext::~dbcontext() -{ -} +dbcontext::~dbcontext() = default; namespace { diff --git a/plugin/handler_socket/handlersocket/database.hpp b/plugin/handler_socket/handlersocket/database.hpp index a4aee0874c7..ed5d00800d9 100644 --- a/plugin/handler_socket/handlersocket/database.hpp +++ b/plugin/handler_socket/handlersocket/database.hpp @@ -27,7 +27,7 @@ struct dbcontext_i; typedef std::auto_ptr<dbcontext_i> dbcontext_ptr; struct database_i { - virtual ~database_i() { } + virtual ~database_i() = default; virtual dbcontext_ptr create_context(bool for_write) volatile = 0; virtual void stop() volatile = 0; virtual const config& get_conf() const volatile = 0; @@ -57,7 +57,7 @@ struct prep_stmt { }; struct dbcallback_i { - virtual ~dbcallback_i () { } + virtual ~dbcallback_i() = default; virtual void dbcb_set_prep_stmt(size_t pst_id, const prep_stmt& v) = 0; virtual const prep_stmt *dbcb_get_prep_stmt(size_t pst_id) const = 0; virtual void dbcb_resp_short(uint32_t code, const char *msg) = 0; @@ -111,7 +111,7 @@ struct cmd_exec_args { }; struct dbcontext_i { - virtual ~dbcontext_i() { } + virtual ~dbcontext_i() = default; virtual void init_thread(const void *stack_bottom, volatile int& shutdown_flag) = 0; virtual void term_thread() = 0; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr.hpp b/plugin/handler_socket/handlersocket/hstcpsvr.hpp index 811bfa25613..5fbed92402b 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr.hpp @@ -47,7 +47,7 @@ struct hstcpsvr_i; typedef std::auto_ptr<hstcpsvr_i> hstcpsvr_ptr; struct hstcpsvr_i { - virtual ~hstcpsvr_i() { } + virtual ~hstcpsvr_i() = default; virtual std::string start_listen() = 0; static hstcpsvr_ptr create(const config& conf); }; diff --git a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp index 497581c27a7..25612adec0f 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr_worker.hpp @@ -24,7 +24,7 @@ struct hstcpsvr_worker_arg { }; struct hstcpsvr_worker_i { - virtual ~hstcpsvr_worker_i() { } + virtual ~hstcpsvr_worker_i() = default; virtual void run() = 0; static hstcpsvr_worker_ptr create(const hstcpsvr_worker_arg& arg); }; diff --git a/plugin/handler_socket/libhsclient/hstcpcli.hpp b/plugin/handler_socket/libhsclient/hstcpcli.hpp index 11dec8ebb0b..fa0d4db1742 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.hpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.hpp @@ -33,7 +33,7 @@ struct hstcpcli_i; typedef std::auto_ptr<hstcpcli_i> hstcpcli_ptr; struct hstcpcli_i { - virtual ~hstcpcli_i() { } + virtual ~hstcpcli_i() = default; virtual void close() = 0; virtual int reconnect() = 0; virtual bool stable_point() = 0; diff --git a/plugin/handler_socket/libhsclient/util.hpp b/plugin/handler_socket/libhsclient/util.hpp index 93d78cc7dc0..60b5441703d 100644 --- a/plugin/handler_socket/libhsclient/util.hpp +++ b/plugin/handler_socket/libhsclient/util.hpp @@ -13,7 +13,7 @@ namespace dena { /* boost::noncopyable */ struct noncopyable { - noncopyable() { } + noncopyable() = default; private: noncopyable(const noncopyable&); noncopyable& operator =(const noncopyable&); diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc index a669f7d4236..e344f45b392 100644 --- a/plugin/query_response_time/query_response_time.cc +++ b/plugin/query_response_time/query_response_time.cc @@ -153,7 +153,7 @@ class time_collector public: time_collector(utility& u): m_utility(&u) { flush(); } - ~time_collector() { } + ~time_collector() = default; uint32_t count(uint index) { return m_count[index]; } uint64_t total(uint index) { return m_total[index]; } void flush() diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h index be9fea8ebc9..ee39f542f05 100644 --- a/plugin/type_uuid/sql_type_uuid.h +++ b/plugin/type_uuid/sql_type_uuid.h @@ -64,9 +64,9 @@ public: { return memcmp(a + m_memory_pos, b + m_memory_pos, m_length); } - void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) const + void hash_record(const uchar *ptr, Hasher *hasher) const { - my_charset_bin.hash_sort(ptr + m_record_pos, m_length, nr, nr2); + hasher->add(&my_charset_bin, ptr + m_record_pos, m_length); } }; @@ -119,13 +119,13 @@ public: put values into the same partition. */ - static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + static void hash_record(const uchar *ptr, Hasher *hasher) { - segment(0).hash_record(ptr, nr, nr2); - segment(1).hash_record(ptr, nr, nr2); - segment(2).hash_record(ptr, nr, nr2); - segment(3).hash_record(ptr, nr, nr2); - segment(4).hash_record(ptr, nr, nr2); + segment(0).hash_record(ptr, hasher); + segment(1).hash_record(ptr, hasher); + segment(2).hash_record(ptr, hasher); + segment(3).hash_record(ptr, hasher); + segment(4).hash_record(ptr, hasher); } // Compare two in-memory values diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index 6d8f77550f6..c970a9d6561 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -36,8 +36,8 @@ public: static Create_func_trt<TRT_FIELD> s_singleton; protected: - Create_func_trt<TRT_FIELD>() {} - virtual ~Create_func_trt<TRT_FIELD>() {} + Create_func_trt<TRT_FIELD>() = default; + virtual ~Create_func_trt<TRT_FIELD>() = default; }; template<TR_table::field_id_t TRT_FIELD> @@ -132,8 +132,8 @@ public: static Create_func_trt_trx_sees<Item_func_trt_trx_seesX> s_singleton; protected: - Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() {} - virtual ~Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() {} + Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() = default; + virtual ~Create_func_trt_trx_sees<Item_func_trt_trx_seesX>() = default; }; template<class X> diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index f4101832214..4938f8da02b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -237,6 +237,15 @@ FOREACH(se aria partition perfschema sql_sequence wsrep) ENDIF() ENDFOREACH() +IF(VISIBILITY_HIDDEN_FLAG AND TARGET partition AND WITH_UBSAN) + # the spider plugin needs some partition symbols from inside mysqld + # when built with ubsan, in which case we need to remove + # -fvisibility=hidden from partition + GET_TARGET_PROPERTY(f partition COMPILE_FLAGS) + STRING(REPLACE "${VISIBILITY_HIDDEN_FLAG}" "" f ${f}) + SET_TARGET_PROPERTIES(partition PROPERTIES COMPILE_FLAGS "${f}") +ENDIF() + IF(WIN32) SET(MYSQLD_SOURCE main.cc message.rc) ELSE() diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index 55523a728f8..eac111d32d7 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -18,6 +18,7 @@ #include "mariadb.h" #include "debug_sync.h" +#include <cstring> #if defined(ENABLED_DEBUG_SYNC) @@ -48,6 +49,8 @@ struct st_debug_sync_action String wait_for; /* signal to wait for */ String sync_point; /* sync point name */ bool need_sort; /* if new action, array needs sort */ + bool clear_event; /* do not clear signal when waited + for if false. */ }; /* Debug sync control. Referenced by THD. */ @@ -67,21 +70,99 @@ struct st_debug_sync_control }; + + /** Definitions for the debug sync facility. - 1. Global string variable to hold a "signal" ("signal post", "flag mast"). + 1. Global string variable to hold a set of of "signals". 2. Global condition variable for signaling and waiting. 3. Global mutex to synchronize access to the above. */ struct st_debug_sync_globals { - String ds_signal; /* signal variable */ + Hash_set<LEX_CSTRING> ds_signal_set; /* A set of active signals */ mysql_cond_t ds_cond; /* condition variable */ mysql_mutex_t ds_mutex; /* mutex variable */ ulonglong dsp_hits; /* statistics */ ulonglong dsp_executed; /* statistics */ ulonglong dsp_max_active; /* statistics */ + + st_debug_sync_globals() : ds_signal_set(PSI_NOT_INSTRUMENTED, signal_key) {}; + ~st_debug_sync_globals() + { + clear_set(); + } + + void clear_set() + { + Hash_set<LEX_CSTRING>::Iterator it{ds_signal_set}; + LEX_CSTRING *s; + while ((s= it++)) + my_free(s); + ds_signal_set.clear(); + } + + /* Hash key function for ds_signal_set. */ + static uchar *signal_key(const LEX_CSTRING *str, size_t *klen, my_bool) + { + *klen= str->length; + return (uchar*) str->str; + } + + /** + Return true if the signal is found in global signal list. + + @param signal_name Signal name identifying the signal. + + @note + If signal is found in the global signal set, it means that the + signal thread has signalled to the waiting thread. This method + must be called with the debug_sync_global.ds_mutex held. + + @retval true if signal is found in the global signal list. + @retval false otherwise. + */ + + inline bool is_signalled(const char *signal_name, size_t length) + { + return ds_signal_set.find(signal_name, length); + } + + void clear_signal(const String &signal_name) + { + DBUG_ENTER("clear_signal"); + LEX_CSTRING *record= ds_signal_set.find(signal_name.ptr(), + signal_name.length()); + if (record) + { + ds_signal_set.remove(record); + my_free(record); + } + DBUG_VOID_RETURN; + } + + bool set_signal(const char *signal_name, size_t length) + { + /* Need to check if the signal is already in the hash set, because + Hash_set doesn't differentiate between OOM and key already in. */ + if (is_signalled(signal_name, length)) + return FALSE; + /* LEX_CSTRING and the string allocated with only one malloc. */ + LEX_CSTRING *s= (LEX_CSTRING *) my_malloc(PSI_NOT_INSTRUMENTED, + sizeof(LEX_CSTRING) + length + 1, + MYF(0)); + char *str= (char *)(s + 1); + memcpy(str, signal_name, length); + str[length]= '\0'; + + s->length= length; + s->str= str; + if (ds_signal_set.insert(s)) + return TRUE; + return FALSE; + } }; + static st_debug_sync_globals debug_sync_global; /* All globals in one object */ /** @@ -161,7 +242,7 @@ int debug_sync_init(void) int rc; /* Initialize the global variables. */ - debug_sync_global.ds_signal.length(0); + debug_sync_global.clear_set(); if ((rc= mysql_cond_init(key_debug_sync_globals_ds_cond, &debug_sync_global.ds_cond, NULL)) || (rc= mysql_mutex_init(key_debug_sync_globals_ds_mutex, @@ -195,7 +276,7 @@ void debug_sync_end(void) debug_sync_C_callback_ptr= NULL; /* Destroy the global variables. */ - debug_sync_global.ds_signal.free(); + debug_sync_global.clear_set(); mysql_cond_destroy(&debug_sync_global.ds_cond); mysql_mutex_destroy(&debug_sync_global.ds_mutex); @@ -272,6 +353,40 @@ void debug_sync_init_thread(THD *thd) /** + Returns an allocated buffer containing a comma-separated C string of all + active signals. + + Buffer must be freed by the caller. +*/ +static const char *get_signal_set_as_string() +{ + mysql_mutex_assert_owner(&debug_sync_global.ds_mutex); + size_t req_size= 1; // In case of empty set for the end '\0' char. + + for (size_t i= 0; i < debug_sync_global.ds_signal_set.size(); i++) + req_size+= debug_sync_global.ds_signal_set.at(i)->length + 1; + + char *buf= (char *) my_malloc(PSI_NOT_INSTRUMENTED, req_size, MYF(0)); + if (!buf) + return nullptr; + memset(buf, '\0', req_size); + + char *cur_pos= buf; + for (size_t i= 0; i < debug_sync_global.ds_signal_set.size(); i++) + { + const LEX_CSTRING *signal= debug_sync_global.ds_signal_set.at(i); + memcpy(cur_pos, signal->str, signal->length); + if (i != debug_sync_global.ds_signal_set.size() - 1) + cur_pos[signal->length]= ','; + else + cur_pos[signal->length] = '\0'; + cur_pos+= signal->length + 1; + } + return buf; +} + + +/** End the debug sync facility at thread end. @param[in] thd thread handle @@ -554,7 +669,7 @@ static void debug_sync_reset(THD *thd) /* Clear the global signal. */ mysql_mutex_lock(&debug_sync_global.ds_mutex); - debug_sync_global.ds_signal.length(0); + debug_sync_global.clear_set(); mysql_mutex_unlock(&debug_sync_global.ds_mutex); DBUG_VOID_RETURN; @@ -1175,6 +1290,7 @@ static bool debug_sync_eval_action(THD *thd, char *action_str, char *action_end) /* Set default for EXECUTE and TIMEOUT options. */ action->execute= 1; action->timeout= opt_debug_sync_timeout; + action->clear_event= true; /* Get next token. If none follows, set action. */ if (!(ptr= debug_sync_token(&token, &token_length, ptr, action_end))) @@ -1226,6 +1342,16 @@ static bool debug_sync_eval_action(THD *thd, char *action_str, char *action_end) } /* + Try NO_CLEAR_EVENT. + */ + if (!my_strcasecmp(system_charset_info, token, "NO_CLEAR_EVENT")) + { + action->clear_event= false; + /* Get next token. If none follows, set action. */ + if (!(ptr = debug_sync_token(&token, &token_length, ptr, action_end))) goto set_action; + } + + /* Try HIT_LIMIT. */ if (!my_strcasecmp(system_charset_info, token, "HIT_LIMIT")) @@ -1325,13 +1451,19 @@ uchar *debug_sync_value_ptr(THD *thd) if (opt_debug_sync_timeout) { - static char on[]= "ON - current signal: '"; + static char on[]= "ON - current signals: '"; // Ensure exclusive access to debug_sync_global.ds_signal mysql_mutex_lock(&debug_sync_global.ds_mutex); - size_t lgt= (sizeof(on) /* includes '\0' */ + - debug_sync_global.ds_signal.length() + 1 /* for '\'' */); + size_t lgt= sizeof(on) + 1; /* +1 as we'll have to append ' at the end. */ + + for (size_t i= 0; i < debug_sync_global.ds_signal_set.size(); i++) + { + /* Assume each signal is separated by a comma, hence +1. */ + lgt+= debug_sync_global.ds_signal_set.at(i)->length + 1; + } + char *vend; char *vptr; @@ -1339,10 +1471,15 @@ uchar *debug_sync_value_ptr(THD *thd) { vend= value + lgt - 1; /* reserve space for '\0'. */ vptr= debug_sync_bmove_len(value, vend, STRING_WITH_LEN(on)); - vptr= debug_sync_bmove_len(vptr, vend, debug_sync_global.ds_signal.ptr(), - debug_sync_global.ds_signal.length()); - if (vptr < vend) - *(vptr++)= '\''; + for (size_t i= 0; i < debug_sync_global.ds_signal_set.size(); i++) + { + const LEX_CSTRING *s= debug_sync_global.ds_signal_set.at(i); + vptr= debug_sync_bmove_len(vptr, vend, s->str, s->length); + if (i != debug_sync_global.ds_signal_set.size() - 1) + *(vptr++)= ','; + } + DBUG_ASSERT(vptr < vend); + *(vptr++)= '\''; *vptr= '\0'; /* We have one byte reserved for the worst case. */ } mysql_mutex_unlock(&debug_sync_global.ds_mutex); @@ -1358,6 +1495,9 @@ uchar *debug_sync_value_ptr(THD *thd) } + + + /** Execute requested action at a synchronization point. @@ -1413,12 +1553,28 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action) read access too, to create a memory barrier in order to avoid that threads just reads an old cached version of the signal. */ + mysql_mutex_lock(&debug_sync_global.ds_mutex); if (action->signal.length()) { - /* Copy the signal to the global variable. */ - if (debug_sync_global.ds_signal.copy(action->signal)) + int offset= 0, pos; + bool error= false; + + /* This loop covers all signals in the list except for the last one. + Split the signal string by commas and set a signal in the global + variable for each one. */ + while (!error && (pos= action->signal.strstr(",", 1, offset)) > 0) + { + error= debug_sync_global.set_signal(action->signal.ptr() + offset, + pos - offset); + offset= pos + 1; + } + + if (error || + /* The last signal in the list. */ + debug_sync_global.set_signal(action->signal.ptr() + offset, + action->signal.length() - offset)) { /* Error is reported by my_malloc(). @@ -1461,31 +1617,43 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action) restore_current_mutex = false; set_timespec(abstime, action->timeout); - DBUG_EXECUTE("debug_sync_exec", - /* Functions as DBUG_PRINT args can change keyword and line nr. */ - DBUG_PRINT("debug_sync_exec", - ("wait for '%s' at: '%s' curr: '%s'", - sig_wait, dsp_name, - debug_sync_global.ds_signal.c_ptr()));); + DBUG_EXECUTE("debug_sync_exec", { + const char *signal_set= get_signal_set_as_string(); + if (!signal_set) + { + DBUG_PRINT("debug_sync_exec", + ("Out of memory when fetching signal set")); + } + else + { + /* Functions as DBUG_PRINT args can change keyword and line nr. */ + DBUG_PRINT("debug_sync_exec", + ("wait for '%s' at: '%s', curr: '%s'", + sig_wait, dsp_name, signal_set)); + my_free((void *)signal_set); + }}); + /* - Wait until global signal string matches the wait_for string. - Interrupt when thread or query is killed or facility disabled. + Wait until the signal set contains the wait_for string. + Interrupt when thread or query is killed or facility is disabled. The facility can become disabled when some thread cannot get the required dynamic memory allocated. */ - while (stringcmp(&debug_sync_global.ds_signal, &action->wait_for) && - !(thd->killed & KILL_HARD_BIT) && opt_debug_sync_timeout) + while (!debug_sync_global.is_signalled(action->wait_for.ptr(), + action->wait_for.length()) && + !(thd->killed & KILL_HARD_BIT) && + opt_debug_sync_timeout) { error= mysql_cond_timedwait(&debug_sync_global.ds_cond, &debug_sync_global.ds_mutex, &abstime); - DBUG_EXECUTE("debug_sync", + // TODO turn this into a for loop printing. + DBUG_EXECUTE("debug_sync", { /* Functions as DBUG_PRINT args can change keyword and line nr. */ DBUG_PRINT("debug_sync", - ("awoke from %s global: %s error: %d", - sig_wait, debug_sync_global.ds_signal.c_ptr(), - error));); + ("awoke from %s error: %d", + sig_wait, error));}); if (unlikely(error == ETIMEDOUT || error == ETIME)) { // We should not make the statement fail, even if in strict mode. @@ -1498,6 +1666,10 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action) } error= 0; } + + if (action->clear_event) + debug_sync_global.clear_signal(action->wait_for); + DBUG_EXECUTE("debug_sync_exec", if (thd->killed) DBUG_PRINT("debug_sync_exec", @@ -1571,10 +1743,10 @@ static void debug_sync(THD *thd, const char *sync_point_name, size_t name_len) st_debug_sync_control *ds_control= thd->debug_sync_control; st_debug_sync_action *action; DBUG_ENTER("debug_sync"); + DBUG_PRINT("debug_sync_point", ("hit: '%s'", sync_point_name)); DBUG_ASSERT(sync_point_name); DBUG_ASSERT(name_len); DBUG_ASSERT(ds_control); - DBUG_PRINT("debug_sync_point", ("hit: '%s'", sync_point_name)); /* Statistics. */ ds_control->dsp_hits++; diff --git a/sql/derived_handler.h b/sql/derived_handler.h index 171165bbe6f..f6feed8db32 100644 --- a/sql/derived_handler.h +++ b/sql/derived_handler.h @@ -56,7 +56,7 @@ public: derived_handler(THD *thd_arg, handlerton *ht_arg) : thd(thd_arg), ht(ht_arg), derived(0),table(0), tmp_table_param(0), unit(0), select(0) {} - virtual ~derived_handler() {} + virtual ~derived_handler() = default; /* Functions to scan data. All these returns 0 if ok, error code in case diff --git a/sql/discover.h b/sql/discover.h index 1775f5d6551..750c2944ede 100644 --- a/sql/discover.h +++ b/sql/discover.h @@ -28,7 +28,7 @@ int writefile(const char *path, const char *db, const char *table, inline void deletefrm(const char *path) { char frm_name[FN_REFLEN]; - strxmov(frm_name, path, reg_ext, NullS); + strxnmov(frm_name, sizeof(frm_name)-1, path, reg_ext, NullS); mysql_file_delete(key_file_frm, frm_name, MYF(0)); } diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 3980f248327..bb552aa9de8 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -328,9 +328,7 @@ Event_queue_element::Event_queue_element(): SYNOPSIS Event_queue_element::Event_queue_element() */ -Event_queue_element::~Event_queue_element() -{ -} +Event_queue_element::~Event_queue_element() = default; /* @@ -356,9 +354,7 @@ Event_timed::Event_timed(): Event_timed::~Event_timed() */ -Event_timed::~Event_timed() -{ -} +Event_timed::~Event_timed() = default; /* diff --git a/sql/event_db_repository.h b/sql/event_db_repository.h index b89a1a15155..29b5031bc28 100644 --- a/sql/event_db_repository.h +++ b/sql/event_db_repository.h @@ -71,7 +71,7 @@ class Event_parse_data; class Event_db_repository { public: - Event_db_repository(){} + Event_db_repository() = default; bool create_event(THD *thd, Event_parse_data *parse_data, diff --git a/sql/field.cc b/sql/field.cc index 6b782f79d3a..5a618a5a2a9 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1924,17 +1924,11 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, } -void Field::hash(ulong *nr, ulong *nr2) +void Field::hash_not_null(Hasher *hasher) { - if (is_null()) - { - *nr^= (*nr << 1) | 1; - } - else - { - uint len= pack_length(); - sort_charset()->hash_sort(ptr, len, nr, nr2); - } + DBUG_ASSERT(marked_for_read()); + DBUG_ASSERT(!is_null()); + hasher->add(sort_charset(), ptr, pack_length()); } size_t @@ -8345,17 +8339,12 @@ bool Field_varstring::is_equal(const Column_definition &new_field) const } -void Field_varstring::hash(ulong *nr, ulong *nr2) +void Field_varstring::hash_not_null(Hasher *hasher) { - if (is_null()) - { - *nr^= (*nr << 1) | 1; - } - else - { - uint len= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); - charset()->hash_sort(ptr + length_bytes, len, nr, nr2); - } + DBUG_ASSERT(marked_for_read()); + DBUG_ASSERT(!is_null()); + uint len= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); + hasher->add(charset(), ptr + length_bytes, len); } @@ -8730,6 +8719,17 @@ oom_error: } +void Field_blob::hash_not_null(Hasher *hasher) +{ + DBUG_ASSERT(marked_for_read()); + DBUG_ASSERT(!is_null()); + char *blob; + memcpy(&blob, ptr + packlength, sizeof(char*)); + if (blob) + hasher->add(Field_blob::charset(), blob, get_length(ptr)); +} + + double Field_blob::val_real(void) { DBUG_ASSERT(marked_for_read()); @@ -9792,20 +9792,27 @@ const DTCollation & Field_bit::dtcollation() const } -void Field_bit::hash(ulong *nr, ulong *nr2) +/* + This method always calculates hash over 8 bytes. + This is different from how the HEAP engine calculate hash: + HEAP takes into account the actual octet size, so say for BIT(18) + it calculates hash over three bytes only: + - the incomplete byte with bits 16..17 + - the two full bytes with bits 0..15 + See hp_rec_hashnr(), hp_hashnr() for details. + + The HEAP way is more efficient, especially for short lengths. + Let's consider fixing Field_bit eventually to do it in the HEAP way, + with proper measures to upgrade partitioned tables easy. +*/ +void Field_bit::hash_not_null(Hasher *hasher) { - if (is_null()) - { - *nr^= (*nr << 1) | 1; - } - else - { - CHARSET_INFO *cs= &my_charset_bin; - longlong value= Field_bit::val_int(); - uchar tmp[8]; - mi_int8store(tmp,value); - cs->hash_sort(tmp, 8, nr, nr2); - } + DBUG_ASSERT(marked_for_read()); + DBUG_ASSERT(!is_null()); + longlong value= Field_bit::val_int(); + uchar tmp[8]; + mi_int8store(tmp,value); + hasher->add(&my_charset_bin, tmp, 8); } diff --git a/sql/field.h b/sql/field.h index 4036f032257..13d80099124 100644 --- a/sql/field.h +++ b/sql/field.h @@ -605,7 +605,7 @@ public: name.length= 0; }; Virtual_column_info* clone(THD *thd); - ~Virtual_column_info() {}; + ~Virtual_column_info() = default; enum_vcol_info_type get_vcol_type() const { return vcol_type; @@ -895,7 +895,7 @@ public: Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const LEX_CSTRING *field_name_arg); - virtual ~Field() {} + virtual ~Field() = default; virtual Type_numeric_attributes type_numeric_attributes() const { @@ -1845,7 +1845,14 @@ public: key_map get_possible_keys(); /* Hash value */ - virtual void hash(ulong *nr, ulong *nr2); + void hash(Hasher *hasher) + { + if (is_null()) + hasher->add_null(); + else + hash_not_null(hasher); + } + virtual void hash_not_null(Hasher *hasher); /** Get the upper limit of the MySQL integral and floating-point type. @@ -4221,7 +4228,7 @@ public: uchar *new_ptr, uint32 length, uchar *new_null_ptr, uint new_null_bit) override; bool is_equal(const Column_definition &new_field) const override; - void hash(ulong *nr, ulong *nr2) override; + void hash_not_null(Hasher *hasher) override; uint length_size() const override { return length_bytes; } void print_key_value(String *out, uint32 length) override; Binlog_type_info binlog_type_info() const override; @@ -4481,6 +4488,7 @@ public: bool make_empty_rec_store_default_value(THD *thd, Item *item) override; int store(const char *to, size_t length, CHARSET_INFO *charset) override; using Field_str::store; + void hash_not_null(Hasher *hasher) override; double val_real() override; longlong val_int() override; String *val_str(String *, String *) override; @@ -5051,7 +5059,7 @@ public: if (bit_ptr) bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); } - void hash(ulong *nr, ulong *nr2) override; + void hash_not_null(Hasher *hasher) override; SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, KEY_PART *key_part, const Item_bool_func *cond, @@ -5851,8 +5859,8 @@ public: Field *from_field,*to_field; String tmp; // For items - Copy_field() {} - ~Copy_field() {} + Copy_field() = default; + ~Copy_field() = default; void set(Field *to,Field *from,bool save); // Field to field void set(uchar *to,Field *from); // Field to string void (*do_copy)(Copy_field *); diff --git a/sql/filesort_utils.h b/sql/filesort_utils.h index 73aa2f76a18..776e986e14a 100644 --- a/sql/filesort_utils.h +++ b/sql/filesort_utils.h @@ -305,22 +305,11 @@ public: /** We need an assignment operator, see filesort(). This happens to have the same semantics as the one that would be - generated by the compiler. We still implement it here, to show shallow - assignment explicitly: we have two objects sharing the same array. + generated by the compiler. + Note that this is a shallow copy. We have two objects sharing the same + array. */ - Filesort_buffer &operator=(const Filesort_buffer &rhs) - { - m_next_rec_ptr= rhs.m_next_rec_ptr; - m_rawmem= rhs.m_rawmem; - m_record_pointers= rhs.m_record_pointers; - m_sort_keys= rhs.m_sort_keys; - m_num_records= rhs.m_num_records; - m_record_length= rhs.m_record_length; - m_sort_length= rhs.m_sort_length; - m_size_in_bytes= rhs.m_size_in_bytes; - m_idx= rhs.m_idx; - return *this; - } + Filesort_buffer &operator=(const Filesort_buffer &rhs) = default; uint get_sort_length() const { return m_sort_length; } void set_sort_length(uint val) { m_sort_length= val; } diff --git a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h index b5188f29dfd..37e887e87e5 100644 --- a/sql/gcalc_slicescan.h +++ b/sql/gcalc_slicescan.h @@ -344,7 +344,7 @@ public: { return complete_ring() || complete_poly(); } - virtual ~Gcalc_shape_transporter() {} + virtual ~Gcalc_shape_transporter() = default; }; diff --git a/sql/group_by_handler.h b/sql/group_by_handler.h index ff3b204fa56..5457cb778f5 100644 --- a/sql/group_by_handler.h +++ b/sql/group_by_handler.h @@ -77,7 +77,7 @@ public: group_by_handler(THD *thd_arg, handlerton *ht_arg) : thd(thd_arg), ht(ht_arg), table(0) {} - virtual ~group_by_handler() {} + virtual ~group_by_handler() = default; /* Functions to scan data. All these returns 0 if ok, error code in case diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 08e3b45e02b..fdb4726a930 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -10034,8 +10034,7 @@ uint8 ha_partition::table_cache_type() uint32 ha_partition::calculate_key_hash_value(Field **field_array) { - ulong nr1= 1; - ulong nr2= 4; + Hasher hasher; bool use_51_hash; use_51_hash= MY_TEST((*field_array)->table->part_info->key_algorithm == partition_info::KEY_ALGORITHM_51); @@ -10062,12 +10061,12 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array) { if (field->is_null()) { - nr1^= (nr1 << 1) | 1; + hasher.add_null(); continue; } /* Force this to my_hash_sort_bin, which was used in 5.1! */ uint len= field->pack_length(); - my_charset_bin.hash_sort(field->ptr, len, &nr1, &nr2); + hasher.add(&my_charset_bin, field->ptr, len); /* Done with this field, continue with next one. */ continue; } @@ -10085,12 +10084,12 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array) { if (field->is_null()) { - nr1^= (nr1 << 1) | 1; + hasher.add_null(); continue; } /* Force this to my_hash_sort_bin, which was used in 5.1! */ uint len= field->pack_length(); - my_charset_latin1.hash_sort(field->ptr, len, &nr1, &nr2); + hasher.add(&my_charset_latin1, field->ptr, len); continue; } /* New types in mysql-5.6. */ @@ -10117,9 +10116,9 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array) } /* fall through, use collation based hashing. */ } - field->hash(&nr1, &nr2); + field->hash(&hasher); } while (*(++field_array)); - return (uint32) nr1; + return (uint32) hasher.finalize(); } diff --git a/sql/handler.cc b/sql/handler.cc index 5884339c809..1a4cc630a37 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4848,6 +4848,35 @@ int handler::check_collation_compatibility() } +int handler::check_long_hash_compatibility() const +{ + if (!table->s->old_long_hash_function()) + return 0; + KEY *key= table->key_info; + KEY *key_end= key + table->s->keys; + for ( ; key < key_end; key++) + { + if (key->algorithm == HA_KEY_ALG_LONG_HASH) + { + /* + The old (pre-MDEV-27653) hash function was wrong. + So the long hash unique constraint can have some + duplicate records. REPAIR TABLE can't fix this, + it will fail on a duplicate key error. + Only "ALTER IGNORE TABLE .. FORCE" can fix this. + So we need to return HA_ADMIN_NEEDS_ALTER here, + (not HA_ADMIN_NEEDS_UPGRADE which is used elsewhere), + to properly send the error message text corresponding + to ER_TABLE_NEEDS_REBUILD (rather than to ER_TABLE_NEEDS_UPGRADE) + to the user. + */ + return HA_ADMIN_NEEDS_ALTER; + } + } + return 0; +} + + int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt) { int error; @@ -4885,6 +4914,9 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt) if (unlikely((error= check_collation_compatibility()))) return error; + + if (unlikely((error= check_long_hash_compatibility()))) + return error; return check_for_upgrade(check_opt); } diff --git a/sql/handler.h b/sql/handler.h index 41bc50e52d4..0810d1a503a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -891,7 +891,7 @@ struct xid_t { long bqual_length; char data[XIDDATASIZE]; // not \0-terminated ! - xid_t() {} /* Remove gcc warning */ + xid_t() = default; /* Remove gcc warning */ bool eq(struct xid_t *xid) const { return !xid->is_null() && eq(xid->gtrid_length, xid->bqual_length, xid->data); } bool eq(long g, long b, const char *d) const @@ -1588,7 +1588,7 @@ struct handlerton public: virtual bool add_table(const char *tname, size_t tlen) = 0; virtual bool add_file(const char *fname) = 0; - protected: virtual ~discovered_list() {} + protected: virtual ~discovered_list() = default; }; /* @@ -1831,7 +1831,7 @@ struct THD_TRANS m_unsafe_rollback_flags= 0; } bool is_empty() const { return ha_list == NULL; } - THD_TRANS() {} /* Remove gcc warning */ + THD_TRANS() = default; /* Remove gcc warning */ unsigned int m_unsafe_rollback_flags; /* @@ -2072,7 +2072,7 @@ struct Table_period_info: Sql_alloc struct start_end_t { - start_end_t() {}; + start_end_t() = default; start_end_t(const LEX_CSTRING& _start, const LEX_CSTRING& _end) : start(_start), end(_end) {} @@ -2432,9 +2432,9 @@ struct KEY_PAIR class inplace_alter_handler_ctx : public Sql_alloc { public: - inplace_alter_handler_ctx() {} + inplace_alter_handler_ctx() = default; - virtual ~inplace_alter_handler_ctx() {} + virtual ~inplace_alter_handler_ctx() = default; virtual void set_shared_data(const inplace_alter_handler_ctx& ctx) {} }; @@ -2681,7 +2681,7 @@ typedef class Item COND; typedef struct st_ha_check_opt { - st_ha_check_opt() {} /* Remove gcc warning */ + st_ha_check_opt() = default; /* Remove gcc warning */ uint flags; /* isam layer flags (e.g. for myisamchk) */ uint sql_flags; /* sql layer flags - for something myisamchk cannot do */ time_t start_time; /* When check/repair starts */ @@ -3065,8 +3065,8 @@ uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map); class Handler_share { public: - Handler_share() {} - virtual ~Handler_share() {} + Handler_share() = default; + virtual ~Handler_share() = default; }; enum class Compare_keys : uint32_t @@ -3497,6 +3497,7 @@ public: } int check_collation_compatibility(); + int check_long_hash_compatibility() const; int ha_check_for_upgrade(HA_CHECK_OPT *check_opt); /** to be actually called to get 'check()' functionality*/ int ha_check(THD *thd, HA_CHECK_OPT *check_opt); @@ -5460,7 +5461,7 @@ public: const LEX_CSTRING *wild_arg); Discovered_table_list(THD *thd_arg, Dynamic_array<LEX_CSTRING*> *tables_arg) : thd(thd_arg), wild(NULL), with_temps(true), tables(tables_arg) {} - ~Discovered_table_list() {} + ~Discovered_table_list() = default; bool add_table(const char *tname, size_t tlen); bool add_file(const char *fname); diff --git a/sql/hash_filo.h b/sql/hash_filo.h index ac84e5ccb7b..4dba104f716 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -35,7 +35,7 @@ class hash_filo_element private: hash_filo_element *next_used,*prev_used; public: - hash_filo_element() {} + hash_filo_element() = default; hash_filo_element *next() { return next_used; } hash_filo_element *prev() diff --git a/sql/hostname.cc b/sql/hostname.cc index 35948db3d23..18164b32517 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -74,8 +74,7 @@ Host_errors::Host_errors() m_local(0) {} -Host_errors::~Host_errors() -{} +Host_errors::~Host_errors() = default; void Host_errors::reset() { diff --git a/sql/item.cc b/sql/item.cc index ce55d77eb4d..92f3d55fcf9 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -10831,7 +10831,7 @@ table_map Item_direct_view_ref::used_tables() const table_map used= (*ref)->used_tables(); return (used ? used : - ((null_ref_table != NO_NULL_TABLE) ? + (null_ref_table != NO_NULL_TABLE && !null_ref_table->const_table ? null_ref_table->map : (table_map)0 )); } diff --git a/sql/item.h b/sql/item.h index e15d454c65f..0bbe65e4239 100644 --- a/sql/item.h +++ b/sql/item.h @@ -326,7 +326,7 @@ private: TABLE_LIST *save_next_local; public: - Name_resolution_context_state() {} /* Remove gcc warning */ + Name_resolution_context_state() = default; /* Remove gcc warning */ public: /* Save the state of a name resolution context. */ @@ -427,7 +427,7 @@ class sp_rcontext; class Sp_rcontext_handler { public: - virtual ~Sp_rcontext_handler() {} + virtual ~Sp_rcontext_handler() = default; /** A prefix used for SP variable names in queries: - EXPLAIN EXTENDED @@ -500,8 +500,8 @@ public: required, otherwise we only reading it and SELECT privilege might be required. */ - Settable_routine_parameter() {} - virtual ~Settable_routine_parameter() {} + Settable_routine_parameter() = default; + virtual ~Settable_routine_parameter() = default; virtual void set_required_privilege(bool rw) {}; /* @@ -583,7 +583,7 @@ class Rewritable_query_parameter limit_clause_param(false) { } - virtual ~Rewritable_query_parameter() { } + virtual ~Rewritable_query_parameter() = default; virtual bool append_for_log(THD *thd, String *str) = 0; }; @@ -743,7 +743,7 @@ public: class Item_const { public: - virtual ~Item_const() {} + virtual ~Item_const() = default; virtual const Type_all_attributes *get_type_all_attributes_from_const() const= 0; virtual bool const_is_null() const { return false; } virtual const longlong *const_ptr_longlong() const { return NULL; } @@ -1499,6 +1499,12 @@ public: */ inline ulonglong val_uint() { return (ulonglong) val_int(); } + virtual bool hash_not_null(Hasher *hasher) + { + DBUG_ASSERT(0); + return true; + } + /* Return string representation of this item object. @@ -2916,8 +2922,8 @@ class Field_enumerator { public: virtual void visit_field(Item_field *field)= 0; - virtual ~Field_enumerator() {}; /* purecov: inspected */ - Field_enumerator() {} /* Remove gcc warning */ + virtual ~Field_enumerator() = default;; /* purecov: inspected */ + Field_enumerator() = default; /* Remove gcc warning */ }; class Item_string; @@ -3449,7 +3455,7 @@ public: Item_result_field(THD *thd, Item_result_field *item): Item_fixed_hybrid(thd, item), result_field(item->result_field) {} - ~Item_result_field() {} /* Required with gcc 2.95 */ + ~Item_result_field() = default; Field *get_tmp_table_field() override { return result_field; } Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, const Tmp_field_param *param) override @@ -3691,6 +3697,13 @@ public: { return Sql_mode_dependency(0, field->value_depends_on_sql_mode()); } + bool hash_not_null(Hasher *hasher) override + { + if (field->is_null()) + return true; + field->hash_not_null(hasher); + return false; + } longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate) @@ -7699,7 +7712,7 @@ public: */ virtual void close()= 0; - virtual ~Item_iterator() {} + virtual ~Item_iterator() = default; }; diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 05cef6871be..1079394e830 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -61,7 +61,7 @@ Cached_item *new_Cached_item(THD *thd, Item *item, bool pass_through_ref) } } -Cached_item::~Cached_item() {} +Cached_item::~Cached_item() = default; /** Compare with old value and replace value with new value. diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 8a1e6d9ffc3..fcdb2aaf2d4 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4909,38 +4909,18 @@ Item_cond::fix_fields(THD *thd, Item **ref) if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) return TRUE; // Fatal error flag is set! - /* - The following optimization reduces the depth of an AND-OR tree. - E.g. a WHERE clause like - F1 AND (F2 AND (F2 AND F4)) - is parsed into a tree with the same nested structure as defined - by braces. This optimization will transform such tree into - AND (F1, F2, F3, F4). - Trees of OR items are flattened as well: - ((F1 OR F2) OR (F3 OR F4)) => OR (F1, F2, F3, F4) - Items for removed AND/OR levels will dangle until the death of the - entire statement. - The optimization is currently prepared statements and stored procedures - friendly as it doesn't allocate any memory and its effects are durable - (i.e. do not depend on PS/SP arguments). - */ - while ((item=li++)) + + while (li++) { - while (item->type() == Item::COND_ITEM && - ((Item_cond*) item)->functype() == functype() && - !((Item_cond*) item)->list.is_empty()) - { // Identical function - li.replace(((Item_cond*) item)->list); - ((Item_cond*) item)->list.empty(); - item= *li.ref(); // new current item - } + merge_sub_condition(li); + item= *li.ref(); if (is_top_level_item()) item->top_level_item(); /* replace degraded condition: was: <field> - become: <field> = 1 + become: <field> != 0 */ Item::Type type= item->type(); if (type == Item::FIELD_ITEM || type == Item::REF_ITEM) @@ -4956,7 +4936,9 @@ Item_cond::fix_fields(THD *thd, Item **ref) if (item->fix_fields_if_needed_for_bool(thd, li.ref())) return TRUE; /* purecov: inspected */ - item= *li.ref(); // item can be substituted in fix_fields + merge_sub_condition(li); + item= *li.ref(); // may be substituted in fix_fields/merge_item_if_possible + used_tables_cache|= item->used_tables(); if (item->can_eval_in_optimize() && !item->with_sp_var() && !cond_has_datetime_is_null(item)) @@ -5003,6 +4985,55 @@ Item_cond::fix_fields(THD *thd, Item **ref) return FALSE; } +/** + @brief + Merge a lower-level condition pointed by the iterator into this Item_cond + if possible + + @param li list iterator pointing to condition that must be + examined and merged if possible. + + @details + If an item pointed by the iterator is an instance of Item_cond with the + same functype() as this Item_cond (i.e. both are Item_cond_and or both are + Item_cond_or) then the arguments of that lower-level item can be merged + into the list of arguments of this upper-level Item_cond. + + This optimization reduces the depth of an AND-OR tree. + E.g. a WHERE clause like + F1 AND (F2 AND (F2 AND F4)) + is parsed into a tree with the same nested structure as defined + by braces. This optimization will transform such tree into + AND (F1, F2, F3, F4). + Trees of OR items are flattened as well: + ((F1 OR F2) OR (F3 OR F4)) => OR (F1, F2, F3, F4) + Items for removed AND/OR levels will dangle until the death of the + entire statement. + + The optimization is currently prepared statements and stored procedures + friendly as it doesn't allocate any memory and its effects are durable + (i.e. do not depend on PS/SP arguments). +*/ +void Item_cond::merge_sub_condition(List_iterator<Item>& li) +{ + Item *item= *li.ref(); + + /* + The check for list.is_empty() is to catch empty Item_cond_and() items. + We may encounter Item_cond_and with an empty list, because optimizer code + strips multiple equalities, combines items, then adds multiple equalities + back + */ + while (item->type() == Item::COND_ITEM && + ((Item_cond*) item)->functype() == functype() && + !((Item_cond*) item)->list.is_empty()) + { + li.replace(((Item_cond*) item)->list); + ((Item_cond*) item)->list.empty(); + item= *li.ref(); + } +} + bool Item_cond::eval_not_null_tables(void *opt_arg) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 1422afb0fd0..efe0bf59559 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -252,8 +252,7 @@ protected: Item_bool_func(thd, a), value(a_value), affirmative(a_affirmative) {} - ~Item_func_truth() - {} + ~Item_func_truth() = default; private: /** True for <code>X IS [NOT] TRUE</code>, @@ -275,7 +274,7 @@ class Item_func_istrue : public Item_func_truth { public: Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {} - ~Item_func_istrue() {} + ~Item_func_istrue() = default; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("istrue") }; @@ -295,7 +294,7 @@ class Item_func_isnottrue : public Item_func_truth public: Item_func_isnottrue(THD *thd, Item *a): Item_func_truth(thd, a, true, false) {} - ~Item_func_isnottrue() {} + ~Item_func_isnottrue() = default; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("isnottrue") }; @@ -317,7 +316,7 @@ class Item_func_isfalse : public Item_func_truth { public: Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {} - ~Item_func_isfalse() {} + ~Item_func_isfalse() = default; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("isfalse") }; @@ -337,7 +336,7 @@ class Item_func_isnotfalse : public Item_func_truth public: Item_func_isnotfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, false) {} - ~Item_func_isnotfalse() {} + ~Item_func_isnotfalse() = default; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("isnotfalse") }; @@ -1450,13 +1449,13 @@ public: CHARSET_INFO *collation; uint count; uint used_count; - in_vector() {} + in_vector() = default; in_vector(THD *thd, uint elements, uint element_length, qsort2_cmp cmp_func, CHARSET_INFO *cmp_coll) :base((char*) thd_calloc(thd, elements * element_length)), size(element_length), compare(cmp_func), collation(cmp_coll), count(elements), used_count(elements) {} - virtual ~in_vector() {} + virtual ~in_vector() = default; virtual void set(uint pos,Item *item)=0; virtual uchar *get_value(Item *item)=0; void sort() @@ -1662,7 +1661,7 @@ class cmp_item :public Sql_alloc public: CHARSET_INFO *cmp_charset; cmp_item() { cmp_charset= &my_charset_bin; } - virtual ~cmp_item() {} + virtual ~cmp_item() = default; virtual void store_value(Item *item)= 0; /** @returns result (TRUE, FALSE or UNKNOWN) of @@ -1691,7 +1690,7 @@ class cmp_item_string : public cmp_item_scalar protected: String *value_res; public: - cmp_item_string () {} + cmp_item_string () = default; cmp_item_string (CHARSET_INFO *cs) { cmp_charset= cs; } void set_charset(CHARSET_INFO *cs) { cmp_charset= cs; } friend class cmp_item_sort_string; @@ -1757,7 +1756,7 @@ class cmp_item_int : public cmp_item_scalar { longlong value; public: - cmp_item_int() {} /* Remove gcc warning */ + cmp_item_int() = default; /* Remove gcc warning */ void store_value(Item *item) { value= item->val_int(); @@ -1790,7 +1789,7 @@ class cmp_item_temporal: public cmp_item_scalar protected: longlong value; public: - cmp_item_temporal() {} + cmp_item_temporal() = default; int compare(cmp_item *ci); }; @@ -1846,7 +1845,7 @@ class cmp_item_real : public cmp_item_scalar { double value; public: - cmp_item_real() {} /* Remove gcc warning */ + cmp_item_real() = default; /* Remove gcc warning */ void store_value(Item *item) { value= item->val_real(); @@ -1876,7 +1875,7 @@ class cmp_item_decimal : public cmp_item_scalar { my_decimal value; public: - cmp_item_decimal() {} /* Remove gcc warning */ + cmp_item_decimal() = default; /* Remove gcc warning */ void store_value(Item *item); int cmp(Item *arg); int cmp_not_null(const Value *val); @@ -3212,6 +3211,9 @@ public: Item *build_clone(THD *thd) override; bool excl_dep_on_table(table_map tab_map) override; bool excl_dep_on_grouping_fields(st_select_lex *sel) override; + +private: + void merge_sub_condition(List_iterator<Item>& li); }; template <template<class> class LI, class T> class Item_equal_iterator; @@ -3715,8 +3717,8 @@ Item *and_expressions(Item *a, Item *b, Item **org_item); class Comp_creator { public: - Comp_creator() {} /* Remove gcc warning */ - virtual ~Comp_creator() {} /* Remove gcc warning */ + Comp_creator() = default; /* Remove gcc warning */ + virtual ~Comp_creator() = default; /* Remove gcc warning */ /** Create operation with given arguments. */ @@ -3735,8 +3737,8 @@ public: class Eq_creator :public Comp_creator { public: - Eq_creator() {} /* Remove gcc warning */ - virtual ~Eq_creator() {} /* Remove gcc warning */ + Eq_creator() = default; /* Remove gcc warning */ + virtual ~Eq_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? "<>" : "="; } @@ -3747,8 +3749,8 @@ public: class Ne_creator :public Comp_creator { public: - Ne_creator() {} /* Remove gcc warning */ - virtual ~Ne_creator() {} /* Remove gcc warning */ + Ne_creator() = default; /* Remove gcc warning */ + virtual ~Ne_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? "=" : "<>"; } @@ -3759,8 +3761,8 @@ public: class Gt_creator :public Comp_creator { public: - Gt_creator() {} /* Remove gcc warning */ - virtual ~Gt_creator() {} /* Remove gcc warning */ + Gt_creator() = default; /* Remove gcc warning */ + virtual ~Gt_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? "<=" : ">"; } @@ -3771,8 +3773,8 @@ public: class Lt_creator :public Comp_creator { public: - Lt_creator() {} /* Remove gcc warning */ - virtual ~Lt_creator() {} /* Remove gcc warning */ + Lt_creator() = default; /* Remove gcc warning */ + virtual ~Lt_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? ">=" : "<"; } @@ -3783,8 +3785,8 @@ public: class Ge_creator :public Comp_creator { public: - Ge_creator() {} /* Remove gcc warning */ - virtual ~Ge_creator() {} /* Remove gcc warning */ + Ge_creator() = default; /* Remove gcc warning */ + virtual ~Ge_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? "<" : ">="; } @@ -3795,8 +3797,8 @@ public: class Le_creator :public Comp_creator { public: - Le_creator() {} /* Remove gcc warning */ - virtual ~Le_creator() {} /* Remove gcc warning */ + Le_creator() = default; /* Remove gcc warning */ + virtual ~Le_creator() = default; /* Remove gcc warning */ Item_bool_rowready_func2* create(THD *thd, Item *a, Item *b) const; Item_bool_rowready_func2* create_swap(THD *thd, Item *a, Item *b) const; const char* symbol(bool invert) const { return invert? ">" : "<="; } diff --git a/sql/item_create.cc b/sql/item_create.cc index 14731e3ddac..0e2bcc7b1be 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -90,9 +90,9 @@ public: protected: /** Constructor. */ - Create_sp_func() {} + Create_sp_func() = default; /** Destructor. */ - virtual ~Create_sp_func() {} + virtual ~Create_sp_func() = default; }; @@ -110,8 +110,8 @@ public: static Create_func_abs s_singleton; protected: - Create_func_abs() {} - virtual ~Create_func_abs() {} + Create_func_abs() = default; + virtual ~Create_func_abs() = default; }; @@ -123,8 +123,8 @@ public: static Create_func_acos s_singleton; protected: - Create_func_acos() {} - virtual ~Create_func_acos() {} + Create_func_acos() = default; + virtual ~Create_func_acos() = default; }; @@ -136,8 +136,8 @@ public: static Create_func_addtime s_singleton; protected: - Create_func_addtime() {} - virtual ~Create_func_addtime() {} + Create_func_addtime() = default; + virtual ~Create_func_addtime() = default; }; @@ -149,8 +149,8 @@ public: static Create_func_aes_encrypt s_singleton; protected: - Create_func_aes_encrypt() {} - virtual ~Create_func_aes_encrypt() {} + Create_func_aes_encrypt() = default; + virtual ~Create_func_aes_encrypt() = default; }; @@ -162,8 +162,8 @@ public: static Create_func_aes_decrypt s_singleton; protected: - Create_func_aes_decrypt() {} - virtual ~Create_func_aes_decrypt() {} + Create_func_aes_decrypt() = default; + virtual ~Create_func_aes_decrypt() = default; }; @@ -175,8 +175,8 @@ public: static Create_func_asin s_singleton; protected: - Create_func_asin() {} - virtual ~Create_func_asin() {} + Create_func_asin() = default; + virtual ~Create_func_asin() = default; }; @@ -189,8 +189,8 @@ public: static Create_func_atan s_singleton; protected: - Create_func_atan() {} - virtual ~Create_func_atan() {} + Create_func_atan() = default; + virtual ~Create_func_atan() = default; }; @@ -202,8 +202,8 @@ public: static Create_func_benchmark s_singleton; protected: - Create_func_benchmark() {} - virtual ~Create_func_benchmark() {} + Create_func_benchmark() = default; + virtual ~Create_func_benchmark() = default; }; @@ -215,8 +215,8 @@ public: static Create_func_bin s_singleton; protected: - Create_func_bin() {} - virtual ~Create_func_bin() {} + Create_func_bin() = default; + virtual ~Create_func_bin() = default; }; @@ -228,8 +228,8 @@ public: static Create_func_binlog_gtid_pos s_singleton; protected: - Create_func_binlog_gtid_pos() {} - virtual ~Create_func_binlog_gtid_pos() {} + Create_func_binlog_gtid_pos() = default; + virtual ~Create_func_binlog_gtid_pos() = default; }; @@ -241,8 +241,8 @@ public: static Create_func_bit_count s_singleton; protected: - Create_func_bit_count() {} - virtual ~Create_func_bit_count() {} + Create_func_bit_count() = default; + virtual ~Create_func_bit_count() = default; }; @@ -254,8 +254,8 @@ public: static Create_func_bit_length s_singleton; protected: - Create_func_bit_length() {} - virtual ~Create_func_bit_length() {} + Create_func_bit_length() = default; + virtual ~Create_func_bit_length() = default; }; @@ -267,8 +267,8 @@ public: static Create_func_ceiling s_singleton; protected: - Create_func_ceiling() {} - virtual ~Create_func_ceiling() {} + Create_func_ceiling() = default; + virtual ~Create_func_ceiling() = default; }; @@ -280,8 +280,8 @@ public: static Create_func_chr s_singleton; protected: - Create_func_chr() {} - virtual ~Create_func_chr() {} + Create_func_chr() = default; + virtual ~Create_func_chr() = default; }; @@ -293,8 +293,8 @@ public: static Create_func_char_length s_singleton; protected: - Create_func_char_length() {} - virtual ~Create_func_char_length() {} + Create_func_char_length() = default; + virtual ~Create_func_char_length() = default; }; @@ -306,8 +306,8 @@ public: static Create_func_coercibility s_singleton; protected: - Create_func_coercibility() {} - virtual ~Create_func_coercibility() {} + Create_func_coercibility() = default; + virtual ~Create_func_coercibility() = default; }; class Create_func_dyncol_check : public Create_func_arg1 @@ -318,8 +318,8 @@ public: static Create_func_dyncol_check s_singleton; protected: - Create_func_dyncol_check() {} - virtual ~Create_func_dyncol_check() {} + Create_func_dyncol_check() = default; + virtual ~Create_func_dyncol_check() = default; }; class Create_func_dyncol_exists : public Create_func_arg2 @@ -330,8 +330,8 @@ public: static Create_func_dyncol_exists s_singleton; protected: - Create_func_dyncol_exists() {} - virtual ~Create_func_dyncol_exists() {} + Create_func_dyncol_exists() = default; + virtual ~Create_func_dyncol_exists() = default; }; class Create_func_dyncol_list : public Create_func_arg1 @@ -342,8 +342,8 @@ public: static Create_func_dyncol_list s_singleton; protected: - Create_func_dyncol_list() {} - virtual ~Create_func_dyncol_list() {} + Create_func_dyncol_list() = default; + virtual ~Create_func_dyncol_list() = default; }; class Create_func_dyncol_json : public Create_func_arg1 @@ -354,8 +354,8 @@ public: static Create_func_dyncol_json s_singleton; protected: - Create_func_dyncol_json() {} - virtual ~Create_func_dyncol_json() {} + Create_func_dyncol_json() = default; + virtual ~Create_func_dyncol_json() = default; }; @@ -367,8 +367,8 @@ public: static Create_func_compress s_singleton; protected: - Create_func_compress() {} - virtual ~Create_func_compress() {} + Create_func_compress() = default; + virtual ~Create_func_compress() = default; }; @@ -381,8 +381,8 @@ public: static Create_func_concat s_singleton; protected: - Create_func_concat() {} - virtual ~Create_func_concat() {} + Create_func_concat() = default; + virtual ~Create_func_concat() = default; }; @@ -395,8 +395,8 @@ public: static Create_func_concat_operator_oracle s_singleton; protected: - Create_func_concat_operator_oracle() {} - virtual ~Create_func_concat_operator_oracle() {} + Create_func_concat_operator_oracle() = default; + virtual ~Create_func_concat_operator_oracle() = default; }; @@ -408,8 +408,8 @@ public: static Create_func_decode_histogram s_singleton; protected: - Create_func_decode_histogram() {} - virtual ~Create_func_decode_histogram() {} + Create_func_decode_histogram() = default; + virtual ~Create_func_decode_histogram() = default; }; @@ -422,8 +422,8 @@ public: static Create_func_decode_oracle s_singleton; protected: - Create_func_decode_oracle() {} - virtual ~Create_func_decode_oracle() {} + Create_func_decode_oracle() = default; + virtual ~Create_func_decode_oracle() = default; }; @@ -436,8 +436,8 @@ public: static Create_func_concat_ws s_singleton; protected: - Create_func_concat_ws() {} - virtual ~Create_func_concat_ws() {} + Create_func_concat_ws() = default; + virtual ~Create_func_concat_ws() = default; }; @@ -449,8 +449,8 @@ public: static Create_func_connection_id s_singleton; protected: - Create_func_connection_id() {} - virtual ~Create_func_connection_id() {} + Create_func_connection_id() = default; + virtual ~Create_func_connection_id() = default; }; @@ -462,8 +462,8 @@ public: static Create_func_nvl2 s_singleton; protected: - Create_func_nvl2() {} - virtual ~Create_func_nvl2() {} + Create_func_nvl2() = default; + virtual ~Create_func_nvl2() = default; }; @@ -475,8 +475,8 @@ public: static Create_func_conv s_singleton; protected: - Create_func_conv() {} - virtual ~Create_func_conv() {} + Create_func_conv() = default; + virtual ~Create_func_conv() = default; }; @@ -488,8 +488,8 @@ public: static Create_func_convert_tz s_singleton; protected: - Create_func_convert_tz() {} - virtual ~Create_func_convert_tz() {} + Create_func_convert_tz() = default; + virtual ~Create_func_convert_tz() = default; }; @@ -501,8 +501,8 @@ public: static Create_func_cos s_singleton; protected: - Create_func_cos() {} - virtual ~Create_func_cos() {} + Create_func_cos() = default; + virtual ~Create_func_cos() = default; }; @@ -514,8 +514,8 @@ public: static Create_func_cot s_singleton; protected: - Create_func_cot() {} - virtual ~Create_func_cot() {} + Create_func_cot() = default; + virtual ~Create_func_cot() = default; }; @@ -528,8 +528,8 @@ public: static Create_func_crc32 s_singleton; protected: - Create_func_crc32() {} - virtual ~Create_func_crc32() {} + Create_func_crc32() = default; + virtual ~Create_func_crc32() = default; }; @@ -542,8 +542,8 @@ public: static Create_func_crc32c s_singleton; protected: - Create_func_crc32c() {} - virtual ~Create_func_crc32c() {} + Create_func_crc32c() = default; + virtual ~Create_func_crc32c() = default; }; @@ -555,8 +555,8 @@ public: static Create_func_datediff s_singleton; protected: - Create_func_datediff() {} - virtual ~Create_func_datediff() {} + Create_func_datediff() = default; + virtual ~Create_func_datediff() = default; }; @@ -568,8 +568,8 @@ public: static Create_func_dayname s_singleton; protected: - Create_func_dayname() {} - virtual ~Create_func_dayname() {} + Create_func_dayname() = default; + virtual ~Create_func_dayname() = default; }; @@ -581,8 +581,8 @@ public: static Create_func_dayofmonth s_singleton; protected: - Create_func_dayofmonth() {} - virtual ~Create_func_dayofmonth() {} + Create_func_dayofmonth() = default; + virtual ~Create_func_dayofmonth() = default; }; @@ -594,8 +594,8 @@ public: static Create_func_dayofweek s_singleton; protected: - Create_func_dayofweek() {} - virtual ~Create_func_dayofweek() {} + Create_func_dayofweek() = default; + virtual ~Create_func_dayofweek() = default; }; @@ -607,8 +607,8 @@ public: static Create_func_dayofyear s_singleton; protected: - Create_func_dayofyear() {} - virtual ~Create_func_dayofyear() {} + Create_func_dayofyear() = default; + virtual ~Create_func_dayofyear() = default; }; @@ -620,8 +620,8 @@ public: static Create_func_degrees s_singleton; protected: - Create_func_degrees() {} - virtual ~Create_func_degrees() {} + Create_func_degrees() = default; + virtual ~Create_func_degrees() = default; }; @@ -634,8 +634,8 @@ public: static Create_func_des_decrypt s_singleton; protected: - Create_func_des_decrypt() {} - virtual ~Create_func_des_decrypt() {} + Create_func_des_decrypt() = default; + virtual ~Create_func_des_decrypt() = default; }; @@ -648,8 +648,8 @@ public: static Create_func_des_encrypt s_singleton; protected: - Create_func_des_encrypt() {} - virtual ~Create_func_des_encrypt() {} + Create_func_des_encrypt() = default; + virtual ~Create_func_des_encrypt() = default; }; @@ -662,8 +662,8 @@ public: static Create_func_elt s_singleton; protected: - Create_func_elt() {} - virtual ~Create_func_elt() {} + Create_func_elt() = default; + virtual ~Create_func_elt() = default; }; @@ -675,8 +675,8 @@ public: static Create_func_encode s_singleton; protected: - Create_func_encode() {} - virtual ~Create_func_encode() {} + Create_func_encode() = default; + virtual ~Create_func_encode() = default; }; @@ -689,8 +689,8 @@ public: static Create_func_encrypt s_singleton; protected: - Create_func_encrypt() {} - virtual ~Create_func_encrypt() {} + Create_func_encrypt() = default; + virtual ~Create_func_encrypt() = default; }; @@ -702,8 +702,8 @@ public: static Create_func_exp s_singleton; protected: - Create_func_exp() {} - virtual ~Create_func_exp() {} + Create_func_exp() = default; + virtual ~Create_func_exp() = default; }; @@ -716,8 +716,8 @@ public: static Create_func_export_set s_singleton; protected: - Create_func_export_set() {} - virtual ~Create_func_export_set() {} + Create_func_export_set() = default; + virtual ~Create_func_export_set() = default; }; @@ -730,8 +730,8 @@ public: static Create_func_field s_singleton; protected: - Create_func_field() {} - virtual ~Create_func_field() {} + Create_func_field() = default; + virtual ~Create_func_field() = default; }; @@ -743,8 +743,8 @@ public: static Create_func_find_in_set s_singleton; protected: - Create_func_find_in_set() {} - virtual ~Create_func_find_in_set() {} + Create_func_find_in_set() = default; + virtual ~Create_func_find_in_set() = default; }; @@ -756,8 +756,8 @@ public: static Create_func_floor s_singleton; protected: - Create_func_floor() {} - virtual ~Create_func_floor() {} + Create_func_floor() = default; + virtual ~Create_func_floor() = default; }; @@ -770,8 +770,8 @@ public: static Create_func_format s_singleton; protected: - Create_func_format() {} - virtual ~Create_func_format() {} + Create_func_format() = default; + virtual ~Create_func_format() = default; }; @@ -783,8 +783,8 @@ public: static Create_func_found_rows s_singleton; protected: - Create_func_found_rows() {} - virtual ~Create_func_found_rows() {} + Create_func_found_rows() = default; + virtual ~Create_func_found_rows() = default; }; @@ -796,8 +796,8 @@ public: static Create_func_from_base64 s_singleton; protected: - Create_func_from_base64() {} - virtual ~Create_func_from_base64() {} + Create_func_from_base64() = default; + virtual ~Create_func_from_base64() = default; }; @@ -809,8 +809,8 @@ public: static Create_func_from_days s_singleton; protected: - Create_func_from_days() {} - virtual ~Create_func_from_days() {} + Create_func_from_days() = default; + virtual ~Create_func_from_days() = default; }; @@ -823,8 +823,8 @@ public: static Create_func_from_unixtime s_singleton; protected: - Create_func_from_unixtime() {} - virtual ~Create_func_from_unixtime() {} + Create_func_from_unixtime() = default; + virtual ~Create_func_from_unixtime() = default; }; @@ -836,8 +836,8 @@ public: static Create_func_get_lock s_singleton; protected: - Create_func_get_lock() {} - virtual ~Create_func_get_lock() {} + Create_func_get_lock() = default; + virtual ~Create_func_get_lock() = default; }; @@ -850,8 +850,8 @@ public: static Create_func_greatest s_singleton; protected: - Create_func_greatest() {} - virtual ~Create_func_greatest() {} + Create_func_greatest() = default; + virtual ~Create_func_greatest() = default; }; @@ -863,8 +863,8 @@ public: static Create_func_hex s_singleton; protected: - Create_func_hex() {} - virtual ~Create_func_hex() {} + Create_func_hex() = default; + virtual ~Create_func_hex() = default; }; @@ -876,8 +876,8 @@ public: static Create_func_ifnull s_singleton; protected: - Create_func_ifnull() {} - virtual ~Create_func_ifnull() {} + Create_func_ifnull() = default; + virtual ~Create_func_ifnull() = default; }; @@ -889,8 +889,8 @@ public: static Create_func_instr s_singleton; protected: - Create_func_instr() {} - virtual ~Create_func_instr() {} + Create_func_instr() = default; + virtual ~Create_func_instr() = default; }; @@ -902,8 +902,8 @@ public: static Create_func_is_free_lock s_singleton; protected: - Create_func_is_free_lock() {} - virtual ~Create_func_is_free_lock() {} + Create_func_is_free_lock() = default; + virtual ~Create_func_is_free_lock() = default; }; @@ -915,8 +915,8 @@ public: static Create_func_is_used_lock s_singleton; protected: - Create_func_is_used_lock() {} - virtual ~Create_func_is_used_lock() {} + Create_func_is_used_lock() = default; + virtual ~Create_func_is_used_lock() = default; }; @@ -928,8 +928,8 @@ public: static Create_func_isnull s_singleton; protected: - Create_func_isnull() {} - virtual ~Create_func_isnull() {} + Create_func_isnull() = default; + virtual ~Create_func_isnull() = default; }; @@ -941,8 +941,8 @@ public: static Create_func_json_normalize s_singleton; protected: - Create_func_json_normalize() {} - virtual ~Create_func_json_normalize() {} + Create_func_json_normalize() = default; + virtual ~Create_func_json_normalize() = default; }; @@ -954,8 +954,8 @@ public: static Create_func_json_equals s_singleton; protected: - Create_func_json_equals() {} - virtual ~Create_func_json_equals() {} + Create_func_json_equals() = default; + virtual ~Create_func_json_equals() = default; }; @@ -967,8 +967,8 @@ public: static Create_func_json_exists s_singleton; protected: - Create_func_json_exists() {} - virtual ~Create_func_json_exists() {} + Create_func_json_exists() = default; + virtual ~Create_func_json_exists() = default; }; @@ -980,8 +980,8 @@ public: static Create_func_json_valid s_singleton; protected: - Create_func_json_valid() {} - virtual ~Create_func_json_valid() {} + Create_func_json_valid() = default; + virtual ~Create_func_json_valid() = default; }; @@ -993,8 +993,8 @@ public: static Create_func_json_compact s_singleton; protected: - Create_func_json_compact() {} - virtual ~Create_func_json_compact() {} + Create_func_json_compact() = default; + virtual ~Create_func_json_compact() = default; }; @@ -1006,8 +1006,8 @@ public: static Create_func_json_loose s_singleton; protected: - Create_func_json_loose() {} - virtual ~Create_func_json_loose() {} + Create_func_json_loose() = default; + virtual ~Create_func_json_loose() = default; }; @@ -1020,8 +1020,8 @@ public: static Create_func_json_detailed s_singleton; protected: - Create_func_json_detailed() {} - virtual ~Create_func_json_detailed() {} + Create_func_json_detailed() = default; + virtual ~Create_func_json_detailed() = default; }; @@ -1033,8 +1033,8 @@ public: static Create_func_json_type s_singleton; protected: - Create_func_json_type() {} - virtual ~Create_func_json_type() {} + Create_func_json_type() = default; + virtual ~Create_func_json_type() = default; }; @@ -1046,8 +1046,8 @@ public: static Create_func_json_depth s_singleton; protected: - Create_func_json_depth() {} - virtual ~Create_func_json_depth() {} + Create_func_json_depth() = default; + virtual ~Create_func_json_depth() = default; }; @@ -1059,8 +1059,8 @@ public: static Create_func_json_value s_singleton; protected: - Create_func_json_value() {} - virtual ~Create_func_json_value() {} + Create_func_json_value() = default; + virtual ~Create_func_json_value() = default; }; @@ -1072,8 +1072,8 @@ public: static Create_func_json_query s_singleton; protected: - Create_func_json_query() {} - virtual ~Create_func_json_query() {} + Create_func_json_query() = default; + virtual ~Create_func_json_query() = default; }; @@ -1086,8 +1086,8 @@ public: static Create_func_json_keys s_singleton; protected: - Create_func_json_keys() {} - virtual ~Create_func_json_keys() {} + Create_func_json_keys() = default; + virtual ~Create_func_json_keys() = default; }; @@ -1100,8 +1100,8 @@ public: static Create_func_json_contains s_singleton; protected: - Create_func_json_contains() {} - virtual ~Create_func_json_contains() {} + Create_func_json_contains() = default; + virtual ~Create_func_json_contains() = default; }; @@ -1114,8 +1114,8 @@ public: static Create_func_json_contains_path s_singleton; protected: - Create_func_json_contains_path() {} - virtual ~Create_func_json_contains_path() {} + Create_func_json_contains_path() = default; + virtual ~Create_func_json_contains_path() = default; }; @@ -1128,8 +1128,8 @@ public: static Create_func_json_extract s_singleton; protected: - Create_func_json_extract() {} - virtual ~Create_func_json_extract() {} + Create_func_json_extract() = default; + virtual ~Create_func_json_extract() = default; }; @@ -1142,8 +1142,8 @@ public: static Create_func_json_search s_singleton; protected: - Create_func_json_search() {} - virtual ~Create_func_json_search() {} + Create_func_json_search() = default; + virtual ~Create_func_json_search() = default; }; @@ -1156,8 +1156,8 @@ public: static Create_func_json_array s_singleton; protected: - Create_func_json_array() {} - virtual ~Create_func_json_array() {} + Create_func_json_array() = default; + virtual ~Create_func_json_array() = default; }; @@ -1170,8 +1170,8 @@ public: static Create_func_json_array_append s_singleton; protected: - Create_func_json_array_append() {} - virtual ~Create_func_json_array_append() {} + Create_func_json_array_append() = default; + virtual ~Create_func_json_array_append() = default; }; @@ -1184,8 +1184,8 @@ public: static Create_func_json_array_insert s_singleton; protected: - Create_func_json_array_insert() {} - virtual ~Create_func_json_array_insert() {} + Create_func_json_array_insert() = default; + virtual ~Create_func_json_array_insert() = default; }; @@ -1198,8 +1198,8 @@ public: static Create_func_json_insert s_singleton; protected: - Create_func_json_insert() {} - virtual ~Create_func_json_insert() {} + Create_func_json_insert() = default; + virtual ~Create_func_json_insert() = default; }; @@ -1212,8 +1212,8 @@ public: static Create_func_json_set s_singleton; protected: - Create_func_json_set() {} - virtual ~Create_func_json_set() {} + Create_func_json_set() = default; + virtual ~Create_func_json_set() = default; }; @@ -1226,8 +1226,8 @@ public: static Create_func_json_replace s_singleton; protected: - Create_func_json_replace() {} - virtual ~Create_func_json_replace() {} + Create_func_json_replace() = default; + virtual ~Create_func_json_replace() = default; }; @@ -1240,8 +1240,8 @@ public: static Create_func_json_remove s_singleton; protected: - Create_func_json_remove() {} - virtual ~Create_func_json_remove() {} + Create_func_json_remove() = default; + virtual ~Create_func_json_remove() = default; }; @@ -1254,8 +1254,8 @@ public: static Create_func_json_object s_singleton; protected: - Create_func_json_object() {} - virtual ~Create_func_json_object() {} + Create_func_json_object() = default; + virtual ~Create_func_json_object() = default; }; @@ -1268,8 +1268,8 @@ public: static Create_func_json_length s_singleton; protected: - Create_func_json_length() {} - virtual ~Create_func_json_length() {} + Create_func_json_length() = default; + virtual ~Create_func_json_length() = default; }; @@ -1282,8 +1282,8 @@ public: static Create_func_json_merge s_singleton; protected: - Create_func_json_merge() {} - virtual ~Create_func_json_merge() {} + Create_func_json_merge() = default; + virtual ~Create_func_json_merge() = default; }; @@ -1296,8 +1296,8 @@ public: static Create_func_json_merge_patch s_singleton; protected: - Create_func_json_merge_patch() {} - virtual ~Create_func_json_merge_patch() {} + Create_func_json_merge_patch() = default; + virtual ~Create_func_json_merge_patch() = default; }; @@ -1309,8 +1309,8 @@ public: static Create_func_json_quote s_singleton; protected: - Create_func_json_quote() {} - virtual ~Create_func_json_quote() {} + Create_func_json_quote() = default; + virtual ~Create_func_json_quote() = default; }; @@ -1322,8 +1322,8 @@ public: static Create_func_json_unquote s_singleton; protected: - Create_func_json_unquote() {} - virtual ~Create_func_json_unquote() {} + Create_func_json_unquote() = default; + virtual ~Create_func_json_unquote() = default; }; @@ -1348,8 +1348,8 @@ public: static Create_func_last_day s_singleton; protected: - Create_func_last_day() {} - virtual ~Create_func_last_day() {} + Create_func_last_day() = default; + virtual ~Create_func_last_day() = default; }; @@ -1362,8 +1362,8 @@ public: static Create_func_last_insert_id s_singleton; protected: - Create_func_last_insert_id() {} - virtual ~Create_func_last_insert_id() {} + Create_func_last_insert_id() = default; + virtual ~Create_func_last_insert_id() = default; }; @@ -1375,8 +1375,8 @@ public: static Create_func_lcase s_singleton; protected: - Create_func_lcase() {} - virtual ~Create_func_lcase() {} + Create_func_lcase() = default; + virtual ~Create_func_lcase() = default; }; @@ -1389,8 +1389,8 @@ public: static Create_func_least s_singleton; protected: - Create_func_least() {} - virtual ~Create_func_least() {} + Create_func_least() = default; + virtual ~Create_func_least() = default; }; @@ -1402,8 +1402,8 @@ public: static Create_func_length s_singleton; protected: - Create_func_length() {} - virtual ~Create_func_length() {} + Create_func_length() = default; + virtual ~Create_func_length() = default; }; class Create_func_octet_length : public Create_func_arg1 @@ -1414,8 +1414,8 @@ public: static Create_func_octet_length s_singleton; protected: - Create_func_octet_length() {} - virtual ~Create_func_octet_length() {} + Create_func_octet_length() = default; + virtual ~Create_func_octet_length() = default; }; @@ -1428,8 +1428,8 @@ public: static Create_func_like_range_min s_singleton; protected: - Create_func_like_range_min() {} - virtual ~Create_func_like_range_min() {} + Create_func_like_range_min() = default; + virtual ~Create_func_like_range_min() = default; }; @@ -1441,8 +1441,8 @@ public: static Create_func_like_range_max s_singleton; protected: - Create_func_like_range_max() {} - virtual ~Create_func_like_range_max() {} + Create_func_like_range_max() = default; + virtual ~Create_func_like_range_max() = default; }; #endif @@ -1455,8 +1455,8 @@ public: static Create_func_ln s_singleton; protected: - Create_func_ln() {} - virtual ~Create_func_ln() {} + Create_func_ln() = default; + virtual ~Create_func_ln() = default; }; @@ -1468,8 +1468,8 @@ public: static Create_func_load_file s_singleton; protected: - Create_func_load_file() {} - virtual ~Create_func_load_file() {} + Create_func_load_file() = default; + virtual ~Create_func_load_file() = default; }; @@ -1482,8 +1482,8 @@ public: static Create_func_locate s_singleton; protected: - Create_func_locate() {} - virtual ~Create_func_locate() {} + Create_func_locate() = default; + virtual ~Create_func_locate() = default; }; @@ -1496,8 +1496,8 @@ public: static Create_func_log s_singleton; protected: - Create_func_log() {} - virtual ~Create_func_log() {} + Create_func_log() = default; + virtual ~Create_func_log() = default; }; @@ -1509,8 +1509,8 @@ public: static Create_func_log10 s_singleton; protected: - Create_func_log10() {} - virtual ~Create_func_log10() {} + Create_func_log10() = default; + virtual ~Create_func_log10() = default; }; @@ -1522,8 +1522,8 @@ public: static Create_func_log2 s_singleton; protected: - Create_func_log2() {} - virtual ~Create_func_log2() {} + Create_func_log2() = default; + virtual ~Create_func_log2() = default; }; @@ -1540,8 +1540,8 @@ public: static Create_func_lpad s_singleton; protected: - Create_func_lpad() {} - virtual ~Create_func_lpad() {} + Create_func_lpad() = default; + virtual ~Create_func_lpad() = default; Item *create_native_std(THD *thd, const LEX_CSTRING *name, List<Item> *items); Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, @@ -1569,8 +1569,8 @@ public: static Create_func_ltrim s_singleton; protected: - Create_func_ltrim() {} - virtual ~Create_func_ltrim() {} + Create_func_ltrim() = default; + virtual ~Create_func_ltrim() = default; }; @@ -1582,8 +1582,8 @@ public: static Create_func_ltrim_oracle s_singleton; protected: - Create_func_ltrim_oracle() {} - virtual ~Create_func_ltrim_oracle() {} + Create_func_ltrim_oracle() = default; + virtual ~Create_func_ltrim_oracle() = default; }; @@ -1595,8 +1595,8 @@ public: static Create_func_makedate s_singleton; protected: - Create_func_makedate() {} - virtual ~Create_func_makedate() {} + Create_func_makedate() = default; + virtual ~Create_func_makedate() = default; }; @@ -1608,8 +1608,8 @@ public: static Create_func_maketime s_singleton; protected: - Create_func_maketime() {} - virtual ~Create_func_maketime() {} + Create_func_maketime() = default; + virtual ~Create_func_maketime() = default; }; @@ -1622,8 +1622,8 @@ public: static Create_func_make_set s_singleton; protected: - Create_func_make_set() {} - virtual ~Create_func_make_set() {} + Create_func_make_set() = default; + virtual ~Create_func_make_set() = default; }; @@ -1636,8 +1636,8 @@ public: static Create_func_master_pos_wait s_singleton; protected: - Create_func_master_pos_wait() {} - virtual ~Create_func_master_pos_wait() {} + Create_func_master_pos_wait() = default; + virtual ~Create_func_master_pos_wait() = default; }; @@ -1650,8 +1650,8 @@ public: static Create_func_master_gtid_wait s_singleton; protected: - Create_func_master_gtid_wait() {} - virtual ~Create_func_master_gtid_wait() {} + Create_func_master_gtid_wait() = default; + virtual ~Create_func_master_gtid_wait() = default; }; @@ -1663,8 +1663,8 @@ public: static Create_func_md5 s_singleton; protected: - Create_func_md5() {} - virtual ~Create_func_md5() {} + Create_func_md5() = default; + virtual ~Create_func_md5() = default; }; @@ -1676,8 +1676,8 @@ public: static Create_func_monthname s_singleton; protected: - Create_func_monthname() {} - virtual ~Create_func_monthname() {} + Create_func_monthname() = default; + virtual ~Create_func_monthname() = default; }; @@ -1689,8 +1689,8 @@ public: static Create_func_name_const s_singleton; protected: - Create_func_name_const() {} - virtual ~Create_func_name_const() {} + Create_func_name_const() = default; + virtual ~Create_func_name_const() = default; }; class Create_func_natural_sort_key : public Create_func_arg1 @@ -1699,8 +1699,8 @@ public: virtual Item *create_1_arg(THD *thd, Item *arg1) override; static Create_func_natural_sort_key s_singleton; protected: - Create_func_natural_sort_key() {} - virtual ~Create_func_natural_sort_key() {} + Create_func_natural_sort_key() = default; + virtual ~Create_func_natural_sort_key() = default; }; class Create_func_nullif : public Create_func_arg2 @@ -1711,8 +1711,8 @@ public: static Create_func_nullif s_singleton; protected: - Create_func_nullif() {} - virtual ~Create_func_nullif() {} + Create_func_nullif() = default; + virtual ~Create_func_nullif() = default; }; @@ -1724,8 +1724,8 @@ public: static Create_func_oct s_singleton; protected: - Create_func_oct() {} - virtual ~Create_func_oct() {} + Create_func_oct() = default; + virtual ~Create_func_oct() = default; }; @@ -1737,8 +1737,8 @@ public: static Create_func_ord s_singleton; protected: - Create_func_ord() {} - virtual ~Create_func_ord() {} + Create_func_ord() = default; + virtual ~Create_func_ord() = default; }; @@ -1750,8 +1750,8 @@ public: static Create_func_period_add s_singleton; protected: - Create_func_period_add() {} - virtual ~Create_func_period_add() {} + Create_func_period_add() = default; + virtual ~Create_func_period_add() = default; }; @@ -1763,8 +1763,8 @@ public: static Create_func_period_diff s_singleton; protected: - Create_func_period_diff() {} - virtual ~Create_func_period_diff() {} + Create_func_period_diff() = default; + virtual ~Create_func_period_diff() = default; }; @@ -1776,8 +1776,8 @@ public: static Create_func_pi s_singleton; protected: - Create_func_pi() {} - virtual ~Create_func_pi() {} + Create_func_pi() = default; + virtual ~Create_func_pi() = default; }; @@ -1789,8 +1789,8 @@ public: static Create_func_pow s_singleton; protected: - Create_func_pow() {} - virtual ~Create_func_pow() {} + Create_func_pow() = default; + virtual ~Create_func_pow() = default; }; @@ -1802,8 +1802,8 @@ public: static Create_func_quote s_singleton; protected: - Create_func_quote() {} - virtual ~Create_func_quote() {} + Create_func_quote() = default; + virtual ~Create_func_quote() = default; }; @@ -1815,8 +1815,8 @@ public: static Create_func_regexp_instr s_singleton; protected: - Create_func_regexp_instr() {} - virtual ~Create_func_regexp_instr() {} + Create_func_regexp_instr() = default; + virtual ~Create_func_regexp_instr() = default; }; @@ -1828,8 +1828,8 @@ public: static Create_func_regexp_replace s_singleton; protected: - Create_func_regexp_replace() {} - virtual ~Create_func_regexp_replace() {} + Create_func_regexp_replace() = default; + virtual ~Create_func_regexp_replace() = default; }; @@ -1841,8 +1841,8 @@ public: static Create_func_regexp_substr s_singleton; protected: - Create_func_regexp_substr() {} - virtual ~Create_func_regexp_substr() {} + Create_func_regexp_substr() = default; + virtual ~Create_func_regexp_substr() = default; }; @@ -1854,8 +1854,8 @@ public: static Create_func_radians s_singleton; protected: - Create_func_radians() {} - virtual ~Create_func_radians() {} + Create_func_radians() = default; + virtual ~Create_func_radians() = default; }; @@ -1868,8 +1868,8 @@ public: static Create_func_rand s_singleton; protected: - Create_func_rand() {} - virtual ~Create_func_rand() {} + Create_func_rand() = default; + virtual ~Create_func_rand() = default; }; @@ -1903,8 +1903,8 @@ public: static Create_func_release_lock s_singleton; protected: - Create_func_release_lock() {} - virtual ~Create_func_release_lock() {} + Create_func_release_lock() = default; + virtual ~Create_func_release_lock() = default; }; @@ -1916,8 +1916,8 @@ public: static Create_func_replace_oracle s_singleton; protected: - Create_func_replace_oracle() {} - virtual ~Create_func_replace_oracle() {} + Create_func_replace_oracle() = default; + virtual ~Create_func_replace_oracle() = default; }; @@ -1929,8 +1929,8 @@ public: static Create_func_reverse s_singleton; protected: - Create_func_reverse() {} - virtual ~Create_func_reverse() {} + Create_func_reverse() = default; + virtual ~Create_func_reverse() = default; }; @@ -1943,8 +1943,8 @@ public: static Create_func_round s_singleton; protected: - Create_func_round() {} - virtual ~Create_func_round() {} + Create_func_round() = default; + virtual ~Create_func_round() = default; }; @@ -1961,8 +1961,8 @@ public: static Create_func_rpad s_singleton; protected: - Create_func_rpad() {} - virtual ~Create_func_rpad() {} + Create_func_rpad() = default; + virtual ~Create_func_rpad() = default; Item *create_native_std(THD *thd, const LEX_CSTRING *name, List<Item> *items); Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, @@ -1990,8 +1990,8 @@ public: static Create_func_rtrim s_singleton; protected: - Create_func_rtrim() {} - virtual ~Create_func_rtrim() {} + Create_func_rtrim() = default; + virtual ~Create_func_rtrim() = default; }; @@ -2003,8 +2003,8 @@ public: static Create_func_rtrim_oracle s_singleton; protected: - Create_func_rtrim_oracle() {} - virtual ~Create_func_rtrim_oracle() {} + Create_func_rtrim_oracle() = default; + virtual ~Create_func_rtrim_oracle() = default; }; @@ -2016,8 +2016,8 @@ public: static Create_func_sec_to_time s_singleton; protected: - Create_func_sec_to_time() {} - virtual ~Create_func_sec_to_time() {} + Create_func_sec_to_time() = default; + virtual ~Create_func_sec_to_time() = default; }; class Create_func_sformat : public Create_native_func @@ -2027,8 +2027,8 @@ public: override; static Create_func_sformat s_singleton; protected: - Create_func_sformat() {} - virtual ~Create_func_sformat() {} + Create_func_sformat() = default; + virtual ~Create_func_sformat() = default; }; class Create_func_sha : public Create_func_arg1 @@ -2039,8 +2039,8 @@ public: static Create_func_sha s_singleton; protected: - Create_func_sha() {} - virtual ~Create_func_sha() {} + Create_func_sha() = default; + virtual ~Create_func_sha() = default; }; @@ -2052,8 +2052,8 @@ public: static Create_func_sha2 s_singleton; protected: - Create_func_sha2() {} - virtual ~Create_func_sha2() {} + Create_func_sha2() = default; + virtual ~Create_func_sha2() = default; }; @@ -2065,8 +2065,8 @@ public: static Create_func_sign s_singleton; protected: - Create_func_sign() {} - virtual ~Create_func_sign() {} + Create_func_sign() = default; + virtual ~Create_func_sign() = default; }; @@ -2078,8 +2078,8 @@ public: static Create_func_sin s_singleton; protected: - Create_func_sin() {} - virtual ~Create_func_sin() {} + Create_func_sin() = default; + virtual ~Create_func_sin() = default; }; @@ -2091,8 +2091,8 @@ public: static Create_func_sleep s_singleton; protected: - Create_func_sleep() {} - virtual ~Create_func_sleep() {} + Create_func_sleep() = default; + virtual ~Create_func_sleep() = default; }; @@ -2104,8 +2104,8 @@ public: static Create_func_soundex s_singleton; protected: - Create_func_soundex() {} - virtual ~Create_func_soundex() {} + Create_func_soundex() = default; + virtual ~Create_func_soundex() = default; }; @@ -2117,8 +2117,8 @@ public: static Create_func_space s_singleton; protected: - Create_func_space() {} - virtual ~Create_func_space() {} + Create_func_space() = default; + virtual ~Create_func_space() = default; }; @@ -2130,8 +2130,8 @@ public: static Create_func_sqrt s_singleton; protected: - Create_func_sqrt() {} - virtual ~Create_func_sqrt() {} + Create_func_sqrt() = default; + virtual ~Create_func_sqrt() = default; }; @@ -2143,8 +2143,8 @@ public: static Create_func_str_to_date s_singleton; protected: - Create_func_str_to_date() {} - virtual ~Create_func_str_to_date() {} + Create_func_str_to_date() = default; + virtual ~Create_func_str_to_date() = default; }; @@ -2156,8 +2156,8 @@ public: static Create_func_strcmp s_singleton; protected: - Create_func_strcmp() {} - virtual ~Create_func_strcmp() {} + Create_func_strcmp() = default; + virtual ~Create_func_strcmp() = default; }; @@ -2169,8 +2169,8 @@ public: static Create_func_substr_index s_singleton; protected: - Create_func_substr_index() {} - virtual ~Create_func_substr_index() {} + Create_func_substr_index() = default; + virtual ~Create_func_substr_index() = default; }; @@ -2183,8 +2183,8 @@ public: static Create_func_substr_oracle s_singleton; protected: - Create_func_substr_oracle() {} - virtual ~Create_func_substr_oracle() {} + Create_func_substr_oracle() = default; + virtual ~Create_func_substr_oracle() = default; }; @@ -2196,8 +2196,8 @@ public: static Create_func_subtime s_singleton; protected: - Create_func_subtime() {} - virtual ~Create_func_subtime() {} + Create_func_subtime() = default; + virtual ~Create_func_subtime() = default; }; @@ -2209,8 +2209,8 @@ public: static Create_func_tan s_singleton; protected: - Create_func_tan() {} - virtual ~Create_func_tan() {} + Create_func_tan() = default; + virtual ~Create_func_tan() = default; }; @@ -2222,8 +2222,8 @@ public: static Create_func_time_format s_singleton; protected: - Create_func_time_format() {} - virtual ~Create_func_time_format() {} + Create_func_time_format() = default; + virtual ~Create_func_time_format() = default; }; @@ -2235,8 +2235,8 @@ public: static Create_func_time_to_sec s_singleton; protected: - Create_func_time_to_sec() {} - virtual ~Create_func_time_to_sec() {} + Create_func_time_to_sec() = default; + virtual ~Create_func_time_to_sec() = default; }; @@ -2248,8 +2248,8 @@ public: static Create_func_timediff s_singleton; protected: - Create_func_timediff() {} - virtual ~Create_func_timediff() {} + Create_func_timediff() = default; + virtual ~Create_func_timediff() = default; }; @@ -2261,8 +2261,8 @@ public: static Create_func_to_base64 s_singleton; protected: - Create_func_to_base64() {} - virtual ~Create_func_to_base64() {} + Create_func_to_base64() = default; + virtual ~Create_func_to_base64() = default; }; @@ -2275,8 +2275,8 @@ public: static Create_func_to_char s_singleton; protected: - Create_func_to_char() {} - virtual ~Create_func_to_char() {} + Create_func_to_char() = default; + virtual ~Create_func_to_char() = default; }; @@ -2288,8 +2288,8 @@ public: static Create_func_to_days s_singleton; protected: - Create_func_to_days() {} - virtual ~Create_func_to_days() {} + Create_func_to_days() = default; + virtual ~Create_func_to_days() = default; }; class Create_func_to_seconds : public Create_func_arg1 @@ -2300,8 +2300,8 @@ public: static Create_func_to_seconds s_singleton; protected: - Create_func_to_seconds() {} - virtual ~Create_func_to_seconds() {} + Create_func_to_seconds() = default; + virtual ~Create_func_to_seconds() = default; }; @@ -2313,8 +2313,8 @@ public: static Create_func_ucase s_singleton; protected: - Create_func_ucase() {} - virtual ~Create_func_ucase() {} + Create_func_ucase() = default; + virtual ~Create_func_ucase() = default; }; @@ -2326,8 +2326,8 @@ public: static Create_func_uncompress s_singleton; protected: - Create_func_uncompress() {} - virtual ~Create_func_uncompress() {} + Create_func_uncompress() = default; + virtual ~Create_func_uncompress() = default; }; @@ -2339,8 +2339,8 @@ public: static Create_func_uncompressed_length s_singleton; protected: - Create_func_uncompressed_length() {} - virtual ~Create_func_uncompressed_length() {} + Create_func_uncompressed_length() = default; + virtual ~Create_func_uncompressed_length() = default; }; @@ -2352,8 +2352,8 @@ public: static Create_func_unhex s_singleton; protected: - Create_func_unhex() {} - virtual ~Create_func_unhex() {} + Create_func_unhex() = default; + virtual ~Create_func_unhex() = default; }; @@ -2366,8 +2366,8 @@ public: static Create_func_unix_timestamp s_singleton; protected: - Create_func_unix_timestamp() {} - virtual ~Create_func_unix_timestamp() {} + Create_func_unix_timestamp() = default; + virtual ~Create_func_unix_timestamp() = default; }; @@ -2379,8 +2379,8 @@ public: static Create_func_uuid_short s_singleton; protected: - Create_func_uuid_short() {} - virtual ~Create_func_uuid_short() {} + Create_func_uuid_short() = default; + virtual ~Create_func_uuid_short() = default; }; @@ -2392,8 +2392,8 @@ public: static Create_func_version s_singleton; protected: - Create_func_version() {} - virtual ~Create_func_version() {} + Create_func_version() = default; + virtual ~Create_func_version() = default; }; @@ -2405,8 +2405,8 @@ public: static Create_func_weekday s_singleton; protected: - Create_func_weekday() {} - virtual ~Create_func_weekday() {} + Create_func_weekday() = default; + virtual ~Create_func_weekday() = default; }; @@ -2418,8 +2418,8 @@ public: static Create_func_weekofyear s_singleton; protected: - Create_func_weekofyear() {} - virtual ~Create_func_weekofyear() {} + Create_func_weekofyear() = default; + virtual ~Create_func_weekofyear() = default; }; @@ -2432,8 +2432,8 @@ public: static Create_func_wsrep_last_written_gtid s_singleton; protected: - Create_func_wsrep_last_written_gtid() {} - virtual ~Create_func_wsrep_last_written_gtid() {} + Create_func_wsrep_last_written_gtid() = default; + virtual ~Create_func_wsrep_last_written_gtid() = default; }; @@ -2445,8 +2445,8 @@ public: static Create_func_wsrep_last_seen_gtid s_singleton; protected: - Create_func_wsrep_last_seen_gtid() {} - virtual ~Create_func_wsrep_last_seen_gtid() {} + Create_func_wsrep_last_seen_gtid() = default; + virtual ~Create_func_wsrep_last_seen_gtid() = default; }; @@ -2459,8 +2459,8 @@ public: static Create_func_wsrep_sync_wait_upto s_singleton; protected: - Create_func_wsrep_sync_wait_upto() {} - virtual ~Create_func_wsrep_sync_wait_upto() {} + Create_func_wsrep_sync_wait_upto() = default; + virtual ~Create_func_wsrep_sync_wait_upto() = default; }; #endif /* WITH_WSREP */ @@ -2473,8 +2473,8 @@ public: static Create_func_xml_extractvalue s_singleton; protected: - Create_func_xml_extractvalue() {} - virtual ~Create_func_xml_extractvalue() {} + Create_func_xml_extractvalue() = default; + virtual ~Create_func_xml_extractvalue() = default; }; @@ -2486,8 +2486,8 @@ public: static Create_func_xml_update s_singleton; protected: - Create_func_xml_update() {} - virtual ~Create_func_xml_update() {} + Create_func_xml_update() = default; + virtual ~Create_func_xml_update() = default; }; @@ -2500,8 +2500,8 @@ public: static Create_func_year_week s_singleton; protected: - Create_func_year_week() {} - virtual ~Create_func_year_week() {} + Create_func_year_week() = default; + virtual ~Create_func_year_week() = default; }; @@ -3679,6 +3679,13 @@ Create_func_get_lock Create_func_get_lock::s_singleton; Item* Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2) { +#ifdef WITH_WSREP + if (WSREP_ON && WSREP(thd)) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "GET_LOCK in cluster (WSREP_ON=ON)"); + return NULL; + } +#endif /* WITH_WSREP */ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); return new (thd->mem_root) Item_func_get_lock(thd, arg1, arg2); @@ -5013,6 +5020,13 @@ Create_func_release_all_locks Create_func_release_all_locks::s_singleton; Item* Create_func_release_all_locks::create_builder(THD *thd) { +#ifdef WITH_WSREP + if (WSREP_ON && WSREP(thd)) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)"); + return NULL; + } +#endif /* WITH_WSREP */ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); return new (thd->mem_root) Item_func_release_all_locks(thd); @@ -5024,6 +5038,13 @@ Create_func_release_lock Create_func_release_lock::s_singleton; Item* Create_func_release_lock::create_1_arg(THD *thd, Item *arg1) { +#ifdef WITH_WSREP + if (WSREP_ON && WSREP(thd)) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RELEASE_LOCK in cluster (WSREP_ON=ON)"); + return NULL; + } +#endif /* WITH_WSREP */ thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); return new (thd->mem_root) Item_func_release_lock(thd, arg1); diff --git a/sql/item_create.h b/sql/item_create.h index 48e1a14e7fc..7c248e81711 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -63,9 +63,9 @@ public: protected: /** Constructor */ - Create_func() {} + Create_func() = default; /** Destructor */ - virtual ~Create_func() {} + virtual ~Create_func() = default; }; @@ -88,9 +88,9 @@ public: protected: /** Constructor. */ - Create_func_arg0() {} + Create_func_arg0() = default; /** Destructor. */ - virtual ~Create_func_arg0() {} + virtual ~Create_func_arg0() = default; }; @@ -114,9 +114,9 @@ public: protected: /** Constructor. */ - Create_func_arg1() {} + Create_func_arg1() = default; /** Destructor. */ - virtual ~Create_func_arg1() {} + virtual ~Create_func_arg1() = default; }; @@ -141,9 +141,9 @@ public: protected: /** Constructor. */ - Create_func_arg2() {} + Create_func_arg2() = default; /** Destructor. */ - virtual ~Create_func_arg2() {} + virtual ~Create_func_arg2() = default; }; @@ -169,9 +169,9 @@ public: protected: /** Constructor. */ - Create_func_arg3() {} + Create_func_arg3() = default; /** Destructor. */ - virtual ~Create_func_arg3() {} + virtual ~Create_func_arg3() = default; }; @@ -203,9 +203,9 @@ public: protected: /** Constructor. */ - Create_native_func() {} + Create_native_func() = default; /** Destructor. */ - virtual ~Create_native_func() {} + virtual ~Create_native_func() = default; }; @@ -246,9 +246,9 @@ public: protected: /** Constructor. */ - Create_qfunc() {} + Create_qfunc() = default; /** Destructor. */ - virtual ~Create_qfunc() {} + virtual ~Create_qfunc() = default; }; @@ -295,9 +295,9 @@ public: protected: /** Constructor. */ - Create_udf_func() {} + Create_udf_func() = default; /** Destructor. */ - virtual ~Create_udf_func() {} + virtual ~Create_udf_func() = default; }; #endif diff --git a/sql/item_func.cc b/sql/item_func.cc index a07595cbbd8..a94dcefe32f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1767,7 +1767,7 @@ static void calc_hash_for_unique(ulong &nr1, ulong &nr2, String *str) cs->hash_sort((uchar *)str->ptr(), str->length(), &nr1, &nr2); } -longlong Item_func_hash::val_int() +longlong Item_func_hash_mariadb_100403::val_int() { DBUG_EXECUTE_IF("same_long_unique_hash", return 9;); unsigned_flag= true; @@ -1788,6 +1788,24 @@ longlong Item_func_hash::val_int() } +longlong Item_func_hash::val_int() +{ + DBUG_EXECUTE_IF("same_long_unique_hash", return 9;); + unsigned_flag= true; + Hasher hasher; + for(uint i= 0;i<arg_count;i++) + { + if (args[i]->hash_not_null(&hasher)) + { + null_value= 1; + return 0; + } + } + null_value= 0; + return (longlong) hasher.finalize(); +} + + bool Item_func_hash::fix_length_and_dec(THD *thd) { decimals= 0; @@ -3976,7 +3994,7 @@ class Interruptible_wait Interruptible_wait(THD *thd) : m_thd(thd) {} - ~Interruptible_wait() {} + ~Interruptible_wait() = default; public: /** diff --git a/sql/item_func.h b/sql/item_func.h index 520dbdc90c7..6e714814526 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -469,7 +469,7 @@ public: class Handler { public: - virtual ~Handler() { } + virtual ~Handler() = default; virtual String *val_str(Item_handled_func *, String *) const= 0; virtual String *val_str_ascii(Item_handled_func *, String *) const= 0; virtual double val_real(Item_handled_func *) const= 0; @@ -1209,6 +1209,18 @@ public: } }; +class Item_func_hash_mariadb_100403: public Item_func_hash +{ +public: + Item_func_hash_mariadb_100403(THD *thd, List<Item> &item) + :Item_func_hash(thd, item) + {} + longlong val_int(); + Item *get_copy(THD *thd) + { return get_item_copy<Item_func_hash_mariadb_100403>(thd, this); } + const char *func_name() const { return "<hash_mariadb_100403>"; } +}; + class Item_longlong_func: public Item_int_func { public: @@ -3854,8 +3866,7 @@ public: Item_func_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name, const Sp_handler *sph, List<Item> &list); - virtual ~Item_func_sp() - {} + virtual ~Item_func_sp() = default; void update_used_tables() override; diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index fc1a4b20e8c..8714417a77d 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1531,9 +1531,7 @@ exit: } -Item_func_spatial_operation::~Item_func_spatial_operation() -{ -} +Item_func_spatial_operation::~Item_func_spatial_operation() = default; String *Item_func_spatial_operation::val_str(String *str_value) @@ -2788,8 +2786,8 @@ public: static Create_func_area s_singleton; protected: - Create_func_area() {} - virtual ~Create_func_area() {} + Create_func_area() = default; + virtual ~Create_func_area() = default; }; @@ -2804,8 +2802,8 @@ public: static Create_func_as_wkb s_singleton; protected: - Create_func_as_wkb() {} - virtual ~Create_func_as_wkb() {} + Create_func_as_wkb() = default; + virtual ~Create_func_as_wkb() = default; }; @@ -2820,8 +2818,8 @@ public: static Create_func_as_wkt s_singleton; protected: - Create_func_as_wkt() {} - virtual ~Create_func_as_wkt() {} + Create_func_as_wkt() = default; + virtual ~Create_func_as_wkt() = default; }; @@ -2837,8 +2835,8 @@ public: static Create_func_centroid s_singleton; protected: - Create_func_centroid() {} - virtual ~Create_func_centroid() {} + Create_func_centroid() = default; + virtual ~Create_func_centroid() = default; }; @@ -2853,8 +2851,8 @@ public: static Create_func_convexhull s_singleton; protected: - Create_func_convexhull() {} - virtual ~Create_func_convexhull() {} + Create_func_convexhull() = default; + virtual ~Create_func_convexhull() = default; }; @@ -2869,8 +2867,8 @@ public: static Create_func_pointonsurface s_singleton; protected: - Create_func_pointonsurface() {} - virtual ~Create_func_pointonsurface() {} + Create_func_pointonsurface() = default; + virtual ~Create_func_pointonsurface() = default; }; @@ -2886,8 +2884,8 @@ public: static Create_func_mbr_contains s_singleton; protected: - Create_func_mbr_contains() {} - virtual ~Create_func_mbr_contains() {} + Create_func_mbr_contains() = default; + virtual ~Create_func_mbr_contains() = default; }; @@ -2902,8 +2900,8 @@ public: static Create_func_contains s_singleton; protected: - Create_func_contains() {} - virtual ~Create_func_contains() {} + Create_func_contains() = default; + virtual ~Create_func_contains() = default; }; @@ -2918,8 +2916,8 @@ public: static Create_func_crosses s_singleton; protected: - Create_func_crosses() {} - virtual ~Create_func_crosses() {} + Create_func_crosses() = default; + virtual ~Create_func_crosses() = default; }; @@ -2934,8 +2932,8 @@ public: static Create_func_dimension s_singleton; protected: - Create_func_dimension() {} - virtual ~Create_func_dimension() {} + Create_func_dimension() = default; + virtual ~Create_func_dimension() = default; }; @@ -2951,8 +2949,8 @@ public: static Create_func_mbr_disjoint s_singleton; protected: - Create_func_mbr_disjoint() {} - virtual ~Create_func_mbr_disjoint() {} + Create_func_mbr_disjoint() = default; + virtual ~Create_func_mbr_disjoint() = default; }; @@ -2967,8 +2965,8 @@ public: static Create_func_disjoint s_singleton; protected: - Create_func_disjoint() {} - virtual ~Create_func_disjoint() {} + Create_func_disjoint() = default; + virtual ~Create_func_disjoint() = default; }; @@ -2983,8 +2981,8 @@ public: static Create_func_distance s_singleton; protected: - Create_func_distance() {} - virtual ~Create_func_distance() {} + Create_func_distance() = default; + virtual ~Create_func_distance() = default; }; @@ -2996,8 +2994,8 @@ public: static Create_func_distance_sphere s_singleton; protected: - Create_func_distance_sphere() {} - virtual ~Create_func_distance_sphere() {} + Create_func_distance_sphere() = default; + virtual ~Create_func_distance_sphere() = default; }; @@ -3031,8 +3029,8 @@ public: static Create_func_endpoint s_singleton; protected: - Create_func_endpoint() {} - virtual ~Create_func_endpoint() {} + Create_func_endpoint() = default; + virtual ~Create_func_endpoint() = default; }; @@ -3047,8 +3045,8 @@ public: static Create_func_envelope s_singleton; protected: - Create_func_envelope() {} - virtual ~Create_func_envelope() {} + Create_func_envelope() = default; + virtual ~Create_func_envelope() = default; }; class Create_func_boundary : public Create_func_arg1 @@ -3062,8 +3060,8 @@ public: static Create_func_boundary s_singleton; protected: - Create_func_boundary() {} - virtual ~Create_func_boundary() {} + Create_func_boundary() = default; + virtual ~Create_func_boundary() = default; }; @@ -3079,8 +3077,8 @@ public: static Create_func_mbr_equals s_singleton; protected: - Create_func_mbr_equals() {} - virtual ~Create_func_mbr_equals() {} + Create_func_mbr_equals() = default; + virtual ~Create_func_mbr_equals() = default; }; @@ -3096,8 +3094,8 @@ public: static Create_func_equals s_singleton; protected: - Create_func_equals() {} - virtual ~Create_func_equals() {} + Create_func_equals() = default; + virtual ~Create_func_equals() = default; }; @@ -3113,8 +3111,8 @@ public: static Create_func_exteriorring s_singleton; protected: - Create_func_exteriorring() {} - virtual ~Create_func_exteriorring() {} + Create_func_exteriorring() = default; + virtual ~Create_func_exteriorring() = default; }; @@ -3128,8 +3126,8 @@ public: static Create_func_geometry_from_text s_singleton; protected: - Create_func_geometry_from_text() {} - virtual ~Create_func_geometry_from_text() {} + Create_func_geometry_from_text() = default; + virtual ~Create_func_geometry_from_text() = default; }; @@ -3179,8 +3177,8 @@ public: static Create_func_geometry_from_wkb s_singleton; protected: - Create_func_geometry_from_wkb() {} - virtual ~Create_func_geometry_from_wkb() {} + Create_func_geometry_from_wkb() = default; + virtual ~Create_func_geometry_from_wkb() = default; }; @@ -3229,8 +3227,8 @@ public: static Create_func_geometry_from_json s_singleton; protected: - Create_func_geometry_from_json() {} - virtual ~Create_func_geometry_from_json() {} + Create_func_geometry_from_json() = default; + virtual ~Create_func_geometry_from_json() = default; }; @@ -3289,8 +3287,8 @@ public: static Create_func_as_geojson s_singleton; protected: - Create_func_as_geojson() {} - virtual ~Create_func_as_geojson() {} + Create_func_as_geojson() = default; + virtual ~Create_func_as_geojson() = default; }; @@ -3349,8 +3347,8 @@ public: static Create_func_geometry_type s_singleton; protected: - Create_func_geometry_type() {} - virtual ~Create_func_geometry_type() {} + Create_func_geometry_type() = default; + virtual ~Create_func_geometry_type() = default; }; @@ -3366,8 +3364,8 @@ public: static Create_func_geometryn s_singleton; protected: - Create_func_geometryn() {} - virtual ~Create_func_geometryn() {} + Create_func_geometryn() = default; + virtual ~Create_func_geometryn() = default; }; @@ -3383,8 +3381,8 @@ public: static Create_func_gis_debug s_singleton; protected: - Create_func_gis_debug() {} - virtual ~Create_func_gis_debug() {} + Create_func_gis_debug() = default; + virtual ~Create_func_gis_debug() = default; }; #endif @@ -3400,8 +3398,8 @@ public: static Create_func_glength s_singleton; protected: - Create_func_glength() {} - virtual ~Create_func_glength() {} + Create_func_glength() = default; + virtual ~Create_func_glength() = default; }; @@ -3417,8 +3415,8 @@ public: static Create_func_interiorringn s_singleton; protected: - Create_func_interiorringn() {} - virtual ~Create_func_interiorringn() {} + Create_func_interiorringn() = default; + virtual ~Create_func_interiorringn() = default; }; @@ -3433,8 +3431,8 @@ public: static Create_func_relate s_singleton; protected: - Create_func_relate() {} - virtual ~Create_func_relate() {} + Create_func_relate() = default; + virtual ~Create_func_relate() = default; }; @@ -3450,8 +3448,8 @@ public: static Create_func_mbr_intersects s_singleton; protected: - Create_func_mbr_intersects() {} - virtual ~Create_func_mbr_intersects() {} + Create_func_mbr_intersects() = default; + virtual ~Create_func_mbr_intersects() = default; }; @@ -3467,8 +3465,8 @@ public: static Create_func_intersects s_singleton; protected: - Create_func_intersects() {} - virtual ~Create_func_intersects() {} + Create_func_intersects() = default; + virtual ~Create_func_intersects() = default; }; @@ -3484,8 +3482,8 @@ public: static Create_func_intersection s_singleton; protected: - Create_func_intersection() {} - virtual ~Create_func_intersection() {} + Create_func_intersection() = default; + virtual ~Create_func_intersection() = default; }; @@ -3501,8 +3499,8 @@ public: static Create_func_difference s_singleton; protected: - Create_func_difference() {} - virtual ~Create_func_difference() {} + Create_func_difference() = default; + virtual ~Create_func_difference() = default; }; @@ -3518,8 +3516,8 @@ public: static Create_func_union s_singleton; protected: - Create_func_union() {} - virtual ~Create_func_union() {} + Create_func_union() = default; + virtual ~Create_func_union() = default; }; @@ -3535,8 +3533,8 @@ public: static Create_func_symdifference s_singleton; protected: - Create_func_symdifference() {} - virtual ~Create_func_symdifference() {} + Create_func_symdifference() = default; + virtual ~Create_func_symdifference() = default; }; @@ -3551,8 +3549,8 @@ public: static Create_func_buffer s_singleton; protected: - Create_func_buffer() {} - virtual ~Create_func_buffer() {} + Create_func_buffer() = default; + virtual ~Create_func_buffer() = default; }; @@ -3567,8 +3565,8 @@ public: static Create_func_isclosed s_singleton; protected: - Create_func_isclosed() {} - virtual ~Create_func_isclosed() {} + Create_func_isclosed() = default; + virtual ~Create_func_isclosed() = default; }; @@ -3583,8 +3581,8 @@ public: static Create_func_isring s_singleton; protected: - Create_func_isring() {} - virtual ~Create_func_isring() {} + Create_func_isring() = default; + virtual ~Create_func_isring() = default; }; @@ -3599,8 +3597,8 @@ public: static Create_func_isempty s_singleton; protected: - Create_func_isempty() {} - virtual ~Create_func_isempty() {} + Create_func_isempty() = default; + virtual ~Create_func_isempty() = default; }; @@ -3615,8 +3613,8 @@ public: static Create_func_issimple s_singleton; protected: - Create_func_issimple() {} - virtual ~Create_func_issimple() {} + Create_func_issimple() = default; + virtual ~Create_func_issimple() = default; }; @@ -3632,8 +3630,8 @@ public: static Create_func_numgeometries s_singleton; protected: - Create_func_numgeometries() {} - virtual ~Create_func_numgeometries() {} + Create_func_numgeometries() = default; + virtual ~Create_func_numgeometries() = default; }; @@ -3648,8 +3646,8 @@ public: static Create_func_numinteriorring s_singleton; protected: - Create_func_numinteriorring() {} - virtual ~Create_func_numinteriorring() {} + Create_func_numinteriorring() = default; + virtual ~Create_func_numinteriorring() = default; }; @@ -3664,8 +3662,8 @@ public: static Create_func_numpoints s_singleton; protected: - Create_func_numpoints() {} - virtual ~Create_func_numpoints() {} + Create_func_numpoints() = default; + virtual ~Create_func_numpoints() = default; }; @@ -3681,8 +3679,8 @@ public: static Create_func_mbr_overlaps s_singleton; protected: - Create_func_mbr_overlaps() {} - virtual ~Create_func_mbr_overlaps() {} + Create_func_mbr_overlaps() = default; + virtual ~Create_func_mbr_overlaps() = default; }; @@ -3698,8 +3696,8 @@ public: static Create_func_overlaps s_singleton; protected: - Create_func_overlaps() {} - virtual ~Create_func_overlaps() {} + Create_func_overlaps() = default; + virtual ~Create_func_overlaps() = default; }; @@ -3717,8 +3715,8 @@ public: static Create_func_pointn s_singleton; protected: - Create_func_pointn() {} - virtual ~Create_func_pointn() {} + Create_func_pointn() = default; + virtual ~Create_func_pointn() = default; }; @@ -3735,8 +3733,8 @@ public: static Create_func_srid s_singleton; protected: - Create_func_srid() {} - virtual ~Create_func_srid() {} + Create_func_srid() = default; + virtual ~Create_func_srid() = default; }; @@ -3752,8 +3750,8 @@ public: static Create_func_startpoint s_singleton; protected: - Create_func_startpoint() {} - virtual ~Create_func_startpoint() {} + Create_func_startpoint() = default; + virtual ~Create_func_startpoint() = default; }; @@ -3770,8 +3768,8 @@ public: static Create_func_touches s_singleton; protected: - Create_func_touches() {} - virtual ~Create_func_touches() {} + Create_func_touches() = default; + virtual ~Create_func_touches() = default; }; @@ -3787,8 +3785,8 @@ public: static Create_func_mbr_within s_singleton; protected: - Create_func_mbr_within() {} - virtual ~Create_func_mbr_within() {} + Create_func_mbr_within() = default; + virtual ~Create_func_mbr_within() = default; }; @@ -3804,8 +3802,8 @@ public: static Create_func_within s_singleton; protected: - Create_func_within() {} - virtual ~Create_func_within() {} + Create_func_within() = default; + virtual ~Create_func_within() = default; }; @@ -3820,8 +3818,8 @@ public: static Create_func_x s_singleton; protected: - Create_func_x() {} - virtual ~Create_func_x() {} + Create_func_x() = default; + virtual ~Create_func_x() = default; }; @@ -3836,8 +3834,8 @@ public: static Create_func_y s_singleton; protected: - Create_func_y() {} - virtual ~Create_func_y() {} + Create_func_y() = default; + virtual ~Create_func_y() = default; }; diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 89f1c9c8221..590fde88a52 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -4239,7 +4239,7 @@ bool Item_func_json_objectagg::add() result.append(STRING_WITH_LEN(", ")); result.append('"'); - result.append(*key); + st_append_escaped(&result,key); result.append(STRING_WITH_LEN("\":")); buf.length(0); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4d69280cb98..eb9e167ca74 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1848,6 +1848,18 @@ bool Item_func_ucase::fix_length_and_dec(THD *thd) } +bool Item_func_left::hash_not_null(Hasher *hasher) +{ + StringBuffer<STRING_BUFFER_USUAL_SIZE> buf; + String *str= val_str(&buf); + DBUG_ASSERT((str == NULL) == null_value); + if (!str) + return true; + hasher->add(collation.collation, str->ptr(), str->length()); + return false; +} + + String *Item_func_left::val_str(String *str) { DBUG_ASSERT(fixed()); diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 30e363e9428..3a3c53385b0 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -582,6 +582,7 @@ class Item_func_left :public Item_str_func String tmp_value; public: Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} + bool hash_not_null(Hasher *hasher) override; String *val_str(String *) override; bool fix_length_and_dec(THD *thd) override; LEX_CSTRING func_name_cstring() const override diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index f8e6a13ce97..30562b5c12c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2951,7 +2951,9 @@ bool Item_exists_subselect::select_prepare_to_be_in() bool trans_res= FALSE; DBUG_ENTER("Item_exists_subselect::select_prepare_to_be_in"); if (!optimizer && - thd->lex->sql_command == SQLCOM_SELECT && + (thd->lex->sql_command == SQLCOM_SELECT || + thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_DELETE_MULTI) && !unit->first_select()->is_part_of_union() && optimizer_flag(thd, OPTIMIZER_SWITCH_EXISTS_TO_IN) && (is_top_level_item() || diff --git a/sql/item_subselect.h b/sql/item_subselect.h index fdd0333adfd..8d58e16bb28 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -831,7 +831,7 @@ public: item= si; maybe_null= 0; } - virtual ~subselect_engine() {}; // to satisfy compiler + virtual ~subselect_engine() = default;; // to satisfy compiler virtual void cleanup()= 0; /* diff --git a/sql/item_sum.h b/sql/item_sum.h index b9bd99acac2..7308734070d 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -59,7 +59,7 @@ protected: public: Aggregator (Item_sum *arg): item_sum(arg) {} - virtual ~Aggregator () {} /* Keep gcc happy */ + virtual ~Aggregator () = default; /* Keep gcc happy */ enum Aggregator_type { SIMPLE_AGGREGATOR, DISTINCT_AGGREGATOR }; virtual Aggregator_type Aggrtype() = 0; @@ -367,7 +367,14 @@ public: int8 aggr_level; /* nesting level of the aggregating subquery */ int8 max_arg_level; /* max level of unbound column references */ int8 max_sum_func_level;/* max level of aggregation for embedded functions */ - bool quick_group; /* If incremental update of fields */ + + /* + true (the default value) means this aggregate function can be computed + with TemporaryTableWithPartialSums algorithm (see end_update()). + false means this aggregate function needs OrderedGroupBy algorithm (see + end_write_group()). + */ + bool quick_group; /* This list is used by the check for mixing non aggregated fields and sum functions in the ONLY_FULL_GROUP_BY_MODE. We save all outer fields diff --git a/sql/log.cc b/sql/log.cc index 4572b9cca82..48e5145210c 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -215,7 +215,7 @@ public: m_message[0]= '\0'; } - virtual ~Silence_log_table_errors() {} + virtual ~Silence_log_table_errors() = default; virtual bool handle_condition(THD *thd, uint sql_errno, @@ -772,14 +772,10 @@ end: } -Log_to_csv_event_handler::Log_to_csv_event_handler() -{ -} +Log_to_csv_event_handler::Log_to_csv_event_handler() = default; -Log_to_csv_event_handler::~Log_to_csv_event_handler() -{ -} +Log_to_csv_event_handler::~Log_to_csv_event_handler() = default; void Log_to_csv_event_handler::cleanup() @@ -1801,6 +1797,7 @@ int binlog_init(void *p) binlog_hton->prepare= binlog_prepare; binlog_hton->start_consistent_snapshot= binlog_start_consistent_snapshot; } + binlog_hton->flags= HTON_NOT_USER_SELECTABLE | HTON_HIDDEN | HTON_NO_ROLLBACK; return 0; } @@ -2119,7 +2116,9 @@ int binlog_commit_by_xid(handlerton *hton, XID *xid) THD *thd= current_thd; if (thd->is_current_stmt_binlog_disabled()) - return 0; + { + return thd->wait_for_prior_commit(); + } /* the asserted state can't be reachable with xa commit */ DBUG_ASSERT(!thd->get_stmt_da()->is_error() || @@ -2151,7 +2150,9 @@ int binlog_rollback_by_xid(handlerton *hton, XID *xid) THD *thd= current_thd; if (thd->is_current_stmt_binlog_disabled()) - return 0; + { + return thd->wait_for_prior_commit(); + } if (thd->get_stmt_da()->is_error() && thd->get_stmt_da()->sql_errno() == ER_XA_RBROLLBACK) diff --git a/sql/log.h b/sql/log.h index 65f70712bbf..c20f0fe5a57 100644 --- a/sql/log.h +++ b/sql/log.h @@ -42,8 +42,8 @@ class TC_LOG { public: int using_heuristic_recover(); - TC_LOG() {} - virtual ~TC_LOG() {} + TC_LOG() = default; + virtual ~TC_LOG() = default; virtual int open(const char *opt_name)=0; virtual void close()=0; @@ -100,7 +100,7 @@ extern PSI_cond_key key_COND_prepare_ordered; class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging { public: - TC_LOG_DUMMY() {} + TC_LOG_DUMMY() = default; int open(const char *opt_name) { return 0; } void close() { } /* @@ -308,7 +308,7 @@ class MYSQL_LOG { public: MYSQL_LOG(); - virtual ~MYSQL_LOG() {} + virtual ~MYSQL_LOG() = default; void init_pthread_objects(); void cleanup(); bool open( @@ -983,7 +983,7 @@ public: class Log_event_handler { public: - Log_event_handler() {} + Log_event_handler() = default; virtual bool init()= 0; virtual void cleanup()= 0; @@ -997,7 +997,7 @@ public: const char *command_type, size_t command_type_len, const char *sql_text, size_t sql_text_len, CHARSET_INFO *client_cs)= 0; - virtual ~Log_event_handler() {} + virtual ~Log_event_handler() = default; }; diff --git a/sql/log_event.cc b/sql/log_event.cc index 788b2509964..cabbfc472be 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -154,7 +154,7 @@ public: reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE); } - ~Write_on_release_cache() {} + ~Write_on_release_cache() = default; bool flush_data() { @@ -3839,9 +3839,7 @@ Ignorable_log_event::Ignorable_log_event(const uchar *buf, DBUG_VOID_RETURN; } -Ignorable_log_event::~Ignorable_log_event() -{ -} +Ignorable_log_event::~Ignorable_log_event() = default; bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file) { diff --git a/sql/log_event.h b/sql/log_event.h index 40fdd65c171..6b8853493be 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -2599,7 +2599,7 @@ Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg, Intvar_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Intvar_log_event() {} + ~Intvar_log_event() = default; Log_event_type get_type_code() { return INTVAR_EVENT;} const char* get_var_type_name(); int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;} @@ -2680,7 +2680,7 @@ class Rand_log_event: public Log_event Rand_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Rand_log_event() {} + ~Rand_log_event() = default; Log_event_type get_type_code() { return RAND_EVENT;} int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ } #ifdef MYSQL_SERVER @@ -2709,7 +2709,7 @@ public: const Format_description_log_event *description_event): Log_event(buf, description_event) {} - ~Xid_apply_log_event() {} + ~Xid_apply_log_event() = default; bool is_valid() const { return 1; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -2760,7 +2760,7 @@ public: Xid_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~Xid_log_event() {} + ~Xid_log_event() = default; Log_event_type get_type_code() { return XID_EVENT;} int get_data_size() { return sizeof(xid); } #ifdef MYSQL_SERVER @@ -2905,7 +2905,7 @@ public: #endif XA_prepare_log_event(const uchar *buf, const Format_description_log_event *description_event); - ~XA_prepare_log_event() {} + ~XA_prepare_log_event() = default; Log_event_type get_type_code() { return XA_PREPARE_LOG_EVENT; } bool is_valid() const { return m_xid.formatID != -1; } int get_data_size() @@ -2980,7 +2980,7 @@ public: User_var_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~User_var_log_event() {} + ~User_var_log_event() = default; Log_event_type get_type_code() { return USER_VAR_EVENT;} #ifdef MYSQL_SERVER bool write(); @@ -3030,7 +3030,7 @@ public: const Format_description_log_event *description_event): Log_event(buf, description_event) {} - ~Stop_log_event() {} + ~Stop_log_event() = default; Log_event_type get_type_code() { return STOP_EVENT;} bool is_valid() const { return 1; } @@ -3325,7 +3325,7 @@ public: #endif Gtid_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Gtid_log_event() { } + ~Gtid_log_event() = default; Log_event_type get_type_code() { return GTID_EVENT; } enum_logged_status logged_status() { return LOGGED_NO_DATA; } int get_data_size() @@ -3500,7 +3500,7 @@ public: Append_block_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Append_block_log_event() {} + ~Append_block_log_event() = default; Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;} int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;} bool is_valid() const { return block != 0; } @@ -3541,7 +3541,7 @@ public: Delete_file_log_event(const uchar *buf, uint event_len, const Format_description_log_event* description_event); - ~Delete_file_log_event() {} + ~Delete_file_log_event() = default; Log_event_type get_type_code() { return DELETE_FILE_EVENT;} int get_data_size() { return DELETE_FILE_HEADER_LEN ;} bool is_valid() const { return file_id != 0; } @@ -3581,7 +3581,7 @@ public: Begin_load_query_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Begin_load_query_log_event() {} + ~Begin_load_query_log_event() = default; Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; } private: #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) @@ -3639,7 +3639,7 @@ public: Execute_load_query_log_event(const uchar *buf, uint event_len, const Format_description_log_event *description_event); - ~Execute_load_query_log_event() {} + ~Execute_load_query_log_event() = default; Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; } bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; } @@ -3677,7 +3677,7 @@ public: {} /* constructor for hopelessly corrupted events */ Unknown_log_event(): Log_event(), what(ENCRYPTED) {} - ~Unknown_log_event() {} + ~Unknown_log_event() = default; bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); Log_event_type get_type_code() { return UNKNOWN_EVENT;} bool is_valid() const { return 1; } diff --git a/sql/mdl.cc b/sql/mdl.cc index c426dbe143b..6cb27efba12 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -415,7 +415,7 @@ public: virtual bool needs_notification(const MDL_ticket *ticket) const = 0; virtual bool conflicting_locks(const MDL_ticket *ticket) const = 0; virtual bitmap_t hog_lock_types_bitmap() const = 0; - virtual ~MDL_lock_strategy() {} + virtual ~MDL_lock_strategy() = default; }; @@ -426,7 +426,7 @@ public: */ struct MDL_scoped_lock : public MDL_lock_strategy { - MDL_scoped_lock() {} + MDL_scoped_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -463,7 +463,7 @@ public: */ struct MDL_object_lock : public MDL_lock_strategy { - MDL_object_lock() {} + MDL_object_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -507,7 +507,7 @@ public: struct MDL_backup_lock: public MDL_lock_strategy { - MDL_backup_lock() {} + MDL_backup_lock() = default; virtual const bitmap_t *incompatible_granted_types_bitmap() const { return m_granted_incompatible; } virtual const bitmap_t *incompatible_waiting_types_bitmap() const @@ -1875,13 +1875,11 @@ bool MDL_lock::has_pending_conflicting_lock(enum_mdl_type type) MDL_wait_for_graph_visitor::~MDL_wait_for_graph_visitor() -{ -} += default; MDL_wait_for_subgraph::~MDL_wait_for_subgraph() -{ -} += default; /** Check if ticket represents metadata lock of "stronger" or equal type diff --git a/sql/mdl.h b/sql/mdl.h index 31ac4e81377..998f34ff2bb 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -60,7 +60,7 @@ typedef unsigned short mdl_bitmap_t; class MDL_context_owner { public: - virtual ~MDL_context_owner() {} + virtual ~MDL_context_owner() = default; /** Enter a condition wait. @@ -471,7 +471,7 @@ public: { mdl_key_init(namespace_arg, db_arg, name_arg); } - MDL_key() {} /* To use when part of MDL_request. */ + MDL_key() = default; /* To use when part of MDL_request. */ /** Get thread state name to be used in case when we have to @@ -640,7 +640,7 @@ public: virtual bool inspect_edge(MDL_context *dest) = 0; virtual ~MDL_wait_for_graph_visitor(); - MDL_wait_for_graph_visitor() {} + MDL_wait_for_graph_visitor() = default; }; /** @@ -799,7 +799,7 @@ private: class MDL_savepoint { public: - MDL_savepoint() {}; + MDL_savepoint() = default;; private: MDL_savepoint(MDL_ticket *stmt_ticket, MDL_ticket *trans_ticket) diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h index 76b026f994a..930ee3f238b 100644 --- a/sql/multi_range_read.h +++ b/sql/multi_range_read.h @@ -204,7 +204,7 @@ class Mrr_reader public: virtual int get_next(range_id_t *range_info) = 0; virtual int refill_buffer(bool initial) = 0; - virtual ~Mrr_reader() {}; /* just to remove compiler warning */ + virtual ~Mrr_reader() = default; /* just to remove compiler warning */ }; diff --git a/sql/my_apc.h b/sql/my_apc.h index cc98e36bbe4..2c0a9ade314 100644 --- a/sql/my_apc.h +++ b/sql/my_apc.h @@ -92,7 +92,7 @@ public: public: /* This function will be called in the target thread */ virtual void call_in_target_thread()= 0; - virtual ~Apc_call() {} + virtual ~Apc_call() = default; }; /* Make a call in the target thread (see function definition for details) */ diff --git a/sql/my_json_writer.h b/sql/my_json_writer.h index b16c7146a28..a581899aab2 100644 --- a/sql/my_json_writer.h +++ b/sql/my_json_writer.h @@ -398,12 +398,14 @@ protected: public: +#ifdef ENABLED_JSON_WRITER_CONSISTENCY_CHECKS virtual ~Json_writer_struct() { -#ifdef ENABLED_JSON_WRITER_CONSISTENCY_CHECKS named_items_expectation.pop_back(); -#endif } +#else + virtual ~Json_writer_struct() = default; +#endif inline bool trace_started() const { diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index 100b4c25096..5294b91738b 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -313,7 +313,7 @@ static char *get_plugindir() { static char plugin_dir[2*MAX_PATH]; get_basedir(plugin_dir, sizeof(plugin_dir), mysqld_path, '/'); - strcat(plugin_dir, "/" STR(INSTALL_PLUGINDIR)); + safe_strcat(plugin_dir, sizeof(plugin_dir), "/" STR(INSTALL_PLUGINDIR)); if (access(plugin_dir, 0) == 0) return plugin_dir; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ff69af07f6e..ee368def9be 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1247,8 +1247,7 @@ class Buffered_log : public Sql_alloc public: Buffered_log(enum loglevel level, const char *message); - ~Buffered_log() - {} + ~Buffered_log() = default; void print(void); @@ -1308,11 +1307,9 @@ void Buffered_log::print() class Buffered_logs { public: - Buffered_logs() - {} + Buffered_logs() = default; - ~Buffered_logs() - {} + ~Buffered_logs() = default; void init(); void cleanup(); @@ -2782,11 +2779,9 @@ void close_connection(THD *thd, uint sql_errno) thd->protocol->net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL); thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno)); } - else - thd->print_aborted_warning(lvl, (thd->main_security_ctx.user ? - "This connection closed normally" : - "This connection closed normally without" - " authentication")); + else if (!thd->main_security_ctx.user) + thd->print_aborted_warning(lvl, "This connection closed normally without" + " authentication"); thd->disconnect(); @@ -5140,12 +5135,11 @@ static int init_server_components() else // full wsrep initialization { // add basedir/bin to PATH to resolve wsrep script names - char* const tmp_path= (char*)my_alloca(strlen(mysql_home) + - strlen("/bin") + 1); + size_t tmp_path_size= strlen(mysql_home) + 5; /* including "/bin" */ + char* const tmp_path= (char*)my_alloca(tmp_path_size); if (tmp_path) { - strcpy(tmp_path, mysql_home); - strcat(tmp_path, "/bin"); + snprintf(tmp_path, tmp_path_size, "%s/bin", mysql_home); wsrep_prepend_PATH(tmp_path); } else @@ -5988,8 +5982,9 @@ int mysqld_main(int argc, char **argv) char real_server_version[2 * SERVER_VERSION_LENGTH + 10]; set_server_version(real_server_version, sizeof(real_server_version)); - strcat(real_server_version, "' as '"); - strcat(real_server_version, server_version); + safe_strcat(real_server_version, sizeof(real_server_version), "' as '"); + safe_strcat(real_server_version, sizeof(real_server_version), + server_version); sql_print_information(ER_DEFAULT(ER_STARTUP), my_progname, real_server_version, @@ -7982,7 +7977,8 @@ static int mysql_init_variables(void) } else my_path(prg_dev, my_progname, "mysql/bin"); - strcat(prg_dev,"/../"); // Remove 'bin' to get base dir + // Remove 'bin' to get base dir + safe_strcat(prg_dev, sizeof(prg_dev), "/../"); cleanup_dirname(mysql_home,prg_dev); } #else diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f2696683124..0fad2d6e201 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2254,7 +2254,7 @@ public: { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* Never called */ } - virtual ~TABLE_READ_PLAN() {} /* Remove gcc warning */ + virtual ~TABLE_READ_PLAN() = default; /* Remove gcc warning */ /** Add basic info for this TABLE_READ_PLAN to the optimizer trace. @@ -2289,7 +2289,7 @@ public: TRP_RANGE(SEL_ARG *key_arg, uint idx_arg, uint mrr_flags_arg) : key(key_arg), key_idx(idx_arg), mrr_flags(mrr_flags_arg) {} - virtual ~TRP_RANGE() {} /* Remove gcc warning */ + virtual ~TRP_RANGE() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc) @@ -2338,8 +2338,8 @@ void TRP_RANGE::trace_basic_info(PARAM *param, class TRP_ROR_INTERSECT : public TABLE_READ_PLAN { public: - TRP_ROR_INTERSECT() {} /* Remove gcc warning */ - virtual ~TRP_ROR_INTERSECT() {} /* Remove gcc warning */ + TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ + virtual ~TRP_ROR_INTERSECT() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); @@ -2365,8 +2365,8 @@ public: class TRP_ROR_UNION : public TABLE_READ_PLAN { public: - TRP_ROR_UNION() {} /* Remove gcc warning */ - virtual ~TRP_ROR_UNION() {} /* Remove gcc warning */ + TRP_ROR_UNION() = default; /* Remove gcc warning */ + virtual ~TRP_ROR_UNION() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TABLE_READ_PLAN **first_ror; /* array of ptrs to plans for merged scans */ @@ -2398,8 +2398,8 @@ void TRP_ROR_UNION::trace_basic_info(PARAM *param, class TRP_INDEX_INTERSECT : public TABLE_READ_PLAN { public: - TRP_INDEX_INTERSECT() {} /* Remove gcc warning */ - virtual ~TRP_INDEX_INTERSECT() {} /* Remove gcc warning */ + TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ + virtual ~TRP_INDEX_INTERSECT() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TRP_RANGE **range_scans; /* array of ptrs to plans of intersected scans */ @@ -2435,8 +2435,8 @@ void TRP_INDEX_INTERSECT::trace_basic_info(PARAM *param, class TRP_INDEX_MERGE : public TABLE_READ_PLAN { public: - TRP_INDEX_MERGE() {} /* Remove gcc warning */ - virtual ~TRP_INDEX_MERGE() {} /* Remove gcc warning */ + TRP_INDEX_MERGE() = default; /* Remove gcc warning */ + virtual ~TRP_INDEX_MERGE() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TRP_RANGE **range_scans; /* array of ptrs to plans of merged scans */ @@ -2506,7 +2506,7 @@ public: if (key_infix_len) memcpy(this->key_infix, key_infix_arg, key_infix_len); } - virtual ~TRP_GROUP_MIN_MAX() {} /* Remove gcc warning */ + virtual ~TRP_GROUP_MIN_MAX() = default; /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); @@ -10002,7 +10002,6 @@ tree_or(RANGE_OPT_PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2) DBUG_RETURN(tree2); SEL_TREE *result= NULL; - key_map result_keys; key_map ored_keys; SEL_TREE *rtree[2]= {NULL,NULL}; SEL_IMERGE *imerge[2]= {NULL, NULL}; diff --git a/sql/opt_range.h b/sql/opt_range.h index 91cbfb3412b..b3a7939c869 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -354,7 +354,7 @@ public: /* See RANGE_OPT_PARAM::alloced_sel_args */ enum { MAX_SEL_ARGS = 16000 }; - SEL_ARG() {} + SEL_ARG() = default; SEL_ARG(SEL_ARG &); SEL_ARG(Field *, const uchar *, const uchar *); SEL_ARG(Field *field, uint8 part, @@ -1119,7 +1119,7 @@ public: bool group_by_optimization_used; QUICK_SELECT_I(); - virtual ~QUICK_SELECT_I(){}; + virtual ~QUICK_SELECT_I() = default;; /* Do post-constructor initialization. diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index b8e046995e9..99e25a5338a 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -224,7 +224,7 @@ class Dep_value : public Sql_alloc { public: Dep_value(): bound(FALSE) {} - virtual ~Dep_value(){} /* purecov: inspected */ /* stop compiler warnings */ + virtual ~Dep_value() = default; /* purecov: inspected */ bool is_bound() { return bound; } void make_bound() { bound= TRUE; } @@ -358,7 +358,7 @@ const size_t Dep_value::iterator_size= class Dep_module : public Sql_alloc { public: - virtual ~Dep_module(){} /* purecov: inspected */ /* stop compiler warnings */ + virtual ~Dep_module() = default; /* purecov: inspected */ /* Mark as bound. Currently is non-virtual and does nothing */ void make_bound() {}; diff --git a/sql/parse_file.h b/sql/parse_file.h index cd26ffec91a..0589d628bfc 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -55,8 +55,8 @@ struct File_option class Unknown_key_hook { public: - Unknown_key_hook() {} /* Remove gcc warning */ - virtual ~Unknown_key_hook() {} /* Remove gcc warning */ + Unknown_key_hook() = default; /* Remove gcc warning */ + virtual ~Unknown_key_hook() = default; /* Remove gcc warning */ virtual bool process_unknown_string(const char *&unknown_key, uchar* base, MEM_ROOT *mem_root, const char *end)= 0; }; @@ -67,7 +67,7 @@ public: class File_parser_dummy_hook: public Unknown_key_hook { public: - File_parser_dummy_hook() {} /* Remove gcc warning */ + File_parser_dummy_hook() = default; /* Remove gcc warning */ virtual bool process_unknown_string(const char *&unknown_key, uchar* base, MEM_ROOT *mem_root, const char *end); }; diff --git a/sql/partition_element.h b/sql/partition_element.h index 756cab2b7f2..1abaa315218 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -164,7 +164,7 @@ public: option_list(part_elem->option_list), option_struct(part_elem->option_struct) {} - ~partition_element() {} + ~partition_element() = default; part_column_list_val& get_col_val(uint idx) { diff --git a/sql/partition_info.h b/sql/partition_info.h index 971ba92d776..833a231e6ce 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -343,7 +343,7 @@ public: part_field_list.empty(); subpart_field_list.empty(); } - ~partition_info() {} + ~partition_info() = default; partition_info *get_clone(THD *thd, bool empty_data_and_index_file= FALSE); bool set_named_partition_bitmap(const char *part_name, size_t length); diff --git a/sql/protocol.h b/sql/protocol.h index 39569a825d5..4fdfde3e007 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -90,7 +90,7 @@ protected: public: THD *thd; Protocol(THD *thd_arg) { init(thd_arg); } - virtual ~Protocol() {} + virtual ~Protocol() = default; void init(THD* thd_arg); enum { SEND_NUM_ROWS= 1, SEND_EOF= 2, SEND_FORCE_COLUMN_INFO= 4 }; diff --git a/sql/rowid_filter.h b/sql/rowid_filter.h index c80281385ea..8f3f3a10925 100644 --- a/sql/rowid_filter.h +++ b/sql/rowid_filter.h @@ -191,7 +191,7 @@ public: virtual void sort (int (*cmp) (void *ctxt, const void *el1, const void *el2), void *cmp_arg) = 0; - virtual ~Rowid_filter_container() {} + virtual ~Rowid_filter_container() = default; }; @@ -228,7 +228,7 @@ public: */ virtual bool check(char *elem) = 0; - virtual ~Rowid_filter() {} + virtual ~Rowid_filter() = default; bool is_empty() { return container->is_empty(); } diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 2319f69d67c..3080d92bf63 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -131,9 +131,7 @@ injector::transaction::binlog_pos injector::transaction::start_pos() const */ /* This constructor is called below */ -inline injector::injector() -{ -} +inline injector::injector() = default; static injector *s_injector= 0; injector *injector::instance() diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 28359d9555a..6a1c724809a 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -307,7 +307,7 @@ public: private: explicit injector(); - ~injector() { } /* Nothing needs to be done */ + ~injector() = default; /* Nothing needs to be done */ injector(injector const&); /* You're not allowed to copy injector instances. */ diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index d8510d7becd..24367897c89 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -56,8 +56,7 @@ rpt_handle_event(rpl_parallel_thread::queued_event *qev, rgi->event_relay_log_pos= qev->event_relay_log_pos; rgi->future_event_relay_log_pos= qev->future_event_relay_log_pos; strcpy(rgi->future_event_master_log_name, qev->future_event_master_log_name); - if (!(ev->is_artificial_event() || ev->is_relay_log_event() || - (ev->when == 0))) + if (event_can_update_last_master_timestamp(ev)) rgi->last_master_timestamp= ev->when + (time_t)ev->exec_time; err= apply_event_and_update_pos_for_parallel(ev, thd, rgi); diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index edbb630c781..a8af950fa08 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -2283,11 +2283,9 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) if (unlikely(error)) { - /* - trans_rollback above does not rollback XA transactions - (todo/fixme consider to do so. - */ - if (thd->transaction->xid_state.is_explicit_XA()) + // leave alone any XA prepared transactions + if (thd->transaction->xid_state.is_explicit_XA() && + thd->transaction->xid_state.get_state_code() != XA_PREPARED) xa_trans_force_rollback(thd); thd->release_transactional_locks(); diff --git a/sql/semisync_master.h b/sql/semisync_master.h index 04fc0e5ce50..5451ad512c6 100644 --- a/sql/semisync_master.h +++ b/sql/semisync_master.h @@ -454,7 +454,7 @@ class Repl_semi_sync_master public: Repl_semi_sync_master(); - ~Repl_semi_sync_master() {} + ~Repl_semi_sync_master() = default; void cleanup(); diff --git a/sql/semisync_master_ack_receiver.h b/sql/semisync_master_ack_receiver.h index b75cb7b76cb..d869bd2e6d4 100644 --- a/sql/semisync_master_ack_receiver.h +++ b/sql/semisync_master_ack_receiver.h @@ -50,7 +50,7 @@ class Ack_receiver : public Repl_semi_sync_base { public: Ack_receiver(); - ~Ack_receiver() {} + ~Ack_receiver() = default; void cleanup(); /** Notify ack receiver to receive acks on the dump session. diff --git a/sql/semisync_slave.h b/sql/semisync_slave.h index f0b8eceeebf..a8229245ab1 100644 --- a/sql/semisync_slave.h +++ b/sql/semisync_slave.h @@ -34,7 +34,7 @@ class Repl_semi_sync_slave :public Repl_semi_sync_base { public: Repl_semi_sync_slave() :m_slave_enabled(false) {} - ~Repl_semi_sync_slave() {} + ~Repl_semi_sync_slave() = default; void set_trace_level(unsigned long trace_level) { m_trace_level = trace_level; diff --git a/sql/session_tracker.h b/sql/session_tracker.h index c78778ac73c..5715b5837b5 100644 --- a/sql/session_tracker.h +++ b/sql/session_tracker.h @@ -78,7 +78,7 @@ private: bool m_changed; public: - virtual ~State_tracker() {} + virtual ~State_tracker() = default; /** Getters */ bool is_enabled() const diff --git a/sql/set_var.h b/sql/set_var.h index 471d76129d4..70f2cb8ead2 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -99,7 +99,7 @@ public: on_check_function on_check_func, on_update_function on_update_func, const char *substitute); - virtual ~sys_var() {} + virtual ~sys_var() = default; /** All the cleanup procedures should be performed here @@ -280,8 +280,8 @@ protected: class set_var_base :public Sql_alloc { public: - set_var_base() {} - virtual ~set_var_base() {} + set_var_base() = default; + virtual ~set_var_base() = default; virtual int check(THD *thd)=0; /* To check privileges etc. */ virtual int update(THD *thd)=0; /* To set the value */ virtual int light_check(THD *thd) { return check(thd); } /* for PS */ diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 65a7e613b72..b66bd694207 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -8938,12 +8938,12 @@ ER_INVALID_DEFAULT_VALUE_FOR_FIELD 22007 hindi "गलत डिफ़ॉलà¥à¤Ÿ मान '%-.128T' कॉलम '%.192s' के लिà¤" spa "Valor por defecto incorrecto '%-.128T' para columna '%.192s'" ER_KILL_QUERY_DENIED_ERROR - chi "ä½ ä¸æ˜¯æŸ¥è¯¢%lu的所有者" - eng "You are not owner of query %lu" - ger "Sie sind nicht Eigentümer von Abfrage %lu" - hindi "आप कà¥à¤µà¥‡à¤°à¥€ %lu के OWNER नहीं हैं" - rus "Ð’Ñ‹ не ÑвлÑетеÑÑŒ владельцем запроÑа %lu" - spa "No eres el propietario de la consulta (query) %lu" + chi "ä½ ä¸æ˜¯æŸ¥è¯¢%lld的所有者" + eng "You are not owner of query %lld" + ger "Sie sind nicht Eigentümer von Abfrage %lld" + hindi "आप कà¥à¤µà¥‡à¤°à¥€ %lld के OWNER नहीं हैं" + rus "Ð’Ñ‹ не ÑвлÑетеÑÑŒ владельцем запроÑа %lld" + spa "No eres el propietario de la consulta (query) %lld" ER_NO_EIS_FOR_FIELD chi "æ²¡æœ‰æ”¶é›†æ— å…³çš„ç»Ÿè®¡ä¿¡æ¯åˆ—'%s'" eng "Engine-independent statistics are not collected for column '%s'" diff --git a/sql/slave.cc b/sql/slave.cc index 7db5a31d439..86180af8aed 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4256,6 +4256,21 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, int exec_res; Log_event_type typ= ev->get_type_code(); + DBUG_EXECUTE_IF( + "pause_sql_thread_on_next_event", + { + /* + Temporarily unlock data_lock so we can check-in with the IO thread + */ + mysql_mutex_unlock(&rli->data_lock); + DBUG_ASSERT(!debug_sync_set_action( + thd, + STRING_WITH_LEN( + "now SIGNAL paused_on_event WAIT_FOR sql_thread_continue"))); + DBUG_SET("-d,pause_sql_thread_on_next_event"); + mysql_mutex_lock(&rli->data_lock); + }); + /* Even if we don't execute this event, we keep the master timestamp, so that seconds behind master shows correct delta (there are events @@ -4269,10 +4284,10 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, the user might be surprised to see a claim that the slave is up to date long before those queued events are actually executed. */ - if (!rli->mi->using_parallel() && - !(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) + if ((!rli->mi->using_parallel()) && event_can_update_last_master_timestamp(ev)) { rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; + rli->sql_thread_caught_up= false; DBUG_ASSERT(rli->last_master_timestamp >= 0); } @@ -4324,6 +4339,17 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, if (rli->mi->using_parallel()) { + if (unlikely((rli->last_master_timestamp == 0 || + rli->sql_thread_caught_up) && + event_can_update_last_master_timestamp(ev))) + { + if (rli->last_master_timestamp < ev->when) + { + rli->last_master_timestamp= ev->when; + rli->sql_thread_caught_up= false; + } + } + int res= rli->parallel.do_event(serial_rgi, ev, event_size); /* In parallel replication, we need to update the relay log position @@ -4344,7 +4370,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, This is the case for pre-10.0 events without GTID, and for handling slave_skip_counter. */ - if (!(ev->is_artificial_event() || ev->is_relay_log_event() || (ev->when == 0))) + if (event_can_update_last_master_timestamp(ev)) { /* Ignore FD's timestamp as it does not reflect the slave execution @@ -4352,7 +4378,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, data modification event execution last long all this time Seconds_Behind_Master is zero. */ - if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) + if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT && + rli->last_master_timestamp < ev->when) rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; DBUG_ASSERT(rli->last_master_timestamp >= 0); @@ -7406,7 +7433,6 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) if (hot_log) mysql_mutex_unlock(log_lock); - rli->sql_thread_caught_up= false; DBUG_RETURN(ev); } if (opt_reckless_slave) // For mysql-test @@ -7570,7 +7596,6 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) rli->relay_log.wait_for_update_relay_log(rli->sql_driver_thd); // re-acquire data lock since we released it earlier mysql_mutex_lock(&rli->data_lock); - rli->sql_thread_caught_up= false; continue; } /* @@ -7761,12 +7786,19 @@ event(errno: %d cur_log->error: %d)", { sql_print_information("Error reading relay log event: %s", "slave SQL thread was killed"); - DBUG_RETURN(0); + goto end; } err: if (errmsg) sql_print_error("Error reading relay log event: %s", errmsg); + +end: + /* + Set that we are not caught up so if there is a hang/problem on restart, + Seconds_Behind_Master will still grow. + */ + rli->sql_thread_caught_up= false; DBUG_RETURN(0); } #ifdef WITH_WSREP diff --git a/sql/slave.h b/sql/slave.h index 5ca6054a178..e2bd5cec1b9 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -49,6 +49,7 @@ #include "rpl_filter.h" #include "rpl_tblmap.h" #include "rpl_gtid.h" +#include "log_event.h" #define SLAVE_NET_TIMEOUT 60 @@ -293,6 +294,17 @@ extern char *report_host, *report_password; extern I_List<THD> threads; +/* + Check that a binlog event (read from the relay log) is valid to update + last_master_timestamp. That is, a valid event is one with a consistent + timestamp which originated from a primary server. +*/ +static inline bool event_can_update_last_master_timestamp(Log_event *ev) +{ + return ev && !(ev->is_artificial_event() || ev->is_relay_log_event() || + (ev->when == 0)); +} + #else #define close_active_mi() /* no-op */ #endif /* HAVE_REPLICATION */ @@ -119,7 +119,7 @@ public: // TODO: make it private or protected const; public: - virtual ~Sp_handler() {} + virtual ~Sp_handler() = default; static const Sp_handler *handler(enum enum_sql_command cmd); static const Sp_handler *handler(enum_sp_type type); static const Sp_handler *handler(MDL_key::enum_mdl_namespace ns); diff --git a/sql/sp_head.h b/sql/sp_head.h index 97ea4e7b89a..5b4aa36e518 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -124,8 +124,7 @@ public: /** Create temporary sp_name object from MDL key. Store in qname_buff */ sp_name(const MDL_key *key, char *qname_buff); - ~sp_name() - {} + ~sp_name() = default; }; @@ -1316,8 +1315,7 @@ public: m_query.length= 0; } - virtual ~sp_instr_stmt() - {}; + virtual ~sp_instr_stmt() = default; virtual int execute(THD *thd, uint *nextp); @@ -1352,8 +1350,7 @@ public: m_lex_keeper(lex, lex_resp) {} - virtual ~sp_instr_set() - {} + virtual ~sp_instr_set() = default; virtual int execute(THD *thd, uint *nextp); @@ -1396,8 +1393,7 @@ public: m_field_offset(field_offset) {} - virtual ~sp_instr_set_row_field() - {} + virtual ~sp_instr_set_row_field() = default; virtual int exec_core(THD *thd, uint *nextp); @@ -1439,8 +1435,7 @@ public: m_field_name(field_name) {} - virtual ~sp_instr_set_row_field_by_name() - {} + virtual ~sp_instr_set_row_field_by_name() = default; virtual int exec_core(THD *thd, uint *nextp); @@ -1466,8 +1461,7 @@ public: value(val), m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_set_trigger_field() - {} + virtual ~sp_instr_set_trigger_field() = default; virtual int execute(THD *thd, uint *nextp); @@ -1510,8 +1504,7 @@ public: m_dest(dest), m_cont_dest(0), m_optdest(0), m_cont_optdest(0) {} - virtual ~sp_instr_opt_meta() - {} + virtual ~sp_instr_opt_meta() = default; virtual void set_destination(uint old_dest, uint new_dest) = 0; @@ -1540,8 +1533,7 @@ public: : sp_instr_opt_meta(ip, ctx, dest) {} - virtual ~sp_instr_jump() - {} + virtual ~sp_instr_jump() = default; virtual int execute(THD *thd, uint *nextp); @@ -1592,8 +1584,7 @@ public: m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_jump_if_not() - {} + virtual ~sp_instr_jump_if_not() = default; virtual int execute(THD *thd, uint *nextp); @@ -1640,8 +1631,7 @@ public: : sp_instr(ip, ctx) {} - virtual ~sp_instr_preturn() - {} + virtual ~sp_instr_preturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1672,8 +1662,7 @@ public: m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_freturn() - {} + virtual ~sp_instr_freturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1778,8 +1767,7 @@ public: : sp_instr(ip, ctx), m_count(count) {} - virtual ~sp_instr_hpop() - {} + virtual ~sp_instr_hpop() = default; void update_count(uint count) { @@ -1812,8 +1800,7 @@ public: m_frame(ctx->current_var_count()) {} - virtual ~sp_instr_hreturn() - {} + virtual ~sp_instr_hreturn() = default; virtual int execute(THD *thd, uint *nextp); @@ -1849,8 +1836,7 @@ public: : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE), m_cursor(offset) {} - virtual ~sp_instr_cpush() - {} + virtual ~sp_instr_cpush() = default; int execute(THD *thd, uint *nextp) override; @@ -1885,8 +1871,7 @@ public: : sp_instr(ip, ctx), m_count(count) {} - virtual ~sp_instr_cpop() - {} + virtual ~sp_instr_cpop() = default; void update_count(uint count) { @@ -1918,8 +1903,7 @@ public: : sp_instr(ip, ctx), m_cursor(c) {} - virtual ~sp_instr_copen() - {} + virtual ~sp_instr_copen() = default; virtual int execute(THD *thd, uint *nextp); @@ -1956,8 +1940,7 @@ public: m_cursor(coffs), m_var(voffs) {} - virtual ~sp_instr_cursor_copy_struct() - {} + virtual ~sp_instr_cursor_copy_struct() = default; virtual int execute(THD *thd, uint *nextp); virtual int exec_core(THD *thd, uint *nextp); virtual void print(String *str); @@ -1979,8 +1962,7 @@ public: : sp_instr(ip, ctx), m_cursor(c) {} - virtual ~sp_instr_cclose() - {} + virtual ~sp_instr_cclose() = default; virtual int execute(THD *thd, uint *nextp); @@ -2009,8 +1991,7 @@ public: m_varlist.empty(); } - virtual ~sp_instr_cfetch() - {} + virtual ~sp_instr_cfetch() = default; virtual int execute(THD *thd, uint *nextp); @@ -2048,8 +2029,7 @@ public: sp_instr_agg_cfetch(uint ip, sp_pcontext *ctx) : sp_instr(ip, ctx){} - virtual ~sp_instr_agg_cfetch() - {} + virtual ~sp_instr_agg_cfetch() = default; virtual int execute(THD *thd, uint *nextp); @@ -2074,8 +2054,7 @@ public: : sp_instr(ip, ctx), m_errcode(errcode) {} - virtual ~sp_instr_error() - {} + virtual ~sp_instr_error() = default; virtual int execute(THD *thd, uint *nextp); @@ -2108,8 +2087,7 @@ public: m_lex_keeper(lex, TRUE) {} - virtual ~sp_instr_set_case_expr() - {} + virtual ~sp_instr_set_case_expr() = default; virtual int execute(THD *thd, uint *nextp); diff --git a/sql/spatial.h b/sql/spatial.h index 8974511adf9..d85bdc86af4 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -214,8 +214,8 @@ struct Geometry_buffer; class Geometry { public: - Geometry() {} /* Remove gcc warning */ - virtual ~Geometry() {} /* Remove gcc warning */ + Geometry() = default; /* Remove gcc warning */ + virtual ~Geometry() = default; /* Remove gcc warning */ static void *operator new(size_t size, void *buffer) { return buffer; @@ -395,8 +395,8 @@ protected: class Gis_point: public Geometry { public: - Gis_point() {} /* Remove gcc warning */ - virtual ~Gis_point() {} /* Remove gcc warning */ + Gis_point() = default; /* Remove gcc warning */ + virtual ~Gis_point() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -465,8 +465,8 @@ public: class Gis_line_string: public Geometry { public: - Gis_line_string() {} /* Remove gcc warning */ - virtual ~Gis_line_string() {} /* Remove gcc warning */ + Gis_line_string() = default; /* Remove gcc warning */ + virtual ~Gis_line_string() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -498,8 +498,8 @@ public: class Gis_polygon: public Geometry { public: - Gis_polygon() {} /* Remove gcc warning */ - virtual ~Gis_polygon() {} /* Remove gcc warning */ + Gis_polygon() = default; /* Remove gcc warning */ + virtual ~Gis_polygon() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -535,8 +535,8 @@ class Gis_multi_point: public Geometry (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) / (WKB_HEADER_SIZE + POINT_DATA_SIZE); public: - Gis_multi_point() {} /* Remove gcc warning */ - virtual ~Gis_multi_point() {} /* Remove gcc warning */ + Gis_multi_point() = default; /* Remove gcc warning */ + virtual ~Gis_multi_point() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -566,8 +566,8 @@ public: class Gis_multi_line_string: public Geometry { public: - Gis_multi_line_string() {} /* Remove gcc warning */ - virtual ~Gis_multi_line_string() {} /* Remove gcc warning */ + Gis_multi_line_string() = default; /* Remove gcc warning */ + virtual ~Gis_multi_line_string() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -597,8 +597,8 @@ public: class Gis_multi_polygon: public Geometry { public: - Gis_multi_polygon() {} /* Remove gcc warning */ - virtual ~Gis_multi_polygon() {} /* Remove gcc warning */ + Gis_multi_polygon() = default; /* Remove gcc warning */ + virtual ~Gis_multi_polygon() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -628,8 +628,8 @@ public: class Gis_geometry_collection: public Geometry { public: - Gis_geometry_collection() {} /* Remove gcc warning */ - virtual ~Gis_geometry_collection() {} /* Remove gcc warning */ + Gis_geometry_collection() = default; /* Remove gcc warning */ + virtual ~Gis_geometry_collection() = default; /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c2a9a99837e..6f2fa9bf672 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -206,7 +206,7 @@ class ACL_USER :public ACL_USER_BASE, { public: - ACL_USER() { } + ACL_USER() = default; ACL_USER(THD *thd, const LEX_USER &combo, const Account_options &options, const privilege_t privileges); @@ -351,7 +351,7 @@ class ACL_PROXY_USER :public ACL_ACCESS MYSQL_PROXIES_PRIV_GRANTOR, MYSQL_PROXIES_PRIV_TIMESTAMP } proxy_table_fields; public: - ACL_PROXY_USER () {}; + ACL_PROXY_USER () = default; void init(const char *host_arg, const char *user_arg, const char *proxied_host_arg, const char *proxied_user_arg, @@ -942,7 +942,7 @@ class User_table: public Grant_table_base virtual longlong get_password_lifetime () const = 0; virtual int set_password_lifetime (longlong x) const = 0; - virtual ~User_table() {} + virtual ~User_table() = default; private: friend class Grant_tables; virtual int setup_sysvars() const = 0; @@ -1291,7 +1291,7 @@ class User_table_tabular: public User_table return 1; } - virtual ~User_table_tabular() {} + virtual ~User_table_tabular() = default; private: friend class Grant_tables; @@ -1692,7 +1692,7 @@ class User_table_json: public User_table int set_password_expired (bool x) const { return x ? set_password_last_changed(0) : 0; } - ~User_table_json() {} + ~User_table_json() = default; private: friend class Grant_tables; static const uint JSON_SIZE=1024; @@ -5398,7 +5398,7 @@ public: GRANT_NAME(const char *h, const char *d,const char *u, const char *t, privilege_t p, bool is_routine); GRANT_NAME (TABLE *form, bool is_routine); - virtual ~GRANT_NAME() {}; + virtual ~GRANT_NAME() = default; virtual bool ok() { return privs != NO_ACL; } void set_user_details(const char *h, const char *d, const char *u, const char *t, @@ -11731,8 +11731,7 @@ public: : is_grave(FALSE) {} - virtual ~Silence_routine_definer_errors() - {} + virtual ~Silence_routine_definer_errors() = default; virtual bool handle_condition(THD *thd, uint sql_errno, diff --git a/sql/sql_acl.h b/sql/sql_acl.h index ab98cfff364..fb8dd2c3763 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -186,11 +186,9 @@ enum ACL_internal_access_result class ACL_internal_table_access { public: - ACL_internal_table_access() - {} + ACL_internal_table_access() = default; - virtual ~ACL_internal_table_access() - {} + virtual ~ACL_internal_table_access() = default; /** Check access to an internal table. @@ -225,11 +223,9 @@ public: class ACL_internal_schema_access { public: - ACL_internal_schema_access() - {} + ACL_internal_schema_access() = default; - virtual ~ACL_internal_schema_access() - {} + virtual ~ACL_internal_schema_access() = default; /** Check access to an internal schema. diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 71039affd2b..465145cf25f 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -44,7 +44,8 @@ const LEX_CSTRING msg_optimize= { STRING_WITH_LEN("optimize") }; /* Prepare, run and cleanup for mysql_recreate_table() */ -static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) +static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list, + Recreate_info *recreate_info) { bool result_code; DBUG_ENTER("admin_recreate_table"); @@ -65,7 +66,7 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) DEBUG_SYNC(thd, "ha_admin_try_alter"); tmp_disable_binlog(thd); // binlogging is done by caller if wanted result_code= (thd->open_temporary_tables(table_list) || - mysql_recreate_table(thd, table_list, false)); + mysql_recreate_table(thd, table_list, recreate_info, false)); reenable_binlog(thd); /* mysql_recreate_table() can push OK or ERROR. @@ -560,6 +561,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, bool open_error= 0; bool collect_eis= FALSE; bool open_for_modify= org_open_for_modify; + Recreate_info recreate_info; storage_engine_name[0]= 0; // Marker that's not used @@ -829,7 +831,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { /* We use extra_open_options to be able to open crashed tables */ thd->open_options|= extra_open_options; - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info) ? + HA_ADMIN_FAILED : HA_ADMIN_OK; thd->open_options&= ~extra_open_options; goto send_result; } @@ -1012,12 +1015,31 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, repair was not implemented and we need to upgrade the table to a new version so we recreate the table with ALTER TABLE */ - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info); } send_result: lex->cleanup_after_one_table_open(); thd->clear_error(); // these errors shouldn't get client + + if (recreate_info.records_duplicate()) + { + protocol->prepare_for_resend(); + protocol->store(&table_name, system_charset_info); + protocol->store(operator_name, system_charset_info); + protocol->store(warning_level_names[Sql_condition::WARN_LEVEL_WARN].str, + warning_level_names[Sql_condition::WARN_LEVEL_WARN].length, + system_charset_info); + char buf[80]; + size_t length= my_snprintf(buf, sizeof(buf), + "Number of rows changed from %u to %u", + (uint) recreate_info.records_processed(), + (uint) recreate_info.records_copied()); + protocol->store(buf, length, system_charset_info); + if (protocol->write()) + goto err; + } + { Diagnostics_area::Sql_condition_iterator it= thd->get_stmt_da()->sql_conditions(); @@ -1128,7 +1150,7 @@ send_result_message: *save_next_global= table->next_global; table->next_local= table->next_global= 0; - result_code= admin_recreate_table(thd, table); + result_code= admin_recreate_table(thd, table, &recreate_info); trans_commit_stmt(thd); trans_commit(thd); close_thread_tables(thd); @@ -1340,6 +1362,8 @@ send_result_message: goto err; DEBUG_SYNC(thd, "admin_command_kill_after_modify"); } + thd->resume_subsequent_commits(suspended_wfc); + DBUG_EXECUTE_IF("inject_analyze_table_sleep", my_sleep(500000);); if (is_table_modified && is_cmd_replicated && (!opt_readonly || thd->slave_thread) && !thd->lex->no_write_to_binlog) { @@ -1349,10 +1373,8 @@ send_result_message: if (res) goto err; } - my_eof(thd); - thd->resume_subsequent_commits(suspended_wfc); - DBUG_EXECUTE_IF("inject_analyze_table_sleep", my_sleep(500000);); + DBUG_RETURN(FALSE); err: @@ -1501,6 +1523,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd) LEX *m_lex= thd->lex; TABLE_LIST *first_table= m_lex->first_select_lex()->table_list.first; bool res= TRUE; + Recreate_info recreate_info; DBUG_ENTER("Sql_cmd_optimize_table::execute"); if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table, @@ -1509,7 +1532,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd) WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, first_table); res= (specialflag & SPECIAL_NO_NEW_FUNC) ? - mysql_recreate_table(thd, first_table, true) : + mysql_recreate_table(thd, first_table, &recreate_info, true) : mysql_admin_table(thd, first_table, &m_lex->check_opt, &msg_optimize, TL_WRITE, 1, 0, 0, 0, &handler::ha_optimize, 0, true); diff --git a/sql/sql_admin.h b/sql/sql_admin.h index 0c7f1c3cee5..1a237d4f616 100644 --- a/sql/sql_admin.h +++ b/sql/sql_admin.h @@ -34,11 +34,9 @@ public: /** Constructor, used to represent a ANALYZE TABLE statement. */ - Sql_cmd_analyze_table() - {} + Sql_cmd_analyze_table() = default; - ~Sql_cmd_analyze_table() - {} + ~Sql_cmd_analyze_table() = default; bool execute(THD *thd); @@ -59,11 +57,9 @@ public: /** Constructor, used to represent a CHECK TABLE statement. */ - Sql_cmd_check_table() - {} + Sql_cmd_check_table() = default; - ~Sql_cmd_check_table() - {} + ~Sql_cmd_check_table() = default; bool execute(THD *thd); @@ -83,11 +79,9 @@ public: /** Constructor, used to represent a OPTIMIZE TABLE statement. */ - Sql_cmd_optimize_table() - {} + Sql_cmd_optimize_table() = default; - ~Sql_cmd_optimize_table() - {} + ~Sql_cmd_optimize_table() = default; bool execute(THD *thd); @@ -108,11 +102,9 @@ public: /** Constructor, used to represent a REPAIR TABLE statement. */ - Sql_cmd_repair_table() - {} + Sql_cmd_repair_table() = default; - ~Sql_cmd_repair_table() - {} + ~Sql_cmd_repair_table() = default; bool execute(THD *thd); diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index ffcc7679273..5959203b36d 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -554,9 +554,11 @@ bool Sql_cmd_alter_table::execute(THD *thd) thd->work_part_info= 0; #endif + Recreate_info recreate_info; result= mysql_alter_table(thd, &select_lex->db, &lex->name, &create_info, first_table, + &recreate_info, &alter_info, select_lex->order_list.elements, select_lex->order_list.first, diff --git a/sql/sql_alter.h b/sql/sql_alter.h index bf1edd4c964..99e717d50b2 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -372,11 +372,9 @@ protected: /** Constructor. */ - Sql_cmd_common_alter_table() - {} + Sql_cmd_common_alter_table() = default; - virtual ~Sql_cmd_common_alter_table() - {} + virtual ~Sql_cmd_common_alter_table() = default; virtual enum_sql_command sql_command_code() const { @@ -395,11 +393,9 @@ public: /** Constructor, used to represent a ALTER TABLE statement. */ - Sql_cmd_alter_table() - {} + Sql_cmd_alter_table() = default; - ~Sql_cmd_alter_table() - {} + ~Sql_cmd_alter_table() = default; Storage_engine_name *option_storage_engine_name() { return this; } @@ -421,8 +417,7 @@ public: :DDL_options(options) {} - ~Sql_cmd_alter_sequence() - {} + ~Sql_cmd_alter_sequence() = default; enum_sql_command sql_command_code() const { diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9634cd4bb48..fa2b144e06f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1420,7 +1420,7 @@ public: : m_ot_ctx(ot_ctx_arg), m_is_active(FALSE) {} - virtual ~MDL_deadlock_handler() {} + virtual ~MDL_deadlock_handler() = default; virtual bool handle_condition(THD *thd, uint sql_errno, diff --git a/sql/sql_base.h b/sql/sql_base.h index 1b294a468a9..6e17d8214ad 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -395,7 +395,7 @@ inline bool setup_fields_with_no_wrap(THD *thd, Ref_ptr_array ref_pointer_array, class Prelocking_strategy { public: - virtual ~Prelocking_strategy() { } + virtual ~Prelocking_strategy() = default; virtual void reset(THD *thd) { }; virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx, diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 61b3df2d086..05b201a5d6e 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -90,7 +90,7 @@ public: or to call set_all()/clear_all()/set_prefix() to initialize bitmap. */ - Bitmap() { } + Bitmap() = default; explicit Bitmap(uint prefix) { diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 126693b9964..a02034764a7 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -91,7 +91,7 @@ typedef my_bool (*qc_engine_callback)(THD *thd, const char *table_key, */ struct Query_cache_block_table { - Query_cache_block_table() {} /* Remove gcc warning */ + Query_cache_block_table() = default; /* Remove gcc warning */ /** This node holds a position in a static table list belonging @@ -122,7 +122,7 @@ struct Query_cache_block_table struct Query_cache_block { - Query_cache_block() {} /* Remove gcc warning */ + Query_cache_block() = default; /* Remove gcc warning */ enum block_type {FREE, QUERY, RESULT, RES_CONT, RES_BEG, RES_INCOMPLETE, TABLE, INCOMPLETE}; @@ -161,7 +161,7 @@ struct Query_cache_query uint8 ready; ulonglong hit_count; - Query_cache_query() {} /* Remove gcc warning */ + Query_cache_query() = default; /* Remove gcc warning */ inline void init_n_lock(); void unlock_n_destroy(); inline ulonglong found_rows() { return limit_found_rows; } @@ -197,7 +197,7 @@ struct Query_cache_query struct Query_cache_table { - Query_cache_table() {} /* Remove gcc warning */ + Query_cache_table() = default; /* Remove gcc warning */ char *tbl; uint32 key_len; uint8 suffix_len; /* For partitioned tables */ @@ -240,7 +240,7 @@ struct Query_cache_table struct Query_cache_result { - Query_cache_result() {} /* Remove gcc warning */ + Query_cache_result() = default; /* Remove gcc warning */ Query_cache_block *query; inline uchar* data() @@ -266,7 +266,7 @@ extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename); struct Query_cache_memory_bin { - Query_cache_memory_bin() {} /* Remove gcc warning */ + Query_cache_memory_bin() = default; /* Remove gcc warning */ #ifndef DBUG_OFF size_t size; #endif @@ -285,7 +285,7 @@ struct Query_cache_memory_bin struct Query_cache_memory_bin_step { - Query_cache_memory_bin_step() {} /* Remove gcc warning */ + Query_cache_memory_bin_step() = default; /* Remove gcc warning */ size_t size; size_t increment; size_t idx; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 17ce7b3c048..79db032c937 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4032,9 +4032,7 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup) DBUG_VOID_RETURN; } -Statement::~Statement() -{ -} +Statement::~Statement() = default; C_MODE_START @@ -8335,6 +8333,20 @@ bool THD::timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts, return 0; } + +void THD::my_ok_with_recreate_info(const Recreate_info &info, + ulong warn_count) +{ + char buf[80]; + my_snprintf(buf, sizeof(buf), + ER_THD(this, ER_INSERT_INFO), + (ulong) info.records_processed(), + (ulong) info.records_duplicate(), + warn_count); + my_ok(this, info.records_processed(), 0L, buf); +} + + THD_list_iterator *THD_list_iterator::iterator() { return &server_threads; diff --git a/sql/sql_class.h b/sql/sql_class.h index ef299e4eb12..bbadff29110 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -247,6 +247,29 @@ public: }; +class Recreate_info +{ + ha_rows m_records_copied; + ha_rows m_records_duplicate; +public: + Recreate_info() + :m_records_copied(0), + m_records_duplicate(0) + { } + Recreate_info(ha_rows records_copied, + ha_rows records_duplicate) + :m_records_copied(records_copied), + m_records_duplicate(records_duplicate) + { } + ha_rows records_copied() const { return m_records_copied; } + ha_rows records_duplicate() const { return m_records_duplicate; } + ha_rows records_processed() const + { + return m_records_copied + m_records_duplicate; + } +}; + + #define TC_HEURISTIC_RECOVER_COMMIT 1 #define TC_HEURISTIC_RECOVER_ROLLBACK 2 extern ulong tc_heuristic_recover; @@ -452,7 +475,7 @@ public: invisible(false), without_overlaps(false) {} Key(const Key &rhs, MEM_ROOT *mem_root); - virtual ~Key() {} + virtual ~Key() = default; /* Equality comparison of keys (ignoring name) */ friend bool foreign_key_prefix(Key *a, Key *b); /** @@ -1180,7 +1203,7 @@ public: Query_arena() { INIT_ARENA_DBUG_INFO; } virtual Type type() const; - virtual ~Query_arena() {}; + virtual ~Query_arena() = default; inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; } inline bool is_stmt_prepare_or_first_sp_execute() const @@ -1231,7 +1254,7 @@ public: Query_arena_memroot() : Query_arena() {} - virtual ~Query_arena_memroot() {} + virtual ~Query_arena_memroot() = default; }; @@ -1381,7 +1404,7 @@ public: my_bool query_cache_is_applicable; /* This constructor is called for backup statements */ - Statement() {} + Statement() = default; Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, enum enum_state state_arg, ulong id_arg); @@ -1893,7 +1916,7 @@ protected: m_prev_internal_handler(NULL) {} - virtual ~Internal_error_handler() {} + virtual ~Internal_error_handler() = default; public: /** @@ -1951,7 +1974,7 @@ public: /* Ignore error */ return TRUE; } - Dummy_error_handler() {} /* Remove gcc warning */ + Dummy_error_handler() = default; /* Remove gcc warning */ }; @@ -1988,7 +2011,7 @@ public: class Drop_table_error_handler : public Internal_error_handler { public: - Drop_table_error_handler() {} + Drop_table_error_handler() = default; public: bool handle_condition(THD *thd, @@ -2029,7 +2052,7 @@ private: class Turn_errors_to_warnings_handler : public Internal_error_handler { public: - Turn_errors_to_warnings_handler() {} + Turn_errors_to_warnings_handler() = default; bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, @@ -4364,6 +4387,8 @@ public: inline bool vio_ok() const { return TRUE; } inline bool is_connected() { return TRUE; } #endif + + void my_ok_with_recreate_info(const Recreate_info &info, ulong warn_count); /** Mark the current error as fatal. Warning: this does not set any error, it sets a property of the error, so must be @@ -5727,7 +5752,7 @@ public: example for a duplicate row entry written to a temp table. */ virtual int send_data(List<Item> &items)=0; - virtual ~select_result_sink() {}; + virtual ~select_result_sink() = default; void reset(THD *thd_arg) { thd= thd_arg; } }; @@ -5759,7 +5784,7 @@ public: ha_rows est_records; /* estimated number of records in the result */ select_result(THD *thd_arg): select_result_sink(thd_arg), est_records(0) {} void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; } - virtual ~select_result() {}; + virtual ~select_result() = default; /** Change wrapped select_result. @@ -6277,6 +6302,12 @@ public: uint sum_func_count; uint hidden_field_count; uint group_parts,group_length,group_null_parts; + + /* + If we're doing a GROUP BY operation, shows which one is used: + true TemporaryTableWithPartialSums algorithm (see end_update()). + false OrderedGroupBy algorithm (see end_write_group()). + */ uint quick_group; /** Enabled when we have atleast one outer_sum_func. Needed when used @@ -7000,7 +7031,7 @@ class user_var_entry { CHARSET_INFO *m_charset; public: - user_var_entry() {} /* Remove gcc warning */ + user_var_entry() = default; /* Remove gcc warning */ LEX_CSTRING name; char *value; size_t length; @@ -7121,7 +7152,7 @@ public: enum type { SESSION_VAR, LOCAL_VAR, PARAM_VAR }; type scope; my_var(const LEX_CSTRING *j, enum type s) : name(*j), scope(s) { } - virtual ~my_var() {} + virtual ~my_var() = default; virtual bool set(THD *thd, Item *val) = 0; virtual my_var_sp *get_my_var_sp() { return NULL; } }; @@ -7142,7 +7173,7 @@ public: : my_var(j, LOCAL_VAR), m_rcontext_handler(rcontext_handler), m_type_handler(type_handler), offset(o), sp(s) { } - ~my_var_sp() { } + ~my_var_sp() = default; bool set(THD *thd, Item *val); my_var_sp *get_my_var_sp() { return this; } const Type_handler *type_handler() const @@ -7172,7 +7203,7 @@ class my_var_user: public my_var { public: my_var_user(const LEX_CSTRING *j) : my_var(j, SESSION_VAR) { } - ~my_var_user() { } + ~my_var_user() = default; bool set(THD *thd, Item *val); }; @@ -7185,7 +7216,7 @@ public: select_dumpvar(THD *thd_arg) :select_result_interceptor(thd_arg), row_count(0), m_var_sp_row(NULL) { var_list.empty(); } - ~select_dumpvar() {} + ~select_dumpvar() = default; int prepare(List<Item> &list, SELECT_LEX_UNIT *u); int send_data(List<Item> &items); bool send_eof(); diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index 1a01caa77dd..2623b3703d3 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -193,8 +193,7 @@ public: } protected: - Sql_cmd() - {} + Sql_cmd() = default; virtual ~Sql_cmd() { @@ -262,8 +261,7 @@ public: m_handler(handler) {} - virtual ~Sql_cmd_call() - {} + virtual ~Sql_cmd_call() = default; /** Execute a CALL statement at runtime. diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h index 3c90550c944..aab97501b48 100644 --- a/sql/sql_crypt.h +++ b/sql/sql_crypt.h @@ -30,12 +30,12 @@ class SQL_CRYPT :public Sql_alloc char decode_buff[256],encode_buff[256]; uint shift; public: - SQL_CRYPT() {} + SQL_CRYPT() = default; SQL_CRYPT(ulong *seed) { init(seed); } - ~SQL_CRYPT() {} + ~SQL_CRYPT() = default; void init(ulong *seed); void reinit() { shift=0; rand=org_rand; } void encode(char *str, uint length); diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index a526bfee2d2..ad385128d8d 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -102,49 +102,6 @@ bool LEX::check_dependencies_in_with_clauses() /** @brief - Resolve references to CTE in specification of hanging CTE - - @details - A CTE to which there are no references in the query is called hanging CTE. - Although such CTE is not used for execution its specification must be - subject to context analysis. All errors concerning references to - non-existing tables or fields occurred in the specification must be - reported as well as all other errors caught at the prepare stage. - The specification of a hanging CTE might contain references to other - CTE outside of the specification and within it if the specification - contains a with clause. This function resolves all such references for - all hanging CTEs encountered in the processed query. - - @retval - false on success - true on failure -*/ - -bool -LEX::resolve_references_to_cte_in_hanging_cte() -{ - for (With_clause *with_clause= with_clauses_list; - with_clause; with_clause= with_clause->next_with_clause) - { - for (With_element *with_elem= with_clause->with_list.first; - with_elem; with_elem= with_elem->next) - { - if (!with_elem->is_referenced()) - { - TABLE_LIST *first_tbl= - with_elem->spec->first_select()->table_list.first; - TABLE_LIST **with_elem_end_pos= with_elem->head->tables_pos.end_pos; - if (first_tbl && resolve_references_to_cte(first_tbl, with_elem_end_pos)) - return true; - } - } - } - return false; -} - - -/** - @brief Resolve table references to CTE from a sub-chain of table references @param tables Points to the beginning of the sub-chain @@ -289,8 +246,6 @@ LEX::check_cte_dependencies_and_resolve_references() return false; if (resolve_references_to_cte(query_tables, query_tables_last)) return true; - if (resolve_references_to_cte_in_hanging_cte()) - return true; return false; } @@ -489,47 +444,33 @@ With_element *find_table_def_in_with_clauses(TABLE_LIST *tbl, st_unit_ctxt_elem *ctxt) { With_element *found= 0; + st_select_lex_unit *top_unit= 0; for (st_unit_ctxt_elem *unit_ctxt_elem= ctxt; unit_ctxt_elem; unit_ctxt_elem= unit_ctxt_elem->prev) { st_select_lex_unit *unit= unit_ctxt_elem->unit; With_clause *with_clause= unit->with_clause; - /* - First look for the table definition in the with clause attached to 'unit' - if there is any such clause. - */ if (with_clause) { - found= with_clause->find_table_def(tbl, NULL); + /* + If the reference to tbl that has to be resolved belongs to + the FROM clause of a descendant of top_unit->with_element + and this with element belongs to with_clause then this + element must be used as the barrier for the search in the + the list of CTEs from with_clause unless the clause contains + RECURSIVE. + */ + With_element *barrier= 0; + if (top_unit && !with_clause->with_recursive && + top_unit->with_element && + top_unit->with_element->get_owner() == with_clause) + barrier= top_unit->with_element; + found= with_clause->find_table_def(tbl, barrier); if (found) break; } - /* - If 'unit' is the unit that defines a with element then reset 'unit' - to the unit whose attached with clause contains this with element. - */ - With_element *with_elem= unit->with_element; - if (with_elem) - { - if (!(unit_ctxt_elem= unit_ctxt_elem->prev)) - break; - unit= unit_ctxt_elem->unit; - } - with_clause= unit->with_clause; - /* - Now look for the table definition in this with clause. If the with clause - contains RECURSIVE the search is performed through all CTE definitions in - clause, otherwise up to the definition of 'with_elem' unless it is NULL. - */ - if (with_clause) - { - found= with_clause->find_table_def(tbl, - with_clause->with_recursive ? - NULL : with_elem); - if (found) - break; - } + top_unit= unit; } return found; } diff --git a/sql/sql_cte.h b/sql/sql_cte.h index e0fbd79803b..6a1f67d3258 100644 --- a/sql/sql_cte.h +++ b/sql/sql_cte.h @@ -326,8 +326,6 @@ public: friend bool LEX::resolve_references_to_cte(TABLE_LIST *tables, TABLE_LIST **tables_last); - friend - bool LEX::resolve_references_to_cte_in_hanging_cte(); }; const uint max_number_of_elements_in_with_clause= sizeof(table_map)*8; @@ -441,9 +439,6 @@ public: friend bool LEX::check_dependencies_in_with_clauses(); - - friend - bool LEX::resolve_references_to_cte_in_hanging_cte(); }; inline diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index d45f2ac8777..cef8ac161df 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -197,9 +197,7 @@ end: Server_side_cursor ****************************************************************************/ -Server_side_cursor::~Server_side_cursor() -{ -} +Server_side_cursor::~Server_side_cursor() = default; void Server_side_cursor::operator delete(void *ptr, size_t size) diff --git a/sql/sql_debug.h b/sql/sql_debug.h index 6109ca38048..003caec5454 100644 --- a/sql/sql_debug.h +++ b/sql/sql_debug.h @@ -22,7 +22,7 @@ class Debug_key: public String { public: - Debug_key() { }; + Debug_key() = default; void print(THD *thd) const { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, diff --git a/sql/sql_error.h b/sql/sql_error.h index d7c29c5f9a4..541b92b4531 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -245,8 +245,7 @@ class Sql_condition_identity: public Sql_state_errno_level, public Sql_user_condition_identity { public: - Sql_condition_identity() - { } + Sql_condition_identity() = default; Sql_condition_identity(const Sql_state_errno_level &st, const Sql_user_condition_identity &ucid) :Sql_state_errno_level(st), @@ -450,8 +449,7 @@ private: } /** Destructor. */ - ~Sql_condition() - {} + ~Sql_condition() = default; /** Copy optional condition items attributes. @@ -871,8 +869,8 @@ public: class ErrConv: public ErrBuff { public: - ErrConv() {} - virtual ~ErrConv() {} + ErrConv() = default; + virtual ~ErrConv() = default; virtual LEX_CSTRING lex_cstring() const= 0; inline const char *ptr() const { diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 67abfe2e9da..03eb8821a34 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -142,7 +142,7 @@ public: Json_writer *writer, bool is_analyze, bool no_tmp_tbl); bool print_explain_json_cache(Json_writer *writer, bool is_analyze); - virtual ~Explain_node(){} + virtual ~Explain_node() = default; }; @@ -291,7 +291,7 @@ class Explain_aggr_node : public Sql_alloc { public: virtual enum_explain_aggr_node_type get_type()= 0; - virtual ~Explain_aggr_node() {} + virtual ~Explain_aggr_node() = default; Explain_aggr_node *child; }; diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h index 9c618a5ae9b..88436837a2d 100644 --- a/sql/sql_expression_cache.h +++ b/sql/sql_expression_cache.h @@ -36,8 +36,8 @@ class Expression_cache :public Sql_alloc public: enum result {ERROR, HIT, MISS}; - Expression_cache(){}; - virtual ~Expression_cache() {}; + Expression_cache()= default; + virtual ~Expression_cache() = default; /** Shall check the presence of expression value in the cache for a given set of values of the expression parameters. Return the result of the diff --git a/sql/sql_hset.h b/sql/sql_hset.h index b3d8165f6f6..41573fb5f03 100644 --- a/sql/sql_hset.h +++ b/sql/sql_hset.h @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ +#include "my_global.h" #include "hash.h" @@ -28,17 +29,15 @@ class Hash_set public: enum { START_SIZE= 8 }; /** - Constructs an empty hash. Does not allocate memory, it is done upon - the first insert. Thus does not cause or return errors. + Constructs an empty unique hash. */ Hash_set(PSI_memory_key psi_key, uchar *(*K)(const T *, size_t *, my_bool), CHARSET_INFO *cs= &my_charset_bin) { - my_hash_clear(&m_hash); - m_hash.get_key= (my_hash_get_key)K; - m_hash.charset= cs; - m_hash.array.m_psi_key= psi_key; + my_hash_init(psi_key, &m_hash, cs, START_SIZE, 0, 0, (my_hash_get_key)K, 0, + HASH_UNIQUE); } + Hash_set(PSI_memory_key psi_key, CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, my_hash_get_key get_key, void (*free_element)(void*), uint flags) @@ -65,8 +64,6 @@ public: */ bool insert(T *value) { - my_hash_init_opt(m_hash.array.m_psi_key, &m_hash, m_hash.charset, - START_SIZE, 0, 0, m_hash.get_key, 0, HASH_UNIQUE); return my_hash_insert(&m_hash, reinterpret_cast<const uchar*>(value)); } bool remove(T *value) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5d713d2176e..6e042d25805 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4038,7 +4038,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) lex->current_select->join->select_options|= OPTION_BUFFER_RESULT; } else if (!(lex->current_select->options & OPTION_BUFFER_RESULT) && - thd->locked_tables_mode <= LTM_LOCK_TABLES) + thd->locked_tables_mode <= LTM_LOCK_TABLES && + !table->s->long_unique_table) { /* We must not yet prepare the result table if it is the same as one of the diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index 2c3bf4022ca..393b3e309d3 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -678,7 +678,7 @@ public: THD *thd(); - virtual ~JOIN_CACHE() {} + virtual ~JOIN_CACHE() = default; void reset_join(JOIN *j) { join= j; } void free() { @@ -1075,7 +1075,7 @@ public: cache= join_tab->cache; } - virtual ~JOIN_TAB_SCAN() {} + virtual ~JOIN_TAB_SCAN() = default; /* Shall calculate the increment of the auxiliary buffer for a record diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5e85d1d0902..ab16a9d0b8b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1291,8 +1291,6 @@ void LEX::start(THD *thd_arg) stmt_var_list.empty(); proc_list.elements=0; - save_group_list.empty(); - save_order_list.empty(); win_ref= NULL; win_frame= NULL; frame_top_bound= NULL; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 95ed308103d..2ddd40568f9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1204,12 +1204,14 @@ public: group_list_ptrs, and re-establish the original list before each execution. */ SQL_I_List<ORDER> group_list; + SQL_I_List<ORDER> save_group_list; Group_list_ptrs *group_list_ptrs; List<Item> item_list; /* list of fields & expressions */ List<Item> pre_fix; /* above list before fix_fields */ List<Item> fix_after_optimize; SQL_I_List<ORDER> order_list; /* ORDER clause */ + SQL_I_List<ORDER> save_order_list; SQL_I_List<ORDER> gorder_list; Lex_select_limit limit_params; /* LIMIT clause parameters */ @@ -1756,8 +1758,8 @@ public: These constructor and destructor serve for creation/destruction of Query_tables_list instances which are used as backup storage. */ - Query_tables_list() {} - ~Query_tables_list() {} + Query_tables_list() = default; + ~Query_tables_list() = default; /* Initializes (or resets) Query_tables_list object for "real" use. */ void reset_query_tables_list(bool init); @@ -2422,13 +2424,9 @@ class Lex_input_stream const char *str, const char *end, int sep); my_charset_conv_wc_mb get_escape_func(THD *thd, my_wc_t sep) const; public: - Lex_input_stream() - { - } + Lex_input_stream() = default; - ~Lex_input_stream() - { - } + ~Lex_input_stream() = default; /** Object initializer. Must be called before usage. @@ -3011,7 +3009,7 @@ public: protected: bool save_explain_data_intern(MEM_ROOT *mem_root, Explain_update *eu, bool is_analyze); public: - virtual ~Update_plan() {} + virtual ~Update_plan() = default; Update_plan(MEM_ROOT *mem_root_arg) : impossible_where(false), no_partitions(false), @@ -3065,7 +3063,7 @@ enum password_exp_type struct Account_options: public USER_RESOURCES { - Account_options() { } + Account_options() = default; void reset() { @@ -3559,8 +3557,6 @@ public: } - SQL_I_List<ORDER> save_group_list; - SQL_I_List<ORDER> save_order_list; LEX_CSTRING *win_ref; Window_frame *win_frame; Window_frame_bound *frame_top_bound; @@ -4823,8 +4819,8 @@ public: const LEX_CSTRING *constraint_name, Table_ident *ref_table_name, DDL_options ddl_options); + bool check_dependencies_in_with_clauses(); - bool resolve_references_to_cte_in_hanging_cte(); bool check_cte_dependencies_and_resolve_references(); bool resolve_references_to_cte(TABLE_LIST *tables, TABLE_LIST **tables_last); @@ -4854,14 +4850,13 @@ class Set_signal_information { public: /** Empty default constructor, use clear() */ - Set_signal_information() {} + Set_signal_information() = default; /** Copy constructor. */ Set_signal_information(const Set_signal_information& set); /** Destructor. */ - ~Set_signal_information() - {} + ~Set_signal_information() = default; /** Clear all items. */ void clear(); @@ -4984,8 +4979,7 @@ public: return m_lip.init(thd, buff, length); } - ~Parser_state() - {} + ~Parser_state() = default; Lex_input_stream m_lip; Yacc_state m_yacc; diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h index 0347030e4c6..2d648271898 100644 --- a/sql/sql_lifo_buffer.h +++ b/sql/sql_lifo_buffer.h @@ -138,7 +138,7 @@ public: virtual void remove_unused_space(uchar **unused_start, uchar **unused_end)=0; virtual uchar *used_area() = 0; - virtual ~Lifo_buffer() {}; + virtual ~Lifo_buffer() = default; }; diff --git a/sql/sql_list.h b/sql/sql_list.h index edecb0f0be4..5a57c86ef9d 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -54,7 +54,7 @@ public: { elements= tmp.elements; first= tmp.first; - next= tmp.next; + next= elements ? tmp.next : &first;; return *this; } diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index fb7fa26f245..dd19807dd6d 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -1919,7 +1919,7 @@ MY_LOCALE my_locale_th_TH ); /***** LOCALE END th_TH *****/ -/***** LOCALE BEGIN tr_TR: Turkish - Turkey *****/ +/***** LOCALE BEGIN tr_TR: Turkish - Türkiye *****/ static const char *my_locale_month_names_tr_TR[13] = {"Ocak","Åžubat","Mart","Nisan","Mayıs","Haziran","Temmuz","AÄŸustos","Eylül","Ekim","Kasım","Aralık", NullS }; static const char *my_locale_ab_month_names_tr_TR[13] = @@ -1940,7 +1940,7 @@ MY_LOCALE my_locale_tr_TR ( 52, "tr_TR", - "Turkish - Turkey", + "Turkish - Türkiye", FALSE, &my_locale_typelib_month_names_tr_TR, &my_locale_typelib_ab_month_names_tr_TR, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 579e4cd27f7..3b0ef4a7d47 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -118,7 +118,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, */ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); -static void sql_kill(THD *thd, longlong id, killed_state state, killed_type type); +static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type); static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state); static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables); static bool execute_show_status(THD *, TABLE_LIST *); @@ -4210,8 +4210,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + Recreate_info recreate_info; res= mysql_alter_table(thd, &first_table->db, &first_table->table_name, - &create_info, first_table, &alter_info, + &create_info, first_table, + &recreate_info, &alter_info, 0, (ORDER*) 0, 0, lex->if_exists()); break; } @@ -5536,7 +5538,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) MYF(0)); goto error; } - sql_kill(thd, it->val_int(), lex->kill_signal, lex->kill_type); + sql_kill(thd, (my_thread_id) it->val_int(), lex->kill_signal, lex->kill_type); } else sql_kill_user(thd, get_current_user(thd, lex->users_list.head()), @@ -8806,8 +8808,8 @@ TABLE_LIST *st_select_lex::convert_right_join() void st_select_lex::prepare_add_window_spec(THD *thd) { LEX *lex= thd->lex; - lex->save_group_list= group_list; - lex->save_order_list= order_list; + save_group_list= group_list; + save_order_list= order_list; lex->win_ref= NULL; lex->win_frame= NULL; lex->frame_top_bound= NULL; @@ -8834,8 +8836,8 @@ bool st_select_lex::add_window_def(THD *thd, win_part_list_ptr, win_order_list_ptr, win_frame); - group_list= thd->lex->save_group_list; - order_list= thd->lex->save_order_list; + group_list= save_group_list; + order_list= save_order_list; if (parsing_place != SELECT_LIST) { fields_in_window_functions+= win_part_list_ptr->elements + @@ -8861,8 +8863,8 @@ bool st_select_lex::add_window_spec(THD *thd, win_part_list_ptr, win_order_list_ptr, win_frame); - group_list= thd->lex->save_group_list; - order_list= thd->lex->save_order_list; + group_list= save_group_list; + order_list= save_order_list; if (parsing_place != SELECT_LIST) { fields_in_window_functions+= win_part_list_ptr->elements + @@ -9166,12 +9168,12 @@ THD *find_thread_by_id(longlong id, bool query_id) */ uint -kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type type) +kill_one_thread(THD *thd, my_thread_id id, killed_state kill_signal, killed_type type) { THD *tmp; uint error= (type == KILL_TYPE_QUERY ? ER_NO_SUCH_QUERY : ER_NO_SUCH_THREAD); DBUG_ENTER("kill_one_thread"); - DBUG_PRINT("enter", ("id: %lld signal: %d", id, kill_signal)); + DBUG_PRINT("enter", ("id: %lld signal: %d", (long long) id, kill_signal)); tmp= find_thread_by_id(id, type == KILL_TYPE_QUERY); if (!tmp) DBUG_RETURN(error); @@ -9344,7 +9346,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user, */ static -void sql_kill(THD *thd, longlong id, killed_state state, killed_type type) +void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { uint error; #ifdef WITH_WSREP diff --git a/sql/sql_partition_admin.h b/sql/sql_partition_admin.h index 4be9e56e359..b50c3555bcb 100644 --- a/sql/sql_partition_admin.h +++ b/sql/sql_partition_admin.h @@ -127,8 +127,7 @@ public: : Sql_cmd_common_alter_table() {} - ~Sql_cmd_alter_table_exchange_partition() - {} + ~Sql_cmd_alter_table_exchange_partition() = default; bool execute(THD *thd); @@ -150,8 +149,7 @@ public: : Sql_cmd_analyze_table() {} - ~Sql_cmd_alter_table_analyze_partition() - {} + ~Sql_cmd_alter_table_analyze_partition() = default; bool execute(THD *thd); @@ -176,8 +174,7 @@ public: : Sql_cmd_check_table() {} - ~Sql_cmd_alter_table_check_partition() - {} + ~Sql_cmd_alter_table_check_partition() = default; bool execute(THD *thd); @@ -202,8 +199,7 @@ public: : Sql_cmd_optimize_table() {} - ~Sql_cmd_alter_table_optimize_partition() - {} + ~Sql_cmd_alter_table_optimize_partition() = default; bool execute(THD *thd); @@ -228,8 +224,7 @@ public: : Sql_cmd_repair_table() {} - ~Sql_cmd_alter_table_repair_partition() - {} + ~Sql_cmd_alter_table_repair_partition() = default; bool execute(THD *thd); @@ -250,11 +245,9 @@ public: /** Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. */ - Sql_cmd_alter_table_truncate_partition() - {} + Sql_cmd_alter_table_truncate_partition() = default; - virtual ~Sql_cmd_alter_table_truncate_partition() - {} + virtual ~Sql_cmd_alter_table_truncate_partition() = default; bool execute(THD *thd); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f8b4948a3ac..094ff52a4ea 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -342,7 +342,7 @@ static bool register_builtin(struct st_maria_plugin *, struct st_plugin_int *, struct st_plugin_int **); static void unlock_variables(THD *thd, struct system_variables *vars); static void cleanup_variables(struct system_variables *vars); -static void plugin_vars_free_values(sys_var *vars); +static void plugin_vars_free_values(st_mysql_sys_var **vars); static void restore_ptr_backup(uint n, st_ptr_backup *backup); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -1293,7 +1293,7 @@ static void plugin_del(struct st_plugin_int *plugin, uint del_mask) if (!(plugin->state & del_mask)) DBUG_VOID_RETURN; /* Free allocated strings before deleting the plugin. */ - plugin_vars_free_values(plugin->system_vars); + plugin_vars_free_values(plugin->plugin->system_vars); restore_ptr_backup(plugin->nbackups, plugin->ptr_backup); if (plugin->plugin_dl) { @@ -2948,6 +2948,7 @@ sys_var *find_sys_var(THD *thd, const char *str, size_t length, /* called by register_var, construct_options and test_plugin_options. Returns the 'bookmark' for the named variable. + returns null for non thd-local variables. LOCK_system_variables_hash should be at least read locked */ static st_bookmark *find_bookmark(const char *plugin, const char *name, @@ -3004,7 +3005,6 @@ static size_t var_storage_size(int flags) /* returns a bookmark for thd-local variables, creating if neccessary. - returns null for non thd-local variables. Requires that a write lock is obtained on LOCK_system_variables_hash */ static st_bookmark *register_var(const char *plugin, const char *name, @@ -3358,27 +3358,35 @@ void plugin_thdvar_cleanup(THD *thd) variables are no longer accessible and the value space is lost. Note that only string values with PLUGIN_VAR_MEMALLOC are allocated and must be freed. - - @param[in] vars Chain of system variables of a plugin */ -static void plugin_vars_free_values(sys_var *vars) +static void plugin_vars_free_values(st_mysql_sys_var **vars) { DBUG_ENTER("plugin_vars_free_values"); - for (sys_var *var= vars; var; var= var->next) + if (!vars) + DBUG_VOID_RETURN; + + while(st_mysql_sys_var *var= *vars++) { - sys_var_pluginvar *piv= var->cast_pluginvar(); - if (piv && - ((piv->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR) && - (piv->plugin_var->flags & PLUGIN_VAR_MEMALLOC)) + if ((var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && + var->flags & PLUGIN_VAR_MEMALLOC) { - /* Free the string from global_system_variables. */ - char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL); + char **val; + if (var->flags & PLUGIN_VAR_THDLOCAL) + { + st_bookmark *v= find_bookmark(0, var->name, var->flags); + if (!v) + continue; + val= (char**)(global_system_variables.dynamic_variables_ptr + v->offset); + } + else + val= *(char***) (var + 1); + DBUG_PRINT("plugin", ("freeing value for: '%s' addr: %p", - var->name.str, valptr)); - my_free(*valptr); - *valptr= NULL; + var->name, val)); + my_free(*val); + *val= NULL; } } DBUG_VOID_RETURN; @@ -4038,7 +4046,7 @@ static my_option *construct_help_options(MEM_ROOT *mem_root, bzero(opts, sizeof(my_option) * count); /** - some plugin variables (those that don't have PLUGIN_VAR_NOSYSVAR flag) + some plugin variables have their names prefixed with the plugin name. Restore the names here to get the correct (not double-prefixed) help text. We won't need @@sysvars anymore and don't care about their proper names. @@ -4150,9 +4158,6 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, char *varname; sys_var *v; - if (o->flags & PLUGIN_VAR_NOSYSVAR) - continue; - tmp_backup[tmp->nbackups++].save(&o->name); if ((var= find_bookmark(tmp->name.str, o->name, o->flags))) { @@ -4168,6 +4173,12 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, my_casedn_str(&my_charset_latin1, varname); convert_dash_to_underscore(varname, len-1); } + if (o->flags & PLUGIN_VAR_NOSYSVAR) + { + o->name= varname; + continue; + } + const char *s= o->flags & PLUGIN_VAR_DEPRECATED ? "" : NULL; v= new (mem_root) sys_var_pluginvar(&chain, varname, tmp, o, s); v->test_load= (var ? &var->loaded : &static_unload); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index c57e76da52c..1e84471eef2 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -4035,9 +4035,7 @@ Reprepare_observer::report_error(THD *thd) * Server_runnable *******************************************************************/ -Server_runnable::~Server_runnable() -{ -} +Server_runnable::~Server_runnable() = default; /////////////////////////////////////////////////////////////////////////// diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h index 1a96df85a19..ff6e986ec87 100644 --- a/sql/sql_prepare.h +++ b/sql/sql_prepare.h @@ -125,7 +125,7 @@ public: MEM_ROOT *mem_root_arg); /** We don't call member destructors, they all are POD types. */ - ~Ed_result_set() {} + ~Ed_result_set() = default; size_t get_field_count() const { return m_column_count; } diff --git a/sql/sql_schema.h b/sql/sql_schema.h index 886a115cbc5..37f8ceb7250 100644 --- a/sql/sql_schema.h +++ b/sql/sql_schema.h @@ -26,7 +26,7 @@ public: Schema(const LEX_CSTRING &name) :m_name(name) { } - virtual ~Schema() { } + virtual ~Schema() = default; const LEX_CSTRING &name() const { return m_name; } virtual const Type_handler *map_data_type(THD *thd, const Type_handler *src) const diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a88b8a54a08..ccec6f1215b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3801,15 +3801,26 @@ bool JOIN::make_aggr_tables_info() /* If we have different sort & group then we must sort the data by group - and copy it to another tmp table + and copy it to another tmp table. + This code is also used if we are using distinct something we haven't been able to store in the temporary table yet like SEC_TO_TIME(SUM(...)). + + 3. Also, this is used when + - the query has Window functions, + - the GROUP BY operation is done with OrderedGroupBy algorithm. + In this case, the first temptable will contain pre-GROUP-BY data. Force + the creation of the second temporary table. Post-GROUP-BY dataset will be + written there, and then Window Function processing code will be able to + process it. */ if ((group_list && (!test_if_subpart(group_list, order) || select_distinct)) || - (select_distinct && tmp_table_param.using_outer_summary_function)) - { /* Must copy to another table */ + (select_distinct && tmp_table_param.using_outer_summary_function) || + (group_list && !tmp_table_param.quick_group && // (3) + select_lex->have_window_funcs())) // (3) + { /* Must copy to another table */ DBUG_PRINT("info",("Creating group table")); calc_group_buffer(this, group_list); @@ -4235,7 +4246,7 @@ JOIN::optimize_distinct() } /* Optimize "select distinct b from t1 order by key_part_1 limit #" */ - if (order && skip_sort_order) + if (order && skip_sort_order && !unit->lim.is_with_ties()) { /* Should already have been optimized away */ DBUG_ASSERT(ordered_index_usage == ordered_index_order_by); @@ -24138,11 +24149,17 @@ end_send(JOIN *join, JOIN_TAB *join_tab, bool end_of_records) /* @brief - Perform a GROUP BY operation over a stream of rows ordered by their group. - The result is sent into join->result. + Perform OrderedGroupBy operation and write the output into join->result. @detail - Also applies HAVING, etc. + The input stream is ordered by the GROUP BY expression, so groups come + one after another. We only need to accumulate the aggregate value, when + a GROUP BY group ends, check the HAVING and send the group. + + Note that the output comes in the GROUP BY order, which is required by + the MySQL's GROUP BY semantics. No further sorting is needed. + + @seealso end_write_group() also implements SortAndGroup */ enum_nested_loop_state @@ -24339,13 +24356,26 @@ end: /* @brief - Perform a GROUP BY operation over rows coming in arbitrary order. - - This is done by looking up the group in a temp.table and updating group - values. + Perform GROUP BY operation over rows coming in arbitrary order: use + TemporaryTableWithPartialSums algorithm. + + @detail + The TemporaryTableWithPartialSums algorithm is: + + CREATE TEMPORARY TABLE tmp ( + group_by_columns PRIMARY KEY, + partial_sum + ); + + for each row R in join output { + INSERT INTO tmp (R.group_by_columns, R.sum_value) + ON DUPLICATE KEY UPDATE partial_sum=partial_sum + R.sum_value; + } @detail Also applies HAVING, etc. + + @seealso end_unique_update() */ static enum_nested_loop_state @@ -24498,13 +24528,15 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), /* @brief - Perform a GROUP BY operation over a stream of rows ordered by their group. - Write the result into a temporary table. + Perform OrderedGroupBy operation and write the output into the temporary + table (join_tab->table). @detail - Also applies HAVING, etc. + The input stream is ordered by the GROUP BY expression, so groups come + one after another. We only need to accumulate the aggregate value, when + a GROUP BY group ends, check the HAVING and write the group. - The rows are written into temptable so e.g. filesort can read them. + @seealso end_send_group() also implements OrderedGroupBy */ enum_nested_loop_state @@ -30493,7 +30525,9 @@ static bool get_range_limit_read_cost(const POSITION *pos, cond_selectivity= best_rows / range_rows; else cond_selectivity= 1.0; +#if 0 // FIXME: cond_selectivity=8/4 = 2 in main.update_use_source DBUG_ASSERT(cond_selectivity <= 1.000000001); +#endif set_if_smaller(cond_selectivity, 1.0); /* @@ -31435,7 +31469,6 @@ void JOIN::make_notnull_conds_for_range_scans() { DBUG_ENTER("JOIN::make_notnull_conds_for_range_scans"); - if (impossible_where || !optimizer_flag(thd, OPTIMIZER_SWITCH_NOT_NULL_RANGE_SCAN)) { @@ -31515,7 +31548,6 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond, table_map allowed) { THD *thd= join->thd; - DBUG_ENTER("build_notnull_conds_for_range_scans"); for (JOIN_TAB *s= join->join_tab; @@ -31523,13 +31555,13 @@ bool build_notnull_conds_for_range_scans(JOIN *join, Item *cond, { /* Clear all needed bitmaps to mark found fields */ if ((allowed & s->table->map) && - !(s->table->map && join->const_table_map)) + !(s->table->map & join->const_table_map)) bitmap_clear_all(&s->table->tmp_set); } /* Find all null-rejected fields assuming that cond is null-rejected and - only formulas over tables from 'allowed' are to be taken into account + only formulas over tables from 'allowed' are to be taken into account */ if (cond->find_not_null_fields(allowed)) DBUG_RETURN(true); diff --git a/sql/sql_select.h b/sql/sql_select.h index 4b64243e1c9..a45c4b8ffc2 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -777,7 +777,7 @@ public: virtual void mark_used() = 0; - virtual ~Semi_join_strategy_picker() {} + virtual ~Semi_join_strategy_picker() = default; }; @@ -1559,12 +1559,30 @@ public: (set in make_join_statistics()) */ bool impossible_where; - List<Item> all_fields; ///< to store all fields that used in query + + /* + All fields used in the query processing. + + Initially this is a list of fields from the query's SQL text. + + Then, ORDER/GROUP BY and Window Function code add columns that need to + be saved to be available in the post-group-by context. These extra columns + are added to the front, because this->all_fields points to the suffix of + this list. + */ + List<Item> all_fields; ///Above list changed to use temporary table List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3; ///Part, shared with list above, emulate following list List<Item> tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; - List<Item> &fields_list; ///< hold field list passed to mysql_select + + /* + The original field list as it was passed to mysql_select(). This refers + to select_lex->item_list. + CAUTION: this list is a suffix of this->all_fields list, that is, it shares + elements with that list! + */ + List<Item> &fields_list; List<Item> procedure_fields_list; int error; @@ -1960,7 +1978,7 @@ public: null_ptr(arg.null_ptr), err(arg.err) {} - virtual ~store_key() {} /** Not actually needed */ + virtual ~store_key() = default; /** Not actually needed */ virtual enum Type type() const=0; virtual const char *name() const=0; virtual bool store_key_is_const() { return false; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6ffa4da955a..e4bef08f314 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -10441,11 +10441,9 @@ exit: class IS_internal_schema_access : public ACL_internal_schema_access { public: - IS_internal_schema_access() - {} + IS_internal_schema_access() = default; - ~IS_internal_schema_access() - {} + ~IS_internal_schema_access() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/sql/sql_signal.h b/sql/sql_signal.h index 433cee21d58..abc9905aefb 100644 --- a/sql/sql_signal.h +++ b/sql/sql_signal.h @@ -36,8 +36,7 @@ protected: m_set_signal_information(set) {} - virtual ~Sql_cmd_common_signal() - {} + virtual ~Sql_cmd_common_signal() = default; /** Evaluate each signal condition items for this statement. @@ -84,8 +83,7 @@ public: : Sql_cmd_common_signal(cond, set) {} - virtual ~Sql_cmd_signal() - {} + virtual ~Sql_cmd_signal() = default; virtual enum_sql_command sql_command_code() const { @@ -111,8 +109,7 @@ public: : Sql_cmd_common_signal(cond, set) {} - virtual ~Sql_cmd_resignal() - {} + virtual ~Sql_cmd_resignal() = default; virtual enum_sql_command sql_command_code() const { diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 5930ebd8256..ecde847c8d4 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -519,7 +519,7 @@ public: } - virtual ~Stat_table() {} + virtual ~Stat_table() = default; /** @brief @@ -1705,7 +1705,7 @@ protected: public: - Count_distinct_field() {} + Count_distinct_field() = default; /** @param diff --git a/sql/sql_string.cc b/sql/sql_string.cc index f4586d530c9..14db5ad7c7d 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -677,33 +677,37 @@ bool String::append_with_prefill(const char *s,uint32 arg_length, } -int Binary_string::strstr(const Binary_string &s, uint32 offset) +int Binary_string::strstr(const char *search, uint32 search_length, uint32 offset) { - if (s.length()+offset <= str_length) + if (search_length + offset <= str_length) { - if (!s.length()) + if (!search_length) return ((int) offset); // Empty string is always found - const char *str = Ptr+offset; - const char *search=s.ptr(); - const char *end=Ptr+str_length-s.length()+1; - const char *search_end=s.ptr()+s.length(); + const char *str= Ptr + offset; + const char *end= Ptr + str_length - search_length + 1; + const char *search_end= search + search_length; skip: while (str != end) { if (*str++ == *search) { - char *i,*j; - i=(char*) str; j=(char*) search+1; - while (j != search_end) - if (*i++ != *j++) goto skip; - return (int) (str-Ptr) -1; + char *i= (char*) str; + char *j= (char*) search + 1 ; + while (j != search_end) + if (*i++ != *j++) goto skip; + return (int) (str-Ptr) -1; } } } return -1; } +int Binary_string::strstr(const Binary_string &s, uint32 offset) +{ + return strstr(s.ptr(), s.length(), offset); +} + /* ** Search string from end. Offset is offset to the end of string */ diff --git a/sql/sql_string.h b/sql/sql_string.h index b1f02bdb43b..9729d9e85fd 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -330,6 +330,7 @@ public: // Returns offset to substring or -1 int strstr(const Binary_string &search, uint32 offset=0); + int strstr(const char *search, uint32 search_length, uint32 offset=0); // Returns offset to substring or -1 int strrstr(const Binary_string &search, uint32 offset=0); @@ -803,7 +804,7 @@ public: class String: public Charset, public Binary_string { public: - String() { } + String() = default; String(size_t length_arg) :Binary_string(length_arg) { } /* @@ -817,9 +818,7 @@ public: String(char *str, size_t len, CHARSET_INFO *cs) :Charset(cs), Binary_string(str, len) { } - String(const String &str) - :Charset(str), Binary_string(str) - { } + String(const String &str) = default; void set(String &str,size_t offset,size_t arg_length) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index db9a67da094..94371b53303 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7673,7 +7673,7 @@ static bool mysql_inplace_alter_table(THD *thd, THD_STAGE_INFO(thd, stage_alter_inplace); DBUG_EXECUTE_IF("start_alter_delay_master", { debug_sync_set_action(thd, - STRING_WITH_LEN("now wait_for alter_cont")); + STRING_WITH_LEN("now wait_for alter_cont NO_CLEAR_EVENT")); }); /* We can abort alter table for any table type */ @@ -9823,6 +9823,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, Table_specification_st *create_info, TABLE_LIST *table_list, + Recreate_info *recreate_info, Alter_info *alter_info, uint order_num, ORDER *order, bool ignore, bool if_exists) @@ -10856,7 +10857,7 @@ do_continue:; DBUG_EXECUTE_IF("start_alter_delay_master", { debug_sync_set_action(thd, - STRING_WITH_LEN("now wait_for alter_cont")); + STRING_WITH_LEN("now wait_for alter_cont NO_CLEAR_EVENT")); }); // It's now safe to take the table level lock. if (lock_tables(thd, table_list, alter_ctx.tables_opened, @@ -11333,11 +11334,10 @@ end_temporary: thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF; - my_snprintf(alter_ctx.tmp_buff, sizeof(alter_ctx.tmp_buff), - ER_THD(thd, ER_INSERT_INFO), - (ulong) (copied + deleted), (ulong) deleted, - (ulong) thd->get_stmt_da()->current_statement_warn_count()); - my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_buff); + *recreate_info= Recreate_info(copied, deleted); + thd->my_ok_with_recreate_info(*recreate_info, + (ulong) thd->get_stmt_da()-> + current_statement_warn_count()); DEBUG_SYNC(thd, "alter_table_inplace_trans_commit"); DBUG_RETURN(false); @@ -11852,7 +11852,8 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, Like mysql_alter_table(). */ -bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy) +bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, + Recreate_info *recreate_info, bool table_copy) { Table_specification_st create_info; Alter_info alter_info; @@ -11877,8 +11878,11 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy) Alter_info::ALTER_TABLE_ALGORITHM_COPY); bool res= mysql_alter_table(thd, &null_clex_str, &null_clex_str, &create_info, - table_list, &alter_info, 0, - (ORDER *) 0, 0, 0); + table_list, recreate_info, &alter_info, 0, + (ORDER *) 0, + // Ignore duplicate records on REPAIR + thd->lex->sql_command == SQLCOM_REPAIR, + 0); table_list->next_global= next_table; DBUG_RETURN(res); } diff --git a/sql/sql_table.h b/sql/sql_table.h index c9e4d969482..ccde7d87120 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -163,6 +163,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, Table_specification_st *create_info, TABLE_LIST *table_list, + class Recreate_info *recreate_info, Alter_info *alter_info, uint order_num, ORDER *order, bool ignore, bool if_exists); @@ -170,7 +171,8 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info, HA_CREATE_INFO *create_info, bool *metadata_equal); -bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy); +bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, + class Recreate_info *recreate_info, bool table_copy); bool mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, const LEX_CSTRING *old_name, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, LEX_CUSTRING *id, diff --git a/sql/sql_truncate.h b/sql/sql_truncate.h index 7d2ff4b6050..5704da1dd7b 100644 --- a/sql/sql_truncate.h +++ b/sql/sql_truncate.h @@ -31,11 +31,9 @@ public: /** Constructor, used to represent a TRUNCATE statement. */ - Sql_cmd_truncate_table() - {} + Sql_cmd_truncate_table() = default; - virtual ~Sql_cmd_truncate_table() - {} + virtual ~Sql_cmd_truncate_table() = default; /** Execute a TRUNCATE statement at runtime. diff --git a/sql/sql_type.h b/sql/sql_type.h index dcdf6438fd9..741e0c9bb96 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -124,6 +124,32 @@ enum scalar_comparison_op }; +class Hasher +{ + ulong m_nr1; + ulong m_nr2; +public: + Hasher(): m_nr1(1), m_nr2(4) + { } + void add_null() + { + m_nr1^= (m_nr1 << 1) | 1; + } + void add(CHARSET_INFO *cs, const uchar *str, size_t length) + { + cs->coll->hash_sort(cs, str, length, &m_nr1, &m_nr2); + } + void add(CHARSET_INFO *cs, const char *str, size_t length) + { + add(cs, (const uchar *) str, length); + } + uint32 finalize() const + { + return (uint32) m_nr1; + } +}; + + enum partition_value_print_mode_t { PARTITION_VALUE_PRINT_MODE_SHOW= 0, @@ -367,7 +393,7 @@ class Dec_ptr { protected: my_decimal *m_ptr; - Dec_ptr() { } + Dec_ptr() = default; public: Dec_ptr(my_decimal *ptr) :m_ptr(ptr) { } bool is_null() const { return m_ptr == NULL; } @@ -515,7 +541,7 @@ protected: { m_sec= m_usec= m_neg= m_truncated= 0; } - Sec6() { } + Sec6() = default; bool add_nanoseconds(uint nanoseconds) { DBUG_ASSERT(nanoseconds <= 1000000000); @@ -675,7 +701,7 @@ protected: Sec6::make_from_int(nr); m_nsec= 0; } - Sec9() { } + Sec9() = default; public: Sec9(const my_decimal *d) { @@ -2828,7 +2854,7 @@ class Timestamp_or_zero_datetime_native: public NativeBuffer<STRING_BUFFER_TIMESTAMP_BINARY_SIZE> { public: - Timestamp_or_zero_datetime_native() { } + Timestamp_or_zero_datetime_native() = default; Timestamp_or_zero_datetime_native(const Timestamp_or_zero_datetime &ts, uint decimals) { @@ -3305,13 +3331,9 @@ public: class Type_all_attributes: public Type_std_attributes { public: - Type_all_attributes() - :Type_std_attributes() - { } - Type_all_attributes(const Type_all_attributes &other) - :Type_std_attributes(other) - { } - virtual ~Type_all_attributes() {} + Type_all_attributes() = default; + Type_all_attributes(const Type_all_attributes &) = default; + virtual ~Type_all_attributes() = default; virtual void set_type_maybe_null(bool maybe_null_arg)= 0; // Returns total number of decimal digits virtual decimal_digits_t decimal_precision() const= 0; @@ -3323,7 +3345,7 @@ public: class Type_cmp_attributes { public: - virtual ~Type_cmp_attributes() { } + virtual ~Type_cmp_attributes() = default; virtual CHARSET_INFO *compare_collation() const= 0; }; @@ -3527,9 +3549,9 @@ enum vers_kind_t class Vers_type_handler { protected: - Vers_type_handler() {} + Vers_type_handler() = default; public: - virtual ~Vers_type_handler() {} + virtual ~Vers_type_handler() = default; virtual vers_kind_t kind() const { DBUG_ASSERT(0); @@ -3826,7 +3848,7 @@ public: return false; } Type_handler() : m_name(0,0) {} - virtual ~Type_handler() {} + virtual ~Type_handler() = default; /** Determines MariaDB traditional scalar data types that always present in the server. @@ -4342,7 +4364,7 @@ public: class Type_handler_row: public Type_handler { public: - virtual ~Type_handler_row() {} + virtual ~Type_handler_row() = default; const Name &default_value() const override; bool validate_implicit_default_value(THD *, const Column_definition &) const override @@ -4746,7 +4768,7 @@ public: bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, MYSQL_TIME *, date_mode_t fuzzydate) const override; - virtual ~Type_handler_numeric() { } + virtual ~Type_handler_numeric() = default; bool can_change_cond_ref_to_const(Item_bool_func2 *target, Item *target_expr, Item *target_value, Item_bool_func2 *source, @@ -4771,7 +4793,7 @@ public: { return DYN_COL_DOUBLE; } - virtual ~Type_handler_real_result() {} + virtual ~Type_handler_real_result() = default; const Type_handler *type_handler_for_comparison() const override; Field *make_table_field(MEM_ROOT *root, const LEX_CSTRING *name, @@ -4892,7 +4914,7 @@ public: { return DYN_COL_DECIMAL; } - virtual ~Type_handler_decimal_result() {}; + virtual ~Type_handler_decimal_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *, Field *field, Item *item) const override { @@ -5152,7 +5174,7 @@ public: } bool is_order_clause_position_type() const override { return true; } bool is_limit_clause_valid_type() const override { return true; } - virtual ~Type_handler_int_result() {} + virtual ~Type_handler_int_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override; bool subquery_type_allows_materialization(const Item *inner, @@ -5272,7 +5294,7 @@ protected: public: Item_result result_type() const override { return STRING_RESULT; } Item_result cmp_type() const override { return TIME_RESULT; } - virtual ~Type_handler_temporal_result() {} + virtual ~Type_handler_temporal_result() = default; void Column_definition_attributes_frm_pack(const Column_definition_attributes *at, uchar *buff) const override; @@ -5370,7 +5392,7 @@ public: return DYN_COL_STRING; } CHARSET_INFO *charset_for_protocol(const Item *item) const override; - virtual ~Type_handler_string_result() {} + virtual ~Type_handler_string_result() = default; const Type_handler *type_handler_for_comparison() const override; int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) const override; @@ -5560,7 +5582,7 @@ public: class Type_handler_tiny: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_tiny() {} + virtual ~Type_handler_tiny() = default; enum_field_types field_type() const override { return MYSQL_TYPE_TINY; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5611,7 +5633,7 @@ public: class Type_handler_short: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_short() {} + virtual ~Type_handler_short() = default; enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5662,7 +5684,7 @@ public: class Type_handler_long: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_long() {} + virtual ~Type_handler_long() = default; enum_field_types field_type() const override { return MYSQL_TYPE_LONG; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5724,7 +5746,7 @@ public: class Type_handler_longlong: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_longlong() {} + virtual ~Type_handler_longlong() = default; enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5779,7 +5801,7 @@ public: class Type_handler_vers_trx_id: public Type_handler_ulonglong { public: - virtual ~Type_handler_vers_trx_id() {} + virtual ~Type_handler_vers_trx_id() = default; Field *make_table_field(MEM_ROOT *root, const LEX_CSTRING *name, const Record_addr &addr, @@ -5791,7 +5813,7 @@ public: class Type_handler_int24: public Type_handler_general_purpose_int { public: - virtual ~Type_handler_int24() {} + virtual ~Type_handler_int24() = default; enum_field_types field_type() const override { return MYSQL_TYPE_INT24; } const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_signed() const override; @@ -5836,7 +5858,7 @@ public: class Type_handler_year: public Type_handler_int_result { public: - virtual ~Type_handler_year() {} + virtual ~Type_handler_year() = default; enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; } uint flags() const override { return UNSIGNED_FLAG; } protocol_send_type_t protocol_send_type() const override @@ -5890,7 +5912,7 @@ public: class Type_handler_bit: public Type_handler_int_result { public: - virtual ~Type_handler_bit() {} + virtual ~Type_handler_bit() = default; enum_field_types field_type() const override { return MYSQL_TYPE_BIT; } uint flags() const override { return UNSIGNED_FLAG; } protocol_send_type_t protocol_send_type() const override @@ -5955,7 +5977,7 @@ public: class Type_handler_float: public Type_handler_real_result { public: - virtual ~Type_handler_float() {} + virtual ~Type_handler_float() = default; enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; } protocol_send_type_t protocol_send_type() const override { @@ -6009,7 +6031,7 @@ public: class Type_handler_double: public Type_handler_real_result { public: - virtual ~Type_handler_double() {} + virtual ~Type_handler_double() = default; enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; } protocol_send_type_t protocol_send_type() const override { @@ -6064,7 +6086,7 @@ public: class Type_handler_time_common: public Type_handler_temporal_result { public: - virtual ~Type_handler_time_common() { } + virtual ~Type_handler_time_common() = default; const Name &default_value() const override; enum_field_types field_type() const override { return MYSQL_TYPE_TIME; } enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) @@ -6186,7 +6208,7 @@ class Type_handler_time: public Type_handler_time_common static uint m_hires_bytes[MAX_DATETIME_PRECISION+1]; public: static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_time() {} + virtual ~Type_handler_time() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MIN_TIME_WIDTH; } @@ -6216,7 +6238,7 @@ public: class Type_handler_time2: public Type_handler_time_common { public: - virtual ~Type_handler_time2() {} + virtual ~Type_handler_time2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { return MYSQL_TYPE_TIME2; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -6246,7 +6268,7 @@ public: class Type_handler_temporal_with_date: public Type_handler_temporal_result { public: - virtual ~Type_handler_temporal_with_date() {} + virtual ~Type_handler_temporal_with_date() = default; Item_literal *create_literal_item(THD *thd, const char *str, size_t length, CHARSET_INFO *cs, bool send_error) const override; @@ -6276,7 +6298,7 @@ public: class Type_handler_date_common: public Type_handler_temporal_with_date { public: - virtual ~Type_handler_date_common() {} + virtual ~Type_handler_date_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; enum_field_types field_type() const override { return MYSQL_TYPE_DATE; } @@ -6347,7 +6369,7 @@ public: class Type_handler_date: public Type_handler_date_common { public: - virtual ~Type_handler_date() {} + virtual ~Type_handler_date() = default; uint32 calc_pack_length(uint32 length) const override { return 4; } Field *make_conversion_table_field(MEM_ROOT *root, TABLE *table, uint metadata, @@ -6374,7 +6396,7 @@ public: class Type_handler_newdate: public Type_handler_date_common { public: - virtual ~Type_handler_newdate() {} + virtual ~Type_handler_newdate() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_NEWDATE; @@ -6405,7 +6427,7 @@ public: class Type_handler_datetime_common: public Type_handler_temporal_with_date { public: - virtual ~Type_handler_datetime_common() {} + virtual ~Type_handler_datetime_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; enum_field_types field_type() const override @@ -6489,7 +6511,7 @@ class Type_handler_datetime: public Type_handler_datetime_common static uint m_hires_bytes[MAX_DATETIME_PRECISION + 1]; public: static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; } - virtual ~Type_handler_datetime() {} + virtual ~Type_handler_datetime() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MAX_DATETIME_WIDTH; } @@ -6519,7 +6541,7 @@ public: class Type_handler_datetime2: public Type_handler_datetime_common { public: - virtual ~Type_handler_datetime2() {} + virtual ~Type_handler_datetime2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { @@ -6554,7 +6576,7 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date protected: bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const; public: - virtual ~Type_handler_timestamp_common() {} + virtual ~Type_handler_timestamp_common() = default; const Name &default_value() const override; const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_native_format() const override; @@ -6656,7 +6678,7 @@ class Type_handler_timestamp: public Type_handler_timestamp_common static uint m_sec_part_bytes[MAX_DATETIME_PRECISION + 1]; public: static uint sec_part_bytes(uint dec) { return m_sec_part_bytes[dec]; } - virtual ~Type_handler_timestamp() {} + virtual ~Type_handler_timestamp() = default; const Name version() const override { return version_mariadb53(); } uint32 max_display_length_for_field(const Conv_source &src) const override { return MAX_DATETIME_WIDTH; } @@ -6686,7 +6708,7 @@ public: class Type_handler_timestamp2: public Type_handler_timestamp_common { public: - virtual ~Type_handler_timestamp2() {} + virtual ~Type_handler_timestamp2() = default; const Name version() const override { return version_mysql56(); } enum_field_types real_field_type() const override { @@ -6721,7 +6743,7 @@ public: class Type_handler_olddecimal: public Type_handler_decimal_result { public: - virtual ~Type_handler_olddecimal() {} + virtual ~Type_handler_olddecimal() = default; enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override { return length; } @@ -6755,7 +6777,7 @@ public: class Type_handler_newdecimal: public Type_handler_decimal_result { public: - virtual ~Type_handler_newdecimal() {} + virtual ~Type_handler_newdecimal() = default; enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; } uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 calc_pack_length(uint32 length) const override; @@ -6799,7 +6821,7 @@ public: class Type_handler_null: public Type_handler_general_purpose_string { public: - virtual ~Type_handler_null() {} + virtual ~Type_handler_null() = default; enum_field_types field_type() const override { return MYSQL_TYPE_NULL; } enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) const override @@ -6871,7 +6893,7 @@ public: class Type_handler_string: public Type_handler_longstr { public: - virtual ~Type_handler_string() {} + virtual ~Type_handler_string() = default; enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } ulong KEY_pack_flags(uint column_nr) const override { @@ -6925,7 +6947,7 @@ public: class Type_handler_var_string: public Type_handler_string { public: - virtual ~Type_handler_var_string() {} + virtual ~Type_handler_var_string() = default; enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; } enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; } enum_field_types traditional_merge_field_type() const override @@ -6955,7 +6977,7 @@ public: class Type_handler_varchar: public Type_handler_longstr { public: - virtual ~Type_handler_varchar() {} + virtual ~Type_handler_varchar() = default; enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; } ulong KEY_pack_flags(uint column_nr) const override { @@ -7026,7 +7048,7 @@ public: class Type_handler_hex_hybrid: public Type_handler_varchar { public: - virtual ~Type_handler_hex_hybrid() {} + virtual ~Type_handler_hex_hybrid() = default; const Type_handler *cast_to_int_type_handler() const override; bool Item_func_round_fix_length_and_dec(Item_func_round *) const override; bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override; @@ -7069,7 +7091,7 @@ public: class Type_handler_blob_common: public Type_handler_longstr { public: - virtual ~Type_handler_blob_common() { } + virtual ~Type_handler_blob_common() = default; virtual uint length_bytes() const= 0; ulong KEY_pack_flags(uint column_nr) const override { @@ -7146,7 +7168,7 @@ public: class Type_handler_tiny_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_tiny_blob() {} + virtual ~Type_handler_tiny_blob() = default; uint length_bytes() const override { return 1; } enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7163,7 +7185,7 @@ public: class Type_handler_medium_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_medium_blob() {} + virtual ~Type_handler_medium_blob() = default; uint length_bytes() const override { return 3; } enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; } @@ -7181,7 +7203,7 @@ public: class Type_handler_long_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_long_blob() {} + virtual ~Type_handler_long_blob() = default; uint length_bytes() const override { return 4; } enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7200,7 +7222,7 @@ public: class Type_handler_blob: public Type_handler_blob_common { public: - virtual ~Type_handler_blob() {} + virtual ~Type_handler_blob() = default; uint length_bytes() const override { return 2; } enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; } uint32 max_display_length_for_field(const Conv_source &src) const override; @@ -7244,7 +7266,7 @@ public: class Type_handler_typelib: public Type_handler_general_purpose_string { public: - virtual ~Type_handler_typelib() { } + virtual ~Type_handler_typelib() = default; enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } const Type_handler *type_handler_for_item_field() const override; const Type_handler *cast_to_int_type_handler() const override; @@ -7282,7 +7304,7 @@ public: class Type_handler_enum: public Type_handler_typelib { public: - virtual ~Type_handler_enum() {} + virtual ~Type_handler_enum() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; } enum_field_types traditional_merge_field_type() const override { @@ -7323,7 +7345,7 @@ public: class Type_handler_set: public Type_handler_typelib { public: - virtual ~Type_handler_set() {} + virtual ~Type_handler_set() = default; enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; } enum_field_types traditional_merge_field_type() const override { @@ -7369,7 +7391,7 @@ public: class Function_collection { public: - virtual ~Function_collection() {} + virtual ~Function_collection() = default; virtual bool init()= 0; virtual void cleanup()= 0; virtual Create_func *find_native_function_builder(THD *thd, @@ -7381,11 +7403,8 @@ public: class Type_collection { public: - virtual ~Type_collection() {} - virtual bool init(Type_handler_data *data) - { - return false; - } + virtual ~Type_collection() = default; + virtual bool init(Type_handler_data *) { return false; } virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0; virtual const Type_handler *aggregate_for_result(const Type_handler *h1, const Type_handler *h2) @@ -7579,7 +7598,7 @@ public: const Type_handler *m_handler1; const Type_handler *m_handler2; const Type_handler *m_result; - Pair() { } + Pair() = default; Pair(const Type_handler *handler1, const Type_handler *handler2, const Type_handler *result) diff --git a/sql/sql_type_fixedbin.h b/sql/sql_type_fixedbin.h index 077e4039643..223bf2cf398 100644 --- a/sql/sql_type_fixedbin.h +++ b/sql/sql_type_fixedbin.h @@ -1428,12 +1428,9 @@ public: item->type_handler() == type_handler()); return true; } - void hash(ulong *nr, ulong *nr2) override + void hash_not_null(Hasher *hasher) override { - if (is_null()) - *nr^= (*nr << 1) | 1; - else - FbtImpl::hash_record(ptr, nr, nr2); + FbtImpl::hash_record(ptr, hasher); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *prm, KEY_PART *key_part, const Item_bool_func *cond, diff --git a/sql/sql_type_fixedbin_storage.h b/sql/sql_type_fixedbin_storage.h index 6e18335bd4c..3a4e74a8cdb 100644 --- a/sql/sql_type_fixedbin_storage.h +++ b/sql/sql_type_fixedbin_storage.h @@ -64,9 +64,7 @@ protected: // The buffer that stores the in-memory binary representation char m_buffer[NATIVE_LEN]; - // Non-initializing constructor - FixedBinTypeStorage() - { } + FixedBinTypeStorage() = default; FixedBinTypeStorage & set_zero() { @@ -122,9 +120,9 @@ public: Hash the in-record representation Used in Field::hash(). */ - static void hash_record(const uchar *ptr, ulong *nr, ulong *nr2) + static void hash_record(uchar *ptr, Hasher *hasher) { - my_charset_bin.hash_sort(ptr, binary_length(), nr, nr2); + hasher->add(&my_charset_bin, ptr, binary_length()); } static bool only_zero_bytes(const char *ptr, size_t length) diff --git a/sql/sql_window.cc b/sql/sql_window.cc index c9f2256ff16..436a8db948d 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -954,7 +954,7 @@ protected: class Table_read_cursor : public Rowid_seq_cursor { public: - virtual ~Table_read_cursor() {} + virtual ~Table_read_cursor() = default; void init(READ_RECORD *info) { @@ -1138,7 +1138,7 @@ public: virtual bool is_outside_computation_bounds() const { return false; }; - virtual ~Frame_cursor() {} + virtual ~Frame_cursor() = default; /* Regular frame cursors add or remove values from the sum functions they diff --git a/sql/sql_window.h b/sql/sql_window.h index 66ea8c7dd4d..1c02740e769 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -106,7 +106,7 @@ class Window_spec : public Sql_alloc { bool window_names_are_checked; public: - virtual ~Window_spec() {} + virtual ~Window_spec() = default; LEX_CSTRING *window_ref; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0c3aaf79c6f..2927b6ce8de 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13365,6 +13365,8 @@ delete_part2: { Lex->last_table()->vers_conditions= Lex->vers_conditions; Lex->pop_select(); //main select + if (Lex->check_main_unit_semantics()) + MYSQL_YYABORT; } ; @@ -13401,6 +13403,8 @@ single_multi: if ($3) Select->order_list= *($3); Lex->pop_select(); //main select + if (Lex->check_main_unit_semantics()) + MYSQL_YYABORT; } | table_wild_list { diff --git a/sql/structs.h b/sql/structs.h index 1da50522991..214fcb242ff 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -981,7 +981,7 @@ public: class Load_data_outvar { public: - virtual ~Load_data_outvar() {} + virtual ~Load_data_outvar() = default; virtual bool load_data_set_null(THD *thd, const Load_data_param *param)= 0; virtual bool load_data_set_value(THD *thd, const char *pos, uint length, const Load_data_param *param)= 0; @@ -995,7 +995,7 @@ public: class Timeval: public timeval { protected: - Timeval() { } + Timeval() = default; public: Timeval(my_time_t sec, ulong usec) { diff --git a/sql/sys_vars_shared.h b/sql/sys_vars_shared.h index bc48d1f7fff..508a0a70c8f 100644 --- a/sql/sys_vars_shared.h +++ b/sql/sys_vars_shared.h @@ -44,7 +44,7 @@ public: virtual void rdlock()= 0; virtual void wrlock()= 0; virtual void unlock()= 0; - virtual ~PolyLock() {} + virtual ~PolyLock() = default; }; class PolyLock_mutex: public PolyLock diff --git a/sql/table.cc b/sql/table.cc index 3fffb974f0c..e0189401906 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1101,6 +1101,18 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share, } } + +Item_func_hash *TABLE_SHARE::make_long_hash_func(THD *thd, + MEM_ROOT *mem_root, + List<Item> *field_list) + const +{ + if (old_long_hash_function()) + return new (mem_root) Item_func_hash_mariadb_100403(thd, *field_list); + return new (mem_root) Item_func_hash(thd, *field_list); +} + + /** Parse TABLE_SHARE::vcol_defs unpack_vcol_info_from_frm @@ -1306,7 +1318,10 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, list_item= new (mem_root) Item_field(thd, keypart->field); field_list->push_back(list_item, mem_root); } - Item_func_hash *hash_item= new(mem_root)Item_func_hash(thd, *field_list); + + Item_func_hash *hash_item= table->s->make_long_hash_func(thd, mem_root, + field_list); + Virtual_column_info *v= new (mem_root) Virtual_column_info(); field->vcol_info= v; field->vcol_info->expr= hash_item; diff --git a/sql/table.h b/sql/table.h index add1871e899..13b8b1a9dc4 100644 --- a/sql/table.h +++ b/sql/table.h @@ -55,6 +55,7 @@ class Item; /* Needed by ORDER */ typedef Item (*Item_ptr); class Item_subselect; class Item_field; +class Item_func_hash; class GRANT_TABLE; class st_select_lex_unit; class st_select_lex; @@ -137,14 +138,13 @@ public: void restore_env(THD *thd, Object_creation_ctx *backup_ctx); protected: - Object_creation_ctx() {} + Object_creation_ctx() = default; virtual Object_creation_ctx *create_backup_ctx(THD *thd) const = 0; virtual void change_env(THD *thd) const = 0; public: - virtual ~Object_creation_ctx() - { } + virtual ~Object_creation_ctx() = default; }; /*************************************************************************/ @@ -560,7 +560,7 @@ protected: public: Table_check_intact(bool keys= false) : has_keys(keys) {} - virtual ~Table_check_intact() {} + virtual ~Table_check_intact() = default; /** Checks whether a table is intact. */ bool check(TABLE *table, const TABLE_FIELD_DEF *table_def); @@ -737,7 +737,7 @@ public: struct TABLE_SHARE { - TABLE_SHARE() {} /* Remove gcc warning */ + TABLE_SHARE() = default; /* Remove gcc warning */ /** Category of this table. */ TABLE_CATEGORY table_category; @@ -1197,6 +1197,22 @@ struct TABLE_SHARE void set_overlapped_keys(); void set_ignored_indexes(); key_map usable_indexes(THD *thd); + + bool old_long_hash_function() const + { + return mysql_version < 100428 || + (mysql_version >= 100500 && mysql_version < 100519) || + (mysql_version >= 100600 && mysql_version < 100612) || + (mysql_version >= 100700 && mysql_version < 100708) || + (mysql_version >= 100800 && mysql_version < 100807) || + (mysql_version >= 100900 && mysql_version < 100905) || + (mysql_version >= 101000 && mysql_version < 101003) || + (mysql_version >= 101100 && mysql_version < 101102); + } + Item_func_hash *make_long_hash_func(THD *thd, + MEM_ROOT *mem_root, + List<Item> *field_list) const; + void update_optimizer_costs(handlerton *hton); }; @@ -1274,7 +1290,7 @@ struct vers_select_conds_t; struct TABLE { - TABLE() {} /* Remove gcc warning */ + TABLE() = default; /* Remove gcc warning */ TABLE_SHARE *s; handler *file; @@ -2274,7 +2290,7 @@ class Index_hint; struct TABLE_CHAIN { - TABLE_CHAIN() {} + TABLE_CHAIN() = default; TABLE_LIST **start_pos; TABLE_LIST ** end_pos; @@ -2285,7 +2301,7 @@ struct TABLE_CHAIN struct TABLE_LIST { - TABLE_LIST() {} /* Remove gcc warning */ + TABLE_LIST() = default; /* Remove gcc warning */ enum prelocking_types { @@ -3056,8 +3072,8 @@ class Item; class Field_iterator: public Sql_alloc { public: - Field_iterator() {} /* Remove gcc warning */ - virtual ~Field_iterator() {} + Field_iterator() = default; /* Remove gcc warning */ + virtual ~Field_iterator() = default; virtual void set(TABLE_LIST *)= 0; virtual void next()= 0; virtual bool end_of_fields()= 0; /* Return 1 at end of list */ @@ -3118,7 +3134,7 @@ class Field_iterator_natural_join: public Field_iterator Natural_join_column *cur_column_ref; public: Field_iterator_natural_join() :cur_column_ref(NULL) {} - ~Field_iterator_natural_join() {} + ~Field_iterator_natural_join() = default; void set(TABLE_LIST *table); void next(); bool end_of_fields() { return !cur_column_ref; } diff --git a/sql/threadpool.h b/sql/threadpool.h index 7737d056b4a..d815d538cde 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -102,8 +102,7 @@ struct TP_connection priority(TP_PRIORITY_HIGH) {} - virtual ~TP_connection() - {}; + virtual ~TP_connection() = default; /* Initialize io structures windows threadpool, epoll etc */ virtual int init() = 0; @@ -121,7 +120,7 @@ struct TP_connection struct TP_pool { - virtual ~TP_pool(){}; + virtual ~TP_pool() = default; virtual int init()= 0; virtual TP_connection *new_connection(CONNECT *)= 0; virtual void add(TP_connection *c)= 0; diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index eb08441a4d5..7261eabfd82 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -1574,8 +1574,7 @@ static void *worker_main(void *param) } -TP_pool_generic::TP_pool_generic() -{} +TP_pool_generic::TP_pool_generic() = default; int TP_pool_generic::init() { diff --git a/sql/tztime.cc b/sql/tztime.cc index 4d94054541d..a2add055deb 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1027,7 +1027,7 @@ static const String tz_SYSTEM_name("SYSTEM", 6, &my_charset_latin1); class Time_zone_system : public Time_zone { public: - Time_zone_system() {} /* Remove gcc warning */ + Time_zone_system() = default; /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; virtual const String * get_name() const; @@ -1123,7 +1123,7 @@ Time_zone_system::get_name() const class Time_zone_utc : public Time_zone { public: - Time_zone_utc() {} /* Remove gcc warning */ + Time_zone_utc() = default; /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, uint *error_code) const; virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const; diff --git a/sql/tztime.h b/sql/tztime.h index 9e5d469925f..6d8af62ecd4 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -41,7 +41,7 @@ class THD; class Time_zone: public Sql_alloc { public: - Time_zone() {} /* Remove gcc warning */ + Time_zone() = default; /* Remove gcc warning */ /** Converts local time in broken down MYSQL_TIME representation to my_time_t (UTC seconds since Epoch) represenation. @@ -66,7 +66,7 @@ public: We need this only for surpressing warnings, objects of this type are allocated on MEM_ROOT and should not require destruction. */ - virtual ~Time_zone() {}; + virtual ~Time_zone() = default; protected: static inline void adjust_leap_second(MYSQL_TIME *t); diff --git a/sql/vers_string.h b/sql/vers_string.h index 67fd421500e..c5be9c359e3 100644 --- a/sql/vers_string.h +++ b/sql/vers_string.h @@ -53,7 +53,7 @@ template <class Compare> struct Lex_cstring_with_compare : public Lex_cstring { public: - Lex_cstring_with_compare() {} + Lex_cstring_with_compare() = default; Lex_cstring_with_compare(const char *_str, size_t _len) : Lex_cstring(_str, _len) { } diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h index 792cdbc7a13..8a240118ac3 100644 --- a/sql/win_tzname_data.h +++ b/sql/win_tzname_data.h @@ -44,7 +44,7 @@ {L"UTC-02","Etc/GMT+2"}, {L"Azores Standard Time","Atlantic/Azores"}, {L"Cape Verde Standard Time","Atlantic/Cape_Verde"}, -{L"UTC","Etc/GMT"}, +{L"UTC","Etc/UTC"}, {L"GMT Standard Time","Europe/London"}, {L"Greenwich Standard Time","Atlantic/Reykjavik"}, {L"Sao Tome Standard Time","Africa/Sao_Tome"}, @@ -64,6 +64,7 @@ {L"South Africa Standard Time","Africa/Johannesburg"}, {L"FLE Standard Time","Europe/Kiev"}, {L"Israel Standard Time","Asia/Jerusalem"}, +{L"South Sudan Standard Time","Africa/Juba"}, {L"Kaliningrad Standard Time","Europe/Kaliningrad"}, {L"Sudan Standard Time","Africa/Khartoum"}, {L"Libya Standard Time","Africa/Tripoli"}, diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index 7ab5ba0c1e2..628a408b49b 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -1,4 +1,4 @@ -/* Copyright 2018-2022 Codership Oy <info@codership.com> +/* Copyright 2018-2023 Codership Oy <info@codership.com> 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 @@ -347,22 +347,36 @@ void Wsrep_client_service::debug_crash(const char* crash_point) int Wsrep_client_service::bf_rollback() { DBUG_ASSERT(m_thd == current_thd); - DBUG_ENTER("Wsrep_client_service::rollback"); + DBUG_ENTER("Wsrep_client_service::bf_rollback"); int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd)); - if (m_thd->locked_tables_mode && m_thd->lock) - { - if (m_thd->locked_tables_list.unlock_locked_tables(m_thd)) - ret= 1; - m_thd->variables.option_bits&= ~OPTION_TABLE_LOCK; - } - if (m_thd->global_read_lock.is_acquired()) + + WSREP_DEBUG("::bf_rollback() thread: %lu, client_state %s " + "client_mode %s trans_state %s killed %d", + thd_get_thread_id(m_thd), + wsrep_thd_client_state_str(m_thd), + wsrep_thd_client_mode_str(m_thd), + wsrep_thd_transaction_state_str(m_thd), + m_thd->killed); + + /* If client is quiting all below will be done in THD::cleanup() + TODO: why we need this any other case? */ + if (m_thd->wsrep_cs().state() != wsrep::client_state::s_quitting) { - m_thd->global_read_lock.unlock_global_read_lock(m_thd); + if (m_thd->locked_tables_mode && m_thd->lock) + { + if (m_thd->locked_tables_list.unlock_locked_tables(m_thd)) + ret= 1; + m_thd->variables.option_bits&= ~OPTION_TABLE_LOCK; + } + if (m_thd->global_read_lock.is_acquired()) + { + m_thd->global_read_lock.unlock_global_read_lock(m_thd); + } + m_thd->release_transactional_locks(); + mysql_ull_cleanup(m_thd); + m_thd->mdl_context.release_explicit_locks(); } - m_thd->release_transactional_locks(); - mysql_ull_cleanup(m_thd); - m_thd->mdl_context.release_explicit_locks(); DBUG_RETURN(ret); } diff --git a/sql/wsrep_condition_variable.h b/sql/wsrep_condition_variable.h index c97b47378f7..d9798bb9548 100644 --- a/sql/wsrep_condition_variable.h +++ b/sql/wsrep_condition_variable.h @@ -29,8 +29,7 @@ public: Wsrep_condition_variable(mysql_cond_t* cond) : m_cond(cond) { } - ~Wsrep_condition_variable() - { } + ~Wsrep_condition_variable() = default; void notify_one() { diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 93d4738212d..7d8296a75a1 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -292,6 +292,7 @@ int Wsrep_high_priority_service::append_fragment_and_commit( ret= ret || trans_commit(m_thd); ret= ret || (m_thd->wsrep_cs().after_applying(), 0); + m_thd->release_transactional_locks(); free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC)); @@ -380,6 +381,15 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle, assert(ws_handle == wsrep::ws_handle()); } int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd)); + + WSREP_DEBUG("::rollback() thread: %lu, client_state %s " + "client_mode %s trans_state %s killed %d", + thd_get_thread_id(m_thd), + wsrep_thd_client_state_str(m_thd), + wsrep_thd_client_mode_str(m_thd), + wsrep_thd_transaction_state_str(m_thd), + m_thd->killed); + m_thd->release_transactional_locks(); mysql_ull_cleanup(m_thd); m_thd->mdl_context.release_explicit_locks(); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 110062defe3..3a8bfe3532d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1020,13 +1020,19 @@ void wsrep_init_startup (bool sst_first) With mysqldump SST (!sst_first) wait until the server reaches joiner state and procedd to accepting connections. */ + int err= 0; if (sst_first) { - server_state.wait_until_state(Wsrep_server_state::s_initializing); + err= server_state.wait_until_state(Wsrep_server_state::s_initializing); } else { - server_state.wait_until_state(Wsrep_server_state::s_joiner); + err= server_state.wait_until_state(Wsrep_server_state::s_joiner); + } + if (err) + { + WSREP_ERROR("Wsrep startup was interrupted"); + unireg_abort(1); } } @@ -1133,7 +1139,11 @@ void wsrep_stop_replication(THD *thd) { WSREP_DEBUG("Disconnect provider"); Wsrep_server_state::instance().disconnect(); - Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); + if (Wsrep_server_state::instance().wait_until_state( + Wsrep_server_state::s_disconnected)) + { + WSREP_WARN("Wsrep interrupted while waiting for disconnected state"); + } } /* my connection, should not terminate with wsrep_close_client_connection(), @@ -1155,7 +1165,11 @@ void wsrep_shutdown_replication() { WSREP_DEBUG("Disconnect provider"); Wsrep_server_state::instance().disconnect(); - Wsrep_server_state::instance().wait_until_state(Wsrep_server_state::s_disconnected); + if (Wsrep_server_state::instance().wait_until_state( + Wsrep_server_state::s_disconnected)) + { + WSREP_WARN("Wsrep interrupted while waiting for disconnected state"); + } } wsrep_close_client_connections(TRUE); @@ -3232,7 +3246,9 @@ static my_bool have_client_connections(THD *thd, void*) { DBUG_PRINT("quit",("Informing thread %lld that it's time to die", (longlong) thd->thread_id)); - if (is_client_connection(thd) && thd->killed == KILL_CONNECTION) + if (is_client_connection(thd) && + (thd->killed == KILL_CONNECTION || + thd->killed == KILL_CONNECTION_HARD)) { (void)abort_replicated(thd); return 1; @@ -3242,7 +3258,7 @@ static my_bool have_client_connections(THD *thd, void*) static void wsrep_close_thread(THD *thd) { - thd->set_killed(KILL_CONNECTION); + thd->set_killed(KILL_CONNECTION_HARD); MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (thd)); mysql_mutex_lock(&thd->LOCK_thd_kill); thd->abort_current_cond_wait(true); @@ -3276,13 +3292,13 @@ static my_bool kill_all_threads(THD *thd, THD *caller_thd) if (is_client_connection(thd) && thd != caller_thd) { if (is_replaying_connection(thd)) - thd->set_killed(KILL_CONNECTION); + thd->set_killed(KILL_CONNECTION_HARD); else if (!abort_replicated(thd)) { /* replicated transactions must be skipped */ WSREP_DEBUG("closing connection %lld", (longlong) thd->thread_id); /* instead of wsrep_close_thread() we do now soft kill by THD::awake */ - thd->awake(KILL_CONNECTION); + thd->awake(KILL_CONNECTION_HARD); } } return 0; diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 5595e0a090c..3634d636e7c 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -670,12 +670,9 @@ static void make_key(TABLE* table, uchar** key, key_part_map* map, int parts) { } /* namespace Wsrep_schema_impl */ -Wsrep_schema::Wsrep_schema() -{ -} +Wsrep_schema::Wsrep_schema() = default; -Wsrep_schema::~Wsrep_schema() -{ } +Wsrep_schema::~Wsrep_schema() = default; static void wsrep_init_thd_for_schema(THD *thd) { diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index b49302790e7..f80320fe216 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -57,8 +57,7 @@ Wsrep_server_state::Wsrep_server_state(const std::string& name, , m_service(*this) { } -Wsrep_server_state::~Wsrep_server_state() -{ } +Wsrep_server_state::~Wsrep_server_state() = default; void Wsrep_server_state::init_once(const std::string& name, const std::string& incoming_address, diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 03ca34992c8..b007357dbc3 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -337,9 +337,14 @@ static bool wsrep_sst_complete (THD* thd, if ((state == Wsrep_server_state::s_joiner || state == Wsrep_server_state::s_initialized)) { - Wsrep_server_state::instance().sst_received(client_service, - rcode); - WSREP_INFO("SST succeeded for position %s", start_pos_buf); + if (Wsrep_server_state::instance().sst_received(client_service, rcode)) + { + failed= true; + } + else + { + WSREP_INFO("SST succeeded for position %s", start_pos_buf); + } } else { diff --git a/sql/xa.cc b/sql/xa.cc index 457aacfeb30..0e421ac62f5 100644 --- a/sql/xa.cc +++ b/sql/xa.cc @@ -600,6 +600,7 @@ bool trans_xa_commit(THD *thd) if (auto xs= xid_cache_search(thd, thd->lex->xid)) { + bool xid_deleted= false; res= xa_trans_rolled_back(xs); /* Acquire metadata lock which will ensure that COMMIT is blocked @@ -610,7 +611,7 @@ bool trans_xa_commit(THD *thd) */ MDL_request mdl_request; MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT, - MDL_STATEMENT); + MDL_EXPLICIT); if (thd->mdl_context.acquire_lock(&mdl_request, thd->variables.lock_wait_timeout)) { @@ -621,25 +622,37 @@ bool trans_xa_commit(THD *thd) */ DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + res= true; + goto _end_external_xid; } - DBUG_ASSERT(!xid_state.xid_cache_element); - - if (thd->wait_for_prior_commit()) + else { - DBUG_ASSERT(thd->is_error()); - - xs->acquired_to_recovered(); - DBUG_RETURN(true); + thd->backup_commit_lock= &mdl_request; } + DBUG_ASSERT(!xid_state.xid_cache_element); xid_state.xid_cache_element= xs; ha_commit_or_rollback_by_xid(thd->lex->xid, !res); - xid_state.xid_cache_element= 0; + if (!res && thd->is_error()) + { + // hton completion error retains xs/xid in the cache, + // unless there had been already one as reflected by `res`. + res= true; + goto _end_external_xid; + } + xid_cache_delete(thd, xs); + xid_deleted= true; + _end_external_xid: + xid_state.xid_cache_element= 0; res= res || thd->is_error(); - xid_cache_delete(thd, xs); + if (!xid_deleted) + xs->acquired_to_recovered(); + if (mdl_request.ticket) + { + thd->mdl_context.release_lock(mdl_request.ticket); + thd->backup_commit_lock= 0; + } } else my_error(ER_XAER_NOTA, MYF(0)); @@ -761,9 +774,11 @@ bool trans_xa_rollback(THD *thd) if (auto xs= xid_cache_search(thd, thd->lex->xid)) { + bool res; + bool xid_deleted= false; MDL_request mdl_request; MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT, - MDL_STATEMENT); + MDL_EXPLICIT); if (thd->mdl_context.acquire_lock(&mdl_request, thd->variables.lock_wait_timeout)) { @@ -774,23 +789,33 @@ bool trans_xa_rollback(THD *thd) */ DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + goto _end_external_xid; } - xa_trans_rolled_back(xs); - DBUG_ASSERT(!xid_state.xid_cache_element); - - if (thd->wait_for_prior_commit()) + else { - DBUG_ASSERT(thd->is_error()); - xs->acquired_to_recovered(); - DBUG_RETURN(true); + thd->backup_commit_lock= &mdl_request; } + res= xa_trans_rolled_back(xs); + DBUG_ASSERT(!xid_state.xid_cache_element); xid_state.xid_cache_element= xs; ha_commit_or_rollback_by_xid(thd->lex->xid, 0); - xid_state.xid_cache_element= 0; + if (!res && thd->is_error()) + { + goto _end_external_xid; + } xid_cache_delete(thd, xs); + xid_deleted= true; + + _end_external_xid: + xid_state.xid_cache_element= 0; + if (!xid_deleted) + xs->acquired_to_recovered(); + if (mdl_request.ticket) + { + thd->mdl_context.release_lock(mdl_request.ticket); + thd->backup_commit_lock= 0; + } } else my_error(ER_XAER_NOTA, MYF(0)); diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index c96f5d8d122..00d8a56acba 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -87,9 +87,7 @@ class ha_archive final : public handler public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_archive() - { - } + ~ha_archive() = default; const char *index_type(uint inx) { return "NONE"; } ulonglong table_flags() const { diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index baa140bc04a..04ca65f2a53 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -44,9 +44,7 @@ class ha_blackhole final : public handler public: ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_blackhole() - { - } + ~ha_blackhole() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index a5c2e065742..1eeb4ac05ca 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -975,13 +975,13 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) xtrc(1, "Arraylist: len=%d\n", len); p = (char *)PlugSubAlloc(g, NULL, len); - strcpy(p, "("); + safe_strcpy(p, len, "("); for (i = 0; i < Nval;) { Value->SetValue_pvblk(Vblp, i); Value->Prints(g, tp, z); - strcat(p, tp); - strcat(p, (++i == Nval) ? ")" : ","); + safe_strcat(p, len, tp); + safe_strcat(p, len, (++i == Nval) ? ")" : ","); } // enfor i xtrc(1, "Arraylist: newlen=%d\n", strlen(p)); diff --git a/storage/connect/blkfil.h b/storage/connect/blkfil.h index 61b02c53c14..27e6fd4b166 100644 --- a/storage/connect/blkfil.h +++ b/storage/connect/blkfil.h @@ -31,7 +31,7 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */ virtual void Prints(PGLOBAL g, char *ps, uint z); protected: - BLOCKFILTER(void) {} // Standard constructor not to be used + BLOCKFILTER(void) = default; // Standard constructor not to be used // Members PTDBDOS Tdbp; // Owner TDB @@ -54,7 +54,7 @@ class DllExport BLKFILLOG : public BLOCKFILTER { /* Logical Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKFILLOG(void) {} // Standard constructor not to be used + BLKFILLOG(void) = default; // Standard constructor not to be used // Members PBF *Fil; // Points to Block filter args @@ -75,7 +75,7 @@ class DllExport BLKFILARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void) {} protected: - BLKFILARI(void) {} // Standard constructor not to be used + BLKFILARI(void) = default; // Standard constructor not to be used // Members PDOSCOL Colp; // Points to column argument @@ -97,7 +97,7 @@ class DllExport BLKFILAR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILAR2(void) {} // Standard constructor not to be used + BLKFILAR2(void) = default; // Standard constructor not to be used // Members uint Bmp; // The value bitmap used to test blocks @@ -118,7 +118,7 @@ class DllExport BLKFILMR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILMR2(void) {} // Standard constructor not to be used + BLKFILMR2(void) = default; // Standard constructor not to be used // Members int Nbm; // The number of ULONG bitmaps @@ -141,7 +141,7 @@ class DllExport BLKSPCARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKSPCARI(void) {} // Standard constructor not to be used + BLKSPCARI(void) = default; // Standard constructor not to be used // Members PCOL Cpx; // Point to subquery "constant" column diff --git a/storage/connect/block.h b/storage/connect/block.h index e8871277d48..5351c2e6354 100644 --- a/storage/connect/block.h +++ b/storage/connect/block.h @@ -55,7 +55,7 @@ class DllExport BLOCK { void operator delete(void*, long long) {} void operator delete(void*) {} - virtual ~BLOCK() {} + virtual ~BLOCK() = default; }; // end of class BLOCK #endif // !BLOCK_DEFINED diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 1eef3c063d6..6bea4eb5d85 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include <my_global.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -598,7 +599,7 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) try { if (!bvp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -606,9 +607,8 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file diff --git a/storage/connect/bson.h b/storage/connect/bson.h index acc36e8e0ed..e3a15a41952 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -165,7 +165,7 @@ public: protected: // Default constructor not to be used - BJSON(void) {} + BJSON(void) = default; }; // end of class BJSON /***********************************************************************/ @@ -203,5 +203,5 @@ protected: bool comma; // True if Pretty = 1 // Default constructor not to be used - BDOC(void) {} + BDOC(void) = default; }; // end of class BDOC diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index d2ddfc5f489..f92bdb46727 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -3572,7 +3572,7 @@ char *bson_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type= TYPE_JAR; BJNX bnx(g); PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; @@ -4911,7 +4911,7 @@ char *bbin_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endfor i if ((bsp = BbinAlloc(bnx.G, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5109,8 +5109,9 @@ char *bbin_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (arp) - if ((bsp = BbinAlloc(g, initid->max_length, arp))) - strcat(bsp->Msg, " array"); + if ((bsp = BbinAlloc(g, initid->max_length, arp))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); + } if (!bsp) { *res_length = 0; @@ -5156,8 +5157,9 @@ char *bbin_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (bop) - if ((bsp = BbinAlloc(g, initid->max_length, bop))) - strcat(bsp->Msg, " object"); + if ((bsp = BbinAlloc(g, initid->max_length, bop))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); + } if (!bsp) { *res_length = 0; @@ -5201,7 +5203,7 @@ char *bbin_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i), bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5256,7 +5258,7 @@ char *bbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, jvp, bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5315,7 +5317,7 @@ char *bbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i + 1), MakePSZ(g, args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5723,7 +5725,7 @@ char *bbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type = TYPE_JAR; BJNX bnx(g); PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; @@ -6078,7 +6080,7 @@ char *bbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, // pretty = pty; if ((bsp = BbinAlloc(bnx.G, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index 0fe3715617e..e355fe7b48e 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -143,7 +143,7 @@ protected: my_bool AddPath(void); // Default constructor not to be used - BJNX(void) {} + BJNX(void) = default; // Members PBVAL Row; diff --git a/storage/connect/catalog.h b/storage/connect/catalog.h index 48347d7519e..2649a50cf76 100644 --- a/storage/connect/catalog.h +++ b/storage/connect/catalog.h @@ -61,7 +61,7 @@ class DllExport CATALOG { friend class OEMDEF; public: CATALOG(void); // Constructor - virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy + virtual ~CATALOG() = default; // Make -Wdelete-non-virtual-dtor happy // Implementation int GetCblen(void) {return Cblen;} diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index c9712f516b5..e67ba3ba3f9 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -177,7 +177,7 @@ class DllExport TIDBLK : public SPCBLK { protected: // Default constructor not to be used - TIDBLK(void) {} + TIDBLK(void) = default; // Members PCSZ Tname; // The current table name @@ -200,7 +200,7 @@ class DllExport PRTBLK : public SPCBLK { protected: // Default constructor not to be used - PRTBLK(void) {} + PRTBLK(void) = default; // Members PCSZ Pname; // The current partition name @@ -223,7 +223,7 @@ class DllExport SIDBLK : public SPCBLK { protected: // Default constructor not to be used - SIDBLK(void) {} + SIDBLK(void) = default; // Members PCSZ Sname; // The current server name diff --git a/storage/connect/csort.h b/storage/connect/csort.h index 6e700059881..cce01df4199 100644 --- a/storage/connect/csort.h +++ b/storage/connect/csort.h @@ -33,7 +33,7 @@ class DllExport CSORT { public: // Constructor CSORT(bool cns, int th = THRESH, int mth = MTHRESH); - virtual ~CSORT() {} + virtual ~CSORT() = default; protected: // Implementation /*********************************************************************/ diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index c7206b4def3..7cd46fd1181 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -443,7 +443,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) hp->Headlen, hp->Filedate[0], hp->Filedate[1], hp->Filedate[2]); - strcat(g->Message, buf); + safe_strcat(g->Message, sizeof(g->Message), buf); } // endif info #endif // 0 diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index dfe5cb5cfc4..6cf6331abd4 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -35,7 +35,7 @@ class DllExport DBFBASE { protected: // Default constructor, not to be used - DBFBASE(void) {} + DBFBASE(void) = default; // Members int Records; /* records in the file */ diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index 117a4e8dda6..3298a83394c 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -36,6 +36,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -881,7 +883,6 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); } else rc = 0; @@ -1002,7 +1003,7 @@ int BGXFAM::Cardinality(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); + safe_strcat(g->Message, sizeof(g->Message), filename); return -1; } else return 0; // File does not exist @@ -1382,7 +1383,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, _MAX_PATH, ".t"); remove(tempname); // Be sure it does not exist yet #if defined(_WIN32) @@ -1391,11 +1393,12 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { DWORD rc = GetLastError(); - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, + tempname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strcat(g->Message, tempname); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -1403,8 +1406,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strcat(g->Message, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)" %s", rc, + MODE_INSERT, tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp index d6c48cb25a9..0eaf3571a80 100644 --- a/storage/connect/filamgz.cpp +++ b/storage/connect/filamgz.cpp @@ -33,6 +33,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -128,12 +130,13 @@ int GZFAM::GetFileLength(PGLOBAL g) /***********************************************************************/ bool GZFAM::OpenTableFile(PGLOBAL g) { - char opmode[4], filename[_MAX_PATH]; - MODE mode = Tdbp->GetMode(); + const char *opmode; + char filename[_MAX_PATH]; + MODE mode = Tdbp->GetMode(); switch (mode) { case MODE_READ: - strcpy(opmode, "r"); + opmode = "rb"; break; case MODE_UPDATE: /*****************************************************************/ @@ -147,7 +150,7 @@ bool GZFAM::OpenTableFile(PGLOBAL g) DelRows = Cardinality(g); // This will erase the entire file - strcpy(opmode, "w"); + opmode = "wb"; // Block = 0; // For ZBKFAM // Last = Nrec; // For ZBKFAM Tdbp->ResetSize(); @@ -158,7 +161,7 @@ bool GZFAM::OpenTableFile(PGLOBAL g) break; case MODE_INSERT: - strcpy(opmode, "a+"); + opmode = "a+b"; break; default: snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); @@ -170,13 +173,11 @@ bool GZFAM::OpenTableFile(PGLOBAL g) /* Use specific zlib functions. */ /* Treat files as binary. */ /*********************************************************************/ - strcat(opmode, "b"); Zfile = gzopen(PlugSetPath(filename, To_File, Tdbp->GetPath()), opmode); if (Zfile == NULL) { - snprintf(g->Message, sizeof(g->Message), MSG(GZOPEN_ERROR), - opmode, (int)errno, filename); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(GZOPEN_ERROR) ": %s", + opmode, (int)errno, filename, strerror(errno)); return (mode == MODE_READ && errno == ENOENT) ? PushWarning(g, Tdbp) : true; } // endif Zfile diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 7a5d16accb2..f8168887e89 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -38,6 +38,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -593,7 +595,7 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) } // endswitch Mode // For blocked I/O or for moving lines, open the table in binary - strcat(opmode, (Bin) ? "b" : "t"); + safe_strcat(opmode, sizeof(opmode), (Bin) ? "b" : "t"); // Now open the file stream PlugSetPath(filename, To_File, Tdbp->GetPath()); @@ -1081,7 +1083,8 @@ bool DOSFAM::OpenTempFile(PGLOBAL g) /* Open the temporary file, Spos is at the beginning of file. */ /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, sizeof(tempname), ".t"); if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) { if (trace(1)) @@ -1170,7 +1173,8 @@ int DOSFAM::RenameTempFile(PGLOBAL g) if (!Abort) { PlugSetPath(filename, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(filetemp, filename), ".ttt"); + PlugRemoveType(filetemp, filename); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index 76e9336dedf..184df646cb7 100644 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -42,6 +42,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -194,7 +196,7 @@ int VCTFAM::GetBlockInfo(PGLOBAL g) if (Header == 2) { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } if ((h = global_open(g, MSGID_CANNOT_OPEN, filename, O_RDONLY)) == -1 @@ -251,7 +253,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) } else { // Header == 2 PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "wb"); } // endif Header @@ -587,7 +589,7 @@ bool VCTFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strncpy(g->Message, msg, sizeof(g->Message)); + safe_strcpy(g->Message, sizeof(msg), msg); rc = true; } // end catch @@ -891,8 +893,7 @@ bool VCTFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); PlugRemoveType(tempname, tempname); - strncat(tempname, ".t", _MAX_PATH - strlen(tempname)); - + safe_strcat(tempname, sizeof(tempname), ".t"); if (MaxBlk) { if (MakeEmptyFile(g, tempname)) return true; @@ -1562,7 +1563,7 @@ bool VCMFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strncpy(g->Message, msg, sizeof(g->Message)); + safe_strcpy(g->Message, sizeof(g->Message), msg); rc = true; } // end catch @@ -2082,10 +2083,10 @@ bool VECFAM::AllocateBuffer(PGLOBAL g) // Allocate all that is needed to move lines and make Temp if (UseTemp) { Tempat = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); - strcpy(Tempat, Colfn); + safe_strcpy(Tempat, _MAX_PATH, Colfn); PlugSetPath(Tempat, Tempat, Tdbp->GetPath()); PlugRemoveType(Tempat, Tempat); - strncat(Tempat, ".t", _MAX_PATH - strlen(Tempat)); + safe_strcat(Tempat, _MAX_PATH, ".t"); T_Fbs = (PFBLOCK *)PlugSubAlloc(g, NULL, Ncol * sizeof(PFBLOCK)); } // endif UseTemp @@ -2460,7 +2461,7 @@ int VECFAM::RenameTempFile(PGLOBAL g) snprintf(filename, _MAX_PATH, Colfn, i+1); PlugSetPath(filename, filename, Tdbp->GetPath()); PlugRemoveType(filetemp, filename); - strncat(filetemp, ".ttt", _MAX_PATH - strlen(filetemp)); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security @@ -3221,7 +3222,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) if (Header == 2) { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } #if defined(_WIN32) @@ -3300,7 +3301,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) } else // Header == 2 { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } if (h == INVALID_HANDLE_VALUE) { @@ -3398,7 +3399,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strncat(g->Message, filename, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), filename); if (h != INVALID_HANDLE_VALUE) CloseHandle(h); @@ -3534,7 +3535,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strncat(g->Message, filename, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), filename); } // endif Hfile if (trace(1)) @@ -3622,8 +3623,8 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) if (Hfile == INVALID_HANDLE_VALUE) { rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, mode, filename); - strncat(g->Message, strerror(errno), sizeof(g->Message) - strlen(g->Message)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)"%s", rc, mode, + filename, strerror(errno)); } // endif Hfile if (trace(1)) @@ -3967,7 +3968,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); PlugRemoveType(tempname, tempname); - strncat(tempname, ".t", _MAX_PATH - strlen(tempname)); + safe_strcat(tempname, _MAX_PATH, ".t"); if (!MaxBlk) remove(tempname); // Be sure it does not exist yet @@ -3986,7 +3987,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strncat(g->Message, tempname, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -3996,8 +3997,8 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strncat(g->Message, strerror(errno), sizeof(g->Message) - strlen(g->Message)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR) "%s", rc, MODE_INSERT, + tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index f0ee947bc23..5a1e40cccb2 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -29,6 +29,7 @@ #include <fcntl.h> #endif // !_WIN32 #include <time.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -181,7 +182,8 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) while (true) { if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName); + snprintf(filename, sizeof(filename), "%s%s%s", + drive, direc, FileData.cFileName); if (ZipFile(g, zutp, filename, FileData.cFileName, buf)) { FindClose(hSearch); @@ -217,7 +219,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) struct dirent *entry; _splitpath(filename, NULL, direc, pattern, ftype); - strcat(pattern, ftype); + safe_strcat(pattern, sizeof(pattern), ftype); // Start searching files in the target directory. if (!(dir = opendir(direc))) { @@ -226,7 +228,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) } // endif dir while ((entry = readdir(dir))) { - strcat(strcpy(fn, direc), entry->d_name); + snprintf(fn, sizeof(fn), "%s%s", direc, entry->d_name); if (lstat(fn, &fileinfo) < 0) { snprintf(g->Message, sizeof(g->Message), "%s: %s", fn, strerror(errno)); @@ -240,7 +242,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) if (fnmatch(pattern, entry->d_name, 0)) continue; // Not a match - strcat(strcpy(filename, direc), entry->d_name); + snprintf(filename, sizeof(filename), "%s%s", direc, entry->d_name); if (ZipFile(g, zutp, filename, entry->d_name, buf)) { closedir(dir); diff --git a/storage/connect/filter.h b/storage/connect/filter.h index 12ac3a169c1..0c3fa41046a 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -77,7 +77,7 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ // PFIL Copy(PTABS t); protected: - FILTER(void) {} // Standard constructor not to be used + FILTER(void) = default; // Standard constructor not to be used void Constr(PGLOBAL g, OPVAL opc, int opm, PPARM *tp); // Members diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index bf104402628..efde2e86330 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -33,6 +33,8 @@ #define NODW #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Required objects includes. */ /***********************************************************************/ @@ -231,15 +233,16 @@ bool JAVAConn::GetJVM(PGLOBAL g) #if defined(_WIN32) for (ntry = 0; !LibJvm && ntry < 3; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "\\jvm.dll"); + snprintf(soname, sizeof(soname), "%s\\jvm.dll", JvmPath); + ntry = 3; // No other try } else if (ntry < 2 && getenv("JAVA_HOME")) { - strcpy(soname, getenv("JAVA_HOME")); + safe_strcpy(soname, sizeof(soname), getenv("JAVA_HOME")); if (ntry == 1) - strcat(soname, "\\jre"); + safe_strcat(soname, sizeof(soname), "\\jre"); - strcat(soname, "\\bin\\client\\jvm.dll"); + safe_strcat(soname, sizeof(soname), "\\bin\\client\\jvm.dll"); } else { // Try to find it through the registry char version[16]; @@ -247,11 +250,12 @@ bool JAVAConn::GetJVM(PGLOBAL g) LONG rc; DWORD BufferSize = 16; - strcpy(soname, "jvm.dll"); // In case it fails + safe_strcpy(soname, sizeof(soname), "jvm.dll"); // In case it fails if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "CurrentVersion", RRF_RT_ANY, NULL, (PVOID)&version, &BufferSize)) == ERROR_SUCCESS) { - strcat(strcat(javaKey, "\\"), version); + safe_strcat(javaKey, sizeof(javaKey), "\\"); + safe_strcat(javaKey, sizeof(javaKey), version); BufferSize = sizeof(soname); if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "RuntimeLib", @@ -272,11 +276,11 @@ bool JAVAConn::GetJVM(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR)": %s", rc, + soname, buf); } else if (!(CreateJavaVM = (CRTJVM)GetProcAddress((HINSTANCE)LibJvm, "JNI_CreateJavaVM"))) { snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), "JNI_CreateJavaVM"); @@ -301,13 +305,14 @@ bool JAVAConn::GetJVM(PGLOBAL g) for (ntry = 0; !LibJvm && ntry < 2; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/libjvm.so", JvmPath); ntry = 2; } else if (!ntry && getenv("JAVA_HOME")) { // TODO: Replace i386 by a better guess - strcat(strcpy(soname, getenv("JAVA_HOME")), "/jre/lib/i386/client/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/jre/lib/i386/client/libjvm.so", + getenv("JAVA_HOME")); } else { // Will need LD_LIBRARY_PATH to be set - strcpy(soname, "libjvm.so"); + safe_strcpy(soname, sizeof(soname), "libjvm.so"); ntry = 2; } // endelse diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 4c78a9f1ecc..4490f179d24 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include <my_global.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -268,7 +269,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { jdp->dfp = GetDefaultPrec(); if (!jsp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -276,9 +277,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 6f5b0883fe1..45a0bb963e7 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -4756,7 +4756,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((arp = (PJAR)JsonNew(g, TYPE_JAR)) && (bsp = JbinAlloc(g, args, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); for (uint i = 0; i < args->arg_count; i++) arp->AddArrayValue(g, MakeValue(g, args, i)); @@ -4833,7 +4833,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, arp->InitArray(gb); if ((bsp = JbinAlloc(g, args, initid->max_length, top))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); bsp->Jsp = arp; } // endif bsp @@ -5054,7 +5054,7 @@ char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5110,7 +5110,7 @@ char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, jvp, MakeKey(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5169,7 +5169,7 @@ char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, MakeValue(g, args, i + 1), MakePSZ(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5391,7 +5391,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif CheckMemory if ((bsp = JbinAlloc(g, args, initid->max_length, jarp))) - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5466,7 +5466,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, jsp = (jvp->GetJsp()) ? jvp->GetJsp() : JvalNew(g, TYPE_JVAL, jvp->GetValue(g)); if ((bsp = JbinAlloc(g, args, initid->max_length, jsp))) - strcat(bsp->Msg, " item"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " item"); else *error = 1; @@ -5826,7 +5826,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, pretty = pty; if ((bsp = JbinAlloc(g, args, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { @@ -6162,9 +6162,8 @@ char* JUP::UnprettyJsonFile(PGLOBAL g, char *fn, char *outfn, int lrecl) { /* Parse the json file and allocate its tree structure. */ /*********************************************************************************/ if (!(fs = fopen(outfn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, outfn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR)": %s", + "w", (int)errno, outfn, strerror(errno)); CloseMemMap(mm.memory, len); return NULL; } // endif fs diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index ada0dbcd96b..4378bddf9ba 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -349,7 +349,7 @@ protected: my_bool AddPath(void); // Default constructor not to be used - JSNX(void) {} + JSNX(void) = default; // Members PJSON Row; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 4c16a7fc1aa..bb6f72de1f8 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -405,18 +405,20 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db, port = mysqld_port; if (!strnicmp(srcdef, "select ", 7) || strstr(srcdef, "%s")) { - query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 10); + size_t query_sz = strlen(srcdef) + 10; + query = (char *)PlugSubAlloc(g, NULL, query_sz); if ((p= strstr(srcdef, "%s"))) { /* Replace %s with 1=1 */ - sprintf(query, "%.*s1=1%s", (int) (p - srcdef), srcdef, p + 2); // dummy where clause + snprintf(query, query_sz, "%.*s1=1%s", + (int) (p - srcdef), srcdef, p + 2); // dummy where clause } - else - strcpy(query, srcdef); + else + safe_strcpy(query, query_sz, srcdef); if (!strnicmp(srcdef, "select ", 7)) - strcat(query, " LIMIT 0"); + safe_strcat(query, query_sz, " LIMIT 0"); } else query = (char *)srcdef; diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index 1696f4dfdbc..9d5a8b7daf5 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -257,7 +257,7 @@ protected: bool SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm); // Default constructor not to be used - BSONCOL(void) {} + BSONCOL(void) = default; // Members TDBBSN *Tbp; // To the JSN table block diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 80dfe63845d..22bb5c63ce3 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -245,7 +245,7 @@ class DllExport DOSCOL : public COLBLK { bool AddDistinctValue(PGLOBAL g); // Default constructor not to be used - DOSCOL(void) {} + DOSCOL(void) = default; // Members PVBLK Min; // Array of block min values diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h index 5f859a2bffe..1a0d756bfcf 100644 --- a/storage/connect/tabfix.h +++ b/storage/connect/tabfix.h @@ -82,7 +82,7 @@ class DllExport BINCOL : public DOSCOL { static void SetEndian(void); protected: - BINCOL(void) {} // Default constructor not to be used + BINCOL(void) = default; // Default constructor not to be used // Members static char Endian; // The host endian setting (L or B) diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index c46b5a3074e..268d00b1724 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -121,7 +121,7 @@ class DllExport CSVCOL : public DOSCOL { protected: // Default constructor not to be used - CSVCOL(void) {} + CSVCOL(void) = default; // Members int Fldnum; // Field ordinal number (0 based) diff --git a/storage/connect/tabjmg.h b/storage/connect/tabjmg.h index cf7cff83b68..06c1462d103 100644 --- a/storage/connect/tabjmg.h +++ b/storage/connect/tabjmg.h @@ -118,7 +118,7 @@ public: protected: // Default constructor not to be used - JMGCOL(void) {} + JMGCOL(void) = default; //char *GetProjPath(PGLOBAL g); //char *Mini(PGLOBAL g, const bson_t *bson, bool b); diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index 623e5b6d509..dcf40620dae 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -238,7 +238,7 @@ public: PJSON GetRow(PGLOBAL g); // Default constructor not to be used - JSONCOL(void) {} + JSONCOL(void) = default; // Members PGLOBAL G; // Support of parse memory diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h index a9d3f88cc44..a01e4e7fdf2 100644 --- a/storage/connect/tabmul.h +++ b/storage/connect/tabmul.h @@ -237,7 +237,7 @@ class DIRCOL : public COLBLK { protected: // Default constructor not to be used - DIRCOL(void) {} + DIRCOL(void) = default; #if defined(_WIN32) void SetTimeValue(PGLOBAL g, FILETIME& ftime); #endif // _WIN32 diff --git a/storage/connect/taboccur.h b/storage/connect/taboccur.h index 13bc055cd6f..8cd507acb7d 100644 --- a/storage/connect/taboccur.h +++ b/storage/connect/taboccur.h @@ -99,7 +99,7 @@ class OCCURCOL : public COLBLK { protected: // Default constructor not to be used - OCCURCOL(void) {} + OCCURCOL(void) = default; // Members int I; @@ -121,7 +121,7 @@ class RANKCOL : public COLBLK { protected: // Default constructor not to be used - RANKCOL(void) {} + RANKCOL(void) = default; // Members }; // end of class RANKCOL diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h index d819d55a61a..0a37804ff87 100644 --- a/storage/connect/tabpivot.h +++ b/storage/connect/tabpivot.h @@ -188,7 +188,7 @@ class SRCCOL : public PRXCOL { protected: // Default constructor not to be used - SRCCOL(void) {} + SRCCOL(void) = default; // Members }; // end of class SRCCOL diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h index 0c6017af177..0a427b12dae 100644 --- a/storage/connect/tabsys.h +++ b/storage/connect/tabsys.h @@ -108,7 +108,7 @@ class INICOL : public COLBLK { protected: // Default constructor not to be used - INICOL(void) {} + INICOL(void) = default; // Members char *Valbuf; // To the key value buffer @@ -176,7 +176,7 @@ class XINCOL : public INICOL { protected: // Default constructor not to be used - XINCOL(void) {} + XINCOL(void) = default; // Members }; // end of class XINICOL diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index c8e7e75106f..6cf2b11632b 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -122,7 +122,7 @@ class DllExport PRXCOL : public COLBLK { char *Decode(PGLOBAL g, const char *cnm); // Default constructor not to be used - PRXCOL(void) {} + PRXCOL(void) = default; // Members PCOL Colp; // Points to matching table column diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h index 189a9ae2221..06ccde71bcb 100644 --- a/storage/connect/tabvct.h +++ b/storage/connect/tabvct.h @@ -110,7 +110,7 @@ class DllExport VCTCOL : public DOSCOL { virtual void ReadBlock(PGLOBAL g); virtual void WriteBlock(PGLOBAL g); - VCTCOL(void) {} // Default constructor not to be used + VCTCOL(void) = default; // Default constructor not to be used // Members PVBLK Blk; // Block buffer diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h index e7313bbae67..b92ca0c50f8 100644 --- a/storage/connect/tabvir.h +++ b/storage/connect/tabvir.h @@ -21,7 +21,7 @@ PQRYRES VirColumns(PGLOBAL g, bool info); class DllExport VIRDEF : public TABDEF { /* Logical table description */ public: // Constructor - VIRDEF(void) {} + VIRDEF(void) = default; // Implementation virtual const char *GetType(void) {return "VIRTUAL";} @@ -86,7 +86,7 @@ class VIRCOL : public COLBLK { protected: // Default constructor not to be used - VIRCOL(void) {} + VIRCOL(void) = default; // No additional members }; // end of class VIRCOL diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 2ae96703548..08beb5fe6ac 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -95,7 +95,7 @@ class XCLCOL : public PRXCOL { protected: // Default constructor not to be used - XCLCOL(void) {} + XCLCOL(void) = default; // Members char *Cbuf; // The column buffer diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h index d36e4dc01d0..3c16fae99bc 100644 --- a/storage/connect/tabzip.h +++ b/storage/connect/tabzip.h @@ -23,7 +23,7 @@ class DllExport ZIPDEF : public DOSDEF { /* Table description */ friend class UNZFAM; public: // Constructor - ZIPDEF(void) {} + ZIPDEF(void) = default; // Implementation virtual const char *GetType(void) {return "ZIP";} @@ -94,7 +94,7 @@ public: protected: // Default constructor not to be used - ZIPCOL(void) {} + ZIPCOL(void) = default; // Members TDBZIP *Tdbz; diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index 1b499e09047..58acf550a0b 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -264,7 +264,7 @@ class DllExport CATCOL : public COLBLK { virtual void ReadColumn(PGLOBAL g); protected: - CATCOL(void) {} // Default constructor not to be used + CATCOL(void) = default; // Default constructor not to be used // Members PTDBCAT Tdbp; // Points to ODBC table block diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 92acce5b7bb..78b07ed5d9f 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -68,9 +68,7 @@ class ha_example: public handler public: ha_example(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_example() - { - } + ~ha_example() = default; /** @brief The name of the index type that will be used for display. diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 2a375a41200..efb598bf91e 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1665,7 +1665,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 317271f60b4..b5ee49755cb 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -121,7 +121,7 @@ private: int real_connect(); public: ha_federated(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federated() {} + ~ha_federated() = default; /* Next pointer used in transaction */ diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc index b1058dbd2f5..8a2394f2150 100644 --- a/storage/federatedx/federatedx_io_null.cc +++ b/storage/federatedx/federatedx_io_null.cc @@ -118,9 +118,7 @@ federatedx_io_null::federatedx_io_null(FEDERATEDX_SERVER *aserver) } -federatedx_io_null::~federatedx_io_null() -{ -} +federatedx_io_null::~federatedx_io_null() = default; void federatedx_io_null::reset() diff --git a/storage/federatedx/federatedx_pushdown.cc b/storage/federatedx/federatedx_pushdown.cc index 0d58e0d8270..e9a9791a859 100644 --- a/storage/federatedx/federatedx_pushdown.cc +++ b/storage/federatedx/federatedx_pushdown.cc @@ -144,7 +144,7 @@ ha_federatedx_derived_handler::ha_federatedx_derived_handler(THD *thd, derived= dt; } -ha_federatedx_derived_handler::~ha_federatedx_derived_handler() {} +ha_federatedx_derived_handler::~ha_federatedx_derived_handler() = default; int ha_federatedx_derived_handler::init_scan() { @@ -281,7 +281,7 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(THD *thd, select= sel; } -ha_federatedx_select_handler::~ha_federatedx_select_handler() {} +ha_federatedx_select_handler::~ha_federatedx_select_handler() = default; int ha_federatedx_select_handler::init_scan() { diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index a39e707b401..62a71aa6db6 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1834,7 +1834,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 6876db5cbb8..a67fe1efa8f 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -315,7 +315,7 @@ private: int real_connect(FEDERATEDX_SHARE *my_share, uint create_flag); public: ha_federatedx(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federatedx() {} + ~ha_federatedx() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index beb97601c06..eed91176136 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -36,7 +36,7 @@ class ha_heap final : public handler my_bool internal_table; public: ha_heap(handlerton *hton, TABLE_SHARE *table); - ~ha_heap() {} + ~ha_heap() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override; const char *index_type(uint inx) override { diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index c1e4d95efcf..3b1a285104c 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -75,12 +75,6 @@ IF(WITH_INNODB_EXTRA_DEBUG) ENDIF() ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks") - -CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU) -IF(HAVE_SCHED_GETCPU) - ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1) -ENDIF() - IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1) ENDIF() diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 6528eb0173f..36dc578dc7f 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1768,6 +1768,7 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, ut_ad(root_leaf_rw_latch != RW_NO_LATCH); upper_rw_latch= root_leaf_rw_latch; mtr->rollback_to_savepoint(savepoint); + height= ULINT_UNDEFINED; continue; } else diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 21ef245a3ae..0a4da87083a 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3075,8 +3075,7 @@ or decrypt/decompress just failed. @retval DB_SUCCESS if page has been read and is not corrupted @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */ +after decryption normal page checksum does not match. */ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, const fil_node_t &node) { @@ -3133,7 +3132,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails -@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ +@retval DB_DECRYPTION_FAILED if the page cannot be decrypted +@retval DB_FAIL if the page contains the wrong ID */ dberr_t buf_page_t::read_complete(const fil_node_t &node) { const page_id_t expected_id{id()}; diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index f5b31c1f3f8..6c994b8c9bd 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -398,6 +398,11 @@ buf_block_t* buf_LRU_get_free_block(buf_LRU_get get) mysql_mutex_assert_owner(&buf_pool.mutex); goto got_mutex; } + DBUG_EXECUTE_IF("recv_ran_out_of_buffer", + if (recv_recovery_is_on() + && recv_sys.apply_log_recs) { + goto flush_lru; + }); mysql_mutex_lock(&buf_pool.mutex); got_mutex: buf_LRU_check_size_of_non_data_objects(); @@ -487,7 +492,9 @@ not_found: removing the block from buf_pool.page_hash and buf_pool.LRU is fairly involved (particularly in case of ROW_FORMAT=COMPRESSED pages). We can do that in a separate patch sometime in future. */ - +#ifndef DBUG_OFF +flush_lru: +#endif if (!buf_flush_LRU(innodb_lru_flush_size)) { MONITOR_INC(MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT); ++flush_failures; diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 24890ff3d91..3906ff65dfb 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -264,6 +264,9 @@ buf_read_page_low( /* The i/o was already completed in space->io() */ *err = bpage->read_complete(*fio.node); space->release(); + if (*err == DB_FAIL) { + *err = DB_PAGE_CORRUPTED; + } } return true; diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 964e75aacc1..b688f3970fc 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -311,7 +311,7 @@ btr_get_size_and_reserved( return ULINT_UNDEFINED; } - mtr->s_lock_space(index->table->space); + mtr->x_lock_space(index->table->space); ulint n = fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_LEAF + root->page.frame, used, mtr); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index f3e11c10bad..04b1ec88ac3 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1475,7 +1475,7 @@ invalid: goto invalid; } - mtr.s_lock_space(index->table->space); + mtr.x_lock_space(index->table->space); ulint dummy, size; index->stat_index_size @@ -2674,7 +2674,7 @@ empty_index: } uint16_t root_level = btr_page_get_level(root->page.frame); - mtr.s_lock_space(index->table->space); + mtr.x_lock_space(index->table->space); ulint dummy, size; result.index_size = fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_LEAF @@ -2984,6 +2984,7 @@ dict_stats_update_persistent( index_stats_t stats = dict_stats_analyze_index(index); if (stats.is_bulk_operation()) { + dict_stats_empty_table(table, false); return DB_SUCCESS_LOCKED_REC; } @@ -3024,6 +3025,12 @@ dict_stats_update_persistent( stats = dict_stats_analyze_index(index); table->stats_mutex_lock(); + if (stats.is_bulk_operation()) { + table->stats_mutex_unlock(); + dict_stats_empty_table(table, false); + return DB_SUCCESS_LOCKED_REC; + } + index->stat_index_size = stats.index_size; index->stat_n_leaf_pages = stats.n_leaf_pages; diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 067aca49b4c..4918cefb947 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1678,8 +1678,9 @@ fil_crypt_get_page_throttle( return NULL; } - if (DB_SUCCESS_LOCKED_REC - != fseg_page_is_allocated(space, state->offset)) { + if (offset % (zip_size ? zip_size : srv_page_size) + && DB_SUCCESS_LOCKED_REC + != fseg_page_is_allocated(space, offset)) { /* page is already freed */ return NULL; } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index f3e3322de4b..f7625974886 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -2655,7 +2655,7 @@ dberr_t fseg_page_is_allocated(fil_space_t *space, unsigned page) mtr.start(); if (!space->is_owner()) - mtr.s_lock_space(space); + mtr.x_lock_space(space); if (page >= space->free_limit || page >= space->size_in_header); else if (const buf_block_t *b= diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7cba8c46fff..de1f2042be3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2982,10 +2982,8 @@ ha_innobase::ha_innobase( /*********************************************************************//** Destruct ha_innobase handler. */ -ha_innobase::~ha_innobase() +ha_innobase::~ha_innobase() = default; /*======================*/ -{ -} /*********************************************************************//** Updates the user_thd field in a handle and also allocates a new InnoDB diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 846cf5e5f3a..59aa1ac08ad 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -740,7 +740,8 @@ public: @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails - @retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ + @retval DB_DECRYPTION_FAILED if the page cannot be decrypted + @retval DB_FAIL if the page contains the wrong ID */ dberr_t read_complete(const fil_node_t &node); /** Note that a block is no longer dirty, while not removing @@ -1002,7 +1003,7 @@ even after we release the buffer pool mutex. */ class HazardPointer { public: - virtual ~HazardPointer() {} + virtual ~HazardPointer() = default; /** @return current value */ buf_page_t *get() const { mysql_mutex_assert_owner(m_mutex); return m_hp; } @@ -1041,16 +1042,15 @@ protected: class FlushHp : public HazardPointer { public: - ~FlushHp() override {} + ~FlushHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage != NULL); - /* We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(list, m_hp); @@ -1062,15 +1062,15 @@ public: /** Class implementing buf_pool.LRU hazard pointer */ class LRUHp : public HazardPointer { public: - ~LRUHp() override {} + ~LRUHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage); /** We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(LRU, m_hp); @@ -1085,8 +1085,7 @@ itr in that position and the other thread can start scan from there */ class LRUItr : public LRUHp { public: - LRUItr() : LRUHp() {} - ~LRUItr() override {} + ~LRUItr() override = default; /** Select from where to start a scan. If we have scanned too deep into the LRU list it resets the value to the tail diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 82a0f780723..f6169227433 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -101,7 +101,7 @@ struct table_name_t char* m_name; /** Default constructor */ - table_name_t() {} + table_name_t() = default; /** Constructor */ table_name_t(char* name) : m_name(name) {} diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 6a2148d487c..cdb159a5b26 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -283,17 +283,6 @@ struct mtr_t { memo_push(lock, MTR_MEMO_SX_LOCK); } - /** Acquire a tablespace S-latch. - @param space tablespace */ - void s_lock_space(fil_space_t *space) - { - ut_ad(space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT || - space->purpose == FIL_TYPE_TABLESPACE); - memo_push(space, MTR_MEMO_SPACE_S_LOCK); - space->s_lock(); - } - /** Acquire an exclusive tablespace latch. @param space tablespace */ void x_lock_space(fil_space_t *space); @@ -346,9 +335,8 @@ public: /** Check if we are holding tablespace latch @param space tablespace to search for - @param shared whether to look for shared latch, instead of exclusive @return whether space.latch is being held */ - bool memo_contains(const fil_space_t& space, bool shared= false) const + bool memo_contains(const fil_space_t& space) const MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /** Check if we are holding an rw-latch in this mini-transaction @@ -401,7 +389,7 @@ public: break; case MTR_MEMO_MODIFY: case MTR_MEMO_S_LOCK: case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: - case MTR_MEMO_SPACE_X_LOCK: case MTR_MEMO_SPACE_S_LOCK: + case MTR_MEMO_SPACE_X_LOCK: ut_ad("invalid type" == 0); } #endif diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 1de31126a88..19db13a12b6 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -342,8 +342,6 @@ enum mtr_memo_type_t { MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5, /** wr_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1, - /** rd_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_S_LOCK = MTR_MEMO_SX_LOCK << 2 + MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1 }; #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index dcf26e57e7e..2f038ab349f 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1223,7 +1223,7 @@ public: } /** Destructor */ - ~rec_printer() override {} + ~rec_printer() override = default; private: /** Copy constructor */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index a49e2c3f441..a9f1c87d600 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -702,7 +702,7 @@ struct row_prebuilt_t { /** Callback for row_mysql_sys_index_iterate() */ struct SysIndexCallback { - virtual ~SysIndexCallback() { } + virtual ~SysIndexCallback() = default; /** Callback method @param mtr current mini transaction diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 3711599bd8c..ac39d3ec45b 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -56,7 +56,7 @@ public: typedef trx_rsegs_t::iterator iterator; typedef trx_rsegs_t::const_iterator const_iterator; - TrxUndoRsegs() {} + TrxUndoRsegs() = default; /** Constructor */ TrxUndoRsegs(trx_rseg_t& rseg) diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index cd116cc3a20..f4183e4c61a 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -283,7 +283,7 @@ public: { } #else - ut_allocator() {} + ut_allocator() = default; ut_allocator(PSI_memory_key) {} #endif /* UNIV_PFS_MEMORY */ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 95541ea574e..fe16ce149da 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -323,7 +323,7 @@ class logger { protected: /* This class must not be used directly */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() {} + ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() = default; public: template<typename T> ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger& operator<<(const T& rhs) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 66b98c5c046..fbfe37d7d41 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -725,8 +725,10 @@ static struct bool reinit_all() { retry: + log_sys.latch.wr_unlock(); bool fail= false; buf_block_t *free_block= buf_LRU_get_free_block(have_no_mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&recv_sys.mutex); for (auto d= defers.begin(); d != defers.end(); ) @@ -1859,7 +1861,7 @@ inline bool page_recv_t::trim(lsn_t start_lsn) { while (log.head) { - if (log.head->lsn >= start_lsn) return false; + if (log.head->lsn > start_lsn) return false; last_offset= 1; /* the next record must not be same_page */ log_rec_t *next= log.head->next; recv_sys.free(log.head); @@ -2485,6 +2487,9 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) goto record_corrupted; static_assert(UT_ARR_SIZE(truncated_undo_spaces) == TRX_SYS_MAX_UNDO_SPACES, "compatibility"); + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. */ + trim({space_id, 0}, lsn); truncated_undo_spaces[space_id - srv_undo_space_id_start]= { lsn, page_no }; if (undo_space_trunc) @@ -3364,7 +3369,12 @@ void recv_sys_t::apply(bool last_batch) const trunc& t= truncated_undo_spaces[id]; if (t.lsn) { - trim(page_id_t(id + srv_undo_space_id_start, 0), t.lsn); + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. + Even though we recv_sys_t::parse() already invoked trim(), + this will be needed in case recovery consists of multiple batches + (there was an invocation with !last_batch). */ + trim({id + srv_undo_space_id_start, 0}, t.lsn); if (fil_space_t *space = fil_space_get(id + srv_undo_space_id_start)) { ut_ad(UT_LIST_GET_LEN(space->chain) == 1); @@ -3378,8 +3388,21 @@ void recv_sys_t::apply(bool last_batch) fil_system.extend_to_recv_size(); + /* We must release log_sys.latch and recv_sys.mutex before + invoking buf_LRU_get_free_block(). Allocating a block may initiate + a redo log write and therefore acquire log_sys.latch. To avoid + deadlocks, log_sys.latch must not be acquired while holding + recv_sys.mutex. */ + mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); + buf_block_t *free_block= buf_LRU_get_free_block(have_no_mutex); + if (!last_batch) + log_sys.latch.wr_lock(SRW_LOCK_CALL); + mysql_mutex_lock(&mutex); + for (map::iterator p= pages.begin(); p != pages.end(); ) { const page_id_t page_id= p->first; @@ -3425,7 +3448,11 @@ erase_for_space: { next_free_block: mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); free_block= buf_LRU_get_free_block(have_no_mutex); + if (!last_batch) + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&mutex); break; } @@ -4143,6 +4170,11 @@ read_only_recovery: || recv_sys.is_corrupt_fs()) { goto err_exit; } + + /* In case of multi-batch recovery, + redo log for the last batch is not + applied yet. */ + ut_d(recv_sys.after_apply = false); } } else { ut_ad(recv_sys.pages.empty()); diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d2f62b5c39e..d642c7266bb 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -52,9 +52,6 @@ void mtr_memo_slot_t::release() const static_cast<fil_space_t*>(object)->set_committed_size(); static_cast<fil_space_t*>(object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(object)->s_unlock(); - break; default: buf_page_t *bpage= static_cast<buf_page_t*>(object); ut_d(const auto s=) @@ -262,9 +259,6 @@ void mtr_t::release_unlogged() static_cast<fil_space_t*>(slot.object)->set_committed_size(); static_cast<fil_space_t*>(slot.object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(slot.object)->s_unlock(); - break; case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: static_cast<index_lock*>(slot.object)-> @@ -404,9 +398,6 @@ void mtr_t::commit() static_cast<fil_space_t*>(slot.object)->set_committed_size(); static_cast<fil_space_t*>(slot.object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(slot.object)->s_unlock(); - break; case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: static_cast<index_lock*>(slot.object)-> @@ -457,7 +448,20 @@ void mtr_t::commit() buf_flush_ahead(m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); } else + { + if (m_freed_pages) + { + ut_ad(!m_freed_pages->empty()); + ut_ad(m_freed_space == fil_system.temp_space); + ut_ad(!m_trim_pages); + for (const auto &range : *m_freed_pages) + m_freed_space->add_free_range(range); + delete m_freed_pages; + m_freed_pages= nullptr; + m_freed_space= nullptr; + } release(); + } func_exit: release_resources(); @@ -1298,18 +1302,14 @@ bool mtr_t::have_u_or_x_latch(const buf_block_t &block) const /** Check if we are holding exclusive tablespace latch @param space tablespace to search for -@param shared whether to look for shared latch, instead of exclusive @return whether space.latch is being held */ -bool mtr_t::memo_contains(const fil_space_t& space, bool shared) const +bool mtr_t::memo_contains(const fil_space_t& space) const { - const mtr_memo_type_t type= shared - ? MTR_MEMO_SPACE_S_LOCK : MTR_MEMO_SPACE_X_LOCK; - for (const mtr_memo_slot_t &slot : m_memo) { - if (slot.object == &space && slot.type == type) + if (slot.object == &space && slot.type == MTR_MEMO_SPACE_X_LOCK) { - ut_ad(shared || space.is_owner()); + ut_ad(space.is_owner()); return true; } } diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 63bd39feb4d..1060e702db4 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -766,10 +766,9 @@ corrupted: max_trx_id is ignored for temp tables because it not required for MVCC. */ if (n_core && !index->is_primary() && !index->table->is_temporary()) { - page_update_max_trx_id(new_block, - new_page_zip, + page_update_max_trx_id(new_block, nullptr, page_get_max_trx_id(block->page.frame), - mtr); + mtr); } if (new_page_zip) { diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 92ec8ba0869..e48cad01530 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -724,9 +724,12 @@ cmp_rec_rec_simple( /* If we ran out of fields, the ordering columns of rec1 were equal to rec2. Issue a duplicate key error if needed. */ - if (!null_eq && table && dict_index_is_unique(index)) { - /* Report erroneous row using new version of table. */ - innobase_rec_to_mysql(table, rec1, index, offsets1); + if (!null_eq && index->is_unique()) { + if (table) { + /* Report erroneous row using new version + of table. */ + innobase_rec_to_mysql(table, rec1, index, offsets1); + } return(0); } diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 133ad520d01..5d7ea475d43 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -349,8 +349,8 @@ public: << index->name; } - /** Descructor */ - ~IndexPurge() UNIV_NOTHROW { } + /** Destructor */ + ~IndexPurge() UNIV_NOTHROW = default; /** Purge delete marked records. @return DB_SUCCESS or error code. */ @@ -691,7 +691,7 @@ struct FetchIndexRootPages : public AbstractCallback { m_table(table), m_index(0, 0) UNIV_NOTHROW { } /** Destructor */ - ~FetchIndexRootPages() UNIV_NOTHROW override { } + ~FetchIndexRootPages() UNIV_NOTHROW override = default; /** Fetch the clustered index root page in the tablespace @param iter Tablespace iterator diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 7c4e5a0d890..2e4f8c283f9 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -389,17 +389,6 @@ thread ensures that we flush the log files at least once per second. */ static time_t srv_last_log_flush_time; -/* Interval in seconds at which various tasks are performed by the -master thread when server is active. In order to balance the workload, -we should try to keep intervals such that they are not multiple of -each other. For example, if we have intervals for various tasks -defined as 5, 10, 15, 60 then all tasks will be performed when -current_time % 60 == 0 and no tasks will be performed when -current_time % 5 != 0. */ - -# define SRV_MASTER_CHECKPOINT_INTERVAL (7) -# define SRV_MASTER_DICT_LRU_INTERVAL (47) - /** Buffer pool dump status frequence in percentages */ ulong srv_buf_dump_status_frequency; @@ -1342,7 +1331,7 @@ static void srv_master_do_active_tasks(ulonglong counter_time) MONITOR_INC(MONITOR_MASTER_ACTIVE_LOOPS); - if (!(counter_time % (SRV_MASTER_DICT_LRU_INTERVAL * 1000000ULL))) { + if (!(counter_time % (47 * 1000000ULL))) { srv_main_thread_op_info = "enforcing dict cache limit"; if (ulint n_evicted = dict_sys.evict_table_LRU(true)) { MONITOR_INC_VALUE( diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index bea913e424f..009e8ca5fe7 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -64,7 +64,7 @@ private: public: ha_maria(handlerton *hton, TABLE_SHARE * table_arg); - ~ha_maria() {} + ~ha_maria() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override final; const char *index_type(uint key_number) override final; ulonglong table_flags() const override final diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index c00f42d74c1..8c105522c11 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -233,7 +233,7 @@ ha_create_table_option s3_table_option_list[]= ha_s3::ha_s3(handlerton *hton, TABLE_SHARE *table_arg) - :ha_maria(hton, table_arg), in_alter_table(S3_NO_ALTER) + :ha_maria(hton, table_arg), in_alter_table(S3_NO_ALTER), open_args(NULL) { /* Remove things that S3 doesn't support */ int_table_flags&= ~(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c index 491a8e0a323..3d18ba8800d 100644 --- a/storage/maria/s3_func.c +++ b/storage/maria/s3_func.c @@ -351,7 +351,7 @@ int aria_copy_to_s3(ms3_st *s3_client, const char *aws_bucket, if (display) printf("Copying frm file %s\n", filename); - end= strmov(aws_path_end,"/frm"); + strmov(aws_path_end,"/frm"); convert_frm_to_s3_format(alloc_block); /* Note that frm is not compressed! */ @@ -1232,7 +1232,7 @@ static void convert_index_to_s3_format(uchar *header, ulong block_size, uchar *base_pos; uint base_offset; - memcpy(state.header.file_version, header, sizeof(state.header)); + memcpy(&state.header, header, sizeof(state.header)); base_offset= mi_uint2korr(state.header.base_pos); base_pos= header + base_offset; @@ -1251,7 +1251,7 @@ static void convert_index_to_disk_format(uchar *header) uchar *base_pos; uint base_offset; - memcpy(state.header.file_version, header, sizeof(state.header)); + memcpy(&state.header, header, sizeof(state.header)); base_offset= mi_uint2korr(state.header.base_pos); base_pos= header + base_offset; diff --git a/storage/mroonga/lib/mrn_count_skip_checker.cpp b/storage/mroonga/lib/mrn_count_skip_checker.cpp index dfa1a11d2b8..cd22be31ef2 100644 --- a/storage/mroonga/lib/mrn_count_skip_checker.cpp +++ b/storage/mroonga/lib/mrn_count_skip_checker.cpp @@ -40,8 +40,7 @@ namespace mrn { is_storage_mode_(is_storage_mode) { } - CountSkipChecker::~CountSkipChecker() { - } + CountSkipChecker::~CountSkipChecker() = default; bool CountSkipChecker::check() { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp index c0c4a90e8f7..08ddd84943e 100644 --- a/storage/mroonga/lib/mrn_database_repairer.cpp +++ b/storage/mroonga/lib/mrn_database_repairer.cpp @@ -57,8 +57,7 @@ namespace mrn { mrn_db_file_suffix_length_(strlen(MRN_DB_FILE_SUFFIX)) { } - DatabaseRepairer::~DatabaseRepairer() { - } + DatabaseRepairer::~DatabaseRepairer() = default; bool DatabaseRepairer::is_crashed(void) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp index d7a81f749fc..db1af550a14 100644 --- a/storage/mroonga/lib/mrn_field_normalizer.cpp +++ b/storage/mroonga/lib/mrn_field_normalizer.cpp @@ -30,8 +30,7 @@ namespace mrn { field_(field) { } - FieldNormalizer::~FieldNormalizer() { - } + FieldNormalizer::~FieldNormalizer() = default; bool FieldNormalizer::should_normalize() { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp index 73639685d0e..dd3165cdadf 100644 --- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -70,8 +70,7 @@ namespace mrn { key_info_(key_info) { } - MultipleColumnKeyCodec::~MultipleColumnKeyCodec() { - } + MultipleColumnKeyCodec::~MultipleColumnKeyCodec() = default; int MultipleColumnKeyCodec::encode(const uchar *mysql_key, uint mysql_key_length, diff --git a/storage/mroonga/lib/mrn_query_parser.cpp b/storage/mroonga/lib/mrn_query_parser.cpp index 92387e259a8..b32ebd2c443 100644 --- a/storage/mroonga/lib/mrn_query_parser.cpp +++ b/storage/mroonga/lib/mrn_query_parser.cpp @@ -44,8 +44,7 @@ namespace mrn { match_columns_(match_columns) { } - QueryParser::~QueryParser() { - } + QueryParser::~QueryParser() = default; grn_rc QueryParser::parse(const char *query, size_t query_length) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_time_converter.cpp b/storage/mroonga/lib/mrn_time_converter.cpp index 9bb8d89a082..7d7555bb47a 100644 --- a/storage/mroonga/lib/mrn_time_converter.cpp +++ b/storage/mroonga/lib/mrn_time_converter.cpp @@ -33,11 +33,9 @@ #define MRN_CLASS_NAME "mrn::TimeConverter" namespace mrn { - TimeConverter::TimeConverter() { - } + TimeConverter::TimeConverter() = default; - TimeConverter::~TimeConverter() { - } + TimeConverter::~TimeConverter() = default; time_t TimeConverter::tm_to_time_gm(struct tm *time, bool *truncated) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/vendor/groonga/lib/alloc.c b/storage/mroonga/vendor/groonga/lib/alloc.c index 94e31901cec..adb35e04c45 100644 --- a/storage/mroonga/vendor/groonga/lib/alloc.c +++ b/storage/mroonga/vendor/groonga/lib/alloc.c @@ -828,7 +828,7 @@ grn_free_default(grn_ctx *ctx, void *ptr, if (ptr) { GRN_ADD_ALLOC_COUNT(-1); } else { - GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (%s:%d) <%d>", + GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (nullptr) (%s:%d) <%d>", file, line, alloc_count); } } diff --git a/storage/mroonga/vendor/groonga/lib/dat/array.hpp b/storage/mroonga/vendor/groonga/lib/dat/array.hpp index de60e3bd590..58186ff4127 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/array.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/array.hpp @@ -33,7 +33,7 @@ class GRN_DAT_API Array { } template <UInt32 U> explicit Array(T (&array)[U]) : ptr_(array), size_(U) {} - ~Array() {} + ~Array() = default; const T &operator[](UInt32 i) const { GRN_DAT_DEBUG_THROW_IF(i >= size_); diff --git a/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp index 357b5250e99..740a56edfde 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp @@ -25,8 +25,8 @@ namespace dat { class GRN_DAT_API Cursor { public: - Cursor() {} - virtual ~Cursor() {} + Cursor() = default; + virtual ~Cursor() = default; virtual void close() = 0; diff --git a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp index 1afbd0955bc..b6e2893ad07 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp @@ -175,12 +175,8 @@ class Exception : public std::exception { file_(file), line_(line), what_((what != NULL) ? what : "") {} - Exception(const Exception &ex) throw() - : std::exception(ex), - file_(ex.file_), - line_(ex.line_), - what_(ex.what_) {} - virtual ~Exception() throw() {} + Exception(const Exception &ex) throw() = default; + virtual ~Exception() throw() = default; virtual ErrorCode code() const throw() = 0; virtual const char *file() const throw() { @@ -208,7 +204,7 @@ class Error : public Exception { : Exception(file, line, what) {} Error(const Error &ex) throw() : Exception(ex) {} - virtual ~Error() throw() {} + virtual ~Error() throw() = default; virtual ErrorCode code() const throw() { return T; diff --git a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp index de969839586..d3caf510dcd 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp @@ -33,7 +33,7 @@ IdCursor::IdCursor() end_(INVALID_KEY_ID), count_(0) {} -IdCursor::~IdCursor() {} +IdCursor::~IdCursor() = default; void IdCursor::open(const Trie &trie, const String &min_str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/key.hpp b/storage/mroonga/vendor/groonga/lib/dat/key.hpp index eb0324cd8d3..717ad90a715 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/key.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/key.hpp @@ -99,7 +99,7 @@ class GRN_DAT_API Key { // Disallows instantiation. Key() : id_and_length_low_(INVALID_KEY_ID << 4), length_high_(0) {} - ~Key() {} + ~Key() = default; // Disallows copy and assignment. Key(const Key &); diff --git a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp index 67520305703..d9fd995beae 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp @@ -35,7 +35,7 @@ PredictiveCursor::PredictiveCursor() end_(0), min_length_(0) {} -PredictiveCursor::~PredictiveCursor() {} +PredictiveCursor::~PredictiveCursor() = default; void PredictiveCursor::open(const Trie &trie, const String &str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp index 83adeb3731e..5f491c6644f 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp @@ -33,7 +33,7 @@ PrefixCursor::PrefixCursor() cur_(0), end_(0) {} -PrefixCursor::~PrefixCursor() {} +PrefixCursor::~PrefixCursor() = default; void PrefixCursor::open(const Trie &trie, const String &str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/string.hpp b/storage/mroonga/vendor/groonga/lib/dat/string.hpp index aead21cac18..281333ee18f 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/string.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/string.hpp @@ -35,9 +35,7 @@ class GRN_DAT_API String { explicit String(const char (&str)[T]) : ptr_(reinterpret_cast<const UInt8 *>(str)), length_(T - 1) {} - String(const String &rhs) - : ptr_(rhs.ptr_), - length_(rhs.length_) {} + String(const String &rhs) = default; String &operator=(const String &rhs) { set_ptr(rhs.ptr()); diff --git a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp index b2c6a84ffa7..47d53209953 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp @@ -55,7 +55,7 @@ Trie::Trie() entries_(), key_buf_() {} -Trie::~Trie() {} +Trie::~Trie() = default; void Trie::create(const char *file_name, UInt64 file_size, diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 68ad636c48e..0914d531788 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -53,7 +53,7 @@ class ha_myisam final : public handler public: ha_myisam(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_myisam() {} + ~ha_myisam() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override; const char *index_type(uint key_number) override; ulonglong table_flags() const override { return int_table_flags; } diff --git a/storage/perfschema/cursor_by_account.h b/storage/perfschema/cursor_by_account.h index 30ee3761f37..59adf2e0fc8 100644 --- a/storage/perfschema/cursor_by_account.h +++ b/storage/perfschema/cursor_by_account.h @@ -51,8 +51,7 @@ protected: cursor_by_account(const PFS_engine_table_share *share); public: - ~cursor_by_account() - {} + ~cursor_by_account() = default; protected: virtual void make_row(PFS_account *account)= 0; diff --git a/storage/perfschema/cursor_by_host.h b/storage/perfschema/cursor_by_host.h index e7ae47fef72..a2ddae4b644 100644 --- a/storage/perfschema/cursor_by_host.h +++ b/storage/perfschema/cursor_by_host.h @@ -51,8 +51,7 @@ protected: cursor_by_host(const PFS_engine_table_share *share); public: - ~cursor_by_host() - {} + ~cursor_by_host() = default; protected: virtual void make_row(PFS_host *host)= 0; diff --git a/storage/perfschema/cursor_by_thread.h b/storage/perfschema/cursor_by_thread.h index 910291c2be3..89d97997a41 100644 --- a/storage/perfschema/cursor_by_thread.h +++ b/storage/perfschema/cursor_by_thread.h @@ -51,8 +51,7 @@ protected: cursor_by_thread(const PFS_engine_table_share *share); public: - ~cursor_by_thread() - {} + ~cursor_by_thread() = default; protected: virtual void make_row(PFS_thread *thread)= 0; diff --git a/storage/perfschema/cursor_by_thread_connect_attr.h b/storage/perfschema/cursor_by_thread_connect_attr.h index aa1b63ad51e..3c273708e39 100644 --- a/storage/perfschema/cursor_by_thread_connect_attr.h +++ b/storage/perfschema/cursor_by_thread_connect_attr.h @@ -70,8 +70,7 @@ protected: cursor_by_thread_connect_attr(const PFS_engine_table_share *share); public: - ~cursor_by_thread_connect_attr() - {} + ~cursor_by_thread_connect_attr() = default; protected: virtual void make_row(PFS_thread *thread, uint ordinal)= 0; diff --git a/storage/perfschema/cursor_by_user.h b/storage/perfschema/cursor_by_user.h index ca4fef9209c..f5b6800d9b1 100644 --- a/storage/perfschema/cursor_by_user.h +++ b/storage/perfschema/cursor_by_user.h @@ -51,8 +51,7 @@ protected: cursor_by_user(const PFS_engine_table_share *share); public: - ~cursor_by_user() - {} + ~cursor_by_user() = default; protected: virtual void make_row(PFS_user *user)= 0; diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 982876216aa..57aa40c7e86 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -238,8 +238,7 @@ ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share) : handler(hton, share), m_table_share(NULL), m_table(NULL) {} -ha_perfschema::~ha_perfschema() -{} +ha_perfschema::~ha_perfschema() = default; int ha_perfschema::open(const char *name, int mode, uint test_if_locked) { diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index d8646938bdb..6a9351b9d91 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -670,11 +670,9 @@ int PFS_engine_table::update_row_values(TABLE *, class PFS_internal_schema_access : public ACL_internal_schema_access { public: - PFS_internal_schema_access() - {} + PFS_internal_schema_access() = default; - ~PFS_internal_schema_access() - {} + ~PFS_internal_schema_access() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index 6280a3799b3..1f31c4fcdf6 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -125,8 +125,7 @@ public: void get_normalizer(PFS_instr_class *instr_class); /** Destructor. */ - virtual ~PFS_engine_table() - {} + virtual ~PFS_engine_table() = default; /** Helper, assign a value to a long field. @@ -337,11 +336,9 @@ struct PFS_engine_table_share class PFS_readonly_acl : public ACL_internal_table_access { public: - PFS_readonly_acl() - {} + PFS_readonly_acl() = default; - ~PFS_readonly_acl() - {} + ~PFS_readonly_acl() = default; virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -357,11 +354,9 @@ extern PFS_readonly_acl pfs_readonly_acl; class PFS_truncatable_acl : public ACL_internal_table_access { public: - PFS_truncatable_acl() - {} + PFS_truncatable_acl() = default; - ~PFS_truncatable_acl() - {} + ~PFS_truncatable_acl() = default; virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -377,11 +372,9 @@ extern PFS_truncatable_acl pfs_truncatable_acl; class PFS_updatable_acl : public ACL_internal_table_access { public: - PFS_updatable_acl() - {} + PFS_updatable_acl() = default; - ~PFS_updatable_acl() - {} + ~PFS_updatable_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -397,11 +390,9 @@ extern PFS_updatable_acl pfs_updatable_acl; class PFS_editable_acl : public ACL_internal_table_access { public: - PFS_editable_acl() - {} + PFS_editable_acl() = default; - ~PFS_editable_acl() - {} + ~PFS_editable_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -416,11 +407,9 @@ extern PFS_editable_acl pfs_editable_acl; class PFS_unknown_acl : public ACL_internal_table_access { public: - PFS_unknown_acl() - {} + PFS_unknown_acl() = default; - ~PFS_unknown_acl() - {} + ~PFS_unknown_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/storage/perfschema/pfs_visitor.cc b/storage/perfschema/pfs_visitor.cc index 4cb0673f1b2..17ef39448f9 100644 --- a/storage/perfschema/pfs_visitor.cc +++ b/storage/perfschema/pfs_visitor.cc @@ -895,8 +895,7 @@ PFS_connection_wait_visitor m_index= klass->m_event_name_index; } -PFS_connection_wait_visitor::~PFS_connection_wait_visitor() -{} +PFS_connection_wait_visitor::~PFS_connection_wait_visitor() = default; void PFS_connection_wait_visitor::visit_global() { @@ -959,12 +958,9 @@ void PFS_connection_wait_visitor::visit_thread(PFS_thread *pfs) } } -PFS_connection_all_wait_visitor -::PFS_connection_all_wait_visitor() -{} +PFS_connection_all_wait_visitor::PFS_connection_all_wait_visitor() = default; -PFS_connection_all_wait_visitor::~PFS_connection_all_wait_visitor() -{} +PFS_connection_all_wait_visitor::~PFS_connection_all_wait_visitor() = default; void PFS_connection_all_wait_visitor::visit_global() { @@ -1010,8 +1006,7 @@ PFS_connection_stage_visitor::PFS_connection_stage_visitor(PFS_stage_class *klas m_index= klass->m_event_name_index; } -PFS_connection_stage_visitor::~PFS_connection_stage_visitor() -{} +PFS_connection_stage_visitor::~PFS_connection_stage_visitor() = default; void PFS_connection_stage_visitor::visit_global() { @@ -1064,8 +1059,7 @@ PFS_connection_statement_visitor m_index= klass->m_event_name_index; } -PFS_connection_statement_visitor::~PFS_connection_statement_visitor() -{} +PFS_connection_statement_visitor::~PFS_connection_statement_visitor() = default; void PFS_connection_statement_visitor::visit_global() { @@ -1114,11 +1108,10 @@ void PFS_connection_statement_visitor::visit_thread(PFS_thread *pfs) /** Instance wait visitor */ PFS_connection_all_statement_visitor -::PFS_connection_all_statement_visitor() -{} +::PFS_connection_all_statement_visitor() = default; -PFS_connection_all_statement_visitor::~PFS_connection_all_statement_visitor() -{} +PFS_connection_all_statement_visitor +::~PFS_connection_all_statement_visitor() = default; void PFS_connection_all_statement_visitor::visit_global() { @@ -1259,11 +1252,9 @@ void PFS_connection_all_transaction_visitor::visit_thread(PFS_thread *pfs) } #endif -PFS_connection_stat_visitor::PFS_connection_stat_visitor() -{} +PFS_connection_stat_visitor::PFS_connection_stat_visitor() = default; -PFS_connection_stat_visitor::~PFS_connection_stat_visitor() -{} +PFS_connection_stat_visitor::~PFS_connection_stat_visitor() = default; void PFS_connection_stat_visitor::visit_global() {} @@ -1360,8 +1351,7 @@ PFS_connection_status_visitor(STATUS_VAR *status_vars) : m_status_vars(status_va memset(m_status_vars, 0, sizeof(STATUS_VAR)); } -PFS_connection_status_visitor::~PFS_connection_status_visitor() -{} +PFS_connection_status_visitor::~PFS_connection_status_visitor() = default; /** Aggregate from global status. */ void PFS_connection_status_visitor::visit_global() @@ -1396,11 +1386,9 @@ void PFS_connection_status_visitor::visit_THD(THD *thd) } -PFS_instance_wait_visitor::PFS_instance_wait_visitor() -{} +PFS_instance_wait_visitor::PFS_instance_wait_visitor() = default; -PFS_instance_wait_visitor::~PFS_instance_wait_visitor() -{} +PFS_instance_wait_visitor::~PFS_instance_wait_visitor() = default; void PFS_instance_wait_visitor::visit_mutex_class(PFS_mutex_class *pfs) { @@ -1460,11 +1448,9 @@ void PFS_instance_wait_visitor::visit_socket(PFS_socket *pfs) /** Table IO wait visitor */ -PFS_object_wait_visitor::PFS_object_wait_visitor() -{} +PFS_object_wait_visitor::PFS_object_wait_visitor() = default; -PFS_object_wait_visitor::~PFS_object_wait_visitor() -{} +PFS_object_wait_visitor::~PFS_object_wait_visitor() = default; void PFS_object_wait_visitor::visit_global() { @@ -1488,11 +1474,9 @@ void PFS_object_wait_visitor::visit_table(PFS_table *pfs) } } -PFS_table_io_wait_visitor::PFS_table_io_wait_visitor() -{} +PFS_table_io_wait_visitor::PFS_table_io_wait_visitor() = default; -PFS_table_io_wait_visitor::~PFS_table_io_wait_visitor() -{} +PFS_table_io_wait_visitor::~PFS_table_io_wait_visitor() = default; void PFS_table_io_wait_visitor::visit_global() { @@ -1545,11 +1529,9 @@ void PFS_table_io_wait_visitor::visit_table(PFS_table *pfs) /** Table IO stat visitor */ -PFS_table_io_stat_visitor::PFS_table_io_stat_visitor() -{} +PFS_table_io_stat_visitor::PFS_table_io_stat_visitor() = default; -PFS_table_io_stat_visitor::~PFS_table_io_stat_visitor() -{} +PFS_table_io_stat_visitor::~PFS_table_io_stat_visitor() = default; void PFS_table_io_stat_visitor::visit_table_share(PFS_table_share *pfs) { @@ -1591,11 +1573,9 @@ void PFS_table_io_stat_visitor::visit_table(PFS_table *pfs) /** Index IO stat visitor */ -PFS_index_io_stat_visitor::PFS_index_io_stat_visitor() -{} +PFS_index_io_stat_visitor::PFS_index_io_stat_visitor() = default; -PFS_index_io_stat_visitor::~PFS_index_io_stat_visitor() -{} +PFS_index_io_stat_visitor::~PFS_index_io_stat_visitor() = default; void PFS_index_io_stat_visitor::visit_table_share_index(PFS_table_share *pfs, uint index) { @@ -1613,11 +1593,9 @@ void PFS_index_io_stat_visitor::visit_table_index(PFS_table *pfs, uint index) /** Table lock wait visitor */ -PFS_table_lock_wait_visitor::PFS_table_lock_wait_visitor() -{} +PFS_table_lock_wait_visitor::PFS_table_lock_wait_visitor() = default; -PFS_table_lock_wait_visitor::~PFS_table_lock_wait_visitor() -{} +PFS_table_lock_wait_visitor::~PFS_table_lock_wait_visitor() = default; void PFS_table_lock_wait_visitor::visit_global() { @@ -1636,11 +1614,9 @@ void PFS_table_lock_wait_visitor::visit_table(PFS_table *pfs) /** Table lock stat visitor */ -PFS_table_lock_stat_visitor::PFS_table_lock_stat_visitor() -{} +PFS_table_lock_stat_visitor::PFS_table_lock_stat_visitor() = default; -PFS_table_lock_stat_visitor::~PFS_table_lock_stat_visitor() -{} +PFS_table_lock_stat_visitor::~PFS_table_lock_stat_visitor() = default; void PFS_table_lock_stat_visitor::visit_table_share(PFS_table_share *pfs) { @@ -1656,11 +1632,11 @@ void PFS_table_lock_stat_visitor::visit_table(PFS_table *pfs) m_stat.aggregate(& pfs->m_table_stat.m_lock_stat); } -PFS_instance_socket_io_stat_visitor::PFS_instance_socket_io_stat_visitor() -{} +PFS_instance_socket_io_stat_visitor +::PFS_instance_socket_io_stat_visitor() = default; -PFS_instance_socket_io_stat_visitor::~PFS_instance_socket_io_stat_visitor() -{} +PFS_instance_socket_io_stat_visitor +::~PFS_instance_socket_io_stat_visitor() = default; void PFS_instance_socket_io_stat_visitor::visit_socket_class(PFS_socket_class *pfs) { @@ -1674,11 +1650,11 @@ void PFS_instance_socket_io_stat_visitor::visit_socket(PFS_socket *pfs) m_socket_io_stat.aggregate(&pfs->m_socket_stat.m_io_stat); } -PFS_instance_file_io_stat_visitor::PFS_instance_file_io_stat_visitor() -{} +PFS_instance_file_io_stat_visitor +::PFS_instance_file_io_stat_visitor() = default; -PFS_instance_file_io_stat_visitor::~PFS_instance_file_io_stat_visitor() -{} +PFS_instance_file_io_stat_visitor +::~PFS_instance_file_io_stat_visitor() = default; void PFS_instance_file_io_stat_visitor::visit_file_class(PFS_file_class *pfs) { diff --git a/storage/perfschema/pfs_visitor.h b/storage/perfschema/pfs_visitor.h index 4644888ea33..c5e5f826b7c 100644 --- a/storage/perfschema/pfs_visitor.h +++ b/storage/perfschema/pfs_visitor.h @@ -67,8 +67,8 @@ struct PFS_connection_slice; class PFS_connection_visitor { public: - PFS_connection_visitor() {} - virtual ~PFS_connection_visitor() {} + PFS_connection_visitor() = default; + virtual ~PFS_connection_visitor() = default; /** Visit all connections. */ virtual void visit_global() {} /** Visit all connections of a host. */ @@ -159,8 +159,8 @@ public: class PFS_instance_visitor { public: - PFS_instance_visitor() {} - virtual ~PFS_instance_visitor() {} + PFS_instance_visitor() = default; + virtual ~PFS_instance_visitor() = default; /** Visit a mutex class. */ virtual void visit_mutex_class(PFS_mutex_class *pfs) {} /** Visit a rwlock class. */ @@ -270,8 +270,8 @@ public: class PFS_object_visitor { public: - PFS_object_visitor() {} - virtual ~PFS_object_visitor() {} + PFS_object_visitor() = default; + virtual ~PFS_object_visitor() = default; /** Visit global data. */ virtual void visit_global() {} /** Visit a table share. */ diff --git a/storage/perfschema/table_accounts.h b/storage/perfschema/table_accounts.h index f44d05b2700..239f278051d 100644 --- a/storage/perfschema/table_accounts.h +++ b/storage/perfschema/table_accounts.h @@ -67,8 +67,7 @@ protected: table_accounts(); public: - ~table_accounts() - {} + ~table_accounts() = default; private: virtual void make_row(PFS_account *pfs); diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index 7dfb27c6032..6895b0b2c47 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -84,8 +84,7 @@ protected: table_all_instr(const PFS_engine_table_share *share); public: - ~table_all_instr() - {} + ~table_all_instr() = default; protected: /** diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.h b/storage/perfschema/table_esgs_by_account_by_event_name.h index dd805f4d038..98bf82e2b96 100644 --- a/storage/perfschema/table_esgs_by_account_by_event_name.h +++ b/storage/perfschema/table_esgs_by_account_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esgs_by_account_by_event_name(); public: - ~table_esgs_by_account_by_event_name() - {} + ~table_esgs_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.h b/storage/perfschema/table_esgs_by_host_by_event_name.h index 674b6bfb883..64349ecc7d9 100644 --- a/storage/perfschema/table_esgs_by_host_by_event_name.h +++ b/storage/perfschema/table_esgs_by_host_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esgs_by_host_by_event_name(); public: - ~table_esgs_by_host_by_event_name() - {} + ~table_esgs_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.h b/storage/perfschema/table_esgs_by_thread_by_event_name.h index d009aabbdfc..4f32d76e256 100644 --- a/storage/perfschema/table_esgs_by_thread_by_event_name.h +++ b/storage/perfschema/table_esgs_by_thread_by_event_name.h @@ -109,8 +109,7 @@ protected: table_esgs_by_thread_by_event_name(); public: - ~table_esgs_by_thread_by_event_name() - {} + ~table_esgs_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.h b/storage/perfschema/table_esgs_by_user_by_event_name.h index a62578ca9b6..3a211d19ad4 100644 --- a/storage/perfschema/table_esgs_by_user_by_event_name.h +++ b/storage/perfschema/table_esgs_by_user_by_event_name.h @@ -110,8 +110,7 @@ protected: table_esgs_by_user_by_event_name(); public: - ~table_esgs_by_user_by_event_name() - {} + ~table_esgs_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_global_by_event_name.h b/storage/perfschema/table_esgs_global_by_event_name.h index ab70e8303ca..013e04308eb 100644 --- a/storage/perfschema/table_esgs_global_by_event_name.h +++ b/storage/perfschema/table_esgs_global_by_event_name.h @@ -76,8 +76,7 @@ protected: table_esgs_global_by_event_name(); public: - ~table_esgs_global_by_event_name() - {} + ~table_esgs_global_by_event_name() = default; protected: void make_row(PFS_stage_class *klass); diff --git a/storage/perfschema/table_esms_by_account_by_event_name.h b/storage/perfschema/table_esms_by_account_by_event_name.h index 1afe7cb09df..3ea7620204b 100644 --- a/storage/perfschema/table_esms_by_account_by_event_name.h +++ b/storage/perfschema/table_esms_by_account_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_account_by_event_name(); public: - ~table_esms_by_account_by_event_name() - {} + ~table_esms_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_digest.h b/storage/perfschema/table_esms_by_digest.h index 27b916e66ac..d231d3388f8 100644 --- a/storage/perfschema/table_esms_by_digest.h +++ b/storage/perfschema/table_esms_by_digest.h @@ -78,8 +78,7 @@ protected: table_esms_by_digest(); public: - ~table_esms_by_digest() - {} + ~table_esms_by_digest() = default; protected: void make_row(PFS_statements_digest_stat*); diff --git a/storage/perfschema/table_esms_by_host_by_event_name.h b/storage/perfschema/table_esms_by_host_by_event_name.h index 2c47d4302b6..7c8c0e777e8 100644 --- a/storage/perfschema/table_esms_by_host_by_event_name.h +++ b/storage/perfschema/table_esms_by_host_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_host_by_event_name(); public: - ~table_esms_by_host_by_event_name() - {} + ~table_esms_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.h b/storage/perfschema/table_esms_by_thread_by_event_name.h index e4100c076f6..e4b1ba63eb8 100644 --- a/storage/perfschema/table_esms_by_thread_by_event_name.h +++ b/storage/perfschema/table_esms_by_thread_by_event_name.h @@ -109,8 +109,7 @@ protected: table_esms_by_thread_by_event_name(); public: - ~table_esms_by_thread_by_event_name() - {} + ~table_esms_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_user_by_event_name.h b/storage/perfschema/table_esms_by_user_by_event_name.h index 85399b18622..18516dfdb48 100644 --- a/storage/perfschema/table_esms_by_user_by_event_name.h +++ b/storage/perfschema/table_esms_by_user_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_user_by_event_name(); public: - ~table_esms_by_user_by_event_name() - {} + ~table_esms_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_global_by_event_name.h b/storage/perfschema/table_esms_global_by_event_name.h index 780c7fa6e4f..67dd631c71c 100644 --- a/storage/perfschema/table_esms_global_by_event_name.h +++ b/storage/perfschema/table_esms_global_by_event_name.h @@ -76,8 +76,7 @@ protected: table_esms_global_by_event_name(); public: - ~table_esms_global_by_event_name() - {} + ~table_esms_global_by_event_name() = default; protected: void make_row(PFS_statement_class *klass); diff --git a/storage/perfschema/table_events_stages.h b/storage/perfschema/table_events_stages.h index 2ef37c16a11..b4941db54eb 100644 --- a/storage/perfschema/table_events_stages.h +++ b/storage/perfschema/table_events_stages.h @@ -107,8 +107,7 @@ protected: table_events_stages_common(const PFS_engine_table_share *share, void *pos); - ~table_events_stages_common() - {} + ~table_events_stages_common() = default; void make_row(PFS_events_stages *stage); @@ -138,8 +137,7 @@ protected: table_events_stages_current(); public: - ~table_events_stages_current() - {} + ~table_events_stages_current() = default; private: friend class table_events_stages_history; @@ -174,8 +172,7 @@ protected: table_events_stages_history(); public: - ~table_events_stages_history() - {} + ~table_events_stages_history() = default; private: /** Table share lock. */ @@ -207,8 +204,7 @@ protected: table_events_stages_history_long(); public: - ~table_events_stages_history_long() - {} + ~table_events_stages_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h index a7fb6fd0ec7..ca8bc804b01 100644 --- a/storage/perfschema/table_events_statements.h +++ b/storage/perfschema/table_events_statements.h @@ -190,8 +190,7 @@ protected: table_events_statements_common(const PFS_engine_table_share *share, void *pos); - ~table_events_statements_common() - {} + ~table_events_statements_common() = default; void make_row_part_1(PFS_events_statements *statement, sql_digest_storage *digest); @@ -225,8 +224,7 @@ protected: table_events_statements_current(); public: - ~table_events_statements_current() - {} + ~table_events_statements_current() = default; private: friend class table_events_statements_history; @@ -263,8 +261,7 @@ protected: table_events_statements_history(); public: - ~table_events_statements_history() - {} + ~table_events_statements_history() = default; private: /** Table share lock. */ @@ -298,8 +295,7 @@ protected: table_events_statements_history_long(); public: - ~table_events_statements_history_long() - {} + ~table_events_statements_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 926d54fd970..dcd0ea6231b 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -146,8 +146,7 @@ protected: table_events_waits_common(const PFS_engine_table_share *share, void *pos); - ~table_events_waits_common() - {} + ~table_events_waits_common() = default; void clear_object_columns(); int make_table_object_columns(PFS_events_waits *wait); @@ -182,8 +181,7 @@ protected: table_events_waits_current(); public: - ~table_events_waits_current() - {} + ~table_events_waits_current() = default; private: friend class table_events_waits_history; @@ -219,8 +217,7 @@ protected: table_events_waits_history(); public: - ~table_events_waits_history() - {} + ~table_events_waits_history() = default; private: /** Table share lock. */ @@ -253,8 +250,7 @@ protected: table_events_waits_history_long(); public: - ~table_events_waits_history_long() - {} + ~table_events_waits_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index 0cc6f18be3c..a2b45c41fae 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -81,8 +81,7 @@ protected: table_events_waits_summary_by_instance(); public: - ~table_events_waits_summary_by_instance() - {} + ~table_events_waits_summary_by_instance() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_ews_by_account_by_event_name.h b/storage/perfschema/table_ews_by_account_by_event_name.h index 6ca0f2912bd..b50704e788b 100644 --- a/storage/perfschema/table_ews_by_account_by_event_name.h +++ b/storage/perfschema/table_ews_by_account_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_account_by_event_name(); public: - ~table_ews_by_account_by_event_name() - {} + ~table_ews_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_host_by_event_name.h b/storage/perfschema/table_ews_by_host_by_event_name.h index ac07e698f13..0a554385511 100644 --- a/storage/perfschema/table_ews_by_host_by_event_name.h +++ b/storage/perfschema/table_ews_by_host_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_host_by_event_name(); public: - ~table_ews_by_host_by_event_name() - {} + ~table_ews_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.h b/storage/perfschema/table_ews_by_thread_by_event_name.h index b811cd40962..9c526182bc8 100644 --- a/storage/perfschema/table_ews_by_thread_by_event_name.h +++ b/storage/perfschema/table_ews_by_thread_by_event_name.h @@ -115,8 +115,7 @@ protected: table_ews_by_thread_by_event_name(); public: - ~table_ews_by_thread_by_event_name() - {} + ~table_ews_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_user_by_event_name.h b/storage/perfschema/table_ews_by_user_by_event_name.h index 2dc34203d9e..3a61c8bcd54 100644 --- a/storage/perfschema/table_ews_by_user_by_event_name.h +++ b/storage/perfschema/table_ews_by_user_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_user_by_event_name(); public: - ~table_ews_by_user_by_event_name() - {} + ~table_ews_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_global_by_event_name.h b/storage/perfschema/table_ews_global_by_event_name.h index 811dfbb6812..46aad715c22 100644 --- a/storage/perfschema/table_ews_global_by_event_name.h +++ b/storage/perfschema/table_ews_global_by_event_name.h @@ -104,8 +104,7 @@ protected: table_ews_global_by_event_name(); public: - ~table_ews_global_by_event_name() - {} + ~table_ews_global_by_event_name() = default; protected: void make_mutex_row(PFS_mutex_class *klass); diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index adad5dadd06..6b8ffaeb591 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -74,8 +74,7 @@ private: table_file_instances(); public: - ~table_file_instances() - {} + ~table_file_instances() = default; private: void make_row(PFS_file *pfs); diff --git a/storage/perfschema/table_file_summary_by_event_name.h b/storage/perfschema/table_file_summary_by_event_name.h index 877adf9476a..0c2b592ab60 100644 --- a/storage/perfschema/table_file_summary_by_event_name.h +++ b/storage/perfschema/table_file_summary_by_event_name.h @@ -75,8 +75,7 @@ private: table_file_summary_by_event_name(); public: - ~table_file_summary_by_event_name() - {} + ~table_file_summary_by_event_name() = default; private: void make_row(PFS_file_class *klass); diff --git a/storage/perfschema/table_file_summary_by_instance.h b/storage/perfschema/table_file_summary_by_instance.h index 3b044fa064d..b8b2115aeed 100644 --- a/storage/perfschema/table_file_summary_by_instance.h +++ b/storage/perfschema/table_file_summary_by_instance.h @@ -83,8 +83,7 @@ private: table_file_summary_by_instance(); public: - ~table_file_summary_by_instance() - {} + ~table_file_summary_by_instance() = default; private: void make_row(PFS_file *pfs); diff --git a/storage/perfschema/table_host_cache.h b/storage/perfschema/table_host_cache.h index bb1cb444c33..482b8a2d66a 100644 --- a/storage/perfschema/table_host_cache.h +++ b/storage/perfschema/table_host_cache.h @@ -127,8 +127,7 @@ protected: table_host_cache(); public: - ~table_host_cache() - {} + ~table_host_cache() = default; private: void materialize(THD *thd); diff --git a/storage/perfschema/table_hosts.h b/storage/perfschema/table_hosts.h index 8262beabda5..cf94bdcbf79 100644 --- a/storage/perfschema/table_hosts.h +++ b/storage/perfschema/table_hosts.h @@ -67,8 +67,7 @@ protected: table_hosts(); public: - ~table_hosts() - {} + ~table_hosts() = default; private: virtual void make_row(PFS_host *pfs); diff --git a/storage/perfschema/table_os_global_by_type.h b/storage/perfschema/table_os_global_by_type.h index 8009d2125b3..632bed522ed 100644 --- a/storage/perfschema/table_os_global_by_type.h +++ b/storage/perfschema/table_os_global_by_type.h @@ -106,8 +106,7 @@ protected: table_os_global_by_type(); public: - ~table_os_global_by_type() - {} + ~table_os_global_by_type() = default; protected: void make_table_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index 5479c6f577d..15bdb5bfa93 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -73,8 +73,7 @@ protected: table_performance_timers(); public: - ~table_performance_timers() - {} + ~table_performance_timers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_session_account_connect_attrs.h b/storage/perfschema/table_session_account_connect_attrs.h index ea8d26b719b..d556394515c 100644 --- a/storage/perfschema/table_session_account_connect_attrs.h +++ b/storage/perfschema/table_session_account_connect_attrs.h @@ -43,8 +43,7 @@ protected: table_session_account_connect_attrs(); public: - ~table_session_account_connect_attrs() - {} + ~table_session_account_connect_attrs() = default; protected: virtual bool thread_fits(PFS_thread *thread); diff --git a/storage/perfschema/table_session_connect_attrs.h b/storage/perfschema/table_session_connect_attrs.h index c35f4b89f4e..f115ea1b168 100644 --- a/storage/perfschema/table_session_connect_attrs.h +++ b/storage/perfschema/table_session_connect_attrs.h @@ -43,8 +43,7 @@ protected: table_session_connect_attrs(); public: - ~table_session_connect_attrs() - {} + ~table_session_connect_attrs() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_setup_actors.h b/storage/perfschema/table_setup_actors.h index 758d3b22ef7..da5fdc37950 100644 --- a/storage/perfschema/table_setup_actors.h +++ b/storage/perfschema/table_setup_actors.h @@ -93,8 +93,7 @@ protected: table_setup_actors(); public: - ~table_setup_actors() - {} + ~table_setup_actors() = default; private: void make_row(PFS_setup_actor *actor); diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index 8c3479a88b1..c72108beb46 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -77,8 +77,7 @@ protected: table_setup_consumers(); public: - ~table_setup_consumers() - {} + ~table_setup_consumers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 4b6ad9b46dd..ce979c40e48 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -115,8 +115,7 @@ protected: table_setup_instruments(); public: - ~table_setup_instruments() - {} + ~table_setup_instruments() = default; private: void make_row(PFS_instr_class *klass, bool update_enabled, bool update_timed); diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h index 2d17e2e15ff..d6cb9bc30c3 100644 --- a/storage/perfschema/table_setup_objects.h +++ b/storage/perfschema/table_setup_objects.h @@ -92,8 +92,7 @@ protected: table_setup_objects(); public: - ~table_setup_objects() - {} + ~table_setup_objects() = default; private: void make_row(PFS_setup_object *pfs); diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 68bf9a55130..9fff43c33a3 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -73,8 +73,7 @@ protected: table_setup_timers(); public: - ~table_setup_timers() - {} + ~table_setup_timers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_socket_instances.h b/storage/perfschema/table_socket_instances.h index 763860d08c1..fdd978b5c3a 100644 --- a/storage/perfschema/table_socket_instances.h +++ b/storage/perfschema/table_socket_instances.h @@ -86,8 +86,7 @@ private: table_socket_instances(); public: - ~table_socket_instances() - {} + ~table_socket_instances() = default; private: void make_row(PFS_socket *pfs); diff --git a/storage/perfschema/table_socket_summary_by_event_name.h b/storage/perfschema/table_socket_summary_by_event_name.h index f386d62f8ee..3a243572979 100644 --- a/storage/perfschema/table_socket_summary_by_event_name.h +++ b/storage/perfschema/table_socket_summary_by_event_name.h @@ -76,8 +76,7 @@ private: table_socket_summary_by_event_name(); public: - ~table_socket_summary_by_event_name() - {} + ~table_socket_summary_by_event_name() = default; private: void make_row(PFS_socket_class *socket_class); diff --git a/storage/perfschema/table_socket_summary_by_instance.h b/storage/perfschema/table_socket_summary_by_instance.h index c7712871c51..b8a08db3e36 100644 --- a/storage/perfschema/table_socket_summary_by_instance.h +++ b/storage/perfschema/table_socket_summary_by_instance.h @@ -79,8 +79,7 @@ private: table_socket_summary_by_instance(); public: - ~table_socket_summary_by_instance() - {} + ~table_socket_summary_by_instance() = default; private: void make_row(PFS_socket *pfs); diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index ce756cef50c..2682c7c88a8 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -78,8 +78,7 @@ private: table_mutex_instances(); public: - ~table_mutex_instances() - {} + ~table_mutex_instances() = default; private: void make_row(PFS_mutex *pfs); @@ -137,8 +136,7 @@ private: table_rwlock_instances(); public: - ~table_rwlock_instances() - {} + ~table_rwlock_instances() = default; private: void make_row(PFS_rwlock *pfs); @@ -190,8 +188,7 @@ private: table_cond_instances(); public: - ~table_cond_instances() - {} + ~table_cond_instances() = default; private: void make_row(PFS_cond *pfs); diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h index 078dbbda5a9..ff9f7ccb2a3 100644 --- a/storage/perfschema/table_threads.h +++ b/storage/perfschema/table_threads.h @@ -110,8 +110,7 @@ protected: table_threads(); public: - ~table_threads() - {} + ~table_threads() = default; private: virtual void make_row(PFS_thread *pfs); diff --git a/storage/perfschema/table_tiws_by_index_usage.h b/storage/perfschema/table_tiws_by_index_usage.h index 64e08683b9b..5f0c85874bd 100644 --- a/storage/perfschema/table_tiws_by_index_usage.h +++ b/storage/perfschema/table_tiws_by_index_usage.h @@ -101,8 +101,7 @@ protected: table_tiws_by_index_usage(); public: - ~table_tiws_by_index_usage() - {} + ~table_tiws_by_index_usage() = default; protected: void make_row(PFS_table_share *table_share, uint index); diff --git a/storage/perfschema/table_tiws_by_table.h b/storage/perfschema/table_tiws_by_table.h index fed3b694fde..933a6164de9 100644 --- a/storage/perfschema/table_tiws_by_table.h +++ b/storage/perfschema/table_tiws_by_table.h @@ -76,8 +76,7 @@ protected: table_tiws_by_table(); public: - ~table_tiws_by_table() - {} + ~table_tiws_by_table() = default; protected: void make_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_tlws_by_table.h b/storage/perfschema/table_tlws_by_table.h index ba0668e5938..49188abd905 100644 --- a/storage/perfschema/table_tlws_by_table.h +++ b/storage/perfschema/table_tlws_by_table.h @@ -76,8 +76,7 @@ protected: table_tlws_by_table(); public: - ~table_tlws_by_table() - {} + ~table_tlws_by_table() = default; protected: void make_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_users.h b/storage/perfschema/table_users.h index 2adc77569d9..a81c143ae2e 100644 --- a/storage/perfschema/table_users.h +++ b/storage/perfschema/table_users.h @@ -67,8 +67,7 @@ protected: table_users(); public: - ~table_users() - {} + ~table_users() = default; private: virtual void make_row(PFS_user *pfs); diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index 29b2d83a759..096185af08f 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -129,10 +129,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64") ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC) endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64") -if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set(SYSTEM_LIBS ${SYSTEM_LIBS} -latomic) -endif() - option(WITH_FALLOCATE "build with fallocate" ON) if(WITH_FALLOCATE AND UNIX) @@ -161,9 +157,9 @@ include_directories(SYSTEM ${ROCKSDB_SOURCE_DIR}/third-party/gtest-1.7.0/fused-s find_package(Threads REQUIRED) if(WIN32) - set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib) + set(SYSTEM_LIBS ${SYSTEM_LIBS} ${ATOMIC_EXTRA_LIBS} Shlwapi.lib Rpcrt4.lib) else() - set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${CMAKE_DL_LIBS}) + set(SYSTEM_LIBS ${SYSTEM_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${CMAKE_DL_LIBS} ${ATOMIC_EXTRA_LIBS}) endif() set(ROCKSDB_LIBS rocksdblib}) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 7c1af7217ca..86300f1cf71 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -2270,7 +2270,7 @@ static inline uint32_t rocksdb_perf_context_level(THD *const thd) { */ interface Rdb_tx_list_walker { - virtual ~Rdb_tx_list_walker() {} + virtual ~Rdb_tx_list_walker() = default; virtual void process_tran(const Rdb_transaction *const) = 0; }; diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index f05f373cbfd..d03c183873e 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -1053,7 +1053,7 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx { m_n_dropped_keys(n_dropped_keys), m_max_auto_incr(max_auto_incr) {} - ~Rdb_inplace_alter_ctx() {} + ~Rdb_inplace_alter_ctx() = default; private: /* Disable Copying */ diff --git a/storage/rocksdb/rdb_compact_filter.h b/storage/rocksdb/rdb_compact_filter.h index 1cd27273b56..93767b23787 100644 --- a/storage/rocksdb/rdb_compact_filter.h +++ b/storage/rocksdb/rdb_compact_filter.h @@ -204,9 +204,9 @@ class Rdb_compact_filter_factory : public rocksdb::CompactionFilterFactory { Rdb_compact_filter_factory(const Rdb_compact_filter_factory &) = delete; Rdb_compact_filter_factory &operator=(const Rdb_compact_filter_factory &) = delete; - Rdb_compact_filter_factory() {} + Rdb_compact_filter_factory() = default; - ~Rdb_compact_filter_factory() {} + ~Rdb_compact_filter_factory() = default; const char *Name() const override { return "Rdb_compact_filter_factory"; } diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h index 899c6f70071..e9fc1da728e 100644 --- a/storage/rocksdb/rdb_datadic.h +++ b/storage/rocksdb/rdb_datadic.h @@ -1177,7 +1177,7 @@ class Rdb_seq_generator { interface Rdb_tables_scanner { virtual int add_table(Rdb_tbl_def * tdef) = 0; - virtual ~Rdb_tables_scanner() {} /* Keep the compiler happy */ + virtual ~Rdb_tables_scanner() = default; /* Keep the compiler happy */ }; /* @@ -1214,7 +1214,7 @@ class Rdb_ddl_manager { public: Rdb_ddl_manager(const Rdb_ddl_manager &) = delete; Rdb_ddl_manager &operator=(const Rdb_ddl_manager &) = delete; - Rdb_ddl_manager() {} + Rdb_ddl_manager() = default; /* Load the data dictionary from on-disk storage */ bool init(Rdb_dict_manager *const dict_arg, Rdb_cf_manager *const cf_manager, diff --git a/storage/rocksdb/rdb_mutex_wrapper.h b/storage/rocksdb/rdb_mutex_wrapper.h index 33eefe9d50c..fd0790aa8e6 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.h +++ b/storage/rocksdb/rdb_mutex_wrapper.h @@ -122,7 +122,7 @@ class Rdb_mutex_factory : public rocksdb::TransactionDBMutexFactory { public: Rdb_mutex_factory(const Rdb_mutex_factory &) = delete; Rdb_mutex_factory &operator=(const Rdb_mutex_factory &) = delete; - Rdb_mutex_factory() {} + Rdb_mutex_factory() = default; /* Override parent class's virtual methods of interrest. */ @@ -137,7 +137,7 @@ class Rdb_mutex_factory : public rocksdb::TransactionDBMutexFactory { return std::make_shared<Rdb_cond_var>(); } - virtual ~Rdb_mutex_factory() override {} + virtual ~Rdb_mutex_factory() override = default; }; } // namespace myrocks diff --git a/storage/rocksdb/rdb_threads.h b/storage/rocksdb/rdb_threads.h index 7d89fe0616b..d23419df3b9 100644 --- a/storage/rocksdb/rdb_threads.h +++ b/storage/rocksdb/rdb_threads.h @@ -125,7 +125,7 @@ class Rdb_thread { void uninit(); - virtual ~Rdb_thread() {} + virtual ~Rdb_thread() = default; private: static void *thread_func(void *const thread_ptr); diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc index 38e1eea8c40..6f66e122ed9 100644 --- a/storage/sequence/sequence.cc +++ b/storage/sequence/sequence.cc @@ -390,7 +390,7 @@ public: // Reset limit because we are handling it now orig_lim->set_unlimited(); } - ~ha_seq_group_by_handler() {} + ~ha_seq_group_by_handler() = default; int init_scan() { first_row= 1 ; return 0; } int next_row(); int end_scan() { return 0; } diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result new file mode 100644 index 00000000000..b2edaff6918 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result @@ -0,0 +1,20 @@ +# +# MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds +# +INSTALL PLUGIN spider SONAME 'ha_spider.so'; +DROP FUNCTION spider_flush_table_mon_cache; +DROP FUNCTION spider_copy_tables; +DROP FUNCTION spider_ping_table; +DROP FUNCTION spider_bg_direct_sql; +DROP FUNCTION spider_direct_sql; +UNINSTALL PLUGIN spider_alloc_mem; +UNINSTALL PLUGIN spider; +DROP TABLE IF EXISTS mysql.spider_xa; +DROP TABLE IF EXISTS mysql.spider_xa_member; +DROP TABLE IF EXISTS mysql.spider_xa_failed_log; +DROP TABLE IF EXISTS mysql.spider_tables; +DROP TABLE IF EXISTS mysql.spider_link_mon_servers; +DROP TABLE IF EXISTS mysql.spider_link_failed_log; +DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; +DROP TABLE IF EXISTS mysql.spider_table_sts; +DROP TABLE IF EXISTS mysql.spider_table_crd; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result new file mode 100644 index 00000000000..df0f6949280 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result @@ -0,0 +1,3 @@ +# +# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +# diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test new file mode 100644 index 00000000000..ffd99390748 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test @@ -0,0 +1,40 @@ +--echo # +--echo # MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds +--echo # + +if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="UBSAN"`) +{ +--skip test needs to be run with UBSAN +} + +# init spider + +INSTALL PLUGIN spider SONAME 'ha_spider.so'; + +let $PLUGIN_NAME= spider_flush_table_mon_cache; +let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; +while (!$PLUGIN_EXIST) +{ + let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; +} + +# deinit spider + +DROP FUNCTION spider_flush_table_mon_cache; +DROP FUNCTION spider_copy_tables; +DROP FUNCTION spider_ping_table; +DROP FUNCTION spider_bg_direct_sql; +DROP FUNCTION spider_direct_sql; +UNINSTALL PLUGIN spider_alloc_mem; +UNINSTALL PLUGIN spider; +DROP TABLE IF EXISTS mysql.spider_xa; +DROP TABLE IF EXISTS mysql.spider_xa_member; +DROP TABLE IF EXISTS mysql.spider_xa_failed_log; +DROP TABLE IF EXISTS mysql.spider_tables; +DROP TABLE IF EXISTS mysql.spider_link_mon_servers; +DROP TABLE IF EXISTS mysql.spider_link_failed_log; +DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; +DROP TABLE IF EXISTS mysql.spider_table_sts; +DROP TABLE IF EXISTS mysql.spider_table_crd; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test new file mode 100644 index 00000000000..788ea2323f7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test @@ -0,0 +1,5 @@ +--echo # +--echo # MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +--echo # + +--exec $MYSQLD_BOOTSTRAP_CMD --wsrep-recover --plugin-load-add=ha_spider.so diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 4941c2890f5..ca556702c65 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -458,18 +458,25 @@ SPIDER_CONN *spider_create_conn( conn->tgt_host = tmp_host; memcpy(conn->tgt_host, share->tgt_hosts[link_idx], share->tgt_hosts_lengths[link_idx]); + conn->tgt_username_length = share->tgt_usernames_lengths[link_idx]; conn->tgt_username = tmp_username; - memcpy(conn->tgt_username, share->tgt_usernames[link_idx], - share->tgt_usernames_lengths[link_idx]); + if (conn->tgt_username_length) + memcpy(conn->tgt_username, share->tgt_usernames[link_idx], + share->tgt_usernames_lengths[link_idx]); + conn->tgt_password_length = share->tgt_passwords_lengths[link_idx]; conn->tgt_password = tmp_password; - memcpy(conn->tgt_password, share->tgt_passwords[link_idx], - share->tgt_passwords_lengths[link_idx]); + if (conn->tgt_password_length) + memcpy(conn->tgt_password, share->tgt_passwords[link_idx], + share->tgt_passwords_lengths[link_idx]); + conn->tgt_socket_length = share->tgt_sockets_lengths[link_idx]; conn->tgt_socket = tmp_socket; - memcpy(conn->tgt_socket, share->tgt_sockets[link_idx], - share->tgt_sockets_lengths[link_idx]); + if (conn->tgt_socket_length) + memcpy(conn->tgt_socket, share->tgt_sockets[link_idx], + share->tgt_sockets_lengths[link_idx]); + conn->tgt_wrapper_length = share->tgt_wrappers_lengths[link_idx]; conn->tgt_wrapper = tmp_wrapper; memcpy(conn->tgt_wrapper, share->tgt_wrappers[link_idx], diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 8f8cf6c97bc..8b2ebb821df 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -684,8 +684,8 @@ class spider_db_util { public: uint dbton_id; - spider_db_util() {} - virtual ~spider_db_util() {} + spider_db_util() = default; + virtual ~spider_db_util() = default; virtual int append_name( spider_string *str, const char *name, @@ -828,7 +828,7 @@ public: uint dbton_id; SPIDER_DB_ROW *next_pos; spider_db_row(uint in_dbton_id) : dbton_id(in_dbton_id), next_pos(NULL) {} - virtual ~spider_db_row() {} + virtual ~spider_db_row() = default; virtual int store_to_field( Field *field, CHARSET_INFO *access_charset @@ -860,8 +860,8 @@ public: class spider_db_result_buffer { public: - spider_db_result_buffer() {} - virtual ~spider_db_result_buffer() {} + spider_db_result_buffer() = default; + virtual ~spider_db_result_buffer() = default; virtual void clear() = 0; virtual bool check_size( longlong size @@ -874,7 +874,7 @@ public: SPIDER_DB_CONN *db_conn; uint dbton_id; spider_db_result(SPIDER_DB_CONN *in_db_conn); - virtual ~spider_db_result() {} + virtual ~spider_db_result() = default; virtual void set_limit(longlong value) {} virtual bool has_result() = 0; virtual void free_result() = 0; @@ -937,7 +937,7 @@ public: spider_db_conn( SPIDER_CONN *in_conn ); - virtual ~spider_db_conn() {} + virtual ~spider_db_conn() = default; virtual int init() = 0; virtual void set_limit(longlong value) {} virtual bool is_connected() = 0; @@ -1114,7 +1114,7 @@ public: st_spider_share *share, uint dbton_id ) : dbton_id(dbton_id), spider_share(share) {} - virtual ~spider_db_share() {} + virtual ~spider_db_share() = default; virtual int init() = 0; virtual uint get_column_name_length( uint field_index @@ -1156,7 +1156,7 @@ public: spider_db_handler(ha_spider *spider, spider_db_share *db_share) : dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), first_link_idx(-1) {} - virtual ~spider_db_handler() {} + virtual ~spider_db_handler() = default; virtual int init() = 0; virtual int append_index_hint( spider_string *str, @@ -1598,7 +1598,7 @@ public: spider_db_share *db_share; spider_db_copy_table(spider_db_share *db_share) : dbton_id(db_share->dbton_id), db_share(db_share) {} - virtual ~spider_db_copy_table() {} + virtual ~spider_db_copy_table() = default; virtual int init() = 0; virtual void set_sql_charset( CHARSET_INFO *cs diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 5bafc4e04ed..13afb5077d3 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -8945,6 +8945,7 @@ void spider_free_sts_threads( ) { bool thread_killed; DBUG_ENTER("spider_free_sts_threads"); + spider_thread->init_command = FALSE; pthread_mutex_lock(&spider_thread->mutex); thread_killed = spider_thread->killed; spider_thread->killed = TRUE; @@ -9082,12 +9083,13 @@ void *spider_table_bg_sts_action( tmp_disable_binlog(thd); thd->security_ctx->skip_grants(); thd->client_capabilities |= CLIENT_MULTI_RESULTS; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed) { pthread_mutex_lock(spd_LOCK_server_started); thd->mysys_var->current_cond = spd_COND_server_started; thd->mysys_var->current_mutex = spd_LOCK_server_started; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command) { do { @@ -9097,14 +9099,16 @@ void *spider_table_bg_sts_action( spd_LOCK_server_started, &abstime); } while ( (error_num == ETIMEDOUT || error_num == ETIME) && - !(*spd_mysqld_server_started) && !thd->killed && !thread->killed + !(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command ); } pthread_mutex_unlock(spd_LOCK_server_started); thd->mysys_var->current_cond = &thread->cond; thd->mysys_var->current_mutex = &thread->mutex; } - while (spider_init_queries[i].length && !thd->killed && !thread->killed) + while (spider_init_queries[i].length && !thd->killed && !thread->killed && + thread->init_command) { dispatch_command(COM_QUERY, thd, spider_init_queries[i].str, (uint) spider_init_queries[i].length); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 85b2cdb8a27..8e1257bad21 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -625,103 +625,136 @@ int spider_create_trx_alter_table( alter_table->tmp_tgt_drivers_lengths = tmp_tgt_drivers_lengths; alter_table->tmp_static_link_ids_lengths = tmp_static_link_ids_lengths; + size_t len; for(roop_count = 0; roop_count < (int) share->all_link_count; roop_count++) { - tmp_server_names[roop_count] = tmp_server_names_char; - memcpy(tmp_server_names_char, - share_alter->tmp_server_names[roop_count], - sizeof(char) * share_alter->tmp_server_names_lengths[roop_count]); - tmp_server_names_char += - share_alter->tmp_server_names_lengths[roop_count] + 1; - - tmp_tgt_table_names[roop_count] = tmp_tgt_table_names_char; - memcpy(tmp_tgt_table_names_char, - share_alter->tmp_tgt_table_names[roop_count], - sizeof(char) * share_alter->tmp_tgt_table_names_lengths[roop_count]); - tmp_tgt_table_names_char += - share_alter->tmp_tgt_table_names_lengths[roop_count] + 1; - - tmp_tgt_dbs[roop_count] = tmp_tgt_dbs_char; - memcpy(tmp_tgt_dbs_char, share_alter->tmp_tgt_dbs[roop_count], - sizeof(char) * share_alter->tmp_tgt_dbs_lengths[roop_count]); - tmp_tgt_dbs_char += - share_alter->tmp_tgt_dbs_lengths[roop_count] + 1; - - tmp_tgt_hosts[roop_count] = tmp_tgt_hosts_char; - memcpy(tmp_tgt_hosts_char, share_alter->tmp_tgt_hosts[roop_count], - sizeof(char) * share_alter->tmp_tgt_hosts_lengths[roop_count]); - tmp_tgt_hosts_char += - share_alter->tmp_tgt_hosts_lengths[roop_count] + 1; - - tmp_tgt_usernames[roop_count] = tmp_tgt_usernames_char; - memcpy(tmp_tgt_usernames_char, share_alter->tmp_tgt_usernames[roop_count], - sizeof(char) * share_alter->tmp_tgt_usernames_lengths[roop_count]); - tmp_tgt_usernames_char += - share_alter->tmp_tgt_usernames_lengths[roop_count] + 1; - - tmp_tgt_passwords[roop_count] = tmp_tgt_passwords_char; - memcpy(tmp_tgt_passwords_char, share_alter->tmp_tgt_passwords[roop_count], - sizeof(char) * share_alter->tmp_tgt_passwords_lengths[roop_count]); - tmp_tgt_passwords_char += - share_alter->tmp_tgt_passwords_lengths[roop_count] + 1; - - tmp_tgt_sockets[roop_count] = tmp_tgt_sockets_char; - memcpy(tmp_tgt_sockets_char, share_alter->tmp_tgt_sockets[roop_count], - sizeof(char) * share_alter->tmp_tgt_sockets_lengths[roop_count]); - tmp_tgt_sockets_char += - share_alter->tmp_tgt_sockets_lengths[roop_count] + 1; - - tmp_tgt_wrappers[roop_count] = tmp_tgt_wrappers_char; - memcpy(tmp_tgt_wrappers_char, share_alter->tmp_tgt_wrappers[roop_count], - sizeof(char) * share_alter->tmp_tgt_wrappers_lengths[roop_count]); - tmp_tgt_wrappers_char += - share_alter->tmp_tgt_wrappers_lengths[roop_count] + 1; - - tmp_tgt_ssl_cas[roop_count] = tmp_tgt_ssl_cas_char; - memcpy(tmp_tgt_ssl_cas_char, share_alter->tmp_tgt_ssl_cas[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_cas_lengths[roop_count]); - tmp_tgt_ssl_cas_char += - share_alter->tmp_tgt_ssl_cas_lengths[roop_count] + 1; - - tmp_tgt_ssl_capaths[roop_count] = tmp_tgt_ssl_capaths_char; - memcpy(tmp_tgt_ssl_capaths_char, - share_alter->tmp_tgt_ssl_capaths[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_capaths_lengths[roop_count]); - tmp_tgt_ssl_capaths_char += - share_alter->tmp_tgt_ssl_capaths_lengths[roop_count] + 1; - - tmp_tgt_ssl_certs[roop_count] = tmp_tgt_ssl_certs_char; - memcpy(tmp_tgt_ssl_certs_char, share_alter->tmp_tgt_ssl_certs[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_certs_lengths[roop_count]); - tmp_tgt_ssl_certs_char += - share_alter->tmp_tgt_ssl_certs_lengths[roop_count] + 1; - - tmp_tgt_ssl_ciphers[roop_count] = tmp_tgt_ssl_ciphers_char; - memcpy(tmp_tgt_ssl_ciphers_char, - share_alter->tmp_tgt_ssl_ciphers[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count]); - tmp_tgt_ssl_ciphers_char += - share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count] + 1; - - tmp_tgt_ssl_keys[roop_count] = tmp_tgt_ssl_keys_char; - memcpy(tmp_tgt_ssl_keys_char, share_alter->tmp_tgt_ssl_keys[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_keys_lengths[roop_count]); - tmp_tgt_ssl_keys_char += - share_alter->tmp_tgt_ssl_keys_lengths[roop_count] + 1; - - tmp_tgt_default_files[roop_count] = tmp_tgt_default_files_char; - memcpy(tmp_tgt_default_files_char, - share_alter->tmp_tgt_default_files[roop_count], - sizeof(char) * share_alter->tmp_tgt_default_files_lengths[roop_count]); - tmp_tgt_default_files_char += - share_alter->tmp_tgt_default_files_lengths[roop_count] + 1; - - tmp_tgt_default_groups[roop_count] = tmp_tgt_default_groups_char; - memcpy(tmp_tgt_default_groups_char, - share_alter->tmp_tgt_default_groups[roop_count], - sizeof(char) * share_alter->tmp_tgt_default_groups_lengths[roop_count]); - tmp_tgt_default_groups_char += - share_alter->tmp_tgt_default_groups_lengths[roop_count] + 1; + if ((len= + sizeof(char) * share_alter->tmp_server_names_lengths[roop_count])) + { + tmp_server_names[roop_count]= tmp_server_names_char; + memcpy(tmp_server_names_char, share_alter->tmp_server_names[roop_count], + len); + tmp_server_names_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_table_names_lengths[roop_count])) + { + tmp_tgt_table_names[roop_count]= tmp_tgt_table_names_char; + memcpy(tmp_tgt_table_names_char, + share_alter->tmp_tgt_table_names[roop_count], len); + tmp_tgt_table_names_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_dbs_lengths[roop_count])) + { + tmp_tgt_dbs[roop_count]= tmp_tgt_dbs_char; + memcpy(tmp_tgt_dbs_char, share_alter->tmp_tgt_dbs[roop_count], len); + tmp_tgt_dbs_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_hosts_lengths[roop_count])) + { + tmp_tgt_hosts[roop_count]= tmp_tgt_hosts_char; + memcpy(tmp_tgt_hosts_char, share_alter->tmp_tgt_hosts[roop_count], len); + tmp_tgt_hosts_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_usernames_lengths[roop_count])) + { + tmp_tgt_usernames[roop_count]= tmp_tgt_usernames_char; + memcpy(tmp_tgt_usernames_char, + share_alter->tmp_tgt_usernames[roop_count], len); + tmp_tgt_usernames_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_passwords_lengths[roop_count])) + { + tmp_tgt_passwords[roop_count]= tmp_tgt_passwords_char; + memcpy(tmp_tgt_passwords_char, + share_alter->tmp_tgt_passwords[roop_count], len); + tmp_tgt_passwords_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_sockets_lengths[roop_count])) + { + tmp_tgt_sockets[roop_count]= tmp_tgt_sockets_char; + memcpy(tmp_tgt_sockets_char, share_alter->tmp_tgt_sockets[roop_count], + len); + tmp_tgt_sockets_char+= len + 1; + } + + if ((len= + sizeof(char) * share_alter->tmp_tgt_wrappers_lengths[roop_count])) + { + tmp_tgt_wrappers[roop_count]= tmp_tgt_wrappers_char; + memcpy(tmp_tgt_wrappers_char, share_alter->tmp_tgt_wrappers[roop_count], + len); + tmp_tgt_wrappers_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_ssl_cas_lengths[roop_count])) + { + tmp_tgt_ssl_cas[roop_count]= tmp_tgt_ssl_cas_char; + memcpy(tmp_tgt_ssl_cas_char, share_alter->tmp_tgt_ssl_cas[roop_count], + len); + tmp_tgt_ssl_cas_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_capaths_lengths[roop_count])) + { + tmp_tgt_ssl_capaths[roop_count]= tmp_tgt_ssl_capaths_char; + memcpy(tmp_tgt_ssl_capaths_char, + share_alter->tmp_tgt_ssl_capaths[roop_count], len); + tmp_tgt_ssl_capaths_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_certs_lengths[roop_count])) + { + tmp_tgt_ssl_certs[roop_count]= tmp_tgt_ssl_certs_char; + memcpy(tmp_tgt_ssl_certs_char, + share_alter->tmp_tgt_ssl_certs[roop_count], len); + tmp_tgt_ssl_certs_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count])) + { + tmp_tgt_ssl_ciphers[roop_count]= tmp_tgt_ssl_ciphers_char; + memcpy(tmp_tgt_ssl_ciphers_char, + share_alter->tmp_tgt_ssl_ciphers[roop_count], len); + tmp_tgt_ssl_ciphers_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_ssl_keys_lengths[roop_count])) + { + tmp_tgt_ssl_keys[roop_count]= tmp_tgt_ssl_keys_char; + memcpy(tmp_tgt_ssl_keys_char, share_alter->tmp_tgt_ssl_keys[roop_count], + len); + tmp_tgt_ssl_keys_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_default_files_lengths[roop_count])) + { + tmp_tgt_default_files[roop_count]= tmp_tgt_default_files_char; + memcpy(tmp_tgt_default_files_char, + share_alter->tmp_tgt_default_files[roop_count], len); + tmp_tgt_default_files_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_default_groups_lengths[roop_count])) + { + tmp_tgt_default_groups[roop_count]= tmp_tgt_default_groups_char; + memcpy(tmp_tgt_default_groups_char, + share_alter->tmp_tgt_default_groups[roop_count], len); + tmp_tgt_default_groups_char+= len + 1; + } tmp_tgt_dsns[roop_count] = tmp_tgt_dsns_char; memcpy(tmp_tgt_dsns_char, share_alter->tmp_tgt_dsns[roop_count], @@ -741,14 +774,13 @@ int spider_create_trx_alter_table( tmp_tgt_drivers_char += share_alter->tmp_tgt_drivers_lengths[roop_count] + 1; - if (share_alter->tmp_static_link_ids[roop_count]) + if ((len= sizeof(char) * + share_alter->tmp_static_link_ids_lengths[roop_count])) { tmp_static_link_ids[roop_count] = tmp_static_link_ids_char; memcpy(tmp_static_link_ids_char, - share_alter->tmp_static_link_ids[roop_count], - sizeof(char) * share_alter->tmp_static_link_ids_lengths[roop_count]); - tmp_static_link_ids_char += - share_alter->tmp_static_link_ids_lengths[roop_count] + 1; + share_alter->tmp_static_link_ids[roop_count], len); + tmp_static_link_ids_char += len + 1; } } diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 5cedd8b0a63..e93f708abbc 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -34763,6 +34763,11 @@ create_tailoring(struct charset_info_st *cs, { src_uca= &my_uca_v520; cs->caseinfo= &my_unicase_unicode520; + if (cs->mbminlen == 1 && cs->mbmaxlen >=3) + { + cs->caseup_multiply= 2; + cs->casedn_multiply= 2; + } } else if (rules.version == 1400) /* Unicode-14.0.0 */ { @@ -36611,8 +36616,8 @@ struct charset_info_st my_charset_utf8mb3_myanmar_uca_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 9, /* min_sort_char */ @@ -36644,8 +36649,8 @@ struct charset_info_st my_charset_utf8mb3_unicode_520_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 9, /* min_sort_char */ @@ -36676,8 +36681,8 @@ struct charset_info_st my_charset_utf8mb3_thai_520_w2= NULL, /* state_map */ NULL, /* ident_map */ 4, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 9, /* min_sort_char */ @@ -36774,8 +36779,8 @@ struct charset_info_st my_charset_utf8mb3_unicode_520_nopad_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 3, /* mbmaxlen */ 9, /* min_sort_char */ @@ -37589,8 +37594,8 @@ struct charset_info_st my_charset_utf8mb4_myanmar_uca_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 4, /* mbmaxlen */ 9, /* min_sort_char */ @@ -37621,8 +37626,8 @@ struct charset_info_st my_charset_utf8mb4_thai_520_w2= NULL, /* state_map */ NULL, /* ident_map */ 4, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 4, /* mbmaxlen */ 9, /* min_sort_char */ @@ -37653,8 +37658,8 @@ struct charset_info_st my_charset_utf8mb4_unicode_520_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 4, /* mbmaxlen */ 9, /* min_sort_char */ @@ -37752,8 +37757,8 @@ struct charset_info_st my_charset_utf8mb4_unicode_520_nopad_ci= NULL, /* state_map */ NULL, /* ident_map */ 8, /* strxfrm_multiply */ - 1, /* caseup_multiply */ - 1, /* casedn_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ 1, /* mbminlen */ 4, /* mbmaxlen */ 9, /* min_sort_char */ diff --git a/strings/json_lib.c b/strings/json_lib.c index 4cb877baee1..903dec978b4 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -844,7 +844,7 @@ static int skip_key(json_engine_t *j) { int t_next, c_len; - if (j->s.c_next< 128 && json_instr_chr_map[j->s.c_next] == S_BKSL && + if (j->s.c_next<128 && json_instr_chr_map[j->s.c_next] == S_BKSL && json_handle_esc(&j->s)) return 1; diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc index 6eff6c313a3..447c2335c74 100644 --- a/tpool/aio_liburing.cc +++ b/tpool/aio_liburing.cc @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #include <vector> #include <thread> #include <mutex> +#include <stdexcept> namespace { diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 5d01c588a88..507c6b9264f 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ # include <thread> # include <atomic> +# include <cstdio> # include <libaio.h> # include <sys/syscall.h> diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index b406e918b8f..45a407371ba 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_11.3_32_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_12.3_32_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in index 58d95210783..831efb6971f 100644 --- a/win/packaging/heidisql.wxi.in +++ b/win/packaging/heidisql.wxi.in @@ -34,7 +34,6 @@ <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/> </Component> - <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no"> <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" /> </Component> @@ -63,6 +62,29 @@ <File Id="heidisql.sqlite3.dll" Name="sqlite3.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\sqlite3.dll" /> </Component> + <Component Id="component.HeidiSQL_fbclient_4.0.dll" Guid="*" Win64="no"> + <File Id="fbclient4.0.dll" Name="fbclient-4.0.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\fbclient-4.0.dll" /> + </Component> + <Component Id="component.HeidiSQL_gds32_14.1.dll" Guid="*" Win64="no"> + <File Id="gds32_14.1.dll" Name="gds32-14.1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\gds32-14.1.dll" /> + </Component> + <Component Id="component.HeidiSQL_plink.exe" Guid="*" Win64="no"> + <File Id="plink.exe" Name="plink.exe" Source="${HEIDISQL_DOWNLOAD_DIR}\plink.exe" /> + </Component> + + <Component Id="component.HeidiSQL_LICENSE_openssl" Guid="*" Win64="no"> + <File Id="LICENSE_openssl" Name="LICENSE-openssl" Source="${HEIDISQL_DOWNLOAD_DIR}\LICENSE-openssl" /> + </Component> + + <?define functions_dblist=interbase;mariadb;mssql;mysql;postgresql;redshift;sqlite?> + + <?foreach db in $(var.functions_dblist) ?> + <Component Id="component.HeidiSQL_functions_$(var.db).ini" Guid="*" Win64="no"> + <File Id="functions_$(var.db).ini" Name="functions-$(var.db).ini" + Source="${HEIDISQL_DOWNLOAD_DIR}\functions-$(var.db).ini" /> + </Component> + <?endforeach?> + <Directory Id="D.HeidiSQL.plugins" Name="plugins"> <?foreach dll in $(var.pluginlist) ?> <Component Id="component.HeidiSQL_$(var.dll)" Guid="*" Win64="no"> @@ -91,6 +113,13 @@ <ComponentRef Id="component.HeidiSQL_libiconv_2.dll" /> <ComponentRef Id="component.HeidiSQL_sqlite3.dll" /> <ComponentRef Id="component.HeidiSQL_libmysql_6.1.dll" /> + <ComponentRef Id="component.HeidiSQL_fbclient_4.0.dll" /> + <ComponentRef Id="component.HeidiSQL_gds32_14.1.dll" /> + <ComponentRef Id="component.HeidiSQL_plink.exe" /> + <ComponentRef Id="component.HeidiSQL_LICENSE_openssl" /> + <?foreach db in $(var.functions_dblist) ?> + <ComponentRef Id="component.HeidiSQL_functions_$(var.db).ini" /> + <?endforeach?> <?foreach dll in $(var.pluginlist)?> <ComponentRef Id="component.HeidiSQL_$(var.dll)" /> <?endforeach?> diff --git a/wsrep-lib b/wsrep-lib -Subproject de3d7b63eab188a54ce5d2f635a610991bf563b +Subproject 275a0af8c5b92f0ee33cfe9e23f3db5f59b56e9 |