diff --git a/CMakeLists.txt b/CMakeLists.txt index 67c9e0c173b..593b5a0c4a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0056 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() @@ -241,7 +241,7 @@ ENDIF() OPTION(WITH_MSAN "Enable memory sanitizer" OFF) IF (WITH_MSAN) - MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE") IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE)) MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags") @@ -251,7 +251,7 @@ IF (WITH_MSAN) MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++") ENDIF() SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory") IF(NOT HAVE_LINK_FLAG__fsanitize_memory) MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") ENDIF() @@ -635,7 +635,7 @@ IF(NOT WITHOUT_SERVER) perror replace) IF(WIN32) - ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill) + ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill mariadb-upgrade-service) ENDIF() ADD_CUSTOM_TARGET(smoketest COMMAND perl ./mysql-test-run.pl main.1st diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index e4d7a5347af..02c126ce0b7 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -862,8 +862,7 @@ static int upgrade_already_done(int silent) s= strchr(version, '.'); s= strchr(s + 1, '.'); - if (strncmp(upgrade_from_version, version, - (size_t)(s - version + 1))) + if (strncmp(upgrade_from_version, version, (size_t)(s - version + 1))) { if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID) { @@ -877,9 +876,14 @@ static int upgrade_already_done(int silent) } if (!silent) { - verbose("This installation of MariaDB is already upgraded to %s.\n" - "There is no need to run mariadb-upgrade again for %s.", - upgrade_from_version, version); + if (strcmp(upgrade_from_version, version)) + verbose("This installation of MariaDB is already upgraded to %s.\n" + "There is no need to run mariadb-upgrade again for %s, because " + "they're both %.*s.", + upgrade_from_version, version, (int)(s - version), version); + else + verbose("This installation of MariaDB is already upgraded to %s.\n" + "There is no need to run mariadb-upgrade again.", version); if (!opt_check_upgrade) verbose("You can use --force if you still want to run mariadb-upgrade"); } diff --git a/client/mysqldump.cc b/client/mysqldump.cc index 51fb48d69e5..4327c4328b9 100644 --- a/client/mysqldump.cc +++ b/client/mysqldump.cc @@ -2253,7 +2253,7 @@ static char *quote_for_equal(const char *name, char *buff) *to++='\\'; } if (*name == '\'') - *to++= '\\'; + *to++= '\''; *to++= *name++; } to[0]= '\''; @@ -3853,7 +3853,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs, fprintf(sql_file, "DELIMITER ;;\n" - "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n" + "/*!50003 SET SESSION SQL_MODE='%s' */;;\n" "/*!50003 CREATE */ ", (*show_trigger_row)[6]); @@ -4907,17 +4907,19 @@ static int dump_all_users_roles_and_grants() return 1; while ((row= mysql_fetch_row(tableres))) { + char buf[200]; if (opt_replace_into) /* Protection against removing the current import user */ /* MySQL-8.0 export capability */ fprintf(md_result_file, "DELIMITER |\n" - "/*M!100101 IF current_user()=\"%s\" THEN\n" + "/*M!100101 IF current_user()=%s THEN\n" " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001," " MESSAGE_TEXT=\"Don't remove current user %s'\";\n" "END IF */|\n" "DELIMITER ;\n" - "/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]); + "/*!50701 DROP USER IF EXISTS %s */;\n", + quote_for_equal(row[0],buf), row[0], row[0]); if (dump_create_user(row[0])) result= 1; /* if roles exist, defer dumping grants until after roles created */ @@ -7033,6 +7035,7 @@ static my_bool get_view_structure(char *table, char* db) char *result_table, *opt_quoted_table; char table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3]; + char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3]; char query[QUERY_LENGTH]; FILE *sql_file= md_result_file; DBUG_ENTER("get_view_structure"); @@ -7093,7 +7096,9 @@ static my_bool get_view_structure(char *table, char* db) "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " " CHARACTER_SET_CLIENT, COLLATION_CONNECTION " "FROM information_schema.views " - "WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db); + "WHERE table_name=%s AND table_schema=%s", + quote_for_equal(table, temp_buff2), + quote_for_equal(db, temp_buff)); if (mysql_query(mysql, query)) { diff --git a/client/mysqlslap.c b/client/mysqlslap.c index e8864d721f8..26da0a4a9eb 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -2223,6 +2223,13 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr) stats *ptr; unsigned int x; + if (eng && eng->string) + con->engine= eng->string; + + /* Early return when iterations is 0 to avoid accessing uninitialized sptr */ + if (iterations == 0) + return; + con->min_timing= sptr->timing; con->max_timing= sptr->timing; con->min_rows= sptr->rows; @@ -2243,11 +2250,6 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr) con->min_timing= ptr->timing; } con->avg_timing= con->avg_timing/iterations; - - if (eng && eng->string) - con->engine= eng->string; - else - con->engine= NULL; } void diff --git a/client/mysqltest.cc b/client/mysqltest.cc index de669640511..cfeb7204d63 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6807,7 +6807,7 @@ int read_line() my_bool have_slash= FALSE; enum {R_NORMAL, R_Q, R_SLASH_IN_Q, - R_COMMENT, R_LINE_START} state= R_LINE_START; + R_COMMENT, R_LINE_START, R_CSTYLE_COMMENT} state= R_LINE_START; DBUG_ENTER("read_line"); *p= 0; @@ -6894,9 +6894,23 @@ int read_line() state= R_Q; } } + else if (c == '*' && last_char == '/') + { + state= R_CSTYLE_COMMENT; + break; + } have_slash= is_escape_char(c, last_quote); break; + case R_CSTYLE_COMMENT: + if (c == '!') + // Got the hint introducer '/*!'. Switch to normal processing of + // next following characters + state= R_NORMAL; + else if (c == '/' && last_char == '*') + state= R_NORMAL; + break; + case R_COMMENT: if (c == '\n') { diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index a9dc6937b86..7fded49b916 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -28,15 +28,14 @@ MACRO (CHECK_LIBFMT) IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto") SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR}) CHECK_CXX_SOURCE_RUNS( - "#define FMT_STATIC_THOUSANDS_SEPARATOR ',' - #define FMT_HEADER_ONLY 1 + "#define FMT_HEADER_ONLY 1 #include int main() { using ArgStore= fmt::dynamic_format_arg_store; ArgStore arg_store; int answer= 4321; arg_store.push_back(answer); - return fmt::vformat(\"{:L}\", arg_store).compare(\"4,321\"); + return fmt::vformat(\"{}\", arg_store).compare(\"4321\"); }" HAVE_SYSTEM_LIBFMT) SET(CMAKE_REQUIRED_INCLUDES) ENDIF() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index ec1029e20ac..510413d915c 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -121,7 +121,7 @@ IF(MSVC) # Disable mingw based pkg-config found in Strawberry perl SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") - SET(MSVC_CRT_TYPE /MT CACHE STRING + SET(MSVC_CRT_TYPE /MD CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) @@ -129,6 +129,25 @@ IF(MSVC) MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ") ENDIF() + # CMake version 3.15 and later uses CMAKE_MSVC_RUNTIME_LIBRARY + # variable for our MSVC_CRT_TYPE. + # Set CMAKE_MSVC_RUNTIME_LIBRARY and pass to external projects + # it is important to keep the same CRT type when linking + # + # Translation rules MSVC_CRT_TYPE -> CMAKE_MSVC_RUNTIME_LIBRARY + # /MT -> MultiThreaded + # /MTd -> MultiThreadedDebug + # /MD -> MultiThreadedDLL + # /MDd -> MultiThreadedDebugDLL + + SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) + IF(MSVC_CRT_TYPE MATCHES "d$") + STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY Debug) + ENDIF() + IF(MSVC_CRT_TYPE MATCHES "D") + STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY DLL) + ENDIF() + IF(MSVC_CRT_TYPE MATCHES "/MD") # Dynamic runtime (DLLs), need to install CRT libraries. SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) @@ -282,6 +301,7 @@ STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib synchronization.lib") # System checks SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs +SET(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1) # IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are # not in headers, to handle dual mode sockets correctly. diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 2e444b770eb..08353e9236a 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -54,11 +54,18 @@ MACRO(BUNDLE_PCRE2) ENDIF() ENDFOREACH() + IF(CMAKE_MSVC_RUNTIME_LIBRARY) + SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG + "-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}") + ELSE() + SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG) + ENDIF() + ExternalProject_Add( pcre2 PREFIX "${dir}" - URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.zip" - URL_MD5 dfab8313154b3377a6959c3b6377841e + URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.zip" + URL_MD5 873da56c6469ec207ca5c5ae9688b83a INSTALL_COMMAND "" CMAKE_ARGS "-DCMAKE_WARN_DEPRECATED=FALSE" @@ -72,6 +79,7 @@ MACRO(BUNDLE_PCRE2) "-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}" "-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" + ${CMAKE_MSVC_RUNTIME_LIBRARY_ARG} ${stdlibs} ${byproducts} ) diff --git a/config.h.cmake b/config.h.cmake index e2d53fda809..be550259a8e 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -457,6 +457,11 @@ /* This should mean case insensitive file system */ #cmakedefine FN_NO_CASE_SENSE 1 +/* Whether an anonymous private mapping is unaccessible after +madvise(MADV_DONTNEED) or madvise(MADV_FREE) or similar has been invoked; +this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */ +#cmakedefine HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1 + #cmakedefine HAVE_CHARSET_armscii8 1 #cmakedefine HAVE_CHARSET_ascii 1 #cmakedefine HAVE_CHARSET_big5 1 diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index e4a39244bbf..052752b8f5e 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -1895,7 +1895,7 @@ bool write_backup_config_file(ds_ctxt *datasink) srv_log_file_size, srv_page_size, srv_undo_dir, - (uint) srv_undo_tablespaces, + srv_undo_tablespaces, page_zip_level, innobase_buffer_pool_filename ? "innodb_buffer_pool_filename=" : "", diff --git a/extra/mariabackup/common_engine.cc b/extra/mariabackup/common_engine.cc index a4a8706243a..a360f63d84f 100644 --- a/extra/mariabackup/common_engine.cc +++ b/extra/mariabackup/common_engine.cc @@ -64,8 +64,10 @@ Table::copy(ds_ctxt_t *ds, MYSQL *con, bool no_lock, bool, unsigned thread_num) for (const auto &fname : m_fnames) { File file = mysql_file_open(0, fname.c_str(),O_RDONLY | O_SHARE, MYF(0)); if (file < 0) { - msg(thread_num, "Error on file %s open during %s table copy", - fname.c_str(), full_tname.c_str()); + char buf[MYSYS_STRERROR_SIZE]; + msg(thread_num, "Error %i on file %s open during %s table copy: %s", + errno, fname.c_str(), full_tname.c_str(), + my_strerror(buf, sizeof(buf), errno)); goto exit; } files.push_back(file); diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 60c38546c09..22f4dc387dd 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -44,8 +44,8 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include #include #include -#include #include +#include "buf0buf.h" #include #include #include @@ -594,8 +594,9 @@ static struct my_option ibx_long_options[] = "--apply-log.", (uchar*) &ibx_xtrabackup_use_memory, (uchar*) &ibx_xtrabackup_use_memory, - 0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, - 1024*1024L, 0}, + 0, GET_LL, REQUIRED_ARG, 96 << 20, + innodb_buffer_pool_extent_size, SIZE_T_MAX, 0, + innodb_buffer_pool_extent_size, 0}, {"innodb-force-recovery", OPT_INNODB_FORCE_RECOVERY, "This option starts up the embedded InnoDB instance in crash " diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 13f19ca6b6a..052cea26ef6 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -144,18 +144,6 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile) return false; } - /* Check whether TRX_SYS page has been changed */ - if (mach_read_from_4(page + FIL_PAGE_SPACE_ID) - == TRX_SYS_SPACE - && mach_read_from_4(page + FIL_PAGE_OFFSET) - == TRX_SYS_PAGE_NO) { - msg(cursor->thread_n, - "--incremental backup is impossible if " - "the server had been restarted with " - "different innodb_undo_tablespaces."); - return false; - } - /* updated page */ if (cp->npages == page_size / 4) { /* flush buffer */ diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 34d63148381..493fd6b6972 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -201,8 +201,6 @@ struct xb_filter_entry_t{ xb_filter_entry_t *name_hash; }; -lsn_t checkpoint_lsn_start; -lsn_t checkpoint_no_start; /** whether log_copying_thread() is active; protected by recv_sys.mutex */ static bool log_copying_running; /** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */ @@ -1386,6 +1384,7 @@ enum options_xtrabackup OPT_XTRA_MYSQLD_ARGS, OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION, OPT_INNODB_FORCE_RECOVERY, + OPT_INNODB_CHECKPOINT, OPT_ARIA_LOG_DIR_PATH }; @@ -1417,8 +1416,9 @@ struct my_option xb_client_options[]= { "The value is used in place of innodb_buffer_pool_size. " "This option is only relevant when the --prepare option is specified.", (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, - GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0, - 1024 * 1024L, 0}, + GET_ULL, REQUIRED_ARG, 96 << 20, innodb_buffer_pool_extent_size, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + 0, innodb_buffer_pool_extent_size, 0}, {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS " "values (for '--backup')", @@ -1795,6 +1795,8 @@ extern const char *io_uring_may_be_unsafe; bool innodb_use_native_aio_default(); #endif +static my_bool innodb_log_checkpoint_now; + struct my_option xb_server_options[] = { {"datadir", 'h', "Path to the database root.", (G_PTR*) &mysql_data_home, @@ -2032,6 +2034,12 @@ struct my_option xb_server_options[] = (G_PTR*)&srv_force_recovery, 0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0}, + {"innodb_log_checkpoint_now", OPT_INNODB_CHECKPOINT, + "(for --backup): Force an InnoDB checkpoint", + (G_PTR*)&innodb_log_checkpoint_now, + (G_PTR*)&innodb_log_checkpoint_now, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"mysqld-args", OPT_XTRA_MYSQLD_ARGS, "All arguments that follow this argument are considered as server " "options, and if some of them are not supported by mariabackup, they " @@ -2118,7 +2126,7 @@ static int prepare_export() if (strncmp(orig_argv1,"--defaults-file=", 16) == 0) { snprintf(cmdline, sizeof cmdline, - IF_WIN("\"","") "\"%s\" --mysqld \"%s\"" + IF_WIN("\"","") "\"%s\" --mariadbd \"%s\"" " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb-buffer-pool-size=%llu" @@ -2132,7 +2140,7 @@ static int prepare_export() else { snprintf(cmdline, sizeof cmdline, - IF_WIN("\"","") "\"%s\" --mysqld" + IF_WIN("\"","") "\"%s\" --mariadbd" " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb-buffer-pool-size=%llu" @@ -2476,7 +2484,7 @@ static bool innodb_init_param() } srv_sys_space.normalize_size(); - srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); + srv_lock_table_size = 5 * buf_pool.curr_size(); /* -------------- Log files ---------------------------*/ @@ -2498,11 +2506,8 @@ static bool innodb_init_param() srv_adaptive_flushing = FALSE; - /* We set srv_pool_size here in units of 1 kB. InnoDB internally - changes the value so that it becomes the number of database pages. */ - - srv_buf_pool_size = (ulint) xtrabackup_use_memory; - srv_buf_pool_chunk_unit = srv_buf_pool_size; + buf_pool.size_in_bytes_max = size_t(xtrabackup_use_memory); + buf_pool.size_in_bytes_requested = buf_pool.size_in_bytes_max; srv_n_read_io_threads = (uint) innobase_read_io_threads; srv_n_write_io_threads = (uint) innobase_write_io_threads; @@ -2968,6 +2973,15 @@ my_bool regex_list_check_match( const regex_list_t& list, const char* name) { + if (list.empty()) return (FALSE); + + /* + regexec/pcre2_regexec is not threadsafe, also documented. + Serialize access from multiple threads to compiled regexes. + */ + static std::mutex regex_match_mutex; + std::lock_guard lock(regex_match_mutex); + regmatch_t tables_regmatch[1]; for (regex_list_t::const_iterator i = list.begin(), end = list.end(); i != end; ++i) { @@ -5427,6 +5441,14 @@ static bool xtrabackup_backup_func() } msg("cd to %s", mysql_real_data_home); encryption_plugin_backup_init(mysql_connection); + if (innodb_log_checkpoint_now != false && mysql_send_query( + mysql_connection, + C_STRING_WITH_LEN("SET GLOBAL " + "innodb_log_checkpoint_now=ON;"))) { + msg("initiating checkpoint failed"); + return(false); + } + msg("open files limit requested %lu, set to %lu", xb_open_files_limit, xb_set_max_open_files(xb_open_files_limit)); @@ -5539,6 +5561,11 @@ fail: goto fail; } + /* try to wait for a log checkpoint, but do not fail if the + server does not support this */ + if (innodb_log_checkpoint_now != false) { + mysql_read_query_result(mysql_connection); + } /* label it */ recv_sys.file_checkpoint = log_sys.next_checkpoint_lsn; log_hdr_init(); @@ -6252,9 +6279,22 @@ xtrabackup_apply_delta( buf + FSP_HEADER_OFFSET + FSP_SIZE); if (mach_read_from_4(buf + FIL_PAGE_SPACE_ID)) { +#ifdef _WIN32 + os_offset_t last_page = + os_file_get_size(dst_file) / + page_size; + + /* os_file_set_size() would + shrink the size of the file */ + if (last_page < n_pages && + !os_file_set_size( + dst_path, dst_file, + n_pages * page_size)) +#else if (!os_file_set_size( dst_path, dst_file, n_pages * page_size)) +#endif /* _WIN32 */ goto error; } else if (fil_space_t* space = fil_system.sys_space) { @@ -7530,9 +7570,9 @@ int main(int argc, char **argv) { /* In "prepare export", we need to start mysqld Since it is not always be installed on the machine, - we start "mariabackup --mysqld", which acts as mysqld + we start "mariabackup --mariadbd", which acts as mysqld */ - if (strcmp(argv[1], "--mysqld") == 0) + if (strcmp(argv[1], "--mariadbd") == 0) { srv_operation= SRV_OPERATION_EXPORT_RESTORED; extern int mysqld_main(int argc, char **argv); diff --git a/include/my_cpu.h b/include/my_cpu.h index bd5fca5f21b..2b34e03fce3 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -97,7 +97,12 @@ static inline void MY_RELAX_CPU(void) /* Changed from __ppc_get_timebase for musl and clang compatibility */ __builtin_ppc_get_timebase(); #elif defined __GNUC__ && defined __riscv - __builtin_riscv_pause(); + /* The GCC-only __builtin_riscv_pause() or the pause instruction is + encoded like a fence instruction with special parameters. On RISC-V + implementations that do not support arch=+zihintpause this + instruction could be interpreted as a more expensive memory fence; + it should not be an illegal instruction. */ + __asm__ volatile(".long 0x0100000f" ::: "memory"); #elif defined __GNUC__ /* Mainly, prevent the compiler from optimizing away delay loops */ __asm__ __volatile__ ("":::"memory"); diff --git a/include/my_sys.h b/include/my_sys.h index e129f03ff3c..c099e0a9774 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -175,9 +175,13 @@ extern void my_free(void *ptr); extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags); extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags); extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags); +extern my_bool my_use_large_pages; -int my_init_large_pages(my_bool super_large_pages); +int my_init_large_pages(void); uchar *my_large_malloc(size_t *size, myf my_flags); +#if defined _WIN32 || defined HAVE_MMAP +char *my_large_virtual_alloc(size_t *size); +#endif void my_large_free(void *ptr, size_t size); void my_large_page_truncate(size_t *size); diff --git a/include/my_virtual_mem.h b/include/my_virtual_mem.h new file mode 100644 index 00000000000..56b2f03b329 --- /dev/null +++ b/include/my_virtual_mem.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2025, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#pragma once +/* + Functionality for handling virtual memory + (reserve, commit, decommit, release) +*/ +#include /*size_t*/ + +#ifdef __cplusplus +extern "C" { +#endif + +char *my_virtual_mem_reserve(size_t *size); +char *my_virtual_mem_commit(char *ptr, size_t size); +void my_virtual_mem_decommit(char *ptr, size_t size); +void my_virtual_mem_release(char *ptr, size_t size); + +#ifdef __cplusplus +} +#endif + diff --git a/libmariadb b/libmariadb index 93e420621a9..ba712ddf961 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 93e420621a9b367081dcfab17fd1a8340c411cf2 +Subproject commit ba712ddf9611304e8dfc12e829ad899222d1b4cb diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 2c040fc0e32..07bc3c70886 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INSTALL_MYSQL_TEST("." ".") +INSTALL_MYSQL_TEST("." "") IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) # Enable running mtr from build directory diff --git a/mysql-test/include/long_test.inc b/mysql-test/include/long_test.inc index 765f88b8037..7f3a3a61778 100644 --- a/mysql-test/include/long_test.inc +++ b/mysql-test/include/long_test.inc @@ -1,6 +1,6 @@ # We use this --source include to mark a test as taking long to run. # We can use this to schedule such test early (to not be left with -# only one or two long tests running, and rests of works idle), or to +# only one or two long tests running, and rests of workers idle), or to # run a quick test skipping long-running test cases. --source include/no_valgrind_without_big.inc diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test index 40f12bb7ef8..6a1fe9f6094 100644 --- a/mysql-test/main/backup_locks.test +++ b/mysql-test/main/backup_locks.test @@ -2,6 +2,7 @@ # Tests BACKUP STAGE locking ######################################################################## +--source include/long_test.inc --source include/have_innodb.inc --source include/have_metadata_lock_info.inc --source include/not_embedded.inc diff --git a/mysql-test/main/ctype_utf8mb4_0900.result b/mysql-test/main/ctype_utf8mb4_0900.result index 9e85fe6d7dc..6d0421900b9 100644 --- a/mysql-test/main/ctype_utf8mb4_0900.result +++ b/mysql-test/main/ctype_utf8mb4_0900.result @@ -91,7 +91,7 @@ utf8mb4_hu_0900_as_cs utf8mb4 297 Yes 8 Alias for utf8mb4_uca1400_hungarian_nop utf8mb4_hr_0900_as_cs utf8mb4 298 Yes 8 Alias for utf8mb4_uca1400_croatian_nopad_as_cs utf8mb4_vi_0900_as_cs utf8mb4 300 Yes 8 Alias for utf8mb4_uca1400_vietnamese_nopad_as_cs utf8mb4_0900_as_ci utf8mb4 305 Yes 8 Alias for utf8mb4_uca1400_nopad_as_ci -utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_bin +utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_nopad_bin # # MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server # @@ -198,3 +198,21 @@ drop table t1,t2; CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci; alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy; drop table t1; +# +# MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin) +# +SELECT collation_name, id, comment +FROM information_schema.collations +WHERE collation_name='utf8mb4_0900_bin'; +collation_name id comment +utf8mb4_0900_bin 309 Alias for utf8mb4_nopad_bin +CREATE TABLE t1 ( +a VARCHAR(32), +b VARCHAR(32) +) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin; +INSERT INTO t1 VALUES ('a\t', 'a'); +SELECT a 2 AND b < 4) OR (b = 5) GROUP BY a; +MAX(b) +3 +drop table t1; +# +# MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL +# +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (4, NULL), (1, 14), (4, 3); +SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a; +MIN(b) +3 +SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a; +MIN(b) +NULL +drop table t1; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index 26661a2282c..1392bd563fc 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -2014,3 +2014,39 @@ drop table t1; --echo # --echo # End of 10.6 tests --echo # + +--echo # +--echo # MDEV-36118 Wrong result in loose index scan +--echo # + +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (1, 3), (1, 1); +--source include/maybe_debug.inc +if ($have_debug) { + --disable_query_log + set @old_debug=@@debug; + set debug="+d,force_group_by"; + --enable_query_log +} +SELECT MAX(b) FROM t1 WHERE (b > 2 AND b < 4) OR (b = 5) GROUP BY a; +if ($have_debug) { + --disable_query_log + set debug=@old_debug; + --enable_query_log +} + +drop table t1; + +--echo # +--echo # MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL +--echo # + +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (4, NULL), (1, 14), (4, 3); +SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a; +SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a; +drop table t1; + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index e9f4ad249be..88d95bc61ec 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -2051,3 +2051,15 @@ a b c a a b DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; # end of 10.3 tests +# +# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +# +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); +SELECT 1 FROM t1 WHERE i IN +(SELECT 1 FROM t1 c +LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); +1 +1 +DROP TABLE t1; +# end of 10.11 tests diff --git a/mysql-test/main/join_nested.test b/mysql-test/main/join_nested.test index ee89c91e734..99ea7bd1faa 100644 --- a/mysql-test/main/join_nested.test +++ b/mysql-test/main/join_nested.test @@ -1459,3 +1459,16 @@ DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; --echo # end of 10.3 tests + +--echo # +--echo # MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +--echo # +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); + +SELECT 1 FROM t1 WHERE i IN + (SELECT 1 FROM t1 c + LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); + +DROP TABLE t1; +--echo # end of 10.11 tests diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index f37006080d0..04658dcda10 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -2060,6 +2060,18 @@ a b c a a b DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; # end of 10.3 tests +# +# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +# +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); +SELECT 1 FROM t1 WHERE i IN +(SELECT 1 FROM t1 c +LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); +1 +1 +DROP TABLE t1; +# end of 10.11 tests CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); diff --git a/mysql-test/main/large_pages.opt b/mysql-test/main/large_pages.opt index 857c9c1ecee..bff2c2f6898 100644 --- a/mysql-test/main/large_pages.opt +++ b/mysql-test/main/large_pages.opt @@ -1 +1 @@ ---large-pages +--large-pages --loose-innodb-buffer-pool-size-max=16m diff --git a/mysql-test/main/large_pages.result b/mysql-test/main/large_pages.result index 9d03e646ddf..c5e73f044a9 100644 --- a/mysql-test/main/large_pages.result +++ b/mysql-test/main/large_pages.result @@ -1,4 +1,5 @@ call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); +call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*"); create table t1 ( a int not null auto_increment, b char(16) not null, diff --git a/mysql-test/main/large_pages.test b/mysql-test/main/large_pages.test index 136273a2821..7c0f497c6d3 100644 --- a/mysql-test/main/large_pages.test +++ b/mysql-test/main/large_pages.test @@ -1,11 +1,9 @@ # Test of large pages (or at least the fallback to conventional allocation) -# Windows needs SeLockMemoryPrivilege ---source include/not_windows.inc --source include/have_innodb.inc call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); - +call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*"); create table t1 ( a int not null auto_increment, b char(16) not null, diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index 515d9dddfe9..e273c9e2238 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -1452,4 +1452,26 @@ DROP TABLE t1, t2; # CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a` +# +# MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin +# +# Disable result log. The exact result is not important. +# We just need to make sure UBSAN nullptr-with-offset is not reported. +SELECT DISTINCT user,authentication_string FROM mysql.user; +SELECT DISTINCT USER,PASSWORD FROM mysql.user; +SELECT DISTINCT USER,plugin FROM mysql.user; +# Enabling result log again. +create or replace table t1 (t text) engine=aria; +insert into t1 values (''); +insert into t1 values (NULL); +select distinct t from t1; +t + +NULL +alter table t1 ENGINE=MyISAM; +select distinct t from t1; +t + +NULL +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/long_unique.test b/mysql-test/main/long_unique.test index f23bf647b36..14e83c50a58 100644 --- a/mysql-test/main/long_unique.test +++ b/mysql-test/main/long_unique.test @@ -552,4 +552,26 @@ DROP TABLE t1, t2; --error ER_NO_AUTOINCREMENT_WITH_UNIQUE CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; +--echo # +--echo # MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin +--echo # + +--echo # Disable result log. The exact result is not important. +--echo # We just need to make sure UBSAN nullptr-with-offset is not reported. +--disable_result_log +SELECT DISTINCT user,authentication_string FROM mysql.user; +SELECT DISTINCT USER,PASSWORD FROM mysql.user; +SELECT DISTINCT USER,plugin FROM mysql.user; +--enable_result_log +--echo # Enabling result log again. + +create or replace table t1 (t text) engine=aria; +insert into t1 values (''); +insert into t1 values (NULL); +select distinct t from t1; +alter table t1 ENGINE=MyISAM; +select distinct t from t1; +DROP TABLE t1; + + --echo # End of 10.5 tests diff --git a/mysql-test/main/mariadb-upgrade-service.result b/mysql-test/main/mariadb-upgrade-service.result new file mode 100644 index 00000000000..a838b6e58a4 --- /dev/null +++ b/mysql-test/main/mariadb-upgrade-service.result @@ -0,0 +1,35 @@ +use mysql; +# run mysql_install_db with --service parameter +# Start service +# -- Upgrade service (online) -- +Phase 1/10: Stopping service +Phase 2/10: Start and stop server in the old version, to avoid crash recovery (skipped) +Phase 3/10: Fixing server config file +Phase 4/10: Starting mysqld for upgrade +Phase 5/10: Waiting for startup to complete +Phase 6/10: Running mysql_upgrade +Phase 7/10: Changing service configuration +Phase 8/10: Initiating server shutdown +Phase 9/10: Waiting for shutdown to complete +Phase 10/10: Starting service +Service 'SERVICE_NAME' successfully upgraded. +Log file is written to UPGRADE_LOG +# upgrade_success(online)=1 +# Service stopped +# -- Upgrade service (offline) -- +Phase 1/10: Stopping service +Phase 2/10: Start and stop server in the old version, to avoid crash recovery ,this can take some time +Phase 3/10: Fixing server config file +Phase 4/10: Starting mysqld for upgrade +Phase 5/10: Waiting for startup to complete +Phase 6/10: Running mysql_upgrade +Phase 7/10: Changing service configuration +Phase 8/10: Initiating server shutdown +Phase 9/10: Waiting for shutdown to complete +Phase 10/10: Starting service (skipped) +Service 'SERVICE_NAME' successfully upgraded. +Log file is written to UPGRADE_LOG +# upgrade_success(offline)=1 +# Delete service +connection default; +# restart diff --git a/mysql-test/main/mariadb-upgrade-service.test b/mysql-test/main/mariadb-upgrade-service.test new file mode 100644 index 00000000000..58132cbb05c --- /dev/null +++ b/mysql-test/main/mariadb-upgrade-service.test @@ -0,0 +1,113 @@ +source include/windows.inc; +let $datadir_name=data; +let $service_name_prefix=mariadb; +let $password=password; + +source include/check_windows_admin.inc; + +# The test uses return code from sc.exe utility, which are as follows +let $ERROR_SERVICE_DOES_NOT_EXIST= 1060; +let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop +let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped +let $ERROR_INVALID_SERVICE_CONTROL=1052; # The requested control is not valid for this service + +let $sc_exe= C:\Windows\System32\sc.exe; +let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name; +let $service_name=$service_name_prefix$MASTER_MYPORT; +let TMP= $MYSQLTEST_VARDIR/tmp; +let $upgrade_log=$TMP/mysql_upgrade_service.$service_name.log; + +use mysql; +error 0,1; +rmdir $ddir; + +--disable_result_log +error 0,$ERROR_SERVICE_DOES_NOT_EXIST; +exec $sc_exe delete $service_name; +--enable_result_log + +source include/shutdown_mysqld.inc; +echo # run mysql_install_db with --service parameter; +--disable_result_log +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name --verbose-bootstrap -R; +--enable_result_log + +echo # Start service; +--disable_result_log +exec $sc_exe start $service_name; +--enable_result_log + +enable_reconnect; +source include/wait_until_connected_again.inc; +disable_reconnect; + +echo # -- Upgrade service (online) --; +--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME +let $sys_errno=0; +let $upgrade_success = 1; +error 0,1; +exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name; + +if($sys_errno != 0) +{ + let $upgrade_success = 0; +} + +echo # upgrade_success(online)=$upgrade_success; +file_exists $upgrade_log; +if ($upgrade_success == 0) +{ + echo --detailed error(online upgrade)--; + cat_file $upgrade_log; +} +# stop service +--disable_result_log +# Wait until stopped +let $sys_errno=0; +while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE) +{ + --error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE, $ERROR_INVALID_SERVICE_CONTROL + exec $sc_exe stop $service_name; + if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE) + { + --real_sleep 0.1 + } +} +--enable_result_log +echo # Service stopped; + +echo # -- Upgrade service (offline) --; +--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME +let $sys_errno=0; +let $upgrade_success = 1; +error 0,1; +exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name; + +if($sys_errno != 0) +{ + let $upgrade_success = 0; +} + +echo # upgrade_success(offline)=$upgrade_success; +file_exists $upgrade_log; +if ($upgrade_success == 0) +{ + echo --detailed error(online upgrade)--; + cat_file $upgrade_log; +} + +echo # Delete service; +let $sys_errno=0; +--disable_result_log +exec $sc_exe delete $service_name; +--enable_result_log + +# Cleanup +source include/wait_until_disconnected.inc; +rmdir $ddir; +remove_file $upgrade_log; +let TEMP=$old_temp; + +#restart original server +connection default; +source include/start_mysqld.inc; diff --git a/mysql-test/main/my_getopt_case_insensitive.opt b/mysql-test/main/my_getopt_case_insensitive.opt new file mode 100644 index 00000000000..cadcd15e765 --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.opt @@ -0,0 +1 @@ +--slOw_QuEry_loG=OFF diff --git a/mysql-test/main/my_getopt_case_insensitive.result b/mysql-test/main/my_getopt_case_insensitive.result new file mode 100644 index 00000000000..0ab93079fbf --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.result @@ -0,0 +1,8 @@ +# +# MDEV-27126: my_getopt compares option names case sensitively +# +# Check if the variable is set correctly from options +SELECT @@GLOBAL.slow_query_log; +@@GLOBAL.slow_query_log +0 +# End of test. diff --git a/mysql-test/main/my_getopt_case_insensitive.test b/mysql-test/main/my_getopt_case_insensitive.test new file mode 100644 index 00000000000..5b301375034 --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.test @@ -0,0 +1,8 @@ +--echo # +--echo # MDEV-27126: my_getopt compares option names case sensitively +--echo # + +--echo # Check if the variable is set correctly from options +SELECT @@GLOBAL.slow_query_log; + +--echo # End of test. diff --git a/mysql-test/main/myisam-big.result b/mysql-test/main/myisam-big.result index fd0bcb1224b..a1e483b4473 100644 --- a/mysql-test/main/myisam-big.result +++ b/mysql-test/main/myisam-big.result @@ -1,4 +1,7 @@ drop table if exists t1,t2; +call mtr.add_suppression("Index.*try to repair it"); +call mtr.add_suppression("Disk got full"); +call mtr.add_suppression("Got an error from thread_id"); create table t1 (id int, sometext varchar(100)) engine=myisam; insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4"); create table t2 like t1; @@ -43,4 +46,9 @@ connection default; connection con2; disconnect con2; connection default; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_pwrite_error'; +insert into t1 select * from t2; +ERROR HY000: Disk got full writing 'test.t1' (Errcode: 28 "No space left on device") +SET debug_dbug= @saved_dbug; drop table t1,t2; diff --git a/mysql-test/main/myisam-big.test b/mysql-test/main/myisam-big.test index 2fec2450ecd..30267b2b3c7 100644 --- a/mysql-test/main/myisam-big.test +++ b/mysql-test/main/myisam-big.test @@ -1,12 +1,17 @@ # # Test bugs in the MyISAM code that require more space/time --source include/big_test.inc +--source include/have_debug.inc # Initialise --disable_warnings drop table if exists t1,t2; --enable_warnings +call mtr.add_suppression("Index.*try to repair it"); +call mtr.add_suppression("Disk got full"); +call mtr.add_suppression("Got an error from thread_id"); + # # BUG#925377: # Querying myisam table metadata while 'alter table..enable keys' is @@ -61,4 +66,12 @@ connection con2; reap; disconnect con2; connection default; + +# +# Test error message from disk full +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_pwrite_error'; +--error ER_DISK_FULL +insert into t1 select * from t2; +SET debug_dbug= @saved_dbug; drop table t1,t2; diff --git a/mysql-test/main/mysql-interactive.result b/mysql-test/main/mysql-interactive.result index a18c018b932..cdb0931418a 100644 --- a/mysql-test/main/mysql-interactive.result +++ b/mysql-test/main/mysql-interactive.result @@ -4,6 +4,7 @@ delimiter $ select 1; $ +exit Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is X Server version: Y @@ -21,4 +22,5 @@ MariaDB [(none)]> select 1; +---+ 1 row in set -MariaDB [(none)]> \ No newline at end of file +MariaDB [(none)]> exit +Bye diff --git a/mysql-test/main/mysql-interactive.test b/mysql-test/main/mysql-interactive.test index 0051d8e58c6..e387f937226 100644 --- a/mysql-test/main/mysql-interactive.test +++ b/mysql-test/main/mysql-interactive.test @@ -6,23 +6,16 @@ source include/not_windows.inc; # this would need an instrumented ncurses library source include/not_msan.inc; -error 0,1; -exec $MYSQL -V|grep -q readline; -if ($sys_errno == 1) -{ - # strangely enough - skip does not work with libedit; -} - write_file $MYSQL_TMP_DIR/mysql_in; delimiter $ select 1; $ +exit EOF let TERM=dumb; replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; error 0,127; -exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; +exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; if ($sys_errno == 127) { remove_file $MYSQL_TMP_DIR/mysql_in; diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 11d1bea06f0..9b20a5b8713 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -152,7 +152,8 @@ Phase 7/8: uninstalling plugins Phase 8/8: Running 'FLUSH PRIVILEGES' OK Run it again - should say already completed -This installation of MariaDB is already upgraded to VERSION.There is no need to run mariadb-upgrade again for VERSION. +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mariadb-upgrade again. You can use --force if you still want to run mariadb-upgrade Force should run it regardless of whether it has been run before Phase 1/8: Checking and upgrading mysql database @@ -1922,11 +1923,11 @@ FLUSH PRIVILEGES; # # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed # -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mariadb-upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mariadb-upgrade again. Looking for 'mariadb' as: mariadb -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mariadb-upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mariadb-upgrade again. # # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it # @@ -1936,17 +1937,17 @@ Empty or non existent ...mariadb_upgrade_info. Assuming mysql_upgrade has to be # MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change # Looking for 'mariadb' as: mariadb -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mariadb-upgrade again for MariaDB . -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mariadb-upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.0-MariaDB. +There is no need to run mariadb-upgrade again for X.Y.Z-MariaDB, because they're both X.Y. +This installation of MariaDB is already upgraded to X.Y.0-MariaDB. +There is no need to run mariadb-upgrade again for X.Y.Z-MariaDB, because they're both X.Y. You can use --force if you still want to run mariadb-upgrade # # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change # -Major version upgrade detected from MariaDB to MariaDB . Check required! +Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required! Looking for 'mysql' as: mysql -Major version upgrade detected from MariaDB to MariaDB . Check required! +Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required! drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; # End of 10.2 tests diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 0d72d0700e8..9ba48778793 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -1,8 +1,12 @@ +--source include/long_test.inc -- source include/mysql_upgrade_preparation.inc -- source include/have_working_dns.inc -- source include/have_innodb.inc -- source include/have_partition.inc --- source include/no_valgrind_without_big.inc + +let majorminor=`select substring_index(version(), '.', 2)`; +# for major upgrade test, see below +let major=`select substring_index(version(), '.', 1) - (version() like '%.0.%')`; set sql_mode=""; @@ -32,7 +36,7 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info; file_exists $MYSQLD_DATADIR/mariadb_upgrade_info; --echo Run it again - should say already completed ---replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB --exec $MYSQL_UPGRADE 2>&1 # It should have created a file in the MySQL Servers datadir @@ -302,10 +306,11 @@ FLUSH PRIVILEGES; --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB +--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose @@ -333,16 +338,18 @@ perl; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/; open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file"; + binmode FILE; print FILE "$ver\n"; close(FILE); EOF --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y +--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y --exec $MYSQL_UPGRADE --remove_file $MYSQLD_DATADIR/mariadb_upgrade_info @@ -358,23 +365,17 @@ perl; my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file"; - if ($ver =~ m/(\d*)\.0\.(\d*)(.*)/) - { - my $prev= $1-1; - $ver= $prev . '.0.' . $2 . $3; - } - else - { - $ver =~ s/^(\d*)\.(\d*)\.(\d*)(.*)/$1.0.$3$4/; - } + binmode FILE; + $ver =~ s/^(\d+)\.(\d+)\.\d+.*/($1-!$2).'.0.99'/e; print FILE "$ver\n"; close(FILE); EOF --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mysql' as: mysql/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X +--replace_regex /'mariadb.* as:[^\n]*/'mysql' as: mysql/ --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --remove_file $MYSQLD_DATADIR/mariadb_upgrade_info drop table mysql.global_priv; diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index f7d12ad421f..b81726260cd 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -655,21 +655,21 @@ INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; /*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */; INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; DELIMITER | -/*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN +/*M!100101 IF current_user()='''mariadb.sys''@''localhost''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''"; END IF */| DELIMITER ; /*!50701 DROP USER IF EXISTS 'mariadb.sys'@'localhost' */; CREATE /*M!100103 OR REPLACE */ USER `mariadb.sys`@`localhost` PASSWORD EXPIRE; DELIMITER | -/*M!100101 IF current_user()="'root'@'localhost'" THEN +/*M!100101 IF current_user()='''root''@''localhost''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; END IF */| DELIMITER ; /*!50701 DROP USER IF EXISTS 'root'@'localhost' */; CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`; DELIMITER | -/*M!100101 IF current_user()="'foobar'@'%'" THEN +/*M!100101 IF current_user()='''foobar''@''%''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''"; END IF */| DELIMITER ; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 6e9f98f088a..59b7b83d91e 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -6930,6 +6930,41 @@ set autocommit=0; commit; ERROR at line 11: Not allowed in the sandbox mode drop table t1; +# +# MDEV-36268 mariadb-dump used wrong quoting character +# +create table t1 (a int); +create view `v'1"2` as select * from t1 with check option; +/*M!999999\- enable the sandbox mode */ +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +set autocommit=0; +commit; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8mb4; +/*!50001 CREATE VIEW `v'1"2` AS SELECT + 1 AS `a` */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP VIEW IF EXISTS `v'1"2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb3 */; +/*!50001 SET character_set_results = utf8mb3 */; +/*!50001 SET collation_connection = utf8mb3_uca1400_ai_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v'1"2` AS select `t1`.`a` AS `a` from `t1` */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +drop view `v'1"2`; +drop table t1; # End of 10.5 tests # # MDEV-16733 mysqldump --tab and --xml options are conflicting diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 7268af5d23f..5052ef044a9 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1,4 +1,4 @@ ---source include/no_valgrind_without_big.inc +--source include/long_test.inc --source include/have_utf8mb4.inc call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); @@ -3032,6 +3032,15 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql drop table t1; +--echo # +--echo # MDEV-36268 mariadb-dump used wrong quoting character +--echo # +create table t1 (a int); +create view `v'1"2` as select * from t1 with check option; # "' +--exec $MYSQL_DUMP --compact test +drop view `v'1"2`; # "' +drop table t1; + --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/mysqlslap.result b/mysql-test/main/mysqlslap.result index 78560903fb7..db3582ac3c0 100644 --- a/mysql-test/main/mysqlslap.result +++ b/mysql-test/main/mysqlslap.result @@ -260,3 +260,6 @@ DROP TABLE t1; # # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK # +# +# Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0 +# diff --git a/mysql-test/main/mysqlslap.test b/mysql-test/main/mysqlslap.test index 81115d59d09..f38284b1b1c 100644 --- a/mysql-test/main/mysqlslap.test +++ b/mysql-test/main/mysqlslap.test @@ -88,3 +88,9 @@ DROP TABLE t1; --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap + +--echo # +--echo # Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0 +--echo # + +--exec $MYSQL_SLAP -i0 --only-print diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index 53f608921a1..7121c4135c1 100644 --- a/mysql-test/main/mysqltest.result +++ b/mysql-test/main/mysqltest.result @@ -989,4 +989,13 @@ select "foo\""bar"; foo\"bar foo\"bar set sql_mode=default; +# +# MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) +# +SELECT 1 /* doesn't throw error */; +1 +1 +SELECT 1 /* doesn't throw error */; +1 +1 End of tests diff --git a/mysql-test/main/mysqltest.test b/mysql-test/main/mysqltest.test index b545e354040..4895d06f66e 100644 --- a/mysql-test/main/mysqltest.test +++ b/mysql-test/main/mysqltest.test @@ -2954,6 +2954,12 @@ set sql_mode=no_backslash_escapes; select "foo\""bar"; set sql_mode=default; +--echo # +--echo # MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) +--echo # +SELECT 1 /* doesn't throw error */; +SELECT 1 /* doesn't throw error */; + --echo End of tests # Wait till we reached the initial number of concurrent sessions diff --git a/mysql-test/main/partition_myisam.result b/mysql-test/main/partition_myisam.result index 79ff1e2e118..e72b205f928 100644 --- a/mysql-test/main/partition_myisam.result +++ b/mysql-test/main/partition_myisam.result @@ -259,3 +259,24 @@ CHECK TABLE `t1` EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT, c varchar(5)) +PARTITION BY RANGE COLUMNS(c) +SUBPARTITION by key(b) SUBPARTITIONS 2 ( +PARTITION p0 VALUES LESS THAN ('m'), +PARTITION p1 VALUES LESS THAN ('z') +); +connect con1,localhost,root,,; +HANDLER t1 OPEN; +SELECT b FROM t2 PARTITION (p0); +connection default; +SET lock_wait_timeout= 1; +ALTER TABLE t1 FORCE; +connection con1; +b +disconnect con1; +connection default; +DROP TABLE t2, t1; diff --git a/mysql-test/main/partition_myisam.test b/mysql-test/main/partition_myisam.test index b26b619a958..70bd4a77794 100644 --- a/mysql-test/main/partition_myisam.test +++ b/mysql-test/main/partition_myisam.test @@ -249,3 +249,31 @@ ALTER TABLE `t1` ADD PRIMARY KEY (`a`); ALTER TABLE `t1` REMOVE PARTITIONING; CHECK TABLE `t1` EXTENDED; DROP TABLE t1; + +--echo # +--echo # MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread +--echo # +CREATE TABLE t1 (a INT); + +CREATE TABLE t2 (b INT, c varchar(5)) + PARTITION BY RANGE COLUMNS(c) + SUBPARTITION by key(b) SUBPARTITIONS 2 ( + PARTITION p0 VALUES LESS THAN ('m'), + PARTITION p1 VALUES LESS THAN ('z') + ); + +--connect (con1,localhost,root,,) +HANDLER t1 OPEN; +--send + SELECT b FROM t2 PARTITION (p0); + +--connection default +SET lock_wait_timeout= 1; +--error 0,ER_STATEMENT_TIMEOUT,ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 FORCE; + +--connection con1 +--reap +--disconnect con1 +--connection default +DROP TABLE t2, t1; diff --git a/mysql-test/main/skip_grants.result b/mysql-test/main/skip_grants.result index 6fc3a5b790e..46e93cc79f3 100644 --- a/mysql-test/main/skip_grants.result +++ b/mysql-test/main/skip_grants.result @@ -138,6 +138,14 @@ drop user baz@baz; # End of 10.3 tests # # +# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +# +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +DROP PROCEDURE p; +DROP FUNCTION f; +# End of 10.5 tests +# # MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES # SELECT @@skip_grant_tables AS EXPECT_1; diff --git a/mysql-test/main/skip_grants.test b/mysql-test/main/skip_grants.test index 999a716c911..228fa6459d8 100644 --- a/mysql-test/main/skip_grants.test +++ b/mysql-test/main/skip_grants.test @@ -168,6 +168,17 @@ drop user baz@baz; --echo # End of 10.3 tests --echo # +--echo # +--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +--echo # +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; + +DROP PROCEDURE p; +DROP FUNCTION f; + +--echo # End of 10.5 tests + --echo # --echo # MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES --echo # diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result index 7c4d13485c2..953db05dfc7 100644 --- a/mysql-test/main/sp-bugs.result +++ b/mysql-test/main/sp-bugs.result @@ -388,5 +388,14 @@ ERROR 23000: Column 'c2' in FROM is ambiguous DROP PROCEDURE p2; DROP TABLE t1, t2; # +# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +# +# This test is a duplicate of the one located in the file skip_grants.test +# and placed here to check the same test case against embedded-server +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +DROP PROCEDURE p; +DROP FUNCTION f; +# # End of 10.5 tests # diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test index f44216fbf46..9a4b867a92b 100644 --- a/mysql-test/main/sp-bugs.test +++ b/mysql-test/main/sp-bugs.test @@ -414,6 +414,26 @@ CALL p2 (@a,@c); DROP PROCEDURE p2; DROP TABLE t1, t2; +--echo # +--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +--echo # +--echo # This test is a duplicate of the one located in the file skip_grants.test +--echo # and placed here to check the same test case against embedded-server + +# Disable warnings before running the following CREATE PROCEDURE/FUNCTION +# statement since the warning message +# "The user specified as a definer ('a'@'%') does not exist" +# is output in case the test be run against a regular server +# and isn't output if embedded server is used (@sa sp_process_definer() +# in sql_parse.cc). +--disable_warnings +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +--enable_warnings + +DROP PROCEDURE p; +DROP FUNCTION f; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index e80f93be420..20ae8bb3b15 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -2295,6 +2295,47 @@ SELECT 1 LIKE 2 ESCAPE a; END; $$ ERROR 21000: Operand should contain 1 column(s) +# Start of 10.6 tests +# +# MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const +# +CREATE PROCEDURE p0 (IN a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN +BEGIN +RETURN FALSE; +END; +/ +PREPARE s0 FROM 'SELECT f0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP FUNCTION f0; +# End of 10.6 tests # # Start of 11.7 tests # diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test index fb302d12cb0..c6c482dbde5 100644 --- a/mysql-test/main/sp-row.test +++ b/mysql-test/main/sp-row.test @@ -1534,6 +1534,67 @@ $$ DELIMITER ;$$ +--echo # Start of 10.6 tests + + +--echo # +--echo # MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const +--echo # + +DELIMITER /; +CREATE PROCEDURE p0 (IN a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN +BEGIN + RETURN FALSE; +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'SELECT f0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP FUNCTION f0; + +--echo # End of 10.6 tests + + --echo # --echo # Start of 11.7 tests --echo # diff --git a/mysql-test/main/temp_table_frm.result b/mysql-test/main/temp_table_frm.result index a9c59ff5969..e54d91bf940 100644 --- a/mysql-test/main/temp_table_frm.result +++ b/mysql-test/main/temp_table_frm.result @@ -25,3 +25,9 @@ OPENED_VIEWS 0 set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; +# +# MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir +# +create table t1 (c int); +drop table t1; +# restart diff --git a/mysql-test/main/temp_table_frm.test b/mysql-test/main/temp_table_frm.test index 47d2fc40d20..1f36238f418 100644 --- a/mysql-test/main/temp_table_frm.test +++ b/mysql-test/main/temp_table_frm.test @@ -24,4 +24,15 @@ select variable_name, session_status.variable_value - t1.variable_value from information_schema.session_status join t1 using (variable_name); set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; -drop table t1; \ No newline at end of file +drop table t1; + +--echo # +--echo # MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir +--echo # + +create table t1 (c int); +let $MYSQLD_TMPDIR=`SELECT @@tmpdir`; +let $MYSQLD_DATADIR=`SELECT @@datadir`; +--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_TMPDIR/#sqlt1.frm +drop table t1; +--source include/restart_mysqld.inc diff --git a/mysql-test/main/timezone.test b/mysql-test/main/timezone.test index 0fa50b7f666..fb03889f541 100644 --- a/mysql-test/main/timezone.test +++ b/mysql-test/main/timezone.test @@ -8,7 +8,7 @@ select FROM_UNIXTIME(24*3600); enable_query_log; # The following is because of daylight saving time ---replace_result MEST CET MET CET +--replace_result MEST CET MET CET CEST CET show variables like "system_time_zone"; --echo # diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 54e02c18320..1a2394fdc36 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -2233,6 +2233,9 @@ sub environment_setup { { $ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mariadb-install-db", "$bindir/bin/mariadb-install-db"); + $ENV{'MARIADB_UPGRADE_SERVICE_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mariadb-upgrade-service", + "$bindir/bin/mariadb-upgrade-service"); + $ENV{'MARIADB_UPGRADE_EXE'}= mtr_exe_exists("$path_client_bindir/mariadb-upgrade"); } my $client_config_exe= @@ -4495,6 +4498,7 @@ sub extract_warning_lines ($$) { qr/InnoDB: innodb_open_files .* should not be greater than/, qr/InnoDB: Trying to delete tablespace.*but there are.*pending/, qr/InnoDB: Tablespace 1[0-9]* was not found at .*, and innodb_force_recovery was set/, + qr/InnoDB: Long wait \([0-9]+ seconds\) for double-write buffer flush/, qr/Slave: Unknown table 't1' .* 1051/, qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/, qr/slave SQL thread aborted/, diff --git a/mysql-test/std_data/galera_certs/galera.root.crt b/mysql-test/std_data/galera_certs/galera.root.crt index e965d5a26d6..70f1265426c 100644 --- a/mysql-test/std_data/galera_certs/galera.root.crt +++ b/mysql-test/std_data/galera_certs/galera.root.crt @@ -2,7 +2,7 @@ MIIFlTCCA32gAwIBAgIUKCF88W+48rZzdfgYpE2dXVMGSKgwDQYJKoZIhvcNAQEL BQAwWjELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhI ZWxzaW5raTEPMA0GA1UECgwGR2FsZXJhMRQwEgYDVQQDDAtnYWxlcmEucm9vdDAe -Fw0yMTAyMDQxMzE3MDJaFw0yMzExMjUxMzE3MDJaMFoxCzAJBgNVBAYTAkZJMREw +Fw0yMzEyMDExMzQzNDBaFw0zMzExMjgxMzQzNDBaMFoxCzAJBgNVBAYTAkZJMREw DwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kxDzANBgNVBAoMBkdh bGVyYTEUMBIGA1UEAwwLZ2FsZXJhLnJvb3QwggIiMA0GCSqGSIb3DQEBAQUAA4IC DwAwggIKAoICAQDKqL45jbaq8RLOj+DeilPcEnBN5gn/y9V3IfZ0BQCd4bR09zLz @@ -18,15 +18,15 @@ dl5QYYMbmyNedNKdwV4idhGCy+Zq7VAX4lBXazI1rD9vQb+oTcPGQiy4i/Vi/g6i F+XZTdTiaOWPEmvFFGLLUQxKl4w872hJaupqfteqdiZ+3ICVIUI8qnXHmwIDAQAB o1MwUTAdBgNVHQ4EFgQUs75v/MgjJ5RHGE6+0qdiVo4BwlowHwYDVR0jBBgwFoAU s75v/MgjJ5RHGE6+0qdiVo4BwlowDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B -AQsFAAOCAgEAOVhBs28dwwvD5q2r7oVVcxLc+tb8zu4XxpXT1p6hiZYUyPguCh00 -GVdXCgR4JMI/NcyM5fBAbF3S8oK3+9rw2kW09afVV06Qf/8o3nIyOiDl7598tGIP -CCK4QsUW/dGajx5kvhtQ7qce+u9KfFTof6lq2xkYtFBBhmBdSv9A1jAZJMw2x3bc -nr99PS8XZMphS0MIExHKj6Ry5DdYm722zZHyIEiiEGyMViDm2m1iug5r/LPH5Z56 -BjQiH4VP+0y5mevBOUGuH8ID+J9Hu9BeoXLhkv+W2Ljs/S6wqzjinMBqVG+wwe0Y -a8F5pABkl5uX38nMQ7CikSbLxSbn7nRf+sux1sbzqjMldeCSqiv9mI5Ysq97+Ni1 -5qMxNxNc0u/wGRnrXH8fWfxBKPP5moA7DQfVcUWPgDGQwDpA8kn8RlJxFk3g4yaK -+NMwk5MORKyx3tz/A3Yhs9AUXk3okvmQCT2YVSHcKUB8PAU+TaKqbr3wk07Y/tL/ -jFPHS+t3eD91Y05KGUXjdtGi+33zpV0biHmTWAZT78VQowDNvEpTnXhkSx8HGHYR -nqSMU2m2LboHSatY113RYznx0LJ1azczRlJdGs8oyPWLPDD2JCesZaQqGZVRJoms -lK4EzYEb5mZTCRgtgoiO+iKcf6XifuOCrWZXoLm4FlLEfOQ3b8yAFlo= +AQsFAAOCAgEAKLV6mkWb88HEJXo1XlmAzznIYNfilrvvxwcjhceluDE8s8sPSpYM +Bz5ebWlHCgEkC/ezhA/PDtZsZlQKwv4jb++lAlFSlebT1GW77xKkdRBTKgkFAaOA +pF5eZao6IP8l76fA4OoI2Tttw5jeb23kOoklDp/8VS0JEAT3wm/hZiE20aUbAFC+ +kPiCucBztzaTHQud9CgtxRH/B3D9FaPuwae/H6FYrvQVNVjcaHTIUh9fTcyKRXYm +oYbvK7fIhCjZkG2LRWRU9Kirivb+ktO4POsuK4BgYrsFaOBf9HYsojA7llyGDopN +cfw9jtb27Qb/uMKJnClFg14u685CU5JAzY31E5OQPPUUx9PqP4Z9PgXRQ0xI6H/4 +sejlcQuqGCDKiL2lOzUjbT86EjO4ZfiKHR+lKOIuT5mXiR8cbS1JeyX3Mrv1Ds4r +UVcdtSXTy6/XYWFIzhu+MrsFon6VX0HkmSH1HjSoLMOZcHAZIFZZ/uAahLmMNaEG +lV15fD5+t5QRKwqmdFUW2ETiqSJxRs6Y++ptxpiiH38QVWPvBWeRgcPpf3A478Bl +iGO0xn0N57TnhFs3g0C0xyZgTBMozfVostYpps1Tqqz0VOhtmURxTZm9JZgTb7qv +nMURY0SIQKXpHCcJuNtxZcDSu8uxgUcMsLSSC7Zmk7/cSeUfmOgZVzU= -----END CERTIFICATE----- diff --git a/mysql-test/suite/atomic/alter_table.test b/mysql-test/suite/atomic/alter_table.test index 8f590e59175..8a1caae1a76 100644 --- a/mysql-test/suite/atomic/alter_table.test +++ b/mysql-test/suite/atomic/alter_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_log_bin.inc diff --git a/mysql-test/suite/atomic/create_table.test b/mysql-test/suite/atomic/create_table.test index 2e58a2b58bf..5998e316121 100644 --- a/mysql-test/suite/atomic/create_table.test +++ b/mysql-test/suite/atomic/create_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_sequence.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/atomic/drop_table.test b/mysql-test/suite/atomic/drop_table.test index 6e6598928a1..463130f73ff 100644 --- a/mysql-test/suite/atomic/drop_table.test +++ b/mysql-test/suite/atomic/drop_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_csv.inc diff --git a/mysql-test/suite/atomic/rename_table.test b/mysql-test/suite/atomic/rename_table.test index 0dcd39f819a..2e3eb043851 100644 --- a/mysql-test/suite/atomic/rename_table.test +++ b/mysql-test/suite/atomic/rename_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_csv.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master.test b/mysql-test/suite/binlog_encryption/encrypted_master.test index f6fc172c79e..1539ad29f00 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master.test +++ b/mysql-test/suite/binlog_encryption/encrypted_master.test @@ -18,6 +18,7 @@ # - with annotated events, default checksums and minimal binlog row image # +--source include/long_test.inc # The test can take very long time with valgrind --source include/not_valgrind.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result index d05e3abd068..be7c9b819ff 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result @@ -59,6 +59,9 @@ INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; connection server_2; start slave; include/wait_for_slave_io_error.inc [errno=1236] +SELECT MASTER_GTID_WAIT("LAST_UNENCRYPTED_GTID", 60); +MASTER_GTID_WAIT("LAST_UNENCRYPTED_GTID", 60) +0 # Ensuring slave was unable to replicate any encrypted transactions.. # ..success SHOW TABLES; diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test index 7f717190cbf..f95262d99b2 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test @@ -122,6 +122,13 @@ start slave; --let $slave_io_errno= 1236 --source include/wait_for_slave_io_error.inc +# Wait for the SQL thread to have replicated to the expected point. Otherwise +# there is a race where the IO thread can stop with error and the test case +# check the @@GLOBAL.gtid_slave_pos before the SQL thread has had time to +# replicate the events queued by the IO thread (MDEV-36424). +--replace_result "$last_unencrypted_gtid" "LAST_UNENCRYPTED_GTID" +eval SELECT MASTER_GTID_WAIT("$last_unencrypted_gtid", 60); + --echo # Ensuring slave was unable to replicate any encrypted transactions.. --let $gsp= `SELECT @@global.gtid_slave_pos` if (`SELECT strcmp("$gsp","$last_unencrypted_gtid")`) diff --git a/mysql-test/suite/encryption/r/doublewrite_debug.result b/mysql-test/suite/encryption/r/doublewrite_debug.result index b289df9f77d..a4d4995b332 100644 --- a/mysql-test/suite/encryption/r/doublewrite_debug.result +++ b/mysql-test/suite/encryption/r/doublewrite_debug.result @@ -3,8 +3,9 @@ call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page "); 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"); -create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; -create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; +create table t1 (f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=yes stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb encrypted=yes stats_persistent=0; +create table t3(f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=no stats_persistent=0; start transaction; insert into t1 values(1, repeat('#',12)); insert into t1 values(2, repeat('+',12)); @@ -12,29 +13,37 @@ insert into t1 values(3, repeat('/',12)); insert into t1 values(4, repeat('-',12)); insert into t1 values(5, repeat('.',12)); insert into t2 select * from t1; +insert into t3 select * from t1; commit work; SET GLOBAL innodb_fast_shutdown = 0; # restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; +select space into @t3_space_id from information_schema.innodb_sys_tablespaces where name='test/t3'; begin; insert into t1 values (6, repeat('%', 400)); insert into t2 values (6, repeat('%', 400)); +insert into t3 values (6, repeat('%', 400)); # xtrabackup prepare set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t1_space_id; set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t2_space_id; +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t3_space_id; set global innodb_buf_flush_list_now = 1; # Kill the server # restart -FOUND 2 /InnoDB: Recovered page \[page id: space=[1-9]*, page number=3\]/ in mysqld.1.err +FOUND 3 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\]/ in mysqld.1.err check table t1; Table Op Msg_type Msg_text test.t1 check status OK check table t2; Table Op Msg_type Msg_text test.t2 check status OK +check table t3; +Table Op Msg_type Msg_text +test.t3 check status OK select f1, f2 from t1; f1 f2 1 ############ @@ -49,6 +58,13 @@ f1 f2 3 //////////// 4 ------------ 5 ............ +select f1, f2 from t3; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ SET GLOBAL innodb_fast_shutdown = 0; # shutdown server # remove datadir @@ -78,4 +94,4 @@ f1 f2 3 //////////// 4 ------------ 5 ............ -drop table t2, t1; +drop table t3, t2, t1; diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.opt b/mysql-test/suite/encryption/t/doublewrite_debug.opt index ed86654270b..827b043547b 100644 --- a/mysql-test/suite/encryption/t/doublewrite_debug.opt +++ b/mysql-test/suite/encryption/t/doublewrite_debug.opt @@ -1,3 +1,3 @@ --innodb-use-atomic-writes=0 ---innodb-encrypt-tables=FORCE +--innodb-encrypt-tables=on --innodb_sys_tablespaces diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.test b/mysql-test/suite/encryption/t/doublewrite_debug.test index 761f9cd3e47..4f221524044 100644 --- a/mysql-test/suite/encryption/t/doublewrite_debug.test +++ b/mysql-test/suite/encryption/t/doublewrite_debug.test @@ -12,8 +12,9 @@ let INNODB_PAGE_SIZE=`select @@innodb_page_size`; let MYSQLD_DATADIR=`select @@datadir`; let ALGO=`select @@innodb_checksum_algorithm`; -create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; -create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; +create table t1 (f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=yes stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb encrypted=yes stats_persistent=0; +create table t3(f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=no stats_persistent=0; start transaction; insert into t1 values(1, repeat('#',12)); @@ -22,6 +23,7 @@ insert into t1 values(3, repeat('/',12)); insert into t1 values(4, repeat('-',12)); insert into t1 values(5, repeat('.',12)); insert into t2 select * from t1; +insert into t3 select * from t1; commit work; # Slow shutdown and restart to make sure ibuf merge is finished @@ -33,15 +35,17 @@ let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_fl select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; +select space into @t3_space_id from information_schema.innodb_sys_tablespaces where name='test/t3'; begin; insert into t1 values (6, repeat('%', 400)); insert into t2 values (6, repeat('%', 400)); +insert into t3 values (6, repeat('%', 400)); -# Copy the t1.ibd, t2.ibd file +# Copy the t1.ibd, t2.ibd, t3.ibd file let $targetdir=$MYSQLTEST_VARDIR/tmp/backup_1; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --skip-innodb-log-checkpoint-now --target-dir=$targetdir; --enable_result_log echo # xtrabackup prepare; @@ -54,8 +58,11 @@ set global innodb_fil_make_page_dirty_debug = @t1_space_id; set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t2_space_id; +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t3_space_id; + set global innodb_buf_flush_list_now = 1; ---let CLEANUP_IF_CHECKPOINT=drop table t1, t2, unexpected_checkpoint; +--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, t3, unexpected_checkpoint; --source ../../suite/innodb/include/no_checkpoint_end.inc # Corrupt the page 3 in t1.ibd, t2.ibd file perl; @@ -103,19 +110,30 @@ binmode FILE; sysseek(FILE, 3*$page_size, 0); print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); close FILE; + +# Zero the complete page +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t3.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +sysseek(FILE, 3*$page_size, 0); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; EOF # Successful recover from doublewrite buffer let $restart_parameters=; --source include/start_mysqld.inc let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9]*, page number=3\\]; +let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9][0-9]*, page number=3\\]; --source include/search_pattern_in_file.inc check table t1; check table t2; +check table t3; select f1, f2 from t1; select f1, f2 from t2; +select f1, f2 from t3; SET GLOBAL innodb_fast_shutdown = 0; let $shutdown_timeout=; @@ -220,4 +238,4 @@ select * from t1; --source ../../mariabackup/include/restart_and_restore.inc select * from t1; -drop table t2, t1; +drop table t3, t2, t1; diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt index 70797302d01..788e69a612d 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt +++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt @@ -1,2 +1,2 @@ ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M --innodb_encrypt_temporary_tables=1 diff --git a/mysql-test/suite/engines/iuds/r/insert_time.result b/mysql-test/suite/engines/iuds/r/insert_time.result index fdda49a36c1..5bfc3b7893b 100644 --- a/mysql-test/suite/engines/iuds/r/insert_time.result +++ b/mysql-test/suite/engines/iuds/r/insert_time.result @@ -5073,10 +5073,14 @@ ERROR 23000: Duplicate entry '825:23:00' for key 'c2' INSERT INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /* throws error as row exists with c1='34 9:23',c2='34 9:23' */; ERROR 23000: Duplicate entry '825:23:00-825:23:00' for key 'idx' INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:33','10:22:34') /* doesn't throw error */; +Warnings: +Warning 1062 Duplicate entry '10:22:33' for key 'PRIMARY' INSERT IGNORE INTO t2(c1,c2) VALUES('12:34:56.78','12:34:56.78') /*doesn't throw error */; Warnings: Warning 1062 Duplicate entry '12:34:56-12:34:56' for key 'PRIMARY' INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:34','34 9:23') /*doesn't throw error */; +Warnings: +Warning 1062 Duplicate entry '825:23:00' for key 'c2' INSERT IGNORE INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /*doesn't throw error */; Warnings: Warning 1062 Duplicate entry '825:23:00-825:23:00' for key 'idx' diff --git a/mysql-test/suite/funcs_2/t/innodb_charset.test b/mysql-test/suite/funcs_2/t/innodb_charset.test index 631c20352d4..c91a9c4d5d6 100644 --- a/mysql-test/suite/funcs_2/t/innodb_charset.test +++ b/mysql-test/suite/funcs_2/t/innodb_charset.test @@ -6,7 +6,7 @@ # Checking of other prerequisites is in charset_master.test # ################################################################################ ---source include/no_valgrind_without_big.inc +--source include/long_test.inc --source include/have_innodb.inc # Starting with MariaDB 10.6, ensure that DDL recovery will have completed diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 96491b5fbf8..23bf40c409a 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,5 +10,7 @@ # ############################################################################## -galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED -MDEV-26266 : MDEV-26266 +galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan +galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan +MW-329 : MDEV-35951 Complete freeze during MW-329 test +galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index 442a8a130e5..072664c4b34 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -17,7 +17,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -28,7 +28,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf index e590160df50..0dd1182bb56 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_master.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf @@ -25,7 +25,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -38,7 +38,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf b/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf index 714caf6ee67..570eeda0bc6 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf index 879699efb02..c4a91e4650d 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf index 7c4d7e40b7b..00bb137f076 100644 --- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -50,7 +50,7 @@ server-id=3 #sst_port=@OPT.port wsrep-provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf index 3d96a504340..3d1278a24cf 100644 --- a/mysql-test/suite/galera/galera_4nodes.cnf +++ b/mysql-test/suite/galera/galera_4nodes.cnf @@ -18,7 +18,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -30,7 +30,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -42,7 +42,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' @@ -54,7 +54,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc index 216c689ec8c..a6ce62b5d8e 100644 --- a/mysql-test/suite/galera/include/auto_increment_offset_save.inc +++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc @@ -42,4 +42,3 @@ if ($node_4) --connection $node_4 let $auto_increment_offset_node_4 = `SELECT @@global.auto_increment_offset`; } - diff --git a/mysql-test/suite/galera/include/galera_dump_sr_table.inc b/mysql-test/suite/galera/include/galera_dump_sr_table.inc index 1e6ff5548d2..91dcf8be46f 100644 --- a/mysql-test/suite/galera/include/galera_dump_sr_table.inc +++ b/mysql-test/suite/galera/include/galera_dump_sr_table.inc @@ -25,4 +25,3 @@ while ($seqno <= $sr_max) --inc $seqno } - diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc index 7492e9f3579..1f7371704e6 100644 --- a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc +++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc @@ -118,4 +118,3 @@ SELECT * from t1; SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; DROP TABLE t1; COMMIT; - diff --git a/mysql-test/suite/galera/include/galera_start_replication.inc b/mysql-test/suite/galera/include/galera_start_replication.inc index b9b201106d7..fd208742d86 100644 --- a/mysql-test/suite/galera/include/galera_start_replication.inc +++ b/mysql-test/suite/galera/include/galera_start_replication.inc @@ -41,9 +41,9 @@ perl; my $counter = 1000; #my $found = false - + while ($counter > 0) { - + open(FILE, "$logfile") or die("Unable to open $logfile : $!\n"); my $new_sync_count = () = grep(/Synchronized with group/g,); close(FILE); diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index efe803dcc9f..1f1427a68e6 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -9,14 +9,14 @@ if (!$wsrep_recover_additional) } --perl - use strict; + use strict; my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position); die if $wsrep_start_position eq ''; - open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n"; close FILE; EOF diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result index 99e875d15c3..5c1f81f90e9 100644 --- a/mysql-test/suite/galera/r/GAL-401.result +++ b/mysql-test/suite/galera/r/GAL-401.result @@ -24,6 +24,6 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DROP TABLE t1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_1; SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/r/MDEV-20225.result b/mysql-test/suite/galera/r/MDEV-20225.result index 245051309d1..47c21249c8d 100644 --- a/mysql-test/suite/galera/r/MDEV-20225.result +++ b/mysql-test/suite/galera/r/MDEV-20225.result @@ -15,7 +15,7 @@ connection node_2a; SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; connection node_2; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation diff --git a/mysql-test/suite/galera/r/MDEV-20793.result b/mysql-test/suite/galera/r/MDEV-20793.result index feb068f258f..d37c0b79165 100644 --- a/mysql-test/suite/galera/r/MDEV-20793.result +++ b/mysql-test/suite/galera/r/MDEV-20793.result @@ -41,4 +41,4 @@ connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction SET debug_sync = "RESET"; DROP TABLE t1; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/r/MDEV-21479.result b/mysql-test/suite/galera/r/MDEV-21479.result index de00413bdcc..2a583d705cf 100644 --- a/mysql-test/suite/galera/r/MDEV-21479.result +++ b/mysql-test/suite/galera/r/MDEV-21479.result @@ -66,7 +66,7 @@ SHOW STATUS LIKE 'wsrep_desync_count'; Variable_name Value wsrep_desync_count 0 SET @@global.wsrep_desync = 0; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_1; # Wait until both nodes are back to cluster SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/r/MDEV-25389.result b/mysql-test/suite/galera/r/MDEV-25389.result index f369fe4dbae..fe3975fe163 100644 --- a/mysql-test/suite/galera/r/MDEV-25389.result +++ b/mysql-test/suite/galera/r/MDEV-25389.result @@ -15,3 +15,4 @@ SET GLOBAL wsrep_slave_threads=1; SELECT @@wsrep_slave_threads; @@wsrep_slave_threads 1 +connection node_2; diff --git a/mysql-test/suite/galera/r/MDEV-26266.result b/mysql-test/suite/galera/r/MDEV-26266.result index 01171d4bb83..49efd893539 100644 --- a/mysql-test/suite/galera/r/MDEV-26266.result +++ b/mysql-test/suite/galera/r/MDEV-26266.result @@ -19,5 +19,5 @@ INSERT INTO t2 VALUES (3); INSERT INTO t2 VALUES (4); INSERT INTO t2 VALUES (5); CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP VIEW v1; DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/r/MDEV-33136.result b/mysql-test/suite/galera/r/MDEV-33136.result index 36159fa05cd..fb9945235d6 100644 --- a/mysql-test/suite/galera/r/MDEV-33136.result +++ b/mysql-test/suite/galera/r/MDEV-33136.result @@ -4,7 +4,7 @@ connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; connection node_1a; -TRUNCATE TABLE t1; +RENAME TABLE t1 TO tmp, tmp TO t1; SET SESSION wsrep_retry_autocommit = 0; SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort'; INSERT INTO t1 VALUES (1); diff --git a/mysql-test/suite/galera/r/MDEV-34647.result b/mysql-test/suite/galera/r/MDEV-34647.result index 0333f14ece1..0bdab65d963 100644 --- a/mysql-test/suite/galera/r/MDEV-34647.result +++ b/mysql-test/suite/galera/r/MDEV-34647.result @@ -95,7 +95,6 @@ id val 4 d 5 d 6 d -set global wsrep_mode=default; connection node_1; drop table t1,t2,t3,t4,t5; set global wsrep_mode=default; diff --git a/mysql-test/suite/galera/r/MDEV-35946.result b/mysql-test/suite/galera/r/MDEV-35946.result index 1ebc88c1a48..5933f7fcfba 100644 --- a/mysql-test/suite/galera/r/MDEV-35946.result +++ b/mysql-test/suite/galera/r/MDEV-35946.result @@ -13,4 +13,4 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME VARIABLE_VALUE Primary SET SESSION wsrep_sync_wait=DEFAULT; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera/r/MDEV-36116.result b/mysql-test/suite/galera/r/MDEV-36116.result new file mode 100644 index 00000000000..fe992d118f0 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-36116.result @@ -0,0 +1,22 @@ +connection node_2; +connection node_1; +connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1; +connection node_1; +CALL mtr.add_suppression("CREATE TABLE isolation failure"); +SET DEBUG_SYNC = 'wsrep_kill_thd_before_enter_toi SIGNAL may_kill WAIT_FOR continue'; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR may_kill'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1; +Got one of the listed errors +connection node_2; +SHOW TABLES LIKE 't1'; +Tables_in_test (t1) +connection con1; +SHOW TABLES LIKE 't1'; +Tables_in_test (t1) +SET DEBUG_SYNC = 'RESET'; +disconnect con1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index ba8b67e9c31..d03948fe28f 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -13,7 +13,7 @@ connection node_3; SELECT @@wsrep_on; @@wsrep_on 0 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; include/wait_for_slave_param.inc [Slave_IO_Running] connection node_1; diff --git a/mysql-test/suite/galera/r/MW-329.result b/mysql-test/suite/galera/r/MW-329.result index 16afcc15996..37a97f57f98 100644 --- a/mysql-test/suite/galera/r/MW-329.result +++ b/mysql-test/suite/galera/r/MW-329.result @@ -18,5 +18,6 @@ connection node_1b; connection node_1; DROP PROCEDURE proc_insert; DROP TABLE t1; +disconnect node_1b; CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); set global innodb_status_output=Default; diff --git a/mysql-test/suite/galera/r/MW-329F.result b/mysql-test/suite/galera/r/MW-329F.result new file mode 100644 index 00000000000..bdde55cba63 --- /dev/null +++ b/mysql-test/suite/galera/r/MW-329F.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; +INSERT INTO t1 (f1) VALUES (1),(65535); +CREATE PROCEDURE proc_insert (repeat_count int) +BEGIN +DECLARE current_num int; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +SET current_num = 0; +SET SESSION wsrep_sync_wait = 0; +WHILE current_num < repeat_count do +INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 )); +SELECT SLEEP(0.1); +SET current_num = current_num + 1; +END WHILE; +END| +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; +connection node_1b; +connection node_1; +DROP PROCEDURE proc_insert; +DROP TABLE t1; +disconnect node_1b; +CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); +set global innodb_status_output=Default; diff --git a/mysql-test/suite/galera/r/MW-416.result b/mysql-test/suite/galera/r/MW-416.result index 98a72c8d46b..4c88808c2c8 100644 --- a/mysql-test/suite/galera/r/MW-416.result +++ b/mysql-test/suite/galera/r/MW-416.result @@ -20,13 +20,13 @@ ALTER VIEW vw AS SELECT 1; Got one of the listed errors CREATE DATABASE db; Got one of the listed errors -CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; +CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; Got one of the listed errors CREATE FUNCTION fun1() RETURNS int RETURN(1); Got one of the listed errors CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; Got one of the listed errors -CREATE PROCEDURE proc1() BEGIN END; +CREATE PROCEDURE proc1() BEGIN END; Got one of the listed errors CREATE INDEX idx ON tbl(id); Got one of the listed errors @@ -100,3 +100,4 @@ mysql performance_schema sys test +disconnect userMW416; diff --git a/mysql-test/suite/galera/r/galera_2primary_replica.result b/mysql-test/suite/galera/r/galera_2primary_replica.result index 8bdbf5be962..9901caa9eb6 100644 --- a/mysql-test/suite/galera/r/galera_2primary_replica.result +++ b/mysql-test/suite/galera/r/galera_2primary_replica.result @@ -13,10 +13,13 @@ grant all on *.* to repl2@'%'; connect replica, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection replica; connection node_2; +connection primary1; +connection primary2; connection replica; # Galera replica changing master to primary1 -SET @@default_master_connection='stream2'; +SET @@default_master_connection='stream1'; # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; START ALL SLAVES; Warnings: Note 1937 SLAVE 'stream1' started diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result index f29c83cad95..98a133c32bc 100644 --- a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result +++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result @@ -26,3 +26,4 @@ COUNT(*) = 1 1 DROP TABLE t1; connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result index 57e28bc236f..f0ec2ef741a 100644 --- a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result +++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result @@ -13,7 +13,7 @@ connection node_1; SELECT 1 FROM DUAL; 1 1 -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); COUNT(*) = 1 1 UNLOCK TABLES; @@ -25,7 +25,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL, PRIMARY KEY (`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); COUNT(*) = 0 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result index fefc988d9d4..969e844577e 100644 --- a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result +++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result @@ -27,7 +27,7 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Transport endpoint is not connected"); +CALL mtr.add_suppression("(Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); connection node_4; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result deleted file mode 100644 index 2a2ddd519f4..00000000000 --- a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result +++ /dev/null @@ -1,685 +0,0 @@ -SET SESSION wsrep_sync_wait = 0; -galera_sr_bf_abort_at_commit = 0 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -galera_sr_bf_abort_at_commit = 1 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -galera_sr_bf_abort_at_commit = 1 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -CALL mtr.add_suppression("WSREP: fragment replication failed: 1"); diff --git a/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result index fa0568035a6..cb94099a1e4 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result @@ -53,7 +53,7 @@ FOUND 2 /Resuming and resyncing the provider/ in mysqld.2.err FOUND 1 /Server not desynched from group at BLOCK_DDL because WSREP_MODE_BF_MARIABACKUP is used./ in mysqld.2.err # Should return FOUND 1 as server did desync and pause at BLOCK_COMMIT FOUND 1 /Server desynched from group during BACKUP STAGE BLOCK_COMMIT./ in mysqld.2.err -SET GLOBAL wsrep_mode = ""; +SET GLOBAL wsrep_mode = DEFAULT; connection node_1; DROP TABLE t; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff index e02acc3de08..098ce2b28a1 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff @@ -1,5 +1,5 @@ ---- a/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.result -+++ b/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.reject +--- r/galera_bf_kill.result ++++ r/galera_bf_kill,debug.reject @@ -77,4 +77,34 @@ a b 5 2 disconnect node_2a; diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result index 3bd0bf42f96..7a56eaefe1d 100644 --- a/mysql-test/suite/galera/r/galera_binlog_checksum.result +++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result @@ -27,4 +27,5 @@ i 1 connection node_1; DROP TABLE t1; +SET @@global.wsrep_mode=DEFAULT; # End of tests. diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 4fe33674701..78f3bd6f9d3 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,11 +1,11 @@ connection node_2; connection node_1; connection node_1; +connection node_2; +connection node_1; SET GLOBAL auto_increment_offset=1; connection node_2; SET GLOBAL auto_increment_offset=2; -connection node_1; -connection node_2; connection node_2; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_circular_replication.result b/mysql-test/suite/galera/r/galera_circular_replication.result index 72340977005..0094283d40b 100644 --- a/mysql-test/suite/galera/r/galera_circular_replication.result +++ b/mysql-test/suite/galera/r/galera_circular_replication.result @@ -12,6 +12,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection replica1; connection node_2; connection primary2; +connection primary1; connection replica1; # Galera replica changing master to primary1 START SLAVE; diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result index 226aebde69e..cf0f1bf8e24 100644 --- a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result +++ b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result @@ -298,6 +298,7 @@ DROP TABLE p1, p2; ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); @@ -491,6 +492,7 @@ Note 1051 Unknown table 'test.tmp1,test.tmp2' ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); @@ -684,6 +686,7 @@ Note 1051 Unknown table 'test.tmp1,test.tmp2' ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index 56c45b71632..3a82297d4a3 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -1,6 +1,9 @@ connection node_2; connection node_1; # Correct Galera library found +SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; +expect 49 +49 SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%' diff --git a/mysql-test/suite/galera/r/galera_event_node_evict.result b/mysql-test/suite/galera/r/galera_event_node_evict.result index 62911facd05..81a68adbde3 100644 --- a/mysql-test/suite/galera/r/galera_event_node_evict.result +++ b/mysql-test/suite/galera/r/galera_event_node_evict.result @@ -2,14 +2,14 @@ connection node_2; connection node_1; # Correct Galera library found connection node_1; -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); connection node_2; -CALL mtr.add_suppression("\\[Warning\\] WSREP: handshake with .* .* failed: 'evicted'"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: handshake with .* ?.+ failed: 'evicted'"); CALL mtr.add_suppression("\\[ERROR\\] WSREP: exception from gcomm, backend must be restarted: this node has been evicted out of the cluster, gcomm backend restart is required \\(FATAL\\)"); connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); connection node_1; connection node_2; connection node_3; diff --git a/mysql-test/suite/galera/r/galera_gcs_fragment.result b/mysql-test/suite/galera/r/galera_gcs_fragment.result index bdd749047ee..cac35a78f1c 100644 --- a/mysql-test/suite/galera/r/galera_gcs_fragment.result +++ b/mysql-test/suite/galera/r/galera_gcs_fragment.result @@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send'; connection node_1; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); SELECT * FROM t1; f1 f2 diff --git a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result index eeacc9ab212..9ee8a4893c4 100644 --- a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result +++ b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result @@ -3,8 +3,11 @@ connection node_1; CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); BEGIN; +SET DEBUG_SYNC = 'wsrep_after_statement_enter SIGNAL blocked'; UPDATE t1 set b = 100 where id between 1 and 2;; connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; +SET DEBUG_SYNC = 'wsrep_after_statement_enter CLEAR'; connection node_1b; SET @save_dbug = @@SESSION.debug_dbug; SET @@SESSION.innodb_lock_wait_timeout=2; @@ -20,5 +23,6 @@ id b 1 100 2 100 3 3 +SET DEBUG_SYNC = 'RESET'; disconnect node_1b; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff index 32c3949b1c4..8c84321e774 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -1,5 +1,5 @@ ---- suite/galera/r/galera_ist_MDEV-28423.result -+++ suite/galera/r/galera_ist_MDEV-28423.reject +--- r/galera_ist_MDEV-28423.result ++++ r/galera_ist_MDEV-28423,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff index c1bc37fb202..51d2a6bf157 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -1,5 +1,5 @@ ---- suite/galera/r/galera_ist_MDEV-28583.result -+++ suite/galera/r/galera_ist_MDEV-28583,debug.reject +--- r/galera_ist_MDEV-28583.result ++++ r/galera_ist_MDEV-28583,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff index 3ee121fdefa..d9e88b06701 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff @@ -1,13 +1,12 @@ --- r/galera_ist_mysqldump.result +++ r/galera_ist_mysqldump,debug.reject -@@ -354,11 +354,195 @@ +@@ -354,6 +354,190 @@ 1 DROP TABLE t1; COMMIT; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; @@ -189,12 +188,6 @@ +DROP TABLE t1; +COMMIT; +SET GLOBAL debug_dbug = $debug_orig; -+connection node_1; -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); + connection node_1; + CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff deleted file mode 100644 index 5cd6f4a38a3..00000000000 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff +++ /dev/null @@ -1,15 +0,0 @@ ---- r/galera_ist_mysqldump.result -+++ r/galera_ist_mysqldump.reject -@@ -355,10 +355,10 @@ - DROP TABLE t1; - COMMIT; - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result index 8737819e552..bcb6bce83df 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); +connection node_1; +connection node_2; Setting SST method to mysqldump ... call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127\\.0\\.0\\.1'"); call mtr.add_suppression("Failed to load slave replication state from table mysql\\.gtid_slave_pos"); @@ -9,9 +12,6 @@ GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; connection node_2; SET GLOBAL wsrep_sst_method = 'mysqldump'; -call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); -connection node_1; -connection node_2; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; @@ -355,10 +355,10 @@ COUNT(*) = 0 DROP TABLE t1; COMMIT; connection node_1; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; connection node_2; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_nonPK_and_PA.result b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result index 5ad55417fd1..d440d66e8d7 100644 --- a/mysql-test/suite/galera/r/galera_nonPK_and_PA.result +++ b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result @@ -8,7 +8,7 @@ connection node_2; SET SESSION wsrep_sync_wait = 0; SET GLOBAL wsrep_slave_threads = 2; *************************************************************** -scenario 1, conflicting UPDATE +scenario 1, conflicting UPDATE *************************************************************** SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync'; connection node_1; @@ -31,7 +31,7 @@ SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; *************************************************************** -scenario 2, conflicting DELETE +scenario 2, conflicting DELETE *************************************************************** SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync'; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result index bc61cfb4d6f..b1ba03a8391 100644 --- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result +++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result @@ -10,10 +10,10 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); connection node_2a; SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE 'Commit' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); EXPECT_1 1 -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); EXPECT_1 1 SELECT COUNT(*) AS EXPECT_0 FROM t1; @@ -32,9 +32,8 @@ EXPECT_1 SELECT COUNT(*) AS EXPECT_1 FROM t2; EXPECT_1 1 -SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); EXPECT_2 2 -SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result index cac784cd16f..46b00539fb1 100644 --- a/mysql-test/suite/galera/r/galera_parallel_simple.result +++ b/mysql-test/suite/galera/r/galera_parallel_simple.result @@ -34,6 +34,5 @@ expect_20 SELECT COUNT(*) as expect_20 FROM t2; expect_20 20 -SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_partitioned_tables.result b/mysql-test/suite/galera/r/galera_partitioned_tables.result index 3f24cae1495..425d9bedbd5 100644 --- a/mysql-test/suite/galera/r/galera_partitioned_tables.result +++ b/mysql-test/suite/galera/r/galera_partitioned_tables.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; SELECT @@wsrep_mode; @@ -44,7 +44,7 @@ t1_v2 CREATE TABLE `t1_v2` ( `v2` int(11) DEFAULT NULL, `v3` int(11) DEFAULT NULL, PRIMARY KEY (`v1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PARTITION BY KEY (`v1`) PARTITIONS 2 SHOW CREATE TABLE t2_v2; @@ -54,15 +54,15 @@ t2_v2 CREATE TABLE `t2_v2` ( `v2` int(11) DEFAULT NULL, `v3` int(11) DEFAULT NULL, PRIMARY KEY (`v1`) -) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PARTITION BY KEY (`v1`) PARTITIONS 2 SHOW CREATE VIEW x1; View Create View character_set_client collation_connection -x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2`,`t1_v2`.`v3` AS `v3` from `t1_v2` latin1 latin1_swedish_ci +x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2`,`t1_v2`.`v3` AS `v3` from `t1_v2` utf8mb4 utf8mb4_uca1400_ai_ci SHOW CREATE VIEW x2; View Create View character_set_client collation_connection -x2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x2` AS select `t2_v2`.`v1` AS `v1`,`t2_v2`.`v2` AS `v2`,`t2_v2`.`v3` AS `v3` from `t2_v2` latin1 latin1_swedish_ci +x2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x2` AS select `t2_v2`.`v1` AS `v1`,`t2_v2`.`v2` AS `v2`,`t2_v2`.`v3` AS `v3` from `t2_v2` utf8mb4 utf8mb4_uca1400_ai_ci SELECT * FROM t1_v2; v1 v2 v3 SELECT * FROM t2_v2; @@ -138,7 +138,7 @@ t1_v2 CREATE TABLE `t1_v2` ( `v1` int(11) NOT NULL, `v2` int(11) DEFAULT NULL, PRIMARY KEY (`v1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PARTITION BY KEY (`v1`) PARTITIONS 2 SHOW CREATE TABLE t2; @@ -147,12 +147,12 @@ t2 CREATE TABLE `t2` ( `v1` int(11) NOT NULL, `v2` int(11) DEFAULT NULL, PRIMARY KEY (`v1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PARTITION BY KEY (`v1`) PARTITIONS 2 SHOW CREATE VIEW x1; View Create View character_set_client collation_connection -x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2` from `t1_v2` latin1 latin1_swedish_ci +x1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `x1` AS select `t1_v2`.`v1` AS `v1`,`t1_v2`.`v2` AS `v2` from `t1_v2` utf8mb4 utf8mb4_uca1400_ai_ci SELECT * FROM t1_v2; v1 v2 SELECT * FROM t2; diff --git a/mysql-test/suite/galera/r/galera_restart_replica.result b/mysql-test/suite/galera/r/galera_restart_replica.result index efc9a83a168..1691f9822a8 100644 --- a/mysql-test/suite/galera/r/galera_restart_replica.result +++ b/mysql-test/suite/galera/r/galera_restart_replica.result @@ -7,6 +7,7 @@ grant all on *.* to repl@'%'; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection node_1; connection replica; +connection primary; connection replica; START SLAVE; connection primary; diff --git a/mysql-test/suite/galera/r/galera_sequence_engine.result b/mysql-test/suite/galera/r/galera_sequence_engine.result index 93e6c46bd7a..4539d63621b 100644 --- a/mysql-test/suite/galera/r/galera_sequence_engine.result +++ b/mysql-test/suite/galera/r/galera_sequence_engine.result @@ -1,5 +1,10 @@ connection node_2; connection node_1; +connection node_2; +SET GLOBAL wsrep_ignore_apply_errors=0; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET SESSION wsrep_sync_wait=0; SET GLOBAL wsrep_ignore_apply_errors=0; SET SESSION AUTOCOMMIT=0; SET SESSION max_error_count=0; @@ -8,5 +13,4 @@ ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences i connection node_2; SHOW CREATE TABLE t0; ERROR 42S02: Table 'test.t0' doesn't exist -connection node_1; -SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +disconnect node_2a; diff --git a/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff b/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff new file mode 100644 index 00000000000..425d1175a09 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff @@ -0,0 +1,11 @@ +--- r/galera_sequences.result ++++ r/galera_sequences,binlogoff.reject +@@ -313,7 +313,7 @@ + 7 4 + SELECT NEXTVAL(t); + NEXTVAL(t) +-42 ++2 + connection node_1; + DROP TABLE t1; + DROP SEQUENCE t; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 1f6b2bd6637..7cdeffff1e3 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -47,6 +47,9 @@ select NEXT VALUE FOR Seq1_1; NEXT VALUE FOR Seq1_1 4 connection node_1; +SHOW CREATE SEQUENCE Seq1_1; +Table Create Table +Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB DROP SEQUENCE Seq1_1; connection node_1; CREATE TABLE t2 (d CHAR(1)KEY); @@ -279,6 +282,9 @@ NEXTVAL(t) connection node_1; DROP TABLE t1; DROP SEQUENCE t; +connection node_2; +SET SESSION wsrep_sync_wait=15; +connection node_1; CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; BEGIN; @@ -324,4 +330,14 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ALTER SEQUENCE IF EXISTS t MINVALUE=1; ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster' DROP TABLE t; + +MDEV-32631: + +CREATE OR REPLACE TABLE t1(c INT ) ENGINE=ARIA; +SET SESSION WSREP_OSU_METHOD=RSU; +INSERT INTO t1 SELECT seq,concat(seq,1) FROM seq_1_to_100; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SET SESSION WSREP_OSU_METHOD=TOI; +DROP TABLE t1; + End of 10.5 tests diff --git a/mysql-test/suite/galera/r/galera_sequences_bf_kill.result b/mysql-test/suite/galera/r/galera_sequences_bf_kill.result new file mode 100644 index 00000000000..39d11337b4f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences_bf_kill.result @@ -0,0 +1,152 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +connection node_1; +START TRANSACTION; +INSERT INTO t1 VALUES (4, next value for s); +INSERT INTO t1 VALUES (5, next value for s); +INSERT INTO t1 VALUES (6, next value for s); +INSERT INTO t1 VALUES (7, next value for s); +INSERT INTO t1 VALUES (8, next value for s); +INSERT INTO t1 VALUES (9, next value for s); +INSERT INTO t1 VALUES (10, next value for s); +INSERT INTO t1 VALUES (11, next value for s); +INSERT INTO t1 VALUES (12, next value for s); +INSERT INTO t1 VALUES (13, next value for s); +INSERT INTO t1 VALUES (14, next value for s); +SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; +f1 f2 +1 0 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +INSERT INTO t1 VALUES (2, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +connection node_1; +wsrep_local_replays +1 +INSERT INTO t1 VALUES (22, next value for s); +INSERT INTO t1 VALUES (23, next value for s); +INSERT INTO t1 VALUES (24, next value for s); +INSERT INTO t1 VALUES (25, next value for s); +INSERT INTO t1 VALUES (26, next value for s); +INSERT INTO t1 VALUES (27, next value for s); +INSERT INTO t1 VALUES (28, next value for s); +INSERT INTO t1 VALUES (29, next value for s); +INSERT INTO t1 VALUES (30, next value for s); +INSERT INTO t1 VALUES (31, next value for s); +INSERT INTO t1 VALUES (32, next value for s); +INSERT INTO t1 VALUES (33, next value for s); +INSERT INTO t1 VALUES (34, next value for s); +INSERT INTO t1 VALUES (35, next value for s); +connection node_1; +SELECT * FROM t1; +f1 f2 +1 0 +2 2 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +22 31 +23 33 +24 35 +25 37 +26 39 +27 41 +28 43 +29 45 +30 47 +31 49 +32 51 +33 53 +34 55 +35 57 +SELECT LASTVAL(s); +LASTVAL(s) +57 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 0 +2 2 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +22 31 +23 33 +24 35 +25 37 +26 39 +27 41 +28 43 +29 45 +30 47 +31 49 +32 51 +33 53 +34 55 +35 57 +SELECT LASTVAL(s); +LASTVAL(s) +NULL +connection node_1; +SELECT NEXTVAL(s); +NEXTVAL(s) +59 +connection node_2; +SELECT NEXTVAL(s); +NEXTVAL(s) +62 +DROP SEQUENCE s; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sequences_transaction.result b/mysql-test/suite/galera/r/galera_sequences_transaction.result new file mode 100644 index 00000000000..c1cfdc4aa20 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences_transaction.result @@ -0,0 +1,350 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_1; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; +connection node_2; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; +connection node_2a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; +connection node_1a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; +connection node_2; +SELECT LASTVAL(s); +LASTVAL(s) +40 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +60 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +79 +connection node_1; +SELECT * FROM t1; +f1 f2 +1 1 +3 1 +5 1 +7 1 +9 1 +11 1 +13 1 +15 1 +17 1 +19 1 +22 1 +24 1 +26 1 +28 1 +30 1 +32 1 +34 1 +36 1 +38 1 +40 1 +42 1 +44 1 +46 1 +48 1 +50 1 +52 1 +54 1 +56 1 +58 1 +60 1 +61 1 +63 1 +65 1 +67 1 +69 1 +71 1 +73 1 +75 1 +77 1 +79 1 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 1 +3 1 +5 1 +7 1 +9 1 +11 1 +13 1 +15 1 +17 1 +19 1 +22 1 +24 1 +26 1 +28 1 +30 1 +32 1 +34 1 +36 1 +38 1 +40 1 +42 1 +44 1 +46 1 +48 1 +50 1 +52 1 +54 1 +56 1 +58 1 +60 1 +61 1 +63 1 +65 1 +67 1 +69 1 +71 1 +73 1 +75 1 +77 1 +79 1 +connection node_1; +DROP TABLE t1; +DROP SEQUENCE s; +connection node_1; +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; +connection node_1; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; +connection node_2; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; +connection node_2a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; +connection node_1a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; +connection node_2; +SELECT LASTVAL(s); +LASTVAL(s) +20 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +40 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +39 +connection node_1; +SELECT * FROM t1; +f1 f2 +connection node_2; +SELECT * FROM t1; +f1 f2 +connection node_1; +DROP TABLE t1; +DROP SEQUENCE s; +connection node_1; +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; +connection node_1; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +connection node_1a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +connection node_2a; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +connection node_2; +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +connection node_1; +COMMIT; +connection node_1a; +ROLLBACK; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2a; +ROLLBACK; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2; +SELECT LASTVAL(s); +LASTVAL(s) +40 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +20 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +39 +connection node_1; +SELECT * FROM t1; +f1 f2 +1 1 +3 1 +5 1 +7 1 +9 1 +11 1 +13 1 +15 1 +17 1 +19 1 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 1 +3 1 +5 1 +7 1 +9 1 +11 1 +13 1 +15 1 +17 1 +19 1 +connection node_1; +DROP TABLE t1; +DROP SEQUENCE s; diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result index 263e1a675d5..19b562d76d4 100644 --- a/mysql-test/suite/galera/r/galera_slave_replay.result +++ b/mysql-test/suite/galera/r/galera_slave_replay.result @@ -1,7 +1,7 @@ -connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2a; connection node_2; connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 374fb31afd1..b3b052b82ba 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -2,6 +2,7 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_2; call mtr.add_suppression("WSREP: TO isolation failed for: "); connection node_1; call mtr.add_suppression("CREATE TABLE isolation failure"); diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result index ec3b717e3f3..b3f33112382 100644 --- a/mysql-test/suite/galera/r/galera_ssl.result +++ b/mysql-test/suite/galera/r/galera_ssl.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result index 545f4babfe1..c5f7c65d303 100644 --- a/mysql-test/suite/galera/r/galera_ssl_compression.result +++ b/mysql-test/suite/galera/r/galera_ssl_compression.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index 9030850b67e..1b69d7b6980 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 connection node_1; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff index 9dc845499ad..1bd6ae15c6c 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff @@ -1,6 +1,6 @@ ---- galera/r/galera_sst_mariabackup.result 2024-04-11 09:53:12.950512316 +0300 -+++ galera/r/galera_sst_mariabackup,debug.reject 2024-04-11 10:00:36.771144955 +0300 -@@ -524,6 +524,190 @@ +--- r/galera_sst_mariabackup.result ++++ r/galera_sst_mariabackup,debug.reject +@@ -516,5 +516,189 @@ 1 DROP TABLE t1; COMMIT; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff index da294317c27..b8469370b0d 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mariabackup.result -+++ r/galera_sst_mariabackup,debug.reject +--- r/galera_sst_mariabackup_force_recovery.result ++++ r/galera_sst_mariabackup_force_recovery,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff new file mode 100644 index 00000000000..4e1470839e9 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff @@ -0,0 +1,210 @@ +--- r/galera_sst_mariabackup_gtid.result ++++ r/galera_sst_mariabackup_gtid,debug.reject +@@ -516,19 +516,203 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; + connection node_1; + # Node_1 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + connection node_2; + # Node_2 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + disconnect node_2; + disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result new file mode 100644 index 00000000000..fa2397b722e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result @@ -0,0 +1,534 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +connection node_1; +# Node_1 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +connection node_2; +# Node_2 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff index a9c796da607..0c08f38c138 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff @@ -1,5 +1,5 @@ --- r/galera_sst_mariabackup_logarchive.result -+++ r/galera_sst_mariabackup_logarchive.reject ++++ r/galera_sst_mariabackup_logarchive,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result index 1d631198990..2f5763139b6 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result @@ -8,6 +8,6 @@ connection node_1; Cleaning var directory ... connection node_2; Starting server ... -include/assert_grep.inc [mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\)] +include/assert_grep.inc [mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\)] disconnect node_2; disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff index ce99b3830e8..9438f8f7638 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff @@ -1,13 +1,12 @@ --- r/galera_sst_mysqldump.result +++ r/galera_sst_mysqldump,debug.reject -@@ -698,11 +698,195 @@ +@@ -698,6 +698,190 @@ 1 DROP TABLE t1; COMMIT; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; @@ -189,12 +188,6 @@ +DROP TABLE t1; +COMMIT; +SET GLOBAL debug_dbug = $debug_orig; -+connection node_1; -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); + connection node_1; + CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff deleted file mode 100644 index 90ce82f3ca1..00000000000 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff +++ /dev/null @@ -1,15 +0,0 @@ ---- r/galera_sst_mysqldump.result -+++ r/galera_sst_mysqldump.reject -@@ -699,10 +699,10 @@ - DROP TABLE t1; - COMMIT; - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index e76d72383c1..1455ac277a8 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -699,10 +699,10 @@ COUNT(*) = 0 DROP TABLE t1; COMMIT; connection node_1; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; connection node_2; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff index 078ed73663d..a9e973c3a15 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff @@ -1,13 +1,12 @@ --- r/galera_sst_mysqldump_with_key.result +++ r/galera_sst_mysqldump_with_key,debug.reject -@@ -358,11 +358,195 @@ +@@ -358,6 +358,190 @@ 1 DROP TABLE t1; COMMIT; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); ++connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; @@ -189,12 +188,6 @@ +DROP TABLE t1; +COMMIT; +SET GLOBAL debug_dbug = $debug_orig; -+connection node_1; -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); + connection node_1; + CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff deleted file mode 100644 index f8b39fbf3bf..00000000000 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff +++ /dev/null @@ -1,15 +0,0 @@ ---- r/galera_sst_mysqldump_with_key.result -+++ r/galera_sst_mysqldump_with_key.reject -@@ -359,10 +359,10 @@ - DROP TABLE t1; - COMMIT; - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result index fe574abf93f..a296263b6db 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result @@ -359,10 +359,10 @@ COUNT(*) = 0 DROP TABLE t1; COMMIT; connection node_1; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; connection node_2; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff index 87f8a463bd0..157a4db3204 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff @@ -1,5 +1,5 @@ --- galera_sst_rsync.result -+++ galera_sst_rsync.reject ++++ galera_sst_rsync,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff new file mode 100644 index 00000000000..c83ead475e2 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff @@ -0,0 +1,210 @@ +--- r/galera_sst_rsync_gtid.result ++++ r/galera_sst_rsync_gtid,debug.reject +@@ -516,19 +516,203 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; + connection node_1; + # Node_1 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + connection node_2; + # Node_2 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + disconnect node_2; + disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result b/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result new file mode 100644 index 00000000000..fa2397b722e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result @@ -0,0 +1,534 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +connection node_1; +# Node_1 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +connection node_2; +# Node_2 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff index 5bc47c58303..0b1e2f2169c 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff @@ -1,3 +1,5 @@ +--- r/galera_sst_rsync_recv_auto.result ++++ r/galera_sst_rsync_recv_auto,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_strict_require_innodb.result b/mysql-test/suite/galera/r/galera_strict_require_innodb.result index cc243cd3813..47adc5e9285 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_innodb.result +++ b/mysql-test/suite/galera/r/galera_strict_require_innodb.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine .*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine "); CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=ARIA; diff --git a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result index 4a05f6405ed..ffdbb89170f 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result +++ b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int, b varchar(50)) ENGINE=MEMORY; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result index d8463f6732f..20701aa1108 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result @@ -52,8 +52,8 @@ EXPECT_0 0 DROP TABLE t1; connection node_1; -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -224,15 +224,26 @@ id b DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +INSERT INTO t1 (a,b) VALUES (10,20); +connection node_2; +SELECT * from t1; +a b +1 20 +connection node_1; +DROP TABLE t1; # # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO # connection node_1; -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); SELECT * FROM t1; i 1 DROP TABLE t1; -connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; +connection node_2; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result index 936f58b89a0..a835cbf527e 100644 --- a/mysql-test/suite/galera/r/galera_var_slave_threads.result +++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result @@ -33,7 +33,6 @@ connection node_2; SELECT COUNT(*) FROM t2; COUNT(*) 70 -SET GLOBAL wsrep_slave_threads = 1; DROP TABLE t1; DROP TABLE t2; # diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 3904c1dc517..af5314635e6 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -1,9 +1,9 @@ connection node_2; connection node_1; -CALL mtr.add_suppression("WSREP: Stray state UUID msg:"); -CALL mtr.add_suppression("Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .* sending install message failed: Socket is not connected"); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); +CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); +CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 @@ -36,8 +36,8 @@ VARIABLE_VALUE LIKE '%gmcast.segment = 3%' 1 DROP TABLE t1; connection node_1; -call mtr.add_suppression("WSREP: read_completion_condition.*"); -call mtr.add_suppression("WSREP: read_handler.*"); +call mtr.add_suppression("WSREP: read_completion_condition"); +call mtr.add_suppression("WSREP: read_handler"); disconnect node_3; disconnect node_4; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result index 5b35bdcef10..36253c5fae9 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result +++ b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result @@ -1,7 +1,7 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\\.segment'"); -call mtr.add_suppression("WSREP\: Set options returned 7"); +call mtr.add_suppression("WSREP: Unknown parameter 'gmcasts\\.segment'"); +call mtr.add_suppression("WSREP: Set options returned 7"); SET GLOBAL wsrep_provider_options="gmcasts.segment=1"; ERROR HY000: Incorrect arguments to SET Unhandled exceptions: 0 diff --git a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result index 2bfa50ebd0a..7077f050ca9 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result +++ b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result @@ -3,10 +3,17 @@ connection node_1; connection node_1; connection node_2; connection node_1; -call mtr.add_suppression("WSREP:.*"); +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; connection node_2; +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; diff --git a/mysql-test/suite/galera/r/mdev-29775.result b/mysql-test/suite/galera/r/mdev-29775.result index e5b55d6ad16..22ab8e50417 100644 --- a/mysql-test/suite/galera/r/mdev-29775.result +++ b/mysql-test/suite/galera/r/mdev-29775.result @@ -75,10 +75,10 @@ ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if ws SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=STATEMENT; -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/r/mdev-30653.result b/mysql-test/suite/galera/r/mdev-30653.result index 43f525ceace..2a6099ae915 100644 --- a/mysql-test/suite/galera/r/mdev-30653.result +++ b/mysql-test/suite/galera/r/mdev-30653.result @@ -4,7 +4,7 @@ create table t1 (id serial, val int) engine=innodb; create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; update t2 set val=41 where id=2; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff index 82c209614c7..50ae3e54507 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff +++ b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff @@ -1,6 +1,6 @@ --- r/mysql-wsrep#33.result +++ r/mysql-wsrep#33,debug.reject -@@ -698,12 +698,196 @@ +@@ -698,6 +698,190 @@ 1 DROP TABLE t1; COMMIT; @@ -190,12 +190,4 @@ +SET GLOBAL debug_dbug = $debug_orig; connection node_2; connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); + CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff b/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff deleted file mode 100644 index afbfc023128..00000000000 --- a/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff +++ /dev/null @@ -1,15 +0,0 @@ ---- r/mysql-wsrep#33.result -+++ r/mysql-wsrep#33.reject -@@ -700,10 +700,10 @@ - COMMIT; - connection node_2; - connection node_1; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - DROP USER sst; - connection node_2; --CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); -+CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); - CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); - CALL mtr.add_suppression("Can't open and lock time zone table"); - CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index ef4240869a8..29ca79a9da5 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -700,10 +700,10 @@ DROP TABLE t1; COMMIT; connection node_2; connection node_1; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; connection node_2; -CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 4c4d26db4c5..55cdde373c5 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -10,61 +10,61 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: last inactive check more than .+ skipping check), + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr|WSREP: discarding established \(time wait\) |, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, - qr|WSREP: Send action \{.* STATE_REQUEST} returned -107 \(Transport endpoint is not connected\)|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/galera/t/GAL-401.test b/mysql-test/suite/galera/t/GAL-401.test index 243fde23642..7ce342ad3a5 100644 --- a/mysql-test/suite/galera/t/GAL-401.test +++ b/mysql-test/suite/galera/t/GAL-401.test @@ -48,7 +48,7 @@ SET @@global.wsrep_desync = 0; SET SESSION wsrep_sync_wait=15; SHOW CREATE TABLE t1; DROP TABLE t1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test index a9b9077d5ef..c2fbfa8685e 100644 --- a/mysql-test/suite/galera/t/GCF-939.test +++ b/mysql-test/suite/galera/t/GCF-939.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log @@ -30,5 +31,6 @@ SELECT * FROM t1; DROP TABLE t1; CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); + --connection node_2 CALL mtr.add_suppression("Error 'Unknown table 'test\\.t1'' on query"); diff --git a/mysql-test/suite/galera/t/MDEV-10715.cnf b/mysql-test/suite/galera/t/MDEV-10715.cnf index 589514466ed..1422f977bf7 100644 --- a/mysql-test/suite/galera/t/MDEV-10715.cnf +++ b/mysql-test/suite/galera/t/MDEV-10715.cnf @@ -4,11 +4,13 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 -wsrep_gtid_domain_id=1 \ No newline at end of file +wsrep_gtid_domain_id=1 diff --git a/mysql-test/suite/galera/t/MDEV-15443.cnf b/mysql-test/suite/galera/t/MDEV-15443.cnf index 88a08203d01..f8c6733de16 100644 --- a/mysql-test/suite/galera/t/MDEV-15443.cnf +++ b/mysql-test/suite/galera/t/MDEV-15443.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] wsrep_auto_increment_control=OFF + [mysqld.2] wsrep_auto_increment_control=OFF diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test index d60be151142..eec8e7dc28a 100644 --- a/mysql-test/suite/galera/t/MDEV-18832.test +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE; CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id)); diff --git a/mysql-test/suite/galera/t/MDEV-20225.test b/mysql-test/suite/galera/t/MDEV-20225.test index 60ab1c53e40..43c763e1d16 100644 --- a/mysql-test/suite/galera/t/MDEV-20225.test +++ b/mysql-test/suite/galera/t/MDEV-20225.test @@ -41,7 +41,7 @@ INSERT INTO t1 VALUES (NULL); SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; --connection node_2 # Trigger should now be dropped on node_2. diff --git a/mysql-test/suite/galera/t/MDEV-20793.test b/mysql-test/suite/galera/t/MDEV-20793.test index 6835a73a2a4..67140d06e71 100644 --- a/mysql-test/suite/galera/t/MDEV-20793.test +++ b/mysql-test/suite/galera/t/MDEV-20793.test @@ -99,4 +99,4 @@ SET SESSION debug_sync = "now SIGNAL continue"; SET debug_sync = "RESET"; DROP TABLE t1; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/t/MDEV-21479.test b/mysql-test/suite/galera/t/MDEV-21479.test index 17451b3bb77..112e1361826 100644 --- a/mysql-test/suite/galera/t/MDEV-21479.test +++ b/mysql-test/suite/galera/t/MDEV-21479.test @@ -77,7 +77,7 @@ SET @@global.wsrep_desync = 0; --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; --source include/wait_condition.inc -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_1 --echo # Wait until both nodes are back to cluster diff --git a/mysql-test/suite/galera/t/MDEV-22227.test b/mysql-test/suite/galera/t/MDEV-22227.test index 0ee75b979e2..e3c4565958b 100644 --- a/mysql-test/suite/galera/t/MDEV-22227.test +++ b/mysql-test/suite/galera/t/MDEV-22227.test @@ -13,7 +13,7 @@ SET lock_wait_timeout= 1; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connection node_1b SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table level lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table level lock' --source include/wait_condition.inc --connection node_1 diff --git a/mysql-test/suite/galera/t/MDEV-22708.cnf b/mysql-test/suite/galera/t/MDEV-22708.cnf index f7ac4f43082..4c62448fe3d 100644 --- a/mysql-test/suite/galera/t/MDEV-22708.cnf +++ b/mysql-test/suite/galera/t/MDEV-22708.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld] -log-bin \ No newline at end of file +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-24143.test b/mysql-test/suite/galera/t/MDEV-24143.test index 3aecac8cb07..391c93a875c 100644 --- a/mysql-test/suite/galera/t/MDEV-24143.test +++ b/mysql-test/suite/galera/t/MDEV-24143.test @@ -21,4 +21,3 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE; ALTER TABLE t1 DROP COLUMN c2; SELECT get_lock ('test', 1.5); DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/MDEV-24327.cnf b/mysql-test/suite/galera/t/MDEV-24327.cnf index 390a9aab0f4..d3e98435699 100644 --- a/mysql-test/suite/galera/t/MDEV-24327.cnf +++ b/mysql-test/suite/galera/t/MDEV-24327.cnf @@ -3,4 +3,3 @@ [mysqld.1] log-bin=mariadb-bin log-slave-updates=OFF - diff --git a/mysql-test/suite/galera/t/MDEV-25389.test b/mysql-test/suite/galera/t/MDEV-25389.test index fc523371918..0bc7d8de9d5 100644 --- a/mysql-test/suite/galera/t/MDEV-25389.test +++ b/mysql-test/suite/galera/t/MDEV-25389.test @@ -7,6 +7,8 @@ --source ../galera/include/auto_increment_offset_save.inc --connection node_2 +--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` + call mtr.add_suppression("WSREP: Failed to create/initialize system thread"); SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1'; --error ER_WRONG_ARGUMENTS @@ -21,4 +23,9 @@ SELECT @@wsrep_slave_threads; # issue is fixed. --source include/restart_mysqld.inc +--connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test index 8560cb3c7b6..f8ce83535f4 100644 --- a/mysql-test/suite/galera/t/MDEV-26266.test +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -31,7 +31,6 @@ INSERT INTO t2 VALUES (2); INSERT INTO t2 VALUES (3); INSERT INTO t2 VALUES (4); INSERT INTO t2 VALUES (5); ---error ER_LOCK_DEADLOCK CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; - +DROP VIEW v1; DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-26597.test b/mysql-test/suite/galera/t/MDEV-26597.test index 465f1130443..7a57400c83d 100644 --- a/mysql-test/suite/galera/t/MDEV-26597.test +++ b/mysql-test/suite/galera/t/MDEV-26597.test @@ -28,5 +28,3 @@ SET SESSION wsrep_sync_wait = 0; --source ../../galera/include/auto_increment_offset_restore.inc --connection node_1 DROP TABLE t3; - - diff --git a/mysql-test/suite/galera/t/MDEV-27001.opt b/mysql-test/suite/galera/t/MDEV-27001.opt index c62d74cb249..8b9f55f295e 100644 --- a/mysql-test/suite/galera/t/MDEV-27001.opt +++ b/mysql-test/suite/galera/t/MDEV-27001.opt @@ -1 +1 @@ ---partition=ON \ No newline at end of file +--partition=ON diff --git a/mysql-test/suite/galera/t/MDEV-27001.test b/mysql-test/suite/galera/t/MDEV-27001.test index fb5f57f53e5..095e2607911 100644 --- a/mysql-test/suite/galera/t/MDEV-27001.test +++ b/mysql-test/suite/galera/t/MDEV-27001.test @@ -4,4 +4,4 @@ CREATE TABLE t3 (c INT) PARTITION BY RANGE (c) (PARTITION p1 VALUES LESS THAN (1000)); CREATE TABLE tp2 (c INT); ALTER TABLE t3 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN (2000); -DROP TABLE t3; \ No newline at end of file +DROP TABLE t3; diff --git a/mysql-test/suite/galera/t/MDEV-27123.opt b/mysql-test/suite/galera/t/MDEV-27123.opt index 1c4accb816a..2a71a656039 100644 --- a/mysql-test/suite/galera/t/MDEV-27123.opt +++ b/mysql-test/suite/galera/t/MDEV-27123.opt @@ -1,2 +1 @@ --wsrep_auto_increment_control=OFF --auto_increment_increment=3 --auto_increment_offset=3 - diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test index f19d6b5db42..f8dd8d0cff6 100644 --- a/mysql-test/suite/galera/t/MDEV-27862.test +++ b/mysql-test/suite/galera/t/MDEV-27862.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc --disable_ps2_protocol diff --git a/mysql-test/suite/galera/t/MDEV-28053.test b/mysql-test/suite/galera/t/MDEV-28053.test index fe0aa566f94..323d7a5ba0e 100644 --- a/mysql-test/suite/galera/t/MDEV-28053.test +++ b/mysql-test/suite/galera/t/MDEV-28053.test @@ -39,6 +39,7 @@ while ($counter) { --disable_result_log --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; START SLAVE; + --eval SELECT MASTER_GTID_WAIT('$gtid', 600) --enable_result_log --enable_query_log diff --git a/mysql-test/suite/galera/t/MDEV-29293.test b/mysql-test/suite/galera/t/MDEV-29293.test index dacbf714c06..cf14a640035 100644 --- a/mysql-test/suite/galera/t/MDEV-29293.test +++ b/mysql-test/suite/galera/t/MDEV-29293.test @@ -38,4 +38,3 @@ set debug_sync= 'now SIGNAL continue'; --reap DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/MDEV-29512.cnf b/mysql-test/suite/galera/t/MDEV-29512.cnf index bf8e0c37984..136a8842a56 100644 --- a/mysql-test/suite/galera/t/MDEV-29512.cnf +++ b/mysql-test/suite/galera/t/MDEV-29512.cnf @@ -10,6 +10,4 @@ log_slave_updates max-binlog-size=4096 expire-logs-days=1 - [mysqld.2] - diff --git a/mysql-test/suite/galera/t/MDEV-32549.test b/mysql-test/suite/galera/t/MDEV-32549.test index a2faa46da5f..b8e58fa4ff9 100644 --- a/mysql-test/suite/galera/t/MDEV-32549.test +++ b/mysql-test/suite/galera/t/MDEV-32549.test @@ -3,6 +3,7 @@ # statement is rolled back # --source include/galera_cluster.inc +--source include/have_aria.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria; diff --git a/mysql-test/suite/galera/t/MDEV-33136.test b/mysql-test/suite/galera/t/MDEV-33136.test index 12765ef6dfb..dc1ae1aecdd 100644 --- a/mysql-test/suite/galera/t/MDEV-33136.test +++ b/mysql-test/suite/galera/t/MDEV-33136.test @@ -10,6 +10,7 @@ # transaction in the MDL conflict handling code. --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug_sync.inc --source include/have_debug.inc @@ -19,8 +20,8 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; --connection node_1a -TRUNCATE TABLE t1; -# TRUNCATE forces the next statement to re-read statistics from persistent storage, +RENAME TABLE t1 TO tmp, tmp TO t1; +# RENAME forces the next statement to re-read statistics from persistent storage, # which will acquire MDL locks on the statistics tables in InnoDB. SET SESSION wsrep_retry_autocommit = 0; SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort'; diff --git a/mysql-test/suite/galera/t/MDEV-33828.cnf b/mysql-test/suite/galera/t/MDEV-33828.cnf index 4c62448fe3d..1b8791ae398 100644 --- a/mysql-test/suite/galera/t/MDEV-33828.cnf +++ b/mysql-test/suite/galera/t/MDEV-33828.cnf @@ -2,3 +2,12 @@ [mysqld] log-bin +log-slave-updates + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/MDEV-33828.test b/mysql-test/suite/galera/t/MDEV-33828.test index 8e30481beee..b7eb2ee7d02 100644 --- a/mysql-test/suite/galera/t/MDEV-33828.test +++ b/mysql-test/suite/galera/t/MDEV-33828.test @@ -1,6 +1,5 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source include/have_aria.inc SET AUTOCOMMIT=ON; SELECT @@autocommit; diff --git a/mysql-test/suite/galera/t/MDEV-34647.cnf b/mysql-test/suite/galera/t/MDEV-34647.cnf new file mode 100644 index 00000000000..1b8791ae398 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-34647.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index db776681aa1..2cf4b627f76 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc create table t1(id serial, val varchar(100)) engine=myisam; @@ -38,14 +39,12 @@ insert into t5 select null, 'c'; insert into t5 select null, 'd' from t5; select * from t2; - --connection node_2 select * from t1; select * from t2; select * from t3; select * from t4; select * from t5; -set global wsrep_mode=default; --connection node_1 drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/galera/t/MDEV-35946.test b/mysql-test/suite/galera/t/MDEV-35946.test index 23c3d463a48..790448a4812 100644 --- a/mysql-test/suite/galera/t/MDEV-35946.test +++ b/mysql-test/suite/galera/t/MDEV-35946.test @@ -25,7 +25,6 @@ SET SESSION wsrep_sync_wait=DEFAULT; --error ER_LOCK_WAIT_TIMEOUT DELETE FROM mysql.wsrep_streaming_log; - # # Reconnect to the cluster # @@ -36,6 +35,5 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SET SESSION wsrep_sync_wait=DEFAULT; - --source include/auto_increment_offset_restore.inc -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera/t/MDEV-36116.test b/mysql-test/suite/galera/t/MDEV-36116.test new file mode 100644 index 00000000000..c216e00652f --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-36116.test @@ -0,0 +1,43 @@ +# +# MDEV-36116: TOI crashes in debug assert if executing thread is killed. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1 + +# Start TOI operation and wait for the thread to be killed. +--connection node_1 +CALL mtr.add_suppression("CREATE TABLE isolation failure"); + +--let $connection_id = `SELECT CONNECTION_ID()` +SET DEBUG_SYNC = 'wsrep_kill_thd_before_enter_toi SIGNAL may_kill WAIT_FOR continue'; +--send + CREATE TABLE t1 (a INT) ENGINE=InnoDB; + +# Kill the thread and let it continue. +--connection con1 +SET DEBUG_SYNC = 'now WAIT_FOR may_kill'; +--disable_query_log +--eval KILL CONNECTION $connection_id +--enable_query_log +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection node_1 +--error 2013,2026 +--reap + +# Verify no tables created on either nodes. +--connection node_2 +SHOW TABLES LIKE 't1'; + +--connection con1 +SHOW TABLES LIKE 't1'; + +# Cleanup +SET DEBUG_SYNC = 'RESET'; +--disconnect con1 +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/MDEV-6860.cnf b/mysql-test/suite/galera/t/MDEV-6860.cnf index d8defd343ad..71934249b25 100644 --- a/mysql-test/suite/galera/t/MDEV-6860.cnf +++ b/mysql-test/suite/galera/t/MDEV-6860.cnf @@ -1,7 +1,8 @@ !include ../galera_2nodes_as_slave.cnf +[mysqld.1] +wsrep-slave-threads=10 + [mysqld.2] slave-parallel-threads=2 slave-parallel-mode=optimistic -[mysqld.1] -wsrep-slave-threads=10 diff --git a/mysql-test/suite/galera/t/MDEV-6860.test b/mysql-test/suite/galera/t/MDEV-6860.test index 4687a8214fd..3c8e7bb72c8 100644 --- a/mysql-test/suite/galera/t/MDEV-6860.test +++ b/mysql-test/suite/galera/t/MDEV-6860.test @@ -4,7 +4,7 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_USE_GTID=slave_pos; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/MW-259.test b/mysql-test/suite/galera/t/MW-259.test index 7298285f6ff..61e0f19e5bb 100644 --- a/mysql-test/suite/galera/t/MW-259.test +++ b/mysql-test/suite/galera/t/MW-259.test @@ -39,4 +39,3 @@ SET GLOBAL wsrep_desync=0; # Cleanup SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index 1b6973bb4c8..597368692dc 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -2,15 +2,16 @@ # MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR # ---source include/have_log_bin.inc --source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_log_bin.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use "); call mtr.add_suppression("WSREP has not yet prepared node for application use"); --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_SSL_VERIFY_SERVER_CERT=0; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_1, master_connect_retry=1; --enable_query_log --connection node_1 @@ -29,7 +30,7 @@ SET global wsrep_sync_wait=0; --connection node_3 SELECT @@wsrep_on; --sleep 1 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; --let $slave_param= Slave_IO_Running --let $slave_param_value= Connecting diff --git a/mysql-test/suite/galera/t/MW-313.cnf b/mysql-test/suite/galera/t/MW-313.cnf index 184900c58fd..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/MW-313.cnf +++ b/mysql-test/suite/galera/t/MW-313.cnf @@ -7,6 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - - - diff --git a/mysql-test/suite/galera/t/MW-329.cnf b/mysql-test/suite/galera/t/MW-329.cnf index 10870a81547..b35f0a5cfe5 100644 --- a/mysql-test/suite/galera/t/MW-329.cnf +++ b/mysql-test/suite/galera/t/MW-329.cnf @@ -4,6 +4,3 @@ wsrep-retry-autocommit=0 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test index c70662e16b4..7d132a7bfc0 100644 --- a/mysql-test/suite/galera/t/MW-329.test +++ b/mysql-test/suite/galera/t/MW-329.test @@ -1,5 +1,5 @@ # -# #MW-329 Fix incorrect affected rows count after replay +# MW-329 Fix incorrect affected rows count after replay. # --source include/galera_cluster.inc @@ -11,7 +11,7 @@ CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; INSERT INTO t1 (f1) VALUES (1),(65535); # -# Run concurrent INSERTs +# Run concurrent INSERTs # DELIMITER |; @@ -86,6 +86,10 @@ while ($count) --eval KILL CONNECTION $connection_id --enable_query_log +# +# getting execution results for --send +# + --connection node_1b --error 0,1317,2013,2026 --reap @@ -96,6 +100,8 @@ while ($count) DROP PROCEDURE proc_insert; DROP TABLE t1; +--disconnect node_1b + # Due to MW-330, Multiple "conflict state 3 after post commit" warnings if table is dropped while SP is running CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); diff --git a/mysql-test/suite/galera/t/MW-329F.cnf b/mysql-test/suite/galera/t/MW-329F.cnf new file mode 100644 index 00000000000..b35f0a5cfe5 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-329F.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-retry-autocommit=0 + +[mysqld.2] diff --git a/mysql-test/suite/galera/t/MW-329F.test b/mysql-test/suite/galera/t/MW-329F.test new file mode 100644 index 00000000000..77370dabbe3 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-329F.test @@ -0,0 +1,105 @@ +# +# MW-329F Fix incorrect affected rows count after replay. +# +# This is a version of MW-329 without the infinite loop that +# in the original test is closed by killing the connection. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; + +# We start with a populated table +INSERT INTO t1 (f1) VALUES (1),(65535); + +# +# Run concurrent INSERTs +# + +DELIMITER |; +CREATE PROCEDURE proc_insert (repeat_count int) +BEGIN + DECLARE current_num int; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + SET current_num = 0; + SET SESSION wsrep_sync_wait = 0; + WHILE current_num < repeat_count do + INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 )); + SELECT SLEEP(0.1); + SET current_num = current_num + 1; + END WHILE; +END| +DELIMITER ;| + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b +--let $connection_id = `SELECT CONNECTION_ID()` +--disable_query_log +--disable_result_log +--send CALL proc_insert(500); + +# +# Run concurrent UPDATEs. We expect that each UPDATE will report that +# some rows were matched and updated +# + +--connection node_2 +--let $count = 2 +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +while ($count) +{ + --let $signature = `SELECT LEFT(MD5(RAND()), 10)` + --disable_query_log + --error 0,ER_LOCK_DEADLOCK + --eval UPDATE t1 SET f2 = '$signature' + --enable_query_log + --let $row_count = `SELECT ROW_COUNT()` + if (`SELECT @@error_count = 0`) { + if (`SELECT $row_count = 0`) { + --die ROW_COUNT() = 0 + } + } + + # + # Ensure at least one replay happens + # + + --let $wsrep_replays = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + --disable_query_log + if (`SELECT $wsrep_replays - $wsrep_local_replays_old > 0`) { + --dec $count + } + --enable_query_log +} + +# +# Confirm that some transaction replays occurred +# + +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old > 0 AS wsrep_local_replays; +--enable_query_log + +# +# getting execution results for --send +# + +--connection node_1b +--error 0,1317,2013,2026 +--reap +--enable_query_log +--enable_result_log + +--connection node_1 +DROP PROCEDURE proc_insert; +DROP TABLE t1; + +--disconnect node_1b + +# Due to MW-330, Multiple "conflict state 3 after post commit" warnings if table is dropped while SP is running +CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); + +set global innodb_status_output=Default; diff --git a/mysql-test/suite/galera/t/MW-360-master.opt b/mysql-test/suite/galera/t/MW-360-master.opt index e51c49c3808..35922307c93 100644 --- a/mysql-test/suite/galera/t/MW-360-master.opt +++ b/mysql-test/suite/galera/t/MW-360-master.opt @@ -1,2 +1 @@ --gtid-domain-id=1 --log-bin --log-slave-updates - diff --git a/mysql-test/suite/galera/t/MW-369.inc b/mysql-test/suite/galera/t/MW-369.inc index 3b0a32bdd9d..f2d59245d7d 100644 --- a/mysql-test/suite/galera/t/MW-369.inc +++ b/mysql-test/suite/galera/t/MW-369.inc @@ -80,5 +80,3 @@ SET SESSION DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; SET GLOBAL DEBUG_DBUG = ""; SET DEBUG_SYNC = 'RESET'; - - diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test index f86ffcbf512..379873c0749 100644 --- a/mysql-test/suite/galera/t/MW-416.test +++ b/mysql-test/suite/galera/t/MW-416.test @@ -21,73 +21,71 @@ ALTER FUNCTION fun1 COMMENT 'foo'; #ALTER INSTANCE ROTATE INNODB MASTER KEY; --error 1044,1227,1370 ALTER PROCEDURE proc1 COMMENT 'foo'; ---error 1044,1227,1370 +--error 1044,1227 ALTER SERVER srv OPTIONS (USER 'sally'); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ALTER TABLE tbl DROP COLUMN col; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ALTER VIEW vw AS SELECT 1; ---error 1044,1227,1370 +--error 1044,1227 CREATE DATABASE db; ---error 1044,1227,1370 -CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; +--error 1044,1227 +CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; --error 1044,1227,1370 CREATE FUNCTION fun1() RETURNS int RETURN(1); --error 1044,1227,1370 CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; --error 1044,1227,1370 -CREATE PROCEDURE proc1() BEGIN END; ---error 1044,1142,1227,1370 +CREATE PROCEDURE proc1() BEGIN END; +--error 1044,1142,1227 CREATE INDEX idx ON tbl(id); ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user'); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE TABLE t (i int); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE VIEW vw AS SELECT 1; - - ---error 1044,1142,1227,1370 +--error 1044,1227 DROP DATABASE db; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP EVENT ev; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 DROP FUNCTION fun1; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP INDEX idx ON t0; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 DROP PROCEDURE proc1; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP SERVEr srv; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP TABLE t0; ---error 1044,1142,1227,1360,1370 +--error 1044,1227,1360 DROP TRIGGER trg; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP VIEW vw; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 RENAME TABLE t0 TO t1; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 TRUNCATE TABLE t0; # DCL # account management ---error 1044,1142,1227,1370,1064 +--error 1044,1227,1064 ALTER USER myuser PASSWORD EXPIRE; ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE USER myuser IDENTIFIED BY 'pass'; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP USER myuser; ---error 1044,1045,1142,1227,1370 +--error 1044,1045,1227 GRANT ALL ON *.* TO 'myuser'; ---error 1044,1142,1227,1370 +--error 1044,1227 RENAME USER myuser TO mariauser; --error 1044,1142,1227,1370 REVOKE SELECT ON test FROM myuser; @@ -97,24 +95,25 @@ REVOKE ALL, GRANT OPTION FROM myuser; REVOKE PROXY ON myuser FROM myuser; # table maintenance ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ANALYZE TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CHECK TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CHECKSUM TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 OPTIMIZE TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 REPAIR TABLE db.tbl; # plugin and user defined functions ---error 1044,1142,1227,1370 +--error 1044,1142,1227 INSTALL PLUGIN plg SONAME 'plg.so'; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 UNINSTALL PLUGIN plg; --connection node_1 DROP USER 'userMW416'@'localhost'; SHOW DATABASES; +--disconnect userMW416 diff --git a/mysql-test/suite/galera/t/MW-86-wait8.cnf b/mysql-test/suite/galera/t/MW-86-wait8.cnf index 8f6a760def0..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/MW-86-wait8.cnf +++ b/mysql-test/suite/galera/t/MW-86-wait8.cnf @@ -7,4 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test index 8f6091235a1..5aab68a7746 100644 --- a/mysql-test/suite/galera/t/binlog_checksum.test +++ b/mysql-test/suite/galera/t/binlog_checksum.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --echo # On node_1 --connection node_1 diff --git a/mysql-test/suite/galera/t/create.test b/mysql-test/suite/galera/t/create.test index 96a6640c21f..01b78d1ff41 100644 --- a/mysql-test/suite/galera/t/create.test +++ b/mysql-test/suite/galera/t/create.test @@ -86,4 +86,3 @@ DROP TABLE t1, t2; --source include/galera_end.inc --echo # End of tests - diff --git a/mysql-test/suite/galera/t/galera#414.cnf b/mysql-test/suite/galera/t/galera#414.cnf index 03e7214b76f..c1538deca8f 100644 --- a/mysql-test/suite/galera/t/galera#414.cnf +++ b/mysql-test/suite/galera/t/galera#414.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=2' +wsrep_provider_options='gcs.max_packet_size=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=2' +wsrep_provider_options='gcs.max_packet_size=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test index c393b7fd056..cc814af6d31 100644 --- a/mysql-test/suite/galera/t/galera#500.test +++ b/mysql-test/suite/galera/t/galera#500.test @@ -3,7 +3,12 @@ # thrown from gcomm background thread, the provider terminates properly # and wsrep_ready becomes 0. # +# Not to be run with ASAN. Provider leaks memory when gcomm +# thread is aborted forcifully and ASAN crashes during leak report +# after provider is unloaded. +# +--source include/not_asan.inc --source include/have_innodb.inc --source include/galera_cluster.inc --source include/galera_have_debug_sync.inc diff --git a/mysql-test/suite/galera/t/galera_2primary_replica.test b/mysql-test/suite/galera/t/galera_2primary_replica.test index fb57c6637d0..da20026f5c9 100644 --- a/mysql-test/suite/galera/t/galera_2primary_replica.test +++ b/mysql-test/suite/galera/t/galera_2primary_replica.test @@ -41,19 +41,21 @@ grant all on *.* to repl2@'%'; --let $node_1 = replica --let $node_2 = node_2 +--let $node_3 = primary1 +--let $node_4 = primary2 --source include/auto_increment_offset_save.inc --connection replica --echo # Galera replica changing master to primary1 ---disable_query_log SET @@default_master_connection='stream1'; ---eval CHANGE MASTER 'stream1' TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; +--disable_query_log +--eval CHANGE MASTER 'stream1' TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log -SET @@default_master_connection='stream2'; --echo # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; --disable_query_log ---eval CHANGE MASTER 'stream2' TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; +--eval CHANGE MASTER 'stream2' TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; --enable_query_log START ALL SLAVES; diff --git a/mysql-test/suite/galera/t/galera_MDEV-29512.cnf b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf index bf8e0c37984..136a8842a56 100644 --- a/mysql-test/suite/galera/t/galera_MDEV-29512.cnf +++ b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf @@ -10,6 +10,4 @@ log_slave_updates max-binlog-size=4096 expire-logs-days=1 - [mysqld.2] - diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test index 57c057f9869..6f23abab6f3 100644 --- a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc # @@ -35,7 +36,4 @@ SELECT COUNT(*) = 1 FROM t1; DROP TABLE t1; --connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test index 97819384a75..4e17ddf2e4c 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test @@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (2); --connection node_1a SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc SELECT COUNT(*) = 0 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf index 4d93a1b2509..3b7a713c30c 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf @@ -9,6 +9,3 @@ wait_timeout=5 lock_wait_timeout=5 innodb_lock_wait_timeout=5 wait_timeout=5 - - - diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test index d62b6552973..9d9ec4bbee3 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test @@ -27,16 +27,16 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER; --connection node_1 SELECT 1 FROM DUAL; # Wait ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); UNLOCK TABLES; SET SESSION wsrep_sync_wait = 15; SHOW CREATE TABLE t1; -SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test index fdd271a3e5c..d09fa0b78c3 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_ctas.test +++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test @@ -16,7 +16,7 @@ SELECT @@wsrep_on; --connection node_1 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, master_ssl_verify_server_cert=0; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; --enable_query_log START SLAVE; @@ -73,4 +73,3 @@ RESET SLAVE ALL; --connection node_3 RESET MASTER; - diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test index 31c50a4658c..2769357c05e 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -17,9 +17,10 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_4, MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_USER='root'; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_4; --enable_query_log START SLAVE; + SET SESSION wsrep_sync_wait = 0; --connection node_4 @@ -84,7 +85,7 @@ RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Transport endpoint is not connected"); +CALL mtr.add_suppression("(Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); diff --git a/mysql-test/suite/galera/t/galera_as_slave_parallel_retry.test b/mysql-test/suite/galera/t/galera_as_slave_parallel_retry.test index e106c5f08c3..40622a1e465 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_parallel_retry.test +++ b/mysql-test/suite/galera/t/galera_as_slave_parallel_retry.test @@ -12,7 +12,7 @@ --connection node_1 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_as_slave_replay.test b/mysql-test/suite/galera/t/galera_as_slave_replay.test index 20455f2843c..27fc002b912 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_as_slave_replay.test @@ -36,7 +36,7 @@ RESET MASTER; # nodes 1 and 2 form a galera cluster, node 2 operates as slave for native MariaDB master in node 3 # --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf index cddb8e0e174..1fcfcc6bf9f 100644 --- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test index 9647d78a094..2756ebcf719 100644 --- a/mysql-test/suite/galera/t/galera_backup_stage.test +++ b/mysql-test/suite/galera/t/galera_backup_stage.test @@ -56,7 +56,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # reach commit stage. In the unlikely case the interleaving is different, the # result of the test should not change. --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc @@ -83,11 +83,11 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # wait for insert to get blocked --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State = 'Commit' OR State='Waiting for certification') +--let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') --source include/wait_condition.inc # nothing after BLOCK_DDL is applied diff --git a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test index 224db902569..5550c9a1c66 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test @@ -55,4 +55,3 @@ DROP TABLE t1; --disconnect node_2a --disconnect node_2b - diff --git a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test index fde783e2cef..1227abb10f6 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test @@ -17,12 +17,12 @@ INSERT INTO t1 VALUES (2); --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc UNLOCK TABLES; ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc COMMIT; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf index 857a4101406..1e6bbcce82f 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf @@ -6,10 +6,10 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test index ed16ac3926c..61695ac9a05 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test @@ -129,7 +129,7 @@ let SEARCH_PATTERN = Server not desynched from group at BLOCK_DDL because WSREP_ let SEARCH_PATTERN = Server desynched from group during BACKUP STAGE BLOCK_COMMIT.; --source include/search_pattern_in_file.inc -SET GLOBAL wsrep_mode = ""; +SET GLOBAL wsrep_mode = DEFAULT; --connection node_1 DROP TABLE t; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf b/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf index 34c1a8cc3cf..ee365a18340 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf @@ -1,3 +1,4 @@ !include ../galera_2nodes.cnf + [mysqltest] -ps-protocol \ No newline at end of file +ps-protocol diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf index 4101b4073ec..90f99fcdd21 100644 --- a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf +++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf @@ -5,5 +5,3 @@ innodb_stats_persistent=ON [mysqld.2] innodb_stats_persistent=ON - - diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.test b/mysql-test/suite/galera/t/galera_bf_background_statistics.test index a9a98b1b567..0ffd4895f5b 100644 --- a/mysql-test/suite/galera/t/galera_bf_background_statistics.test +++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.test @@ -46,4 +46,3 @@ ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1; --enable_query_log DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 4655a35fde5..b59eef11cd3 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -113,7 +113,7 @@ update t1 set a =5, b=2; --connection node_2b SET SESSION wsrep_sync_wait=0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'; --source include/wait_condition.inc --connection node_2a diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test index 78a460eda09..d7832c59ebf 100644 --- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test @@ -97,4 +97,3 @@ drop procedure p1; --disconnect node_1_p2 --disconnect node_2_p1 --disconnect node_2_p2 - diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf index bd61ee67406..590cecf36bc 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf @@ -9,5 +9,3 @@ slave-sql-verify-checksum=1 binlog-checksum=CRC32 master-verify-checksum=1 slave-sql-verify-checksum=1 - - diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test index 12fb87a618c..e00e2169a50 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.test +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test @@ -38,8 +38,6 @@ SELECT * FROM t1; --connection node_1 DROP TABLE t1; ---disable_query_log SET @@global.wsrep_mode=DEFAULT; ---enable_query_log --echo # End of tests. diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf index 9315086a3cc..5f0809ddf07 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf @@ -4,6 +4,3 @@ binlog-row-event-max-size=4294967040 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf index 798435d8e54..5899387f52d 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf @@ -4,6 +4,3 @@ binlog-row-event-max-size=256 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test index 00b55339770..43ea0932676 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test @@ -12,4 +12,3 @@ INSERT INTO t1 VALUES (REPEAT('x', 1000)); SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000); DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_binlog_row_image.test b/mysql-test/suite/galera/t/galera_binlog_row_image.test index 70262ec44ca..5c544414b9e 100644 --- a/mysql-test/suite/galera/t/galera_binlog_row_image.test +++ b/mysql-test/suite/galera/t/galera_binlog_row_image.test @@ -94,7 +94,3 @@ SELECT COUNT(*) = 0 FROM t2; DROP TABLE t1; DROP TABLE t2; - - - - diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test index 994f7695fc6..81bf6738086 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test @@ -5,15 +5,15 @@ --source include/galera_cluster.inc --source include/force_restart.inc +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 SET GLOBAL auto_increment_offset=1; --connection node_2 SET GLOBAL auto_increment_offset=2; ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc - ## ## Verify the correct operation of the auto-increment when the binlog ## format artificially set to the 'STATEMENT' (although this mode is diff --git a/mysql-test/suite/galera/t/galera_cache_index.test b/mysql-test/suite/galera/t/galera_cache_index.test index b373a173894..294a13295c4 100644 --- a/mysql-test/suite/galera/t/galera_cache_index.test +++ b/mysql-test/suite/galera/t/galera_cache_index.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); diff --git a/mysql-test/suite/galera/t/galera_can_run_toi.test b/mysql-test/suite/galera/t/galera_can_run_toi.test index e73eb46c0d7..80dd6986bc4 100644 --- a/mysql-test/suite/galera/t/galera_can_run_toi.test +++ b/mysql-test/suite/galera/t/galera_can_run_toi.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc # # MDEV-24833 : Signal 11 on wsrep_can_run_in_toi at wsrep_mysqld.cc:1994 # diff --git a/mysql-test/suite/galera/t/galera_change_user.test b/mysql-test/suite/galera/t/galera_change_user.test index 89efef1dbb0..5051b18eec6 100644 --- a/mysql-test/suite/galera/t/galera_change_user.test +++ b/mysql-test/suite/galera/t/galera_change_user.test @@ -26,4 +26,3 @@ reset_connection; --connection node_1 DROP TABLE t1; DROP USER user1; - diff --git a/mysql-test/suite/galera/t/galera_circular_replication.test b/mysql-test/suite/galera/t/galera_circular_replication.test index dbe85da4b23..11dff973c00 100644 --- a/mysql-test/suite/galera/t/galera_circular_replication.test +++ b/mysql-test/suite/galera/t/galera_circular_replication.test @@ -45,12 +45,13 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = replica1 --let $node_2 = node_2 --let $node_3 = primary2 +--let $node_4 = primary1 --source include/auto_increment_offset_save.inc --connection replica1 --echo # Galera replica changing master to primary1 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; --enable_query_log START SLAVE; @@ -62,7 +63,7 @@ grant all on *.* to repl2@'%'; --connection replica2 --echo # replica2 changing master to primary2 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_concurrent_ctas.test b/mysql-test/suite/galera/t/galera_concurrent_ctas.test index ed579f19a0d..199cd727df0 100644 --- a/mysql-test/suite/galera/t/galera_concurrent_ctas.test +++ b/mysql-test/suite/galera/t/galera_concurrent_ctas.test @@ -98,4 +98,3 @@ DROP TABLE t1; --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/galera_create_trigger.test b/mysql-test/suite/galera/t/galera_create_trigger.test index c76981aae29..3a2a39584fe 100644 --- a/mysql-test/suite/galera/t/galera_create_trigger.test +++ b/mysql-test/suite/galera/t/galera_create_trigger.test @@ -41,4 +41,3 @@ DROP TABLE definer_root; DROP TABLE definer_default; DROP USER 'user1'; - diff --git a/mysql-test/suite/galera/t/galera_ctas.test b/mysql-test/suite/galera/t/galera_ctas.test index 8b9ad9c4a20..05561204123 100644 --- a/mysql-test/suite/galera/t/galera_ctas.test +++ b/mysql-test/suite/galera/t/galera_ctas.test @@ -1,4 +1,6 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc --connection node_1 create table t1_Aria(a int, count int, b int, key(b)) engine=Aria; @@ -36,4 +38,3 @@ SHOW CREATE TABLE t4; DROP TABLE t2, t3,t4; DROP TABLE t1_MyISAM, t1_Aria,t1_InnoDB; - diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf index 2975070498e..106d79a503e 100644 --- a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf +++ b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf @@ -7,5 +7,3 @@ loose-galera-ddl-fk-conflict=1 [mysqld.2] wsrep-debug=1 loose-galera-ddl-fk-conflict=1 - - diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test index a8fb6614e41..22da69dfc24 100644 --- a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test +++ b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test @@ -43,4 +43,3 @@ SET SESSION wsrep_sync_wait=0; --source galera_ddl_fk_conflict_with_tmp.inc # CHECK and ANALYZE are not affected - diff --git a/mysql-test/suite/galera/t/galera_ddl_multiline.test b/mysql-test/suite/galera/t/galera_ddl_multiline.test index c7155d066fa..dc69dfd186f 100644 --- a/mysql-test/suite/galera/t/galera_ddl_multiline.test +++ b/mysql-test/suite/galera/t/galera_ddl_multiline.test @@ -51,4 +51,3 @@ SHOW CREATE TABLE t6; --connection node_1 DROP TABLE t1, t2, t3, t4, t5, t6; - diff --git a/mysql-test/suite/galera/t/galera_defaults.cnf b/mysql-test/suite/galera/t/galera_defaults.cnf index 5352d18a6b8..31ce78f1f82 100644 --- a/mysql-test/suite/galera/t/galera_defaults.cnf +++ b/mysql-test/suite/galera/t/galera_defaults.cnf @@ -4,7 +4,7 @@ wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index ff08151327a..994c5918302 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,11 +13,13 @@ --source include/force_restart.inc # Make sure that the test is operating on the right version of galera library. ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source ../wsrep/include/check_galera_version.inc; # Global Variables +SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; + SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%' diff --git a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test index b28bab1f8cb..2867e9e050e 100644 --- a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test +++ b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test @@ -101,4 +101,3 @@ DROP TABLE tab; DROP TABLE tab1; DROP TABLE tab2; DROP TABLE tab3; - diff --git a/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf b/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf index 0f7f80b7d0b..a26c4b30b00 100644 --- a/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf +++ b/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf @@ -1,6 +1,6 @@ !include ../galera_2nodes.cnf -[mysqld] +[mysqld] encrypt-tmp-files = 1 plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO file-key-management diff --git a/mysql-test/suite/galera/t/galera_event_node_evict.cnf b/mysql-test/suite/galera/t/galera_event_node_evict.cnf index e9b669babca..9344782b833 100644 --- a/mysql-test/suite/galera/t/galera_event_node_evict.cnf +++ b/mysql-test/suite/galera/t/galera_event_node_evict.cnf @@ -1,14 +1,14 @@ !include ../galera_4nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.auto_evict=1' +wsrep_provider_options='evs.auto_evict=1;gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.auto_evict=1' +wsrep_provider_options='evs.auto_evict=1;gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_status_file='status2.json' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.auto_evict=1' +wsrep_provider_options='evs.auto_evict=1;gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.auto_evict=1' +wsrep_provider_options='evs.auto_evict=1;gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_event_node_evict.test b/mysql-test/suite/galera/t/galera_event_node_evict.test index 9651bf09d48..738f51212da 100644 --- a/mysql-test/suite/galera/t/galera_event_node_evict.test +++ b/mysql-test/suite/galera/t/galera_event_node_evict.test @@ -11,17 +11,17 @@ --source suite/wsrep/include/check_galera_version.inc --connection node_1 -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); --connection node_2 -CALL mtr.add_suppression("\\[Warning\\] WSREP: handshake with .* .* failed: 'evicted'"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: handshake with .* ?.+ failed: 'evicted'"); CALL mtr.add_suppression("\\[ERROR\\] WSREP: exception from gcomm, backend must be restarted: this node has been evicted out of the cluster, gcomm backend restart is required \\(FATAL\\)"); --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 -CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* at .* permanently from group"); +CALL mtr.add_suppression("\\[Warning\\] WSREP: evicting member .* ?at .+ permanently from group"); # Save original auto_increment_offset values. diff --git a/mysql-test/suite/galera/t/galera_fk_truncate.cnf b/mysql-test/suite/galera/t/galera_fk_truncate.cnf new file mode 100644 index 00000000000..91e9199b092 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_truncate.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +auto_increment_offset=1 +auto_increment_increment=1 + +[mysqld.2] +auto_increment_offset=2 +auto_increment_increment=1 diff --git a/mysql-test/suite/galera/t/galera_flush_local.test b/mysql-test/suite/galera/t/galera_flush_local.test index 207ce0ceae0..b9712fccf46 100644 --- a/mysql-test/suite/galera/t/galera_flush_local.test +++ b/mysql-test/suite/galera/t/galera_flush_local.test @@ -3,6 +3,7 @@ # PXC-391 --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_query_cache.inc --disable_warnings @@ -72,7 +73,6 @@ SELECT COUNT(*) AS EXPECT_10 FROM x1; SELECT COUNT(*) AS EXPECT_10000 FROM t2; SELECT COUNT(*) AS EXPECT_10 FROM x2; - --connection node_1 DROP TABLE t1, t2, x1, x2; CREATE TABLE t1 (f1 INTEGER); @@ -144,4 +144,3 @@ DROP TABLE t1, t2, x1, x2; --disable_query_log SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test index 786837239ed..2866d6fee88 100644 --- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -49,4 +49,3 @@ DROP DATABASE testdb_9401; #--source include/galera_end.inc --echo # End of tests - diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf index 34c757de77e..0b4cba4ee2c 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.test b/mysql-test/suite/galera/t/galera_gcache_recover.test index fe2a65ee14e..b7ef486ae31 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf index 0157d2f08b1..1d64266a395 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf @@ -3,7 +3,7 @@ [mysqld.1] max_allowed_packet=10M innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test index 6b3e56d8a0f..99a5e621c08 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf index c6432f3607e..99d144a563e 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf @@ -2,8 +2,8 @@ [mysqld.1] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' 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 3834607ce86..3c250077911 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --source include/big_test.inc +--source include/have_innodb.inc --source include/have_log_bin.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf index aae3fee5904..b75fddaef6f 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf index 6bb11e5957a..b75fddaef6f 100644 --- a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64;gcache.size=10M' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64;gcache.size=10M' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gtid.cnf b/mysql-test/suite/galera/t/galera_gtid.cnf index 8f6a760def0..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/galera_gtid.cnf +++ b/mysql-test/suite/galera/t/galera_gtid.cnf @@ -7,4 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf index bda7a00ab2e..76887d5c189 100644 --- a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf @@ -13,4 +13,3 @@ wsrep_gtid_mode=ON server-id=12 log_slave_updates log_bin - diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.cnf b/mysql-test/suite/galera/t/galera_gtid_slave.cnf index 112c487851f..5d242f01707 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_slave.cnf @@ -4,13 +4,16 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.3] gtid-domain-id=2 diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf index efeb536de96..2b05acfde01 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf @@ -5,14 +5,16 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW wsrep_sst_method=rsync + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.3] gtid-domain-id=2 - diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test index 6c7beb4ae16..b54c36207cd 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -13,6 +13,7 @@ # As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it # we open the node_3 connection here --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + --echo #Connection 2 --connection node_2 --disable_query_log @@ -30,6 +31,7 @@ INSERT INTO t2 VALUES(3,33); SELECT @@global.gtid_binlog_state; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -39,6 +41,7 @@ INSERT INTO t2 VALUES(4,44); INSERT INTO t2 VALUES(5,55); INSERT INTO t2 VALUES(6,66); SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2'; @@ -60,6 +63,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -68,6 +72,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1'; @@ -77,10 +82,12 @@ COMMIT; --let $node_1= node_1 --let $node_2= node_2 --source include/auto_increment_offset_save.inc + --echo #Connection 2 --connection node_2 --echo Shutting down server ... --source include/shutdown_mysqld.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' @@ -90,6 +97,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; + --echo #Connection 2 --connection node_2 --echo Starting server ... @@ -103,11 +111,13 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 8 FROM t1; --source include/wait_condition.inc Select * from t1 order by f1; + --echo #Connection 2 --connection node_2 Select * from t1 order by f1; @@ -153,12 +163,14 @@ start slave; INSERT INTO t1 VALUES ('node2_slave_started'); SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 12 FROM t1; --source include/wait_condition.inc SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 3 --connection node_3 DROP TABLE t2,t1; @@ -173,10 +185,12 @@ DROP TABLE t2,t1; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; --source include/wait_condition.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc + --echo #Connection 2 --connection node_2 STOP SLAVE; @@ -194,6 +208,7 @@ set global gtid_slave_pos=""; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; + --echo #Connection 3 --connection node_3 reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf index 5f129e7c168..1422f977bf7 100644 --- a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf @@ -4,10 +4,12 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 diff --git a/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test index f4aac7fd795..1aeb1981150 100644 --- a/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test +++ b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test @@ -6,9 +6,14 @@ CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); BEGIN; +SET DEBUG_SYNC = 'wsrep_after_statement_enter SIGNAL blocked'; --send UPDATE t1 set b = 100 where id between 1 and 2; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; +SET DEBUG_SYNC = 'wsrep_after_statement_enter CLEAR'; + --connection node_1b SET @save_dbug = @@SESSION.debug_dbug; SET @@SESSION.innodb_lock_wait_timeout=2; @@ -21,5 +26,6 @@ SET @@SESSION.debug_dbug = @save_dbug; --reap COMMIT; SELECT * FROM t1; +SET DEBUG_SYNC = 'RESET'; --disconnect node_1b DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_insert_ignore.test b/mysql-test/suite/galera/t/galera_insert_ignore.test index 027f70e96d9..4d500ab7b4e 100644 --- a/mysql-test/suite/galera/t/galera_insert_ignore.test +++ b/mysql-test/suite/galera/t/galera_insert_ignore.test @@ -57,4 +57,3 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; --eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig - diff --git a/mysql-test/suite/galera/t/galera_insert_multi.test b/mysql-test/suite/galera/t/galera_insert_multi.test index d62283aff69..35205921283 100644 --- a/mysql-test/suite/galera/t/galera_insert_multi.test +++ b/mysql-test/suite/galera/t/galera_insert_multi.test @@ -113,10 +113,3 @@ SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) = 2 FROM t1; DROP TABLE t1; - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf index 3d43138f3c7..9bbd1e70bb6 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf @@ -33,10 +33,10 @@ log_slave_updates=ON log_bin=binlog [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf index 6fc6e3421cb..d2459ca1a73 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf @@ -33,10 +33,10 @@ log_slave_updates=ON log_bin=binlog [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf index f03527dc808..fea434ab181 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth=root: [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf index e4f52aaad0a..e0651b03e67 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf @@ -7,10 +7,10 @@ wsrep_sst_auth=root: innodb_flush_log_at_trx_commit=0 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf index d1d3b4eb9cd..f6b72221254 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf @@ -9,11 +9,11 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' loose-innodb-log-file-buffering [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' loose-innodb-log-file-buffering [sst] diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf index 807829f047f..1007de9f779 100644 --- a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf @@ -4,7 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.test b/mysql-test/suite/galera/t/galera_ist_mysqldump.test index 73b406d016b..71be0919483 100644 --- a/mysql-test/suite/galera/t/galera_ist_mysqldump.test +++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.test @@ -2,14 +2,14 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source suite/galera/include/galera_sst_set_mysqldump.inc - call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); --let $node_1=node_1 --let $node_2=node_2 --source include/auto_increment_offset_save.inc +--source suite/galera/include/galera_sst_set_mysqldump.inc + # mysql-wsrep#33 - nnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx_sys_update_wsrep_checkpoint with mysqldump IST # --source suite/galera/include/galera_st_disconnect_slave.inc diff --git a/mysql-test/suite/galera/t/galera_ist_progress.cnf b/mysql-test/suite/galera/t/galera_ist_progress.cnf index b37e7f38ce3..7a043bbe9f0 100644 --- a/mysql-test/suite/galera/t/galera_ist_progress.cnf +++ b/mysql-test/suite/galera/t/galera_ist_progress.cnf @@ -1,7 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' - - - +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf index 2628f05eaef..90502d3326e 100644 --- a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf +++ b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf @@ -1,8 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1' - +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf index 10958aad9a8..7a043bbe9f0 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.cnf b/mysql-test/suite/galera/t/galera_ist_rsync.cnf index 7a3da6dad02..33cea999503 100644 --- a/mysql-test/suite/galera/t/galera_ist_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_ist_rsync.cnf @@ -4,9 +4,9 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sync_wait=1 [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sync_wait=1 diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf index 9125f6708fe..ddedc97717c 100644 --- a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf +++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf @@ -8,10 +8,10 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] ssl-mode=VERIFY_CA diff --git a/mysql-test/suite/galera/t/galera_kill_applier.cnf b/mysql-test/suite/galera/t/galera_kill_applier.cnf index 62cf1854032..18a80b22fb6 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.cnf +++ b/mysql-test/suite/galera/t/galera_kill_applier.cnf @@ -1,7 +1,9 @@ !include ../galera_2nodes.cnf [mysqld.1] +wsrep_slave_threads=1 wsrep-debug=1 [mysqld.2] +wsrep_slave_threads=1 wsrep-debug=1 diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test index 15e1727de03..bb1e76b5d7d 100644 --- a/mysql-test/suite/galera/t/galera_kill_smallchanges.test +++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_load_data.test b/mysql-test/suite/galera/t/galera_load_data.test index 252580f9426..24cd55c4ae0 100644 --- a/mysql-test/suite/galera/t/galera_load_data.test +++ b/mysql-test/suite/galera/t/galera_load_data.test @@ -397,4 +397,3 @@ SELECT data_length from information_schema.tables WHERE TABLE_NAME = 'cardtest_t --connection node_1 use test; drop database cardtest02; - diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf index 3c14cde794c..b9da661bb42 100644 --- a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf +++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index 3623b3f33b0..0c2d974561a 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -1,5 +1,6 @@ --source include/big_test.inc --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.cnf b/mysql-test/suite/galera/t/galera_mdev_13787.cnf index ada78e1db2a..5f954d5ccba 100644 --- a/mysql-test/suite/galera/t/galera_mdev_13787.cnf +++ b/mysql-test/suite/galera/t/galera_mdev_13787.cnf @@ -5,5 +5,3 @@ innodb-stats-persistent=1 [mysqld.2] innodb-stats-persistent=1 - - diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.test b/mysql-test/suite/galera/t/galera_mdev_13787.test index 940cffb8b65..458d7f1d5d4 100644 --- a/mysql-test/suite/galera/t/galera_mdev_13787.test +++ b/mysql-test/suite/galera/t/galera_mdev_13787.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc + --connection node_1 create table t(a int); insert into t select 1; diff --git a/mysql-test/suite/galera/t/galera_mdev_15611.cnf b/mysql-test/suite/galera/t/galera_mdev_15611.cnf index b6f601c56b1..1d9f793beff 100644 --- a/mysql-test/suite/galera/t/galera_mdev_15611.cnf +++ b/mysql-test/suite/galera/t/galera_mdev_15611.cnf @@ -1,4 +1,5 @@ !include ../galera_2nodes.cnf + [mysqld.1] [mysqld.2] diff --git a/mysql-test/suite/galera/t/galera_mdl_race.test b/mysql-test/suite/galera/t/galera_mdl_race.test index 3341a3792f1..9d6babea0b3 100644 --- a/mysql-test/suite/galera/t/galera_mdl_race.test +++ b/mysql-test/suite/galera/t/galera_mdl_race.test @@ -91,4 +91,3 @@ SET DEBUG_SYNC = "RESET"; --disconnect node_1a --disconnect node_1b --disconnect node_1c - diff --git a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test index 8a5173f576b..c7592d8fe88 100644 --- a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test +++ b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test @@ -26,7 +26,6 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc - # Setup CREATE TABLE t1 (f1 VARCHAR(32) NOT NULL) ENGINE=InnoDB; @@ -44,7 +43,7 @@ SET SESSION wsrep_sync_wait = 0; SET GLOBAL wsrep_slave_threads = 2; --echo *************************************************************** ---echo scenario 1, conflicting UPDATE +--echo scenario 1, conflicting UPDATE --echo *************************************************************** # Set up a synchronization point to catch the first transaction @@ -99,9 +98,8 @@ COMMIT; --source include/galera_signal_sync_point.inc --source include/galera_clear_sync_point.inc - --echo *************************************************************** ---echo scenario 2, conflicting DELETE +--echo scenario 2, conflicting DELETE --echo *************************************************************** # Set up a synchronization point to catch the first transaction @@ -164,5 +162,6 @@ SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP TABLE t2; + --connection node_2 SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_nopk_unicode.test b/mysql-test/suite/galera/t/galera_nopk_unicode.test index e036e14ebe0..8e98f1e5e47 100644 --- a/mysql-test/suite/galera/t/galera_nopk_unicode.test +++ b/mysql-test/suite/galera/t/galera_nopk_unicode.test @@ -39,5 +39,4 @@ COMMIT; SELECT f1 = 'текст2' FROM t1; SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test index b49253efc02..52226850532 100644 --- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test +++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test @@ -29,11 +29,13 @@ INSERT INTO t2 VALUES (1); --let $galera_connection_name = node_2a --let $galera_server_number = 2 --source include/galera_connect.inc + --connection node_2a --sleep 1 SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE 'Commit' or STATE = 'Waiting for certification'); -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); + SELECT COUNT(*) AS EXPECT_0 FROM t1; SELECT COUNT(*) AS EXPECT_0 FROM t2; @@ -44,8 +46,11 @@ UNLOCK TABLES; --eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig; SELECT COUNT(*) AS EXPECT_1 FROM t1; SELECT COUNT(*) AS EXPECT_1 FROM t2; -SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); +--disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test index df0200fab55..f7d1c2c1e62 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test @@ -67,4 +67,3 @@ SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1; --connection default DROP TABLE t1; DROP TABLE ten; - diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test index 587fbe10fe4..a3e2f249e2f 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test @@ -91,5 +91,3 @@ SELECT COUNT(DISTINCT f1) FROM t1; DROP TABLE t1; DROP TABLE ten; DROP PROCEDURE p1; - - diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index 48171a1777e..074af301671 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -48,10 +48,10 @@ INSERT INTO t2 select * from t2; --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE 'Commit' or STATE = 'Waiting for certification'); +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); --source include/wait_condition.inc UNLOCK TABLES; @@ -61,7 +61,9 @@ SET SESSION wsrep_sync_wait = 15; SELECT COUNT(*) as expect_20 FROM t1; SELECT COUNT(*) as expect_20 FROM t2; +--disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_partitioned_tables.test b/mysql-test/suite/galera/t/galera_partitioned_tables.test index f29adcf1501..8e52b59d97d 100644 --- a/mysql-test/suite/galera/t/galera_partitioned_tables.test +++ b/mysql-test/suite/galera/t/galera_partitioned_tables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); --echo # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf index ae48aa3ae0f..5ea513d111e 100644 --- a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf @@ -4,8 +4,7 @@ wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' - +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' diff --git a/mysql-test/suite/galera/t/galera_pc_recovery.test b/mysql-test/suite/galera/t/galera_pc_recovery.test index 631054103a3..4489db63a91 100644 --- a/mysql-test/suite/galera/t/galera_pc_recovery.test +++ b/mysql-test/suite/galera/t/galera_pc_recovery.test @@ -33,8 +33,8 @@ SELECT COUNT(*) = 1 FROM t1; # Perform --wsrep-recover and preserve the positions into variables by placing them in $MYSQL_TMP_DIR/galera_wsrep_start_position.inc and then --source'ing it ---exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.1.log > $MYSQL_TMP_DIR/galera_wsrep_recover.1.log 2>&1 ---exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.2.log > $MYSQL_TMP_DIR/galera_wsrep_recover.2.log 2>&1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --loose-innodb --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.1.log > $MYSQL_TMP_DIR/galera_wsrep_recover.1.log 2>&1 +--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --loose-innodb --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.2.log > $MYSQL_TMP_DIR/galera_wsrep_recover.2.log 2>&1 --perl use strict; diff --git a/mysql-test/suite/galera/t/galera_query_cache.cnf b/mysql-test/suite/galera/t/galera_query_cache.cnf index 80f40b0997e..5f37e357a52 100644 --- a/mysql-test/suite/galera/t/galera_query_cache.cnf +++ b/mysql-test/suite/galera/t/galera_query_cache.cnf @@ -7,4 +7,3 @@ query_cache_size=1355776 [mysqld.2] query_cache_type=1 query_cache_size=1355776 - diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test index 5a03bcf8c99..e27eb5fc86a 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test @@ -29,7 +29,7 @@ call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node"); --connection node_3 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_ssl_verify_server_cert=0, master_use_gtid=current_pos +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos; --enable_query_log START SLAVE; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf index 80f40b0997e..5f37e357a52 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf +++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf @@ -7,4 +7,3 @@ query_cache_size=1355776 [mysqld.2] query_cache_type=1 query_cache_size=1355776 - diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index 8d8a8cf88aa..3a3857572ba 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -48,4 +48,3 @@ DROP TABLE t2; SET GLOBAL read_only=FALSE; DROP TABLE t1; DROP USER foo@localhost; - diff --git a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test index 8749c20faed..5d12ad1c1c4 100644 --- a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test +++ b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test @@ -25,7 +25,6 @@ UPDATE t2 SET f1 = REPEAT('b', 256); SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234; SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256); - --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_replica_no_gtid.test b/mysql-test/suite/galera/t/galera_replica_no_gtid.test index 12e9038dc1c..de3bbc4b276 100644 --- a/mysql-test/suite/galera/t/galera_replica_no_gtid.test +++ b/mysql-test/suite/galera/t/galera_replica_no_gtid.test @@ -23,7 +23,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --connection node_2 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test index 0a6a0c5ccbe..8ca80649d3f 100644 --- a/mysql-test/suite/galera/t/galera_restart_nochanges.test +++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test @@ -37,4 +37,3 @@ DROP TABLE t1; --source include/auto_increment_offset_restore.inc --source include/galera_end.inc - diff --git a/mysql-test/suite/galera/t/galera_restart_replica.cnf b/mysql-test/suite/galera/t/galera_restart_replica.cnf index 6713e301527..cb2a7998ec6 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.cnf +++ b/mysql-test/suite/galera/t/galera_restart_replica.cnf @@ -17,4 +17,3 @@ wsrep_gtid_mode=1 wsrep_gtid_domain_id=16 gtid_domain_id=11 gtid_strict_mode=1 - diff --git a/mysql-test/suite/galera/t/galera_restart_replica.test b/mysql-test/suite/galera/t/galera_restart_replica.test index 05ab77f2519..d28bd0ed1f7 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.test +++ b/mysql-test/suite/galera/t/galera_restart_replica.test @@ -40,11 +40,12 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = node_1 --let $node_2 = replica +--let $node_3 = primary --source include/auto_increment_offset_save.inc --connection replica --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_ssl_verify_server_cert=0, master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_savepoint_replay.test b/mysql-test/suite/galera/t/galera_savepoint_replay.test index cff26f4a94f..d8b04847a2b 100644 --- a/mysql-test/suite/galera/t/galera_savepoint_replay.test +++ b/mysql-test/suite/galera/t/galera_savepoint_replay.test @@ -83,4 +83,3 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_sequence_engine.test b/mysql-test/suite/galera/t/galera_sequence_engine.test index 47107dcce84..affdfaa9d2a 100644 --- a/mysql-test/suite/galera/t/galera_sequence_engine.test +++ b/mysql-test/suite/galera/t/galera_sequence_engine.test @@ -1,6 +1,13 @@ --source include/galera_cluster.inc --source include/have_sequence.inc +--connection node_2 +let $restore_wsrep_ignore_apply_errors=`SELECT @@GLOBAL.wsrep_ignore_apply_errors`; +SET GLOBAL wsrep_ignore_apply_errors=0; + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET SESSION wsrep_sync_wait=0; SET GLOBAL wsrep_ignore_apply_errors=0; SET SESSION AUTOCOMMIT=0; SET SESSION max_error_count=0; @@ -11,6 +18,8 @@ CREATE TABLE t0 (id GEOMETRY,parent_id GEOMETRY)ENGINE=SEQUENCE; --error ER_NO_SUCH_TABLE SHOW CREATE TABLE t0; ---connection node_1 -SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +--disable_query_log +--eval SET GLOBAL wsrep_ignore_apply_errors=$restore_wsrep_ignore_apply_errors +--enable_query_log +--disconnect node_2a diff --git a/mysql-test/suite/galera/t/galera_sequences.cnf b/mysql-test/suite/galera/t/galera_sequences.cnf index 3a0543e3d34..8701e86db5f 100644 --- a/mysql-test/suite/galera/t/galera_sequences.cnf +++ b/mysql-test/suite/galera/t/galera_sequences.cnf @@ -1,13 +1,9 @@ !include ../galera_2nodes.cnf [mysqld.1] -log-bin -log-slave-updates auto-increment-increment=2 auto-increment-offset=1 [mysqld.2] -log-bin -log-slave-updates auto-increment-increment=2 auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/galera_sequences.combinations b/mysql-test/suite/galera/t/galera_sequences.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 75a31b224b9..9e18353893b 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -1,6 +1,9 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_aria.inc +--disable_ps2_protocol # # MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster # @@ -45,6 +48,7 @@ SHOW CREATE SEQUENCE Seq1_1; select NEXT VALUE FOR Seq1_1; --connection node_1 +SHOW CREATE SEQUENCE Seq1_1; DROP SEQUENCE Seq1_1; # @@ -316,6 +320,12 @@ SELECT NEXTVAL(t); DROP TABLE t1; DROP SEQUENCE t; +--connection node_2 +--let $wsrep_sync_wait_orig_2 = `SELECT @@wsrep_sync_wait` +SET SESSION wsrep_sync_wait=15; + +--connection node_1 + CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; # @@ -338,6 +348,10 @@ SELECT NEXTVAL(t); SELECT * FROM t1; SELECT NEXTVAL(t); +--disable_query_log +--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_2 +--enable_query_log + --connection node_1 DROP TABLE t1; DROP SEQUENCE t; @@ -355,4 +369,17 @@ CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; ALTER SEQUENCE IF EXISTS t MINVALUE=1; DROP TABLE t; + +--echo +--echo MDEV-32631: +--echo + +CREATE OR REPLACE TABLE t1(c INT ) ENGINE=ARIA; +SET SESSION WSREP_OSU_METHOD=RSU; +--error ER_NOT_SUPPORTED_YET +INSERT INTO t1 SELECT seq,concat(seq,1) FROM seq_1_to_100; +SET SESSION WSREP_OSU_METHOD=TOI; +DROP TABLE t1; + +--echo --echo End of 10.5 tests diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf b/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf new file mode 100644 index 00000000000..8701e86db5f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations b/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.test b/mysql-test/suite/galera/t/galera_sequences_bf_kill.test new file mode 100644 index 00000000000..3c53a103d44 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.test @@ -0,0 +1,115 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--disable_ps2_protocol +# +# We create InnoDB seqeuence with small cache that is then +# used as default value for column in table. +# +--connection node_1 +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +--connection node_1 +START TRANSACTION; +INSERT INTO t1 VALUES (4, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (5, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (6, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (7, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (8, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (9, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (10, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (11, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (12, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (13, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (14, next value for s); # No conflict in cert +SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; # Should cause GAP lock between 1 and 3 + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait=0; +# Block the applier on node #1 and issue a conflicting update on node #2 +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# Send conflicting INSERT +# +--connection node_2 +INSERT INTO t1 VALUES (2, 2); # This should BF abort because of GAP lock + +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# Block the commit, send the COMMIT and wait until it gets blocked +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a + +--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# Let the transactions proceed +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# Commit succeeds +--connection node_1 +--reap + +# wsrep_local_replays has increased by 1 +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +INSERT INTO t1 VALUES (22, next value for s); +INSERT INTO t1 VALUES (23, next value for s); +INSERT INTO t1 VALUES (24, next value for s); +INSERT INTO t1 VALUES (25, next value for s); +INSERT INTO t1 VALUES (26, next value for s); +INSERT INTO t1 VALUES (27, next value for s); +INSERT INTO t1 VALUES (28, next value for s); +INSERT INTO t1 VALUES (29, next value for s); +INSERT INTO t1 VALUES (30, next value for s); +INSERT INTO t1 VALUES (31, next value for s); +INSERT INTO t1 VALUES (32, next value for s); +INSERT INTO t1 VALUES (33, next value for s); +INSERT INTO t1 VALUES (34, next value for s); +INSERT INTO t1 VALUES (35, next value for s); + +--connection node_1 +SELECT * FROM t1; +SELECT LASTVAL(s); + +--connection node_2 +SELECT * FROM t1; +SELECT LASTVAL(s); + +--connection node_1 +SELECT NEXTVAL(s); + +--connection node_2 +SELECT NEXTVAL(s); + +DROP SEQUENCE s; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.cnf b/mysql-test/suite/galera/t/galera_sequences_transaction.cnf new file mode 100644 index 00000000000..8701e86db5f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.combinations b/mysql-test/suite/galera/t/galera_sequences_transaction.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.test b/mysql-test/suite/galera/t/galera_sequences_transaction.test new file mode 100644 index 00000000000..f3dc7d51285 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.test @@ -0,0 +1,255 @@ +--source include/galera_cluster.inc +--source include/have_sequence.inc + +--disable_ps2_protocol +# +# Case 1: Separate transactions from few connections +# +--connection node_1 +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--connection node_1 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; + +--connection node_2 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; + +--connection node_2a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; + +--connection node_1a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +COMMIT; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; + +# +# Case 2: All rollback +# +--connection node_1 +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; + +--connection node_1 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; + +--connection node_2 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; + +--connection node_2a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; + +--connection node_1a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +ROLLBACK; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; +# +# Case 3: Mixed transactions +# +--connection node_1 +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB; + +--connection node_1 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); + +--connection node_1a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); + +--connection node_2a +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); + +--connection node_2 +BEGIN; +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); +INSERT INTO t1(f2) values (1); + +--connection node_1 +COMMIT; +--connection node_1a +ROLLBACK; +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; +--connection node_2a +--error ER_LOCK_DEADLOCK +ROLLBACK; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; diff --git a/mysql-test/suite/galera/t/galera_server.test b/mysql-test/suite/galera/t/galera_server.test index 30b39028b96..36687402d4e 100644 --- a/mysql-test/suite/galera/t/galera_server.test +++ b/mysql-test/suite/galera/t/galera_server.test @@ -25,4 +25,3 @@ SELECT COUNT(*)=0 FROM mysql.servers; --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test index 4dfddb0f32a..a7f26e28aca 100644 --- a/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test +++ b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test @@ -95,4 +95,5 @@ if ($galera_wsrep_start_position != $expected_position) --connection node_1 DROP TABLE t1; SET GLOBAL wsrep_slave_threads = DEFAULT; + --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test index d289cfb3bd2..49ffa2a0fe3 100644 --- a/mysql-test/suite/galera/t/galera_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_slave_replay.test @@ -6,6 +6,7 @@ # or rollback and replay (depending on the nature of lock conflict). # +--source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_log_bin.inc --source include/have_debug.inc @@ -13,9 +14,7 @@ --source include/galera_have_debug_sync.inc --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 - --connection node_2a ---source include/galera_cluster.inc ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; @@ -36,7 +35,7 @@ RESET MASTER; # nodes 1 and 2 form a galera cluster, node 2 operates as slave for native MariaDB master in node 3 # --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/galera_sp_bf_abort.inc b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc index 58345184e98..a3c8c16209d 100644 --- a/mysql-test/suite/galera/t/galera_sp_bf_abort.inc +++ b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc @@ -35,4 +35,3 @@ --source include/galera_signal_sync_point.inc --let $galera_sync_point = after_replicate_sync --source include/galera_signal_sync_point.inc - diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index b1ea9c9b4ab..bb6a4c8e648 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -13,6 +13,7 @@ --let $node_2=node_2 --source include/auto_increment_offset_save.inc +--connection node_2 call mtr.add_suppression("WSREP: TO isolation failed for: "); --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test index cd8d6ba6426..c8c46b25e1c 100644 --- a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test +++ b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test @@ -17,7 +17,6 @@ SET SESSION sql_log_bin = 1; INSERT INTO t1 VALUES (2); - --connection node_2 SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; diff --git a/mysql-test/suite/galera/t/galera_ssl.cnf b/mysql-test/suite/galera/t/galera_ssl.cnf index de57c9ffbf0..904842c88b6 100644 --- a/mysql-test/suite/galera/t/galera_ssl.cnf +++ b/mysql-test/suite/galera/t/galera_ssl.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl.test b/mysql-test/suite/galera/t/galera_ssl.test index e6346aa2151..984fca6ab96 100644 --- a/mysql-test/suite/galera/t/galera_ssl.test +++ b/mysql-test/suite/galera/t/galera_ssl.test @@ -9,6 +9,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf index dff9c96afbb..776c321d800 100644 --- a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-cipher=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.cnf b/mysql-test/suite/galera/t/galera_ssl_compression.cnf index 4dffe99bd5a..2994c552338 100644 --- a/mysql-test/suite/galera/t/galera_ssl_compression.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_compression.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.test b/mysql-test/suite/galera/t/galera_ssl_compression.test index 1df4aa26ebb..8d9dcbd6ced 100644 --- a/mysql-test/suite/galera/t/galera_ssl_compression.test +++ b/mysql-test/suite/galera/t/galera_ssl_compression.test @@ -8,6 +8,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 7c495102564..ee8c6e590f4 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-upgrade=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index 78897ffd738..f86aa3730f3 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -10,6 +10,9 @@ --source include/have_openssl.inc --source include/force_restart.inc +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf index 596bb95ac6a..182173211e1 100644 --- a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf +++ b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf @@ -10,7 +10,7 @@ innodb_encryption_threads = 4 wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 8cb962cb95b..9c92b49c2c1 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -6,12 +6,12 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' innodb_fast_shutdown=0 innodb_undo_tablespaces=0 [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' innodb_fast_shutdown=0 innodb_undo_tablespaces=3 loose_innodb_log_file_buffering diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.test b/mysql-test/suite/galera/t/galera_sst_mariabackup.test index 96f8b4dca55..7dead49eb98 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.test @@ -1,5 +1,6 @@ --source include/big_test.inc --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_mariabackup.inc # Save original auto_increment_offset values. diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf index b1caf700a12..20581ee765e 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf @@ -6,11 +6,11 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/data_dir_test -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf index 857a4101406..1e6bbcce82f 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf @@ -6,10 +6,10 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf new file mode 100644 index 00000000000..053c2175946 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf @@ -0,0 +1,28 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" +gtid_strict_mode=ON +wsrep-gtid_mode=ON +log-bin +log-slave_updates +loose-galera-sst-mariabackup-gtid=1 + +[mysqld.1] +wsrep_provider_options='pc.weight=2;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=mbstream diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test new file mode 100644 index 00000000000..66cd0c92307 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test @@ -0,0 +1,29 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc +--source include/force_restart.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--connection node_1 +--echo # Node_1 +SHOW global variables like 'gtid%pos'; + +--connection node_2 +--echo # Node_2 +SHOW global variables like 'gtid%pos'; + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf index 04043ac2b74..8e68fc0554a 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf @@ -6,10 +6,10 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf index a09efd2e011..56ab462df7d 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf index 857a4101406..06a49ff85d0 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf @@ -6,10 +6,10 @@ wsrep_sst_auth="root:" wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf index 05a647eb090..0504f610b80 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf @@ -5,4 +5,4 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mariabackup] -use_memory=123m +use_memory=129m diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test index f6ba873976e..bbc689b03ed 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test @@ -40,8 +40,8 @@ let $restart_noprint=2; --source include/wait_condition.inc # Confirm that IST did not take place ---let $assert_text = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) ---let $assert_select = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_text = mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_select = mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\) --let $assert_count = 1 --let $assert_file = $MYSQLTEST_VARDIR/mysqld.2/data/mariabackup.prepare.log --let $assert_only_after = Starting InnoDB instance for recovery diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf index af4fedf12ce..1007de9f779 100644 --- a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf @@ -4,6 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf index da04a605291..2e4e0ffd31d 100644 --- a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf @@ -9,10 +9,10 @@ wsrep-sync_wait=15 loose-galera_sst_mysqldump_with_key=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [client] ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_sst_rsync.cnf index 29d3a1e6219..197c2a1a11e 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync.cnf @@ -4,7 +4,7 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf index a089baacf36..483d4b0f015 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/server1_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server1_binlog_index.index [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/server2_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server2_binlog_index.index diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf index b1e4278dceb..dcd77967c80 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf @@ -4,9 +4,9 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=server1_binlog [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=server2_binlog diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf index 4cc3442bd87..b873ac0d6a1 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/rsync_test_2 -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' [sst] backup_threads=2 diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf index 3ab762df013..d93f5a1a663 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf @@ -14,7 +14,7 @@ ssl-ca= ssl-mode=VERIFY_CA [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf index 948b52d4bf7..354376baec8 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf @@ -8,7 +8,7 @@ tkey=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem tcert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf index 8ed9348e789..6ad746ebff0 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf @@ -10,7 +10,7 @@ ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem ssl-mode=VERIFY_CA [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf new file mode 100644 index 00000000000..af5d2225bba --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf @@ -0,0 +1,23 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=rsync +gtid_strict_mode=ON +wsrep-gtid_mode=ON +log-bin +log-slave_updates +loose-galera-sst-rsync-gtid=1 + +[mysqld.1] +wsrep_provider_options='pc.weight=2;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test new file mode 100644 index 00000000000..66cd0c92307 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test @@ -0,0 +1,29 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc +--source include/force_restart.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--connection node_1 +--echo # Node_1 +SHOW global variables like 'gtid%pos'; + +--connection node_2 +--echo # Node_2 +SHOW global variables like 'gtid%pos'; + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf index 3913ab6660f..4c9745cba66 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_basename=server1 log_bin [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_basename=server2 log_bin diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf index c2888926a57..c1011763faf 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf @@ -5,14 +5,14 @@ wsrep_sst_method=rsync bind-address=:: [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_address=::1 wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' [mysqld.2] -wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;gcache.size=1;pc.ignore_sb=true' -wsrep_node_address=::1 +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_node_address=::1 wsrep_sst_receive_address=AUTO diff --git a/mysql-test/suite/galera/t/galera_status_cluster.test b/mysql-test/suite/galera/t/galera_status_cluster.test index 3299613d584..0c2260321e9 100644 --- a/mysql-test/suite/galera/t/galera_status_cluster.test +++ b/mysql-test/suite/galera/t/galera_status_cluster.test @@ -14,5 +14,3 @@ SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; - - diff --git a/mysql-test/suite/galera/t/galera_status_local_index.test b/mysql-test/suite/galera/t/galera_status_local_index.test index b61b8ced863..3e15911537a 100644 --- a/mysql-test/suite/galera/t/galera_status_local_index.test +++ b/mysql-test/suite/galera/t/galera_status_local_index.test @@ -12,7 +12,6 @@ INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_ --connection node_2 INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); - --connection node_1 SELECT COUNT(*) = 2 FROM wsrep_local_indexes; SELECT COUNT(DISTINCT wsrep_local_index) = 2 FROM wsrep_local_indexes; diff --git a/mysql-test/suite/galera/t/galera_status_local_state.test b/mysql-test/suite/galera/t/galera_status_local_state.test index 09cdb25f80c..6401c32082f 100644 --- a/mysql-test/suite/galera/t/galera_status_local_state.test +++ b/mysql-test/suite/galera/t/galera_status_local_state.test @@ -22,7 +22,3 @@ SET GLOBAL wsrep_desync = 0; --source include/wait_condition.inc SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; - - - - diff --git a/mysql-test/suite/galera/t/galera_strict_require_innodb.test b/mysql-test/suite/galera/t/galera_strict_require_innodb.test index b627fffe70c..6ca95432dbc 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_innodb.test +++ b/mysql-test/suite/galera/t/galera_strict_require_innodb.test @@ -15,9 +15,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine .*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine "); CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM; @@ -114,4 +115,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test index dc5f9910396..4733c2e2ef4 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test +++ b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test @@ -14,9 +14,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; @@ -140,4 +141,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index 0f95bcd4531..9a238e59f30 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -67,4 +67,3 @@ DROP TABLE t1; # Restore original auto_increment_offset values. --let $node_2=node_2a --source include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto.test b/mysql-test/suite/galera/t/galera_sync_wait_upto.test index aaecd8760f5..4aba69f6152 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto.test @@ -3,8 +3,8 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc ---source include/have_debug_sync.inc CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); @@ -44,7 +44,6 @@ SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2'); --eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$wsrep_last_committed_gtid') AS WSREP_SYNC_WAIT_UPTO; --enable_query_log - # Timeout if GTID is not received on time --disable_query_log diff --git a/mysql-test/suite/galera/t/galera_table_with_hyphen.inc b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc index ac79d864e82..f53a08cd401 100644 --- a/mysql-test/suite/galera/t/galera_table_with_hyphen.inc +++ b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc @@ -45,4 +45,3 @@ SET GLOBAL wsrep_slave_threads=DEFAULT; --connection node_2 --eval drop table `$fk_child` --eval drop table `$fk_parent` - diff --git a/mysql-test/suite/galera/t/galera_temporary_sequences.test b/mysql-test/suite/galera/t/galera_temporary_sequences.test index c46c4243514..a85124950af 100644 --- a/mysql-test/suite/galera/t/galera_temporary_sequences.test +++ b/mysql-test/suite/galera/t/galera_temporary_sequences.test @@ -30,7 +30,6 @@ SELECT * FROM t; SHOW CREATE TABLE seq1; SHOW CREATE TABLE seq2; - --connection node_1 DROP TABLE t; DROP SEQUENCE seq1; diff --git a/mysql-test/suite/galera/t/galera_threadpool.cnf b/mysql-test/suite/galera/t/galera_threadpool.cnf index c1a1e6a81aa..0ef20a3abb9 100644 --- a/mysql-test/suite/galera/t/galera_threadpool.cnf +++ b/mysql-test/suite/galera/t/galera_threadpool.cnf @@ -13,5 +13,3 @@ log_bin=binlog log_slave_updates=ON wsrep_sst_method=rsync thread_handling = pool-of-threads - - diff --git a/mysql-test/suite/galera/t/galera_threadpool.test b/mysql-test/suite/galera/t/galera_threadpool.test index 78b26e6e89f..e5d2db15bec 100644 --- a/mysql-test/suite/galera/t/galera_threadpool.test +++ b/mysql-test/suite/galera/t/galera_threadpool.test @@ -5,7 +5,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 - --source ../galera/include/auto_increment_offset_save.inc # diff --git a/mysql-test/suite/galera/t/galera_toi_ftwrl.test b/mysql-test/suite/galera/t/galera_toi_ftwrl.test index 4d0edefda8e..25a3de20847 100644 --- a/mysql-test/suite/galera/t/galera_toi_ftwrl.test +++ b/mysql-test/suite/galera/t/galera_toi_ftwrl.test @@ -19,4 +19,3 @@ UNLOCK TABLES; SHOW CREATE TABLE t1; DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_transaction_read_only.test b/mysql-test/suite/galera/t/galera_transaction_read_only.test index 386d73fd3ca..65c65deda45 100644 --- a/mysql-test/suite/galera/t/galera_transaction_read_only.test +++ b/mysql-test/suite/galera/t/galera_transaction_read_only.test @@ -55,4 +55,3 @@ COMMIT; --enable_query_log DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_udf.cnf b/mysql-test/suite/galera/t/galera_udf.cnf index 69d5acd65f3..16477960835 100644 --- a/mysql-test/suite/galera/t/galera_udf.cnf +++ b/mysql-test/suite/galera/t/galera_udf.cnf @@ -6,10 +6,3 @@ query_cache_type=1 [mysqld.2] query_cache_type=1 - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_unicode_identifiers.test b/mysql-test/suite/galera/t/galera_unicode_identifiers.test index d94adb3d4e7..fb597a17d3b 100644 --- a/mysql-test/suite/galera/t/galera_unicode_identifiers.test +++ b/mysql-test/suite/galera/t/galera_unicode_identifiers.test @@ -77,4 +77,3 @@ DROP DATABASE `database with space`; DROP DATABASE `база`; DROP DATABASE `втора база`; --eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig - diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.cnf b/mysql-test/suite/galera/t/galera_v1_row_events.cnf index b95e321ad4f..cfb3782832b 100644 --- a/mysql-test/suite/galera/t/galera_v1_row_events.cnf +++ b/mysql-test/suite/galera/t/galera_v1_row_events.cnf @@ -4,10 +4,3 @@ log-bin-use-v1-row-events=1 [mysqld.2] - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_var_OSU_method2.test b/mysql-test/suite/galera/t/galera_var_OSU_method2.test index 099e2cc6612..5117f87b647 100644 --- a/mysql-test/suite/galera/t/galera_var_OSU_method2.test +++ b/mysql-test/suite/galera/t/galera_var_OSU_method2.test @@ -44,4 +44,3 @@ SET DEBUG_SYNC= 'RESET'; --connection node_1a SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test index c0bbe5af8cf..241b62dbf8c 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test @@ -94,11 +94,13 @@ SELECT * FROM t1; --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1 +--disconnect node_1a --connection node_2 --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2 +--disconnect node_2a --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf index 523bae68763..25da46fc009 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf @@ -5,9 +5,3 @@ wsrep-auto-increment-control=ON [mysqld.2] wsrep-auto-increment-control=ON - - - - - - diff --git a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf index 9b88a09d814..a8c2826ad0d 100644 --- a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf +++ b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf @@ -6,7 +6,7 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_address=[::1]:@mysqld.1.#galera_port wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' @@ -14,7 +14,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.2.port' wsrep_node_address=[::1]:@mysqld.2.#galera_port wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test index c0d8c5d6b3b..6946bc552ea 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test @@ -3,7 +3,6 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_aria.inc CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test index ac9a79e6196..c4367642102 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test @@ -234,4 +234,3 @@ SET GLOBAL wsrep_mode = DEFAULT; --connection node_2 SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index f405ebfdc46..8cfe82fd457 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -77,8 +77,8 @@ DROP TABLE t1; # --connection node_1 -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -126,6 +126,7 @@ INSERT INTO t1 VALUES (1); --connection node_1 COMMIT; DROP TABLE t1, t2; + # # Test prepared staments # @@ -200,21 +201,28 @@ SELECT * FROM t2 ORDER BY id; DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +INSERT INTO t1 (a,b) VALUES (10,20); + +--connection node_2 +SELECT * from t1; +--connection node_1 +DROP TABLE t1; --echo # --echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO --echo # --connection node_1 -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); # This command should not get replicated. SELECT * FROM t1; DROP TABLE t1; ---connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; + --connection node_2 SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test index 66909baff07..1a3a038a971 100644 --- a/mysql-test/suite/galera/t/galera_var_slave_threads.test +++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test @@ -15,11 +15,15 @@ --connection node_1 --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` + CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; --connection node_2 +--let $wsrep_slave_threads_orig_2 = `SELECT @@wsrep_slave_threads` + CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread\\."); + # Setting wsrep_slave_threads to zero triggers a warning SET GLOBAL wsrep_slave_threads = 0; SHOW WARNINGS; @@ -74,7 +78,9 @@ SELECT COUNT(*) FROM t2; --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; --source include/wait_condition.inc ---eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig_2; +--enable_query_log DROP TABLE t1; DROP TABLE t2; @@ -94,6 +100,11 @@ SET GLOBAL wsrep_slave_threads = 4; SET GLOBAL wsrep_slave_threads = 1; --connection node_1 + +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); @@ -106,6 +117,10 @@ DROP TABLE t1; --connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig_2; +--enable_query_log + # Wait until above DDL is replicated # # make sure that we are left with exactly one applier thread before we leaving the test diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test index 002dce0a05a..fdb033b0874 100644 --- a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test @@ -57,9 +57,3 @@ SELECT @@wsrep_mode; # reset SET GLOBAL wsrep_mode=DEFAULT; - - - - - - diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test index 58371061a5f..c868e5e8e5b 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -91,10 +91,6 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with DROP TABLE t2; ---let $node_3=node_3 ---let $auto_increment_offset_node_3 = 3; ---let $node_4=node_4 ---let $auto_increment_offset_node_4 = 4; --source suite/galera/include/auto_increment_offset_restore.inc --disconnect node_3 diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf index df1d55928dc..c01468b5073 100644 --- a/mysql-test/suite/galera/t/galera_wan.cnf +++ b/mysql-test/suite/galera/t/galera_wan.cnf @@ -4,14 +4,13 @@ loose-galera-wan=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3' - +wsrep_provider_options='gmcast.segment=3;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index ab2346ebe94..8b90381c4aa 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -10,10 +10,10 @@ --source include/have_innodb.inc --source include/force_restart.inc -CALL mtr.add_suppression("WSREP: Stray state UUID msg:"); -CALL mtr.add_suppression("Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .* sending install message failed: Socket is not connected"); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); +CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); +CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc @@ -42,8 +42,8 @@ SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL DROP TABLE t1; --connection node_1 -call mtr.add_suppression("WSREP: read_completion_condition.*"); -call mtr.add_suppression("WSREP: read_handler.*"); +call mtr.add_suppression("WSREP: read_completion_condition"); +call mtr.add_suppression("WSREP: read_handler"); --disconnect node_3 --disconnect node_4 diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf index 0a230f5324f..d101f5d5f53 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf @@ -4,14 +4,13 @@ loose-galera-wan-restart-ist=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' - +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf index 202aa4ce1c8..e8f6804ffe6 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf @@ -4,14 +4,13 @@ loose-galera-wan-restart-sst=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' - +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf index 440c37bea81..db7e2bd973c 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf +++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf @@ -5,8 +5,3 @@ wsrep_log_conflicts=ON [mysqld.2] wsrep_log_conflicts=ON - - - - - diff --git a/mysql-test/suite/galera/t/galera_wsrep_mode.test b/mysql-test/suite/galera/t/galera_wsrep_mode.test index a8e192123bd..d50018c1c4b 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_wsrep_mode.test @@ -16,7 +16,6 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; DROP TABLE t1; SET GLOBAL wsrep_mode = default; - # MDEV-25698 SIGSEGV in wsrep_should_replicate_ddl SET GLOBAL wsrep_mode = STRICT_REPLICATION; diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test index 04d78a306a8..5cfcffce475 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test +++ b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test @@ -3,10 +3,11 @@ # --source include/galera_cluster.inc --source include/have_innodb.inc + --let LOGF=$MYSQLTEST_VARDIR/log/mysqld.1.err --disable_info -call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\\.segment'"); -call mtr.add_suppression("WSREP\: Set options returned 7"); +call mtr.add_suppression("WSREP: Unknown parameter 'gmcasts\\.segment'"); +call mtr.add_suppression("WSREP: Set options returned 7"); --error ER_WRONG_ARGUMENTS SET GLOBAL wsrep_provider_options="gmcasts.segment=1"; # Search for unhandled exception message. diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test index 5fa170f3a02..fa80d329bc3 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -6,11 +6,22 @@ --source include/auto_increment_offset_save.inc --connection node_1 -call mtr.add_suppression("WSREP:.*"); + +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); + SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; --connection node_2 + +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); + SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; @@ -22,6 +33,7 @@ INSERT INTO mysql.wsrep_allowlist (ip) VALUES (0); SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig; SELECT 1; DELETE FROM mysql.wsrep_allowlist; + --connection node_2 --source include/kill_galera.inc diff --git a/mysql-test/suite/galera/t/mdev-29775.test b/mysql-test/suite/galera/t/mdev-29775.test index 2de477a4822..0a509ad12f1 100644 --- a/mysql-test/suite/galera/t/mdev-29775.test +++ b/mysql-test/suite/galera/t/mdev-29775.test @@ -72,10 +72,10 @@ SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; --error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=STATEMENT; --error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/mdev-30653.test b/mysql-test/suite/galera/t/mdev-30653.test index 658c4372d6b..425f93b3f8c 100644 --- a/mysql-test/suite/galera/t/mdev-30653.test +++ b/mysql-test/suite/galera/t/mdev-30653.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc create table t1 (id serial, val int) engine=innodb; @@ -6,7 +7,8 @@ create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); + +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; diff --git a/mysql-test/suite/galera/t/mdev-31285.test b/mysql-test/suite/galera/t/mdev-31285.test index 5abef37cccd..3e5f5a48cf5 100644 --- a/mysql-test/suite/galera/t/mdev-31285.test +++ b/mysql-test/suite/galera/t/mdev-31285.test @@ -11,5 +11,3 @@ CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i; --connection node_2 --error ER_NO_SUCH_TABLE SHOW CREATE TABLE t; - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf index 4a82e9fa037..bea5b606e3e 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf @@ -5,5 +5,3 @@ query_cache_type=1 [mysqld.2] query_cache_type=1 - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#247.test b/mysql-test/suite/galera/t/mysql-wsrep#247.test index 8bcd58607a1..2f348029407 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#247.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#247.test @@ -20,4 +20,3 @@ SET GLOBAL wsrep_desync=0; --sleep 1 DROP TABLE t1; SHOW VARIABLES LIKE 'wsrep_desync'; - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#31.test b/mysql-test/suite/galera/t/mysql-wsrep#31.test index c669d4834ba..1924bc4a11c 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#31.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#31.test @@ -49,5 +49,3 @@ DROP DATABASE db; --source include/auto_increment_offset_restore.inc --source include/galera_end.inc - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf index f1c3d802e4b..7100721695f 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf @@ -1,8 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' - +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/mysql-wsrep#332.test b/mysql-test/suite/galera/t/mysql-wsrep#332.test index 464156e832e..dcbbca89f25 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#332.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#332.test @@ -216,4 +216,3 @@ SELECT * FROM c; DROP TABLE c; DROP TABLE p1; DROP TABLE p2; - diff --git a/mysql-test/suite/galera/t/rename.test b/mysql-test/suite/galera/t/rename.test index 326d64d3b8a..b56caa1531f 100644 --- a/mysql-test/suite/galera/t/rename.test +++ b/mysql-test/suite/galera/t/rename.test @@ -50,4 +50,3 @@ DROP USER foo@localhost; DROP TABLE t2; --echo # End of tests - diff --git a/mysql-test/suite/galera/t/view.test b/mysql-test/suite/galera/t/view.test index fa2cd8b2a67..a6f94941ba0 100644 --- a/mysql-test/suite/galera/t/view.test +++ b/mysql-test/suite/galera/t/view.test @@ -47,4 +47,3 @@ DROP VIEW v1, v2, v3, v4; DROP TABLE t1; --echo # End of tests - diff --git a/mysql-test/suite/galera/t/wsrep_mode_strict_replication.test b/mysql-test/suite/galera/t/wsrep_mode_strict_replication.test index 1f114435914..9c53f836692 100644 --- a/mysql-test/suite/galera/t/wsrep_mode_strict_replication.test +++ b/mysql-test/suite/galera/t/wsrep_mode_strict_replication.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_aria.inc call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index bb9d7cbd7b8..fcaf38a3d7b 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -9,6 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - -galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed -galera_nbo_master_phase_two_crash : MENT-2215 Test failure on galera_3nodes.galera_nbo_master_non_prim_failure diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf index f670ba5a93e..e63035ac6bf 100644 --- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -24,6 +24,7 @@ wsrep-on=1 #sst_port=@OPT.port wsrep_cluster_address=gcomm:// wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index b8a75ea914b..fb6b2b6fc1c 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -19,10 +19,11 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' +wsrep_node_name=node1 [mysqld.2] wsrep-on=1 @@ -30,10 +31,11 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' +wsrep_node_name=node2 [mysqld.3] wsrep-on=1 @@ -41,10 +43,11 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' +wsrep_node_name=node3 [sst] sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-36360.result b/mysql-test/suite/galera_3nodes/r/MDEV-36360.result new file mode 100644 index 00000000000..2778c3e7bd8 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/MDEV-36360.result @@ -0,0 +1,61 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE parent ( +id INT PRIMARY KEY +) ENGINE=InnoDB; +CREATE TABLE child ( +id INT PRIMARY KEY, +parent_id INT, +KEY (parent_id), +CONSTRAINT FOREIGN KEY (parent_id) REFERENCES parent(id) +) ENGINE=InnoDB; +INSERT INTO parent VALUES (1), (2); +connection node_3; +SET SESSION wsrep_on = OFF; +DELETE FROM parent WHERE id = 1; +SET SESSION wsrep_on = ON; +Restarting server 3 with one applier thread having FK and UK checks disabled +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row'; +connection node_1; +INSERT INTO child VALUES (1, 1); +connection node_3; +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached'; +SET GLOBAL DEBUG_DBUG = ''; +SET wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row'; +INSERT INTO child VALUES (2, 2); +SET DEBUG_SYNC = 'RESET'; +include/assert_grep.inc [no FK constraint failure] +Server 3 +SELECT COUNT(*) AS EXPECT_1 FROM parent; +EXPECT_1 +1 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +connection node_1; +Server 1 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +EXPECT_2 +2 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +connection node_2; +Server 2 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +EXPECT_2 +2 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +DROP TABLE child; +DROP TABLE parent; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera-features#115.result b/mysql-test/suite/galera_3nodes/r/galera-features#115.result new file mode 100644 index 00000000000..db965599d80 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera-features#115.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +SET GLOBAL wsrep_on=OFF; +DROP SCHEMA test; +connection node_3; +SET GLOBAL wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); +connection node_1; +CREATE TABLE t1 (f1 INTEGER); +connection node_1; +SET SESSION wsrep_sync_wait=0; +connection node_2; +SET SESSION wsrep_sync_wait=0; +connection node_3; +SET SESSION wsrep_sync_wait=0; +connection node_1; +SET GLOBAL wsrep_provider_options='pc.bootstrap=YES'; +connection node_2; +disconnect node_2; +connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2; +# restart +connection node_3; +# restart +connection node_1; +DROP TABLE test.t1; +connection node_2; +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1049"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); +connection node_3; +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1050"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result index bdd18ee2534..c3e233a9fb7 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result @@ -1,9 +1,9 @@ connection node_2; connection node_1; +connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_4; -CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; START SLAVE; include/wait_for_slave_to_start.inc connection node_1; @@ -21,7 +21,6 @@ include/sync_with_master_gtid.inc SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 -connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; connection node_6; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 @@ -51,18 +50,30 @@ SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; COUNT(*) = 3 1 connection node_2; +connection node_1; +connection node_3; +connection node_4; +connection node_5; +connection node_6; +connection node_2; OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave connection node_1; +connection node_3; connection node_4; +connection node_5; connection node_6; connection node_1; DROP TABLE t1; connection node_4; STOP SLAVE; RESET SLAVE; +Warnings: +Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; @@ -75,19 +86,33 @@ connection node_2; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_3; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_5; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_6; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +connection node_1; CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_2; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_3; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_4; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_5; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_6; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result index 676ba7e8a0e..12d1f78cc9c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result @@ -2,8 +2,6 @@ connection node_2; connection node_1; connection node_1; connection node_2; -connection node_1; -connection node_2; connection node_3; Killing node #3 to free ports for garbd ... connection node_3; @@ -26,8 +24,8 @@ DROP TABLE t1; Restarting node #3 to satisfy MTR's end-of-test checks connection node_3; connection node_1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_2; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_3; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result index fdf3f5abde0..638b1553039 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -1,7 +1,6 @@ connection node_2; connection node_1; connection node_1; -connection node_1; connection node_2; connection node_3; connection node_1; @@ -12,7 +11,6 @@ CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -connection node_2; Killing node #3 to free ports for garbd ... connection node_3; connection node_1; @@ -34,8 +32,8 @@ Restarting node #3 to satisfy MTR's end-of-test checks connection node_3; connection node_1; connection node_1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_2; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_3; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result index b849cc9f368..36a63c87713 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -35,7 +35,7 @@ SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 connection node_1; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +--- ignore_server_ids=(12,13) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -45,7 +45,7 @@ select @@gtid_slave_pos; @@gtid_slave_pos connection node_4; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +--- ignore_server_ids=(22,23) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -262,7 +262,7 @@ set global wsrep_on=OFF; reset master; set global wsrep_on=ON; connection node_1; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +--- ignore_server_ids=(12,13) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -272,7 +272,7 @@ select @@gtid_slave_pos; @@gtid_slave_pos connection node_4; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +--- ignore_server_ids=(22,23) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result index fdea4154626..52f5db8daed 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result @@ -77,8 +77,8 @@ SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result index 7811059db42..a63e7933e9c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result @@ -87,11 +87,11 @@ SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); disconnect node_1a; disconnect node_3; disconnect node_2; diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result index ea185bf676a..d80d90cd726 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result @@ -94,9 +94,9 @@ SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Send action {(.*), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Send action {.* STATE_REQUEST} returned -107 \\((Transport endpoint|Socket) is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result index 087f9e7e279..a38e14c40a2 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result +++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result @@ -26,7 +26,7 @@ connection node_3; SELECT f1 = 111 FROM t1; f1 = 111 1 -SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); COUNT(*) IN (1, 2) 1 SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result index 6d8c7a51b1f..9351d528b87 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -157,10 +157,10 @@ SET GLOBAL wsrep_provider_options = 'pc.weight=1'; CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); connection node_2; CALL mtr.add_suppression('SYNC message from member'); -CALL mtr.add_suppression('user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); connection node_3; CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result index d34324d2f91..9a059c16a99 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -47,7 +47,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); connection node_3; CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); @@ -61,7 +61,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result b/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result new file mode 100644 index 00000000000..6f372463b15 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result @@ -0,0 +1,26 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +connection node_1; +SET GLOBAL debug_dbug = '+d,sync.wsrep_sst_donor_after_donation'; +connection node_2; +# restart +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_sst_donor_after_donation_continue'; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = ''; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET SESSION wsrep_sync_wait=15; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +connection node_1; +CALL mtr.add_suppression("WSREP: sst sent called when not SST donor, state CONNECTED"); +CALL mtr.add_suppression("WSREP: .* returned an error: Not connected to Primary Component"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result index e1a382559de..f1cc5fd0c38 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -57,7 +57,6 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci -CALL mtr.add_suppression("is inconsistent with group"); connection node_3; SHOW CREATE TABLE t1; Table Create Table @@ -80,4 +79,5 @@ CALL mtr.add_suppression("Native table .* has the wrong structure"); CALL mtr.add_suppression("Table 'mysql\\.gtid_slave_pos' doesn't exist"); connection node_2; # restart +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); connection node_1; diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 49b93248a58..34b5afd0cdc 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -9,69 +9,71 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: last inactive check more than .+ skipping check), + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr|WSREP: discarding established \(time wait\) |, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, + qr|WSREP: Failed to report last committed|, ); sub which($) { return `sh -c "command -v $_[0]"` } sub skip_combinations { my %skip = (); - $skip{'include/have_mariabackup.inc'} = 'Need ss' + $skip{'include/have_mariabackup.inc'} = 'Need socket statistics utility' unless which("lsof") || which("sockstat") || which("ss"); %skip; } diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf index cd99c90bc16..7e521ee5c5b 100644 --- a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf +++ b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf @@ -6,7 +6,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.1.port' bind-address=:: @@ -14,7 +14,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.2.port' bind-address=:: @@ -22,7 +22,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.3.port' bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf index e87e65ca58c..660266e2cce 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf @@ -7,10 +7,10 @@ loose-gcf-354=0 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G;pc.weight=4' +wsrep_provider_options='repl.causal_read_timeout=PT90S;pc.weight=4;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-36360.test b/mysql-test/suite/galera_3nodes/t/MDEV-36360.test new file mode 100644 index 00000000000..31f077fb818 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-36360.test @@ -0,0 +1,110 @@ +# +# MDEV-36360: Don't grab table-level X locks for applied inserts. +# +# It prevents a debug crash in wsrep_report_error() which happened when appliers would run +# with FK and UK checks disabled and erroneously execute plain inserts as bulk inserts. +# +# Moreover, in release builds such a behavior could lead to deadlocks between two applier +# threads if a thread waiting for a table-level lock was ordered before the lock holder. +# In that case the lock holder would proceed to commit order and wait forever for the +# now-blocked other applier thread to commit before. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# Create parent and child tables. +--connection node_1 +CREATE TABLE parent ( + id INT PRIMARY KEY +) ENGINE=InnoDB; + +CREATE TABLE child ( + id INT PRIMARY KEY, + parent_id INT, + KEY (parent_id), + CONSTRAINT FOREIGN KEY (parent_id) REFERENCES parent(id) +) ENGINE=InnoDB; + +# Fill the parent table with rows that will later be used by the child. +INSERT INTO parent VALUES (1), (2); + +# Wait until the rows are replicated on node #3. +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 2 FROM parent +--source include/wait_condition.inc + +# Delete one row from the parent table on node #3 and rejoin the cluster. +SET SESSION wsrep_on = OFF; +DELETE FROM parent WHERE id = 1; +SET SESSION wsrep_on = ON; +--echo Restarting server 3 with one applier thread having FK and UK checks disabled +--source include/shutdown_mysqld.inc +--let $start_mysqld_params = --wsrep_slave_FK_checks=0 --wsrep_slave_UK_checks=0 +--source ../galera/include/start_mysqld.inc + +# Stop the applier after writing a row into the child table. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row'; + +# Insert a child row that will be applied on node #3, but should not +# grab table-level X-lock. +--connection node_1 +INSERT INTO child VALUES (1, 1); + +--connection node_3 +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached'; +# Now that the applier has hit the global sync point wait, reset it +# so that the upcoming insert avoids it. +SET GLOBAL DEBUG_DBUG = ''; +# Don't wait for applied insert to commit. +SET wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row'; +# The insert should pass the sync point, as otherwise if the applied insert +# grabs table-level X-lock, they'll both deadlock forever. +INSERT INTO child VALUES (2, 2); +SET DEBUG_SYNC = 'RESET'; + +--let $assert_select = foreign key constraint fails +--let $assert_count = 0 +--let $assert_text = no FK constraint failure +--let $assert_only_after = CURRENT_TEST +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.3.err +--source include/assert_grep.inc + +# Child row insert is applied even though there's no parent row. +--echo Server 3 +SELECT COUNT(*) AS EXPECT_1 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +# Check other nodes have both parent and child rows. +--connection node_1 +--echo Server 1 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +--connection node_2 +--echo Server 2 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +DROP TABLE child; +DROP TABLE parent; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf b/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf new file mode 100644 index 00000000000..e255e1d527e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#115.test b/mysql-test/suite/galera_3nodes/t/galera-features#115.test new file mode 100644 index 00000000000..f045e7abe4b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera-features#115.test @@ -0,0 +1,89 @@ +# +# This test tests that one successful node wins over two nodes that fail for +# different reasons +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source suite/galera/include/auto_increment_offset_save.inc + +# create inconsistency on node 2 +--connection node_2 +SET GLOBAL wsrep_on=OFF; +DROP SCHEMA test; + +# create inconsistency on node 3 +--connection node_3 +SET GLOBAL wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); + +# check that nodes 2 and 3 leave the cluster, and node_1 is Primary by itself + +--connection node_1 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_1 +# this is a workaround for "sending install message failed" BUG: +# https://github.com/codership/galera/issues/174 +# When it happens, node_1 becomes non-prim +SET GLOBAL wsrep_provider_options='pc.bootstrap=YES'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# restart nodes 2 and 3, since they failed + +--connection node_2 +# need to reinitialize connection due to a "Bad handshake" bug. +# we reconnect using the 'mysql' database as 'test' was dropped. +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2 + --source include/restart_mysqld.inc + +--connection node_3 + --source include/restart_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +DROP TABLE test.t1; + +--source suite/galera/include/auto_increment_offset_restore.inc + +--connection node_2 +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1049"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); + +--connection node_3 +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1050"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#119.test b/mysql-test/suite/galera_3nodes/t/galera-features#119.test index 0effe780a22..a9f96ddce7c 100644 --- a/mysql-test/suite/galera_3nodes/t/galera-features#119.test +++ b/mysql-test/suite/galera_3nodes/t/galera-features#119.test @@ -66,6 +66,5 @@ CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno" CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); CALL mtr.add_suppression("WSREP: Failed to apply write set: "); - # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf index 41c1c7c0519..297e0fad159 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf @@ -1,25 +1,34 @@ !include ../galera_2x3nodes.cnf +[mysqld] +wsrep-debug=1 + [mysqld.1] wsrep_gtid_domain_id=1 server-id=11 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M;pc.weight=2' [mysqld.2] wsrep_gtid_domain_id=1 server-id=12 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.3] wsrep_gtid_domain_id=1 server-id=13 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.4] wsrep_gtid_domain_id=2 server-id=21 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.5] wsrep_gtid_domain_id=2 server-id=22 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.6] wsrep_gtid_domain_id=2 server-id=23 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test index 8fc9e492342..d20b64e7c81 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -9,14 +9,17 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 - --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + --connection node_4 ---replace_result $NODE_MYPORT_1 NODE_MYPORT_1 ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +--disable_query_log +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +--enable_query_log START SLAVE; --source include/wait_for_slave_to_start.inc @@ -42,7 +45,6 @@ SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1; ---connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 --connection node_6 SELECT COUNT(*) = 1 FROM t1; @@ -81,23 +83,46 @@ SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; # --connection node_2 - ---let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` -OPTIMIZE TABLE t1; +--let $wsrep_last_committed_before_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` --connection node_1 +--let $wsrep_last_committed_before_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--connection node_3 +--let $wsrep_last_committed_before_3 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_4 +--let $wsrep_last_committed_before_4 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_5 +--let $wsrep_last_committed_before_5 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_6 +--let $wsrep_last_committed_before_6 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_2 +OPTIMIZE TABLE t1; +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_2 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_1 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_3 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc --connection node_4 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_4 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--connection node_5 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_5 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc --connection node_6 - ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_6 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc # @@ -115,6 +140,7 @@ RESET SLAVE; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc SET GLOBAL GTID_SLAVE_POS=""; --connection node_1 @@ -122,35 +148,56 @@ SET GLOBAL GTID_SLAVE_POS=""; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_2 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_3 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_5 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_6 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc +connection node_1; CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_2; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_3; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_4; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_5; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_6; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); diff --git a/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf index 62f24c172af..21c412e3bb1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf @@ -7,7 +7,7 @@ wsrep_sst_method=rsync wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3" [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' # Variable is only used on bootstrap node, so this will be ignored wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5" @@ -18,9 +18,9 @@ wsrep_node_incoming_address=127.0.0.2:@mysqld.2.port wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port' [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE;gcache.size=10M' wsrep_node_address=127.0.0.3 wsrep_sst_receive_address=127.0.0.3:@mysqld.3.#sst_port wsrep_node_incoming_address=127.0.0.3:@mysqld.3.port -wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port' \ No newline at end of file +wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test index b4fe10bff0d..e5646d98427 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test +++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test @@ -50,4 +50,3 @@ DROP TABLE t1; --source ../galera/include/auto_increment_offset_restore.inc --source include/galera_end.inc - diff --git a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test index 49ddb31d2d7..fe7f0b01607 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test +++ b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/big_test.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf index 1457727270e..84500819cee 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf @@ -5,12 +5,12 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_node_name='node.1' -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] wsrep_node_name='node.2' -wsrep_provider_options='base_port=@mysqld.2.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] wsrep_node_name='node.3' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test index bdb6a9db55b..b4536762560 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test @@ -14,7 +14,6 @@ --let $node_3 = node_3 --source ../galera/include/auto_increment_offset_save.inc - --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test index c52bebc7019..c36cce61f23 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test @@ -87,5 +87,6 @@ SELECT COUNT(*) FROM t1; --source include/wait_condition.inc DROP TABLE t1; + # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test index da1956d8c85..6618728b651 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test @@ -9,14 +9,9 @@ --source include/big_test.inc # Save galera ports ---connection node_1 --source suite/galera/include/galera_base_port.inc --let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT ---connection node_2 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT - --let $galera_connection_name = node_3 --let $galera_server_number = 3 --source include/galera_connect.inc @@ -81,10 +76,10 @@ let $restart_noprint=2; # Workaround for galera#101 --connection node_1 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_2 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_3 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test index d1d8e643d8e..61256642242 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -10,11 +10,9 @@ --source include/have_debug.inc --source include/have_debug_sync.inc ---connection node_1 -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---let $node_3=node_3 +# Save galera ports +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT --let $galera_connection_name = node_3 --let $galera_server_number = 3 @@ -22,12 +20,13 @@ --source suite/galera/include/galera_base_port.inc --let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 --source ../galera/include/auto_increment_offset_save.inc -# Save galera ports --connection node_1 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT --let $datadir= `SELECT @@datadir` --let $innodb_max_dirty_pages_pct = `SELECT @@innodb_max_dirty_pages_pct` @@ -41,10 +40,6 @@ CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; - ---connection node_2 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT --echo Killing node #3 to free ports for garbd ... --connection node_3 @@ -124,13 +119,16 @@ let $restart_noprint=2; --eval SET GLOBAL innodb_max_dirty_pages_pct_lwm = $innodb_max_dirty_pages_pct_lwm --enable_query_log +# Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc +# Workaround for galera#101 + --connection node_1 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_2 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_3 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf index bc64d114275..dc4f414d2c4 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -3,6 +3,7 @@ # following tests such as galera_3nodes.galera_var_dirty_reads2 !include ../galera_2x3nodes.cnf + [mysqld.1] wsrep_gtid_domain_id=1 server-id=11 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test index c8247f15aba..c0dbc7d493d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -42,8 +42,10 @@ SHOW STATUS LIKE 'wsrep_cluster_size'; SHOW STATUS LIKE 'wsrep_cluster_size'; #--disable_parsing --connection node_1 ---replace_result $NODE_MYPORT_4 NODE_MYPORT_4 ---eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--echo --- ignore_server_ids=(12,13) +--disable_query_log +--eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -51,8 +53,10 @@ select @@gtid_slave_pos; #--query_vertical SHOW SLAVE STATUS; --connection node_4 ---replace_result $NODE_MYPORT_1 NODE_MYPORT_1 ---eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--echo --- ignore_server_ids=(22,23) +--disable_query_log +--eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -210,8 +214,10 @@ set global wsrep_on=ON; # Then we will kill node D and set up the replication between A and E # To see whether fail over works or not. --connection node_1 ---replace_result $NODE_MYPORT_6 NODE_MYPORT_6 ---eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--echo --- ignore_server_ids=(12,13) +--disable_query_log +--eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -219,8 +225,10 @@ select @@gtid_slave_pos; #--query_vertical SHOW SLAVE STATUS; --connection node_4 ---replace_result $NODE_MYPORT_3 NODE_MYPORT_3 ---eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--echo --- ignore_server_ids=(22,23) +--disable_query_log +--eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf index ed0e6204d3e..e7f79cfb40a 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf @@ -6,7 +6,7 @@ wsrep_sst_auth="root:" [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -15,7 +15,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -25,7 +25,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf index aaad88ebcbd..765c465794e 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf @@ -9,7 +9,7 @@ wsrep_sst_auth="root:" [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -18,7 +18,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -28,7 +28,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf index 0a54fb8e4e1..e739704aa9d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -13,7 +13,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -21,7 +21,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf index 0a54fb8e4e1..e739704aa9d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -13,7 +13,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -21,7 +21,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf index 35196700044..8e62cad67f6 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf @@ -10,7 +10,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -18,7 +18,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -26,7 +26,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf index 29563657262..3b8375ceae7 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf @@ -1,7 +1,7 @@ !include ../galera_3nodes.cnf [mysqld.1] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=1 auto_increment_offset=1 # this will force server restarts before this test @@ -9,14 +9,14 @@ loose-galera-ist-gcache-rollover=1 wsrep-debug=1 [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=2 auto_increment_offset=2 loose-galera-ist-gcache-rollover=2 wsrep-debug=1 [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=3 auto_increment_offset=3 loose-galera-ist-gcache-rollover=3 diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test index bb25b1dd9d1..b30446b84bb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test @@ -259,12 +259,12 @@ INSERT INTO t1 VALUES (9, 2); DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test index b5983c384ed..b80a1dd89fb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test @@ -270,13 +270,13 @@ SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debu DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --disconnect node_1a diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test index d914482a100..6afd7b94d0f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test @@ -295,13 +295,13 @@ INSERT INTO t1 VALUES (9, 2); DROP TABLE t1; -call mtr.add_suppression("WSREP: Send action {(.*), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Send action {.* STATE_REQUEST} returned -107 \\((Transport endpoint|Socket) is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test index 84629c96c65..61708f7ec6c 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test +++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test @@ -65,7 +65,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; --connection node_3 SELECT f1 = 111 FROM t1; -SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test index 7020400e5ea..a8c1c1d6328 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -17,7 +17,6 @@ call mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index 8a1c93a769f..037a732923f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -132,11 +132,11 @@ CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); --connection node_2 CALL mtr.add_suppression('SYNC message from member'); -CALL mtr.add_suppression('user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); --connection node_3 CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index eb41137b8b3..8c2f659aa26 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -14,7 +14,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 @@ -195,7 +194,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); --connection node_3 CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); @@ -210,7 +209,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf index d4c654e2bf8..58c3093d811 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf @@ -5,10 +5,10 @@ wsrep-debug=1 loose-galera-ssl-reload=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf new file mode 100644 index 00000000000..ecb568672fe --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld.2] +wsrep_sst_donor=node1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test new file mode 100644 index 00000000000..22c4f75b601 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test @@ -0,0 +1,64 @@ +# +# Construct a situation where Donor node partitions in the +# middle of SST. The Donor should stay in non-Primary state instead of +# crashing in assertion in wsrep-lib. +# +# In the test, node_2 is restarted and node_1 configured to be +# the donor. Node_1 execution is stopped before sst_sent() is +# called and node_1 is made to partition from the cluster. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/big_test.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +--source include/shutdown_mysqld.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat + +--connection node_1 +SET GLOBAL debug_dbug = '+d,sync.wsrep_sst_donor_after_donation'; + +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc + +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_sst_donor_after_donation_continue'; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = ''; + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET SESSION wsrep_sync_wait=15; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--connection node_1 +--source include/wait_condition.inc +--connection node_2 +--source include/wait_condition.inc +--connection node_3 + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc + +--source ../galera/include/auto_increment_offset_restore.inc + +--connection node_1 +CALL mtr.add_suppression("WSREP: sst sent called when not SST donor, state CONNECTED"); +CALL mtr.add_suppression("WSREP: .* returned an error: Not connected to Primary Component"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test index 6c7b255bdc3..a0837db3a4b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test @@ -69,7 +69,6 @@ SHOW CREATE TABLE t1; --connection node_2 SHOW CREATE TABLE t1; -CALL mtr.add_suppression("is inconsistent with group"); --connection node_3 SHOW CREATE TABLE t1; @@ -83,6 +82,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col # restart node so we don't fail on WSREP_START_POSITION internal check --source include/restart_mysqld.inc --source include/wait_until_connected_again.inc +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test index d6e20d3bbfb..cde888b2621 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test index 7d8089a8ceb..de639e54bf1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test @@ -10,6 +10,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -55,4 +56,3 @@ SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; --source ../galera/include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf index ae2cf8068f5..340fe700e2b 100644 --- a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf +++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf @@ -5,5 +5,4 @@ wsrep-slave-threads=8 wsrep-ignore-apply-errors=0 [ENV] -galera_cluster_size = 3 - +galera_cluster_size=3 diff --git a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result index 9addd29b0ea..b1c266dd605 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result +++ b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; connection node_2; @@ -45,7 +45,7 @@ SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_2; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) connection node_2a; SET DEBUG_SYNC = 'RESET'; connection node_1a; @@ -74,15 +74,15 @@ connection node_3a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; connection node_1a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_2a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_3a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result index 08e3fc6c3e3..404e909e956 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result @@ -44,7 +44,7 @@ connection node_2; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 -call mtr.add_suppression("WSREP: node uuid:.*"); +call mtr.add_suppression("WSREP: node uuid:"); connection node_1; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm index becc764733a..c7f4472e242 100644 --- a/mysql-test/suite/galera_3nodes_sr/suite.pm +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -9,38 +9,39 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), qr(WSREP: SQL statement was ineffective), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr|WSREP: discarding established \(time wait\) |, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.), qr(WSREP: Could not find peer:), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.), + qr|WSREP: .*core_handle_uuid_msg|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, ); bless { }; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test index 879c007e601..2048580d735 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test @@ -85,4 +85,5 @@ DROP TABLE t1; --connection node_2 CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test index a32da959429..73cb5624f0e 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index 700b3c38b6b..df446ebe541 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -7,6 +7,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test index a952b343d9f..86d31226979 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test +++ b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test @@ -21,7 +21,7 @@ --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -158,15 +158,15 @@ SET SESSION wsrep_sync_wait = DEFAULT; --connection node_1a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_3a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_1 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test index 18e1f0023c3..94f567d4c61 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test @@ -6,6 +6,7 @@ # Test the effect of gmcast.isolate on master during an SR transaction # --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test index 95aa1a37a78..a8cb72c8e47 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test index c7e7528679b..cda2e335e4d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test @@ -6,6 +6,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test index c0df6b2777a..a4d442ab5d8 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test @@ -9,6 +9,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test index 6ca2011d221..b32eafe5e9c 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -8,6 +8,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -65,4 +66,5 @@ SELECT COUNT(*) FROM mysql.wsrep_streaming_log; --connection node_1 --disconnect node_1a DROP TABLE t1; + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index 58d744e704d..47605772d13 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -9,6 +9,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -88,7 +89,7 @@ SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; # As noted above sometimes node delivers the same view twice -call mtr.add_suppression("WSREP: node uuid:.*"); +call mtr.add_suppression("WSREP: node uuid:"); --connection node_1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf index 910d945949a..18bae4a74e9 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf @@ -1,5 +1,4 @@ !include ../galera_3nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=3' - +wsrep_provider_options='pc.weight=3;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test index 9d961171d93..6ceaf36ec22 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test @@ -7,6 +7,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt index 196498bb9fa..954aacb818b 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt @@ -1,2 +1 @@ --wsrep-ignore-apply-errors=0 - diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 73ef1d0d73b..fcaf38a3d7b 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -9,7 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - -GCF-1060 : MDEV-32160 GCF-1060 test failure due to wsrep MDL conflict -# Links to below failures in MDEV-30172 -MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC diff --git a/mysql-test/suite/galera_sr/r/MENT-2042.result b/mysql-test/suite/galera_sr/r/MENT-2042.result new file mode 100644 index 00000000000..297ad808356 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MENT-2042.result @@ -0,0 +1,9 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +XA START 'a'; +ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication' +DROP TABLE t1; +disconnect node_1a; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result index 433cfa4e459..de8d2bd7e7c 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -CALL mtr.add_suppression("WSREP: discarding established.*"); +CALL mtr.add_suppression("WSREP: discarding established"); connection node_1; connection node_2; connection node_2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result index 7ef86c65915..963ed9507ab 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result @@ -2,6 +2,7 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result index 5f899f528cb..6ef3d1c485e 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result @@ -14,3 +14,4 @@ LENGTH(f1) = 65535 1 DROP TABLE t1; connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result index 98bf13e9d2b..a97c004999d 100644 --- a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result @@ -25,7 +25,7 @@ COMMIT; connection node_1; Got one of the listed errors connection node_2; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; SET GLOBAL debug_dbug = ''; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm index a9665b5252c..0aea25145da 100644 --- a/mysql-test/suite/galera_sr/suite.pm +++ b/mysql-test/suite/galera_sr/suite.pm @@ -9,62 +9,64 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: last inactive check more than .+ skipping check), + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr|WSREP: discarding established \(time wait\) |, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, + qr|WSREP: Failed to report last committed|, ); bless { }; diff --git a/mysql-test/suite/galera_sr/t/MDEV-27615.test b/mysql-test/suite/galera_sr/t/MDEV-27615.test index 8cc425aa7e1..50076f23b41 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-27615.test +++ b/mysql-test/suite/galera_sr/t/MDEV-27615.test @@ -69,5 +69,4 @@ SET DEBUG_SYNC = 'RESET'; --disconnect node_2 --connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 - --source suite/galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/MDEV-28971.test b/mysql-test/suite/galera_sr/t/MDEV-28971.test index d3dbf03b4df..2f924e3bec8 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-28971.test +++ b/mysql-test/suite/galera_sr/t/MDEV-28971.test @@ -4,6 +4,7 @@ # --source include/galera_cluster.inc +--source include/have_sequence.inc CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size=1; diff --git a/mysql-test/suite/galera_sr/t/MENT-2042.test b/mysql-test/suite/galera_sr/t/MENT-2042.test new file mode 100644 index 00000000000..fc047ba33ef --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MENT-2042.test @@ -0,0 +1,23 @@ +# +# MENT-2042 Assertion `bf_aborted()' failed in wsrep::transaction::xa_replay_common() +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +--let connection_id = `SELECT CONNECTION_ID()` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); + +# +# Execute XA transaction up to COMMIT +# + +--error ER_NOT_SUPPORTED_YET +XA START 'a'; + +DROP TABLE t1; +--disconnect node_1a diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test index 563f115ecf1..b0d5853ac69 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test @@ -7,7 +7,7 @@ # leave the cluster. # -CALL mtr.add_suppression("WSREP: discarding established.*"); +CALL mtr.add_suppression("WSREP: discarding established"); # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt index 6623c33c484..2c3adba1eee 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt +++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt @@ -1 +1 @@ - --log-bin --log-slave-updates --loose-galera-sr-gtid-unique +--log-bin --log-slave-updates --loose-galera-sr-gtid-unique diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf index 82c001e0131..c9b6ff8c3f7 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf @@ -1,7 +1,8 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.recovery=false' +wsrep_provider_options='pc.recovery=false;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + auto_increment_offset=1 [mysqld.2] diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test index f6f50fd50c9..6486ae419d0 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test @@ -11,6 +11,8 @@ --let $node_2=node_2 --source ../../galera/include/auto_increment_offset_save.inc +--connection node_1 + CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; @@ -26,7 +28,6 @@ INSERT INTO t1 VALUES (5); --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; --source include/wait_condition.inc - # # Kill the entire cluster and restart # diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf index 290d8fe196e..d0509488d83 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=2' +wsrep_provider_options='pc.weight=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test index ce9990ffd35..a8af84449aa 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test @@ -22,6 +22,4 @@ SELECT LENGTH(f1) = 65535 FROM t1; DROP TABLE t1; --connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf index 574ae28b54a..1007de9f779 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf @@ -4,8 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' - +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test index 50378b2a9bd..9df4392375a 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test @@ -85,4 +85,3 @@ SET SESSION wsrep_trx_fragment_size=0; # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test index 035ef873700..cad7a0d3a1e 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -8,6 +8,7 @@ --let $node_1=node_1 --let $node_2=node_2 --source ../galera/include/auto_increment_offset_save.inc + --connection node_2 call mtr.add_suppression("WSREP: Failed to scan the last segment to the end\\. Last events may be missing\\. Last recovered event: "); diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf index c8e17436e71..c56efcbf2d4 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf @@ -1,6 +1,7 @@ !include ../galera_2nodes.cnf -[mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=16K' -[mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=16K' +[mysqld.1] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=16K' + +[mysqld.2] +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=16K' diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test index deeb890fa0b..2f1e0920f0c 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test @@ -18,4 +18,3 @@ DROP TABLE t1; --connection node_2 --source include/galera_wait_ready.inc - diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test index e0a443061df..7689fac802e 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test @@ -47,7 +47,7 @@ COMMIT; --reap --connection node_2 -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; SET GLOBAL debug_dbug = ''; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test index 544109dadee..302c11d8ff1 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test @@ -40,7 +40,6 @@ COMMIT; --connection node_1 SELECT COUNT(*) = 6 FROM t1; - --connection node_2 SELECT COUNT(*) = 6 FROM t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test index c773b310183..59875862f70 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test @@ -39,7 +39,3 @@ SELECT COUNT(*) = 0 FROM t2; --connection node_1 DROP TABLE t1; DROP TABLE t2; - - - - diff --git a/mysql-test/suite/innodb/r/alter_partitioned_debug.result b/mysql-test/suite/innodb/r/alter_partitioned_debug.result index d2ec602c6d7..29a6e5822c5 100644 --- a/mysql-test/suite/innodb/r/alter_partitioned_debug.result +++ b/mysql-test/suite/innodb/r/alter_partitioned_debug.result @@ -1,4 +1,5 @@ CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=0 PARTITION BY RANGE(a) (PARTITION pa VALUES LESS THAN (3), PARTITION pb VALUES LESS THAN (5)); @@ -19,9 +20,30 @@ connection ddl; ERROR 23000: Duplicate entry '2-two' for key 'a' connection default; DELETE FROM t1; -disconnect ddl; SET DEBUG_SYNC = 'RESET'; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -DROP TABLE t1; +CREATE TABLE t(a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +RENAME TABLE t TO u; +DELETE FROM mysql.innodb_table_stats WHERE table_name='u'; +DELETE FROM mysql.innodb_index_stats WHERE table_name='u'; +SET STATEMENT debug_dbug='+d,dict_stats_save_exit_notify_and_wait' FOR +SELECT * FROM u; +connection ddl; +SET DEBUG_SYNC='open_tables_after_open_and_process_table +WAIT_FOR dict_stats_save_finished'; +ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u; +connect sync,localhost,root; +SET DEBUG_SYNC='now SIGNAL dict_stats_save_unblock'; +disconnect sync; +connection default; +a b +connection ddl; +disconnect ddl; +connection default; +SELECT * FROM u; +a b +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1,u; diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result deleted file mode 100644 index 0bff75701a0..00000000000 --- a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result +++ /dev/null @@ -1,8 +0,0 @@ -# -# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL -# ONLINE WITH MEMORY FULL CONDITION -# -call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); -SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; -# restart diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index 7ebd3cc0fcf..7ddee300d6a 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -532,7 +532,6 @@ INSERT INTO t1 VALUES(1,1); ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL inserted'; connection con1; -disconnect con1; connection default; SELECT * FROM t1; a b @@ -541,6 +540,31 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-36281 DML aborts during online virtual index +# +CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL, +f3 INT NOT NULL, f4 INT AS (f3) VIRTUAL, +f5 INT AS (f1) VIRTUAL, INDEX(f4))ENGINE=InnoDB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 2, 3); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish'; +ALTER TABLE t1 ADD INDEX v1(f5, f2, f4), ADD INDEX v2(f3, f5); +connection con1; +set DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET f3= f3 + 1; +set DEBUG_SYNC="now SIGNAL dml_finish"; +disconnect con1; +connection default; +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT f5, f2, f4 FROM t1 USE INDEX(v1); +f5 f2 f4 +1 2 4 +SELECT f3, f5 FROM t1 USE INDEX(v2); +f3 f5 +4 1 +DROP TABLE t1; SET DEBUG_SYNC = 'RESET'; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result index 1a8f16e4efb..ea053308b2e 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("InnoDB: Cannot allocate memory for the buffer pool"); +call mtr.add_suppression("InnoDB: Cannot map innodb_buffer_pool_size_max="); 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."); @@ -6,4 +6,4 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile # MDEV-25019 memory allocation failures during startup cause server failure in different, confusing ways # # restart: --debug_dbug=+d,ib_buf_chunk_init_fails -FOUND 1 /\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool/ in mysqld.1.err +FOUND 1 /\[ERROR\] InnoDB: Cannot map innodb_buffer_pool_size_max=16m/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result index cafa3f45eab..5db74a71636 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result @@ -1,27 +1,28 @@ +# +# MDEV-29445: Reorganize buffer pool (and remove chunks) +# set global innodb_adaptive_hash_index=ON; select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 8388608 +set global innodb_buffer_pool_size = 9437184; set global innodb_buffer_pool_size = 10485760; select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 10485760 -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; -set @`v_id` := 0; -set @`v_val` := 0; -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; -set global innodb_buffer_pool_size = 64 * 1024 * 1024 + 512 * 1024; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '67633152' -select @@innodb_buffer_pool_size; -@@innodb_buffer_pool_size -68157440 +create table t1 (id int primary key, val int not null) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR +INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; +set global innodb_buffer_pool_size = 7340032; select count(val) from t1; count(val) 262144 set global innodb_adaptive_hash_index=OFF; -set global innodb_buffer_pool_size = 25165824; +set global innodb_buffer_pool_size = 24117248; +set global innodb_buffer_pool_size = 26214400; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '26214400' select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 25165824 @@ -29,4 +30,12 @@ select count(val) from t1; count(val) 262144 drop table t1; -drop view view0; +SET GLOBAL innodb_max_purge_lag_wait = 0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result deleted file mode 100644 index d6b29060dc7..00000000000 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result +++ /dev/null @@ -1,14 +0,0 @@ -SET @save_size=@@innodb_buffer_pool_size; -# -# MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize -# after or during DROP TABLE -# -select @@innodb_buffer_pool_chunk_size; -@@innodb_buffer_pool_chunk_size -1048576 -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -SET GLOBAL innodb_buffer_pool_size=256*1024*1024; -DROP TABLE t1; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; -# End of 10.6 tests -SET GLOBAL innodb_buffer_pool_size=@save_size; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result index 43d48023958..b34da91f255 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result @@ -4,7 +4,32 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; +SET GLOBAL innodb_max_purge_lag_wait=0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status +connect con1,localhost,root; +SET DEBUG_SYNC='buf_pool_shrink_before_wakeup SIGNAL blocked WAIT_FOR go'; SET GLOBAL innodb_buffer_pool_size=8388608; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status Withdrawing blocks. (506/506). +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +disconnect con1; +connection default; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status +SET DEBUG_SYNC=RESET; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; SELECT COUNT(*),MIN(a),MAX(a) FROM t1; COUNT(*) MIN(a) MAX(a) 200 1 200 diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result deleted file mode 100644 index efb652091bf..00000000000 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result +++ /dev/null @@ -1,26 +0,0 @@ -select @@innodb_buffer_pool_chunk_size; -@@innodb_buffer_pool_chunk_size -4194304 -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; -set @`v_id` := 0; -set @`v_val` := 0; -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; -set global innodb_buffer_pool_size = 7340032; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '7340032' -select count(val) from t1; -count(val) -262144 -set global innodb_buffer_pool_size = 16777216; -select count(val) from t1; -count(val) -262144 -drop table t1; -drop view view0; -set global innodb_buffer_pool_size = 2*1048576; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '2097152' -select @@innodb_buffer_pool_size; -@@innodb_buffer_pool_size -4194304 diff --git a/mysql-test/suite/innodb/r/lock_memory_debug.result b/mysql-test/suite/innodb/r/lock_memory_debug.result index 36d7433974e..90150805707 100644 --- a/mysql-test/suite/innodb/r/lock_memory_debug.result +++ b/mysql-test/suite/innodb/r/lock_memory_debug.result @@ -5,7 +5,7 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Over 67 percent of the buffer po CREATE TABLE t1 (col1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET STATEMENT debug_dbug='+d,innodb_skip_lock_bitmap' FOR -INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g LIMIT 45000; +INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g; ERROR HY000: The total number of locks exceeds the lock table size SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/innodb/r/log_upgrade_101_flags.result b/mysql-test/suite/innodb/r/log_upgrade_101_flags.result index 2458c51bf23..9bcb786170a 100644 --- a/mysql-test/suite/innodb/r/log_upgrade_101_flags.result +++ b/mysql-test/suite/innodb/r/log_upgrade_101_flags.result @@ -1,7 +1,7 @@ call mtr.add_suppression("InnoDB: The change buffer is corrupted"); call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages"); call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file"); -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); diff --git a/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff b/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff new file mode 100644 index 00000000000..37809768945 --- /dev/null +++ b/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff @@ -0,0 +1,11 @@ +--- mem_pressure.result ++++ mem_pressure,32bit.result +@@ -11,7 +11,7 @@ + @@GLOBAL.innodb_buffer_pool_size_auto_min, + @@GLOBAL.innodb_buffer_pool_size_max; + @@GLOBAL.innodb_buffer_pool_size @@GLOBAL.innodb_buffer_pool_size_auto_min @@GLOBAL.innodb_buffer_pool_size_max +-17825792 16777216 25165824 ++17825792 16777216 18874368 + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; + SET GLOBAL innodb_limit_optimistic_insert_debug=2; + SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR diff --git a/mysql-test/suite/innodb/r/mem_pressure.result b/mysql-test/suite/innodb/r/mem_pressure.result index 7af0d8b55e7..3d4936bb8e4 100644 --- a/mysql-test/suite/innodb/r/mem_pressure.result +++ b/mysql-test/suite/innodb/r/mem_pressure.result @@ -4,23 +4,34 @@ set @save_dbug=@@debug_dbug; set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; set GLOBAL innodb_max_purge_lag_wait=0; +SET @innodb_buffer_pool_size= @@GLOBAL.innodb_buffer_pool_size; +SET @innodb_buffer_pool_size_min= @@GLOBAL.innodb_buffer_pool_size_auto_min; +SELECT +@@GLOBAL.innodb_buffer_pool_size, +@@GLOBAL.innodb_buffer_pool_size_auto_min, +@@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size @@GLOBAL.innodb_buffer_pool_size_auto_min @@GLOBAL.innodb_buffer_pool_size_max +17825792 16777216 25165824 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB CHARSET=latin1; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR INSERT INTO t1 SELECT * FROM seq_1_to_1000; SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; DROP TABLE t1; -SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; -set debug_dbug="d,trigger_garbage_collection"; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size; -FOUND 1 /[Mm]emory pressure.*/ in mysqld.1.err -SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; -LESS_DIRTY_IS_GOOD +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size=@innodb_buffer_pool_size; +FOUND 1 /Memory pressure event disregarded.*/ in mysqld.1.err +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size_auto_min= +CAST(@innodb_buffer_pool_size/2 AS UNSIGNED), +innodb_buffer_pool_size=@innodb_buffer_pool_size; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size_auto_min value: '8912896' +select @@global.innodb_buffer_pool_size < @innodb_buffer_pool_size; +@@global.innodb_buffer_pool_size < @innodb_buffer_pool_size 1 -FOUND 1 /InnoDB: Memory pressure event freed.*/ in mysqld.1.err +FOUND 1 /InnoDB: Memory pressure event shrunk.*/ in mysqld.1.err set debug_dbug=@save_dbug; +SET GLOBAL innodb_buffer_pool_size= @innodb_buffer_pool_size; +SET GLOBAL innodb_buffer_pool_size_auto_min=@innodb_buffer_pool_size_min; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/page_cleaner.result b/mysql-test/suite/innodb/r/page_cleaner.result index a026435237d..068a17be0f6 100644 --- a/mysql-test/suite/innodb/r/page_cleaner.result +++ b/mysql-test/suite/innodb/r/page_cleaner.result @@ -2,11 +2,24 @@ SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; +CREATE TABLE t(a INT) ENGINE=InnoDB STATS_PERSISTENT=0; +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +SET GLOBAL innodb_max_purge_lag_wait=0; SET GLOBAL innodb_max_dirty_pages_pct=90.0; select variable_value into @innodb_async_writes_total_count_before from information_schema.global_status where variable_name='innodb_async_writes_total_count'; -CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +BEGIN; +ROLLBACK; +SELECT if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) +FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; +if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) +ok +disconnect prevent_purge; SELECT variable_value>0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; variable_value>0 diff --git a/mysql-test/suite/innodb/r/recovery_memory.result b/mysql-test/suite/innodb/r/recovery_memory.result index b585b0202c2..a2a1f924d5f 100644 --- a/mysql-test/suite/innodb/r/recovery_memory.result +++ b/mysql-test/suite/innodb/r/recovery_memory.result @@ -13,7 +13,7 @@ END LOOP connect con1,localhost,root,,,; CALL dorepeat(); connection default; -# restart: --innodb_buffer_pool_size=5242880 +# restart: --innodb_buffer_pool_size=6m DROP TABLE t1; DROP PROCEDURE dorepeat; # diff --git a/mysql-test/suite/innodb/r/restart,16k.rdiff b/mysql-test/suite/innodb/r/restart,16k.rdiff deleted file mode 100644 index 3149b9aeab0..00000000000 --- a/mysql-test/suite/innodb/r/restart,16k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 5242880 for innodb_page_size=16384 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,32k.rdiff b/mysql-test/suite/innodb/r/restart,32k.rdiff deleted file mode 100644 index 3f00646cb37..00000000000 --- a/mysql-test/suite/innodb/r/restart,32k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 10485760 for innodb_page_size=32768 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,4k.rdiff b/mysql-test/suite/innodb/r/restart,4k.rdiff deleted file mode 100644 index b00c56ef81f..00000000000 --- a/mysql-test/suite/innodb/r/restart,4k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 2097152 for innodb_page_size=4096 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,64k.rdiff b/mysql-test/suite/innodb/r/restart,64k.rdiff deleted file mode 100644 index 886cbcde7d9..00000000000 --- a/mysql-test/suite/innodb/r/restart,64k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 20971520 for innodb_page_size=65536 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,8k.rdiff b/mysql-test/suite/innodb/r/restart,8k.rdiff deleted file mode 100644 index 40a9e1bad1c..00000000000 --- a/mysql-test/suite/innodb/r/restart,8k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 3145728 for innodb_page_size=8192 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result index 95d79a0ab14..ba6a87b5ef7 100644 --- a/mysql-test/suite/innodb/r/restart.result +++ b/mysql-test/suite/innodb/r/restart.result @@ -30,19 +30,6 @@ SELECT * FROM td; a DROP TABLE tr,tc,td; # -# MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup -# -SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; -SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); -ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -SHOW WARNINGS; -Level Code Message -Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE -Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); -SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; -# # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message # FOUND 1 /InnoDB: MySQL-8\.0 tablespace in \./ibdata1/ in attempted_start.err diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index a50e6fb1886..55dfcc3dabc 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -101,3 +101,13 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; DROP TABLE t1; # End of 10.6 tests +# +# MDEV-36373 Warning: ... persistent statistics storage is corrupted +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +SET STATEMENT transaction_read_only=1 FOR ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +DROP TABLE t1; +# End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/temp_truncate_freed.result b/mysql-test/suite/innodb/r/temp_truncate_freed.result index 1a25a7c7bea..1fa09139319 100644 --- a/mysql-test/suite/innodb/r/temp_truncate_freed.result +++ b/mysql-test/suite/innodb/r/temp_truncate_freed.result @@ -1,5 +1,6 @@ set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; set @old_immediate_scrub_data_val= @@innodb_immediate_scrub_data_uncompressed; +SET GLOBAL innodb_max_purge_lag_wait=0; SET GLOBAL innodb_immediate_scrub_data_uncompressed=1; SET GLOBAL innodb_buffer_pool_size= 16777216; CREATE TEMPORARY TABLE t1(c1 MEDIUMTEXT) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/undo_leak_fail.result b/mysql-test/suite/innodb/r/undo_leak_fail.result index 6aa89ec7d3d..83b976f785c 100644 --- a/mysql-test/suite/innodb/r/undo_leak_fail.result +++ b/mysql-test/suite/innodb/r/undo_leak_fail.result @@ -43,7 +43,7 @@ NAME FILE_SIZE innodb_system 77594624 # restart: --debug_dbug=d,unused_undo_free_fail_1 # Fail to free the segment due to previous shutdown -FOUND 4 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0/ in mysqld.1.err +FOUND 1 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0.*/ in mysqld.1.err SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; NAME FILE_SIZE innodb_system 15728640 diff --git a/mysql-test/suite/innodb/t/alter_partitioned_debug.test b/mysql-test/suite/innodb/t/alter_partitioned_debug.test index 34565e12036..cac5f960e01 100644 --- a/mysql-test/suite/innodb/t/alter_partitioned_debug.test +++ b/mysql-test/suite/innodb/t/alter_partitioned_debug.test @@ -4,6 +4,7 @@ --source include/have_debug_sync.inc CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=0 PARTITION BY RANGE(a) (PARTITION pa VALUES LESS THAN (3), PARTITION pb VALUES LESS THAN (5)); @@ -26,9 +27,46 @@ reap; connection default; DELETE FROM t1; -disconnect ddl; SET DEBUG_SYNC = 'RESET'; CHECK TABLE t1; -DROP TABLE t1; + +CREATE TABLE t(a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +RENAME TABLE t TO u; +DELETE FROM mysql.innodb_table_stats WHERE table_name='u'; +DELETE FROM mysql.innodb_index_stats WHERE table_name='u'; + +send SET STATEMENT debug_dbug='+d,dict_stats_save_exit_notify_and_wait' FOR +SELECT * FROM u; + +connection ddl; +SET DEBUG_SYNC='open_tables_after_open_and_process_table +WAIT_FOR dict_stats_save_finished'; +send ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u; + +connect sync,localhost,root; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'debug sync point: now' + and info like 'SET STATEMENT debug_dbug%SELECT * FROM u'; +--source include/wait_condition.inc +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'Waiting for table metadata lock' + and info like 'ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u'; +--source include/wait_condition.inc +SET DEBUG_SYNC='now SIGNAL dict_stats_save_unblock'; +disconnect sync; + +connection default; +reap; +connection ddl; +reap; +disconnect ddl; +connection default; +SELECT * FROM u; +SET DEBUG_SYNC = 'RESET'; + +DROP TABLE t1,u; diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt deleted file mode 100644 index 09fd8bd8e35..00000000000 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test deleted file mode 100644 index ea13129e8b1..00000000000 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test +++ /dev/null @@ -1,27 +0,0 @@ ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/not_embedded.inc - ---echo # ---echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL ---echo # ONLINE WITH MEMORY FULL CONDITION ---echo # - -call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); - -SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; - ---disable_warnings -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; ---enable_warnings - -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; - ---source include/wait_condition.inc -# Restart the server, because the buffer pool would not necessarily be -# shrunk afterwards even if we request it. ---source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb-index-online.opt b/mysql-test/suite/innodb/t/innodb-index-online.opt index 1837463f07a..0aa69cc9e20 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.opt +++ b/mysql-test/suite/innodb/t/innodb-index-online.opt @@ -1,5 +1,5 @@ --loose-innodb-sort-buffer-size=64k --loose-innodb-online-alter-log-max-size=128k ---loose-innodb-buffer-pool-size=5M +--loose-innodb-buffer-pool-size=6M --loose-innodb-sys-indexes --loose-innodb-sys-fields diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 70a10391db2..2581d7dc42e 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -506,12 +506,35 @@ SET DEBUG_SYNC = 'now SIGNAL inserted'; connection con1; reap; -disconnect con1; connection default; SELECT * FROM t1; CHECK TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-36281 DML aborts during online virtual index +--echo # +CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL, + f3 INT NOT NULL, f4 INT AS (f3) VIRTUAL, + f5 INT AS (f1) VIRTUAL, INDEX(f4))ENGINE=InnoDB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 2, 3); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish'; +send ALTER TABLE t1 ADD INDEX v1(f5, f2, f4), ADD INDEX v2(f3, f5); + +connection con1; +set DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET f3= f3 + 1; +set DEBUG_SYNC="now SIGNAL dml_finish"; + +disconnect con1; +connection default; +reap; +CHECK TABLE t1 EXTENDED; +SELECT f5, f2, f4 FROM t1 USE INDEX(v1); +SELECT f3, f5 FROM t1 USE INDEX(v2); +DROP TABLE t1; + SET DEBUG_SYNC = 'RESET'; # Check that all connections opened by test cases in this file are really diff --git a/mysql-test/suite/innodb/t/innodb-table-online-master.opt b/mysql-test/suite/innodb/t/innodb-table-online-master.opt index 1eafb5ac188..42f6b2832e5 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online-master.opt +++ b/mysql-test/suite/innodb/t/innodb-table-online-master.opt @@ -1 +1 @@ ---innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=512k --innodb-buffer-pool-size=5M +--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=512k --innodb-buffer-pool-size=6M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt new file mode 100644 index 00000000000..95f86e59920 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=16m diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test index e8e070c5061..f082e7d7fd4 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test @@ -1,6 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc -call mtr.add_suppression("InnoDB: Cannot allocate memory for the buffer pool"); +call mtr.add_suppression("InnoDB: Cannot map innodb_buffer_pool_size_max="); 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."); @@ -10,5 +10,5 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile let restart_parameters=--debug_dbug=+d,ib_buf_chunk_init_fails; --source include/restart_mysqld.inc let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_PATTERN=\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool; +let SEARCH_PATTERN=\[ERROR\] InnoDB: Cannot map innodb_buffer_pool_size_max=16m; --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt index 39543543a53..eaf7b653020 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt @@ -1,2 +1,3 @@ --innodb-buffer-pool-size=8M +--innodb-buffer-pool-size-max=25M --innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test index 051f38a572e..612a0c1be64 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test @@ -1,17 +1,13 @@ -# -# WL6117 : Resize the InnoDB Buffer Pool Online -# - --source include/have_innodb.inc ---source include/big_test.inc +--source include/have_sequence.inc -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; +--echo # +--echo # MDEV-29445: Reorganize buffer pool (and remove chunks) +--echo # --disable_query_log +call mtr.add_suppression("InnoDB: Over 67 percent of the buffer pool is occupied by lock heaps"); +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; set @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; --enable_query_log @@ -21,10 +17,9 @@ set global innodb_adaptive_hash_index=ON; select @@innodb_buffer_pool_size; # Expand buffer pool +set global innodb_buffer_pool_size = 9437184; set global innodb_buffer_pool_size = 10485760; ---source include/wait_condition.inc - select @@innodb_buffer_pool_size; # fill buffer pool @@ -32,41 +27,48 @@ select @@innodb_buffer_pool_size; SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; +create table t1 (id int primary key, val int not null) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -set @`v_id` := 0; -set @`v_val` := 0; +SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR +INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; -# 2^18 == 262144 records -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; --disable_query_log SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log -# Shrink buffer pool -set global innodb_buffer_pool_size = 64 * 1024 * 1024 + 512 * 1024; ---source include/wait_condition.inc - -select @@innodb_buffer_pool_size; +# Attempt to shrink the buffer pool. This may occasionally fail. +--error 0,ER_WRONG_USAGE +set global innodb_buffer_pool_size = 7340032; select count(val) from t1; set global innodb_adaptive_hash_index=OFF; -# Expand buffer pool to 24MB -set global innodb_buffer_pool_size = 25165824; ---source include/wait_condition.inc +# Expand buffer pool to 23 and then 24 MiB (requesting 25 MiB) +set global innodb_buffer_pool_size = 24117248; +set global innodb_buffer_pool_size = 26214400; select @@innodb_buffer_pool_size; select count(val) from t1; drop table t1; -drop view view0; ---disable_query_log -set global innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; -set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; ---enable_query_log +SET GLOBAL innodb_max_purge_lag_wait = 0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; + +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +let $wait_condition = +SELECT variable_value = 0 +FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; --source include/wait_condition.inc +# this may occasionally be aborted on a heavily loaded builder +--error 0,ER_WRONG_USAGE +SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt deleted file mode 100644 index 72f055d3b58..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-buffer-pool-chunk-size=1M ---loose-skip-innodb-disable-resize_buffer_pool_debug diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test deleted file mode 100644 index db5da2924fa..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test +++ /dev/null @@ -1,28 +0,0 @@ ---source include/have_innodb.inc ---source include/big_test.inc - -SET @save_size=@@innodb_buffer_pool_size; - -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; - ---echo # ---echo # MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize ---echo # after or during DROP TABLE ---echo # - -select @@innodb_buffer_pool_chunk_size; -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -SET GLOBAL innodb_buffer_pool_size=256*1024*1024; -DROP TABLE t1; ---source include/wait_condition.inc -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; ---source include/wait_condition.inc - ---echo # End of 10.6 tests - -SET GLOBAL innodb_buffer_pool_size=@save_size; ---source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt deleted file mode 100644 index dca040ea893..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt new file mode 100644 index 00000000000..95f86e59920 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=16m diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index c49ae451638..59afed24521 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -1,24 +1,43 @@ --source include/have_innodb.inc --source include/have_sequence.inc --source include/have_debug.inc +--source include/have_debug_sync.inc SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; - SET GLOBAL innodb_buffer_pool_size=16777216; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; -SET GLOBAL innodb_buffer_pool_size=8388608; +# Flush the buffer pool to prevent +# "innodb_buffer_pool_size change aborted" error with ./mtr --repeat=3 +SET GLOBAL innodb_max_purge_lag_wait=0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; ---source include/wait_condition.inc +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +connect con1,localhost,root; +SET DEBUG_SYNC='buf_pool_shrink_before_wakeup SIGNAL blocked WAIT_FOR go'; +send SET GLOBAL innodb_buffer_pool_size=8388608; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +# adjust for 32-bit +--replace_result 504/504 505/505 +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +reap; +disconnect con1; +connection default; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +SET DEBUG_SYNC=RESET; + +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; SELECT COUNT(*),MIN(a),MAX(a) FROM t1; DROP TEMPORARY TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt deleted file mode 100644 index ade197de338..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt +++ /dev/null @@ -1,3 +0,0 @@ ---innodb-buffer-pool-size=16M ---innodb-buffer-pool-chunk-size=4M ---innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test deleted file mode 100644 index 78db6bf0d5a..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test +++ /dev/null @@ -1,61 +0,0 @@ -# -# WL6117 : Resize the InnoDB Buffer Pool Online -# (innodb_buffer_pool_chunk_size used case) -# - ---source include/have_innodb.inc ---source include/big_test.inc - -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - ---disable_query_log -set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; ---enable_query_log - -select @@innodb_buffer_pool_chunk_size; - -# fill buffer pool ---disable_query_log -SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; - -set @`v_id` := 0; -set @`v_val` := 0; - -# 2^18 == 262144 records -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; ---disable_query_log -SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; ---enable_query_log - -# Shrink buffer pool to 7MB -set global innodb_buffer_pool_size = 7340032; ---source include/wait_condition.inc - -select count(val) from t1; - -# Expand buffer pool to 16MB -set global innodb_buffer_pool_size = 16777216; ---source include/wait_condition.inc - -select count(val) from t1; - -drop table t1; -drop view view0; - -# Try to shrink buffer pool to smaller than chunk size -set global innodb_buffer_pool_size = 2*1048576; ---source include/wait_condition.inc -select @@innodb_buffer_pool_size; - ---disable_query_log -set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; ---enable_query_log ---source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/innodb_bug52663.test b/mysql-test/suite/innodb/t/innodb_bug52663.test index fcf97531e00..dd246297d94 100644 --- a/mysql-test/suite/innodb/t/innodb_bug52663.test +++ b/mysql-test/suite/innodb/t/innodb_bug52663.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_innodb.inc set session transaction isolation level read committed; diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.opt b/mysql-test/suite/innodb/t/lock_memory_debug.opt index 67c8423cf2a..184ec4096a8 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.opt +++ b/mysql-test/suite/innodb/t/lock_memory_debug.opt @@ -1 +1 @@ ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.test b/mysql-test/suite/innodb/t/lock_memory_debug.test index 588356f7fa4..58a76740dcb 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.test +++ b/mysql-test/suite/innodb/t/lock_memory_debug.test @@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); --error ER_LOCK_TABLE_FULL SET STATEMENT debug_dbug='+d,innodb_skip_lock_bitmap' FOR -INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g LIMIT 45000; +INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g; SELECT COUNT(*) FROM t1; diff --git a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test index 7b54e3ae9aa..7b19986f73e 100644 --- a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test +++ b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test @@ -89,7 +89,7 @@ print OUT chr(0); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/innodb/t/mem_pressure.opt b/mysql-test/suite/innodb/t/mem_pressure.opt new file mode 100644 index 00000000000..ea4105f2390 --- /dev/null +++ b/mysql-test/suite/innodb/t/mem_pressure.opt @@ -0,0 +1,3 @@ +--loose-innodb-buffer-pool-size-auto-min=17m +--innodb-buffer-pool-size-max=17m +--innodb-buffer-pool-size=17m diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test index a0fd0ad1f43..fcfb631b759 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.test +++ b/mysql-test/suite/innodb/t/mem_pressure.test @@ -1,8 +1,8 @@ --source include/have_debug.inc ---source include/have_cgroupv2.inc --source include/not_embedded.inc --source include/have_innodb.inc --source include/have_sequence.inc +--source include/word_size.inc --echo # --echo # MDEV-24670 avoid OOM by linux kernel co-operative memory management @@ -15,6 +15,13 @@ set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; # This is not an actual parameter, so there is no need to restore it. set GLOBAL innodb_max_purge_lag_wait=0; +SET @innodb_buffer_pool_size= @@GLOBAL.innodb_buffer_pool_size; +SET @innodb_buffer_pool_size_min= @@GLOBAL.innodb_buffer_pool_size_auto_min; +SELECT +@@GLOBAL.innodb_buffer_pool_size, +@@GLOBAL.innodb_buffer_pool_size_auto_min, +@@GLOBAL.innodb_buffer_pool_size_max; + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB CHARSET=latin1; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR @@ -24,32 +31,31 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; DROP TABLE t1; ---disable_cursor_protocol -SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; ---enable_cursor_protocol - -set debug_dbug="d,trigger_garbage_collection"; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size; +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size=@innodb_buffer_pool_size; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; -# either a fail or the pressure event -let SEARCH_PATTERN= [Mm]emory pressure.*; +let SEARCH_PATTERN= Memory pressure event disregarded.*; +let SEARCH_WAIT= FOUND; --source include/search_pattern_in_file.inc +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size_auto_min= +CAST(@innodb_buffer_pool_size/2 AS UNSIGNED), +innodb_buffer_pool_size=@innodb_buffer_pool_size; + # The garbage collection happens asynchronously after trigger, in a background # thread. So wait for it to happen to avoid sporadic failure. let $wait_condition= - SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD - FROM INFORMATION_SCHEMA.GLOBAL_STATUS - WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; + select @@global.innodb_buffer_pool_size < @innodb_buffer_pool_size; --source include/wait_condition.inc eval $wait_condition; -let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*; +let SEARCH_PATTERN= InnoDB: Memory pressure event shrunk.*; let SEARCH_WAIT= FOUND; --source include/search_pattern_in_file.inc set debug_dbug=@save_dbug; +SET GLOBAL innodb_buffer_pool_size= @innodb_buffer_pool_size; +SET GLOBAL innodb_buffer_pool_size_auto_min=@innodb_buffer_pool_size_min; --echo # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/page_cleaner.test b/mysql-test/suite/innodb/t/page_cleaner.test index 267d69b63c5..2ff92f1d477 100644 --- a/mysql-test/suite/innodb/t/page_cleaner.test +++ b/mysql-test/suite/innodb/t/page_cleaner.test @@ -7,6 +7,12 @@ SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; +CREATE TABLE t(a INT) ENGINE=InnoDB STATS_PERSISTENT=0; +--connect (prevent_purge,localhost,root) +START TRANSACTION WITH CONSISTENT SNAPSHOT; +--connection default +SET GLOBAL innodb_max_purge_lag_wait=0; + let $wait_condition = SELECT variable_value = 0 FROM information_schema.global_status @@ -20,7 +26,24 @@ select variable_value into @innodb_async_writes_total_count_before where variable_name='innodb_async_writes_total_count'; --enable_cursor_protocol -CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +--disable_cursor_protocol +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +--enable_cursor_protocol + +BEGIN; +--disable_query_log +let $N=500; +while ($N) { + INSERT INTO t SELECT * FROM seq_1_to_10; + dec $N; +} +--enable_query_log +ROLLBACK; + +SELECT if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) +FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; +--disconnect prevent_purge SELECT variable_value>0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; diff --git a/mysql-test/suite/innodb/t/purge_secondary.opt b/mysql-test/suite/innodb/t/purge_secondary.opt index 2821c98397c..fd3b12811e8 100644 --- a/mysql-test/suite/innodb/t/purge_secondary.opt +++ b/mysql-test/suite/innodb/t/purge_secondary.opt @@ -1,4 +1,4 @@ --innodb-sys-tablestats ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M --innodb_monitor_enable=module_buffer --skip-innodb-stats-persistent diff --git a/mysql-test/suite/innodb/t/recovery_memory.test b/mysql-test/suite/innodb/t/recovery_memory.test index 66609dd7d7e..a1eeed13b07 100644 --- a/mysql-test/suite/innodb/t/recovery_memory.test +++ b/mysql-test/suite/innodb/t/recovery_memory.test @@ -23,7 +23,7 @@ send CALL dorepeat(); connection default; sleep 10; let $shutdown_timeout=0; -let $restart_parameters=--innodb_buffer_pool_size=5242880; +let $restart_parameters=--innodb_buffer_pool_size=6m; --source include/restart_mysqld.inc DROP TABLE t1; DROP PROCEDURE dorepeat; @@ -34,11 +34,11 @@ DROP PROCEDURE dorepeat; --echo # if ($have_debug) { SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; -let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug=+d,hdr_page_corrupt; +let $restart_parameters=--innodb_buffer_pool_size=6m --debug_dbug=+d,hdr_page_corrupt; } if (!$have_debug) { --echo SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; -let $restart_parameters=--innodb_buffer_pool_size=5242880; +let $restart_parameters=--innodb_buffer_pool_size=6m; } CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; INSERT INTO t1 SELECT * FROM seq_1_to_65536; diff --git a/mysql-test/suite/innodb/t/restart.opt b/mysql-test/suite/innodb/t/restart.opt deleted file mode 100644 index ce43e89cb2b..00000000000 --- a/mysql-test/suite/innodb/t/restart.opt +++ /dev/null @@ -1,2 +0,0 @@ ---loose-innodb_disable_resize_buffer_pool_debug=0 ---innodb-buffer-pool-chunk-size=1M diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 727353b2492..fc6c2bfabd5 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -92,31 +92,6 @@ SELECT * FROM tc; SELECT * FROM td; DROP TABLE tr,tc,td; ---echo # ---echo # MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup ---echo # - -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - ---disable_cursor_protocol -SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; -SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; ---enable_cursor_protocol ---error ER_WRONG_VALUE_FOR_VAR -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); - -SHOW WARNINGS; - -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - ---source include/wait_condition.inc - -SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; - --echo # --echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message --echo # diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index d606ad27709..f5eef1e9056 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -110,3 +110,12 @@ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; DROP TABLE t1; --echo # End of 10.6 tests + +--echo # +--echo # MDEV-36373 Warning: ... persistent statistics storage is corrupted +--echo # +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +SET STATEMENT transaction_read_only=1 FOR ANALYZE TABLE t1; +DROP TABLE t1; + +--echo # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/sys_truncate_debug.test b/mysql-test/suite/innodb/t/sys_truncate_debug.test index 20fa981685d..be70ea743e9 100644 --- a/mysql-test/suite/innodb/t/sys_truncate_debug.test +++ b/mysql-test/suite/innodb/t/sys_truncate_debug.test @@ -3,6 +3,8 @@ --source include/not_embedded.inc --source include/have_debug.inc --source include/not_windows.inc +# This test is extremely slow on Valgrind (exceeding 4 hours). +--source include/not_valgrind.inc call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test b/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test index 8e8c91e7b47..d819ebe42ee 100644 --- a/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test +++ b/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test @@ -2,6 +2,8 @@ --source include/have_sequence.inc --source include/not_embedded.inc --source include/have_debug.inc +# This test is extremely slow on Valgrind (exceeding 4 hours). +--source include/not_valgrind.inc call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/innodb/t/temp_truncate_freed.opt b/mysql-test/suite/innodb/t/temp_truncate_freed.opt new file mode 100644 index 00000000000..95f86e59920 --- /dev/null +++ b/mysql-test/suite/innodb/t/temp_truncate_freed.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=16m diff --git a/mysql-test/suite/innodb/t/temp_truncate_freed.test b/mysql-test/suite/innodb/t/temp_truncate_freed.test index a09cecc5f9c..fc321c30d74 100644 --- a/mysql-test/suite/innodb/t/temp_truncate_freed.test +++ b/mysql-test/suite/innodb/t/temp_truncate_freed.test @@ -3,34 +3,17 @@ set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; set @old_immediate_scrub_data_val= @@innodb_immediate_scrub_data_uncompressed; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - +SET GLOBAL innodb_max_purge_lag_wait=0; SET GLOBAL innodb_immediate_scrub_data_uncompressed=1; SET GLOBAL innodb_buffer_pool_size= 16777216; ---source include/wait_condition.inc CREATE TEMPORARY TABLE t1(c1 MEDIUMTEXT) ENGINE=InnoDB; INSERT INTO t1 VALUES (repeat(1,16777215)); DROP TEMPORARY TABLE t1; SET GLOBAL innodb_truncate_temporary_tablespace_now=1; - -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 45) = 'Completed resizing buffer pool from 16777216' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - SET GLOBAL innodb_buffer_pool_size=10485760; ---source include/wait_condition.inc set global innodb_immediate_scrub_data_uncompressed = @old_immediate_scrub_data_val; - -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 45) = 'Completed resizing buffer pool from 10485760' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; +# this may occasionally be aborted on a heavily loaded builder +--error 0,ER_WRONG_USAGE set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; ---source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/undo_leak_fail.test b/mysql-test/suite/innodb/t/undo_leak_fail.test index 0346293eda2..30ca437025d 100644 --- a/mysql-test/suite/innodb/t/undo_leak_fail.test +++ b/mysql-test/suite/innodb/t/undo_leak_fail.test @@ -49,7 +49,7 @@ let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_1; let $shutdown_timeout=; --echo # Fail to free the segment due to previous shutdown ---let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 +--let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0.* let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt deleted file mode 100644 index f0fd647546d..00000000000 --- a/mysql-test/suite/innodb/t/update_time-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=5M diff --git a/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result index a1ffb0a5d09..34416dff883 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result +++ b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result @@ -118,4 +118,13 @@ KEY VALUE SELECT @@GLOBAL.innodb_ft_aux_table; @@GLOBAL.innodb_ft_aux_table test/t1 +CREATE TABLE t(a INT) ENGINE=InnoDB; +SET GLOBAL innodb_ft_aux_table='test/t'; +ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t' +DROP TABLE t; +SET GLOBAL innodb_ft_aux_table='test/t'; +ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t' +SELECT @@GLOBAL.innodb_ft_aux_table; +@@GLOBAL.innodb_ft_aux_table +test/t1 SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; diff --git a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test index f9447aada60..2c0972083c9 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test +++ b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test @@ -41,4 +41,13 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; SELECT @@GLOBAL.innodb_ft_aux_table; + +CREATE TABLE t(a INT) ENGINE=InnoDB; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL innodb_ft_aux_table='test/t'; +DROP TABLE t; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL innodb_ft_aux_table='test/t'; +SELECT @@GLOBAL.innodb_ft_aux_table; + SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; diff --git a/mysql-test/suite/innodb_gis/r/rollback.result b/mysql-test/suite/innodb_gis/r/rollback.result index 1f10dc00de5..3b20e00e640 100644 --- a/mysql-test/suite/innodb_gis/r/rollback.result +++ b/mysql-test/suite/innodb_gis/r/rollback.result @@ -412,3 +412,16 @@ update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3; ERROR HY000: Lost connection to server during query insert into t1 values(5, point(5,5), point(5,5), 5); drop table t1; +# +# MDEV-35420 Server aborts while deleting the record +# in spatial index +# +CREATE TABLE t1 (c POINT NOT NULL, SPATIAL(c)) engine=InnoDB; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +START TRANSACTION; +INSERT INTO t1 SELECT ST_GeomFromText('POINT(114368751 656950466)') FROM seq_1_to_512; +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/rollback.test b/mysql-test/suite/innodb_gis/t/rollback.test index 8483b3569d8..77e5379e4e0 100644 --- a/mysql-test/suite/innodb_gis/t/rollback.test +++ b/mysql-test/suite/innodb_gis/t/rollback.test @@ -8,6 +8,7 @@ # Avoid CrashReporter popup on Mac --source include/not_crashrep.inc --source include/have_innodb_16k.inc +--source include/have_sequence.inc CREATE TABLE t4 (id bigint(12) unsigned NOT NULL auto_increment, c2 varchar(15) collate utf8_bin default NULL, @@ -475,3 +476,15 @@ update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3; insert into t1 values(5, point(5,5), point(5,5), 5); drop table t1; + +--echo # +--echo # MDEV-35420 Server aborts while deleting the record +--echo # in spatial index +--echo # +CREATE TABLE t1 (c POINT NOT NULL, SPATIAL(c)) engine=InnoDB; +CHECK TABLE t1; +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +START TRANSACTION; +INSERT INTO t1 SELECT ST_GeomFromText('POINT(114368751 656950466)') FROM seq_1_to_512; +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index 194c8a23b01..f89f590acf0 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -1,5 +1,6 @@ # This test case will test R-tree purge. +--source include/long_test.inc --source include/innodb_page_size.inc --source include/have_sequence.inc --source include/not_valgrind.inc diff --git a/mysql-test/suite/mariabackup/binlog.test b/mysql-test/suite/mariabackup/binlog.test index d02d135ebbd..520684ce46d 100644 --- a/mysql-test/suite/mariabackup/binlog.test +++ b/mysql-test/suite/mariabackup/binlog.test @@ -9,7 +9,7 @@ INSERT INTO t VALUES(1); SHOW VARIABLES like 'log_bin'; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --skip-innodb-log-checkpoint-now --parallel=10 --target-dir=$basedir; --enable_result_log exec $XTRABACKUP --prepare --binlog-info=1 --target-dir=$basedir ; diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index 71525c22080..936fdce0db2 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -1,7 +1,12 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); +SET GLOBAL innodb_max_purge_lag_wait=0; # xtrabackup backup NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log +SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; +variable_value +0 INSERT INTO t VALUES(2); # xtrabackup prepare # shutdown server diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index d3d3661ce6c..55dce51a088 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -2,6 +2,7 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); +SET GLOBAL innodb_max_purge_lag_wait=0; echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; --let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log @@ -18,6 +19,8 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir= --source include/search_pattern_in_file.inc --remove_file $backup_log +SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; INSERT INTO t VALUES(2); diff --git a/mysql-test/suite/mariabackup/incremental_compressed.result b/mysql-test/suite/mariabackup/incremental_compressed.result index 74af3db7ae2..b33a955c2e4 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.result +++ b/mysql-test/suite/mariabackup/incremental_compressed.result @@ -4,6 +4,9 @@ # CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; ALTER TABLE t PARTITION BY KEY(pk); +# Incremental backup +# Prepare fullbackup +# Prepare incremental backup # shutdown server # remove datadir # xtrabackup move back diff --git a/mysql-test/suite/mariabackup/incremental_compressed.test b/mysql-test/suite/mariabackup/incremental_compressed.test index ebb1fada685..d548081e940 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.test +++ b/mysql-test/suite/mariabackup/incremental_compressed.test @@ -16,12 +16,18 @@ CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; ALTER TABLE t PARTITION BY KEY(pk); +--echo # Incremental backup --exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --protocol=tcp --port=$MASTER_MYPORT --user=root > $incremental_dir.log 2>&1 +--echo # Prepare fullbackup --exec $XTRABACKUP --prepare --target-dir=$basedir --user=root > $MYSQL_TMP_DIR/backup_prepare_0.log 2>&1 ---exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log ---cat_file $MYSQL_TMP_DIR/backup_prepare_1.log +--echo # Prepare incremental backup +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log 2>&1 let $targetdir=$basedir; -- source include/restart_and_restore.inc - SHOW CREATE TABLE t; DROP TABLE t; +remove_file $incremental_dir.log; +remove_file $MYSQL_TMP_DIR/backup_prepare_0.log; +remove_file $MYSQL_TMP_DIR/backup_prepare_1.log; +rmdir $basedir; +rmdir $incremental_dir; diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test index 18d773bd480..53b850d2952 100644 --- a/mysql-test/suite/mariabackup/log_page_corruption.test +++ b/mysql-test/suite/mariabackup/log_page_corruption.test @@ -1,5 +1,5 @@ +--source include/long_test.inc --source include/have_debug.inc ---source include/no_valgrind_without_big.inc --source include/innodb_undo_tablespaces.inc --echo ######## diff --git a/mysql-test/suite/mariabackup/partial.result b/mysql-test/suite/mariabackup/partial.result index 9ff3a20c01f..cefda922868 100644 --- a/mysql-test/suite/mariabackup/partial.result +++ b/mysql-test/suite/mariabackup/partial.result @@ -4,8 +4,8 @@ CREATE TABLE t21(i INT) ENGINE INNODB; INSERT INTO t21 VALUES(1); CREATE TABLE t2(i int) ENGINE INNODB; # xtrabackup backup -t1.new -t21.new +t1.ibd +t21.ibd # xtrabackup prepare t1.cfg t21.cfg diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result index f57a5f63e68..9f4c1042d93 100644 --- a/mysql-test/suite/mariabackup/partial_exclude.result +++ b/mysql-test/suite/mariabackup/partial_exclude.result @@ -14,7 +14,7 @@ INSERT INTO test.t1 VALUES(20); INSERT INTO test.t2 VALUES(20); # xtrabackup backup COMMIT; -t1.new +t1.ibd DROP TABLE t1; DROP TABLE t2; DROP DATABASE db2; diff --git a/mysql-test/suite/mariabackup/partition_notwin.result b/mysql-test/suite/mariabackup/partition_notwin.result new file mode 100644 index 00000000000..6f2e1778ad9 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_notwin.result @@ -0,0 +1,11 @@ +# +# MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM +# +create table t1 ( +id bigint(20) not null auto_increment, +primary key (id) +) engine=myisam +partition by hash (id) +partitions 600; +FOUND 1 /Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files/ in backup.log +drop table t1; diff --git a/mysql-test/suite/mariabackup/partition_notwin.test b/mysql-test/suite/mariabackup/partition_notwin.test new file mode 100644 index 00000000000..10687e19935 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_notwin.test @@ -0,0 +1,25 @@ +source include/not_windows.inc; +source include/have_partition.inc; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $log=$MYSQL_TMP_DIR/backup.log; + +--echo # +--echo # MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM +--echo # + +create table t1 ( + id bigint(20) not null auto_increment, + primary key (id) +) engine=myisam + partition by hash (id) + partitions 600; + +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $log 2>&1; +let SEARCH_FILE=$log; +let SEARCH_PATTERN=Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files; +source include/search_pattern_in_file.inc; + +rmdir $targetdir; +#remove_file $log; +drop table t1; diff --git a/mysql-test/suite/mariabackup/sys_truncate.test b/mysql-test/suite/mariabackup/sys_truncate.test index 4f4ea510302..82d2660f527 100644 --- a/mysql-test/suite/mariabackup/sys_truncate.test +++ b/mysql-test/suite/mariabackup/sys_truncate.test @@ -13,13 +13,13 @@ DROP TABLE t1; --source ../innodb/include/wait_all_purged.inc SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir --throttle=1000; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --skip-innodb-log-checkpoint-now --parallel=10 --target-dir=$basedir --throttle=1000; --enable_result_log --source include/restart_mysqld.inc SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; --echo # Incremental backup -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --skip-innodb-log-checkpoint-now --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir; --disable_result_log echo # Prepare full backup, apply incremental one; diff --git a/mysql-test/suite/mariabackup/unsupported_redo.result b/mysql-test/suite/mariabackup/unsupported_redo.result index 4ba40f5a916..f2cfcc730e5 100644 --- a/mysql-test/suite/mariabackup/unsupported_redo.result +++ b/mysql-test/suite/mariabackup/unsupported_redo.result @@ -22,8 +22,8 @@ CREATE TABLE t2(i int) ENGINE INNODB; ALTER TABLE t21 FORCE, ALGORITHM=INPLACE; # Create partial backup (excluding table t21), Ignore the # unsupported redo log for the table t21. -t1.new -t2.new +t1.ibd +t2.ibd # Prepare the full backup t1.ibd t2.ibd diff --git a/mysql-test/suite/multi_source/master_info_file.opt b/mysql-test/suite/multi_source/master_info_file.opt new file mode 100644 index 00000000000..33315660f0d --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.opt @@ -0,0 +1 @@ +--master-info-file=$MYSQL_TMP_DIR/master_info_file.txt diff --git a/mysql-test/suite/multi_source/master_info_file.result b/mysql-test/suite/multi_source/master_info_file.result new file mode 100644 index 00000000000..08fe34677be --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.result @@ -0,0 +1,18 @@ +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1; +CHANGE MASTER 'named' TO master_host='localhost', master_user='test', master_port=SERVER_MYPORT_2; +--list_files @@datadir *.info +relay-log-named.info +relay-log.info +--list_files MYSQL_TMP_DIR *.txt +master_info_file-named.txt +master_info_file.txt +multi-master_info_file.txt +--cat_file MYSQL_TMP_DIR/multi-master_info_file.txt +named +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file-named.txt +FOUND 1 matches in master_info_file-named.txt +FOUND 1 matches in master_info_file-named.txt +RESET REPLICA 'named' ALL; diff --git a/mysql-test/suite/multi_source/master_info_file.test b/mysql-test/suite/multi_source/master_info_file.test new file mode 100644 index 00000000000..812b22b5706 --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.test @@ -0,0 +1,38 @@ +# MDEV-36238: Test `--master-info-file` +# +# Other tests (such as `info_logs`) work explicitly with `(multi-)master.info`. +# This test sees that `--master-info-file` moves/renames this file. + +--source include/not_embedded.inc +--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_1 +--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 +--eval CHANGE MASTER 'named' TO master_host='localhost', master_user='test', master_port=$SERVER_MYPORT_2 + +--let $datadir = `SELECT @@datadir` +--echo --list_files @@datadir *.info +--list_files $datadir *.info +--echo --list_files MYSQL_TMP_DIR *.txt +--list_files $MYSQL_TMP_DIR *.txt + +--echo --cat_file MYSQL_TMP_DIR/multi-master_info_file.txt +--cat_file $MYSQL_TMP_DIR/multi-master_info_file.txt +--let SEARCH_OUTPUT= count + +--let SEARCH_FILE= $MYSQL_TMP_DIR/master_info_file.txt +--let SEARCH_PATTERN= \\n127.0.0.1\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\nroot\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\n$SERVER_MYPORT_1\\n +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $MYSQL_TMP_DIR/master_info_file-named.txt +--let SEARCH_PATTERN= \\nlocalhost\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\ntest\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\n$SERVER_MYPORT_2\\n +--source include/search_pattern_in_file.inc + +RESET REPLICA 'named' ALL; diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.cnf b/mysql-test/suite/multi_source/show_slave_auth_info.cnf new file mode 100644 index 00000000000..50761676fd6 --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.cnf @@ -0,0 +1,13 @@ +!include ./my.cnf + +[mysqld.1] +show-slave-auth-info + +[mysqld.4] +server-id=4 +log-warnings=2 +report-user=my_user +report-password=my_password + +[ENV] +SERVER_MYPORT_4= @mysqld.4.port diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.result b/mysql-test/suite/multi_source/show_slave_auth_info.result new file mode 100644 index 00000000000..71038f83f3b --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.result @@ -0,0 +1,45 @@ +# Setup +connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect slave1,127.0.0.1,root,,,$SERVER_MYPORT_3; +connect slave2,127.0.0.1,root,,,$SERVER_MYPORT_4; +connection slave2; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1, master_ssl_verify_server_cert=0; +CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_2, master_ssl_verify_server_cert=0; +START ALL SLAVES; +connection slave1; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1, master_ssl_verify_server_cert=0; +CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_2, master_ssl_verify_server_cert=0; +START ALL SLAVES; +# Test +connection master2; +SHOW SLAVE HOSTS; +Server_id Host Port Master_id +3 localhost SERVER_MYPORT_3 2 +4 localhost SERVER_MYPORT_4 2 +connection master1; +SHOW SLAVE HOSTS; +Server_id Host User Password Port Master_id +3 localhost SERVER_MYPORT_3 1 +4 localhost my_user my_password SERVER_MYPORT_4 1 +SHOW REPLICA HOSTS; +Server_id Host User Password Port Master_id +3 localhost SERVER_MYPORT_3 1 +4 localhost my_user my_password SERVER_MYPORT_4 1 +# Cleanup +connection slave2; +STOP ALL SLAVES; +include/wait_for_slave_to_stop.inc +SET @@SESSION.default_master_connection= 'control sample'; +include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +connection slave1; +STOP ALL SLAVES; +include/wait_for_slave_to_stop.inc +SET @@SESSION.default_master_connection= 'control sample'; +include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +disconnect master1; +disconnect master2; +disconnect slave1; +disconnect slave2; diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.test b/mysql-test/suite/multi_source/show_slave_auth_info.test new file mode 100644 index 00000000000..ccaabcfc1db --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.test @@ -0,0 +1,83 @@ +# MDEV-36238: Test `--show-slave-auth-info` (and `--report-user`/`password`) +# +# `rpl.rpl_show_slave_hosts` and `rpl.rpl_slave_alias_replica` +# (and several others) test SHOW SLAVE HOSTS without `--show-slave-auth-info`. +# This test supplements them with a comparison between with and without. + +# SHOW SLAVE HOSTS is agnostic of binlog formats +--source include/have_binlog_format_mixed.inc + +--echo # Setup + +# This server has `--show-slave-auth-info`. +--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) +# This `--show-slave-auth-info`-less server asserts that it is per-master. +--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) +# This is a non-reporting slave. +--connect (slave1,127.0.0.1,root,,,$SERVER_MYPORT_3) +# This is a self-reporting slave. +--connect (slave2,127.0.0.1,root,,,$SERVER_MYPORT_4) + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection slave$rpl_server_number + + --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 + --eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_1, master_ssl_verify_server_cert=0 + --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 + --eval CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_2, master_ssl_verify_server_cert=0 + --disable_warnings + START ALL SLAVES; + --enable_warnings + + --dec $rpl_server_number +} + +--echo # Test + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection master$rpl_server_number + + # Make sure the master's synced up + --let $show_statement= SHOW SLAVE HOSTS + --let $field= Server_id + --let $condition= =3 + --source include/wait_show_condition.inc + --let $condition= =4 + --source include/wait_show_condition.inc + + --replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $SERVER_MYPORT_4 SERVER_MYPORT_4 + SHOW SLAVE HOSTS; + + --dec $rpl_server_number +} + +# MDEV-20601 Make REPLICA a synonym for SLAVE in SQL statements +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $SERVER_MYPORT_4 SERVER_MYPORT_4 +SHOW REPLICA HOSTS; + +--echo # Cleanup + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection slave$rpl_server_number + + --disable_warnings + STOP ALL SLAVES; + --enable_warnings + --source include/wait_for_slave_to_stop.inc + SET @@SESSION.default_master_connection= 'control sample'; + --source include/wait_for_slave_to_stop.inc + RESET SLAVE ALL; + + --dec $rpl_server_number +} + +--disconnect master1 +--disconnect master2 +--disconnect slave1 +--disconnect slave2 diff --git a/mysql-test/suite/parts/t/partition_exchange_innodb.test b/mysql-test/suite/parts/t/partition_exchange_innodb.test index 31ea61bbb7b..73dd5500a43 100644 --- a/mysql-test/suite/parts/t/partition_exchange_innodb.test +++ b/mysql-test/suite/parts/t/partition_exchange_innodb.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_innodb.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/parts/t/partition_exchange_memory.test b/mysql-test/suite/parts/t/partition_exchange_memory.test index 7384a49f829..431a662f056 100644 --- a/mysql-test/suite/parts/t/partition_exchange_memory.test +++ b/mysql-test/suite/parts/t/partition_exchange_memory.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/parts/t/partition_exchange_myisam.test b/mysql-test/suite/parts/t/partition_exchange_myisam.test index 68e55090a9c..ab3fb388efd 100644 --- a/mysql-test/suite/parts/t/partition_exchange_myisam.test +++ b/mysql-test/suite/parts/t/partition_exchange_myisam.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result b/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result index aa5ff772552..cd3b335b540 100644 --- a/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result +++ b/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result @@ -4,6 +4,7 @@ connection master; CREATE TABLE t (a INT) ENGINE = innodb; connection slave; include/stop_slave.inc +SET STATEMENT sql_log_bin= 0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; SET @@global.slave_parallel_threads= 2; @@ -19,6 +20,7 @@ xa prepare 'x'; connection slave; SET @@global.debug_dbug="+d,hold_worker_on_schedule"; start slave; +SET debug_sync = 'now WAIT_FOR reached_pause'; connection slave1; backup stage start; backup stage block_commit; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index c47beacfb36..f46c17db3fc 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -12,6 +12,8 @@ INSERT INTO t1 VALUES (1, 0); connection server_2; SET sql_log_bin=0; call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +call mtr.add_suppression('Slave I/O: .*Lost connection to server during query'); +call mtr.add_suppression("Slave I/O thread couldn't register on master"); SET sql_log_bin=1; include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test b/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test index 03fc66d89e7..e3df0ac69a1 100644 --- a/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test +++ b/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test @@ -11,6 +11,7 @@ CREATE TABLE t (a INT) ENGINE = innodb; --sync_slave_with_master --source include/stop_slave.inc +SET STATEMENT sql_log_bin= 0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; SET @@global.slave_parallel_threads= 2; @@ -28,20 +29,21 @@ xa prepare 'x'; --connection slave SET @@global.debug_dbug="+d,hold_worker_on_schedule"; start slave; +SET debug_sync = 'now WAIT_FOR reached_pause'; --let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit" --source include/wait_condition.inc --connection slave1 backup stage start; ---send backup stage block_commit +backup stage block_commit; --connection slave --let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for backup lock" SET debug_sync = 'now SIGNAL continue_worker'; +--source include/wait_condition.inc SET debug_sync = RESET; --connection slave1 -reap; backup stage end; --connection master diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt index 5b3fb44c910..13232d12992 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt @@ -1 +1 @@ ---master-retry-count=100 --slave-net-timeout=10 +--master-retry-count=500 --slave-net-timeout=10 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index e1a57f4b725..05283139533 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -24,6 +24,8 @@ INSERT INTO t1 VALUES (1, 0); --sync_with_master SET sql_log_bin=0; call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +call mtr.add_suppression('Slave I/O: .*Lost connection to server during query'); +call mtr.add_suppression("Slave I/O thread couldn't register on master"); SET sql_log_bin=1; --source include/stop_slave.inc --replace_result $MASTER_MYPORT MASTER_PORT diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index b6133625c02..fb67ad770d5 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -9,6 +9,7 @@ # * Various states of master and heartbeat # * Circular replication ############################################################# +--source include/long_test.inc --source include/master-slave.inc # # The test runs long and does not have any specifics to diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test index bc5c60749c0..348e6721b6b 100644 --- a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test @@ -3,6 +3,7 @@ # tables. Specifically when drop temporary tables and create temporary tables # are used. ################################################################################### +--source include/long_test.inc --source include/have_binlog_format_row.inc --source include/have_innodb.inc --source include/master-slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 0c2ebc67288..691688d3ee3 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -4,6 +4,7 @@ # Please check all dependent tests after modifying it # +source include/long_test.inc; source include/not_embedded.inc; source include/have_innodb.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test index 2d91d2e4118..015dcceb043 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_binlog_format_statement.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test index 47af6c34fcf..0ce94b82a67 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_binlog_format_row.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index 35b8487a8d8..3e97085b2a2 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -4,6 +4,7 @@ # Please check all dependent tests after modifying it # +--source include/long_test.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc --source include/test_db_charset_latin1.inc diff --git a/mysql-test/suite/sql_sequence/alter.opt b/mysql-test/suite/sql_sequence/alter.opt new file mode 100644 index 00000000000..c5eebd75ce5 --- /dev/null +++ b/mysql-test/suite/sql_sequence/alter.opt @@ -0,0 +1 @@ +--innodb-sys-tables diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 11a9c6b02e1..beda77e3a9d 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -166,6 +166,32 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si select next value for t1; next value for t1 11 +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0; +begin; +delete from t1; +rollback; +$check_innodb_flags; +is_sequence +0 +alter table t1 sequence=1; +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0, algorithm=copy; +$check_innodb_flags; +is_sequence +0 +alter table t1 sequence=1, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY +alter table t1 sequence=1, algorithm=copy; +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY drop sequence t1; # # ALTER TABLE diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index bf3d5a248cc..8d6c565e720 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -80,6 +80,25 @@ alter sequence t1 start=100; show create sequence t1; select * from t1; select next value for t1; +let $check_innodb_flags = +select flag & 12288 is_sequence from information_schema.innodb_sys_tables +where name='test/t1'; +evalp $check_innodb_flags; +alter table t1 sequence=0; +begin; +delete from t1; +rollback; +evalp $check_innodb_flags; +alter table t1 sequence=1; +evalp $check_innodb_flags; +alter table t1 sequence=0, algorithm=copy; +evalp $check_innodb_flags; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 sequence=1, algorithm=inplace; +alter table t1 sequence=1, algorithm=copy; +evalp $check_innodb_flags; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 sequence=0, algorithm=inplace; drop sequence t1; --echo # diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result index e5dd6820420..6e4dad90127 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result @@ -1,16 +1,17 @@ SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size; -'#---------------------BS_STVARS_022_01----------------------#' -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) -1 -1 Expected '#---------------------BS_STVARS_022_02----------------------#' -SET @@GLOBAL.innodb_buffer_pool_size=10485760; -Expected succeeded -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) +SELECT @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size_max +8388608 +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max +1 +SET GLOBAL innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max + 1048576; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '9437184' +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max 1 -1 Expected '#---------------------BS_STVARS_022_03----------------------#' SELECT @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -18,10 +19,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE 1 1 Expected -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) -1 -1 Expected SELECT COUNT(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_buffer_pool_size'; @@ -50,4 +47,7 @@ COUNT(@@GLOBAL.innodb_buffer_pool_size) 1 Expected SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size; ERROR 42S22: Unknown column 'innodb_buffer_pool_size' in 'SELECT' -# restart +SET GLOBAL innodb_buffer_pool_size = @start_buffer_pool_size; +SELECT @@innodb_buffer_pool_size = @start_buffer_pool_size; +@@innodb_buffer_pool_size = @start_buffer_pool_size +1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 626ce6c70da..82a595ee003 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -1,6 +1,6 @@ --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result -@@ -48,7 +48,7 @@ VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTS +@@ -47,7 +47,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -9,7 +9,7 @@ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -84,7 +84,7 @@ VARIABLE_NAME INNODB_AUTOINC_LOCK_MODE +@@ -83,7 +83,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -18,20 +18,20 @@ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -96,10 +96,10 @@ VARIABLE_NAME INNODB_BUFFER_POOL_CHUNK_SIZE +@@ -95,10 +95,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means autosize this variable based on buffer pool size + VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -132,7 +132,7 @@ VARIABLE_NAME INNODB_BUFFER_POOL_DUMP_PCT +@@ -131,7 +131,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 25 VARIABLE_SCOPE GLOBAL @@ -40,7 +40,50 @@ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -216,7 +216,7 @@ VARIABLE_NAME INNODB_BUF_DUMP_STATUS_FREQUENCY +@@ -203,10 +203,10 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 134217728 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables + NUMERIC_MIN_VALUE 2097152 +-NUMERIC_MAX_VALUE 18446744073701163008 ++NUMERIC_MAX_VALUE 4292870144 + NUMERIC_BLOCK_SIZE 1048576 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -215,11 +215,11 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure + NUMERIC_MIN_VALUE 0 +-NUMERIC_MAX_VALUE 18446744073701163008 +-NUMERIC_BLOCK_SIZE 8388608 ++NUMERIC_MAX_VALUE 4292870144 ++NUMERIC_BLOCK_SIZE 2097152 + ENUM_VALUE_LIST NULL + READ_ONLY NO + COMMAND_LINE_ARGUMENT REQUIRED +@@ -227,11 +227,11 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Maximum innodb_buffer_pool_size + NUMERIC_MIN_VALUE 0 +-NUMERIC_MAX_VALUE 18446744073701163008 +-NUMERIC_BLOCK_SIZE 8388608 ++NUMERIC_MAX_VALUE 4292870144 ++NUMERIC_BLOCK_SIZE 2097152 + ENUM_VALUE_LIST NULL + READ_ONLY YES + COMMAND_LINE_ARGUMENT REQUIRED +@@ -239,7 +239,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -49,7 +92,7 @@ VARIABLE_COMMENT A number that tells how often buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -288,7 +288,7 @@ VARIABLE_NAME INNODB_COMPRESSION_FAILURE_THRESHOLD_PCT +@@ -311,7 +311,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -58,7 +101,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -312,7 +312,7 @@ VARIABLE_NAME INNODB_COMPRESSION_PAD_PCT_MAX +@@ -335,7 +335,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -67,7 +110,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -540,7 +540,7 @@ VARIABLE_NAME INNODB_FATAL_SEMAPHORE_WAIT_THRESHOLD +@@ -575,7 +575,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -76,7 +119,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -588,7 +588,7 @@ VARIABLE_NAME INNODB_FLUSHING_AVG_LOOPS +@@ -623,7 +623,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -85,7 +128,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -612,7 +612,7 @@ VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT +@@ -647,7 +647,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -94,7 +137,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3 NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -636,7 +636,7 @@ VARIABLE_NAME INNODB_FLUSH_NEIGHBORS +@@ -671,7 +671,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -103,7 +146,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -672,7 +672,7 @@ VARIABLE_NAME INNODB_FORCE_RECOVERY +@@ -707,7 +707,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -112,7 +155,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -696,10 +696,10 @@ VARIABLE_NAME INNODB_FT_CACHE_SIZE +@@ -731,10 +731,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -125,7 +168,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -732,7 +732,7 @@ VARIABLE_NAME INNODB_FT_MAX_TOKEN_SIZE +@@ -767,7 +767,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -134,7 +177,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -744,7 +744,7 @@ VARIABLE_NAME INNODB_FT_MIN_TOKEN_SIZE +@@ -779,7 +779,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -143,7 +186,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -756,7 +756,7 @@ VARIABLE_NAME INNODB_FT_NUM_WORD_OPTIMIZE +@@ -791,7 +791,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -152,7 +195,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -768,10 +768,10 @@ VARIABLE_NAME INNODB_FT_RESULT_CACHE_LIMIT +@@ -803,10 +803,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -165,7 +208,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -792,7 +792,7 @@ VARIABLE_NAME INNODB_FT_SORT_PLL_DEGREE +@@ -827,7 +827,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -174,7 +217,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -804,10 +804,10 @@ VARIABLE_NAME INNODB_FT_TOTAL_CACHE_SIZE +@@ -839,10 +839,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -187,7 +230,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -852,22 +852,22 @@ VARIABLE_NAME INNODB_IO_CAPACITY +@@ -887,7 +887,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -195,27 +238,17 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 --NUMERIC_MAX_VALUE 18446744073709551615 -+NUMERIC_MAX_VALUE 4294967295 - NUMERIC_BLOCK_SIZE 0 - ENUM_VALUE_LIST NULL - READ_ONLY NO - COMMAND_LINE_ARGUMENT REQUIRED - VARIABLE_NAME INNODB_IO_CAPACITY_MAX + NUMERIC_MAX_VALUE 4294967295 +@@ -899,7 +899,7 @@ SESSION_VALUE NULL --DEFAULT_VALUE 18446744073709551615 -+DEFAULT_VALUE 4294967295 + DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated NUMERIC_MIN_VALUE 100 --NUMERIC_MAX_VALUE 18446744073709551615 -+NUMERIC_MAX_VALUE 4294967295 - NUMERIC_BLOCK_SIZE 0 - ENUM_VALUE_LIST NULL - READ_ONLY NO -@@ -984,10 +984,10 @@ VARIABLE_NAME INNODB_LRU_FLUSH_SIZE + NUMERIC_MAX_VALUE 4294967295 +@@ -1031,10 +1031,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -228,7 +261,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -996,10 +996,10 @@ VARIABLE_NAME INNODB_LRU_SCAN_DEPTH +@@ -1043,10 +1043,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -241,7 +274,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1032,10 +1032,10 @@ VARIABLE_NAME INNODB_MAX_PURGE_LAG +@@ -1079,10 +1079,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -254,7 +287,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1044,7 +1044,7 @@ VARIABLE_NAME INNODB_MAX_PURGE_LAG_DELAY +@@ -1091,7 +1091,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -263,7 +296,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1176,10 +1176,10 @@ VARIABLE_NAME INNODB_OPEN_FILES +@@ -1223,10 +1223,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -276,7 +309,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1200,7 +1200,7 @@ VARIABLE_NAME INNODB_PAGE_SIZE +@@ -1247,7 +1247,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -285,7 +318,7 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1236,7 +1236,7 @@ VARIABLE_NAME INNODB_PURGE_BATCH_SIZE +@@ -1283,7 +1283,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 127 VARIABLE_SCOPE GLOBAL @@ -294,7 +327,7 @@ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1248,7 +1248,7 @@ VARIABLE_NAME INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY +@@ -1295,7 +1295,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -303,7 +336,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1284,7 +1284,7 @@ VARIABLE_NAME INNODB_READ_AHEAD_THRESHOLD +@@ -1331,7 +1331,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -312,7 +345,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1368,7 +1368,7 @@ VARIABLE_NAME INNODB_SORT_BUFFER_SIZE +@@ -1415,7 +1415,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -321,7 +354,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1536,10 +1536,10 @@ VARIABLE_NAME INNODB_SYNC_SPIN_LOOPS +@@ -1583,10 +1583,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 8c1f514c7fa..c6f21371c8b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -96,7 +96,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means autosize this variable based on buffer pool size +VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 1048576 @@ -206,11 +206,35 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables NUMERIC_MIN_VALUE 2097152 -NUMERIC_MAX_VALUE 9223372036854775807 +NUMERIC_MAX_VALUE 18446744073701163008 NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_BUFFER_POOL_SIZE_AUTO_MIN +SESSION_VALUE NULL +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 18446744073701163008 +NUMERIC_BLOCK_SIZE 8388608 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_BUFFER_POOL_SIZE_MAX +SESSION_VALUE NULL +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Maximum innodb_buffer_pool_size +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 18446744073701163008 +NUMERIC_BLOCK_SIZE 8388608 +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUF_DUMP_STATUS_FREQUENCY SESSION_VALUE NULL DEFAULT_VALUE 0 @@ -866,19 +890,19 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_IO_CAPACITY_MAX SESSION_VALUE NULL -DEFAULT_VALUE 18446744073709551615 +DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated NUMERIC_MIN_VALUE 100 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO @@ -924,7 +948,7 @@ SESSION_VALUE NULL DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Force checkpoint now +VARIABLE_COMMENT Write back dirty pages from the buffer pool and update the log checkpoint NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt deleted file mode 100644 index aa536bf0070..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt new file mode 100644 index 00000000000..373ccf8732e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=8m diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test index dada2a9a455..1807ffaada1 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test @@ -24,35 +24,19 @@ --source include/have_innodb.inc -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size; ---echo '#---------------------BS_STVARS_022_01----------------------#' -#################################################################### -# Displaying default value # -#################################################################### -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - - --echo '#---------------------BS_STVARS_022_02----------------------#' #################################################################### # Check if Value can set # #################################################################### -SET @@GLOBAL.innodb_buffer_pool_size=10485760; ---echo Expected succeeded ---source include/wait_condition.inc - -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - - - +--enable_warnings +SELECT @@GLOBAL.innodb_buffer_pool_size_max; +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +SET GLOBAL innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max + 1048576; +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +--disable_warnings --echo '#---------------------BS_STVARS_022_03----------------------#' ################################################################# @@ -66,9 +50,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; --enable_warnings --echo 1 Expected -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - --disable_warnings SELECT COUNT(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -76,8 +57,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; --enable_warnings --echo 1 Expected - - --echo '#---------------------BS_STVARS_022_04----------------------#' ################################################################################ # Check if accessing variable with and without GLOBAL point to same variable # @@ -111,4 +90,6 @@ SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size; # Restore the original buffer pool size. ---source include/restart_mysqld.inc +SET GLOBAL innodb_buffer_pool_size = @start_buffer_pool_size; + +SELECT @@innodb_buffer_pool_size = @start_buffer_pool_size; diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt index c3eec59bc17..19ecb6c65f9 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt @@ -1,2 +1,4 @@ ---loose-innodb-flush-log-at-timeout=3 +--innodb +--innodb-purge-rseg-truncate-frequency=64 +--innodb-flush-log-at-timeout=3 --table_open_cache=200 diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 2680e442da4..4c5ad1f676c 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -3,6 +3,10 @@ --source include/not_valgrind.inc --source include/word_size.inc +--disable_query_log +call mtr.add_suppression("'innodb-purge-rseg-truncate-frequency' was removed"); +--enable_query_log + --vertical_results --replace_regex /^\/\S+/PATH/ /\.\//PATH/ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables diff --git a/mysql-test/suite/versioning/r/derived.result b/mysql-test/suite/versioning/r/derived.result index 700c92a8d5c..50cfb4020d0 100644 --- a/mysql-test/suite/versioning/r/derived.result +++ b/mysql-test/suite/versioning/r/derived.result @@ -211,12 +211,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Query A: -Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) join `test`.`t2` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > (current_timestamp(6)) and `test`.`t2`.`row_start` <= (current_timestamp(6)) and `test`.`t1`.`row_end` > (current_timestamp(6)) and `test`.`t1`.`row_start` <= (current_timestamp(6)) +Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) join `test`.`t2` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t2`.`row_start` <= TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t1`.`row_end` > TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t1`.`row_start` <= TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Query B: -Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) join `test`.`t2` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > (current_timestamp(6)) and `test`.`t2`.`row_start` <= (current_timestamp(6)) and `test`.`t1`.`row_end` > (current_timestamp(6)) and `test`.`t1`.`row_start` <= (current_timestamp(6)) +Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) join `test`.`t2` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp(6) where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t2`.`row_start` <= TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t1`.`row_end` > TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' and `test`.`t1`.`row_start` <= TIMESTAMP/*WITH LOCAL TIME ZONE*/'YYYY-MM-DD hh:ss:mm:.uuuuuu' Fine result: queries A and B are equal. ## LEFT JOIN: t1, t2 versioned select * from ( diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 1bdca613b87..881b6589408 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3429,6 +3429,20 @@ drop table t; create table t (a int) with system versioning partition by system_time partitions 3; ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTORY partitions. # +# MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON +# in row_update_for_mysql +# +create table t (a int key) engine=innodb +with system versioning +partition by key() partitions 3; +start transaction; +insert into t values (1),(2),(3),(4),(5),(6),(7),(8); +set timestamp=+1; +delete from t; +insert into t values (1),(2); +DELETE from t; +drop table t; +# # End of 10.5 tests # # @@ -3454,4 +3468,25 @@ drop table t; # # End of 10.9 tests # +# +# MDEV-34775 Wrong reopen of already open routine due to auto-create in SP +# +create table t (a int) with system versioning +partition by system_time +interval 1 minute auto; +create function f() +returns int +begin +replace into t select * from t; +return 0; +end $ +set timestamp= @@timestamp + 61; +select f(); +f() +0 +drop table t; +drop function f; +# +# End of 10.11 tests +# set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/derived.test b/mysql-test/suite/versioning/t/derived.test index f599ede97c1..dec5b6fa9f6 100644 --- a/mysql-test/suite/versioning/t/derived.test +++ b/mysql-test/suite/versioning/t/derived.test @@ -1,6 +1,6 @@ --source include/default_optimizer_switch.inc ---let $replace_regex_tsltz6= /TIMESTAMP..WITH LOCAL TIME ZONE..'....-..-.. ..:..:..[.]......'/TIMESTAMP\/*WITH LOCAL TIME ZONE*\/'YYYY-MM-DD hh:ss:mm:.uuuuuu'/ +--let $replace_regex_tsltz6= /(TIMESTAMP..WITH LOCAL TIME ZONE..'....-..-.. ..:..:..[.]......'|\(current_timestamp\(6\)\))/TIMESTAMP\/*WITH LOCAL TIME ZONE*\/'YYYY-MM-DD hh:ss:mm:.uuuuuu'/ create table emp ( diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index c5213734d0c..f2812a2f6b0 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2665,6 +2665,22 @@ drop table t; --error WARN_VERS_PARAMETERS create table t (a int) with system versioning partition by system_time partitions 3; +--echo # +--echo # MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON +--echo # in row_update_for_mysql +--echo # +create table t (a int key) engine=innodb +with system versioning +partition by key() partitions 3; + +start transaction; +insert into t values (1),(2),(3),(4),(5),(6),(7),(8); +set timestamp=+1; +delete from t; +insert into t values (1),(2); +DELETE from t; +drop table t; + --echo # --echo # End of 10.5 tests --echo # @@ -2707,5 +2723,32 @@ drop table t; --echo # End of 10.9 tests --echo # +--echo # +--echo # MDEV-34775 Wrong reopen of already open routine due to auto-create in SP +--echo # + +create table t (a int) with system versioning +partition by system_time +interval 1 minute auto; + +--delimiter $ +create function f() +returns int +begin + replace into t select * from t; + return 0; +end $ +--delimiter ; + +set timestamp= @@timestamp + 61; +select f(); + +drop table t; +drop function f; + +--echo # +--echo # End of 10.11 tests +--echo # + set global innodb_stats_persistent= @save_persistent; --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/wsrep/README b/mysql-test/suite/wsrep/README index 988096071a4..143f3c96887 100644 --- a/mysql-test/suite/wsrep/README +++ b/mysql-test/suite/wsrep/README @@ -4,4 +4,3 @@ * As these tests are specific to wsrep-related functionalities, they must skip on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF) See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc - diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc index 40cd157ca80..11cd02f6472 100644 --- a/mysql-test/suite/wsrep/include/check_galera_version.inc +++ b/mysql-test/suite/wsrep/include/check_galera_version.inc @@ -44,4 +44,3 @@ if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR } --echo # Correct Galera library found - diff --git a/mysql-test/suite/wsrep/r/plugin.result b/mysql-test/suite/wsrep/r/plugin.result index 4f52173cb25..2928acd07d2 100644 --- a/mysql-test/suite/wsrep/r/plugin.result +++ b/mysql-test/suite/wsrep/r/plugin.result @@ -1,3 +1,3 @@ -SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; +SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins WHERE plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; plugin_name plugin_version plugin_maturity wsrep 1.0 Stable diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result b/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result new file mode 100644 index 00000000000..2429434ae53 --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result @@ -0,0 +1,18 @@ +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +# Case 1: Server goes through graceful shutdown and is restarted +connection default; +INSERT INTO t1 VALUES (1); +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT * FROM t1; +f1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result b/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result new file mode 100644 index 00000000000..682cecca8bb --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result @@ -0,0 +1,65 @@ +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +# Case 1: Server goes through graceful shutdown and is restarted +connection default; +INSERT INTO t1 VALUES (1); +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-2 +SELECT * FROM t1; +f1 +1 +# Case 2: Server is killed after the transaction gets prepared +# but before it is written into binlog. As there is not GTID assigned, +# the transaction must be rolled back during recovery. +connect con, localhost, root; +SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (2); +connection default; +SET DEBUG_SYNC = "now WAIT_FOR reached"; +# Kill the server +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-2 +Expect 1 +SELECT * FROM t1; +f1 +1 +disconnect con; +# Case 3: Server is killed after the transaction gets written into binlog +# but before it is committed in storage engine. In this case the +# transaction must be committed during recovery as it had a valid +# GTID assigned. +connect con, localhost, root; +SET DEBUG_SYNC = "commit_before_get_LOCK_commit_ordered SIGNAL reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (3); +connection default; +SET DEBUG_SYNC = "now WAIT_FOR reached"; +# Kill the server +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-3 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-3 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-3 +Expect 1 3 +SELECT * FROM t1; +f1 +1 +3 +disconnect con; +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff index 5fc091c7752..c6b231bc558 100644 --- a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff +++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff @@ -1,5 +1,5 @@ --- r/wsrep-recover-v25.result -+++ r/wsrep-recover-v25.reject ++++ r/wsrep-recover-v25,binlogoin.reject @@ -12,4 +12,16 @@ SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; expect 6 diff --git a/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result b/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result new file mode 100644 index 00000000000..6eb68ca13a5 --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result @@ -0,0 +1,8 @@ +# +# MDEV-27126: my_getopt compares option names case sensitively +# +# Check if the variable is set correctly from options +SELECT @@GLOBAL.wsrep_slave_uk_checks; +@@GLOBAL.wsrep_slave_uk_checks +1 +# End of test. diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm index 2ee33d83275..040a48c7964 100644 --- a/mysql-test/suite/wsrep/suite.pm +++ b/mysql-test/suite/wsrep/suite.pm @@ -9,9 +9,9 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, ); bless { }; diff --git a/mysql-test/suite/wsrep/t/binlog_format.cnf b/mysql-test/suite/wsrep/t/binlog_format.cnf index 7ec24c14d80..500a197e422 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.cnf +++ b/mysql-test/suite/wsrep/t/binlog_format.cnf @@ -5,4 +5,3 @@ wsrep-on=ON wsrep-provider=@ENV.WSREP_PROVIDER wsrep-cluster-address=gcomm:// innodb_autoinc_lock_mode=2 - diff --git a/mysql-test/suite/wsrep/t/foreign_key.test b/mysql-test/suite/wsrep/t/foreign_key.test index 71f6076a1d7..c14910c7f86 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.test +++ b/mysql-test/suite/wsrep/t/foreign_key.test @@ -17,4 +17,3 @@ SELECT * FROM test.c; # Cleanup DROP TABLE c; DROP TABLE p; - diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test index 0f0aa287086..157e7b5a7b6 100644 --- a/mysql-test/suite/wsrep/t/mdev_10186.test +++ b/mysql-test/suite/wsrep/t/mdev_10186.test @@ -9,4 +9,3 @@ SELECT @@wsrep_on; SET @@GLOBAL.wsrep_cluster_address='gcomm://'; - diff --git a/mysql-test/suite/wsrep/t/mdev_7798.cnf b/mysql-test/suite/wsrep/t/mdev_7798.cnf index 0bf01f81fc5..c2b7c4d415f 100644 --- a/mysql-test/suite/wsrep/t/mdev_7798.cnf +++ b/mysql-test/suite/wsrep/t/mdev_7798.cnf @@ -4,4 +4,3 @@ wsrep-on=ON wsrep-provider=@ENV.WSREP_PROVIDER wsrep-cluster-address=gcomm:// - diff --git a/mysql-test/suite/wsrep/t/plugin.test b/mysql-test/suite/wsrep/t/plugin.test index 73d605b0918..90750403405 100644 --- a/mysql-test/suite/wsrep/t/plugin.test +++ b/mysql-test/suite/wsrep/t/plugin.test @@ -5,4 +5,4 @@ # MDEV-7604: wsrep plugin lists its status as Unknown # -SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; \ No newline at end of file +SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins WHERE plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 3f3363d8f26..762d783a09c 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -23,4 +23,3 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # variables SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME; - diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test index 29d98f7373d..e55dbd4fa1f 100644 --- a/mysql-test/suite/wsrep/t/variables_debug.test +++ b/mysql-test/suite/wsrep/t/variables_debug.test @@ -25,4 +25,3 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # variables SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME; - diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf new file mode 100644 index 00000000000..a6b93d651bd --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf @@ -0,0 +1,10 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +binlog-format=ROW +wsrep-gtid-domain-id=100 +server-id=10 +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test new file mode 100644 index 00000000000..06685ebdd17 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test @@ -0,0 +1,28 @@ +# Test wsrep GTID recovery with binlog off. The test restarts the server +# and verifies that the GTID returned by SELECT WSREP_LAST_SEEN_GTID() +# gets initialized properly during server restart. +# +--source include/have_wsrep.inc +--source include/have_wsrep_provider.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +--echo # Case 1: Server goes through graceful shutdown and is restarted +--connection default +INSERT INTO t1 VALUES (1); + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); + +--source include/shutdown_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf new file mode 100644 index 00000000000..7080157b2b4 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf @@ -0,0 +1,14 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +binlog-format=ROW +log-bin +log-slave-updates +gtid-domain-id=10 +gtid-strict-mode=ON +wsrep-gtid-mode=ON +wsrep-gtid-domain-id=100 +server-id=10 diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test new file mode 100644 index 00000000000..2113bafb6de --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test @@ -0,0 +1,73 @@ +# Test wsrep recovery with gtid_mode=ON. The test crashes the server +# in different commit stages and verifies that the GTID returned by +# SELECT WSREP_LAST_SEEN_GTID() and @@GLOBAL.gtid_binlog_pos get +# initialized properly during server restart. +# +--source include/have_wsrep.inc +--source include/have_wsrep_provider.inc +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +--echo # Case 1: Server goes through graceful shutdown and is restarted +--connection default +INSERT INTO t1 VALUES (1); +--source include/shutdown_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +SELECT * FROM t1; + +--echo # Case 2: Server is killed after the transaction gets prepared +--echo # but before it is written into binlog. As there is not GTID assigned, +--echo # the transaction must be rolled back during recovery. +--connect con, localhost, root +SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (2) + +--connection default +SET DEBUG_SYNC = "now WAIT_FOR reached"; +--source include/kill_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +--echo Expect 1 +SELECT * FROM t1; +--disconnect con + +--echo # Case 3: Server is killed after the transaction gets written into binlog +--echo # but before it is committed in storage engine. In this case the +--echo # transaction must be committed during recovery as it had a valid +--echo # GTID assigned. + +--connect con, localhost, root +SET DEBUG_SYNC = "commit_before_get_LOCK_commit_ordered SIGNAL reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (3) + +--connection default +SET DEBUG_SYNC = "now WAIT_FOR reached"; +--source include/kill_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc +--source include/wait_wsrep_ready.inc +--echo Expect 100-10-3 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +--echo Expect 1 3 +SELECT * FROM t1; + +--disconnect con + +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.cnf b/mysql-test/suite/wsrep/t/wsrep-recover.cnf index 19986cd97bc..489c4385dbd 100644 --- a/mysql-test/suite/wsrep/t/wsrep-recover.cnf +++ b/mysql-test/suite/wsrep/t/wsrep-recover.cnf @@ -6,4 +6,4 @@ binlog-format=ROW innodb-flush-log-at-trx-commit=1 wsrep-cluster-address=gcomm:// wsrep-provider=@ENV.WSREP_PROVIDER -innodb-autoinc-lock-mode=2 \ No newline at end of file +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test index 37e9c6c718e..718fc975071 100644 --- a/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test +++ b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test @@ -2,7 +2,6 @@ --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc - --echo # --echo # wsrep_forced_binlog_format --echo # diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf new file mode 100644 index 00000000000..c2b7c4d415f --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf @@ -0,0 +1,6 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt new file mode 100644 index 00000000000..d13f9f874c9 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt @@ -0,0 +1 @@ +--wsrep-slave-uk-checks=1 diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test new file mode 100644 index 00000000000..acfe8fd6c45 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test @@ -0,0 +1,11 @@ +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_binlog_format_row.inc +--echo # +--echo # MDEV-27126: my_getopt compares option names case sensitively +--echo # + +--echo # Check if the variable is set correctly from options +SELECT @@GLOBAL.wsrep_slave_uk_checks; + +--echo # End of test. diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test index 4f34aadc365..98a70d0dfb1 100644 --- a/mysql-test/suite/wsrep/t/wsrep_rpl.test +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test @@ -41,4 +41,3 @@ eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_slave; --source include/rpl_end.inc --echo # End of test. - diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test index b41718792a2..d63c3e5fafb 100644 --- a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test +++ b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test @@ -44,7 +44,6 @@ SET GLOBAL wsrep_sst_method='method;'; SELECT @@global.wsrep_sst_method; SHOW WARNINGS; - --disable_query_log SET @@global.wsrep_sst_method = @wsrep_sst_method_saved; --enable_query_log diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf index 23b1392e4b1..83400293eb8 100644 --- a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf +++ b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf @@ -9,4 +9,3 @@ wsrep-on=OFF #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port - diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 1a08bafda99..630740f783d 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -47,7 +47,8 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c my_rdtsc.c psi_noop.c my_atomic_writes.c my_cpu.c my_likely.c my_largepage.c file_logger.c my_dlerror.c crc32/crc32c.cc - my_timezone.cc my_thread_name.cc) + my_timezone.cc my_thread_name.cc + my_virtual_mem.c) IF (WIN32) SET (MYSYS_SOURCES ${MYSYS_SOURCES} diff --git a/mysys/my_default.c b/mysys/my_default.c index e63a3a8abd3..0b50235aa69 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -317,6 +317,9 @@ int get_defaults_options(char **argv) argv++; } + if (! my_defaults_group_suffix) + my_defaults_group_suffix= getenv("MARIADB_GROUP_SUFFIX"); + if (! my_defaults_group_suffix) my_defaults_group_suffix= getenv("MYSQL_GROUP_SUFFIX"); diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 56f947e6791..d8e7348b968 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1039,7 +1040,7 @@ my_bool getopt_compare_strings(register const char *s, register const char *t, for (;s != end ; s++, t++) { - if ((*s != '-' ? *s : '_') != (*t != '-' ? *t : '_')) + if ((*s != '-' ? tolower(*s) : '_') != (*t != '-' ? tolower(*t) : '_')) DBUG_RETURN(1); } DBUG_RETURN(0); diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 71527a9bc27..240c8e84fc7 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -35,17 +35,11 @@ extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); #endif /* __sun__ ... */ #endif /* HAVE_SOLARIS_LARGE_PAGES */ -#if defined(_WIN32) -static size_t my_large_page_size; -#define HAVE_LARGE_PAGES -#elif defined(HAVE_MMAP) -#define HAVE_LARGE_PAGES -#endif -#ifdef HAVE_LARGE_PAGES -static my_bool my_use_large_pages= 0; -#else -#define my_use_large_pages 0 +my_bool my_use_large_pages; + +#ifdef _WIN32 +static size_t my_large_page_size; #endif #if defined(HAVE_GETPAGESIZES) || defined(__linux__) @@ -172,7 +166,7 @@ static void my_get_large_page_sizes(size_t sizes[]) @retval a large page size that is valid on this system or 0 if no large page size possible. */ -#if defined(HAVE_MMAP) && !defined(_WIN32) +#ifndef _WIN32 static size_t my_next_large_page_size(size_t sz, int *start) { DBUG_ENTER("my_next_large_page_size"); @@ -188,11 +182,12 @@ static size_t my_next_large_page_size(size_t sz, int *start) } DBUG_RETURN(0); } -#endif /* defined(MMAP) || !defined(_WIN32) */ +#endif -int my_init_large_pages(my_bool super_large_pages) +int my_init_large_pages(void) { + my_use_large_pages= 1; #ifdef _WIN32 if (!my_obtain_privilege(SE_LOCK_MEMORY_NAME)) { @@ -200,19 +195,15 @@ int my_init_large_pages(my_bool super_large_pages) "Lock Pages in memory access rights required for use with" " large-pages, see https://mariadb.com/kb/en/library/" "mariadb-memory-allocation/#huge-pages", MYF(MY_WME)); + my_use_large_pages= 0; } my_large_page_size= GetLargePageMinimum(); #endif - my_use_large_pages= 1; my_get_large_page_sizes(my_large_page_sizes); -#ifndef HAVE_LARGE_PAGES - my_printf_error(EE_OUTOFMEMORY, "No large page support on this platform", - MYF(MY_WME)); -#endif - #ifdef HAVE_SOLARIS_LARGE_PAGES + extern my_bool opt_super_large_pages; /* tell the kernel that we want to use 4/256MB page for heap storage and also for the stack. We use 4 MByte as default and if the @@ -222,9 +213,15 @@ int my_init_large_pages(my_bool super_large_pages) measured in a number of GBytes. We use as big pages as possible which isn't bigger than the above desired page sizes. + + Note: This refers to some implementations of the SPARC ISA, + where the supported page sizes are + 8KiB, 64KiB, 512KiB, 4MiB, 32MiB, 256MiB, 2GiB, and 16GiB. + On implementations of the AMD64 ISA, the available page sizes + should be 4KiB, 2MiB, and 1GiB. */ int nelem= 0; - size_t max_desired_page_size= (super_large_pages ? 256 : 4) * 1024 * 1024; + size_t max_desired_page_size= opt_super_large_pages ? 256 << 20 : 4 << 20; size_t max_page_size= my_next_large_page_size(max_desired_page_size, &nelem); if (max_page_size > 0) @@ -426,6 +423,118 @@ uchar *my_large_malloc(size_t *size, myf my_flags) DBUG_RETURN(ptr); } +#ifdef _WIN32 +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_virtual_alloc(size_t *size) +{ + char *ptr; + DBUG_ENTER("my_large_virtual_alloc"); + + if (my_use_large_pages) + { + size_t s= *size; + s= MY_ALIGN(s, (size_t) my_large_page_size); + ptr= VirtualAlloc(NULL, s, MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES, + PAGE_READWRITE); + if (ptr) + { + *size= s; + DBUG_RETURN(ptr); + } + } + + DBUG_RETURN(VirtualAlloc(NULL, *size, MEM_RESERVE, PAGE_READWRITE)); +} +#elif defined HAVE_MMAP +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_mmap(size_t *size, int prot) +{ + char *ptr; + DBUG_ENTER("my_large_virtual_alloc"); + + if (my_use_large_pages) + { + size_t large_page_size; + int page_i= 0; + prot= PROT_READ | PROT_WRITE; + + while ((large_page_size= my_next_large_page_size(*size, &page_i)) != 0) + { + int mapflag= MAP_PRIVATE | +# ifdef MAP_POPULATE + MAP_POPULATE | +# endif +# if defined MAP_HUGETLB /* linux 2.6.32 */ + MAP_HUGETLB | +# if defined MAP_HUGE_SHIFT /* Linux-3.8+ */ + my_bit_log2_size_t(large_page_size) << MAP_HUGE_SHIFT | +# else +# warning "No explicit large page (HUGETLB pages) support in Linux < 3.8" +# endif +# elif defined MAP_ALIGNED + MAP_ALIGNED(my_bit_log2_size_t(large_page_size)) | +# if defined MAP_ALIGNED_SUPER + MAP_ALIGNED_SUPER | +# endif +# endif + OS_MAP_ANON; + + size_t aligned_size= MY_ALIGN(*size, (size_t) large_page_size); + ptr= mmap(NULL, aligned_size, prot, mapflag, -1, 0); + if (ptr == (void*) -1) + { + ptr= NULL; + /* try next smaller memory size */ + if (errno == ENOMEM) + continue; + + /* other errors are more serious */ + break; + } + else /* success */ + { + /* + we do need to record the adjustment so that munmap gets called with + the right size. This is only the case for HUGETLB pages. + */ + *size= aligned_size; + DBUG_RETURN(ptr); + } + } + } + + ptr= mmap(NULL, *size, prot, +# ifdef MAP_NORESERVE + MAP_NORESERVE | +# endif + MAP_PRIVATE | OS_MAP_ANON, -1, 0); + if (ptr == MAP_FAILED) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + ptr= NULL; + } + + DBUG_RETURN(ptr); +} + +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_virtual_alloc(size_t *size) +{ + return my_large_mmap(size, PROT_READ | PROT_WRITE); +} +#endif /** General large pages deallocator. @@ -482,7 +591,7 @@ void my_large_free(void *ptr, size_t size) #endif /* memory_sanitizer */ #else my_free_lock(ptr); -#endif /* HAVE_MMMAP */ +#endif /* HAVE_MMAP */ DBUG_VOID_RETURN; } diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 56cc91ae083..28d7fc18f1b 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -158,6 +158,15 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count, #else writtenbytes= pwrite(Filedes, Buffer, Count, offset); #endif + + DBUG_EXECUTE_IF ("simulate_file_pwrite_error", + if (writtenbytes == Count && + my_seek(Filedes, 0, SEEK_END, MYF(0)) > 1024*1024L) + { + errno= ENOSPC; + writtenbytes= (size_t) -1; + }); + if (writtenbytes == Count) break; my_errno= errno; diff --git a/mysys/my_virtual_mem.c b/mysys/my_virtual_mem.c new file mode 100644 index 00000000000..47e3a29788a --- /dev/null +++ b/mysys/my_virtual_mem.c @@ -0,0 +1,207 @@ +/* Copyright (c) 2025, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include +#include +#include +#include +#ifdef _AIX +# include +#endif + +/* + Functionality for handling virtual memory + + - reserve range, + - commit memory (within reserved range) + - decommit previously commited memory + - release range + + Not every OS has a "reserve" functionality, i.e it is not always + possible to reserve memory larger than swap or RAM for example. + + We try to respect use_large_pages setting, on Windows and Linux +*/ +#ifndef _WIN32 +char *my_large_mmap(size_t *size, int prot); +#endif + +char *my_virtual_mem_reserve(size_t *size) +{ +#ifdef _WIN32 + DWORD flags= my_use_large_pages + ? MEM_LARGE_PAGES | MEM_RESERVE | MEM_COMMIT + : MEM_RESERVE; + char *ptr= VirtualAlloc(NULL, *size, flags, PAGE_READWRITE); + if (!ptr && (flags & MEM_LARGE_PAGES)) + { + /* Try without large pages */ + ptr= VirtualAlloc(NULL, *size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + if (!ptr) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), *size); + } + return ptr; +#else + return my_large_mmap(size, PROT_NONE); +#endif +} + +#if defined _WIN32 && !defined DBUG_OFF +static my_bool is_memory_committed(char *ptr, size_t size) +{ + MEMORY_BASIC_INFORMATION mbi; + if (VirtualQuery(ptr, &mbi, sizeof mbi) == 0) + DBUG_ASSERT(0); + return !!(mbi.State & MEM_COMMIT); +} +#endif + +char *my_virtual_mem_commit(char *ptr, size_t size) +{ + DBUG_ASSERT(ptr); +#ifdef _WIN32 + if (my_use_large_pages) + { + DBUG_ASSERT(is_memory_committed(ptr, size)); + } + else + { + void *p= VirtualAlloc(ptr, size, MEM_COMMIT, PAGE_READWRITE); + DBUG_ASSERT(p == ptr); + if (!p) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } + } +#else + if (my_use_large_pages) + /* my_large_mmap() already created a read/write mapping. */; + else + { +# ifdef _AIX + /* + MAP_FIXED does not not work on IBM AIX in the way does works elsewhere. + Apparently, it is not possible to mmap(2) a range that is already in use, + at least not by default. + + mprotect(2) is the fallback, it can't communicate out-of-memory + conditions, but it looks like overcommitting is not possible on + AIX anyway. + */ + if (mprotect(ptr, size, PROT_READ | PROT_WRITE)) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } +# else + void *p= 0; + const int flags= +# ifdef MAP_POPULATE + MAP_POPULATE | +# endif + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED; + p= mmap(ptr, size, PROT_READ | PROT_WRITE, flags, -1, 0); + if (p == MAP_FAILED) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } + DBUG_ASSERT(p == ptr); +# if defined MADV_FREE_REUSABLE && defined MADV_FREE_REUSE /* Apple macOS */ + madvise(ptr, size, MADV_FREE_REUSE); /* cancel MADV_FREE_REUSABLE */ +# endif +# endif + } +#endif + update_malloc_size(size, 0); + return ptr; +} + +void my_virtual_mem_decommit(char *ptr, size_t size) +{ +#ifdef _WIN32 + DBUG_ASSERT(is_memory_committed(ptr, size)); +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT +# error "VirtualFree(MEM_DECOMMIT) will not allow subsequent reads!" +# endif + if (!my_use_large_pages) + { + if (!VirtualFree(ptr, size, MEM_DECOMMIT)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, + GetLastError()); + DBUG_ASSERT(0); + } + } +#else + const int prot= +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* + In InnoDB, buf_pool_t::page_guess() may deference pointers to + this, assuming that either the original contents or zeroed + contents is available. + */ + PROT_READ +# else + /* We will explicitly mark the memory unaccessible. */ + PROT_NONE +# endif + ; +# ifdef _AIX + disclaim(ptr, size, DISCLAIM_ZEROMEM); +# elif defined __linux__ || defined __osf__ + madvise(ptr, size, MADV_DONTNEED); /* OSF/1, Linux mimicing AIX disclaim() */ +# elif defined MADV_FREE_REUSABLE && defined MADV_FREE_REUSE + /* Mac OS X 10.9; undocumented in Apple macOS */ + madvise(ptr, size, MADV_FREE_REUSABLE); /* macOS mimicing AIX disclaim() */ +# elif defined MADV_PURGE /* Illumos */ + madvise(ptr, size, MADV_PURGE); /* Illumos mimicing AIX disclaim() */ +# elif defined MADV_FREE + /* FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, OpenSolaris, Apple macOS */ + madvise(ptr, size, MADV_FREE); /* allow lazy zeroing out */ +# elif defined MADV_DONTNEED +# warning "It is unclear if madvise(MADV_DONTNEED) works as intended" + madvise(ptr, size, MADV_DONTNEED); +# else +# warning "Do not know how to decommit memory" +# endif + if (mprotect(ptr, size, prot)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno); + DBUG_ASSERT(0); + } +#endif + update_malloc_size(-(longlong) size, 0); +} + +void my_virtual_mem_release(char *ptr, size_t size) +{ +#ifdef _WIN32 + DBUG_ASSERT(my_use_large_pages || !is_memory_committed(ptr, size)); + if (!VirtualFree(ptr, 0, MEM_RELEASE)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, + GetLastError()); + DBUG_ASSERT(0); + } +#else + if (munmap(ptr, size)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno); + DBUG_ASSERT(0); + } +#endif +} diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index b4557afc897..38124c12741 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -149,7 +149,6 @@ static const Native_func_registry func_array_vers[] = { { C_STRING_WITH_LEN("TRT_TRX_ID") }, BUILDER(Create_func_trt)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES") }, BUILDER(Create_func_trt_trx_sees)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES_EQ") }, BUILDER(Create_func_trt_trx_sees)}, - { {0, 0}, NULL} }; diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index 177cbf52c6a..b1a45bc74f0 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -211,7 +211,7 @@ if ($opt{socket} and -S $opt{socket}) else { $dsn .= "host=" . $opt{host}; - if ($opt{host} ne "localhost") + if ($opt{host} ne "localhost" and $opt{port}) { $dsn .= ";port=". $opt{port}; } diff --git a/sql/filesort.cc b/sql/filesort.cc index 3e61e56c294..50a71aae82f 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -730,6 +730,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, } #ifndef DBUG_OFF + +static char dbug_row_print_buf[4096]; + /* Print table's current row into a buffer and return a pointer to it. @@ -745,11 +748,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) { Field **pfield; - const size_t alloc_size= 512; - char *row_buff= (char *) alloc_root(&table->mem_root, alloc_size); - char *row_buff_tmp= (char *) alloc_root(&table->mem_root, alloc_size); - String tmp(row_buff_tmp, alloc_size, &my_charset_bin); - String output(row_buff, alloc_size, &my_charset_bin); + char row_buff_tmp[512]; + String tmp(row_buff_tmp, sizeof(row_buff_tmp), &my_charset_bin); + String output(dbug_row_print_buf, sizeof(dbug_row_print_buf), &my_charset_bin); auto move_back_lambda= [table, rec]() mutable { table->move_fields(table->field, table->record[0], rec); @@ -762,7 +763,7 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) move_back_guard.engage(); } - SCOPE_VALUE(table->read_set, (table->read_set && table->write_set) ? + SCOPE_VALUE(table->read_set, (table->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE) ? table->write_set : table->read_set); output.length(0); @@ -813,8 +814,10 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) } } output.append(')'); - - return output.c_ptr_safe(); + if (output.c_ptr() == dbug_row_print_buf) + return dbug_row_print_buf; + else + return "Couldn't fit into buffer"; } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 078ecee4b9e..13d9a28b8f0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4423,31 +4423,19 @@ THR_LOCK_DATA **ha_partition::store_lock(THD *thd, DBUG_ENTER("ha_partition::store_lock"); DBUG_ASSERT(thd == current_thd); - /* - This can be called from get_lock_data() in mysql_lock_abort_for_thread(), - even when thd != table->in_use. In that case don't use partition pruning, - but use all partitions instead to avoid using another threads structures. - */ - if (thd != table->in_use) - { - for (i= 0; i < m_tot_parts; i++) - to= m_file[i]->store_lock(thd, to, lock_type); - } - else - { - MY_BITMAP *used_partitions= lock_type == TL_UNLOCK || - lock_type == TL_IGNORE ? - &m_locked_partitions : - &m_part_info->lock_partitions; + MY_BITMAP *used_partitions= lock_type == TL_UNLOCK || + lock_type == TL_IGNORE ? + &m_locked_partitions : + &m_part_info->lock_partitions; - for (i= bitmap_get_first_set(used_partitions); - i < m_tot_parts; - i= bitmap_get_next_set(used_partitions, i)) - { - DBUG_PRINT("info", ("store lock %u iteration", i)); - to= m_file[i]->store_lock(thd, to, lock_type); - } + for (i= bitmap_get_first_set(used_partitions); + i < m_tot_parts; + i= bitmap_get_next_set(used_partitions, i)) + { + DBUG_PRINT("info", ("store lock %u iteration", i)); + to= m_file[i]->store_lock(thd, to, lock_type); } + DBUG_RETURN(to); } @@ -4774,7 +4762,6 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) } - m_last_part= new_part_id; start_part_bulk_insert(thd, new_part_id); DBUG_ASSERT(!m_file[new_part_id]->row_logging); if (new_part_id == old_part_id) @@ -4809,6 +4796,8 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) goto exit; } + m_last_part= new_part_id; + exit: /* if updating an auto_increment column, update diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 4d2179d3555..6492f0ee9d2 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -352,6 +352,12 @@ bool ha_sequence::check_if_incompatible_data(HA_CREATE_INFO *create_info, return(COMPATIBLE_DATA_YES); } +enum_alter_inplace_result +ha_sequence::check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ai) +{ + return file->check_if_supported_inplace_alter(altered_table, ai); +} int ha_sequence::external_lock(THD *thd, int lock_type) { diff --git a/sql/ha_sequence.h b/sql/ha_sequence.h index 0a3ff86a121..384cf1cd255 100644 --- a/sql/ha_sequence.h +++ b/sql/ha_sequence.h @@ -94,6 +94,9 @@ public: /* For ALTER ONLINE TABLE */ bool check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) override; + enum_alter_inplace_result + check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ai) override; void write_lock() { write_locked= 1;} void unlock() { write_locked= 0; } bool is_locked() { return write_locked; } diff --git a/sql/handler.cc b/sql/handler.cc index 9ca2fee591c..a5a34e69b5b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -501,7 +501,7 @@ int ha_init_errors(void) SETMSG(HA_ERR_INDEX_COL_TOO_LONG, ER_DEFAULT(ER_INDEX_COLUMN_TOO_LONG)); SETMSG(HA_ERR_INDEX_CORRUPT, ER_DEFAULT(ER_INDEX_CORRUPT)); SETMSG(HA_FTS_INVALID_DOCID, "Invalid InnoDB FTS Doc ID"); - SETMSG(HA_ERR_DISK_FULL, ER_DEFAULT(ER_DISK_FULL)); + SETMSG(HA_ERR_DISK_FULL, "Disk got full writing '%s'"); SETMSG(HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE, "Too many words in a FTS phrase or proximity search"); SETMSG(HA_ERR_FK_DEPTH_EXCEEDED, "Foreign key cascade delete/update exceeds"); SETMSG(HA_ERR_TABLESPACE_MISSING, ER_DEFAULT(ER_TABLESPACE_MISSING)); @@ -754,6 +754,8 @@ int ha_initialize_handlerton(void *plugin_) DBUG_EXECUTE_IF("unstable_db_type", { static int i= (int) DB_TYPE_FIRST_DYNAMIC; + while (installed_htons[i]) + i++; hton->db_type= (enum legacy_db_type)++i; }); @@ -2353,7 +2355,7 @@ int ha_rollback_trans(THD *thd, bool all) "conf %d wsrep_err %s SQL %s", thd->thread_id, thd->query_id, thd->wsrep_trx().state(), wsrep::to_c_string(thd->wsrep_cs().current_error()), - thd->query()); + wsrep_thd_query(thd)); } #endif /* WITH_WSREP */ } @@ -2369,7 +2371,7 @@ int ha_rollback_trans(THD *thd, bool all) if (WSREP(thd) && thd->is_error()) { WSREP_DEBUG("ha_rollback_trans(%lld, %s) rolled back: msg %s is_real %d wsrep_err %s", - thd->thread_id, all? "TRUE" : "FALSE", + thd->thread_id, all ? "TRUE" : "FALSE", thd->get_stmt_da()->message(), is_real_trans, wsrep::to_c_string(thd->wsrep_cs().current_error())); } @@ -2868,6 +2870,7 @@ static bool xarecover_handlerton(THD *, transaction_participant *hton, void *arg } if (IF_WSREP((wsrep_emulate_bin_log && wsrep_is_wsrep_xid(info->list + i) && + !wsrep_is_xid_gtid_undefined(info->list + i) && x <= wsrep_limit), false) || tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) { @@ -4727,8 +4730,12 @@ void handler::print_error(int error, myf errflag) break; case ENOSPC: case HA_ERR_DISK_FULL: - textno= ER_DISK_FULL; SET_FATAL_ERROR; // Ensure error is logged + my_printf_error(ER_DISK_FULL, "Disk got full writing '%s.%s' (Errcode: %iE)", + MYF(errflag | ME_ERROR_LOG), + table_share->db.str, table_share->table_name.str, + error); + DBUG_VOID_RETURN; break; case EE_GLOBAL_TMP_SPACE_FULL: // Safety case EE_LOCAL_TMP_SPACE_FULL: // Safety @@ -8177,7 +8184,10 @@ int handler::ha_write_row(const uchar *buf) }); #endif /* WITH_WSREP */ if ((error= ha_check_overlaps(NULL, buf))) + { + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); + } if (table->s->long_unique_table && is_root_handler()) { @@ -8187,6 +8197,7 @@ int handler::ha_write_row(const uchar *buf) if (table->next_number_field) if (int err= update_auto_increment()) error= err; + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); } } @@ -8207,13 +8218,10 @@ int handler::ha_write_row(const uchar *buf) error= binlog_log_row(0, buf, log_func); #ifdef WITH_WSREP - if (WSREP_NNULL(ha_thd()) && table_share->tmp_table == NO_TMP_TABLE && - ht->flags & HTON_WSREP_REPLICATION && - !error && (error= wsrep_after_row(ha_thd()))) - { - DEBUG_SYNC_C("ha_write_row_end"); - DBUG_RETURN(error); - } + THD *thd= ha_thd(); + if (WSREP_NNULL(thd) && table_share->tmp_table == NO_TMP_TABLE && + ht->flags & HTON_WSREP_REPLICATION && !error) + error= wsrep_after_row(thd); #endif /* WITH_WSREP */ } diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a994e810238..1f1815d8db7 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -2528,7 +2528,7 @@ double Item_func_sphere_distance::val_real() String *arg2= args[1]->val_str(&bak2); double distance= 0.0; double sphere_radius= 6370986.0; // Default radius equals Earth radius - + null_value= (args[0]->null_value || args[1]->null_value); if (null_value) { @@ -2546,7 +2546,7 @@ double Item_func_sphere_distance::val_real() } if (sphere_radius <= 0) { - my_error(ER_INTERNAL_ERROR, MYF(0), "Radius must be greater than zero."); + my_error(ER_GIS_UNSUPPORTED_ARGUMENT, MYF(0), func_name()); return 1; } } @@ -2558,26 +2558,27 @@ double Item_func_sphere_distance::val_real() my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_Distance_Sphere"); goto handle_errors; } -// Method allowed for points and multipoints + // Method allowed for points and multipoints if (!(g1->get_class_info()->m_type_id == Geometry::wkb_point || g1->get_class_info()->m_type_id == Geometry::wkb_multipoint) || !(g2->get_class_info()->m_type_id == Geometry::wkb_point || g2->get_class_info()->m_type_id == Geometry::wkb_multipoint)) { - // Generate error message in case different geometry is used? - my_error(ER_INTERNAL_ERROR, MYF(0), func_name()); + // Generate error message in case of unexpected geometry. + my_error(ER_GIS_UNSUPPORTED_ARGUMENT, MYF(0), func_name()); return 0; } distance= spherical_distance_points(g1, g2, sphere_radius); if (distance < 0) { - my_error(ER_INTERNAL_ERROR, MYF(0), "Returned distance cannot be negative."); + my_error(ER_INTERNAL_ERROR, MYF(0), + "Returned distance cannot be negative."); return 1; } return distance; - handle_errors: - return 0; +handle_errors: + return 0; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ef958945c11..ef1c29731d0 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -57,7 +57,6 @@ C_MODE_END #endif /* fmtlib include (https://fmt.dev/). */ -#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 #include "fmt/args.h" @@ -1560,6 +1559,13 @@ namespace fmt { }; }; +struct fmt_locale_comma : std::numpunct +{ + char do_thousands_sep() const override { return ','; } + std::string do_grouping() const override { return "\3"; } +}; +static std::locale fmt_locale(std::locale(), new fmt_locale_comma); + /* SFORMAT(format_string, ...) This function receives a formatting specification string and N parameters @@ -1612,7 +1618,7 @@ String *Item_func_sformat::val_str(String *res) /* Create the string output */ try { - auto text = fmt::vformat(fmt_arg->c_ptr_safe(), arg_store); + auto text = fmt::vformat(fmt_locale, fmt_arg->c_ptr_safe(), arg_store); res->length(0); res->set_charset(collation.collation); res->append(text.c_str(), text.size(), fmt_arg->charset()); diff --git a/sql/log.cc b/sql/log.cc index 2fc87ade6ae..d95c2fc3523 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1910,6 +1910,16 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr, if (using_trx && thd->binlog_flush_pending_rows_event(TRUE, TRUE)) DBUG_RETURN(1); +#ifdef WITH_WSREP + /* Wsrep transaction was BF aborted but it must replay because certification + succeeded. The transaction must not be written into binlog yet, it will + be done during commit after the replay. */ + if (WSREP(thd) && wsrep_must_replay(thd)) + { + DBUG_RETURN(0); + } +#endif /* WITH_WSREP */ + /* Doing a commit or a rollback including non-transactional tables, i.e., ending a transaction where we might write the transaction @@ -8486,7 +8496,12 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, { DBUG_RETURN(0); } - else if (!(thd->variables.option_bits & OPTION_BIN_LOG)) + + if (!(thd->variables.option_bits & OPTION_BIN_LOG) +#ifdef WITH_WSREP + && !WSREP(thd) +#endif + ) { cache_mngr->need_unlog= false; DBUG_RETURN(0); @@ -9432,6 +9447,13 @@ int MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, bool has_xid= entry->end_event->get_type_code() == XID_EVENT; DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_or_stmt"); +#ifdef WITH_WSREP + if (WSREP(entry->thd) && + !(entry->thd->variables.option_bits & OPTION_BIN_LOG)) + { + DBUG_RETURN(0); + } +#endif /* WITH_WSREP */ /* An error in the trx_cache will truncate the cache to the last good diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index e424141b151..61fa17596aa 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -336,7 +336,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) " --bootstrap" " --datadir=." " --tmpdir=." - " --loose-innodb-buffer-pool-size=20M" + " --loose-innodb-buffer-pool-size=21M" "\"" , mysqld_path, opt_verbose_bootstrap ? "--console" : ""); return cmdline; diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 02fae11a260..5492bccd239 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -45,7 +45,6 @@ extern int upgrade_config_file(const char *myini_path); "OPTIONS:" static char mysqld_path[MAX_PATH]; -static char mysqladmin_path[MAX_PATH]; static char mysqlupgrade_path[MAX_PATH]; static char defaults_file_param[MAX_PATH + 16]; /*--defaults-file= */ @@ -302,13 +301,29 @@ void stop_mysqld_service() our --skip-grant-tables do not work anymore after mysql_upgrade that does "flush privileges". Instead, the shutdown event is set. */ +#define OPEN_EVENT_RETRY_SLEEP_MS 100 +#define OPEN_EVENT_MAX_RETRIES 50 + void initiate_mysqld_shutdown() { char event_name[32]; DWORD pid= GetProcessId(mysqld_process); sprintf_s(event_name, "MySQLShutdown%d", pid); - HANDLE shutdown_handle= OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name); - if(!shutdown_handle) + + HANDLE shutdown_handle; + for (int i= 0;; i++) + { + shutdown_handle= OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name); + if(shutdown_handle != nullptr || i == OPEN_EVENT_MAX_RETRIES) + break; + if (WaitForSingleObject(mysqld_process, OPEN_EVENT_RETRY_SLEEP_MS) != + WAIT_TIMEOUT) + { + die("server process exited before shutdown event was created"); + break; + } + } + if (!shutdown_handle) { die("OpenEvent() failed for shutdown event"); } @@ -403,6 +418,26 @@ static void change_service_config() } +/** + Waits until starting server can be connected to, via given named pipe, with timeout + Dies if either server process exited meanwhile, or when timeout was exceeded. +*/ +static void wait_for_server_startup(HANDLE process, const char *named_pipe, DWORD timeout_sec) +{ + unsigned long long end_time= GetTickCount64() + 1000ULL*timeout_sec; + for (;;) + { + if (WaitNamedPipe(named_pipe, 0)) + return; + + if (GetTickCount64() >= end_time) + die("Server did not startup after %lu seconds", timeout_sec); + + if (WaitForSingleObject(process, 100) != WAIT_TIMEOUT) + die("Server did not start"); + } +} + int main(int argc, char **argv) { @@ -419,8 +454,9 @@ int main(int argc, char **argv) /* Get full path to mysqld, we need it when changing service configuration. - Assume installation layout, i.e mysqld.exe, mysqladmin.exe, mysqlupgrade.exe - and mysql_upgrade_service.exe are in the same directory. + Assume mysqld.exe in the same directory as this program. + mysql_upgrade.exe is either in the same directory, or pointed to by + MARIADB_UPGRADE_EXE environment variable (in case of MTR running it) */ GetModuleFileName(NULL, bindir, FN_REFLEN); p= strrchr(bindir, FN_LIBCHAR); @@ -429,15 +465,19 @@ int main(int argc, char **argv) *p= 0; } sprintf_s(mysqld_path, "%s\\mysqld.exe", bindir); - sprintf_s(mysqladmin_path, "%s\\mysqladmin.exe", bindir); sprintf_s(mysqlupgrade_path, "%s\\mysql_upgrade.exe", bindir); - char *paths[]= {mysqld_path, mysqladmin_path, mysqlupgrade_path}; - for(int i= 0; i< 3;i++) + if (access(mysqld_path, 0)) + die("File %s does not exist", mysqld_path); + if (access(mysqlupgrade_path, 0)) { - if(GetFileAttributes(paths[i]) == INVALID_FILE_ATTRIBUTES) - die("File %s does not exist", paths[i]); + /* Try to get path from environment variable, set by MTR */ + char *alt_mysqlupgrade_path= getenv("MARIADB_UPGRADE_EXE"); + if (alt_mysqlupgrade_path) + sprintf_s(mysqlupgrade_path, "%s", alt_mysqlupgrade_path); } + if (access(mysqlupgrade_path, 0)) + die("File %s does not exist", mysqld_path); /* Messages written on stdout should not be buffered, GUI upgrade program @@ -482,6 +522,10 @@ int main(int argc, char **argv) DWORD start_duration_ms = 0; + char pipe_name[64]; + snprintf(pipe_name, sizeof(pipe_name), + "\\\\.\\pipe\\mysql_upgrade_service_%lu", GetCurrentProcessId()); + if (do_start_stop_server) { /* Start/stop server with --loose-innodb-fast-shutdown=1 */ @@ -493,37 +537,23 @@ int main(int argc, char **argv) { die("Cannot start mysqld.exe process, last error =%u", GetLastError()); } - char pipe_name[64]; - snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\mysql_upgrade_service_%lu", - GetCurrentProcessId()); - for (;;) + wait_for_server_startup(mysqld_process, pipe_name, startup_timeout); + // Server started, shut it down. + initiate_mysqld_shutdown(); + if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0) { - if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT) - die("mysqld.exe did not start"); - - if (WaitNamedPipe(pipe_name, 0)) - { - // Server started, shut it down. - initiate_mysqld_shutdown(); - if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0) - { - die("Could not shutdown server started with '--innodb-fast-shutdown=0'"); - } - DWORD exit_code; - if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code)) - { - die("Could not get mysqld's exit code"); - } - if (exit_code) - { - die("Could not get successfully shutdown mysqld"); - } - CloseHandle(mysqld_process); - break; - } - Sleep(500); - start_duration_ms += 500; + die("Could not shutdown server"); } + DWORD exit_code; + if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code)) + { + die("Could not get server's exit code"); + } + if (exit_code) + { + die("Could not get successfully shutdown server (exit code %u)",exit_code); + } + CloseHandle(mysqld_process); } log("Phase %d/%d: Fixing server config file%s", ++phase, max_phases, @@ -550,22 +580,7 @@ int main(int argc, char **argv) } log("Phase %d/%d: Waiting for startup to complete",++phase,max_phases); - start_duration_ms= 0; - for(;;) - { - if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT) - die("mysqld.exe did not start"); - - if (run_tool(P_WAIT, mysqladmin_path, "--protocol=pipe", socket_param, - "ping", "--no-beep", NULL) == 0) - { - break; - } - if (start_duration_ms > startup_timeout*1000) - die("Server did not come up in %d seconds",startup_timeout); - Sleep(500); - start_duration_ms+= 500; - } + wait_for_server_startup(mysqld_process, pipe_name, startup_timeout); log("Phase %d/%d: Running mysql_upgrade",++phase,max_phases); int upgrade_err= (int) run_tool(P_WAIT, mysqlupgrade_path, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ce75a02c51d..34bf4938bf5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -428,7 +428,9 @@ my_bool opt_require_secure_transport= 0; char* opt_secure_file_priv; my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; +#ifdef HAVE_SOLARIS_LARGE_PAGES my_bool opt_super_large_pages= 0; +#endif my_bool opt_myisam_use_mmap= 0; uint opt_large_page_size= 0; #if defined(ENABLED_DEBUG_SYNC) @@ -3726,12 +3728,12 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) #endif /* - When thread specific is set, both mysqld_server_initialized and thd - must be set, and we check that with DBUG_ASSERT. - - However, do not crash, if current_thd is NULL, in release version. + is_thread_specific is only relevant when a THD exist and the server + has fully started. is_thread_specific can be set during recovery by + Aria for functions that are normally only run in one thread. + However InnoDB sets thd early, so we can use it. */ - DBUG_ASSERT(!is_thread_specific || (mysqld_server_initialized && thd)); + DBUG_ASSERT(!is_thread_specific || thd || !plugins_are_initialized); if (is_thread_specific && likely(thd)) /* If thread specific memory */ { @@ -4130,7 +4132,7 @@ static int init_common_variables() if (opt_large_pages) { DBUG_PRINT("info", ("Large page set")); - if (my_init_large_pages(opt_super_large_pages)) + if (my_init_large_pages()) { return 1; } @@ -5415,7 +5417,7 @@ static int init_server_components() MARIADB_REMOVED_OPTION("innodb-log-optimize-ddl"), MARIADB_REMOVED_OPTION("innodb-lru-flush-size"), MARIADB_REMOVED_OPTION("innodb-page-cleaners"), - MARIADB_REMOVED_OPTION("innodb-purge-truncate-frequency"), + MARIADB_REMOVED_OPTION("innodb-purge-rseg-truncate-frequency"), MARIADB_REMOVED_OPTION("innodb-replication-delay"), MARIADB_REMOVED_OPTION("innodb-scrub-log"), MARIADB_REMOVED_OPTION("innodb-scrub-log-speed"), @@ -8015,7 +8017,9 @@ static int mysql_init_variables(void) bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); bzero((char*) &global_status_var, clear_for_server_start); opt_large_pages= 0; +#ifdef HAVE_SOLARIS_LARGE_PAGES opt_super_large_pages= 0; +#endif #if defined(ENABLED_DEBUG_SYNC) opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ @@ -9531,6 +9535,7 @@ PSI_stage_info stage_preparing= { 0, "Preparing", 0}; PSI_stage_info stage_purging_old_relay_logs= { 0, "Purging old relay logs", 0}; PSI_stage_info stage_query_end= { 0, "Query end", 0}; PSI_stage_info stage_starting_cleanup= { 0, "Starting cleanup", 0}; +PSI_stage_info stage_slave_sql_cleanup= { 0, "Slave SQL thread ending", 0}; PSI_stage_info stage_rollback= { 0, "Rollback", 0}; PSI_stage_info stage_rollback_implicit= { 0, "Rollback_implicit", 0}; PSI_stage_info stage_commit= { 0, "Commit", 0}; @@ -9773,6 +9778,7 @@ PSI_stage_info *all_server_stages[]= & stage_preparing, & stage_purging_old_relay_logs, & stage_starting_cleanup, + & stage_slave_sql_cleanup, & stage_query_end, & stage_queueing_master_event_to_the_relay_log, & stage_reading_event_from_the_relay_log, diff --git a/sql/mysqld.h b/sql/mysqld.h index 3cac9a6630a..c39f0108c93 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -562,6 +562,7 @@ extern PSI_stage_info stage_preparing; extern PSI_stage_info stage_purging_old_relay_logs; extern PSI_stage_info stage_query_end; extern PSI_stage_info stage_starting_cleanup; +extern PSI_stage_info stage_slave_sql_cleanup; extern PSI_stage_info stage_rollback; extern PSI_stage_info stage_rollback_implicit; extern PSI_stage_info stage_commit; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index edf5b6b212a..066b6aa8506 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -704,18 +704,22 @@ net_real_write(NET *net,const uchar *packet, size_t len) "%s: write looped on vio with state %d, aborting thread\n", my_progname, (int) net->vio->type); net->error= 2; /* Close socket */ - net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : - ER_NET_ERROR_ON_WRITE); -#ifdef MYSQL_SERVER - if (global_system_variables.log_warnings > 3) + + if (net->vio->state != VIO_STATE_SHUTDOWN || net->last_errno == 0) { - sql_print_warning("Could not write packet: fd: %lld state: %d " - "errno: %d vio_errno: %d length: %ld", - (longlong) vio_fd(net->vio), (int) net->vio->state, - vio_errno(net->vio), net->last_errno, - (ulong) (end-pos)); - } + net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : + ER_NET_ERROR_ON_WRITE); +#ifdef MYSQL_SERVER + if (global_system_variables.log_warnings > 3) + { + sql_print_warning("Could not write packet: fd: %lld state: %d " + "errno: %d vio_errno: %d length: %ld", + (longlong) vio_fd(net->vio), (int) net->vio->state, + vio_errno(net->vio), net->last_errno, + (ulong) (end-pos)); + } #endif + } MYSQL_SERVER_my_error(net->last_errno, MYF(0)); break; } @@ -865,6 +869,7 @@ retry: net->last_errno= (vio_was_timeout(net->vio) ? ER_NET_READ_INTERRUPTED : ER_NET_READ_ERROR); #ifdef MYSQL_SERVER + strmake_buf(net->last_error, ER(net->last_errno)); if (global_system_variables.log_warnings > 3) { /* Log things as a warning */ diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 2c656d3d32e..68832e3ba83 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -16638,7 +16638,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() Remember this key, and continue looking for a non-NULL key that satisfies some other condition. */ - memcpy(tmp_record, record, head->s->rec_buff_length); + memcpy(tmp_record, record, head->s->reclength); found_null= TRUE; continue; } @@ -16678,7 +16678,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() */ if (found_null && result) { - memcpy(record, tmp_record, head->s->rec_buff_length); + memcpy(record, tmp_record, head->s->reclength); result= 0; } return result; @@ -16711,7 +16711,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() ha_rkey_function find_flag; key_part_map keypart_map; QUICK_RANGE *cur_range; - int result; + int result= HA_ERR_KEY_NOT_FOUND; DBUG_ASSERT(min_max_ranges.elements > 0); @@ -16720,10 +16720,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx - 1); /* - If the current value for the min/max argument is smaller than the left - boundary of cur_range, there is no need to check this range. + If the key has already been "moved" by a successful call to + ha_index_read_map, and the current value for the max argument + comes before the range, there is no need to check this range. */ - if (range_idx != min_max_ranges.elements && + if (!result && !(cur_range->flag & NO_MIN_RANGE) && (key_cmp(min_max_arg_part, (const uchar*) cur_range->min_key, min_max_arg_len) == -1)) diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index b4746ed6d55..f4c7d8ee462 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -153,14 +153,12 @@ static void finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, rpl_parallel_entry *entry, rpl_group_info *rgi) { - THD *thd= rpt->thd; - wait_for_commit *wfc= &rgi->commit_orderer; - int err; - if (rgi->get_finish_event_group_called()) return; - thd->get_stmt_da()->set_overwrite_status(true); + THD *thd= rpt->thd; + wait_for_commit *wfc= &rgi->commit_orderer; + int err; if (unlikely(rgi->worker_error)) { @@ -320,10 +318,6 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, wait_for_pending_deadlock_kill(thd, rgi); thd->clear_error(); thd->reset_killed(); - /* - Would do thd->get_stmt_da()->set_overwrite_status(false) here, but - reset_diagnostics_area() already does that. - */ thd->get_stmt_da()->reset_diagnostics_area(); wfc->wakeup_subsequent_commits(rgi->worker_error); rgi->did_mark_start_commit= false; @@ -1601,9 +1595,7 @@ handle_rpl_parallel_thread(void *arg) else { delete qev->ev; - thd->get_stmt_da()->set_overwrite_status(true); err= thd->wait_for_prior_commit(); - thd->get_stmt_da()->set_overwrite_status(false); } end_of_group= diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index b1c570ade03..c1052e690d1 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -277,7 +277,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_safe_printf_stderr("Status: %s\n", kreason); my_safe_printf_stderr("Query (%p): ", thd->query()); my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())); - my_safe_printf_stderr("%s", "Optimizer switch: "); + my_safe_printf_stderr("%s", "\nOptimizer switch: "); ulonglong optsw= thd->variables.optimizer_switch; for (uint i= 0; optimizer_switch_names[i+1]; i++, optsw >>= 1) { diff --git a/sql/slave.cc b/sql/slave.cc index ab8cf495055..9f043ffeed3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2932,13 +2932,17 @@ void store_master_info(THD *thd, Master_info *mi, TABLE *table, &my_charset_bin); mysql_mutex_lock(&mi->run_lock); - msg= (mi->rli.sql_driver_thd ? - mi->rli.sql_driver_thd->get_proc_info() : ""); - store_string_or_null(field++, msg); - msg= mi->io_thd ? mi->io_thd->get_proc_info() : ""; - store_string_or_null(field++, msg); + THD *sql_thd= mi->rli.sql_driver_thd; + const char *const slave_sql_running_state= + sql_thd ? sql_thd->get_proc_info() : ""; + THD *io_thd= mi->io_thd; + const char *const slave_io_running_state= + io_thd ? io_thd->get_proc_info() : ""; mysql_mutex_unlock(&mi->run_lock); + store_string_or_null(field++, slave_sql_running_state); + store_string_or_null(field++, slave_io_running_state); + mysql_mutex_lock(&mi->data_lock); mysql_mutex_lock(&mi->rli.data_lock); /* err_lock is to protect mi->last_error() */ @@ -3106,10 +3110,6 @@ void store_master_info(THD *thd, Master_info *mi, TABLE *table, // int32 on paper, unsigned in practice (*field++)->store((uint32) mi->rli.get_sql_delay(), true); // SQL_Remaining_Delay - // THD::proc_info is not protected by any lock, so we read it once - // to ensure that we use the same value throughout this function. - const char *slave_sql_running_state= - mi->rli.sql_driver_thd ? mi->rli.sql_driver_thd->proc_info : ""; if (slave_sql_running_state == stage_sql_thd_waiting_until_delay.m_name) { time_t t= my_time(0), sql_delay_end= mi->rli.get_sql_delay_end(); @@ -5163,6 +5163,7 @@ pthread_handler_t handle_slave_sql(void *arg) THD *thd; /* needs to be first for thread_stack */ char saved_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN]; + bool thd_initialized= 0; my_off_t UNINIT_VAR(saved_log_pos); my_off_t UNINIT_VAR(saved_master_log_pos); String saved_skip_gtid_pos; @@ -5263,6 +5264,7 @@ pthread_handler_t handle_slave_sql(void *arg) thd->variables.binlog_annotate_row_events= 0; server_threads.insert(thd); + thd_initialized= 1; /* We are going to set slave_running to 1. Assuming slave I/O thread is alive and connected, this is going to make Seconds_Behind_Master be 0 @@ -5642,7 +5644,7 @@ pthread_handler_t handle_slave_sql(void *arg) } THD_STAGE_INFO(thd, stage_waiting_for_slave_mutex_on_exit); thd->add_status_to_global(); - server_threads.erase(thd); + THD_STAGE_INFO(thd, stage_slave_sql_cleanup); mysql_mutex_lock(&rli->run_lock); err_during_init: @@ -5713,6 +5715,8 @@ err_during_init: rpl_parallel_resize_pool_if_no_slaves(); delete serial_rgi; + if (thd_initialized) + server_threads.erase(thd); delete thd; DBUG_LEAVE; // Must match DBUG_ENTER() diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 5f1f6c04b80..20770d50d57 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1356,7 +1356,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) thd->wsrep_cs().reset_error(); /* Reset also thd->killed if it has been set during BF abort. */ if (killed_mask_hard(thd->killed) == KILL_QUERY) - thd->killed= NOT_KILLED; + thd->reset_killed(); /* if failed transaction was not replayed, must return with error from here */ if (!must_replay) err_status = 1; } @@ -2384,6 +2384,16 @@ sp_head::bind_input_param(THD *thd, if (!spvar) DBUG_RETURN(FALSE); + if (!spvar->field_def.type_handler()->is_scalar_type() && + dynamic_cast(arg_item)) + { + // Item_param cannot store values of non-scalar data types yet + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + spvar->field_def.type_handler()->name().ptr(), + "EXECUTE ... USING ?"); + DBUG_RETURN(true); + } + if (spvar->mode != sp_variable::MODE_IN) { Settable_routine_parameter *srp= diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ac6f0820a06..1eba626cd4b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -13283,6 +13283,9 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock) return dup; } + if (!initialized) + return dup; + if (lock) mysql_mutex_lock(&acl_cache->lock); if (find_acl_role(dup->user, false)) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 61621960aa8..c7033320542 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -784,6 +784,7 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share, } } +#ifdef DBUG_ASSERT_EXISTS static inline bool check_field_pointers(const TABLE *table) { for (Field **pf= table->field; *pf; pf++) @@ -799,6 +800,7 @@ static inline bool check_field_pointers(const TABLE *table) } return true; } +#endif int close_thread_tables_for_query(THD *thd) @@ -4590,6 +4592,7 @@ bool open_tables(THD *thd, const DDL_options_st &options, } thd->current_tablenr= 0; + sroutine_to_open= &thd->lex->sroutines_list.first; restart: /* @@ -4605,7 +4608,6 @@ restart: has_prelocking_list= thd->lex->requires_prelocking(); table_to_open= start; - sroutine_to_open= &thd->lex->sroutines_list.first; *counter= 0; THD_STAGE_INFO(thd, stage_opening_tables); prelocking_strategy->reset(thd); @@ -4702,7 +4704,7 @@ restart: elements from the table list (if MERGE tables are involved), */ close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp(), - ot_ctx.remove_implicitly_used_deps()); + false); /* Here we rely on the fact that 'tables' still points to the valid @@ -4770,10 +4772,9 @@ restart: /* F.ex. deadlock happened */ if (ot_ctx.can_recover_from_failed_open()) { - DBUG_ASSERT(ot_ctx.remove_implicitly_used_deps()); close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp(), - ot_ctx.remove_implicitly_used_deps()); + true); if (ot_ctx.recover_from_failed_open()) goto error; @@ -4782,6 +4783,7 @@ restart: goto error; error= FALSE; + sroutine_to_open= &thd->lex->sroutines_list.first; goto restart; } /* @@ -6080,19 +6082,19 @@ bool restart_trans_for_tables(THD *thd, TABLE_LIST *table) trying to reopen tables. NULL if no metadata locks were held and thus all metadata locks should be released. - @param[in] remove_implicit_deps True in case routines and tables implicitly + @param[in] remove_indirect True in case routines and tables implicitly used by a statement should be removed. */ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp, - bool remove_implicit_deps) + bool remove_indirect) { - TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); TABLE_LIST *tmp; - if (remove_implicit_deps) + if (remove_indirect) { + TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); /* If table list consists only from tables from prelocking set, table list for new attempt should be empty, so we have to update list's root pointer. @@ -9492,9 +9494,11 @@ my_bool mysql_rm_tmp_tables(void) memcpy(path_copy, path, path_len - ext_len); path_copy[path_len - ext_len]= 0; init_tmp_table_share(thd, &share, "", 0, "", path_copy, true); - handlerton *ht= share.db_type(); if (!open_table_def(thd, &share)) - ht->drop_table(share.db_type(), path_copy); + { + handlerton *ht= share.db_type(); + ht->drop_table(ht, path_copy); + } free_table_share(&share); } /* diff --git a/sql/sql_base.h b/sql/sql_base.h index 6b1dee77f54..b60359a46f1 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -158,7 +158,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, my_bool mysql_rm_tmp_tables(void); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp, - bool remove_implicit_dependencies); + bool remove_indirect); bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_CSTRING *db, LEX_CSTRING *table, thr_lock_type lock_type); TABLE_LIST *find_table_in_list(TABLE_LIST *table, @@ -586,23 +586,6 @@ public: return m_timeout; } - /** - Return true in case tables and routines the statement implicilty - dependent on should be removed, else return false. - - @note The use case when routines and tables the statement implicitly - dependent on shouldn't be removed is the one when a new partition be - created on handling the INSERT statement against a versioning partitioned - table. For this case re-opening a versioning table would result in adding - implicitly dependent routines (e.g. table's triggers) that lead to - allocation of memory on PS mem_root and so leaking a memory until the PS - statement be deallocated. - */ - bool remove_implicitly_used_deps() const - { - return m_action != OT_ADD_HISTORY_PARTITION; - } - uint get_flags() const { return m_flags; } /** diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c3e9d3b7b58..78521e6848c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -8398,6 +8398,24 @@ end: } +void +wait_for_commit::prior_commit_error(THD *thd) +{ + /* + Only raise a "prior commit failed" error if we didn't already raise + an error. + + The ER_PRIOR_COMMIT_FAILED is just an internal mechanism to ensure that a + transaction does not commit successfully if a prior commit failed, so that + the parallel replication worker threads stop in an orderly fashion when + one of them get an error. Thus, if another worker already got another real + error, overriding it with ER_PRIOR_COMMIT_FAILED is not useful. + */ + if (!thd->get_stmt_da()->is_set()) + my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); +} + + /* Wakeup anyone waiting for us to have committed. diff --git a/sql/sql_class.h b/sql/sql_class.h index 2eff34f3ae0..bc82fdda5bc 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2647,8 +2647,8 @@ struct wait_for_commit return wait_for_prior_commit2(thd, allow_kill); else { - if (wakeup_error) - my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); + if (unlikely(wakeup_error)) + prior_commit_error(thd); return wakeup_error; } } @@ -2699,6 +2699,7 @@ struct wait_for_commit void wakeup(int wakeup_error); int wait_for_prior_commit2(THD *thd, bool allow_kill); + void prior_commit_error(THD *thd); void wakeup_subsequent_commits2(int wakeup_error); void unregister_wait_for_prior_commit2(); diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 3167a3f500e..623ed031a0e 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -329,18 +329,16 @@ Diagnostics_area::reset_diagnostics_area() #endif get_warning_info()->clear_error_condition(); set_is_sent(false); - /** Tiny reset in debug mode to see garbage right away */ - if (!is_bulk_op()) - /* - For BULK DML operations (e.g. UPDATE) the data member m_status - has the value DA_OK_BULK. Keep this value in order to handle - m_affected_rows, m_statement_warn_count in correct way. Else, - the number of rows and the number of warnings affected by - the last statement executed as part of a trigger fired by the dml - (e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts - rows modified by trigger's statement. - */ - m_status= DA_EMPTY; + /* + For BULK DML operations (e.g. UPDATE) the data member m_status + has the value DA_OK_BULK. Keep this value in order to handle + m_affected_rows, m_statement_warn_count in correct way. Else, + the number of rows and the number of warnings affected by + the last statement executed as part of a trigger fired by the dml + (e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts + rows modified by trigger's statement. + */ + m_status= is_bulk_op() ? DA_OK_BULK : DA_EMPTY; DBUG_VOID_RETURN; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8450b166497..3fc718c16b7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -15074,6 +15074,36 @@ bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys) } +/* + Procedure of keys generation for result tables of materialized derived + tables/views. + + A key is generated for each equi-join pair {derived_table, some_other_table}. + Each generated key consists of fields of derived table used in equi-join. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=t1.f3 and tt.f2.=t1.f4; + In this case for the derived table tt one key will be generated. It will + consist of two parts f1 and f2. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=t1.f3 JOIN + t2 ON tt.f2=t2.f4; + In this case for the derived table tt two keys will be generated. + One key over f1 field, and another key over f2 field. + Currently optimizer may choose to use only one such key, thus the second + one will be dropped after range optimizer is finished. + See also JOIN::drop_unused_derived_keys function. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=a_function(t1.f3); + In this case for the derived table tt one key will be generated. It will + consist of one field - f1. +*/ + static bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array) { @@ -19757,6 +19787,8 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top, prev_table->dep_tables|= used_tables; if (prev_table->on_expr) { + /* If the ON expression is still there, it's an outer join */ + DBUG_ASSERT(prev_table->outer_join); prev_table->dep_tables|= table->on_expr_dep_tables; table_map prev_used_tables= prev_table->nested_join ? prev_table->nested_join->used_tables : @@ -19771,11 +19803,59 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top, prevents update of inner table dependences. For example it might happen if RAND() function is used in JOIN ON clause. - */ - if (!((prev_table->on_expr->used_tables() & - ~(OUTER_REF_TABLE_BIT | RAND_TABLE_BIT)) & - ~prev_used_tables)) + */ + table_map prev_on_expr_deps= prev_table->on_expr->used_tables() & + ~(OUTER_REF_TABLE_BIT | RAND_TABLE_BIT); + prev_on_expr_deps&= ~prev_used_tables; + + if (!prev_on_expr_deps) prev_table->dep_tables|= used_tables; + else + { + /* + Another possible case is when prev_on_expr_deps!=0 but it depends + on a table outside this join nest. SQL name resolution don't allow + this but it is possible when LEFT JOIN is inside a subquery which + is converted into a semi-join nest, Example: + + t1 SEMI JOIN ( + t2 + LEFT JOIN (t3 LEFT JOIN t4 ON t4.col=t1.col) ON expr + ) ON ... + + here, we would have prev_table=t4, table=t3. The condition + "ON t4.col=t1.col" depends on tables {t1, t4}. To make sure the + optimizer puts t3 before t4 we need to make sure t4.dep_tables + includes t3. + */ + + DBUG_ASSERT(table->embedding == prev_table->embedding); + if (table->embedding) + { + /* + Find what are the "peers" of "table" in the join nest. Normally, + it is table->embedding->nested_join->used_tables, but here we are + in the process of recomputing that value. + So, we walk the join list and collect the bitmap of peers: + */ + table_map peers= 0; + List_iterator_fast li(*join_list); + TABLE_LIST *peer; + while ((peer= li++)) + { + table_map curmap= peer->nested_join + ? peer->nested_join->used_tables + : peer->get_map(); + peers|= curmap; + } + /* + If prev_table doesn't depend on any of its peers, add a + dependency on nearest peer, that is, on 'table'. + */ + if (!(prev_on_expr_deps & peers)) + prev_table->dep_tables|= used_tables; + } + } } } prev_table= table; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 513a0e881c8..ee1a0bb1c05 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11968,7 +11968,8 @@ alter_copy: - Neither old or new engine uses files from another engine The above is mainly true for the sequence and the partition engine. */ - engine_changed= ((new_table->file->ht != table->file->ht) && + engine_changed= ((new_table->file->storage_ht() != + table->file->storage_ht()) && ((!(new_table->file->ha_table_flags() & HA_FILE_BASED) || !(table->file->ha_table_flags() & HA_FILE_BASED))) && !(table->file->ha_table_flags() & HA_REUSES_FILE_NAMES) && @@ -12003,7 +12004,7 @@ alter_copy: debug_crash_here("ddl_log_alter_after_copy"); // Use old table /* - We are new ready to use the new table. Update the state in the + We are now ready to use the new table. Update the state in the ddl log so that we recovery know that the new table is ready and in case of crash it should use the new one and log the query to the binary log. diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 660d79a2334..90056b40fb7 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -299,7 +299,7 @@ Sql_cmd_truncate_table::handler_truncate(THD *thd, TABLE_LIST *table_ref, bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, bool *hton_can_recreate) { - handlerton *hton; + const handlerton *hton; bool versioned; bool sequence= false; TABLE *table= NULL; @@ -370,8 +370,12 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, table we need to find out default partition handlerton. */ - const handlerton *ht= share->default_part_plugin ? - plugin_hton(share->default_part_plugin) : hton; + const handlerton* const ht= +#ifdef WITH_PARTITION_STORAGE_ENGINE + share->default_part_plugin ? + plugin_hton(share->default_part_plugin) : +#endif + hton; if (ht && !wsrep_should_replicate_ddl(thd, ht)) { diff --git a/sql/structs.h b/sql/structs.h index fa9e115822b..ac0510bed5d 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -236,7 +236,7 @@ struct AUTHID LEX_CSTRING user, host; void init() { memset(this, 0, sizeof(*this)); } void copy(MEM_ROOT *root, const LEX_CSTRING *usr, const LEX_CSTRING *host); - bool is_role() const { return user.str[0] && !host.str[0]; } + bool is_role() const { return user.str[0] && (!host.str || !host.str[0]); } void set_lex_string(LEX_CSTRING *l, char *buf) { if (is_role()) diff --git a/sql/table.cc b/sql/table.cc index 76f706d849c..a708b68bace 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -10204,37 +10204,6 @@ int TABLE_LIST::fetch_number_of_rows() return error; } -/* - Procedure of keys generation for result tables of materialized derived - tables/views. - - A key is generated for each equi-join pair derived table-another table. - Each generated key consists of fields of derived table used in equi-join. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=t1.f3 and tt.f2.=t1.f4; - In this case for the derived table tt one key will be generated. It will - consist of two parts f1 and f2. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=t1.f3 JOIN - t2 ON tt.f2=t2.f4; - In this case for the derived table tt two keys will be generated. - One key over f1 field, and another key over f2 field. - Currently optimizer may choose to use only one such key, thus the second - one will be dropped after range optimizer is finished. - See also JOIN::drop_unused_derived_keys function. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=a_function(t1.f3); - In this case for the derived table tt one key will be generated. It will - consist of one field - f1. -*/ - - /* @brief diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index 289688c8470..ee3da59d4f2 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -203,6 +203,21 @@ int wsrep_apply_events(THD* thd, } } + if (LOG_EVENT_IS_WRITE_ROW(typ) || + LOG_EVENT_IS_UPDATE_ROW(typ) || + LOG_EVENT_IS_DELETE_ROW(typ)) + { + Rows_log_event* rle = static_cast(ev); + if (thd_test_options(thd, OPTION_RELAXED_UNIQUE_CHECKS)) + { + rle->set_flags(Rows_log_event::RELAXED_UNIQUE_CHECKS_F); + } + if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) + { + rle->set_flags(Rows_log_event::NO_FOREIGN_KEY_CHECKS_F); + } + } + /* Use the original server id for logging. */ thd->set_server_id(ev->server_id); thd->lex->current_select= 0; diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index 4c172d8804b..222435f6063 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -305,6 +305,12 @@ enum wsrep::provider::status Wsrep_client_service::replay() replayer_service.replay_status(ret); } + // In Galera we allow only InnoDB sequences, thus + // sequence table updates are in writeset. + // Binlog cache needs reset so that binlog_close + // does not write cache to binlog file yet. + binlog_reset_cache(m_thd); + replayer_thd->main_security_ctx = old_ctx; delete replayer_thd; DBUG_RETURN(ret); diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index bc0aa5ac99c..af7c9f010bd 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -611,7 +611,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, int ret= apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); - if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) + if (!ret && !wsrep::commits_transaction(ws_meta.flags())) { thd->wsrep_cs().fragment_applied(ws_meta.seqno()); } @@ -779,7 +779,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, } ret= ret || apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); - if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) + if (!ret && !wsrep::commits_transaction(ws_meta.flags())) { thd->wsrep_cs().fragment_applied(ws_meta.seqno()); } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 3e5b9f1ea15..98583be3cc9 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2008, 2024, Codership Oy - Copyright (c) 2020, 2024, MariaDB +/* Copyright (c) 2008, 2025, Codership Oy + Copyright (c) 2020, 2025, MariaDB 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 @@ -833,7 +833,8 @@ void wsrep_init_globals() wsrep_server_gtid_t new_gtid; new_gtid.domain_id= wsrep_gtid_domain_id; new_gtid.server_id= global_system_variables.server_id; - new_gtid.seqno= 0; + /* Use seqno which was recovered in wsrep_init_gtid() */ + new_gtid.seqno= wsrep_gtid_server.seqno(); /* Try to search for domain_id and server_id combination in binlog if found continue from last seqno */ wsrep_get_binlog_gtid_seqno(new_gtid); wsrep_gtid_server.gtid(new_gtid); @@ -2515,38 +2516,36 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) if (!wsrep_check_mode(WSREP_MODE_STRICT_REPLICATION)) return true; - if (!hton) - return true; - DBUG_ASSERT(hton != nullptr); switch (hton->db_type) { + case DB_TYPE_UNKNOWN: + /* Special pseudo-handlertons (such as 10.6+ JSON tables). */ + return true; + break; case DB_TYPE_INNODB: return true; break; case DB_TYPE_MYISAM: if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + break; + case DB_TYPE_ARIA: + if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + return true; break; case DB_TYPE_PARTITION_DB: /* In most cases this means we could not find out table->file->partition_ht() */ return true; break; - case DB_TYPE_ARIA: - if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) - return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); - break; default: - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); break; } + WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + /* wsrep_mode = STRICT_REPLICATION, treat as error */ my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -2561,15 +2560,14 @@ bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list) { for (const TABLE_LIST* it= table_list; it; it= it->next_global) { - if (it->table) + const TABLE* table= it->table; + if (table && !it->table_function) { /* If this is partitioned table we need to find out implementing storage engine handlerton. */ - const handlerton *ht= it->table->file->partition_ht() ? - it->table->file->partition_ht() : - it->table->s->db_type(); - + const handlerton *ht= table->file->partition_ht(); + if (!ht) ht= table->s->db_type(); if (!wsrep_should_replicate_ddl(thd, ht)) return false; } @@ -2822,7 +2820,6 @@ fail: unireg_abort(1); } - /* returns: 0: statement was replicated as TOI @@ -2838,6 +2835,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table, DBUG_ASSERT(wsrep_OSU_method_get(thd) == WSREP_OSU_TOI); WSREP_DEBUG("TOI Begin: %s", wsrep_thd_query(thd)); + DEBUG_SYNC(thd, "wsrep_before_toi_begin"); if (wsrep_can_run_in_toi(thd, db, table, table_list, create_info) == false) { @@ -3078,12 +3076,13 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, const wsrep::key_array *fk_tables, const HA_CREATE_INFO *create_info) { + DEBUG_SYNC(thd, "wsrep_kill_thd_before_enter_toi"); mysql_mutex_lock(&thd->LOCK_thd_kill); const killed_state killed = thd->killed; mysql_mutex_unlock(&thd->LOCK_thd_kill); if (killed) { - DBUG_ASSERT(FALSE); + /* The thread may have been killed as a result of memory pressure. */ return -1; } @@ -3260,19 +3259,20 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, const MDL_key *key) { THD *request_thd= requestor_ctx->get_thd(); - THD *granted_thd= ticket->get_ctx()->get_thd(); /* Fallback to the non-wsrep behaviour */ if (!WSREP(request_thd)) return; - const char* schema= key->db_name(); - int schema_len= key->db_name_length(); - mysql_mutex_lock(&request_thd->LOCK_thd_data); if (wsrep_thd_is_toi(request_thd) || wsrep_thd_is_applying(request_thd)) { + THD *granted_thd= ticket->get_ctx()->get_thd(); + + const char* schema= key->db_name(); + int schema_len= key->db_name_length(); + WSREP_DEBUG("wsrep_handle_mdl_conflict request TOI/APPLY for %s", wsrep_thd_query(request_thd)); THD_STAGE_INFO(request_thd, stage_waiting_isolation); @@ -3292,7 +3292,6 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, /* Here we will call wsrep_abort_transaction so we should hold THD::LOCK_thd_data to protect victim from concurrent usage and THD::LOCK_thd_kill to protect from disconnect or delete. - */ mysql_mutex_lock(&granted_thd->LOCK_thd_kill); mysql_mutex_lock(&granted_thd->LOCK_thd_data); diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 08ed9bd366f..e0fffa84457 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -192,6 +192,7 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level, break; case wsrep::log::unknown: WSREP_UNKNOWN("%s", message); + assert(0); break; } } diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 7097853e61b..9d1735157f1 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -136,13 +136,15 @@ static void* wsrep_sst_donor_monitor_thread(void *arg __attribute__((unused))) "is not completed", time_waited); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing..."); + "WSREP state transfer (role donor) ongoing..."); } } WSREP_INFO("Donor monitor thread ended with total time %lu sec", time_waited); mysql_mutex_unlock(&LOCK_wsrep_donor_monitor); + sd_notify(0, "STATUS=WSREP state transfer (role donor) completed.\n"); + return NULL; } @@ -172,13 +174,15 @@ static void* wsrep_sst_joiner_monitor_thread(void *arg __attribute__((unused))) "is not completed", time_waited); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing..."); + "WSREP state transfer (role joiner) ongoing..."); } } WSREP_INFO("Joiner monitor thread ended with total time %lu sec", time_waited); mysql_mutex_unlock(&LOCK_wsrep_joiner_monitor); + sd_notify(0, "STATUS=WSREP state transfer (role joiner) completed.\n"); + return NULL; } @@ -459,7 +463,7 @@ bool wsrep_sst_received (THD* thd, if (WSREP_ON) { int const rcode(seqno < 0 ? seqno : 0); - error= wsrep_sst_complete(thd,rcode, sst_gtid); + error= wsrep_sst_complete(thd, rcode, sst_gtid); } return error; @@ -2193,6 +2197,15 @@ wait_signal: wsrep::seqno(err ? wsrep::seqno::undefined() : wsrep::seqno(ret_seqno))); +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_sst_donor_after_donation", { + const char act[]= "now " + "SIGNAL sync.wsrep_sst_donor_after_donation_reached " + "WAIT_FOR signal.wsrep_sst_donor_after_donation_continue"; + DBUG_ASSERT(!debug_sync_set_action(thd.ptr, STRING_WITH_LEN(act))); + }); +#endif /* ENABLED_DEBUG_SYNC */ + Wsrep_server_state::instance().sst_sent(gtid, err); proc.wait(); diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index bf5baf9ac7d..2fe3e123cea 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -237,25 +237,13 @@ static inline void wsrep_override_error(THD* thd, wsrep::client_error ce, enum wsrep::provider::status status) { - DBUG_ASSERT(ce != wsrep::e_success); - switch (ce) - { - case wsrep::e_error_during_commit: - if (status == wsrep::provider::error_size_exceeded) - wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - else - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status); - break; - case wsrep::e_deadlock_error: - wsrep_override_error(thd, ER_LOCK_DEADLOCK); - break; - case wsrep::e_interrupted_error: - wsrep_override_error(thd, ER_QUERY_INTERRUPTED); - break; - case wsrep::e_size_exceeded_error: + DBUG_ASSERT(ce != wsrep::e_success); + switch (ce) + { + case wsrep::e_error_during_commit: + if (status == wsrep::provider::error_size_exceeded) wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - break; - case wsrep::e_append_fragment_error: + else /* TODO: Figure out better error number */ if (status) wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, @@ -265,17 +253,45 @@ static inline void wsrep_override_error(THD* thd, else wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, "Error while appending streaming replication fragment"); - break; - case wsrep::e_not_supported_error: - wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); - break; - case wsrep::e_timeout_error: - wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + case wsrep::e_deadlock_error: + switch (thd->lex->sql_command) + { + case SQLCOM_XA_END: + case SQLCOM_XA_PREPARE: + wsrep_override_error(thd, ER_XA_RBDEADLOCK); break; default: - wsrep_override_error(thd, ER_UNKNOWN_ERROR); + wsrep_override_error(thd, ER_LOCK_DEADLOCK); break; } + break; + case wsrep::e_interrupted_error: + wsrep_override_error(thd, ER_QUERY_INTERRUPTED); + break; + case wsrep::e_size_exceeded_error: + wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); + break; + case wsrep::e_append_fragment_error: + /* TODO: Figure out better error number */ + if (status) + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment" + "(provider status: %s)", + wsrep::provider::to_string(status).c_str()); + else + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment"); + break; + case wsrep::e_not_supported_error: + wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); + break; + case wsrep::e_timeout_error: + wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + default: + wsrep_override_error(thd, ER_UNKNOWN_ERROR); + } } /** diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 25e71638efd..2cc89044cc6 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -1,4 +1,4 @@ -/* Copyright 2016-2023 Codership Oy +/* Copyright 2016-2025 Codership Oy 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 @@ -265,12 +265,17 @@ static inline int wsrep_before_prepare(THD* thd, bool all) { DBUG_RETURN(ret); } + if ((ret= thd->wsrep_cs().before_prepare()) == 0) { DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); + /* Here we init xid with UUID and wsrep seqno. GTID is + set to undefined because commit order is decided later + in wsrep_before_commit(). wsrep_before_prepare() is + executed out of order. */ wsrep_xid_init(&thd->wsrep_xid, thd->wsrep_trx().ws_meta().gtid(), - wsrep_gtid_server.gtid()); + wsrep_gtid_server.undefined()); } mysql_mutex_lock(&thd->LOCK_thd_kill); @@ -472,12 +477,6 @@ static inline int wsrep_after_statement(THD* thd) { DBUG_ENTER("wsrep_after_statement"); - WSREP_DEBUG("wsrep_after_statement for %lu client_state %s " - " client_mode %s trans_state %s", - thd_get_thread_id(thd), - wsrep::to_c_string(thd->wsrep_cs().state()), - wsrep::to_c_string(thd->wsrep_cs().mode()), - wsrep::to_c_string(thd->wsrep_cs().transaction().state())); int ret= ((thd->wsrep_cs().state() != wsrep::client_state::s_none && thd->wsrep_cs().mode() == Wsrep_client_state::m_local) && !thd->internal_transaction() ? diff --git a/sql/wsrep_xid.cc b/sql/wsrep_xid.cc index 34eafe9c46c..12647907881 100644 --- a/sql/wsrep_xid.cc +++ b/sql/wsrep_xid.cc @@ -1,4 +1,4 @@ -/* Copyright 2015 Codership Oy +/* Copyright 2015-2025 Codership Oy 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 @@ -24,6 +24,8 @@ #include #include /* std::sort() */ +#include /* std::string */ +#include /* std::stringstream */ /* * WSREPXid */ @@ -119,11 +121,7 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) if (hton->set_checkpoint) { - const unsigned char* uuid= wsrep_xid_uuid(xid); - char uuid_str[40]= {0, }; - wsrep_uuid_print((const wsrep_uuid_t*)uuid, uuid_str, sizeof(uuid_str)); - WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", - uuid_str, (long long)wsrep_xid_seqno(xid)); + WSREP_DEBUG("Set WSREPXid for InnoDB: %s", wsrep_xid_print(xid).c_str()); hton->set_checkpoint(hton, xid); } return FALSE; @@ -150,12 +148,7 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) if (hton->get_checkpoint) { hton->get_checkpoint(hton, xid); - wsrep_uuid_t uuid; - memcpy(&uuid, wsrep_xid_uuid(xid), sizeof(uuid)); - char uuid_str[40]= {0, }; - wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str)); - WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", - uuid_str, (long long)wsrep_xid_seqno(xid)); + WSREP_DEBUG("Read WSREPXid from InnoDB: %s", wsrep_xid_print(xid).c_str()); } return FALSE; } @@ -252,3 +245,29 @@ void wsrep_sort_xid_array(XID *array, int len) { std::sort(array, array + len, Wsrep_xid_cmp()); } + +std::string wsrep_xid_print(const XID *xid) +{ + std::stringstream ss; + const unsigned char* uuid= wsrep_xid_uuid(xid); + char uuid_str[40]= {0, }; + wsrep_uuid_print((const wsrep_uuid_t*)uuid, uuid_str, sizeof(uuid_str)); + wsrep_server_gtid_t gtid= {0,0,0}; + memcpy(>id, &xid->data[WSREP_XID_RPL_GTID_OFFSET], sizeof(wsrep_server_gtid_t)); + ss << uuid_str << ":" << wsrep_xid_seqno(xid) << " " << gtid.domain_id << "-" + << gtid.server_id << "-" << gtid.seqno; + return ss.str(); +} + +bool wsrep_is_xid_gtid_undefined(const XID *xid) +{ + wsrep_server_gtid_t gtid= {0,0,0}; + + if (wsrep_is_wsrep_xid(xid) && + xid->data[WSREP_XID_VERSION_OFFSET] == WSREP_XID_VERSION_3) + { + memcpy(>id, &xid->data[WSREP_XID_RPL_GTID_OFFSET], sizeof(wsrep_server_gtid_t)); + } + + return (gtid.seqno == 0 && gtid.server_id == 0 && gtid.domain_id == 0); +} diff --git a/sql/wsrep_xid.h b/sql/wsrep_xid.h index 45ba6ffee6b..6eb812c81ce 100644 --- a/sql/wsrep_xid.h +++ b/sql/wsrep_xid.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Codership Oy +/* Copyright (C) 2015-2025 Codership Oy 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 @@ -34,6 +34,8 @@ bool wsrep_set_SE_checkpoint(const wsrep::gtid& gtid, const wsrep_server_gtid_t& //void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */ void wsrep_sort_xid_array(XID *array, int len); +std::string wsrep_xid_print(const XID *xid); +bool wsrep_is_xid_gtid_undefined(const XID *xid); #endif /* WITH_WSREP */ #endif /* WSREP_UTILS_H */ diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 3c67280a6fd..f449d133741 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -86,11 +86,11 @@ void CntEndDB(PGLOBAL g) free(dbuserp); - if (trace(1)) - htrc("CntEndDB: Freeing Dup\n"); + if (trace(1)) + htrc("CntEndDB: Freeing Dup\n"); - g->Activityp->Aptr = NULL; - } // endif dbuserp + g->Activityp->Aptr = NULL; // Free PlgGetUser() data + } // endif dbuserp } // end of CntEndDB diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index 4b179ef55d0..35e066cfe97 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -98,9 +98,6 @@ bool user_connect::user_init() PACTIVITY ap= NULL; PDBUSER dup= NULL; - // Areasize= 64M because of VEC tables. Should be parameterisable -//g= PlugInit(NULL, 67108864); -//g= PlugInit(NULL, 134217728); // 128M was because of old embedded tests g= PlugInit(NULL, (size_t)worksize); // Check whether the initialization is complete @@ -110,12 +107,13 @@ bool user_connect::user_init() printf("%s\n", g->Message); (void) PlugExit(g); + g= 0; - if (dup) - free(dup); + if (dup) + free(dup); return true; - } // endif g-> + } // endif g-> dup->Catalog= new MYCAT(NULL); @@ -125,17 +123,16 @@ bool user_connect::user_init() g->Activityp= ap; g->Activityp->Aptr= dup; - pthread_mutex_lock(&usrmut); + pthread_mutex_lock(&usrmut); next= to_users; to_users= this; if (next) next->previous= this; - count = 1; - pthread_mutex_unlock(&usrmut); - - last_query_id= thdp->query_id; + count = 1; + pthread_mutex_unlock(&usrmut); + last_query_id= thdp->query_id; return false; } // end of user_init diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index eb9b019f7b2..cbf5f60987d 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -327,7 +327,7 @@ btr_search_disable(const UT_LIST_BASE_NODE_T(dict_table_t)& tables) noexcept } /** Lazily free detached metadata when removing the last reference. */ -ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) +ATTRIBUTE_COLD void btr_search_lazy_free(dict_index_t *index) noexcept { ut_ad(index->freed()); dict_table_t *table= index->table; @@ -351,8 +351,7 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) table->autoinc_mutex.wr_unlock(); } -/** Disable the adaptive hash search system and empty the index. */ -void btr_sea::disable() noexcept +ATTRIBUTE_COLD bool btr_sea::disable() noexcept { dict_sys.freeze(SRW_LOCK_CALL); @@ -362,7 +361,9 @@ void btr_sea::disable() noexcept parts[i].blocks_mutex.wr_lock(); } - if (enabled) + const bool was_enabled{enabled}; + + if (was_enabled) { enabled= false; btr_search_disable(dict_sys.table_LRU); @@ -381,18 +382,20 @@ void btr_sea::disable() noexcept parts[i].latch.wr_unlock(); parts[i].blocks_mutex.wr_unlock(); } + + return was_enabled; } /** Enable the adaptive hash search system. @param resize whether buf_pool_t::resize() is the caller */ -void btr_sea::enable(bool resize) noexcept +ATTRIBUTE_COLD void btr_sea::enable(bool resize) noexcept { if (!resize) { mysql_mutex_lock(&buf_pool.mutex); - bool changed= srv_buf_pool_old_size != srv_buf_pool_size; + const auto is_shrinking = buf_pool.is_shrinking(); mysql_mutex_unlock(&buf_pool.mutex); - if (changed) + if (is_shrinking) return; } @@ -405,7 +408,7 @@ void btr_sea::enable(bool resize) noexcept if (!parts[0].table.array) { enabled= true; - alloc(buf_pool_get_curr_size() / sizeof(void *) / 64); + alloc(buf_pool.curr_size() / sizeof(void *) / 64); } ut_ad(enabled); @@ -896,89 +899,6 @@ static bool ha_search_and_update_if_found(hash_table_t *table, uint32_t fold, ha_search_and_update_if_found(table,fold,data,new_data) #endif -/** Clear the adaptive hash index on all pages in the buffer pool. */ -inline void buf_pool_t::clear_hash_index() noexcept -{ - ut_ad(!resizing); - ut_ad(!btr_search.enabled); - - std::set garbage; - - for (chunk_t *chunk= chunks + n_chunks; chunk-- != chunks; ) - { - for (buf_block_t *block= chunk->blocks, * const end= block + chunk->size; - block != end; block++) - { - dict_index_t *index= block->index; - - /* We can clear block->index and block->n_pointers when - holding all AHI latches exclusively; see the comments in buf0buf.h */ - - if (!index) - { -# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG - ut_a(!block->n_pointers); -# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - continue; - } - - ut_d(const auto s= block->page.state()); - /* Another thread may have set the state to - REMOVE_HASH in buf_LRU_block_remove_hashed(). - - The state change in buf_pool_t::realloc() is not observable - here, because in that case we would have !block->index. - - In the end, the entire adaptive hash index will be removed. */ - ut_ad(s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH); -# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG - block->n_pointers= 0; -# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - block->index= nullptr; - if (index->freed()) - garbage.emplace(index); - else - index->search_info.ref_count= 0; - } - } - - for (dict_index_t *index : garbage) - btr_search_lazy_free(index); -} - -/** Get a buffer block from an adaptive hash index pointer. -This function does not return if the block is not identified. -@param ptr pointer to within a page frame -@return pointer to block, never NULL */ -inline buf_block_t* buf_pool_t::block_from_ahi(const byte *ptr) const noexcept -{ - chunk_t::map *chunk_map = chunk_t::map_ref; - ut_ad(chunk_t::map_ref == chunk_t::map_reg); - ut_ad(!resizing); - - chunk_t::map::const_iterator it= chunk_map->upper_bound(ptr); - ut_a(it != chunk_map->begin()); - - chunk_t *chunk= it == chunk_map->end() - ? chunk_map->rbegin()->second - : (--it)->second; - - const size_t offs= size_t(ptr - chunk->blocks->page.frame) >> - srv_page_size_shift; - ut_a(offs < chunk->size); - - buf_block_t *block= &chunk->blocks[offs]; - /* buf_pool_t::chunk_t::init() invokes buf_block_init() so that - block[n].frame == block->page.frame + n * srv_page_size. Check it. */ - ut_ad(block->page.frame == page_align(ptr)); - /* Read the state of the block without holding hash_lock. - A state transition to REMOVE_HASH is possible during - this execution. */ - ut_ad(block->page.state() >= buf_page_t::REMOVE_HASH); - - return block; -} - /** Fold a prefix given as the number of fields of a tuple. @param tuple index record @param cursor B-tree cursor @@ -1118,7 +1038,8 @@ btr_search_guess_on_hash( } const rec_t *rec= node->rec; - buf_block_t *block= buf_pool.block_from_ahi(rec); + buf_block_t* block = buf_pool.block_from(rec); + ut_ad(block->page.frame == page_align(rec)); #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ut_a(block == node->block); #endif @@ -1965,7 +1886,7 @@ func_exit: for (; node != NULL; node = node->next) { const buf_block_t* block - = buf_pool.block_from_ahi(node->rec); + = buf_pool.block_from(node->rec); index_id_t page_index_id; if (UNIV_LIKELY(block->page.in_file())) { diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index 5e31790aad4..9a7fbafa3e1 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -162,6 +162,20 @@ buf_buddy_get( } #ifdef UNIV_DEBUG +const buf_block_t *buf_pool_t::contains_zip(const void *data, size_t shift) + const noexcept +{ + const size_t d= size_t(data) >> shift; + + for (size_t i= 0; i < n_blocks; i++) + { + const buf_block_t *block= get_nth_page(i); + if (size_t(block->page.zip.data) >> shift == d) + return block; + } + return nullptr; +} + /** Validate a given zip_free list. */ struct CheckZipFree { CheckZipFree(ulint i) : m_i(i) {} @@ -257,13 +271,10 @@ buf_buddy_is_free( /** Add a block to the head of the appropriate buddy free list. @param[in,out] buf block to be freed @param[in] i index of buf_pool.zip_free[] */ -UNIV_INLINE -void -buf_buddy_add_to_free(buf_buddy_free_t* buf, ulint i) +static void buf_buddy_add_to_free(buf_buddy_free_t *buf, ulint i) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(buf_pool.zip_free[i].start != buf); - buf_buddy_stamp_free(buf, i); UT_LIST_ADD_FIRST(buf_pool.zip_free[i], buf); ut_d(buf_buddy_list_validate(i)); @@ -272,9 +283,7 @@ buf_buddy_add_to_free(buf_buddy_free_t* buf, ulint i) /** Remove a block from the appropriate buddy free list. @param[in,out] buf block to be freed @param[in] i index of buf_pool.zip_free[] */ -UNIV_INLINE -void -buf_buddy_remove_from_free(buf_buddy_free_t* buf, ulint i) +static void buf_buddy_remove_from_free(buf_buddy_free_t *buf, ulint i) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(buf_buddy_check_free(buf, i)); @@ -298,13 +307,10 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) buf = UT_LIST_GET_FIRST(buf_pool.zip_free[i]); - if (buf_pool.is_shrinking() - && UT_LIST_GET_LEN(buf_pool.withdraw) - < buf_pool.withdraw_target) { - + if (size_t size = buf_pool.shrinking_size()) { while (buf != NULL && buf_pool.will_be_withdrawn( - reinterpret_cast(buf))) { + reinterpret_cast(buf), size)) { /* This should be withdrawn, not to be allocated */ buf = UT_LIST_GET_NEXT(list, buf); } @@ -312,6 +318,7 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) if (buf) { buf_buddy_remove_from_free(buf, i); + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); } else if (i + 1 < BUF_BUDDY_SIZES) { /* Attempt to split. */ buf = buf_buddy_alloc_zip(i + 1); @@ -321,7 +328,6 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) reinterpret_cast( reinterpret_cast(buf) + (BUF_BUDDY_LOW << i)); - ut_ad(!buf_pool.contains_zip(buddy)); buf_buddy_add_to_free(buddy, i); } } @@ -340,74 +346,52 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) return(buf); } +#ifdef UNIV_DEBUG +/** number of blocks allocated to the buddy system */ +static size_t buf_buddy_n_frames; +#endif + /** Deallocate a buffer frame of srv_page_size. @param buf buffer frame to deallocate */ static void buf_buddy_block_free(void *buf) noexcept { mysql_mutex_assert_owner(&buf_pool.mutex); - ut_a(!ut_align_offset(buf, srv_page_size)); - - const ulint fold= BUF_POOL_ZIP_FOLD_PTR(buf); - buf_page_t **prev= buf_pool.zip_hash.cell_get(fold)-> - search(&buf_page_t::hash, [buf](const buf_page_t *b) - { - ut_ad(b->in_zip_hash); - ut_ad(b->state() == buf_page_t::MEMORY); - return b->frame == buf; - }); - - buf_page_t *bpage= *prev; - ut_a(bpage); - ut_a(bpage->frame == buf); - ut_d(bpage->in_zip_hash= false); - *prev= bpage->hash; - bpage->hash= nullptr; - + buf_block_t *block= buf_pool.block_from(buf); + ut_ad(block->page.state() == buf_page_t::MEMORY); + ut_ad(block->page.frame == buf); + ut_ad(!buf_pool.contains_zip(buf, srv_page_size_shift)); ut_d(memset(buf, 0, srv_page_size)); MEM_UNDEFINED(buf, srv_page_size); - - buf_LRU_block_free_non_file_page(reinterpret_cast(bpage)); - ut_ad(buf_pool.buddy_n_frames > 0); - ut_d(buf_pool.buddy_n_frames--); + buf_LRU_block_free_non_file_page(block); + ut_ad(buf_buddy_n_frames > 0); + ut_d(buf_buddy_n_frames--); } /** Allocate a buffer block to the buddy allocator. @param block buffer block to register */ static void buf_buddy_block_register(buf_block_t *block) noexcept { - const ulint fold= BUF_POOL_ZIP_FOLD(block); + ut_ad(buf_pool.is_uncompressed_current(block)); ut_ad(block->page.state() == buf_page_t::MEMORY); - - ut_a(block->page.frame); - ut_a(!ut_align_offset(block->page.frame, srv_page_size)); - - ut_ad(!block->page.in_zip_hash); - ut_d(block->page.in_zip_hash= true); - buf_pool.zip_hash.cell_get(fold)->append(block->page, &buf_page_t::hash); - ut_d(buf_pool.buddy_n_frames++); + ut_d(buf_buddy_n_frames++); } /** Allocate a block from a bigger object. @param[in] buf a block that is free to use @param[in] i index of buf_pool.zip_free[] -@param[in] j size of buf as an index of buf_pool.zip_free[] @return allocated block */ -static -void* -buf_buddy_alloc_from(void* buf, ulint i, ulint j) +static void *buf_buddy_alloc_from(void *buf, ulint i) { - ulint offs = BUF_BUDDY_LOW << j; - ut_ad(j <= BUF_BUDDY_SIZES); ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); - ut_ad(j >= i); - ut_ad(!ut_align_offset(buf, offs)); + ut_ad(i <= BUF_BUDDY_SIZES); + ut_ad(!ut_align_offset(buf, srv_page_size)); + ut_ad(!buf_pool.contains_zip(buf, srv_page_size)); /* Add the unused parts of the block to the free lists. */ - while (j > i) { + for (ulint j = BUF_BUDDY_SIZES, offs = srv_page_size; j-- > i; ) { buf_buddy_free_t* zip_buf; offs >>= 1; - j--; zip_buf = reinterpret_cast( reinterpret_cast(buf) + offs); @@ -422,7 +406,7 @@ buf_buddy_alloc_from(void* buf, ulint i, ulint j) @param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -byte *buf_buddy_alloc_low(ulint i, bool *lru) +byte *buf_buddy_alloc_low(ulint i, bool *lru) noexcept { buf_block_t* block; @@ -439,7 +423,7 @@ byte *buf_buddy_alloc_low(ulint i, bool *lru) } /* Try allocating from the buf_pool.free list. */ - block = buf_LRU_get_free_only(); + block = buf_pool.allocate(); if (block) { goto alloc_big; @@ -455,21 +439,21 @@ alloc_big: buf_buddy_block_register(block); block = reinterpret_cast( - buf_buddy_alloc_from(block->page.frame, i, BUF_BUDDY_SIZES)); + buf_buddy_alloc_from(block->page.frame, i)); func_exit: buf_pool.buddy_stat[i].used++; return reinterpret_cast(block); } -/** Try to relocate a block. The caller must hold zip_free_mutex, and this -function will release and lock it again. +/** Try to relocate a block. @param[in] src block to relocate @param[in] dst free block to relocated to @param[in] i index of buf_pool.zip_free[] @param[in] force true if we must relocated always @return true if relocated */ -static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) +static bool buf_buddy_relocate(void *src, void *dst, ulint i, bool force) + noexcept { buf_page_t* bpage; const ulint size = BUF_BUDDY_LOW << i; @@ -575,7 +559,7 @@ static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] i index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -void buf_buddy_free_low(void* buf, ulint i) +void buf_buddy_free_low(void* buf, ulint i) noexcept { buf_buddy_free_t* buddy; @@ -595,13 +579,12 @@ recombine: ut_ad(i < BUF_BUDDY_SIZES); ut_ad(buf == ut_align_down(buf, BUF_BUDDY_LOW << i)); - ut_ad(!buf_pool.contains_zip(buf)); + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); /* Do not recombine blocks if there are few free blocks. We may waste up to 15360*max_len bytes to free blocks (1024 + 2048 + 4096 + 8192 = 15360) */ - if (UT_LIST_GET_LEN(buf_pool.zip_free[i]) < 16 - && !buf_pool.is_shrinking()) { + if (UT_LIST_GET_LEN(buf_pool.zip_free[i]) < 16) { goto func_exit; } @@ -615,10 +598,9 @@ recombine: /* The buddy is free: recombine */ buf_buddy_remove_from_free(buddy, i); buddy_is_free: - ut_ad(!buf_pool.contains_zip(buddy)); i++; buf = ut_align_down(buf, BUF_BUDDY_LOW << i); - + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); goto recombine; case BUF_BUDDY_STATE_USED: @@ -655,107 +637,125 @@ func_exit: buf_buddy_add_to_free(reinterpret_cast(buf), i); } -/** Try to reallocate a block. -@param[in] buf buf_pool block to be reallocated -@param[in] size block size, up to srv_page_size -@return whether the reallocation succeeded */ -bool -buf_buddy_realloc(void* buf, ulint size) +/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize(). +@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page +@param block uncompressed block for storage +@return block +@retval nullptr if the block was consumed */ +ATTRIBUTE_COLD +buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept { - buf_block_t* block = NULL; - ulint i = buf_buddy_get_slot(size); + ut_ad(bpage->zip.data); - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(i <= BUF_BUDDY_SIZES); - ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); + void *dst= nullptr; + ulint size= page_zip_get_size(&bpage->zip); + ulint i= buf_buddy_get_slot(size); - if (i < BUF_BUDDY_SIZES) { - /* Try to allocate from the buddy system. */ - block = reinterpret_cast(buf_buddy_alloc_zip(i)); - } + ut_ad(buf_pool.will_be_withdrawn(bpage->zip.data, size)); + ut_ad(bpage->can_relocate()); + ut_ad(i <= BUF_BUDDY_SIZES); + ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); - if (block == NULL) { - /* Try allocating from the buf_pool.free list. */ - block = buf_LRU_get_free_only(); + if (UNIV_LIKELY(i < BUF_BUDDY_SIZES)) + dst= buf_buddy_alloc_zip(i); - if (block == NULL) { - return(false); /* free_list was not enough */ - } + if (!dst) + { + buf_buddy_block_register(block); + dst= buf_buddy_alloc_from(block->page.frame, i); + ut_ad(dst); + block= nullptr; + } - buf_buddy_block_register(block); + void *src= bpage->zip.data; + memcpy_aligned(dst, src, size); + bpage->zip.data= static_cast(dst); + buf_pool.buddy_stat[i].relocated++; - block = reinterpret_cast( - buf_buddy_alloc_from( - block->page.frame, i, BUF_BUDDY_SIZES)); - } + for (;;) + { + MEM_UNDEFINED(src, BUF_BUDDY_LOW << i); + ut_ad(i < BUF_BUDDY_SIZES); + /* Try to combine adjacent blocks. */ + buf_buddy_free_t *buddy= reinterpret_cast + (buf_buddy_get(static_cast(src), BUF_BUDDY_LOW << i)); - buf_pool.buddy_stat[i].used++; + if (buf_buddy_is_free(buddy, i) != BUF_BUDDY_STATE_FREE) + { + ut_ad(!buf_pool.contains_zip(src, BUF_BUDDY_LOW_SHIFT + i)); + buf_buddy_add_to_free(static_cast(src), i); + break; + } - /* Try to relocate the buddy of buf to the free block. */ - if (buf_buddy_relocate(buf, block, i, true)) { - /* succeeded */ - buf_buddy_free_low(buf, i); - } else { - /* failed */ - buf_buddy_free_low(block, i); - } + /* The buddy is free: recombine */ + buf_buddy_remove_from_free(buddy, i); + i++; + src= ut_align_down(src, BUF_BUDDY_LOW << i); + if (i == BUF_BUDDY_SIZES) + { + buf_buddy_block_free(src); + break; + } + } - return(true); /* free_list was enough */ + return block; } -/** Combine all pairs of free buddies. */ -void buf_buddy_condense_free() +/** Combine all pairs of free buddies. +@param size the target innodb_buffer_pool_size */ +ATTRIBUTE_COLD void buf_buddy_condense_free(size_t size) noexcept { - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(buf_pool.is_shrinking()); + ut_ad(size); + ut_ad(size == buf_pool.shrinking_size()); - for (ulint i = 0; i < UT_ARR_SIZE(buf_pool.zip_free); ++i) { - buf_buddy_free_t* buf = - UT_LIST_GET_FIRST(buf_pool.zip_free[i]); + for (ulint i= 0; i < array_elements(buf_pool.zip_free); i++) + { + buf_buddy_free_t *buf= UT_LIST_GET_FIRST(buf_pool.zip_free[i]); - /* seek to withdraw target */ - while (buf != NULL - && !buf_pool.will_be_withdrawn( - reinterpret_cast(buf))) { - buf = UT_LIST_GET_NEXT(list, buf); - } + /* seek to withdraw target */ + while (buf && + !buf_pool.will_be_withdrawn(reinterpret_cast(buf), size)) + buf= UT_LIST_GET_NEXT(list, buf); - while (buf != NULL) { - buf_buddy_free_t* next = - UT_LIST_GET_NEXT(list, buf); + for (buf_buddy_free_t *next= buf; buf; buf= next) + { + buf_buddy_free_t *buddy= reinterpret_cast + (buf_buddy_get(reinterpret_cast(buf), BUF_BUDDY_LOW << i)); - buf_buddy_free_t* buddy = - reinterpret_cast( - buf_buddy_get( - reinterpret_cast(buf), - BUF_BUDDY_LOW << i)); + /* seek to the next withdraw target */ + do + { + while ((next= UT_LIST_GET_NEXT(list, next)) && + !buf_pool.will_be_withdrawn(reinterpret_cast(next), + size)) {} + } + while (buddy == next); - /* seek to the next withdraw target */ - while (true) { - while (next != NULL - && !buf_pool.will_be_withdrawn( - reinterpret_cast(next))) { - next = UT_LIST_GET_NEXT(list, next); - } + if (buf_buddy_is_free(buddy, i) != BUF_BUDDY_STATE_FREE) + continue; - if (buddy != next) { - break; - } + buf_buddy_remove_from_free(buf, i); + ulint j= i; + recombine: + buf_buddy_remove_from_free(buddy, j); + j++; + buf= static_cast + (ut_align_down(buf, BUF_BUDDY_LOW << j)); + MEM_UNDEFINED(buf, BUF_BUDDY_LOW << j); - next = UT_LIST_GET_NEXT(list, next); - } + if (j == BUF_BUDDY_SIZES) + { + buf_buddy_block_free(buf); + continue; + } - if (buf_buddy_is_free(buddy, i) - == BUF_BUDDY_STATE_FREE) { - /* Both buf and buddy are free. - Try to combine them. */ - buf_buddy_remove_from_free(buf, i); - buf_pool.buddy_stat[i].used++; + buddy= reinterpret_cast + (buf_buddy_get(reinterpret_cast(buf), BUF_BUDDY_LOW << j)); + if (buf_buddy_is_free(buddy, j) == BUF_BUDDY_STATE_FREE) + goto recombine; - buf_buddy_free_low(buf, i); - } - - buf = next; - } - } + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + j)); + buf_buddy_add_to_free(buf, j); + } + } } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 5d61b5f55c9..3fce60922b5 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -46,8 +46,6 @@ Created 11/5/1995 Heikki Tuuri #include "buf0dblwr.h" #include "lock0lock.h" #include "btr0sea.h" -#include "trx0undo.h" -#include "trx0purge.h" #include "log0log.h" #include "dict0stats_bg.h" #include "srv0srv.h" @@ -63,6 +61,7 @@ Created 11/5/1995 Heikki Tuuri #include #include #include "log.h" +#include "my_virtual_mem.h" using st_::span; @@ -276,6 +275,56 @@ the read requests for the whole area. */ #ifndef UNIV_INNOCHECKSUM +/** Compute the number of page frames needed for buf_block_t, +per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr uint8_t first_page(size_t ps) +{ + return uint8_t(innodb_buffer_pool_extent_size / ps - + innodb_buffer_pool_extent_size / (ps + sizeof(buf_block_t))); +} + +/** Compute the number of bytes needed for buf_block_t, +per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr size_t first_frame(size_t ps) +{ + return first_page(ps) * ps; +} + +/** Compute the number of pages per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr uint16_t pages(size_t ps) +{ + return uint16_t(innodb_buffer_pool_extent_size / ps - first_page(ps)); +} + +/** The byte offset of the first page frame in a buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr size_t first_frame_in_extent[]= +{ + first_frame(4096), first_frame(8192), first_frame(16384), + first_frame(32768), first_frame(65536) +}; + +/** The position offset of the first page frame in a buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr uint8_t first_page_in_extent[]= +{ + first_page(4096), first_page(8192), first_page(16384), + first_page(32768), first_page(65536) +}; + +/** Number of pages per buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr size_t pages_in_extent[]= +{ + pages(4096), pages(8192), pages(16384), pages(32768), pages(65536) +}; + # ifdef SUX_LOCK_GENERIC void page_hash_latch::read_lock_wait() noexcept { @@ -325,8 +374,6 @@ const byte *field_ref_zero; /** The InnoDB buffer pool */ buf_pool_t buf_pool; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_reg; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_ref; #ifdef UNIV_DEBUG /** This is used to insert validation operations in execution @@ -796,6 +843,11 @@ public: bool setup() { + m_num_fds= 0; + + if (my_use_large_pages) + return false; + static_assert(array_elements(m_fds) == (array_elements(m_triggers) + 1), "insufficient fds"); std::string memcgroup{"/sys/fs/cgroup"}; @@ -808,7 +860,6 @@ public: cgroup.erase(0, 3); // Remove "0::" memcgroup+= cgroup + "/memory.pressure"; - m_num_fds= 0; for (auto trig= std::begin(m_triggers); trig!= std::end(m_triggers); ++trig) { if ((m_fds[m_num_fds].fd= @@ -957,29 +1008,120 @@ void mem_pressure::pressure_routine(mem_pressure *m) } /** Initialize mem pressure. */ -ATTRIBUTE_COLD void buf_mem_pressure_detect_init() +ATTRIBUTE_COLD static void buf_mem_pressure_detect_init() noexcept { mem_pressure_obj.setup(); } -ATTRIBUTE_COLD void buf_mem_pressure_shutdown() +ATTRIBUTE_COLD void buf_mem_pressure_shutdown() noexcept { mem_pressure_obj.join(); } -#endif /* __linux__ */ +#endif + +#if defined __linux__ || !defined DBUG_OFF +inline void buf_pool_t::garbage_collect() noexcept +{ + mysql_mutex_lock(&mutex); + const size_t old_size{size_in_bytes}, min_size{size_in_bytes_auto_min}; + const size_t reduce_size= + std::max(innodb_buffer_pool_extent_size, + ut_calc_align((old_size - min_size) / 2, + innodb_buffer_pool_extent_size)); + if (old_size < min_size + reduce_size || + first_to_withdraw || old_size != size_in_bytes_requested) + { + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event disregarded;" + " innodb_buffer_pool_size=%zum," + " innodb_buffer_pool_size_min=%zum", + old_size >> 20, min_size >> 20); + return; + } + + size_t size= old_size - reduce_size; + size_t n_blocks_new= get_n_blocks(size); + + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); + + n_blocks_to_withdraw= n_blocks - n_blocks_new; + first_to_withdraw= &get_nth_page(n_blocks_new)->page; + + size_in_bytes_requested= size; + mysql_mutex_unlock(&mutex); + mysql_mutex_lock(&flush_list_mutex); + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); +# ifdef BTR_CUR_HASH_ADAPT + bool ahi_disabled= btr_search.disable(); +# endif /* BTR_CUR_HASH_ADAPT */ + time_t start= time(nullptr); + mysql_mutex_lock(&mutex); + + do + { + if (shrink(size)) + { + const size_t old_blocks{n_blocks}; + n_blocks= n_blocks_new; + + size_t s= n_blocks_new / BUF_READ_AHEAD_PORTION; + read_ahead_area= s >= READ_AHEAD_PAGES + ? READ_AHEAD_PAGES + : my_round_up_to_next_power(uint32(s)); + + os_total_large_mem_allocated-= reduce_size; + shrunk(size, reduce_size); +# ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search.enable(true); +# endif + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event shrunk" + " innodb_buffer_pool_size=%zum (%zu pages)" + " from %zum (%zu pages)", + size >> 20, n_blocks_new, old_size >> 20, + old_blocks); + ut_d(validate()); + return; + } + } + while (time(nullptr) - start < 15); + + ut_ad(size_in_bytes > size_in_bytes_requested); + n_blocks_to_withdraw= 0; + first_to_withdraw= nullptr; + size_in_bytes_requested= size_in_bytes; + + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) + { + UT_LIST_REMOVE(withdrawn, b); + UT_LIST_ADD_LAST(free, b); + ut_d(b->in_free_list= true); + ut_ad(b->state() == buf_page_t::NOT_USED); + b->lock.init(); + } + + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event failed to shrink" + " innodb_buffer_pool_size=%zum", old_size); + ut_d(validate()); +} +#endif #if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) -/** Enable buffers to be dumped to core files +/** Enable buffers to be dumped to core files. -A convience function, not called anyhwere directly however +A convenience function, not called anyhwere directly however it is left available for gdb or any debugger to call in the event that you want all of the memory to be dumped to a core file. -Returns number of errors found in madvise calls. */ +@return number of errors found in madvise() calls */ MY_ATTRIBUTE((used)) -int -buf_madvise_do_dump() +int buf_pool_t::madvise_do_dump() noexcept { int ret= 0; @@ -990,20 +1132,13 @@ buf_madvise_do_dump() MADV_DODUMP); } - mysql_mutex_lock(&buf_pool.mutex); - auto chunk = buf_pool.chunks; - - for (ulint n = buf_pool.n_chunks; n--; chunk++) { - ret+= madvise(chunk->mem, chunk->mem_size(), MADV_DODUMP); - } - - mysql_mutex_unlock(&buf_pool.mutex); + ret+= madvise(buf_pool.memory, buf_pool.size_in_bytes, MADV_DODUMP); return ret; } #endif #ifndef UNIV_DEBUG -static inline byte hex_to_ascii(byte hex_digit) +static inline byte hex_to_ascii(byte hex_digit) noexcept { const int offset= hex_digit <= 9 ? '0' : 'a' - 10; return byte(hex_digit + offset); @@ -1059,158 +1194,80 @@ static void buf_block_init_low(buf_block_t *block) noexcept inline void buf_block_init_low(buf_block_t*) {} #endif /* BTR_CUR_HASH_ADAPT */ -/** Initialize a buffer page descriptor. -@param[in,out] block buffer page descriptor -@param[in] frame buffer page frame */ -static -void -buf_block_init(buf_block_t* block, byte* frame) +IF_DBUG(,inline) byte *buf_block_t::frame_address() const noexcept { - /* This function should only be executed at database startup or by - buf_pool.resize(). Either way, adaptive hash index must not exist. */ - buf_block_init_low(block); - block->page.frame = frame; + static_assert(ut_is_2pow(innodb_buffer_pool_extent_size), ""); - MEM_MAKE_DEFINED(&block->modify_clock, sizeof block->modify_clock); - ut_ad(!block->modify_clock); - MEM_MAKE_DEFINED(&block->page.lock, sizeof block->page.lock); - block->page.lock.init(); - block->page.init(buf_page_t::NOT_USED, page_id_t(~0ULL)); - ut_d(block->in_unzip_LRU_list = false); - ut_d(block->in_withdraw_list = false); - - page_zip_des_init(&block->page.zip); - - MEM_MAKE_DEFINED(&block->page.hash, sizeof block->page.hash); - ut_ad(!block->page.hash); + byte *frame_= reinterpret_cast + ((reinterpret_cast(this) & ~(innodb_buffer_pool_extent_size - 1)) | + first_frame_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]); + ut_ad(reinterpret_cast(this) + sizeof(*this) <= frame_); + frame_+= + (((reinterpret_cast(this) & (innodb_buffer_pool_extent_size - 1)) / + sizeof(*this)) << srv_page_size_shift); + return frame_; } -/** Allocate a chunk of buffer frames. -@param bytes requested size -@return whether the allocation succeeded */ -inline bool buf_pool_t::chunk_t::create(size_t bytes) noexcept +buf_block_t *buf_pool_t::block_from(const void *ptr) noexcept { - DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return false;); - /* Round down to a multiple of page size, although it already should be. */ - bytes= ut_2pow_round(bytes, srv_page_size); + static_assert(ut_is_2pow(innodb_buffer_pool_extent_size), ""); + ut_ad(static_cast(ptr) >= buf_pool.memory); - mem= buf_pool.allocator.allocate_large_dontdump(bytes, &mem_pfx); + byte *first_block= reinterpret_cast + (reinterpret_cast(ptr) & ~(innodb_buffer_pool_extent_size - 1)); + const size_t first_frame= + first_frame_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; - if (UNIV_UNLIKELY(!mem)) - return false; - - MEM_UNDEFINED(mem, mem_size()); - -#ifdef HAVE_LIBNUMA - if (srv_numa_interleave) - { - struct bitmask *numa_mems_allowed= numa_get_mems_allowed(); - MEM_MAKE_DEFINED(numa_mems_allowed, sizeof *numa_mems_allowed); - if (mbind(mem, mem_size(), MPOL_INTERLEAVE, - numa_mems_allowed->maskp, numa_mems_allowed->size, - MPOL_MF_MOVE)) - { - ib::warn() << "Failed to set NUMA memory policy of" - " buffer pool page frames to MPOL_INTERLEAVE" - " (error: " << strerror(errno) << ")."; - } - numa_bitmask_free(numa_mems_allowed); - } -#endif /* HAVE_LIBNUMA */ - - - /* Allocate the block descriptors from - the start of the memory block. */ - blocks= reinterpret_cast(mem); - - /* Align a pointer to the first frame. Note that when - opt_large_page_size is smaller than srv_page_size, - (with max srv_page_size at 64k don't think any hardware - makes this true), - we may allocate one fewer block than requested. When - it is bigger, we may allocate more blocks than requested. */ - static_assert(sizeof(byte*) == sizeof(ulint), "pointer size"); - - byte *frame= reinterpret_cast((reinterpret_cast(mem) + - srv_page_size - 1) & - ~ulint{srv_page_size - 1}); - size= (mem_pfx.m_size >> srv_page_size_shift) - (frame != mem); - - /* Subtract the space needed for block descriptors. */ - { - ulint s= size; - - while (frame < reinterpret_cast(blocks + s)) - { - frame+= srv_page_size; - s--; - } - - size= s; - } - - /* Init block structs and assign frames for them. Then we assign the - frames to the first blocks (we already mapped the memory above). */ - - buf_block_t *block= blocks; - - for (auto i= size; i--; ) { - buf_block_init(block, frame); - MEM_UNDEFINED(block->page.frame, srv_page_size); - /* Add the block to the free list */ - UT_LIST_ADD_LAST(buf_pool.free, &block->page); - - ut_d(block->page.in_free_list = TRUE); - block++; - frame+= srv_page_size; - } - - reg(); - - return true; + ut_ad(static_cast(ptr) >= first_block + first_frame); + return reinterpret_cast(first_block) + + (((size_t(ptr) & (innodb_buffer_pool_extent_size - 1)) - first_frame) >> + srv_page_size_shift); } -#ifdef UNIV_DEBUG -/** Check that all file pages in the buffer chunk are in a replaceable state. -@return address of a non-free block -@retval nullptr if all freed */ -inline const buf_block_t *buf_pool_t::chunk_t::not_freed() const noexcept +/** Determine the address of the first invalid block descriptor +@param n_blocks buf_pool.n_blocks +@return offset of the first invalid buf_block_t, relative to buf_pool.memory */ +static size_t block_descriptors_in_bytes(size_t n_blocks) noexcept { - buf_block_t *block= blocks; - for (auto i= size; i--; block++) + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + const size_t extent_size= pages_in_extent[ssize]; + return n_blocks / extent_size * innodb_buffer_pool_extent_size + + (n_blocks % extent_size) * sizeof(buf_block_t); +} + +buf_block_t *buf_pool_t::get_nth_page(size_t pos) const noexcept +{ + mysql_mutex_assert_owner(&mutex); + ut_ad(pos < n_blocks); + return reinterpret_cast + (memory + block_descriptors_in_bytes(pos)); +} + +buf_block_t *buf_pool_t::allocate() noexcept +{ + mysql_mutex_assert_owner(&mutex); + + while (buf_page_t *b= UT_LIST_GET_FIRST(free)) { - if (block->page.in_file()) + ut_ad(b->in_free_list); + ut_d(b->in_free_list = FALSE); + ut_ad(!b->oldest_modification()); + ut_ad(!b->in_LRU_list); + ut_a(!b->in_file()); + UT_LIST_REMOVE(free, b); + + if (UNIV_LIKELY(!n_blocks_to_withdraw) || !withdraw(*b)) { - /* The uncompressed buffer pool should never - contain ROW_FORMAT=COMPRESSED block descriptors. */ - ut_ad(block->page.frame); - const lsn_t lsn= block->page.oldest_modification(); - - if (srv_read_only_mode) - { - /* The page cleaner is disabled in read-only mode. No pages - can be dirtied, so all of them must be clean. */ - ut_ad(lsn == 0 || lsn == recv_sys.lsn || - srv_force_recovery == SRV_FORCE_NO_LOG_REDO); - break; - } - - if (fsp_is_system_temporary(block->page.id().space())) - { - ut_ad(lsn == 0 || lsn == 2); - break; - } - - if (lsn > 1 || !block->page.can_relocate()) - return block; - - break; + /* No adaptive hash index entries may point to a free block. */ + assert_block_ahi_empty(reinterpret_cast(b)); + b->set_state(buf_page_t::MEMORY); + b->set_os_used(); + return reinterpret_cast(b); } } return nullptr; } -#endif /* UNIV_DEBUG */ /** Create the hash table. @param n the lower bound of n_cells */ @@ -1224,96 +1281,181 @@ void buf_pool_t::page_hash_table::create(ulint n) noexcept array= static_cast(v); } +size_t buf_pool_t::get_n_blocks(size_t size_in_bytes) noexcept +{ + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + size_t n_blocks_alloc= size_in_bytes / innodb_buffer_pool_extent_size * + pages_in_extent[ssize]; + + if (const size_t incomplete_extent_pages= + (size_in_bytes & (innodb_buffer_pool_extent_size - 1)) >> + srv_page_size_shift) + { + ssize_t d= incomplete_extent_pages - first_page_in_extent[ssize]; + ut_ad(d > 0); + n_blocks_alloc+= d; + } + + return n_blocks_alloc; +} + +size_t buf_pool_t::blocks_in_bytes(size_t n_blocks) noexcept +{ + const size_t shift{srv_page_size_shift}; + const size_t ssize{shift - UNIV_PAGE_SIZE_SHIFT_MIN}; + const size_t extent_size= pages_in_extent[ssize]; + size_t size_in_bytes= n_blocks / extent_size * + innodb_buffer_pool_extent_size; + if (size_t remainder= n_blocks % extent_size) + size_in_bytes+= (remainder + first_page_in_extent[ssize]) << shift; + ut_ad(get_n_blocks(size_in_bytes) == n_blocks); + return size_in_bytes; +} + /** Create the buffer pool. @return whether the creation failed */ -bool buf_pool_t::create() +bool buf_pool_t::create() noexcept { ut_ad(this == &buf_pool); - ut_ad(srv_buf_pool_size % srv_buf_pool_chunk_unit == 0); ut_ad(!is_initialised()); - ut_ad(srv_buf_pool_size > 0); - ut_ad(!resizing); - ut_ad(!chunks_old); + ut_ad(size_in_bytes_requested > 0); + ut_ad(!(size_in_bytes_max & (innodb_buffer_pool_extent_size - 1))); + ut_ad(!(size_in_bytes_requested & ((1U << 20) - 1))); + ut_ad(size_in_bytes_requested <= size_in_bytes_max); /* mariabackup loads tablespaces, and it requires field_ref_zero to be allocated before innodb initialization */ ut_ad(srv_operation >= SRV_OPERATION_RESTORE || !field_ref_zero); - NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - - if (!field_ref_zero) { + if (!field_ref_zero) + { if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) + { field_ref_zero= static_cast (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - else - return true; - } - - chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map()); - - new(&allocator) ut_allocator(mem_key_buf_buf_pool); - - n_chunks= srv_buf_pool_size / srv_buf_pool_chunk_unit; - const size_t chunk_size= srv_buf_pool_chunk_unit; - - chunks= static_cast(ut_zalloc_nokey(n_chunks * sizeof *chunks)); - UT_LIST_INIT(free, &buf_page_t::list); - curr_size= 0; - auto chunk= chunks; - - do - { - if (!chunk->create(chunk_size)) - { - while (--chunk >= chunks) - { - buf_block_t* block= chunk->blocks; - - for (auto i= chunk->size; i--; block++) - block->page.lock.free(); - - allocator.deallocate_large_dodump(chunk->mem, &chunk->mem_pfx); - } - ut_free(chunks); - chunks= nullptr; - UT_DELETE(chunk_t::map_reg); - chunk_t::map_reg= nullptr; - aligned_free(const_cast(field_ref_zero)); - field_ref_zero= nullptr; - ut_ad(!is_initialised()); - return true; + goto init; } - curr_size+= chunk->size; + oom: + ut_ad(!is_initialised()); + sql_print_error("InnoDB: Cannot map innodb_buffer_pool_size_max=%zum", + size_in_bytes_max >> 20); + return true; + } + + init: + DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", goto oom;); + size_t size= size_in_bytes_max; + sql_print_information("InnoDB: innodb_buffer_pool_size_max=%zum," + " innodb_buffer_pool_size=%zum", + size >> 20, size_in_bytes_requested >> 20); + + retry: + { + NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; + memory_unaligned= my_virtual_mem_reserve(&size); + } + + if (!memory_unaligned) + goto oom; + + const size_t alignment_waste= + ((~size_t(memory_unaligned) & (innodb_buffer_pool_extent_size - 1)) + 1) & + (innodb_buffer_pool_extent_size - 1); + + if (size < size_in_bytes_max + alignment_waste) + { + my_virtual_mem_release(memory_unaligned, size); + size+= 1 + + (~size_t(memory_unaligned) & (innodb_buffer_pool_extent_size - 1)); + goto retry; + } + + MEM_UNDEFINED(memory_unaligned, size); + ut_dontdump(memory_unaligned, size, true); + memory= memory_unaligned + alignment_waste; + size_unaligned= size; + size-= alignment_waste; + size&= ~(innodb_buffer_pool_extent_size - 1); + + const size_t actual_size= size_in_bytes_requested; + ut_ad(actual_size <= size); + + size_in_bytes= actual_size; + os_total_large_mem_allocated+= actual_size; + +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_alloc)(mem_key_buf_buf_pool, actual_size, &owner); +#endif + if (!my_virtual_mem_commit(memory, actual_size)) + { + my_virtual_mem_release(memory_unaligned, size_unaligned); + memory= nullptr; + memory_unaligned= nullptr; + goto oom; + } + +#ifdef HAVE_LIBNUMA + if (srv_numa_interleave) + { + struct bitmask *numa_mems_allowed= numa_get_mems_allowed(); + MEM_MAKE_DEFINED(numa_mems_allowed, sizeof *numa_mems_allowed); + if (mbind(memory_unaligned, size_unaligned, MPOL_INTERLEAVE, + numa_mems_allowed->maskp, numa_mems_allowed->size, + MPOL_MF_MOVE)) + sql_print_warning("InnoDB: Failed to set NUMA memory policy of" + " buffer pool page frames to MPOL_INTERLEAVE" + " (error: %s).", strerror(errno)); + numa_bitmask_free(numa_mems_allowed); + } +#endif /* HAVE_LIBNUMA */ + + n_blocks= get_n_blocks(actual_size); + n_blocks_to_withdraw= 0; + UT_LIST_INIT(free, &buf_page_t::list); + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + { + buf_block_t *block= reinterpret_cast(extent); + const buf_block_t *extent_end= block + pages_in_extent[ssize]; + if (reinterpret_cast(extent_end) > end) + extent_end= reinterpret_cast(end); + MEM_MAKE_DEFINED(block, (extent_end - block) * sizeof *block); + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize]; + block < extent_end; block++, frame+= srv_page_size) + { + ut_ad(!memcmp(block, field_ref_zero, sizeof *block)); + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } } - while (++chunk < chunks + n_chunks); - ut_ad(is_initialised()); #if defined(__aarch64__) mysql_mutex_init(buf_pool_mutex_key, &mutex, MY_MUTEX_INIT_FAST); #else mysql_mutex_init(buf_pool_mutex_key, &mutex, nullptr); #endif + UT_LIST_INIT(withdrawn, &buf_page_t::list); UT_LIST_INIT(LRU, &buf_page_t::LRU); - UT_LIST_INIT(withdraw, &buf_page_t::list); - withdraw_target= 0; UT_LIST_INIT(flush_list, &buf_page_t::list); UT_LIST_INIT(unzip_LRU, &buf_block_t::unzip_LRU); for (size_t i= 0; i < UT_ARR_SIZE(zip_free); ++i) UT_LIST_INIT(zip_free[i], &buf_buddy_free_t::list); - ulint s= curr_size; + ulint s= n_blocks; s/= BUF_READ_AHEAD_PORTION; read_ahead_area= s >= READ_AHEAD_PAGES ? READ_AHEAD_PAGES : my_round_up_to_next_power(static_cast(s)); - curr_pool_size= srv_buf_pool_size; - n_chunks_new= n_chunks; - - page_hash.create(2 * curr_size); - zip_hash.create(2 * curr_size); - last_printout_time= time(NULL); + page_hash.create(2 * n_blocks); + last_printout_time= time(nullptr); mysql_mutex_init(flush_list_mutex_key, &flush_list_mutex, MY_MUTEX_INIT_FAST); @@ -1332,14 +1474,8 @@ bool buf_pool_t::create() io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) * OS_AIO_N_PENDING_IOS_PER_THREAD); - /* FIXME: remove some of these variables */ - srv_buf_pool_curr_size= curr_pool_size; - srv_buf_pool_old_size= srv_buf_pool_size; - srv_buf_pool_base_size= srv_buf_pool_size; - last_activity_count= srv_get_activity_count(); - chunk_t::map_ref= chunk_t::map_reg; buf_LRU_old_ratio_update(100 * 3 / 8, false); btr_search_sys_create(); @@ -1348,6 +1484,7 @@ bool buf_pool_t::create() buf_mem_pressure_detect_init(); #endif ut_ad(is_initialised()); + sql_print_information("InnoDB: Completed initialization of buffer pool"); return false; } @@ -1382,14 +1519,31 @@ void buf_pool_t::close() noexcept } } - for (auto chunk= chunks + n_chunks; --chunk >= chunks; ) { - buf_block_t *block= chunk->blocks; + const size_t size{size_in_bytes}; - for (auto i= chunk->size; i--; block++) - block->page.lock.free(); + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + MEM_MAKE_DEFINED(&block->page.lock, sizeof &block->page.lock); + block->page.lock.free(); + } - allocator.deallocate_large_dodump(chunk->mem, &chunk->mem_pfx); + ut_dodump(memory_unaligned, size_unaligned); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_free)(mem_key_buf_buf_pool, size, owner); + owner= nullptr; +#endif + os_total_large_mem_allocated-= size; + my_virtual_mem_decommit(memory, size); + my_virtual_mem_release(memory_unaligned, size_unaligned); + memory= nullptr; + memory_unaligned= nullptr; } pthread_cond_destroy(&done_flush_LRU); @@ -1397,125 +1551,13 @@ void buf_pool_t::close() noexcept pthread_cond_destroy(&do_flush_list); pthread_cond_destroy(&done_free); - ut_free(chunks); - chunks= nullptr; page_hash.free(); - zip_hash.free(); io_buf.close(); - UT_DELETE(chunk_t::map_reg); - chunk_t::map_reg= chunk_t::map_ref= nullptr; aligned_free(const_cast(field_ref_zero)); field_ref_zero= nullptr; } -/** Try to reallocate a control block. -@param block control block to reallocate -@return whether the reallocation succeeded */ -inline bool buf_pool_t::realloc(buf_block_t *block) noexcept -{ - buf_block_t* new_block; - - mysql_mutex_assert_owner(&mutex); - ut_ad(block->page.in_file()); - ut_ad(block->page.frame); - - new_block = buf_LRU_get_free_only(); - - if (new_block == NULL) { - mysql_mutex_lock(&buf_pool.flush_list_mutex); - page_cleaner_wakeup(); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - return(false); /* free list was not enough */ - } - - const page_id_t id{block->page.id()}; - hash_chain& chain = page_hash.cell_get(id.fold()); - page_hash_latch& hash_lock = page_hash.lock_get(chain); - /* It does not make sense to use transactional_lock_guard - here, because copying innodb_page_size (4096 to 65536) bytes - as well as other changes would likely make the memory - transaction too large. */ - hash_lock.lock(); - - if (block->page.can_relocate()) { - memcpy_aligned( - new_block->page.frame, block->page.frame, - srv_page_size); - mysql_mutex_lock(&buf_pool.flush_list_mutex); - const auto frame = new_block->page.frame; - new_block->page.lock.free(); - new (&new_block->page) buf_page_t(block->page); - new_block->page.frame = frame; - - /* relocate LRU list */ - if (buf_page_t* prev_b = buf_pool.LRU_remove(&block->page)) { - UT_LIST_INSERT_AFTER(LRU, prev_b, &new_block->page); - } else { - UT_LIST_ADD_FIRST(LRU, &new_block->page); - } - - if (LRU_old == &block->page) { - LRU_old = &new_block->page; - } - - ut_ad(new_block->page.in_LRU_list); - - /* relocate unzip_LRU list */ - if (block->page.zip.data != NULL) { - ut_ad(block->in_unzip_LRU_list); - ut_d(new_block->in_unzip_LRU_list = true); - - buf_block_t* prev_block = UT_LIST_GET_PREV(unzip_LRU, block); - UT_LIST_REMOVE(unzip_LRU, block); - - ut_d(block->in_unzip_LRU_list = false); - block->page.zip.data = NULL; - page_zip_set_size(&block->page.zip, 0); - - if (prev_block != NULL) { - UT_LIST_INSERT_AFTER(unzip_LRU, prev_block, new_block); - } else { - UT_LIST_ADD_FIRST(unzip_LRU, new_block); - } - } else { - ut_ad(!block->in_unzip_LRU_list); - ut_d(new_block->in_unzip_LRU_list = false); - } - - /* relocate page_hash */ - hash_chain& chain = page_hash.cell_get(id.fold()); - ut_ad(&block->page == page_hash.get(id, chain)); - buf_pool.page_hash.replace(chain, &block->page, - &new_block->page); - buf_block_modify_clock_inc(block); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - memset_aligned<4>(block->page.frame - + FIL_PAGE_OFFSET, 0xff, 4); - static_assert(FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID % 4 == 2, - "not perfect alignment"); - memset_aligned<2>(block->page.frame - + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4); - MEM_UNDEFINED(block->page.frame, srv_page_size); - block->page.set_state(buf_page_t::REMOVE_HASH); - if (!fsp_is_system_temporary(id.space())) { - buf_flush_relocate_on_flush_list(&block->page, - &new_block->page); - } - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - block->page.set_corrupt_id(); - - buf_block_init_low(new_block); - ut_d(block->page.set_state(buf_page_t::MEMORY)); - /* free block */ - new_block = block; - } - - hash_lock.unlock(); - buf_LRU_block_free_non_file_page(new_block); - return(true); /* free_list was enough */ -} - void buf_pool_t::io_buf_t::create(ulint n_slots) noexcept { this->n_slots= n_slots; @@ -1554,717 +1596,523 @@ buf_tmp_buffer_t *buf_pool_t::io_buf_t::reserve(bool wait_for_reads) noexcept } } -/** Sets the global variable that feeds MySQL's innodb_buffer_pool_resize_status -to the specified string. The format and the following parameters are the -same as the ones used for printf(3). -@param[in] fmt format -@param[in] ... extra parameters according to fmt */ -static -void -buf_resize_status( - const char* fmt, - ...) +ATTRIBUTE_COLD bool buf_pool_t::withdraw(buf_page_t &bpage) noexcept { - va_list ap; - - va_start(ap, fmt); - - vsnprintf( - export_vars.innodb_buffer_pool_resize_status, - sizeof(export_vars.innodb_buffer_pool_resize_status), - fmt, ap); - - va_end(ap); - - ib::info() << export_vars.innodb_buffer_pool_resize_status; + mysql_mutex_assert_owner(&mutex); + ut_ad(n_blocks_to_withdraw); + ut_ad(first_to_withdraw); + ut_ad(!bpage.zip.data); + if (&bpage < first_to_withdraw) + return false; + n_blocks_to_withdraw--; + bpage.lock.free(); + UT_LIST_ADD_LAST(withdrawn, &bpage); + return true; } -/** Withdraw blocks from the buffer pool until meeting withdraw_target. -@return whether retry is needed */ -inline bool buf_pool_t::withdraw_blocks() noexcept +ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size) + noexcept { - buf_block_t* block; - ulint loop_count = 0; + mysql_mutex_assert_owner(&mutex); + buf_load_abort(); - ib::info() << "Start to withdraw the last " - << withdraw_target << " blocks."; - - while (UT_LIST_GET_LEN(withdraw) < withdraw_target) { - - /* try to withdraw from free_list */ - ulint count1 = 0; - - mysql_mutex_lock(&mutex); - buf_buddy_condense_free(); - block = reinterpret_cast( - UT_LIST_GET_FIRST(free)); - while (block != NULL - && UT_LIST_GET_LEN(withdraw) < withdraw_target) { - ut_ad(block->page.in_free_list); - ut_ad(!block->page.oldest_modification()); - ut_ad(!block->page.in_LRU_list); - ut_a(!block->page.in_file()); - - buf_block_t* next_block; - next_block = reinterpret_cast( - UT_LIST_GET_NEXT( - list, &block->page)); - - if (will_be_withdrawn(block->page)) { - /* This should be withdrawn */ - UT_LIST_REMOVE(free, &block->page); - UT_LIST_ADD_LAST(withdraw, &block->page); - ut_d(block->in_withdraw_list = true); - count1++; - } - - block = next_block; - } - - /* reserve free_list length */ - if (UT_LIST_GET_LEN(withdraw) < withdraw_target) { - try_LRU_scan = false; - mysql_mutex_unlock(&mutex); - mysql_mutex_lock(&flush_list_mutex); - page_cleaner_wakeup(true); - my_cond_wait(&done_flush_list, - &flush_list_mutex.m_mutex); - mysql_mutex_unlock(&flush_list_mutex); - mysql_mutex_lock(&mutex); - } - - /* relocate blocks/buddies in withdrawn area */ - ulint count2 = 0; - - buf_pool_mutex_exit_forbid(); - for (buf_page_t* bpage = UT_LIST_GET_FIRST(LRU), *next_bpage; - bpage; bpage = next_bpage) { - ut_ad(bpage->in_file()); - next_bpage = UT_LIST_GET_NEXT(LRU, bpage); - if (UNIV_LIKELY_NULL(bpage->zip.data) - && will_be_withdrawn(bpage->zip.data) - && bpage->can_relocate()) { - if (!buf_buddy_realloc( - bpage->zip.data, - page_zip_get_size(&bpage->zip))) { - /* failed to allocate block */ - break; - } - count2++; - if (bpage->frame) { - goto realloc_frame; - } - } - - if (bpage->frame && will_be_withdrawn(*bpage) - && bpage->can_relocate()) { -realloc_frame: - if (!realloc(reinterpret_cast( - bpage))) { - /* failed to allocate block */ - break; - } - count2++; - } - } - buf_pool_mutex_exit_allow(); - mysql_mutex_unlock(&mutex); - - buf_resize_status( - "Withdrawing blocks. (" ULINTPF "/" ULINTPF ").", - UT_LIST_GET_LEN(withdraw), - withdraw_target); - - ib::info() << "Withdrew " - << count1 << " blocks from free list." - << " Tried to relocate " << count2 << " blocks (" - << UT_LIST_GET_LEN(withdraw) << "/" - << withdraw_target << ")."; - - if (++loop_count >= 10) { - /* give up for now. - retried after user threads paused. */ - - ib::info() << "will retry to withdraw later"; - - /* need retry later */ - return(true); - } - } - - /* confirm withdrawn enough */ - for (const chunk_t* chunk = chunks + n_chunks_new, - * const echunk = chunks + n_chunks; chunk != echunk; chunk++) { - block = chunk->blocks; - for (ulint j = chunk->size; j--; block++) { - ut_a(block->page.state() == buf_page_t::NOT_USED); - ut_ad(block->in_withdraw_list); - } - } - - ib::info() << "Withdrawn target: " << UT_LIST_GET_LEN(withdraw) - << " blocks."; - - return(false); -} - - - -inline void buf_pool_t::page_hash_table::write_lock_all() noexcept -{ - for (auto n= pad(n_cells) & ~ELEMENTS_PER_LATCH;; n-= ELEMENTS_PER_LATCH + 1) + if (!n_blocks_to_withdraw) { - reinterpret_cast(array[n]).lock(); - if (!n) - break; - } -} - - -inline void buf_pool_t::page_hash_table::write_unlock_all() noexcept -{ - for (auto n= pad(n_cells) & ~ELEMENTS_PER_LATCH;; n-= ELEMENTS_PER_LATCH + 1) - { - reinterpret_cast(array[n]).unlock(); - if (!n) - break; - } -} - - -namespace -{ - -struct find_interesting_trx -{ - void operator()(const trx_t &trx) - { - if (!trx.is_started()) - return; - if (trx.mysql_thd == nullptr) - return; - if (withdraw_started <= trx.start_time_micro) - return; - - if (!found) + withdraw_done: + first_to_withdraw= nullptr; + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) { - sql_print_warning("InnoDB: The following trx might hold " - "the blocks in buffer pool to " - "be withdrawn. Buffer pool " - "resizing can complete only " - "after all the transactions " - "below release the blocks."); - found= true; + UT_LIST_REMOVE(withdrawn, b); + /* satisfy the check in lazy_allocate() */ + ut_d(memset((void*) b, 0, sizeof(buf_block_t))); } - - lock_trx_print_wait_and_mvcc_state(stderr, &trx, current_time); + return SHRINK_DONE; } - bool &found; - /** microsecond_interval_timer() */ - const ulonglong withdraw_started; - const my_hrtime_t current_time; -}; + buf_buddy_condense_free(size); -} // namespace - -/** Resize from srv_buf_pool_old_size to srv_buf_pool_size. */ -inline void buf_pool_t::resize() -{ - ut_ad(this == &buf_pool); - ut_ad(srv_shutdown_state < SRV_SHUTDOWN_CLEANUP); - - bool warning = false; - - NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - - ut_ad(!resize_in_progress()); - ut_ad(srv_buf_pool_chunk_unit > 0); - - ulint new_instance_size = srv_buf_pool_size >> srv_page_size_shift; - std::ostringstream str_old_size, str_new_size, str_chunk_size; - str_old_size << ib::bytes_iec{srv_buf_pool_old_size}; - str_new_size << ib::bytes_iec{srv_buf_pool_size}; - str_chunk_size << ib::bytes_iec{srv_buf_pool_chunk_unit}; - - buf_resize_status("Resizing buffer pool from %s to %s (unit = %s).", - str_old_size.str().c_str(), - str_new_size.str().c_str(), - str_chunk_size.str().c_str()); - -#ifdef BTR_CUR_HASH_ADAPT - /* disable AHI if needed */ - buf_resize_status("Disabling adaptive hash index."); - - const bool btr_search_disabled = btr_search.enabled; - - btr_search.disable(); - - if (btr_search_disabled) { - ib::info() << "disabled adaptive hash index."; - } -#endif /* BTR_CUR_HASH_ADAPT */ - - mysql_mutex_lock(&mutex); - ut_ad(n_chunks_new == n_chunks); - ut_ad(UT_LIST_GET_LEN(withdraw) == 0); - - n_chunks_new = (new_instance_size << srv_page_size_shift) - / srv_buf_pool_chunk_unit; - curr_size = n_chunks_new * chunks->size; - mysql_mutex_unlock(&mutex); - - if (is_shrinking()) { - /* set withdraw target */ - size_t w = 0; - - for (const chunk_t* chunk = chunks + n_chunks_new, - * const echunk = chunks + n_chunks; - chunk != echunk; chunk++) - w += chunk->size; - - ut_ad(withdraw_target == 0); - withdraw_target = w; - } - - buf_resize_status("Withdrawing blocks to be shrunken."); - - ulonglong withdraw_started = microsecond_interval_timer(); - ulonglong message_interval = 60ULL * 1000 * 1000; - ulint retry_interval = 1; - -withdraw_retry: - /* wait for the number of blocks fit to the new size (if needed)*/ - bool should_retry_withdraw = is_shrinking() - && withdraw_blocks(); - - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { - /* abort to resize for shutdown. */ - return; - } - - /* abort buffer pool load */ - buf_load_abort(); - - const ulonglong current_time = microsecond_interval_timer(); - - if (should_retry_withdraw - && current_time - withdraw_started >= message_interval) { - - if (message_interval > 900000000) { - message_interval = 1800000000; - } else { - message_interval *= 2; - } - - bool found= false; - find_interesting_trx f - {found, withdraw_started, my_hrtime_coarse()}; - withdraw_started = current_time; - - /* This is going to exceed the maximum size of a - memory transaction. */ - LockMutexGuard g{SRW_LOCK_CALL}; - trx_sys.trx_list.for_each(f); - } - - if (should_retry_withdraw) { - ib::info() << "Will retry to withdraw " << retry_interval - << " seconds later."; - std::this_thread::sleep_for( - std::chrono::seconds(retry_interval)); - - if (retry_interval > 5) { - retry_interval = 10; - } else { - retry_interval *= 2; - } - - goto withdraw_retry; - } - - buf_resize_status("Latching entire buffer pool."); - -#ifndef DBUG_OFF - { - bool should_wait = true; - - while (should_wait) { - should_wait = false; - DBUG_EXECUTE_IF( - "ib_buf_pool_resize_wait_before_resize", - should_wait = true; - std::this_thread::sleep_for( - std::chrono::milliseconds(10));); - } - } -#endif /* !DBUG_OFF */ - - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { - return; - } - - /* Indicate critical path */ - resizing.store(true, std::memory_order_relaxed); - - mysql_mutex_lock(&mutex); - page_hash.write_lock_all(); - - chunk_t::map_reg = UT_NEW_NOKEY(chunk_t::map()); - - /* add/delete chunks */ - - buf_resize_status("Resizing buffer pool from " - ULINTPF " chunks to " ULINTPF " chunks.", - n_chunks, n_chunks_new); - - if (is_shrinking()) { - /* delete chunks */ - chunk_t* chunk = chunks + n_chunks_new; - const chunk_t* const echunk = chunks + n_chunks; - - ulint sum_freed = 0; - - while (chunk < echunk) { - /* buf_LRU_block_free_non_file_page() invokes - MEM_NOACCESS() on any buf_pool.free blocks. - We must cancel the effect of that. In - MemorySanitizer, MEM_NOACCESS() is no-op, so - we must not do anything special for it here. */ -#ifdef HAVE_valgrind -# if !__has_feature(memory_sanitizer) - MEM_MAKE_DEFINED(chunk->mem, chunk->mem_size()); -# endif -#else - MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->size); -#endif - - buf_block_t* block = chunk->blocks; - - for (ulint j = chunk->size; j--; block++) { - block->page.lock.free(); - } - - allocator.deallocate_large_dodump( - chunk->mem, &chunk->mem_pfx); - sum_freed += chunk->size; - ++chunk; - } - - /* discard withdraw list */ - UT_LIST_INIT(withdraw, &buf_page_t::list); - withdraw_target = 0; - - ib::info() << n_chunks - n_chunks_new - << " Chunks (" << sum_freed - << " blocks) were freed."; - - n_chunks = n_chunks_new; - } - - { - /* reallocate chunks */ - const size_t new_chunks_size - = n_chunks_new * sizeof(chunk_t); - - chunk_t* new_chunks = static_cast( - ut_zalloc_nokey_nofatal(new_chunks_size)); - - DBUG_EXECUTE_IF("buf_pool_resize_chunk_null", - ut_free(new_chunks); new_chunks= nullptr; ); - - if (!new_chunks) { - ib::error() << "failed to allocate" - " the chunk array."; - n_chunks_new = n_chunks; - warning = true; - chunks_old = NULL; - goto calc_buf_pool_size; - } - - ulint n_chunks_copy = ut_min(n_chunks_new, n_chunks); - - memcpy(new_chunks, chunks, - n_chunks_copy * sizeof *new_chunks); - - for (ulint j = 0; j < n_chunks_copy; j++) { - new_chunks[j].reg(); - } - - chunks_old = chunks; - chunks = new_chunks; - } - - if (n_chunks_new > n_chunks) { - /* add chunks */ - ulint sum_added = 0; - ulint n = n_chunks; - const size_t unit = srv_buf_pool_chunk_unit; - - for (chunk_t* chunk = chunks + n_chunks, - * const echunk = chunks + n_chunks_new; - chunk != echunk; chunk++) { - if (!chunk->create(unit)) { - ib::error() << "failed to allocate" - " memory for buffer pool chunk"; - - warning = true; - n_chunks_new = n_chunks; - break; - } - - sum_added += chunk->size; - ++n; - } - - ib::info() << n_chunks_new - n_chunks - << " chunks (" << sum_added - << " blocks) were added."; - - n_chunks = n; - } -calc_buf_pool_size: - /* recalc curr_size */ - ulint new_size = 0; - - { - chunk_t* chunk = chunks; - const chunk_t* const echunk = chunk + n_chunks; - do { - new_size += chunk->size; - } while (++chunk != echunk); - } - - curr_size = new_size; - n_chunks_new = n_chunks; - - if (chunks_old) { - ut_free(chunks_old); - chunks_old = NULL; - } - - chunk_t::map* chunk_map_old = chunk_t::map_ref; - chunk_t::map_ref = chunk_t::map_reg; - - /* set size */ - ut_ad(UT_LIST_GET_LEN(withdraw) == 0); - ulint s= curr_size; - s/= BUF_READ_AHEAD_PORTION; - read_ahead_area= s >= READ_AHEAD_PAGES - ? READ_AHEAD_PAGES - : my_round_up_to_next_power(static_cast(s)); - curr_pool_size= n_chunks * srv_buf_pool_chunk_unit; - srv_buf_pool_curr_size= curr_pool_size;/* FIXME: remove*/ - extern ulonglong innobase_buffer_pool_size; - innobase_buffer_pool_size= buf_pool_size_align(srv_buf_pool_curr_size); - - const bool new_size_too_diff - = srv_buf_pool_base_size > srv_buf_pool_size * 2 - || srv_buf_pool_base_size * 2 < srv_buf_pool_size; - - mysql_mutex_unlock(&mutex); - page_hash.write_unlock_all(); - - UT_DELETE(chunk_map_old); - - resizing.store(false, std::memory_order_relaxed); - - /* Normalize other components, if the new size is too different */ - if (!warning && new_size_too_diff) { - srv_buf_pool_base_size = srv_buf_pool_size; - - buf_resize_status("Resizing other hash tables."); - - srv_lock_table_size = 5 - * (srv_buf_pool_size >> srv_page_size_shift); - lock_sys.resize(srv_lock_table_size); - dict_sys.resize(); - - ib::info() << "Resized hash tables: lock_sys," -#ifdef BTR_CUR_HASH_ADAPT - " adaptive hash index," -#endif /* BTR_CUR_HASH_ADAPT */ - " and dictionary."; - } - - if (srv_buf_pool_old_size != srv_buf_pool_size) { - std::ostringstream sout; - sout << "Completed resizing buffer pool from " - << srv_buf_pool_old_size << " to " - << srv_buf_pool_size <<" bytes."; - srv_buf_pool_old_size = srv_buf_pool_size; - buf_resize_status(sout.str().c_str()); - } - -#ifdef BTR_CUR_HASH_ADAPT - /* enable AHI if needed */ - if (btr_search_disabled) { - btr_search.enable(true); - ib::info() << "Re-enabled adaptive hash index."; - } -#endif /* BTR_CUR_HASH_ADAPT */ - - if (warning) - buf_resize_status("Resizing buffer pool failed"); - - ut_d(validate()); - - return; -} - -#ifdef __linux__ -inline void buf_pool_t::garbage_collect() -{ - mysql_mutex_lock(&mutex); - size_t freed= 0; - -#ifdef BTR_CUR_HASH_ADAPT - /* buf_LRU_free_page() will temporarily release and reacquire - buf_pool.mutex for invoking btr_search_drop_page_hash_index(). Thus, - we must protect ourselves with the hazard pointer. */ -rescan: -#else - lru_hp.set(nullptr); -#endif - for (buf_page_t *bpage= UT_LIST_GET_LAST(LRU), *prev; bpage; bpage= prev) + for (buf_page_t *b= UT_LIST_GET_FIRST(free), *next; b; b= next) { - prev= UT_LIST_GET_PREV(LRU, bpage); -#ifdef BTR_CUR_HASH_ADAPT - lru_hp.set(prev); -#endif - auto state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); - ut_ad(bpage->in_LRU_list); + ut_ad(b->in_free_list); + ut_ad(!b->in_LRU_list); + ut_ad(!b->zip.data); + ut_ad(!b->oldest_modification()); + ut_a(b->state() == buf_page_t::NOT_USED); - /* We try to free any pages that can be freed without writing out - anything. */ - switch (bpage->oldest_modification()) { - case 0: - try_to_evict: - if (buf_LRU_free_page(bpage, true)) - { - evicted: - freed++; -#ifdef BTR_CUR_HASH_ADAPT - bpage= prev; - prev= lru_hp.get(); - if (!prev && bpage) - goto rescan; -#endif - } - continue; - case 1: - break; - default: - if (state >= buf_page_t::UNFIXED) + next= UT_LIST_GET_NEXT(list, b); + + if (b >= first_to_withdraw) + { + UT_LIST_REMOVE(free, b); + b->lock.free(); + UT_LIST_ADD_LAST(withdrawn, b); + if (!--n_blocks_to_withdraw) + goto withdraw_done; + } + } + + buf_block_t *block= allocate(); + size_t scanned= 0; + for (buf_page_t *b= lru_scan_itr.start(), *prev; block && b; b= prev) + { + ut_ad(b->in_LRU_list); + ut_a(b->in_file()); + + prev= UT_LIST_GET_PREV(LRU, b); + + if (!b->can_relocate()) + { + next: + if (++scanned & 31) continue; + /* Avoid starvation by periodically releasing buf_pool.mutex. */ + lru_scan_itr.set(prev); + mysql_mutex_unlock(&mutex); + mysql_mutex_lock(&mutex); + prev= lru_scan_itr.get(); + continue; } - if (state < buf_page_t::READ_FIX && bpage->lock.u_lock_try(true)) + const page_id_t id{b->id()}; + hash_chain &chain= page_hash.cell_get(id.fold()); + page_hash_latch &hash_lock= page_hash.lock_get(chain); + hash_lock.lock(); + { - ut_ad(!bpage->is_io_fixed()); - lsn_t oldest_modification= bpage->oldest_modification(); - switch (oldest_modification) { - case 1: - mysql_mutex_lock(&flush_list_mutex); - oldest_modification= bpage->oldest_modification(); - if (oldest_modification) - { - ut_ad(oldest_modification == 1); - delete_from_flush_list(bpage); - } - mysql_mutex_unlock(&flush_list_mutex); + /* relocate flush_list and b->page.zip */ + bool have_flush_list_mutex= false; + + switch (b->oldest_modification()) { + case 2: + ut_ad(fsp_is_system_temporary(id.space())); /* fall through */ case 0: - bpage->lock.u_unlock(true); - goto try_to_evict; + break; default: - if (bpage->state() < buf_page_t::UNFIXED && - oldest_modification <= log_sys.get_flushed_lsn()) - { - release_freed_page(bpage); - goto evicted; + mysql_mutex_lock(&flush_list_mutex); + switch (ut_d(lsn_t om=) b->oldest_modification()) { + case 1: + delete_from_flush_list(b); + /* fall through */ + case 0: + mysql_mutex_unlock(&flush_list_mutex); + break; + default: + ut_ad(om != 2); + have_flush_list_mutex= true; } - else - bpage->lock.u_unlock(true); + } + + if (!b->can_relocate()) + { + next_quick: + if (have_flush_list_mutex) + mysql_mutex_unlock(&flush_list_mutex); + hash_lock.unlock(); + continue; + } + + if (UNIV_LIKELY_NULL(b->zip.data) && + will_be_withdrawn(b->zip.data, size)) + { + block= buf_buddy_shrink(b, block); + ut_ad(mach_read_from_4(b->zip.data + FIL_PAGE_OFFSET) == id.page_no()); + if (UNIV_UNLIKELY(!n_blocks_to_withdraw)) + { + if (have_flush_list_mutex) + mysql_mutex_unlock(&flush_list_mutex); + hash_lock.unlock(); + if (block) + buf_LRU_block_free_non_file_page(block); + goto withdraw_done; + } + if (!block && !(block= allocate())) + goto next_quick; + } + + if (!b->frame || b < first_to_withdraw) + goto next_quick; + + ut_ad(is_uncompressed_current(b)); +#ifdef BTR_CUR_HASH_ADAPT + ut_ad(!reinterpret_cast(b)->index); + ut_ad(!reinterpret_cast(b)->n_pointers); +#endif + + byte *const frame= block->page.frame; + memcpy_aligned<4096>(frame, b->frame, srv_page_size); + b->lock.free(); + block->page.lock.free(); + new(&block->page) buf_page_t(*b); + block->page.frame= frame; + + if (have_flush_list_mutex) + { + buf_flush_relocate_on_flush_list(b, &block->page); + mysql_mutex_unlock(&flush_list_mutex); } } + + /* relocate LRU list */ + if (buf_page_t *prev_b= LRU_remove(b)) + UT_LIST_INSERT_AFTER(LRU, prev_b, &block->page); + else + UT_LIST_ADD_FIRST(LRU, &block->page); + + if (LRU_old == b) + LRU_old= &block->page; + + ut_ad(block->page.in_LRU_list); + + /* relocate page_hash */ + ut_ad(b == page_hash.get(id, chain)); + page_hash.replace(chain, b, &block->page); + + if (b->zip.data) + { + ut_ad(mach_read_from_4(b->zip.data + FIL_PAGE_OFFSET) == id.page_no()); + b->zip.data= nullptr; + /* relocate unzip_LRU list */ + buf_block_t *old_block= reinterpret_cast(b); + ut_ad(old_block->in_unzip_LRU_list); + ut_d(old_block->in_unzip_LRU_list= false); + ut_d(block->in_unzip_LRU_list= true); + + buf_block_t *prev= UT_LIST_GET_PREV(unzip_LRU, old_block); + UT_LIST_REMOVE(unzip_LRU, old_block); + + if (prev) + UT_LIST_INSERT_AFTER(unzip_LRU, prev, block); + else + UT_LIST_ADD_FIRST(unzip_LRU, block); + } + + buf_block_modify_clock_inc(block); + + buf_block_init_low(block); + hash_lock.unlock(); + + ut_d(b->in_LRU_list= false); + + b->set_state(buf_page_t::NOT_USED); + UT_LIST_ADD_LAST(withdrawn, b); + if (!--n_blocks_to_withdraw) + goto withdraw_done; + + block= allocate(); + goto next; } -#if defined MADV_FREE - /* FIXME: Issue fewer calls for larger contiguous blocks of - memory. For now, we assume that this is acceptable, because this - code should be executed rarely. */ - for (buf_page_t *bpage= UT_LIST_GET_FIRST(free); bpage; - bpage= UT_LIST_GET_NEXT(list, bpage)) - madvise(bpage->frame, srv_page_size, MADV_FREE); -#endif + mysql_mutex_lock(&flush_list_mutex); + + if (LRU_warned && !UT_LIST_GET_FIRST(free)) + { + LRU_warned_clear(); + mysql_mutex_unlock(&flush_list_mutex); + return SHRINK_ABORT; + } + + try_LRU_scan= false; mysql_mutex_unlock(&mutex); - sql_print_information("InnoDB: Memory pressure event freed %zu pages", - freed); - return; + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); + mysql_mutex_lock(&mutex); + + if (!n_blocks_to_withdraw) + goto withdraw_done; + + return SHRINK_IN_PROGRESS; } -#endif /* __linux__ */ -/** Thread pool task invoked by innodb_buffer_pool_size changes. */ -static void buf_resize_callback(void *) +inline void buf_pool_t::shrunk(size_t size, size_t reduced) noexcept { - DBUG_ENTER("buf_resize_callback"); - ut_ad(srv_shutdown_state < SRV_SHUTDOWN_CLEANUP); - mysql_mutex_lock(&buf_pool.mutex); - const auto size= srv_buf_pool_size; - const bool work= srv_buf_pool_old_size != size; - mysql_mutex_unlock(&buf_pool.mutex); + ut_ad(size + reduced == size_in_bytes); + size_in_bytes_requested= size; + size_in_bytes= size; +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* Only page_guess() may read this memory, which after + my_virtual_mem_decommit() may be zeroed out or preserve its original + contents. Try to catch any unintended reads outside page_guess(). */ + MEM_UNDEFINED(memory + size, size_in_bytes_max - size); +# else + for (size_t n= page_hash.pad(page_hash.n_cells), i= 0; i < n; + i+= page_hash.ELEMENTS_PER_LATCH + 1) + { + auto &latch= reinterpret_cast(page_hash.array[i]); + latch.lock(); + /* We already shrunk size_in_bytes. The exclusive lock here + ensures that any page_guess() will detect an out-of-bounds + guess before we invoke my_virtual_mem_decommit() below. */ + latch.unlock(); + } +# endif + my_virtual_mem_decommit(memory + size, reduced); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_free)(mem_key_buf_buf_pool, reduced, owner); +#endif +} - if (work) - buf_pool.resize(); +ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept +{ + ut_ad(this == &buf_pool); + mysql_mutex_assert_owner(&LOCK_global_system_variables); + ut_ad(size <= size_in_bytes_max); + if (my_use_large_pages) + { + my_error(ER_VARIABLE_IS_READONLY, MYF(0), "InnoDB", + "innodb_buffer_pool_size", "large_pages=0"); + return; + } + + size_t n_blocks_new= get_n_blocks(size); + + mysql_mutex_lock(&mutex); + + const size_t old_size= size_in_bytes; + if (first_to_withdraw || old_size != size_in_bytes_requested) + { + mysql_mutex_unlock(&mutex); + my_printf_error(ER_WRONG_USAGE, + "innodb_buffer_pool_size change is already in progress", + MYF(0)); + return; + } + + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); +#ifdef __linux__ + DBUG_EXECUTE_IF("trigger_garbage_collection", + mem_pressure_obj.trigger_collection();); +#endif + + if (size == old_size) + { + mysql_mutex_unlock(&mutex); + DBUG_EXECUTE_IF("trigger_garbage_collection", + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + garbage_collect();); + return; + } + +#ifdef BTR_CUR_HASH_ADAPT + bool ahi_disabled= false; +#endif + + const bool significant_change= + n_blocks_new > n_blocks * 2 || n_blocks > n_blocks_new * 2; + const ssize_t n_blocks_removed= n_blocks - n_blocks_new; + + if (n_blocks_removed <= 0) + { + if (!my_virtual_mem_commit(memory + old_size, size - old_size)) + { + mysql_mutex_unlock(&mutex); + sql_print_error("InnoDB: Cannot commit innodb_buffer_pool_size=%zum;" + " retaining innodb_buffer_pool_size=%zum", + size >> 20, old_size >> 20); + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return; + } + + size_in_bytes_requested= size; + size_in_bytes= size; + + { + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + const size_t pages= pages_in_extent[ssize]; + const size_t first_extent= n_blocks / pages; + + char *extent= memory + first_extent * innodb_buffer_pool_extent_size; + + buf_block_t *block= reinterpret_cast(extent); + if (const size_t first_blocks= n_blocks % pages) + { + /* Extend the last (partial) extent until its end */ + const buf_block_t *extent_end= block + + (first_extent == (n_blocks_new / pages) + ? (n_blocks_new % pages) + : pages); + block+= first_blocks; + memset((void*) block, 0, (extent_end - block) * sizeof *block); + + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize] + + (first_blocks << srv_page_size_shift); block < extent_end; + block++, frame+= srv_page_size) + { + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } + extent+= innodb_buffer_pool_extent_size; + } + + /* Fill in further extents; @see buf_pool_t::create() */ + for (const char *const end_new= memory + + block_descriptors_in_bytes(n_blocks_new); + extent < end_new; extent+= innodb_buffer_pool_extent_size) + { + block= reinterpret_cast(extent); + const buf_block_t *extent_end= block + pages; + if (reinterpret_cast(extent_end) > end_new) + extent_end= reinterpret_cast(end_new); + + memset((void*) block, 0, (extent_end - block) * sizeof *block); + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize]; + block < extent_end; block++, frame+= srv_page_size) + { + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } + } + } + + mysql_mutex_unlock(&LOCK_global_system_variables); + resized: + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); + ut_ad(!first_to_withdraw); + const size_t old_blocks{n_blocks}; + n_blocks= n_blocks_new; + + size_t s= n_blocks_new / BUF_READ_AHEAD_PORTION; + read_ahead_area= s >= READ_AHEAD_PAGES + ? READ_AHEAD_PAGES + : my_round_up_to_next_power(uint32(s)); + + if (ssize_t d= size - old_size) + { + os_total_large_mem_allocated+= d; + if (d > 0) + { + /* Already committed memory earlier */ + ut_ad(n_blocks_removed <= 0); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_alloc)(mem_key_buf_buf_pool, d, &owner); +#endif + } + else + shrunk(size, size_t(-d)); + } + + mysql_mutex_unlock(&mutex); + + if (significant_change) + { + sql_print_information("InnoDB: Resizing hash tables"); + srv_lock_table_size= 5 * n_blocks_new; + lock_sys.resize(srv_lock_table_size); + dict_sys.resize(); + } + +#ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search.enable(true); +#endif + mysql_mutex_lock(&LOCK_global_system_variables); + bool resized= n_blocks_removed < 0; + if (n_blocks_removed > 0) + { + mysql_mutex_lock(&mutex); + resized= size_in_bytes == old_size; + if (resized) + { + size_in_bytes_requested= size; + size_in_bytes= size; + } + mysql_mutex_unlock(&mutex); + } + + if (resized) + sql_print_information("InnoDB: innodb_buffer_pool_size=%zum (%zu pages)" + " resized from %zum (%zu pages)", + size >> 20, n_blocks_new, old_size >> 20, + old_blocks); + } else { - std::ostringstream sout; - sout << "Size did not change: old size = new size = " << size; - buf_resize_status(sout.str().c_str()); + size_t to_withdraw= size_t(n_blocks_removed); + n_blocks_to_withdraw= to_withdraw; + first_to_withdraw= &get_nth_page(n_blocks_new)->page; + size_in_bytes_requested= size; + mysql_mutex_unlock(&LOCK_global_system_variables); + + mysql_mutex_unlock(&mutex); + DEBUG_SYNC_C("buf_pool_shrink_before_wakeup"); + mysql_mutex_lock(&flush_list_mutex); + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); +#ifdef BTR_CUR_HASH_ADAPT + ahi_disabled= btr_search.disable(); +#endif /* BTR_CUR_HASH_ADAPT */ + mysql_mutex_lock(&mutex); + + time_t last_message= 0; + + do + { + time_t now= time(nullptr); + if (now - last_message > 15) + { + if (last_message != 0 && to_withdraw == n_blocks_to_withdraw) + break; + to_withdraw= n_blocks_to_withdraw; + last_message= now; + sql_print_information("InnoDB: Trying to shrink" + " innodb_buffer_pool_size=%zum (%zu pages)" + " from %zum (%zu pages, to withdraw %zu)", + size >> 20, n_blocks_new, + old_size >> 20, n_blocks, to_withdraw); + } + shrink_status s{shrink(size)}; + if (s == SHRINK_DONE) + goto resized; + if (s != SHRINK_IN_PROGRESS) + break; + } + while (!thd_kill_level(thd)); + + ut_ad(size_in_bytes > size_in_bytes_requested); + n_blocks_to_withdraw= 0; + first_to_withdraw= nullptr; + size_in_bytes_requested= size_in_bytes; + + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) + { + UT_LIST_REMOVE(withdrawn, b); + UT_LIST_ADD_LAST(free, b); + ut_d(b->in_free_list= true); + ut_ad(b->state() == buf_page_t::NOT_USED); + b->lock.init(); + } + + mysql_mutex_unlock(&mutex); + my_printf_error(ER_WRONG_USAGE, "innodb_buffer_pool_size change aborted", + MYF(ME_ERROR_LOG)); + mysql_mutex_lock(&LOCK_global_system_variables); } - DBUG_VOID_RETURN; + + ut_d(validate()); } -/* Ensure that task does not run in parallel, by setting max_concurrency to 1 for the thread group */ -static tpool::task_group single_threaded_group(1); -static tpool::waitable_task buf_resize_task(buf_resize_callback, - nullptr, &single_threaded_group); - -void buf_resize_start() -{ -#if !defined(DBUG_OFF) && defined(__linux__) - DBUG_EXECUTE_IF("trigger_garbage_collection", - { - mem_pressure_obj.trigger_collection(); - } - ); -#endif - - srv_thread_pool->submit_task(&buf_resize_task); -} - -void buf_resize_shutdown() -{ -#ifdef __linux__ - buf_mem_pressure_shutdown(); -#endif - buf_resize_task.wait(); -} - - /** Relocate a ROW_FORMAT=COMPRESSED block in the LRU list and buf_pool.page_hash. The caller must relocate bpage->list. @param bpage ROW_FORMAT=COMPRESSED only block @param dpage destination control block */ -static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) +static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) noexcept { const page_id_t id{bpage->id()}; buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); ut_ad(!bpage->frame); mysql_mutex_assert_owner(&buf_pool.mutex); + ut_ad(mach_read_from_4(bpage->zip.data + FIL_PAGE_OFFSET) == id.page_no()); ut_ad(buf_pool.page_hash.lock_get(chain).is_write_locked()); ut_ad(bpage == buf_pool.page_hash.get(id, chain)); ut_d(const auto state= bpage->state()); @@ -2272,6 +2120,7 @@ static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) ut_ad(state <= buf_page_t::READ_FIX); ut_ad(bpage->lock.is_write_locked()); const auto frame= dpage->frame; + ut_ad(frame == reinterpret_cast(dpage)->frame_address()); dpage->lock.free(); new (dpage) buf_page_t(*bpage); @@ -2473,6 +2322,8 @@ bool buf_zip_decompress(buf_block_t *block, bool check) noexcept ut_ad(block->zip_size()); ut_a(block->page.id().space() != 0); + ut_ad(mach_read_from_4(frame + FIL_PAGE_OFFSET) + == block->page.id().page_no()); if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) { @@ -2638,7 +2489,6 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, if (b) { uint32_t state= b->fix() + 1; - ut_ad(!b->in_zip_hash); hash_lock.unlock_shared(); if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) @@ -2666,7 +2516,8 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, return reinterpret_cast(-1); } - if (UNIV_LIKELY(b->frame != nullptr)); + if (UNIV_LIKELY(b->frame != nullptr)) + ut_ad(b->frame==reinterpret_cast(b)->frame_address()); else if (state < buf_page_t::READ_FIX) goto unzip; else @@ -2722,6 +2573,49 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, } } +TRANSACTIONAL_TARGET +uint32_t buf_pool_t::page_guess(buf_block_t *b, page_hash_latch &latch, + const page_id_t id) noexcept +{ + transactional_shared_lock_guard g{latch}; +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() and my_virtual_mem_decommit() could retain the original + contents of the virtual memory range or zero it out immediately or + with a delay. Any zeroing out may lead to a false positive for + b->page.id() == id but never for b->page.state(). At the time of + the shrunk() call, shrink() and buf_LRU_block_free_non_file_page() + should guarantee that b->page.state() is equal to + buf_page_t::NOT_USED (0) for all to-be-freed blocks. */ +#else + /* shrunk() made the memory inaccessible. */ + if (UNIV_UNLIKELY(reinterpret_cast(b) >= memory + size_in_bytes)) + return 0; +#endif + const page_id_t block_id{b->page.id()}; +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() may have invoked MEM_UNDEFINED() on this memory to be able + to catch any unintended access elsewhere in our code. */ + MEM_MAKE_DEFINED(&block_id, sizeof block_id); +#endif + + if (id == block_id) + { + uint32_t state= b->page.state(); +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() may have invoked MEM_UNDEFINED() on this memory to be able + to catch any unintended access elsewhere in our code. */ + MEM_MAKE_DEFINED(&state, sizeof state); +#endif + /* Ignore guesses that point to read-fixed blocks. We can only + avoid a race condition by looking up the block via page_hash. */ + if ((state >= buf_page_t::FREED && state < buf_page_t::READ_FIX) || + state >= buf_page_t::WRITE_FIX) + return b->page.fix(); + ut_ad(b->page.frame); + } + return 0; +} + /** Low level function used to get access to a database page. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @@ -2794,22 +2688,9 @@ loop: buf_block_t* block = guess; uint32_t state; - if (block) { - transactional_shared_lock_guard g{hash_lock}; - if (buf_pool.is_uncompressed(block) - && page_id == block->page.id()) { - ut_ad(!block->page.in_zip_hash); - state = block->page.state(); - /* Ignore guesses that point to read-fixed blocks. - We can only avoid a race condition by - looking up the block via buf_pool.page_hash. */ - if ((state >= buf_page_t::FREED - && state < buf_page_t::READ_FIX) - || state >= buf_page_t::WRITE_FIX) { - state = block->page.fix(); - goto got_block; - } - } + if (block + && (state = buf_pool.page_guess(block, hash_lock, page_id))) { + goto got_block; } guess = nullptr; @@ -2867,7 +2748,6 @@ loop: goto loop; got_block: - ut_ad(!block->page.in_zip_hash); state++; ut_ad(state > buf_page_t::FREED); @@ -2999,27 +2879,26 @@ wait_for_unzip: } ut_ad(state < buf_page_t::READ_FIX || state > buf_page_t::WRITE_FIX); + ut_ad(block->page.frame == block->frame_address()); ut_ad(page_id_t(page_get_space_id(block->page.frame), page_get_page_no(block->page.frame)) == page_id); return block; } -TRANSACTIONAL_TARGET buf_block_t *buf_page_optimistic_fix(buf_block_t *block, page_id_t id) noexcept { buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); - transactional_shared_lock_guard g - {buf_pool.page_hash.lock_get(chain)}; - if (UNIV_UNLIKELY(!buf_pool.is_uncompressed(block) || - id != block->page.id() || !block->page.frame)) - return nullptr; - const auto state= block->page.state(); - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED || - state >= buf_page_t::READ_FIX)) - return nullptr; - block->page.fix(); - return block; + page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); + if (uint32_t state= buf_pool.page_guess(block, hash_lock, id)) + { + if (UNIV_LIKELY(state >= buf_page_t::UNFIXED)) + return block; + else + /* Refuse access to pages that are marked as freed in the data file. */ + block->page.unfix(); + } + return nullptr; } buf_block_t *buf_page_optimistic_get(buf_block_t *block, @@ -3129,6 +3008,7 @@ void buf_block_t::initialise(const page_id_t page_id, ulint zip_size, { ut_ad(!page.in_file()); buf_block_init_low(this); + page.lock.init(); page.init(fix, page_id); page.set_os_used(); page_zip_set_size(&page.zip, zip_size); @@ -3213,6 +3093,7 @@ retry: { mysql_mutex_unlock(&buf_pool.mutex); buf_block_t *block= reinterpret_cast(bpage); + ut_ad(bpage->frame == block->frame_address()); mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); #ifdef BTR_CUR_HASH_ADAPT drop_hash_entry= block->index; @@ -3248,7 +3129,8 @@ retry: else { mysql_mutex_unlock(&buf_pool.mutex); - ut_ad(bpage->frame); + ut_ad(bpage->frame == + reinterpret_cast(bpage)->frame_address()); #ifdef BTR_CUR_HASH_ADAPT ut_ad(!reinterpret_cast(bpage)->index); #endif @@ -3608,8 +3490,8 @@ database_corrupted_compressed: release_page: if (node.space->full_crc32() && node.space->crypt_data && recv_recovery_is_on() && - recv_sys.dblwr.find_encrypted_page(node, id().page_no(), - const_cast(read_frame))) + recv_sys.dblwr.find_deferred_page(node, id().page_no(), + const_cast(read_frame))) { /* Recover from doublewrite buffer */ err= DB_SUCCESS; @@ -3661,6 +3543,61 @@ success_page: return DB_SUCCESS; } +#ifdef BTR_CUR_HASH_ADAPT +/** Clear the adaptive hash index on all pages in the buffer pool. */ +ATTRIBUTE_COLD void buf_pool_t::clear_hash_index() noexcept +{ + std::set garbage; + + mysql_mutex_lock(&mutex); + ut_ad(!btr_search.enabled); + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + dict_index_t *index= block->index; + assert_block_ahi_valid(block); + + /* We can clear block->index and block->n_pointers when + holding all AHI latches exclusively; see the comments in buf0buf.h */ + + if (!index) + { +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + ut_a(!block->n_pointers); +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ + continue; + } + + ut_d(const auto s= block->page.state()); + /* Another thread may have set the state to + REMOVE_HASH in buf_LRU_block_remove_hashed(). + + The state change in buf_pool_t::resize() is not observable + here, because in that case we would have !block->index. + + In the end, the entire adaptive hash index will be removed. */ + ut_ad(s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH); +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + block->n_pointers= 0; +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ + if (index->freed()) + garbage.insert(index); + block->index= nullptr; + } + + mysql_mutex_unlock(&mutex); + + for (dict_index_t *index : garbage) + btr_search_lazy_free(index); +} +#endif /* BTR_CUR_HASH_ADAPT */ + #ifdef UNIV_DEBUG /** Check that all blocks are in a replaceable state. @return address of a non-free block @@ -3668,10 +3605,44 @@ success_page: void buf_pool_t::assert_all_freed() noexcept { mysql_mutex_lock(&mutex); - const chunk_t *chunk= chunks; - for (auto i= n_chunks; i--; chunk++) - if (const buf_block_t* block= chunk->not_freed()) - ib::fatal() << "Page " << block->page.id() << " still fixed or dirty"; + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + if (!block->page.in_file()) + continue; + switch (const lsn_t lsn= block->page.oldest_modification()) { + case 0: + case 1: + break; + + case 2: + ut_ad(fsp_is_system_temporary(block->page.id().space())); + break; + + default: + if (srv_read_only_mode) + { + /* The page cleaner is disabled in read-only mode. No pages + can be dirtied, so all of them must be clean. */ + ut_ad(lsn == recv_sys.lsn || + srv_force_recovery == SRV_FORCE_NO_LOG_REDO); + break; + } + + goto fixed_or_dirty; + } + + if (!block->page.can_relocate()) + fixed_or_dirty: + ib::fatal() << "Page " << block->page.id() << " still fixed or dirty"; + } + mysql_mutex_unlock(&mutex); } #endif /* UNIV_DEBUG */ @@ -3721,40 +3692,35 @@ void buf_pool_t::validate() noexcept mysql_mutex_lock(&mutex); - chunk_t* chunk = chunks; - /* Check the uncompressed blocks. */ - for (auto i = n_chunks; i--; chunk++) { - buf_block_t* block = chunk->blocks; + for (ulint i = 0; i < n_blocks; i++) { + const buf_block_t* block = get_nth_page(i); + ut_ad(block->page.frame == block->frame_address()); - for (auto j = chunk->size; j--; block++) { - ut_ad(block->page.frame); - switch (const auto f = block->page.state()) { - case buf_page_t::NOT_USED: - n_free++; + switch (const auto f = block->page.state()) { + case buf_page_t::NOT_USED: + ut_ad(!block->page.in_LRU_list); + n_free++; + break; + case buf_page_t::MEMORY: + case buf_page_t::REMOVE_HASH: + /* do nothing */ + break; + default: + if (f >= buf_page_t::READ_FIX + && f < buf_page_t::WRITE_FIX) { + /* A read-fixed block is not + necessarily in the page_hash yet. */ break; - - case buf_page_t::MEMORY: - case buf_page_t::REMOVE_HASH: - /* do nothing */ - break; - - default: - if (f >= buf_page_t::READ_FIX - && f < buf_page_t::WRITE_FIX) { - /* A read-fixed block is not - necessarily in the page_hash yet. */ - break; - } - ut_ad(f >= buf_page_t::FREED); - const page_id_t id{block->page.id()}; - ut_ad(page_hash.get( - id, - page_hash.cell_get(id.fold())) - == &block->page); - n_lru++; } + ut_ad(f >= buf_page_t::FREED); + const page_id_t id{block->page.id()}; + ut_ad(page_hash.get( + id, + page_hash.cell_get(id.fold())) + == &block->page); + n_lru++; } } @@ -3779,24 +3745,11 @@ void buf_pool_t::validate() noexcept ut_ad(UT_LIST_GET_LEN(flush_list) == n_flushing); mysql_mutex_unlock(&flush_list_mutex); - - if (n_chunks_new == n_chunks - && n_lru + n_free > curr_size + n_zip) { - - ib::fatal() << "n_LRU " << n_lru << ", n_free " << n_free - << ", pool " << curr_size - << " zip " << n_zip << ". Aborting..."; - } - + ut_ad(n_lru + n_free <= n_blocks + n_zip); ut_ad(UT_LIST_GET_LEN(LRU) >= n_lru); - - if (n_chunks_new == n_chunks - && UT_LIST_GET_LEN(free) != n_free) { - - ib::fatal() << "Free list len " - << UT_LIST_GET_LEN(free) - << ", free blocks " << n_free << ". Aborting..."; - } + ut_ad(UT_LIST_GET_LEN(free) <= n_free); + ut_ad(size_in_bytes != size_in_bytes_requested + || UT_LIST_GET_LEN(free) == n_free); mysql_mutex_unlock(&mutex); @@ -3811,26 +3764,23 @@ void buf_pool_t::print() noexcept { index_id_t* index_ids; ulint* counts; - ulint size; ulint i; - ulint j; index_id_t id; ulint n_found; - chunk_t* chunk; dict_index_t* index; - size = curr_size; + mysql_mutex_lock(&mutex); index_ids = static_cast( - ut_malloc_nokey(size * sizeof *index_ids)); + ut_malloc_nokey(n_blocks * sizeof *index_ids)); - counts = static_cast(ut_malloc_nokey(sizeof(ulint) * size)); + counts = static_cast( + ut_malloc_nokey(sizeof(ulint) * n_blocks)); - mysql_mutex_lock(&mutex); mysql_mutex_lock(&flush_list_mutex); ib::info() - << "[buffer pool: size=" << curr_size + << "[buffer pool: size=" << n_blocks << ", database pages=" << UT_LIST_GET_LEN(LRU) << ", free pages=" << UT_LIST_GET_LEN(free) << ", modified database pages=" @@ -3850,38 +3800,28 @@ void buf_pool_t::print() noexcept n_found = 0; - chunk = chunks; + for (size_t i = 0; i < n_blocks; i++) { + buf_block_t* block = get_nth_page(i); + const buf_frame_t* frame = block->page.frame; + ut_ad(frame == block->frame_address()); - for (i = n_chunks; i--; chunk++) { - buf_block_t* block = chunk->blocks; - ulint n_blocks = chunk->size; + if (fil_page_index_page_check(frame)) { - for (; n_blocks--; block++) { - const buf_frame_t* frame = block->page.frame; + id = btr_page_get_index_id(frame); - if (fil_page_index_page_check(frame)) { - - id = btr_page_get_index_id(frame); - - /* Look for the id in the index_ids array */ - j = 0; - - while (j < n_found) { - - if (index_ids[j] == id) { - counts[j]++; - - break; - } - j++; - } - - if (j == n_found) { - n_found++; - index_ids[j] = id; - counts[j] = 1; + /* Look for the id in the index_ids array */ + for (ulint j = 0; j < n_found; j++) { + if (index_ids[j] == id) { + counts[j]++; + goto found; } } + + index_ids[n_found] = id; + counts[n_found] = 1; + n_found++; +found: + continue; } } @@ -3915,138 +3855,78 @@ ulint buf_get_latched_pages_number() noexcept { ulint fixed_pages_number= 0; - mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_assert_owner(&buf_pool.mutex); for (buf_page_t *b= UT_LIST_GET_FIRST(buf_pool.LRU); b; b= UT_LIST_GET_NEXT(LRU, b)) if (b->state() > buf_page_t::UNFIXED) fixed_pages_number++; - mysql_mutex_unlock(&buf_pool.mutex); - return fixed_pages_number; } #endif /* UNIV_DEBUG */ -/** Collect buffer pool metadata. -@param[out] pool_info buffer pool metadata */ -void buf_stats_get_pool_info(buf_pool_info_t *pool_info) noexcept +void buf_pool_t::get_info(buf_pool_info_t *pool_info) noexcept { - time_t current_time; - double time_elapsed; + mysql_mutex_lock(&mutex); + pool_info->pool_size= curr_size(); + pool_info->lru_len= UT_LIST_GET_LEN(LRU); + pool_info->old_lru_len= LRU_old_len; + pool_info->free_list_len= UT_LIST_GET_LEN(free); - mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_lock(&flush_list_mutex); + pool_info->flush_list_len= UT_LIST_GET_LEN(flush_list); + pool_info->n_pend_unzip= UT_LIST_GET_LEN(unzip_LRU); + pool_info->n_pend_reads= os_aio_pending_reads_approx(); + pool_info->n_pending_flush_lru= n_flush(); + pool_info->n_pending_flush_list= os_aio_pending_writes(); + mysql_mutex_unlock(&flush_list_mutex); - pool_info->pool_size = buf_pool.curr_size; + double elapsed= 0.001 + difftime(time(nullptr), last_printout_time); - pool_info->lru_len = UT_LIST_GET_LEN(buf_pool.LRU); - - pool_info->old_lru_len = buf_pool.LRU_old_len; - - pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool.free); - - mysql_mutex_lock(&buf_pool.flush_list_mutex); - pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool.flush_list); - - pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool.unzip_LRU); - - pool_info->n_pend_reads = os_aio_pending_reads_approx(); - - pool_info->n_pending_flush_lru = buf_pool.n_flush(); - - pool_info->n_pending_flush_list = os_aio_pending_writes(); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - - current_time = time(NULL); - time_elapsed = 0.001 + difftime(current_time, - buf_pool.last_printout_time); - - pool_info->n_pages_made_young = buf_pool.stat.n_pages_made_young; - - pool_info->n_pages_not_made_young = - buf_pool.stat.n_pages_not_made_young; - - pool_info->n_pages_read = buf_pool.stat.n_pages_read; - - pool_info->n_pages_created = buf_pool.stat.n_pages_created; - - pool_info->n_pages_written = buf_pool.stat.n_pages_written; - - pool_info->n_page_gets = buf_pool.stat.n_page_gets; - - pool_info->n_ra_pages_read_rnd = buf_pool.stat.n_ra_pages_read_rnd; - pool_info->n_ra_pages_read = buf_pool.stat.n_ra_pages_read; - - pool_info->n_ra_pages_evicted = buf_pool.stat.n_ra_pages_evicted; - - pool_info->page_made_young_rate = - static_cast(buf_pool.stat.n_pages_made_young - - buf_pool.old_stat.n_pages_made_young) - / time_elapsed; - - pool_info->page_not_made_young_rate = - static_cast(buf_pool.stat.n_pages_not_made_young - - buf_pool.old_stat.n_pages_not_made_young) - / time_elapsed; - - pool_info->pages_read_rate = - static_cast(buf_pool.stat.n_pages_read - - buf_pool.old_stat.n_pages_read) - / time_elapsed; - - pool_info->pages_created_rate = - static_cast(buf_pool.stat.n_pages_created - - buf_pool.old_stat.n_pages_created) - / time_elapsed; - - pool_info->pages_written_rate = - static_cast(buf_pool.stat.n_pages_written - - buf_pool.old_stat.n_pages_written) - / time_elapsed; - - pool_info->n_page_get_delta = buf_pool.stat.n_page_gets - - buf_pool.old_stat.n_page_gets; - - if (pool_info->n_page_get_delta) { - pool_info->page_read_delta = buf_pool.stat.n_pages_read - - buf_pool.old_stat.n_pages_read; - - pool_info->young_making_delta = - buf_pool.stat.n_pages_made_young - - buf_pool.old_stat.n_pages_made_young; - - pool_info->not_young_making_delta = - buf_pool.stat.n_pages_not_made_young - - buf_pool.old_stat.n_pages_not_made_young; - } - pool_info->pages_readahead_rnd_rate = - static_cast(buf_pool.stat.n_ra_pages_read_rnd - - buf_pool.old_stat.n_ra_pages_read_rnd) - / time_elapsed; - - - pool_info->pages_readahead_rate = - static_cast(buf_pool.stat.n_ra_pages_read - - buf_pool.old_stat.n_ra_pages_read) - / time_elapsed; - - pool_info->pages_evicted_rate = - static_cast(buf_pool.stat.n_ra_pages_evicted - - buf_pool.old_stat.n_ra_pages_evicted) - / time_elapsed; - - pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool.unzip_LRU); - - pool_info->io_sum = buf_LRU_stat_sum.io; - - pool_info->io_cur = buf_LRU_stat_cur.io; - - pool_info->unzip_sum = buf_LRU_stat_sum.unzip; - - pool_info->unzip_cur = buf_LRU_stat_cur.unzip; - - buf_refresh_io_stats(); - mysql_mutex_unlock(&buf_pool.mutex); + pool_info->n_pages_made_young= stat.n_pages_made_young; + pool_info->page_made_young_rate= + double(stat.n_pages_made_young - old_stat.n_pages_made_young) / + elapsed; + pool_info->n_pages_not_made_young= stat.n_pages_not_made_young; + pool_info->page_not_made_young_rate= + double(stat.n_pages_not_made_young - old_stat.n_pages_not_made_young) / + elapsed; + pool_info->n_pages_read= stat.n_pages_read; + pool_info->pages_read_rate= + double(stat.n_pages_read - old_stat.n_pages_read) / elapsed; + pool_info->n_pages_created= stat.n_pages_created; + pool_info->pages_created_rate= + double(stat.n_pages_created - old_stat.n_pages_created) / elapsed; + pool_info->n_pages_written= stat.n_pages_written; + pool_info->pages_written_rate= + double(stat.n_pages_written - old_stat.n_pages_written) / elapsed; + pool_info->n_page_gets= stat.n_page_gets; + pool_info->n_page_get_delta= stat.n_page_gets - old_stat.n_page_gets; + if (pool_info->n_page_get_delta) + { + pool_info->page_read_delta= stat.n_pages_read - old_stat.n_pages_read; + pool_info->young_making_delta= + stat.n_pages_made_young - old_stat.n_pages_made_young; + pool_info->not_young_making_delta= + stat.n_pages_not_made_young - old_stat.n_pages_not_made_young; + } + pool_info->n_ra_pages_read_rnd= stat.n_ra_pages_read_rnd; + pool_info->pages_readahead_rnd_rate= + double(stat.n_ra_pages_read_rnd - old_stat.n_ra_pages_read_rnd) / elapsed; + pool_info->n_ra_pages_read= stat.n_ra_pages_read; + pool_info->pages_readahead_rate= + double(stat.n_ra_pages_read - old_stat.n_ra_pages_read) / elapsed; + pool_info->n_ra_pages_evicted= stat.n_ra_pages_evicted; + pool_info->pages_evicted_rate= + double(stat.n_ra_pages_evicted - old_stat.n_ra_pages_evicted) / elapsed; + pool_info->unzip_lru_len= UT_LIST_GET_LEN(unzip_LRU); + pool_info->io_sum= buf_LRU_stat_sum.io; + pool_info->io_cur= buf_LRU_stat_cur.io; + pool_info->unzip_sum= buf_LRU_stat_sum.unzip; + pool_info->unzip_cur= buf_LRU_stat_cur.unzip; + buf_refresh_io_stats(); + mysql_mutex_unlock(&mutex); } /*********************************************************************//** @@ -4154,7 +4034,7 @@ buf_print_io( { buf_pool_info_t pool_info; - buf_stats_get_pool_info(&pool_info); + buf_pool.get_info(&pool_info); buf_print_io_instance(&pool_info, file); } diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 51ccadd2612..36e983c55a5 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -375,7 +375,7 @@ void buf_dblwr_t::recover() noexcept srv_page_size)); byte *const buf= read_buf + srv_page_size; - std::deque encrypted_pages; + std::deque deferred_pages; for (recv_dblwr_t::list::iterator i= recv_sys.dblwr.pages.begin(); i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr) { @@ -394,11 +394,12 @@ void buf_dblwr_t::recover() noexcept { /* These pages does not appear to belong to any tablespace. There is a possibility that this page could be - encrypted using full_crc32 format. If innodb encounters - any corrupted encrypted page during recovery then - InnoDB should use this page to find the valid page. - See find_encrypted_page() */ - encrypted_pages.push_back(*i); + encrypted/compressed using full_crc32 format. + If innodb encounters any corrupted encrypted/compressed + page during recovery then InnoDB should use this page to + find the valid page. + See find_encrypted_page()/find_page_compressed() */ + deferred_pages.push_back(*i); continue; } @@ -479,7 +480,7 @@ next_page: } recv_sys.dblwr.pages.clear(); - for (byte *page : encrypted_pages) + for (byte *page : deferred_pages) recv_sys.dblwr.pages.push_back(page); fil_flush_file_spaces(); aligned_free(read_buf); @@ -599,20 +600,67 @@ static void buf_dblwr_check_block(const buf_page_t *bpage) noexcept } #endif /* UNIV_DEBUG */ +ATTRIBUTE_COLD void buf_dblwr_t::print_info() const noexcept +{ + mysql_mutex_assert_owner(&mutex); + const slot *flush_slot= active_slot == &slots[0] ? &slots[1] : &slots[0]; + + sql_print_information("InnoDB: Double Write State\n" + "-------------------\n" + "Batch running : %s\n" + "Active Slot - first_free: %zu reserved: %zu\n" + "Flush Slot - first_free: %zu reserved: %zu\n" + "-------------------", + (batch_running ? "true" : "false"), + active_slot->first_free, active_slot->reserved, + flush_slot->first_free, flush_slot->reserved); +} + bool buf_dblwr_t::flush_buffered_writes(const ulint size) noexcept { mysql_mutex_assert_owner(&mutex); ut_ad(size == block_size); - for (;;) + const size_t max_count= 60 * 60; + const size_t first_log_count= 30; + const size_t fatal_threshold= + static_cast(srv_fatal_semaphore_wait_threshold); + size_t log_count= first_log_count; + + for (size_t count= 0;;) { if (!active_slot->first_free) return false; if (!batch_running) break; - my_cond_wait(&cond, &mutex.m_mutex); - } + timespec abstime; + set_timespec(abstime, 1); + my_cond_timedwait(&cond, &mutex.m_mutex, &abstime); + + if (count > fatal_threshold) + { + buf_pool.print_flush_info(); + print_info(); + ib::fatal() << "InnoDB: Long wait (" << count + << " seconds) for double-write buffer flush."; + } + else if (++count < first_log_count && !(count % 5)) + { + sql_print_information("InnoDB: Long wait (%zu seconds) for double-write" + " buffer flush.", count); + buf_pool.print_flush_info(); + print_info(); + } + else if (!(count % log_count)) + { + sql_print_warning("InnoDB: Long wait (%zu seconds) for double-write" + " buffer flush.", count); + buf_pool.print_flush_info(); + print_info(); + log_count= log_count >= max_count ? max_count : log_count * 2; + } + } ut_ad(active_slot->reserved == active_slot->first_free); ut_ad(!flushing_buffered_writes); diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 3ed84cc75a7..d13e0d0c82c 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -58,7 +58,7 @@ take after being waked up. */ static volatile bool buf_dump_should_start; static volatile bool buf_load_should_start; -static bool buf_load_abort_flag; +static Atomic_relaxed buf_load_abort_flag; /** Start the buffer pool dump/load task and instructs it to start a dump. */ void buf_dump_start() @@ -295,7 +295,7 @@ buf_dump( /* limit the number of total pages dumped to X% of the total number of pages */ - t_pages = buf_pool.curr_size * srv_buf_pool_dump_pct / 100; + t_pages = buf_pool.curr_size() * srv_buf_pool_dump_pct / 100; if (n_pages > t_pages) { buf_dump_status(STATUS_INFO, "Restricted to " ULINTPF @@ -477,10 +477,10 @@ buf_load() return; } - /* If dump is larger than the buffer pool(s), then we ignore the + /* If the dump is larger than the buffer pool, then we ignore the extra trailing. This could happen if a dump is made, then buffer pool is shrunk and then load is attempted. */ - dump_n = std::min(dump_n, buf_pool.get_n_pages()); + dump_n = std::min(dump_n, buf_pool.curr_size()); if (dump_n != 0) { dump = static_cast(ut_malloc_nokey( diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 6523d227de2..5012e78e5b9 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -281,6 +281,8 @@ void buf_page_t::write_complete(bool persistent, bool error, uint32_t state) { ut_ad(!persistent == fsp_is_system_temporary(id().space())); ut_ad(state >= WRITE_FIX); + ut_ad(!frame || + frame == reinterpret_cast(this)->frame_address()); if (UNIV_LIKELY(!error)) { @@ -795,6 +797,7 @@ bool buf_page_t::flush(fil_space_t *space) noexcept size_t orig_size; #endif buf_tmp_buffer_t *slot= nullptr; + byte *page= frame; if (UNIV_UNLIKELY(!frame)) /* ROW_FORMAT=COMPRESSED */ { @@ -810,7 +813,6 @@ bool buf_page_t::flush(fil_space_t *space) noexcept } else { - byte *page= frame; size= block->physical_size(); #if defined HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE || defined _WIN32 orig_size= size; @@ -891,7 +893,7 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, : space.physical_size() == 1024 ? 3 : 0)); /* When flushed, dirty blocks are searched in neighborhoods of this size, and flushed along with the original page. */ - const ulint s= buf_pool.curr_size / 16; + const ulint s= buf_pool.curr_size() / 16; const uint32_t read_ahead= buf_pool.read_ahead_area; const uint32_t buf_flush_area= read_ahead > s ? static_cast(s) : read_ahead; @@ -1209,16 +1211,15 @@ static void buf_flush_discard_page(buf_page_t *bpage) noexcept /** Flush dirty blocks from the end buf_pool.LRU, and move clean blocks to buf_pool.free. -@param max maximum number of blocks to flush -@param n counts of flushed and evicted pages */ -static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept +@param max maximum number of blocks to flush +@param n counts of flushed and evicted pages +@param to_withdraw buf_pool.to_withdraw() */ +static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n, + size_t to_withdraw) noexcept { - ulint scanned= 0; + size_t scanned= 0; mysql_mutex_assert_owner(&buf_pool.mutex); - ulint free_limit{buf_pool.LRU_scan_depth}; - if (buf_pool.withdraw_target && buf_pool.is_shrinking()) - free_limit+= buf_pool.withdraw_target - UT_LIST_GET_LEN(buf_pool.withdraw); - + size_t free_limit{buf_pool.LRU_scan_depth + to_withdraw}; const auto neighbors= UT_LIST_GET_LEN(buf_pool.LRU) < BUF_LRU_OLD_MIN_LEN ? 0 : buf_pool.flush_neighbors; fil_space_t *space= nullptr; @@ -1235,8 +1236,8 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept pages. To avoid such hang, we adjust the LRU limit lower than the limit for data objects as checked in buf_LRU_check_size_of_non_data_objects() i.e. one page less than 5% of BP. */ - size_t pool_limit= buf_pool.curr_size / 20 - 1; - auto buf_lru_min_len= std::min(pool_limit, BUF_LRU_MIN_LEN); + const size_t buf_lru_min_len= + std::min((buf_pool.usable_size()) / 20 - 1, size_t{BUF_LRU_MIN_LEN}); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.LRU); bpage && @@ -1334,7 +1335,10 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept break; } - if (neighbors && space->is_rotational()) + if (neighbors && space->is_rotational() && + /* Skip neighbourhood flush from LRU list if we haven't yet reached + half of the free page target. */ + UT_LIST_GET_LEN(buf_pool.free) * 2 >= free_limit) n->flushed+= buf_flush_try_neighbors(space, page_id, bpage, neighbors == 1, n->flushed, max); @@ -1370,11 +1374,12 @@ Whether LRU or unzip_LRU is used depends on the state of the system. @param n counts of flushed and evicted pages */ static void buf_do_LRU_batch(ulint max, flush_counters_t *n) noexcept { - if (buf_LRU_evict_from_unzip_LRU()) + const size_t to_withdraw= buf_pool.to_withdraw(); + if (!to_withdraw && buf_LRU_evict_from_unzip_LRU()) buf_free_from_unzip_LRU_list_batch(); n->evicted= 0; n->flushed= 0; - buf_flush_LRU_list_batch(max, n); + buf_flush_LRU_list_batch(max, n, to_withdraw); mysql_mutex_assert_owner(&buf_pool.mutex); buf_lru_freed_page_count+= n->evicted; @@ -1723,8 +1728,16 @@ static ulint buf_flush_LRU(ulint max_n) noexcept buf_do_LRU_batch(max_n, &n); ulint pages= n.flushed; + ulint evicted= n.evicted; - if (n.evicted) + /* If we have exhausted flush quota, it is likely we exited before + generating enough free pages. Call once more with 0 flush to generate + free pages immediately as required. */ + if (pages >= max_n) + buf_do_LRU_batch(0, &n); + + evicted+= n.evicted; + if (evicted) { buf_pool.try_LRU_scan= true; pthread_cond_broadcast(&buf_pool.done_free); @@ -1998,6 +2011,14 @@ static bool log_checkpoint() noexcept if (recv_recovery_is_on()) recv_sys.apply(true); +#if defined HAVE_valgrind && !__has_feature(memory_sanitizer) + /* The built-in scheduler in Valgrind may neglect some threads for a + long time. Under Valgrind, let us explicitly wait for page write + completion in order to avoid a result difference in the test + innodb.page_cleaner. */ + os_aio_wait_until_no_pending_writes(false); +#endif + fil_flush_file_spaces(); log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -2185,6 +2206,7 @@ static void buf_flush_sync_for_checkpoint(lsn_t lsn) noexcept MONITOR_FLUSH_SYNC_PAGES, n_flushed); } + os_aio_wait_until_no_pending_writes(false); fil_flush_file_spaces(); log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -2296,13 +2318,23 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, if (!prev_lsn || !pct_for_lsn) { prev_time = curr_time; prev_lsn = cur_lsn; - if (max_pct > 0.0) { - dirty_pct /= max_pct; - } - n_pages = ulint(dirty_pct * double(srv_io_capacity)); - if (n_pages < dirty_blocks) { - n_pages= std::min(srv_io_capacity, dirty_blocks); + if (srv_io_capacity >= dirty_blocks) { + n_pages = dirty_blocks; + } else { + if (max_pct > 1.0) { + dirty_pct/= max_pct; + } + n_pages= ulint(dirty_pct * double(srv_io_capacity)); + + if (n_pages < dirty_blocks) { + n_pages= srv_io_capacity; + + } else { + /* Set maximum IO capacity upper bound. */ + n_pages= std::min(srv_max_io_capacity, + dirty_blocks); + } } func_exit: @@ -2398,6 +2430,13 @@ func_exit: goto func_exit; } +TPOOL_SUPPRESS_TSAN +bool buf_pool_t::running_out() const noexcept +{ + return !recv_recovery_is_on() && + UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < n_blocks / 4; +} + TPOOL_SUPPRESS_TSAN bool buf_pool_t::need_LRU_eviction() const noexcept { @@ -2436,6 +2475,11 @@ static void buf_flush_page_cleaner() noexcept DBUG_EXECUTE_IF("ib_page_cleaner_sleep", { std::this_thread::sleep_for(std::chrono::seconds(1)); + /* Cover the logging code in debug mode. */ + buf_pool.print_flush_info(); + buf_dblwr.lock(); + buf_dblwr.print_info(); + buf_dblwr.unlock(); }); lsn_limit= buf_flush_sync_lsn; @@ -2458,7 +2502,7 @@ static void buf_flush_page_cleaner() noexcept (!UT_LIST_GET_LEN(buf_pool.flush_list) || srv_max_dirty_pages_pct_lwm == 0.0)) { - buf_pool.LRU_warned.clear(std::memory_order_release); + buf_pool.LRU_warned_clear(); /* We are idle; wait for buf_pool.page_cleaner_wakeup() */ my_cond_wait(&buf_pool.do_flush_list, &buf_pool.flush_list_mutex.m_mutex); @@ -2533,6 +2577,7 @@ static void buf_flush_page_cleaner() noexcept buf_pool.n_flush_inc(); mysql_mutex_unlock(&buf_pool.flush_list_mutex); n= srv_max_io_capacity; + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&buf_pool.mutex); LRU_flush: n= buf_flush_LRU(n); @@ -2636,10 +2681,17 @@ static void buf_flush_page_cleaner() noexcept !buf_pool.need_LRU_eviction()) goto check_oldest_and_set_idle; else + { mysql_mutex_lock(&buf_pool.mutex); + os_aio_wait_until_no_pending_writes(false); + } n= srv_max_io_capacity; n= n >= n_flushed ? n - n_flushed : 0; + /* It is critical to generate free pages to keep the system alive. Make + sure we are not hindered by dirty pages in LRU tail. */ + n= std::max(n, std::min(srv_max_io_capacity, + buf_pool.LRU_scan_depth)); goto LRU_flush; } @@ -2677,11 +2729,13 @@ ATTRIBUTE_COLD void buf_pool_t::LRU_warn() noexcept { mysql_mutex_assert_owner(&mutex); try_LRU_scan= false; - if (!LRU_warned.test_and_set(std::memory_order_acquire)) + if (!LRU_warned) + { + LRU_warned= true; sql_print_warning("InnoDB: Could not free any blocks in the buffer pool!" - " %zu blocks are in use and %zu free." - " Consider increasing innodb_buffer_pool_size.", - UT_LIST_GET_LEN(LRU), UT_LIST_GET_LEN(free)); + " Consider increasing innodb_buffer_pool_size."); + print_flush_info(); + } } /** Initialize page_cleaner. */ @@ -2765,6 +2819,53 @@ void buf_flush_sync() noexcept thd_wait_end(nullptr); } +ATTRIBUTE_COLD void buf_pool_t::print_flush_info() const noexcept +{ + /* We do dirty read of UT_LIST count variable. */ + size_t lru_size= UT_LIST_GET_LEN(LRU); + size_t dirty_size= UT_LIST_GET_LEN(flush_list); + size_t free_size= UT_LIST_GET_LEN(free); + size_t dirty_pct= lru_size ? dirty_size * 100 / (lru_size + free_size) : 0; + sql_print_information("InnoDB: Buffer Pool pages\n" + "-------------------\n" + "LRU Pages : %zu\n" + "Free Pages : %zu\n" + "Dirty Pages: %zu : %zu%%\n" + "-------------------", + lru_size, free_size, dirty_size, dirty_pct); + + lsn_t lsn= log_sys.get_lsn(); + lsn_t clsn= log_sys.last_checkpoint_lsn; + sql_print_information("InnoDB: LSN flush parameters\n" + "-------------------\n" + "System LSN : %" PRIu64 "\n" + "Checkpoint LSN: %" PRIu64 "\n" + "Flush ASync LSN: %" PRIu64 "\n" + "Flush Sync LSN: %" PRIu64 "\n" + "-------------------", + lsn, clsn, buf_flush_async_lsn.load(), buf_flush_sync_lsn.load()); + + lsn_t age= lsn - clsn; + lsn_t age_pct= log_sys.max_checkpoint_age + ? age * 100 / log_sys.max_checkpoint_age : 0; + sql_print_information("InnoDB: LSN age parameters\n" + "-------------------\n" + "Current Age : %" PRIu64 " : %" PRIu64 "%%\n" + "Max Age(Async): %" PRIu64 "\n" + "Max Age(Sync) : %" PRIu64 "\n" + "Capacity : %" PRIu64 "\n" + "-------------------", + age, age_pct, log_sys.max_modified_age_async, log_sys.max_checkpoint_age, + log_sys.log_capacity); + + sql_print_information("InnoDB: Pending IO count\n" + "-------------------\n" + "Pending Read : %zu\n" + "Pending Write: %zu\n" + "-------------------", + os_aio_pending_reads_approx(), os_aio_pending_writes_approx()); +} + #ifdef UNIV_DEBUG /** Functor to validate the flush list. */ struct Check { diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index e5d33edf652..863bca7fb14 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -38,6 +38,7 @@ Created 11/5/1995 Heikki Tuuri #include "srv0srv.h" #include "srv0mon.h" #include "my_cpu.h" +#include "log.h" /** The number of blocks from the LRU_old pointer onward, including the block pointed to, must be buf_pool.LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV @@ -133,7 +134,7 @@ static inline void incr_LRU_size_in_bytes(const buf_page_t* bpage) buf_pool.stat.LRU_bytes += bpage->physical_size(); - ut_ad(buf_pool.stat.LRU_bytes <= buf_pool.curr_pool_size); + ut_ad(buf_pool.stat.LRU_bytes <= buf_pool.curr_pool_size()); } /** @return whether the unzip_LRU list should be used for evicting a victim @@ -259,89 +260,52 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit) return(freed); } -/** @return a buffer block from the buf_pool.free list -@retval NULL if the free list is empty */ -buf_block_t* buf_LRU_get_free_only() -{ - buf_block_t* block; - - mysql_mutex_assert_owner(&buf_pool.mutex); - - block = reinterpret_cast( - UT_LIST_GET_FIRST(buf_pool.free)); - - while (block != NULL) { - ut_ad(block->page.in_free_list); - ut_d(block->page.in_free_list = FALSE); -#ifdef BTR_CUR_HASH_ADAPT - ut_ad(!block->n_pointers); - ut_ad(!block->index); -#endif - ut_ad(!block->page.oldest_modification()); - ut_ad(!block->page.in_LRU_list); - ut_a(!block->page.in_file()); - UT_LIST_REMOVE(buf_pool.free, &block->page); - - if (!buf_pool.is_shrinking() - || UT_LIST_GET_LEN(buf_pool.withdraw) - >= buf_pool.withdraw_target - || !buf_pool.will_be_withdrawn(block->page)) { - block->page.set_state(buf_page_t::MEMORY); - block->page.set_os_used(); - break; - } - - /* This should be withdrawn */ - UT_LIST_ADD_LAST(buf_pool.withdraw, &block->page); - ut_d(block->in_withdraw_list = true); - - block = reinterpret_cast( - UT_LIST_GET_FIRST(buf_pool.free)); - } - - return(block); -} - /******************************************************************//** Checks how much of buf_pool is occupied by non-data objects like AHI, lock heaps etc. Depending on the size of non-data objects this function will either assert or issue a warning and switch on the status monitor. */ -static void buf_LRU_check_size_of_non_data_objects() +static void buf_LRU_check_size_of_non_data_objects() noexcept { mysql_mutex_assert_owner(&buf_pool.mutex); - if (recv_recovery_is_on() || buf_pool.n_chunks_new != buf_pool.n_chunks) + if (recv_recovery_is_on()) return; - const auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU); + const size_t curr_size{buf_pool.usable_size()}; - if (s < buf_pool.curr_size / 20) - ib::fatal() << "Over 95 percent of the buffer pool is" - " occupied by lock heaps" + auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU); + + if (s < curr_size / 20) + { + sql_print_error("[FATAL] InnoDB: Over 95 percent of the buffer pool is" + " occupied by lock heaps" #ifdef BTR_CUR_HASH_ADAPT - " or the adaptive hash index" + " or the adaptive hash index" #endif /* BTR_CUR_HASH_ADAPT */ - "! Check that your transactions do not set too many" - " row locks, or review if innodb_buffer_pool_size=" - << (buf_pool.curr_size >> (20U - srv_page_size_shift)) - << "M could be bigger."; + "! Check that your transactions do not set too many" + " row locks, or review if innodb_buffer_pool_size=%zuM" + " could be bigger", + curr_size >> (20 - srv_page_size_shift)); + abort(); + } - if (s < buf_pool.curr_size / 3) + if (s < curr_size / 3) { if (!buf_lru_switched_on_innodb_mon && srv_monitor_timer) { /* Over 67 % of the buffer pool is occupied by lock heaps or the adaptive hash index. This may be a memory leak! */ - ib::warn() << "Over 67 percent of the buffer pool is" - " occupied by lock heaps" + sql_print_warning("InnoDB: Over 67 percent of the buffer pool is" + " occupied by lock heaps" #ifdef BTR_CUR_HASH_ADAPT - " or the adaptive hash index" + " or the adaptive hash index" #endif /* BTR_CUR_HASH_ADAPT */ - "! Check that your transactions do not set too many row locks." - " innodb_buffer_pool_size=" - << (buf_pool.curr_size >> (20U - srv_page_size_shift)) - << "M. Starting the InnoDB Monitor to print diagnostics."; + "! Check that your transactions do not set too many" + " row locks. innodb_buffer_pool_size=%zuM." + " Starting the InnoDB Monitor to print diagnostics.", + curr_size >> (20 - srv_page_size_shift)); + buf_lru_switched_on_innodb_mon= true; srv_print_innodb_monitor= TRUE; srv_monitor_timer_schedule_now(); @@ -390,15 +354,15 @@ buf_block_t* buf_LRU_get_free_block(buf_LRU_get get) retry: /* If there is a block in the free list, take it */ - block= buf_LRU_get_free_only(); + block= buf_pool.allocate(); if (block) { got_block: const ulint LRU_size= UT_LIST_GET_LEN(buf_pool.LRU); const ulint available= UT_LIST_GET_LEN(buf_pool.free); - const ulint scan_depth= buf_pool.LRU_scan_depth / 2; - ut_ad(LRU_size <= BUF_LRU_MIN_LEN || - available >= scan_depth || buf_pool.need_LRU_eviction()); + const size_t scan_depth{buf_pool.LRU_scan_depth / 2}; + ut_ad(LRU_size <= BUF_LRU_MIN_LEN || available >= scan_depth || + buf_pool.is_shrinking() || buf_pool.need_LRU_eviction()); ut_d(bool signalled = false); @@ -453,7 +417,7 @@ got_block: waited= true; - while (!(block= buf_LRU_get_free_only())) + while (!(block= buf_pool.allocate())) { buf_pool.stat.LRU_waits++; @@ -818,10 +782,10 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) if (zip || !bpage->zip.data || !bpage->frame) { break; } + mysql_mutex_lock(&buf_pool.flush_list_mutex); relocate_compressed: b = static_cast(ut_zalloc_nokey(sizeof *b)); ut_a(b); - mysql_mutex_lock(&buf_pool.flush_list_mutex); new (b) buf_page_t(*bpage); b->frame = nullptr; { @@ -839,7 +803,12 @@ func_exit: hash_lock.unlock(); return(false); } - goto relocate_compressed; + mysql_mutex_lock(&buf_pool.flush_list_mutex); + if (bpage->can_relocate()) { + goto relocate_compressed; + } + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + goto func_exit; } mysql_mutex_assert_owner(&buf_pool.mutex); @@ -878,7 +847,6 @@ func_exit: /* The fields of bpage were copied to b before buf_LRU_block_remove_hashed() was invoked. */ - ut_ad(!b->in_zip_hash); ut_ad(b->in_LRU_list); ut_ad(b->in_page_hash); ut_d(b->in_page_hash = false); @@ -997,24 +965,12 @@ buf_LRU_block_free_non_file_page( if (data != NULL) { block->page.zip.data = NULL; - buf_pool_mutex_exit_forbid(); - ut_ad(block->zip_size()); - buf_buddy_free(data, block->zip_size()); - - buf_pool_mutex_exit_allow(); page_zip_set_size(&block->page.zip, 0); } - if (buf_pool.is_shrinking() - && UT_LIST_GET_LEN(buf_pool.withdraw) < buf_pool.withdraw_target - && buf_pool.will_be_withdrawn(block->page)) { - /* This should be withdrawn */ - UT_LIST_ADD_LAST( - buf_pool.withdraw, - &block->page); - ut_d(block->in_withdraw_list = true); + if (buf_pool.to_withdraw() && buf_pool.withdraw(block->page)) { } else { UT_LIST_ADD_FIRST(buf_pool.free, &block->page); ut_d(block->page.in_free_list = true); @@ -1115,7 +1071,6 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, MEM_CHECK_ADDRESSABLE(bpage->zip.data, bpage->zip_size()); } - ut_ad(!bpage->in_zip_hash); buf_pool.page_hash.remove(chain, bpage); page_hash_latch& hash_lock = buf_pool.page_hash.lock_get(chain); @@ -1127,11 +1082,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, ut_ad(!bpage->oldest_modification()); hash_lock.unlock(); - buf_pool_mutex_exit_forbid(); - buf_buddy_free(bpage->zip.data, bpage->zip_size()); - - buf_pool_mutex_exit_allow(); bpage->lock.free(); ut_free(bpage); return false; @@ -1160,12 +1111,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, ut_ad(!bpage->in_free_list); ut_ad(!bpage->oldest_modification()); ut_ad(!bpage->in_LRU_list); - buf_pool_mutex_exit_forbid(); - buf_buddy_free(data, bpage->zip_size()); - - buf_pool_mutex_exit_allow(); - page_zip_set_size(&bpage->zip, 0); } @@ -1381,7 +1327,7 @@ void buf_LRU_validate() ut_ad(!bpage->frame || reinterpret_cast(bpage) ->in_unzip_LRU_list - == bpage->belongs_to_unzip_LRU()); + == !!bpage->zip.data); if (bpage->is_old()) { const buf_page_t* prev diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index a00f6873bbd..1717d11999a 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -53,7 +53,7 @@ bool buf_pool_t::page_hash_contains(const page_id_t page_id, hash_chain &chain) return page_hash.get(page_id, chain); } -/** If there are buf_pool.curr_size per the number below pending reads, then +/** If there are buf_pool.curr_size() per the number below pending reads, then read-ahead is not done: this is to prevent flooding the buffer pool with i/o-fixed buffer blocks */ #define BUF_READ_AHEAD_PEND_LIMIT 2 @@ -315,7 +315,7 @@ ulint buf_read_ahead_random(const page_id_t page_id) noexcept return 0; if (os_aio_pending_reads_approx() > - buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + buf_pool.curr_size() / BUF_READ_AHEAD_PEND_LIMIT) return 0; fil_space_t* space= fil_space_t::get(page_id.space()); @@ -516,7 +516,7 @@ ulint buf_read_ahead_linear(const page_id_t page_id) noexcept return 0; if (os_aio_pending_reads_approx() > - buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + buf_pool.curr_size() / BUF_READ_AHEAD_PEND_LIMIT) return 0; const uint32_t buf_read_ahead_area= buf_pool.read_ahead_area; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 626034a53d2..b063404f17e 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -44,6 +44,7 @@ Created 1/8/1996 Heikki Tuuri #include "btr0cur.h" #include "btr0sea.h" #include "buf0buf.h" +#include "buf0flu.h" #include "data0type.h" #include "dict0boot.h" #include "dict0load.h" @@ -631,32 +632,28 @@ dict_acquire_mdl_shared(dict_table_t *table, MDL_context *mdl_context, MDL_ticket **mdl, dict_table_op_t table_op) { - table_id_t table_id= table->id; char db_buf[NAME_LEN + 1], db_buf1[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1], tbl_buf1[NAME_LEN + 1]; size_t db_len, tbl_len; - bool unaccessible= false; if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ return table; retry: - if (!unaccessible && (!table->is_readable() || table->corrupted)) + ut_ad(!trylock == dict_sys.frozen()); + + if (!table->is_readable() || table->corrupted) { if (*mdl) { mdl_context->release_lock(*mdl); *mdl= nullptr; } - unaccessible= true; + return nullptr; } - if (!trylock) - table->release(); - - if (unaccessible) - return nullptr; + const table_id_t table_id{table->id}; if (!trylock) dict_sys.unfreeze(); @@ -685,11 +682,38 @@ retry: } } + size_t db1_len, tbl1_len; +lookup: dict_sys.freeze(SRW_LOCK_CALL); table= dict_sys.find_table(table_id); if (table) - table->acquire(); - if (!table && table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) + { + if (!table->is_accessible()) + { + table= nullptr; + unlock_and_return_without_mdl: + if (trylock) + dict_sys.unfreeze(); + return_without_mdl: + if (*mdl) + { + mdl_context->release_lock(*mdl); + *mdl= nullptr; + } + return table; + } + + if (trylock) + table->acquire(); + + if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) + { + /* The table was renamed to #sql prefix. + Release MDL (if any) for the old name and return. */ + goto unlock_and_return_without_mdl; + } + } + else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); @@ -697,31 +721,15 @@ retry: table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); - dict_sys.freeze(SRW_LOCK_CALL); - } - - if (!table || !table->is_accessible()) - { -return_without_mdl: - if (trylock) - dict_sys.unfreeze(); - if (*mdl) - { - mdl_context->release_lock(*mdl); - *mdl= nullptr; - } - return nullptr; - } - - size_t db1_len, tbl1_len; - - if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) - { - /* The table was renamed to #sql prefix. - Release MDL (if any) for the old name and return. */ + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ + if (table) + goto lookup; + if (!trylock) + dict_sys.freeze(SRW_LOCK_CALL); goto return_without_mdl; } @@ -810,6 +818,7 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, dict_table_op_t table_op, THD *thd, MDL_ticket **mdl) { +retry: if (!dict_locked) dict_sys.freeze(SRW_LOCK_CALL); @@ -817,9 +826,21 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, if (table) { - table->acquire(); - if (thd && !dict_locked) - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (!dict_locked) + { + if (thd) + { + table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (table) + goto acquire; + } + else + acquire: + table->acquire(); + dict_sys.unfreeze(); + } + else + table->acquire(); } else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { @@ -832,24 +853,16 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); if (!dict_locked) { dict_sys.unlock(); - if (table && thd) - { - dict_sys.freeze(SRW_LOCK_CALL); - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); - dict_sys.unfreeze(); - } - return table; + if (table) + goto retry; } + else if (table) + table->acquire(); } - if (!dict_locked) - dict_sys.unfreeze(); - return table; } @@ -912,7 +925,7 @@ void dict_sys_t::create() noexcept UT_LIST_INIT(table_LRU, &dict_table_t::table_LRU); UT_LIST_INIT(table_non_LRU, &dict_table_t::table_LRU); - const ulint hash_size = buf_pool_get_curr_size() + const ulint hash_size = buf_pool.curr_size() / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE); table_hash.create(hash_size); @@ -949,7 +962,10 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexc const ulong threshold= srv_fatal_semaphore_wait_threshold; if (waited >= threshold) + { + buf_pool.print_flush_info(); ib::fatal() << fatal_msg; + } if (waited > threshold / 4) ib::warn() << "A long wait (" << waited @@ -1066,6 +1082,55 @@ dict_table_open_on_name( DBUG_RETURN(table); } +bool dict_stats::open(THD *thd) noexcept +{ + ut_ad(!mdl_table); + ut_ad(!mdl_index); + ut_ad(!table_stats); + ut_ad(!index_stats); + ut_ad(!mdl_context); + + mdl_context= static_cast(thd_mdl_context(thd)); + if (!mdl_context) + return true; + /* FIXME: use compatible type, and maybe remove this parameter altogether! */ + const double timeout= double(global_system_variables.lock_wait_timeout); + MDL_request request; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_table_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + return true; + mdl_table= request.ticket; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_index_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + goto release_mdl; + mdl_index= request.ticket; + table_stats= dict_table_open_on_name("mysql/innodb_table_stats", false, + DICT_ERR_IGNORE_NONE); + if (!table_stats) + goto release_mdl; + index_stats= dict_table_open_on_name("mysql/innodb_index_stats", false, + DICT_ERR_IGNORE_NONE); + if (index_stats) + return false; + + table_stats->release(); +release_mdl: + if (mdl_index) + mdl_context->release_lock(mdl_index); + mdl_context->release_lock(mdl_table); + return true; +} + +void dict_stats::close() noexcept +{ + table_stats->release(); + index_stats->release(); + mdl_context->release_lock(mdl_table); + mdl_context->release_lock(mdl_index); +} + /**********************************************************************//** Adds system columns to a table object. */ void @@ -4267,7 +4332,7 @@ void dict_sys_t::resize() noexcept table_id_hash.free(); temp_id_hash.free(); - const ulint hash_size = buf_pool_get_curr_size() + const ulint hash_size = buf_pool.curr_size() / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE); table_hash.create(hash_size); table_id_hash.create(hash_size); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index a1d354ca3b6..5c65f572115 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -2843,12 +2843,20 @@ dberr_t dict_stats_save(dict_table_t* table, index_id_t index_id) pars_info_t* pinfo; char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; + THD* const thd = current_thd; #ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dict_stats_save_exit_notify", + SCOPE_EXIT([thd] { + debug_sync_set_action(thd, + STRING_WITH_LEN("now SIGNAL dict_stats_save_finished")); + }); + ); + DBUG_EXECUTE_IF("dict_stats_save_exit_notify_and_wait", SCOPE_EXIT([] { debug_sync_set_action(current_thd, - STRING_WITH_LEN("now SIGNAL dict_stats_save_finished")); + STRING_WITH_LEN("now SIGNAL dict_stats_save_finished" + " WAIT_FOR dict_stats_save_unblock")); }); ); #endif /* ENABLED_DEBUG_SYNC */ @@ -2861,41 +2869,10 @@ dberr_t dict_stats_save(dict_table_t* table, index_id_t index_id) return (dict_stats_report_error(table)); } - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) { - goto release_and_exit; - } - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - dict_table_close(index_stats, thd, mdl_index); - goto release_and_exit; - } - dict_fs2utf8(table->name.m_name, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); const time_t now = time(NULL); @@ -2904,9 +2881,9 @@ release_and_exit: trx_start_internal(trx); dberr_t ret = trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) { - ret = lock_table_for_trx(index_stats, trx, LOCK_X); + ret = lock_table_for_trx(stats.index(), trx, LOCK_X); } if (ret != DB_SUCCESS) { if (trx->state != TRX_STATE_NOT_STARTED) { @@ -2967,8 +2944,7 @@ free_and_exit: dict_sys.unlock(); unlocked_free_and_exit: trx->free(); - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); + stats.close(); return ret; } @@ -3431,42 +3407,11 @@ dberr_t dict_stats_fetch_from_ps(dict_table_t *table) stats. */ dict_stats_empty_table(table); - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!table_stats) { + THD* const thd = current_thd; + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!index_stats) { - table_stats->release(); - return DB_STATS_DO_NOT_EXIST; - } - - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - dict_sys.unfreeze(); - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, thd, mdl_index); - } - return DB_STATS_DO_NOT_EXIST; - } - - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - if (!index_stats - || strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - goto release_and_exit; - } #ifdef ENABLED_DEBUG_SYNC DEBUG_SYNC(thd, "dict_stats_mdl_acquired"); @@ -3492,7 +3437,6 @@ release_and_exit: "fetch_index_stats_step", dict_stats_fetch_index_stats_step, &index_fetch_arg); - dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); que_t* graph = pars_sql( pinfo, @@ -3558,18 +3502,11 @@ release_and_exit: trx_start_internal_read_only(trx); que_run_threads(que_fork_start_command(graph)); que_graph_free(graph); - - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - trx_commit_for_mysql(trx); - dberr_t ret = trx->error_state; + dberr_t ret = index_fetch_arg.stats_were_modified + ? trx->error_state : DB_STATS_DO_NOT_EXIST; trx->free(); - - if (!index_fetch_arg.stats_were_modified) { - return DB_STATS_DO_NOT_EXIST; - } - + stats.close(); return ret; } diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 1aa003fd6ce..e3375449508 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -503,10 +503,10 @@ rtr_pcur_move_to_next( rtr_rec_t rec; rec = rtr_info->matches->matched_recs->back(); rtr_info->matches->matched_recs->pop_back(); + cursor->btr_cur.page_cur.block = rtr_info->matches->block; mysql_mutex_unlock(&rtr_info->matches->rtr_match_mutex); cursor->btr_cur.page_cur.rec = rec.r_rec; - cursor->btr_cur.page_cur.block = rtr_info->matches->block; DEBUG_SYNC_C("rtr_pcur_move_to_next_return"); return(true); @@ -1569,7 +1569,10 @@ rtr_check_discard_page( if (auto matches = rtr_info->matches) { mysql_mutex_lock(&matches->rtr_match_mutex); - if (matches->block->page.id() == id) { + /* matches->block could be nullptr when cursor + encounters empty table */ + if (rtr_info->matches->block + && matches->block->page.id() == id) { matches->matched_recs->clear(); matches->valid = false; } @@ -2205,6 +2208,15 @@ rtr_cur_search_with_match( ut_ad(orig_mode != PAGE_CUR_RTREE_LOCATE); + /* Collect matched records on page */ + offsets = rec_get_offsets( + rec, index, offsets, + index->n_fields, + ULINT_UNDEFINED, &heap); + + mysql_mutex_lock( + &rtr_info->matches->rtr_match_mutex); + if (!match_init) { rtr_init_match( rtr_info->matches, @@ -2212,14 +2224,12 @@ rtr_cur_search_with_match( match_init = true; } - /* Collect matched records on page */ - offsets = rec_get_offsets( - rec, index, offsets, - index->n_fields, - ULINT_UNDEFINED, &heap); rtr_leaf_push_match_rec( rec, rtr_info, offsets, page_is_comp(page)); + + mysql_mutex_unlock( + &rtr_info->matches->rtr_match_mutex); } last_match_rec = rec; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 05d7b46866d..5c04302ef45 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -46,6 +46,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include #include #include @@ -169,13 +170,9 @@ static const long AUTOINC_OLD_STYLE_LOCKING = 0; static const long AUTOINC_NEW_STYLE_LOCKING = 1; static const long AUTOINC_NO_LOCKING = 2; -static constexpr size_t buf_pool_chunk_min_size= 1U << 20; - static ulong innobase_open_files; static long innobase_autoinc_lock_mode; -ulonglong innobase_buffer_pool_size; - /** Percentage of the buffer pool to reserve for 'old' blocks. Connected to buf_LRU_old_ratio. */ static uint innobase_old_blocks_pct; @@ -1341,38 +1338,17 @@ static void innodb_drop_database(handlerton*, char *path) dict_sys.unlock(); - dict_table_t *table_stats, *index_stats; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + dict_stats stats; + const bool stats_failed{stats.open(thd)}; trx_start_for_ddl(trx); uint errors= 0; char db[NAME_LEN + 1]; strconvert(&my_charset_filename, namebuf, len, system_charset_info, db, sizeof db, &errors); - if (!errors && table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - lock_table_for_trx(table_stats, trx, LOCK_X) == DB_SUCCESS && - lock_table_for_trx(index_stats, trx, LOCK_X) == DB_SUCCESS) + if (!errors && !stats_failed && + lock_table_for_trx(stats.table(), trx, LOCK_X) == DB_SUCCESS && + lock_table_for_trx(stats.index(), trx, LOCK_X) == DB_SUCCESS) { row_mysql_lock_data_dictionary(trx); if (dict_stats_delete(db, trx)) @@ -1468,19 +1444,16 @@ static void innodb_drop_database(handlerton*, char *path) if (err != DB_SUCCESS) { trx->rollback(); - namebuf[len] = '\0'; - ib::error() << "DROP DATABASE " << namebuf << ": " << err; + sql_print_error("InnoDB: DROP DATABASE %.*s: %s", + int(len), namebuf, ut_strerr(err)); } else trx->commit(); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); - trx->free(); + if (!stats_failed) + stats.close(); if (err == DB_SUCCESS) { @@ -3015,8 +2988,9 @@ static bool innodb_copy_stat_flags(dict_table_t *table, static_assert(HA_OPTION_NO_STATS_PERSISTENT == dict_table_t::STATS_PERSISTENT_OFF << 11, ""); uint32_t stat= - (table_options & - (HA_OPTION_STATS_PERSISTENT | HA_OPTION_NO_STATS_PERSISTENT)) >> 11; + uint32_t(table_options & + (HA_OPTION_STATS_PERSISTENT | + HA_OPTION_NO_STATS_PERSISTENT)) >> 11; static_assert(uint32_t{HA_STATS_AUTO_RECALC_ON} << 3 == dict_table_t::STATS_AUTO_RECALC_ON, ""); static_assert(uint32_t{HA_STATS_AUTO_RECALC_OFF} << 3 == @@ -3711,53 +3685,44 @@ static int innodb_init_abort() DBUG_RETURN(1); } -/** Return the minimum buffer pool size based on page size */ -static inline ulint min_buffer_pool_size() +static void innodb_buffer_pool_size_update(THD* thd,st_mysql_sys_var*,void*, + const void *save) noexcept { - ulint s= (BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4) * srv_page_size; - /* buf_pool_chunk_size minimum is 1M, so round up to a multiple */ - ulint alignment= 1U << 20; - return UT_CALC_ALIGN(s, alignment); + buf_pool.resize(*static_cast(save), thd); } -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - struct st_mysql_sys_var* var, - void* save, - struct st_mysql_value* value); - -/** Update the system variable innodb_buffer_pool_size using the "saved" -value. This function is registered as a callback with MySQL. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] var_ptr where the formal string goes -@param[in] save immediate result from check function */ -static -void -innodb_buffer_pool_size_update( - THD* thd, - struct st_mysql_sys_var* var, - void* var_ptr, - const void* save); - -static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size, buf_pool.size_in_bytes_requested, PLUGIN_VAR_RQCMDARG, - "The size of the memory buffer InnoDB uses to cache data and indexes of its tables", - innodb_buffer_pool_size_validate, - innodb_buffer_pool_size_update, - 128ULL << 20, - 2ULL << 20, - LLONG_MAX, 1024*1024L); + "The size of the memory buffer InnoDB uses to cache data" + " and indexes of its tables", + nullptr, innodb_buffer_pool_size_update, 128U << 20, 2U << 20, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), 1U << 20); + +#if defined __linux__ || !defined DBUG_OFF +static void innodb_buffer_pool_size_auto_min_update(THD*,st_mysql_sys_var*, + void*, const void *save) + noexcept +{ + mysql_mutex_lock(&buf_pool.mutex); + buf_pool.size_in_bytes_auto_min= *static_cast(save); + mysql_mutex_unlock(&buf_pool.mutex); +} + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size_auto_min, + buf_pool.size_in_bytes_auto_min, + PLUGIN_VAR_RQCMDARG, + "Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure", + nullptr, innodb_buffer_pool_size_auto_min_update, 0, 0, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + innodb_buffer_pool_extent_size); +#endif + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size_max, buf_pool.size_in_bytes_max, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Maximum innodb_buffer_pool_size", + nullptr, nullptr, 0, 0, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + innodb_buffer_pool_extent_size); static MYSQL_SYSVAR_UINT(log_write_ahead_size, log_sys.write_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -3809,29 +3774,6 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) return 0; } -/** Initialize and normalize innodb_buffer_pool_{chunk_,}size. */ -static void innodb_buffer_pool_size_init() -{ - if (srv_buf_pool_chunk_unit > srv_buf_pool_size) - { - /* Size unit of buffer pool is larger than srv_buf_pool_size. - adjust srv_buf_pool_chunk_unit for srv_buf_pool_size. */ - srv_buf_pool_chunk_unit = srv_buf_pool_size; - } - else if (srv_buf_pool_chunk_unit == 0) - { - srv_buf_pool_chunk_unit = srv_buf_pool_size / 64; - my_large_page_truncate(&srv_buf_pool_chunk_unit); - } - - if (srv_buf_pool_chunk_unit < buf_pool_chunk_min_size) - srv_buf_pool_chunk_unit = buf_pool_chunk_min_size; - - srv_buf_pool_size = buf_pool_size_align(srv_buf_pool_size); - innobase_buffer_pool_size = srv_buf_pool_size; -} - - static bool compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags) { @@ -3857,311 +3799,303 @@ compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags) @retval HA_ERR_INITIALIZATION when some parameters are out of range */ static int innodb_init_params() { - DBUG_ENTER("innodb_init_params"); + DBUG_ENTER("innodb_init_params"); - ulong num_pll_degree; + srv_page_size_shift= innodb_page_size_validate(srv_page_size); + if (!srv_page_size_shift) + { + sql_print_error("InnoDB: Invalid page size=%lu.\n", srv_page_size); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* Check that values don't overflow on 32-bit systems. */ - if (sizeof(ulint) == 4) { - if (innobase_buffer_pool_size > UINT_MAX32) { - sql_print_error( - "innodb_buffer_pool_size can't be over 4GB" - " on 32-bit systems"); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } + size_t &min= MYSQL_SYSVAR_NAME(buffer_pool_size).min_val; + min= ut_calc_align + (buf_pool.blocks_in_bytes(BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4), + 1U << 20); + size_t innodb_buffer_pool_size= buf_pool.size_in_bytes_requested; - /* The buffer pool needs to be able to accommodate enough many - pages, even for larger pages */ - MYSQL_SYSVAR_NAME(buffer_pool_size).min_val= min_buffer_pool_size(); + /* With large pages, buffer pool can't grow or shrink. */ + if (!buf_pool.size_in_bytes_max || my_use_large_pages || + innodb_buffer_pool_size > buf_pool.size_in_bytes_max) + buf_pool.size_in_bytes_max= ut_calc_align(innodb_buffer_pool_size, + innodb_buffer_pool_extent_size); - if (innobase_buffer_pool_size < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { - ib::error() << "innodb_page_size=" - << srv_page_size << " requires " - << "innodb_buffer_pool_size >= " - << (MYSQL_SYSVAR_NAME(buffer_pool_size).min_val >> 20) - << "MiB current " << (innobase_buffer_pool_size >> 20) - << "MiB"; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + MYSQL_SYSVAR_NAME(buffer_pool_size).max_val= buf_pool.size_in_bytes_max; +#if defined __linux__ || !defined DBUG_OFF + if (!buf_pool.size_in_bytes_auto_min || + buf_pool.size_in_bytes_auto_min > buf_pool.size_in_bytes_max) + buf_pool.size_in_bytes_auto_min= buf_pool.size_in_bytes_max; + MYSQL_SYSVAR_NAME(buffer_pool_size_auto_min).max_val= + buf_pool.size_in_bytes_max; +#endif - if (!ut_is_2pow(log_sys.write_size)) { - sql_print_error("InnoDB: innodb_log_write_ahead_size=%u" - " is not a power of two", - log_sys.write_size); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (innodb_buffer_pool_size < min) + { + sql_print_error("InnoDB: innodb_page_size=%lu requires " + "innodb_buffer_pool_size >= %zu MiB current %zu MiB", + srv_page_size, min >> 20, innodb_buffer_pool_size >> 20); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG)) - DBUG_RETURN(HA_ERR_INITIALIZATION); + if (!ut_is_2pow(log_sys.write_size)) + { + sql_print_error("InnoDB: innodb_log_write_ahead_size=%u" + " is not a power of two", + log_sys.write_size); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if ((srv_encrypt_tables || srv_encrypt_log - || innodb_encrypt_temporary_tables) - && !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) { - sql_print_error("InnoDB: cannot enable encryption, " - "encryption plugin is not available"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, + ME_ERROR_LOG)) + DBUG_RETURN(HA_ERR_INITIALIZATION); + + if ((srv_encrypt_tables || srv_encrypt_log || + innodb_encrypt_temporary_tables) && + !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) + { + sql_print_error("InnoDB: cannot enable encryption, " + "encryption plugin is not available"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } #ifdef _WIN32 - if (!is_filename_allowed(srv_buf_dump_filename, - strlen(srv_buf_dump_filename), FALSE)) { - sql_print_error("InnoDB: innodb_buffer_pool_filename" - " cannot have colon (:) in the file name."); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!is_filename_allowed(srv_buf_dump_filename, + strlen(srv_buf_dump_filename), false)) + { + sql_print_error("InnoDB: innodb_buffer_pool_filename" + " cannot have colon (:) in the file name."); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } #endif - /* First calculate the default path for innodb_data_home_dir etc., - in case the user has not given any value. + /* First calculate the default path for innodb_data_home_dir etc., + in case the user has not given any value. - Note that when using the embedded server, the datadirectory is not - necessarily the current directory of this program. */ + Note that when using the embedded server, the datadirectory is not + necessarily the current directory of this program. */ - fil_path_to_mysql_datadir = + fil_path_to_mysql_datadir = #ifndef HAVE_REPLICATION - mysqld_embedded ? mysql_real_data_home : + mysqld_embedded ? mysql_real_data_home : #endif - "./"; + "./"; - /* Set InnoDB initialization parameters according to the values - read from MySQL .cnf file */ + /* Set InnoDB initialization parameters according to the values + read from MySQL .cnf file */ - /* The default dir for data files is the datadir of MySQL */ + /* The default dir for data files is the datadir of MySQL */ - srv_data_home = innobase_data_home_dir - ? innobase_data_home_dir - : const_cast(fil_path_to_mysql_datadir); + srv_data_home= innobase_data_home_dir + ? innobase_data_home_dir + : const_cast(fil_path_to_mysql_datadir); #ifdef WITH_WSREP - /* If we use the wsrep API, then we need to tell the server - the path to the data files (for passing it to the SST scripts): */ - wsrep_set_data_home_dir(srv_data_home); + /* If we use the wsrep API, then we need to tell the server + the path to the data files (for passing it to the SST scripts): */ + wsrep_set_data_home_dir(srv_data_home); #endif /* WITH_WSREP */ - /*--------------- Shared tablespaces -------------------------*/ + /*--------------- Shared tablespaces -------------------------*/ - /* Check that the value of system variable innodb_page_size was - set correctly. Its value was put into srv_page_size. If valid, - return the associated srv_page_size_shift. */ - srv_page_size_shift = innodb_page_size_validate(srv_page_size); - if (!srv_page_size_shift) { - sql_print_error("InnoDB: Invalid page size=%lu.\n", - srv_page_size); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + /* Check that the value of system variable innodb_page_size was + set correctly. Its value was put into srv_page_size. If valid, + return the associated srv_page_size_shift. */ - srv_sys_space.set_space_id(TRX_SYS_SPACE); + srv_sys_space.set_space_id(TRX_SYS_SPACE); + /* Temporary tablespace is in full crc32 format. */ + srv_tmp_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER | + FSP_FLAGS_FCRC32_PAGE_SSIZE()); - switch (srv_checksum_algorithm) { - case SRV_CHECKSUM_ALGORITHM_FULL_CRC32: - case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32: - srv_sys_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER - | FSP_FLAGS_FCRC32_PAGE_SSIZE()); - break; - default: - srv_sys_space.set_flags(FSP_FLAGS_PAGE_SSIZE()); - } + switch (srv_checksum_algorithm) { + case SRV_CHECKSUM_ALGORITHM_FULL_CRC32: + case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32: + srv_sys_space.set_flags(srv_tmp_space.flags()); + break; + default: + srv_sys_space.set_flags(FSP_FLAGS_PAGE_SSIZE()); + } - srv_sys_space.set_path(srv_data_home); + srv_sys_space.set_path(srv_data_home); - /* Supports raw devices */ - if (!srv_sys_space.parse_params(innobase_data_file_path, true)) { - ib::error() << "Unable to parse innodb_data_file_path=" - << innobase_data_file_path; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!srv_sys_space.parse_params(innobase_data_file_path, true)) + { + sql_print_error("InnoDB: Unable to parse innodb_data_file_path=%s", + innobase_data_file_path); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - srv_tmp_space.set_path(srv_data_home); + srv_tmp_space.set_path(srv_data_home); - /* Temporary tablespace is in full crc32 format. */ - srv_tmp_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER - | FSP_FLAGS_FCRC32_PAGE_SSIZE()); + if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) + { + sql_print_error("InnoDB: Unable to parse innodb_temp_data_file_path=%s", + innobase_temp_data_file_path); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) { - ib::error() << "Unable to parse innodb_temp_data_file_path=" - << innobase_temp_data_file_path; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + /* Perform all sanity check before we take action of deleting files*/ + if (srv_sys_space.intersection(&srv_tmp_space)) + { + sql_print_error("innodb_temporary and innodb_system" + " file names seem to be the same."); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* Perform all sanity check before we take action of deleting files*/ - if (srv_sys_space.intersection(&srv_tmp_space)) { - sql_print_error("innodb_temporary and innodb_system" - " file names seem to be the same."); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + srv_sys_space.normalize_size(); + srv_tmp_space.normalize_size(); - srv_sys_space.normalize_size(); - srv_tmp_space.normalize_size(); + /* ------------ UNDO tablespaces files ---------------------*/ + if (!srv_undo_dir) + srv_undo_dir= const_cast(fil_path_to_mysql_datadir); - /* ------------ UNDO tablespaces files ---------------------*/ - if (!srv_undo_dir) { - srv_undo_dir = const_cast(fil_path_to_mysql_datadir); - } + if (strchr(srv_undo_dir, ';')) + { + sql_print_error("syntax error in innodb_undo_directory"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (strchr(srv_undo_dir, ';')) { - sql_print_error("syntax error in innodb_undo_directory"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!srv_log_group_home_dir) + srv_log_group_home_dir= const_cast(fil_path_to_mysql_datadir); - /* -------------- All log files ---------------------------*/ + if (strchr(srv_log_group_home_dir, ';')) + { + sql_print_error("syntax error in innodb_log_group_home_dir"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* The default dir for log files is the datadir of MySQL */ + /* Check that interdependent parameters have sane values. */ + if (srv_max_buf_pool_modified_pct < srv_max_dirty_pages_pct_lwm) + { + sql_print_warning("InnoDB: innodb_max_dirty_pages_pct_lwm" + " cannot be set higher than" + " innodb_max_dirty_pages_pct.\n" + "InnoDB: Setting" + " innodb_max_dirty_pages_pct_lwm to %lf\n", + srv_max_buf_pool_modified_pct); + srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; + } - if (!srv_log_group_home_dir) { - srv_log_group_home_dir - = const_cast(fil_path_to_mysql_datadir); - } + if (srv_max_io_capacity == SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT) + { + if (srv_io_capacity >= SRV_MAX_IO_CAPACITY_LIMIT / 2) + /* Avoid overflow. */ + srv_max_io_capacity= SRV_MAX_IO_CAPACITY_LIMIT; + else + /* The user has not set the value. We should set it based on + innodb_io_capacity. */ + srv_max_io_capacity= std::max(2 * srv_io_capacity, 2000UL); + } + else if (srv_max_io_capacity < srv_io_capacity) + { + sql_print_warning("InnoDB: innodb_io_capacity cannot be set higher than" + " innodb_io_capacity_max." + "Setting innodb_io_capacity=%lu", srv_max_io_capacity); + srv_io_capacity= srv_max_io_capacity; + } - if (strchr(srv_log_group_home_dir, ';')) { - sql_print_error("syntax error in innodb_log_group_home_dir"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (UNIV_PAGE_SIZE_DEF != srv_page_size) + { + sql_print_information("InnoDB: innodb_page_size=%lu", srv_page_size); + srv_max_undo_log_size= + std::max(srv_max_undo_log_size, + ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) << + srv_page_size_shift); + } - /* Check that interdependent parameters have sane values. */ - if (srv_max_buf_pool_modified_pct < srv_max_dirty_pages_pct_lwm) { - sql_print_warning("InnoDB: innodb_max_dirty_pages_pct_lwm" - " cannot be set higher than" - " innodb_max_dirty_pages_pct.\n" - "InnoDB: Setting" - " innodb_max_dirty_pages_pct_lwm to %lf\n", - srv_max_buf_pool_modified_pct); + if (innobase_open_files < 10) + innobase_open_files= (srv_file_per_table && tc_size > 300 && + tc_size < open_files_limit) + ? tc_size + : 300; - srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; - } + if (innobase_open_files > open_files_limit) + { + sql_print_warning("InnoDB: innodb_open_files %lu" + " should not be greater than the open_files_limit %lu", + innobase_open_files, open_files_limit); + if (innobase_open_files > tc_size) + innobase_open_files= tc_size; + } - if (srv_max_io_capacity == SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT) { + const size_t min_open_files_limit= srv_undo_tablespaces + + srv_sys_space.m_files.size() + srv_tmp_space.m_files.size() + 1; + if (min_open_files_limit > innobase_open_files) + { + sql_print_warning("InnoDB: innodb_open_files=%lu is not greater " + "than the number of system tablespace files, " + "temporary tablespace files, " + "innodb_undo_tablespaces=%u; adjusting " + "to innodb_open_files=%zu", + innobase_open_files, srv_undo_tablespaces, + min_open_files_limit); + innobase_open_files= ulong(min_open_files_limit); + } - if (srv_io_capacity >= SRV_MAX_IO_CAPACITY_LIMIT / 2) { - /* Avoid overflow. */ - srv_max_io_capacity = SRV_MAX_IO_CAPACITY_LIMIT; - } else { - /* The user has not set the value. We should - set it based on innodb_io_capacity. */ - srv_max_io_capacity = - ut_max(2 * srv_io_capacity, 2000UL); - } + srv_max_n_open_files= innobase_open_files; + srv_innodb_status = (ibool) innobase_create_status_file; - } else if (srv_max_io_capacity < srv_io_capacity) { - sql_print_warning("InnoDB: innodb_io_capacity" - " cannot be set higher than" - " innodb_io_capacity_max." - "Setting innodb_io_capacity=%lu", - srv_max_io_capacity); + srv_print_verbose_log= !mysqld_embedded; - srv_io_capacity = srv_max_io_capacity; - } + if (!ut_is_2pow(fts_sort_pll_degree)) + { + ulong n; + for (n= 1; n < fts_sort_pll_degree; n<<= 1) {} + fts_sort_pll_degree= n; + } - if (UNIV_PAGE_SIZE_DEF != srv_page_size) { - ib::info() << "innodb_page_size=" << srv_page_size; - - srv_max_undo_log_size = std::max( - srv_max_undo_log_size, - ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) - << srv_page_size_shift); - } - - srv_buf_pool_size = ulint(innobase_buffer_pool_size); - - if (innobase_open_files < 10) { - innobase_open_files = 300; - if (srv_file_per_table && tc_size > 300 && tc_size < open_files_limit) { - innobase_open_files = tc_size; - } - } - - if (innobase_open_files > open_files_limit) { - ib::warn() << "innodb_open_files " << innobase_open_files - << " should not be greater" - << " than the open_files_limit " << open_files_limit; - if (innobase_open_files > tc_size) { - innobase_open_files = tc_size; - } - } - - ulint min_open_files_limit = srv_undo_tablespaces - + srv_sys_space.m_files.size() - + srv_tmp_space.m_files.size() + 1; - if (min_open_files_limit > innobase_open_files) { - sql_print_warning( - "InnoDB: innodb_open_files=%lu is not greater " - "than the number of system tablespace files, " - "temporary tablespace files, " - "innodb_undo_tablespaces=%u; adjusting " - "to innodb_open_files=%zu", - innobase_open_files, srv_undo_tablespaces, - min_open_files_limit); - innobase_open_files = (ulong) min_open_files_limit; - } - - srv_max_n_open_files = innobase_open_files; - srv_innodb_status = (ibool) innobase_create_status_file; - - srv_print_verbose_log = mysqld_embedded ? 0 : 1; - - /* Round up fts_sort_pll_degree to nearest power of 2 number */ - for (num_pll_degree = 1; - num_pll_degree < fts_sort_pll_degree; - num_pll_degree <<= 1) { - - /* No op */ - } - - fts_sort_pll_degree = num_pll_degree; - - if (innodb_flush_method == 1 /* O_DSYNC */) { - log_sys.log_write_through = true; - fil_system.write_through = true; - fil_system.buffered = false; + if (innodb_flush_method == 1 /* O_DSYNC */) + { + log_sys.log_write_through= true; + fil_system.write_through= true; + fil_system.buffered= false; #if defined __linux__ || defined _WIN32 - log_sys.log_buffered = false; - goto skip_buffering_tweak; + log_sys.log_buffered= false; + goto skip_buffering_tweak; #endif - } else if (innodb_flush_method >= 4 /* O_DIRECT */ - IF_WIN(&& innodb_flush_method < 8 /* normal */,)) { - /* O_DIRECT and similar settings do nothing */ - if (innodb_flush_method == 5 /* O_DIRECT_NO_FSYNC */ - && buf_dblwr.use) { - buf_dblwr.use = buf_dblwr.USE_FAST; - } + } + else if (innodb_flush_method >= 4 /* O_DIRECT */ && + IF_WIN(innodb_flush_method < 8 /* normal */, true)) + { + /* O_DIRECT and similar settings do nothing */ + if (innodb_flush_method == 5 /* O_DIRECT_NO_FSYNC */ && buf_dblwr.use) + buf_dblwr.use= buf_dblwr.USE_FAST; + } #ifdef O_DIRECT - } else if (srv_use_atomic_writes && my_may_have_atomic_write) { - /* If atomic writes are enabled, do the same as with - innodb_flush_method=O_DIRECT: retain the default settings */ + else if (srv_use_atomic_writes && my_may_have_atomic_write) + /* If atomic writes are enabled, do the same as with + innodb_flush_method=O_DIRECT: retain the default settings */; #endif - } else { - log_sys.log_write_through = false; - fil_system.write_through = false; - fil_system.buffered = true; - } + else + { + log_sys.log_write_through= false; + fil_system.write_through= false; + fil_system.buffered= true; + } #if defined __linux__ || defined _WIN32 - if (srv_flush_log_at_trx_commit == 2) { - /* Do not disable the file system cache if - innodb_flush_log_at_trx_commit=2. */ - log_sys.log_buffered = true; - } + if (srv_flush_log_at_trx_commit == 2) + /* Do not disable the file system cache if + innodb_flush_log_at_trx_commit=2. */ + log_sys.log_buffered= true; skip_buffering_tweak: #endif +#if !defined LINUX_NATIVE_AIO && !defined HAVE_URING && !defined _WIN32 + /* Currently native AIO is supported only on windows and linux + and that also when the support is compiled in. In all other + cases, we ignore the setting of innodb_use_native_aio. */ + srv_use_native_aio= FALSE; +#endif #ifdef HAVE_URING - if (srv_use_native_aio && io_uring_may_be_unsafe) { - sql_print_warning("innodb_use_native_aio may cause " - "hangs with this kernel %s; see " - "https://jira.mariadb.org/browse/MDEV-26674", - io_uring_may_be_unsafe); - } -#elif !defined LINUX_NATIVE_AIO && !defined _WIN32 - /* Currently native AIO is supported only on windows and linux - and that also when the support is compiled in. In all other - cases, we ignore the setting of innodb_use_native_aio. */ - srv_use_native_aio = FALSE; + if (srv_use_native_aio && io_uring_may_be_unsafe) + sql_print_warning("innodb_use_native_aio may cause " + "hangs with this kernel %s; see " + "https://jira.mariadb.org/browse/MDEV-26674", + io_uring_may_be_unsafe); #endif - innodb_buffer_pool_size_init(); - - srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); - DBUG_RETURN(0); + srv_lock_table_size= 5 * buf_pool.curr_size(); + DBUG_RETURN(0); } @@ -5856,7 +5790,7 @@ dberr_t ha_innobase::statistics_init(dict_table_t *table, bool recalc) if (err == DB_STATS_DO_NOT_EXIST && table->stats_is_auto_recalc()) goto recalc; } - if (err == DB_SUCCESS) + if (err == DB_SUCCESS || err == DB_READ_ONLY) return err; if (!recalc) break; @@ -7982,6 +7916,17 @@ set_max_autoinc: error, m_prebuilt->table->flags, m_user_thd); #ifdef WITH_WSREP +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_after_write_row", + { + const char act[]= + "now " + "SIGNAL sync.wsrep_after_write_row_reached " + "WAIT_FOR signal.wsrep_after_write_row"; + DBUG_ASSERT(!debug_sync_set_action(m_user_thd, STRING_WITH_LEN(act))); + };); +#endif /* ENABLED_DEBUG_SYNC */ + if (!error_result && trx->is_wsrep() && !trx->is_bulk_insert() && wsrep_thd_is_local(m_user_thd) @@ -13661,8 +13606,6 @@ int ha_innobase::delete_table(const char *name) err= lock_table_children(table, trx); } - dict_table_t *table_stats= nullptr, *index_stats= nullptr; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; if (err == DB_SUCCESS) err= lock_table_for_trx(table, trx, LOCK_X); @@ -13701,37 +13644,18 @@ int ha_innobase::delete_table(const char *name) #endif DEBUG_SYNC(thd, "before_delete_table_stats"); + dict_stats stats; + bool stats_failed= true; if (err == DB_SUCCESS && table->stats_is_persistent() && !table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + stats_failed= stats.open(thd); const bool skip_wait{table->name.is_temporary()}; - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(err= lock_table_for_trx(table_stats, trx, LOCK_X, skip_wait))) - err= lock_table_for_trx(index_stats, trx, LOCK_X, skip_wait); + if (!stats_failed && + !(err= lock_table_for_trx(stats.table(), trx, LOCK_X, skip_wait))) + err= lock_table_for_trx(stats.index(), trx, LOCK_X, skip_wait); if (err != DB_SUCCESS && skip_wait) { @@ -13740,10 +13664,8 @@ int ha_innobase::delete_table(const char *name) ut_ad(err == DB_LOCK_WAIT); ut_ad(trx->error_state == DB_SUCCESS); err= DB_SUCCESS; - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - table_stats= nullptr; - index_stats= nullptr; + stats.close(); + stats_failed= true; } } @@ -13814,13 +13736,11 @@ err_exit: else if (rollback_add_partition) purge_sys.resume_FTS(); #endif - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); if (trx != parent_trx) trx->free(); + if (!stats_failed) + stats.close(); DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL)); } @@ -13835,7 +13755,7 @@ err_exit: err= trx->drop_table_foreign(table->name); } - if (err == DB_SUCCESS && table_stats && index_stats) + if (err == DB_SUCCESS && !stats_failed) err= trx->drop_table_statistics(table->name); if (err != DB_SUCCESS) goto err_exit; @@ -13846,11 +13766,9 @@ err_exit: std::vector deleted; trx->commit(deleted); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) + stats.close(); for (pfs_os_file_t d : deleted) os_file_close(d); log_write_up_to(trx->commit_lsn, true); @@ -14047,9 +13965,6 @@ int ha_innobase::truncate() ib_table->name.m_name, ib_table->id); const char *name= mem_heap_strdup(heap, ib_table->name.m_name); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dberr_t error= lock_table_children(ib_table, trx); if (error == DB_SUCCESS) @@ -14057,6 +13972,7 @@ int ha_innobase::truncate() const bool fts= error == DB_SUCCESS && ib_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge= error == DB_SUCCESS && ib_table->get_ref_count() > 1; if (fts) { @@ -14064,6 +13980,8 @@ int ha_innobase::truncate() purge_sys.stop_FTS(*ib_table); error= fts_lock_tables(trx, *ib_table); } + else if (pause_purge) + purge_sys.stop_FTS(); if (error == DB_SUCCESS) { @@ -14079,33 +13997,16 @@ int ha_innobase::truncate() } } + dict_stats stats; + bool stats_failed= true; + if (error == DB_SUCCESS && ib_table->stats_is_persistent() && !ib_table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, m_user_thd, - &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, m_user_thd, - &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(error= lock_table_for_trx(table_stats, trx, LOCK_X))) - error= lock_table_for_trx(index_stats, trx, LOCK_X); + stats_failed= stats.open(m_user_thd); + if (!stats_failed && + !(error= lock_table_for_trx(stats.table(), trx, LOCK_X))) + error= lock_table_for_trx(stats.index(), trx, LOCK_X); } if (error == DB_SUCCESS) @@ -14197,14 +14098,9 @@ int ha_innobase::truncate() } trx->free(); - + if (!stats_failed) + stats.close(); mem_heap_free(heap); - - if (table_stats) - dict_table_close(table_stats, m_user_thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, m_user_thd, mdl_index); - DBUG_RETURN(err); } @@ -14266,8 +14162,6 @@ ha_innobase::rename_table( trx_t* trx = innobase_trx_allocate(thd); trx_start_for_ddl(trx); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; char norm_from[MAX_FULL_NAME_LEN]; char norm_to[MAX_FULL_NAME_LEN]; @@ -14278,6 +14172,7 @@ ha_innobase::rename_table( const bool from_temp = dict_table_t::is_temporary_name(norm_from); dict_table_t* t; + bool pause_purge = false, fts_exist = false; if (from_temp) { /* There is no need to lock any FOREIGN KEY child tables. */ @@ -14290,37 +14185,35 @@ ha_innobase::rename_table( if (error == DB_SUCCESS) { error = lock_table_for_trx(t, trx, LOCK_X); } + fts_exist = error == DB_SUCCESS && t->flags2 + & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + pause_purge = error == DB_SUCCESS + && t->get_ref_count() > 1; + if (fts_exist) { + fts_optimize_remove_table(t); + purge_sys.stop_FTS(*t); + if (error == DB_SUCCESS) { + error = fts_lock_tables(trx, *t); + } + } else if (pause_purge) { + purge_sys.stop_FTS(); + } } } + dict_stats stats; + bool stats_fail = true; + if (strcmp(norm_from, TABLE_STATS_NAME) && strcmp(norm_from, INDEX_STATS_NAME) && strcmp(norm_to, TABLE_STATS_NAME) && strcmp(norm_to, INDEX_STATS_NAME)) { - table_stats = dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (error == DB_SUCCESS && table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - error = lock_table_for_trx(table_stats, trx, LOCK_X, - from_temp); + stats_fail = stats.open(thd); + if (!stats_fail && error == DB_SUCCESS) { + error = lock_table_for_trx(stats.table(), trx, + LOCK_X, from_temp); if (error == DB_SUCCESS) { - error = lock_table_for_trx(index_stats, trx, + error = lock_table_for_trx(stats.index(), trx, LOCK_X, from_temp); } if (error != DB_SUCCESS && from_temp) { @@ -14331,10 +14224,8 @@ ha_innobase::rename_table( we cannot lock the tables, when the table is being renamed from from a temporary name. */ - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - table_stats = nullptr; - index_stats = nullptr; + stats.close(); + stats_fail = true; } } } @@ -14361,7 +14252,7 @@ ha_innobase::rename_table( DEBUG_SYNC(thd, "after_innobase_rename_table"); - if (error == DB_SUCCESS && table_stats && index_stats) { + if (error == DB_SUCCESS && !stats_fail) { error = dict_stats_rename_table(norm_from, norm_to, trx); if (error == DB_DUPLICATE_KEY) { /* The duplicate may also occur in @@ -14375,7 +14266,10 @@ ha_innobase::rename_table( if (error == DB_SUCCESS) { trx->flush_log_later = true; if (t) { - ut_ad(dict_sys.frozen()); + ut_ad(dict_sys.locked()); + if (fts_exist) { + fts_optimize_add_table(t); + } if (UNIV_LIKELY(t->release())) { stats_deinit(t); } else { @@ -14385,23 +14279,28 @@ ha_innobase::rename_table( innobase_commit_low(trx); } else { if (t) { + if (fts_exist) { + fts_optimize_add_table(t); + } t->release(); } trx->rollback(); } - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, thd, mdl_index); - } row_mysql_unlock_data_dictionary(trx); + + if (fts_exist || pause_purge) { + purge_sys.resume_FTS(); + } + if (error == DB_SUCCESS) { log_write_up_to(trx->commit_lsn, true); } trx->flush_log_later = false; trx->free(); + if (!stats_fail) { + stats.close(); + } if (error == DB_DUPLICATE_KEY) { /* We are not able to deal with handler::get_dup_key() @@ -14947,6 +14846,7 @@ recalc: ret = statistics_init(ib_table, is_analyze); switch (ret) { case DB_SUCCESS: + case DB_READ_ONLY: break; default: goto error; @@ -15977,28 +15877,37 @@ ha_innobase::extra( break; case HA_EXTRA_END_ALTER_COPY: trx = check_trx_exists(ha_thd()); - if (m_prebuilt->table->skip_alter_undo) { - if (dberr_t err= trx->bulk_insert_apply()) { - m_prebuilt->table->skip_alter_undo = 0; - return convert_error_code_to_mysql( - err, - m_prebuilt->table->flags, - trx->mysql_thd); - } - - trx->end_bulk_insert(*m_prebuilt->table); - trx->bulk_insert = false; - /* During copy alter operation, InnoDB - updates the stats only for non-persistent - tables. */ - if (!m_prebuilt->table->stats_is_persistent()) { - dict_stats_update_if_needed( - m_prebuilt->table, *trx); - } + if (!m_prebuilt->table->skip_alter_undo) { + /* This could be invoked inside INSERT...SELECT. + We do not want any extra log writes, because + they could cause a severe performance regression. */ + break; } m_prebuilt->table->skip_alter_undo = 0; + if (dberr_t err= trx->bulk_insert_apply()) { + m_prebuilt->table->skip_alter_undo = 0; + return convert_error_code_to_mysql( + err, m_prebuilt->table->flags, + trx->mysql_thd); + } + + trx->end_bulk_insert(*m_prebuilt->table); + trx->bulk_insert = false; if (!m_prebuilt->table->is_temporary() && !high_level_read_only) { + /* During copy_data_between_tables(), InnoDB only + updates transient statistics. */ + if (!m_prebuilt->table->stats_is_persistent()) { + dict_stats_update_if_needed(m_prebuilt->table, + *trx); + } + /* The extra log write is necessary for + ALTER TABLE...ALGORITHM=COPY, because + a normal transaction commit would be a no-op + because no undo log records were generated. + This log write will also be unnecessarily executed + during CREATE...SELECT, which is the other caller of + handler::extra(HA_EXTRA_BEGIN_ALTER_COPY). */ log_buffer_flush_to_disk(); } break; @@ -17435,7 +17344,12 @@ ha_innobase::check_if_incompatible_data( param_new = info->option_struct; param_old = table->s->option_struct; - innobase_copy_frm_flags_from_create_info(m_prebuilt->table, info); + m_prebuilt->table->stats_mutex_lock(); + if (!m_prebuilt->table->stat_initialized()) { + innobase_copy_frm_flags_from_create_info( + m_prebuilt->table, info); + } + m_prebuilt->table->stats_mutex_unlock(); if (table_changes != IS_EQUAL_YES) { @@ -17524,7 +17438,8 @@ innodb_io_capacity_update( " higher than innodb_io_capacity_max %lu", in_val, srv_max_io_capacity); - srv_max_io_capacity = (in_val & ~(~0UL >> 1)) + /* Avoid overflow. */ + srv_max_io_capacity = (in_val >= SRV_MAX_IO_CAPACITY_LIMIT / 2) ? in_val : in_val * 2; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -17687,22 +17602,6 @@ innodb_stopword_table_validate( return(ret); } -extern void buf_resize_start(); - -/** Update the system variable innodb_buffer_pool_size using the "saved" -value. This function is registered as a callback with MySQL. -@param[in] save immediate result from check function */ -static -void -innodb_buffer_pool_size_update(THD*,st_mysql_sys_var*,void*, const void* save) -{ - snprintf(export_vars.innodb_buffer_pool_resize_status, - sizeof(export_vars.innodb_buffer_pool_resize_status), - "Buffer pool resize requested"); - - buf_resize_start(); -} - /** The latest assigned innodb_ft_aux_table name */ static char* innodb_ft_aux_table; @@ -17717,11 +17616,16 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, int len = sizeof buf; if (const char* table_name = value->val_str(value, buf, &len)) { + /* Because we are not acquiring MDL on the table name, + we must contiguously hold dict_sys.latch while we are + examining the table, to protect us against concurrent DDL. */ + dict_sys.lock(SRW_LOCK_CALL); if (dict_table_t* table = dict_table_open_on_name( - table_name, false, DICT_ERR_IGNORE_NONE)) { + table_name, true, DICT_ERR_IGNORE_NONE)) { + table->release(); const table_id_t id = dict_table_has_fts_index(table) ? table->id : 0; - table->release(); + dict_sys.unlock(); if (id) { innodb_ft_aux_table_id = id; if (table_name == buf) { @@ -17732,12 +17636,12 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, len); } - *static_cast(save) = table_name; return 0; } + } else { + dict_sys.unlock(); } - return 1; } else { *static_cast(save) = NULL; @@ -18503,13 +18407,13 @@ static void innodb_buf_pool_update(THD *thd, st_mysql_sys_var *, mysql_mutex_unlock(&buf_pool.mutex); } +static my_bool innodb_log_checkpoint_now; #ifdef UNIV_DEBUG -static my_bool innodb_log_checkpoint_now = TRUE; static my_bool innodb_buf_flush_list_now = TRUE; static uint innodb_merge_threshold_set_all_debug = DICT_INDEX_MERGE_THRESHOLD_DEFAULT; +#endif -/** Force an InnoDB log checkpoint. */ /** Force an InnoDB log checkpoint. */ static void @@ -18535,13 +18439,15 @@ checkpoint_now_set(THD* thd, st_mysql_sys_var*, void*, const void *save) ? SIZE_OF_FILE_CHECKPOINT + 8 : SIZE_OF_FILE_CHECKPOINT; mysql_mutex_unlock(&LOCK_global_system_variables); lsn_t lsn; - while (log_sys.last_checkpoint_lsn.load(std::memory_order_acquire) + size < + while (!thd_kill_level(thd) && + log_sys.last_checkpoint_lsn.load(std::memory_order_acquire) + size < (lsn= log_sys.get_lsn(std::memory_order_acquire))) log_make_checkpoint(); mysql_mutex_lock(&LOCK_global_system_variables); } +#ifdef UNIV_DEBUG /****************************************************************//** Force a dirty pages flush now. */ static @@ -19153,7 +19059,7 @@ static MYSQL_SYSVAR_ENUM(instant_alter_column_allowed, static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, PLUGIN_VAR_RQCMDARG, "Number of IOPs the server can do. Tunes the background IO rate", - NULL, innodb_io_capacity_update, 200, 100, ~0UL, 0); + NULL, innodb_io_capacity_update, 200, 100, SRV_MAX_IO_CAPACITY_LIMIT, 0); static MYSQL_SYSVAR_ULONG(io_capacity_max, srv_max_io_capacity, PLUGIN_VAR_RQCMDARG, @@ -19162,12 +19068,12 @@ static MYSQL_SYSVAR_ULONG(io_capacity_max, srv_max_io_capacity, SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT, 100, SRV_MAX_IO_CAPACITY_LIMIT, 0); -#ifdef UNIV_DEBUG static MYSQL_SYSVAR_BOOL(log_checkpoint_now, innodb_log_checkpoint_now, PLUGIN_VAR_OPCMDARG, - "Force checkpoint now", + "Write back dirty pages from the buffer pool and update the log checkpoint", NULL, checkpoint_now_set, FALSE); +#ifdef UNIV_DEBUG static MYSQL_SYSVAR_BOOL(buf_flush_list_now, innodb_buf_flush_list_now, PLUGIN_VAR_OPCMDARG, "Force dirty page flush now", @@ -19384,11 +19290,12 @@ static MYSQL_SYSVAR_UINT(autoextend_increment, "Data file autoextend increment in megabytes", NULL, NULL, 64, 1, 1000, 0); -static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, - "Size of a single memory chunk" - " for resizing buffer pool. Online buffer pool resizing happens at this" - " granularity. 0 means autosize this variable based on buffer pool size", +static size_t innodb_buffer_pool_chunk_size; + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, + innodb_buffer_pool_chunk_size, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED, + "Deprecated parameter with no effect", NULL, NULL, 0, 0, SIZE_T_MAX, 1024 * 1024); @@ -20039,6 +19946,10 @@ static MYSQL_SYSVAR_BOOL(truncate_temporary_tablespace_now, static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), +#if defined __linux__ || !defined DBUG_OFF + MYSQL_SYSVAR(buffer_pool_size_auto_min), +#endif + MYSQL_SYSVAR(buffer_pool_size_max), MYSQL_SYSVAR(buffer_pool_chunk_size), MYSQL_SYSVAR(buffer_pool_filename), MYSQL_SYSVAR(buffer_pool_dump_now), @@ -20156,8 +20067,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(monitor_reset_all), MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), -#ifdef UNIV_DEBUG MYSQL_SYSVAR(log_checkpoint_now), +#ifdef UNIV_DEBUG MYSQL_SYSVAR(buf_flush_list_now), MYSQL_SYSVAR(merge_threshold_set_all_debug), #endif /* UNIV_DEBUG */ @@ -21143,90 +21054,6 @@ innobase_convert_to_system_charset( cs2, to, static_cast(len), errors))); } -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - st_mysql_sys_var*, - void* save, - struct st_mysql_value* value) -{ - longlong intbuf; - - value->val_int(value, &intbuf); - - if (static_cast(intbuf) < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "innodb_buffer_pool_size must be at least" - " %lld for innodb_page_size=%lu", - MYSQL_SYSVAR_NAME(buffer_pool_size).min_val, - srv_page_size); - return(1); - } - - if (!srv_was_started) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "Cannot update innodb_buffer_pool_size," - " because InnoDB is not started."); - return(1); - } - - mysql_mutex_lock(&buf_pool.mutex); - - if (srv_buf_pool_old_size != srv_buf_pool_size) { - mysql_mutex_unlock(&buf_pool.mutex); - my_printf_error(ER_WRONG_ARGUMENTS, - "Another buffer pool resize is already in progress.", MYF(0)); - return(1); - } - - ulint requested_buf_pool_size = buf_pool_size_align(ulint(intbuf)); - - *static_cast(save) = requested_buf_pool_size; - - if (srv_buf_pool_size == ulint(intbuf)) { - mysql_mutex_unlock(&buf_pool.mutex); - /* nothing to do */ - return(0); - } - - if (srv_buf_pool_size == requested_buf_pool_size) { - mysql_mutex_unlock(&buf_pool.mutex); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "innodb_buffer_pool_size must be at least" - " innodb_buffer_pool_chunk_size=%zu", - srv_buf_pool_chunk_unit); - /* nothing to do */ - return(0); - } - - srv_buf_pool_size = requested_buf_pool_size; - mysql_mutex_unlock(&buf_pool.mutex); - - if (intbuf != static_cast(requested_buf_pool_size)) { - char buf[64]; - int len = 64; - value->val_str(value, buf, &len); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - "Truncated incorrect %-.32s value: '%-.128s'", - mysql_sysvar_buffer_pool_size.name, - value->val_str(value, buf, &len)); - } - - return(0); -} - /*************************************************************//** Check for a valid value of innobase_compression_algorithm. @return 0 for valid innodb_compression_algorithm. */ @@ -21522,19 +21349,3 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row) if (UNIV_LIKELY_NULL(local_heap)) mem_heap_free(local_heap); } - -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -ulint buf_pool_size_align(ulint size) noexcept -{ - const size_t m = srv_buf_pool_chunk_unit; - size = ut_max(size, (size_t) MYSQL_SYSVAR_NAME(buffer_pool_size).min_val); - - if (size % m == 0) { - return(size); - } else { - return (size / m + 1) * m; - } -} diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index dd07d891bce..5dacba955d3 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2237,6 +2237,12 @@ ha_innobase::check_if_supported_inplace_alter( DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } + if (ha_alter_info->create_info->used_fields + & HA_CREATE_USED_SEQUENCE) { + ha_alter_info->unsupported_reason = "SEQUENCE"; + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + update_thd(); if (!m_prebuilt->table->space) { @@ -6494,6 +6500,8 @@ prepare_inplace_alter_table_dict( DBUG_ASSERT(!ctx->add_index); DBUG_ASSERT(!ctx->add_key_numbers); DBUG_ASSERT(!ctx->num_to_add_index); + DBUG_ASSERT(!(ha_alter_info->create_info->used_fields + & HA_CREATE_USED_SEQUENCE)); user_table = ctx->new_table; @@ -6593,8 +6601,9 @@ prepare_inplace_alter_table_dict( mem_heap_alloc(ctx->heap, ctx->num_to_add_index * sizeof *ctx->add_key_numbers)); - const bool fts_exist = ctx->new_table->flags2 + const bool have_fts = user_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge = have_fts || user_table->get_ref_count() > 1; /* Acquire a lock on the table before creating any indexes. */ bool table_lock_failed = false; @@ -6621,13 +6630,18 @@ acquire_lock: user_table->lock_shared_unlock(); } - if (fts_exist) { - purge_sys.stop_FTS(*ctx->new_table); + if (pause_purge) { + purge_sys.stop_FTS(); + if (have_fts) { + purge_sys.stop_FTS(*user_table, true); + } if (error == DB_SUCCESS) { - error = fts_lock_tables(ctx->trx, *ctx->new_table); + error = fts_lock_tables(ctx->trx, *user_table); } } + ut_ad(user_table->get_ref_count() == 1); + if (error == DB_SUCCESS) { error = lock_sys_tables(ctx->trx); } @@ -7459,7 +7473,7 @@ error_handling_drop_uncached: /* fts_create_common_tables() may drop old common tables, whose files would be deleted here. */ commit_unlock_and_unlink(ctx->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } @@ -7556,7 +7570,7 @@ err_exit: ctx->trx->free(); } trx_commit_for_mysql(ctx->prebuilt->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } @@ -11557,34 +11571,16 @@ err_index: } } - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; + dict_stats stats; + bool stats_failed = true; dberr_t error = DB_SUCCESS; if (!ctx0->old_table->is_stats_table() && !ctx0->new_table->is_stats_table()) { - table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, m_user_thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, m_user_thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) - && !(error = lock_table_for_trx(table_stats, + stats_failed = stats.open(m_user_thd); + if (!stats_failed + && !(error = lock_table_for_trx(stats.table(), trx, LOCK_X))) { - error = lock_table_for_trx(index_stats, trx, LOCK_X); + error = lock_table_for_trx(stats.index(), trx, LOCK_X); } } @@ -11598,13 +11594,9 @@ err_index: error = lock_sys_tables(trx); } if (error != DB_SUCCESS) { - if (table_stats) { - dict_table_close(table_stats, m_user_thd, mdl_table); + if (!stats_failed) { + stats.close(); } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, mdl_index); - } - my_error_innodb(error, table_share->table_name.str, 0); if (fts_exist) { purge_sys.resume_FTS(); } @@ -11620,6 +11612,7 @@ err_index: trx_start_for_ddl(trx); } + my_error_innodb(error, table_share->table_name.str, 0); DBUG_RETURN(true); } @@ -11637,15 +11630,10 @@ err_index: fail: trx->rollback(); ut_ad(!trx->fts_trx); - if (table_stats) { - dict_table_close(table_stats, m_user_thd, - mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, - mdl_index); - } row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11665,14 +11653,14 @@ fail: if (commit_try_rebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; } } else if (commit_try_norebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; @@ -11695,13 +11683,6 @@ fail: #endif } - if (table_stats) { - dict_table_close(table_stats, m_user_thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, mdl_index); - } - /* Commit or roll back the changes to the data dictionary. */ DEBUG_SYNC(m_user_thd, "innodb_alter_inplace_before_commit"); @@ -11850,6 +11831,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11906,6 +11890,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 71e98bfa224..828e0ef9fd5 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -3381,7 +3381,7 @@ static int i_s_innodb_stats_fill(THD *thd, TABLE_LIST * tables, Item *) DBUG_RETURN(0); } - buf_stats_get_pool_info(&info); + buf_pool.get_info(&info); table = tables->table; @@ -3925,87 +3925,37 @@ and fetch information to information schema tables: INNODB_BUFFER_PAGE. @return 0 on success, 1 on failure */ static int i_s_innodb_buffer_page_fill(THD *thd, TABLE_LIST *tables, Item *) { - int status = 0; - mem_heap_t* heap; + DBUG_ENTER("i_s_innodb_buffer_page_fill"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); - DBUG_ENTER("i_s_innodb_buffer_page_fill"); + /* deny access to user without PROCESS privilege */ + if (check_global_access(thd, PROCESS_ACL)) + DBUG_RETURN(0); - RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); + int status; + buf_page_info_t *b= + static_cast(my_malloc(PSI_INSTRUMENT_ME, + MAX_BUF_INFO_CACHED * sizeof *b, + MYF(MY_WME))); + if (!b) + DBUG_RETURN(1); + for (size_t j= 0;;) + { + memset((void*) b, 0, MAX_BUF_INFO_CACHED * sizeof *b); + mysql_mutex_lock(&buf_pool.mutex); + const size_t N= buf_pool.curr_size(); + const size_t n= std::min(N, MAX_BUF_INFO_CACHED); + for (size_t i= 0; i < n && j < N; i++, j++) + i_s_innodb_buffer_page_get_info(&buf_pool.get_nth_page(j)->page, j, + &b[i]); - /* deny access to user without PROCESS privilege */ - if (check_global_access(thd, PROCESS_ACL)) { - DBUG_RETURN(0); - } - - heap = mem_heap_create(10000); - - for (ulint n = 0; - n < ut_min(buf_pool.n_chunks, buf_pool.n_chunks_new); n++) { - const buf_block_t* block; - ulint n_blocks; - buf_page_info_t* info_buffer; - ulint num_page; - ulint mem_size; - ulint chunk_size; - ulint num_to_process = 0; - ulint block_id = 0; - - /* Get buffer block of the nth chunk */ - block = buf_pool.chunks[n].blocks; - chunk_size = buf_pool.chunks[n].size; - num_page = 0; - - while (chunk_size > 0) { - /* we cache maximum MAX_BUF_INFO_CACHED number of - buffer page info */ - num_to_process = ut_min(chunk_size, - (ulint)MAX_BUF_INFO_CACHED); - - mem_size = num_to_process * sizeof(buf_page_info_t); - - /* For each chunk, we'll pre-allocate information - structures to cache the page information read from - the buffer pool. Doing so before obtain any mutex */ - info_buffer = (buf_page_info_t*) mem_heap_zalloc( - heap, mem_size); - - /* Obtain appropriate mutexes. Since this is diagnostic - buffer pool info printout, we are not required to - preserve the overall consistency, so we can - release mutex periodically */ - mysql_mutex_lock(&buf_pool.mutex); - - /* GO through each block in the chunk */ - for (n_blocks = num_to_process; n_blocks--; block++) { - i_s_innodb_buffer_page_get_info( - &block->page, block_id, - info_buffer + num_page); - block_id++; - num_page++; - } - - mysql_mutex_unlock(&buf_pool.mutex); - - /* Fill in information schema table with information - just collected from the buffer chunk scan */ - status = i_s_innodb_buffer_page_fill( - thd, tables, info_buffer, - num_page); - - /* If something goes wrong, break and return */ - if (status) { - break; - } - - mem_heap_empty(heap); - chunk_size -= num_to_process; - num_page = 0; - } - } - - mem_heap_free(heap); - - DBUG_RETURN(status); + mysql_mutex_unlock(&buf_pool.mutex); + status= i_s_innodb_buffer_page_fill(thd, tables, b, n); + if (status || j >= N) + break; + } + my_free(b); + DBUG_RETURN(status); } /*******************************************************************//** diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index f2cd84838df..f04d4b9187d 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -37,6 +37,8 @@ extern mysql_pfs_key_t btr_search_latch_key; # define btr_search_sys_create() btr_search.create() # define btr_search_sys_free() btr_search.free() +ATTRIBUTE_COLD void btr_search_lazy_free(dict_index_t *index) noexcept; + /** Tries to guess the right search position based on the hash search info of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts, and the function returns TRUE, then cursor->up_match and cursor->low_match @@ -107,12 +109,13 @@ struct btr_sea while a thread is holding a partition::latch, then also this must hold. */ Atomic_relaxed enabled; - /** Disable the adaptive hash search system and empty the index. */ - void disable() noexcept; + /** Disable the adaptive hash search system and empty the index. + @return whether the adaptive hash index was enabled */ + ATTRIBUTE_COLD bool disable() noexcept; /** Enable the adaptive hash search system. @param resize whether buf_pool_t::resize() is the caller */ - void enable(bool resize= false) noexcept; + ATTRIBUTE_COLD void enable(bool resize= false) noexcept; /** Partition of the hash table */ struct partition diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index bb9994203d6..9ac26c7d4be 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -24,17 +24,13 @@ Binary buddy allocator for compressed pages Created December 2006 by Marko Makela *******************************************************/ -#ifndef buf0buddy_h -#define buf0buddy_h - +#pragma once #include "buf0types.h" /** @param[in] block size in bytes @return index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -inline -ulint -buf_buddy_get_slot(ulint size) +inline ulint buf_buddy_get_slot(ulint size) noexcept { ulint i; ulint s; @@ -53,13 +49,13 @@ buf_buddy_get_slot(ulint size) @param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -byte *buf_buddy_alloc_low(ulint i, bool *lru) MY_ATTRIBUTE((malloc)); +byte *buf_buddy_alloc_low(ulint i, bool *lru) noexcept MY_ATTRIBUTE((malloc)); /** Allocate a ROW_FORMAT=COMPRESSED block. @param size compressed page size in bytes @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) +inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) noexcept { return buf_buddy_alloc_low(buf_buddy_get_slot(size), lru); } @@ -68,24 +64,26 @@ inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] i index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -void buf_buddy_free_low(void* buf, ulint i); +void buf_buddy_free_low(void* buf, ulint i) noexcept; /** Deallocate a block. @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] size block size in bytes */ -inline void buf_buddy_free(void* buf, ulint size) +inline void buf_buddy_free(void* buf, ulint size) noexcept { - buf_buddy_free_low(buf, buf_buddy_get_slot(size)); + buf_buddy_free_low(buf, buf_buddy_get_slot(size)); } -/** Try to reallocate a block. -@param[in] buf block to be reallocated, must be pointed -to by the buffer pool -@param[in] size block size, up to srv_page_size -@retval false if failed because of no free blocks. */ -bool buf_buddy_realloc(void* buf, ulint size); +ATTRIBUTE_COLD MY_ATTRIBUTE((nonnull, warn_unused_result)) +/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize(). +@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page +@param block uncompressed block for storage +@return block +@retval nullptr if the block was consumed */ +ATTRIBUTE_COLD +buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept; -/** Combine all pairs of free buddies. */ -void buf_buddy_condense_free(); -#endif /* buf0buddy_h */ +/** Combine all pairs of free buddies. +@param size the target innodb_buffer_pool_size */ +ATTRIBUTE_COLD void buf_buddy_condense_free(size_t size) noexcept; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 07b0f04e425..0e292928524 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -35,13 +35,16 @@ Created 11/5/1995 Heikki Tuuri #include "assume_aligned.h" #include "buf0types.h" #ifndef UNIV_INNOCHECKSUM -#include "ut0byte.h" #include "page0types.h" #include "log0log.h" #include "srv0srv.h" #include "transactional_lock_guard.h" #include +/** The allocation granularity of innodb_buffer_pool_size */ +constexpr size_t innodb_buffer_pool_extent_size= + sizeof(size_t) < 8 ? 2 << 20 : 8 << 20; + /** @name Modes for buf_page_get_gen */ /* @{ */ #define BUF_GET 10 /*!< get always */ @@ -68,7 +71,7 @@ struct buf_pool_info_t ulint pool_size; /*!< Buffer Pool size in pages */ ulint lru_len; /*!< Length of buf_pool.LRU */ ulint old_lru_len; /*!< buf_pool.LRU_old_len */ - ulint free_list_len; /*!< Length of buf_pool.free list */ + ulint free_list_len; /*!< free + lazy_allocate_size() */ ulint flush_list_len; /*!< Length of buf_pool.flush_list */ ulint n_pend_unzip; /*!< buf_pool.n_pend_unzip, pages pending decompress */ @@ -139,10 +142,8 @@ operator<<( const page_id_t page_id); #ifndef UNIV_INNOCHECKSUM -# define buf_pool_get_curr_size() srv_buf_pool_curr_size # define buf_block_free(block) buf_pool.free_block(block) - -#define buf_page_get(ID, SIZE, LA, MTR) \ +# define buf_page_get(ID, SIZE, LA, MTR) \ buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, MTR) /** Try to buffer-fix a page. @@ -364,9 +365,6 @@ void buf_print_io( /*=========*/ FILE* file); /*!< in: file where to print */ -/** Collect buffer pool metadata. -@param[out] pool_info buffer pool metadata */ -void buf_stats_get_pool_info(buf_pool_info_t *pool_info) noexcept; /** Refresh the statistics used to print per-second averages. */ void buf_refresh_io_stats() noexcept; @@ -396,12 +394,6 @@ counter value in MONITOR_MODULE_BUF_PAGE. ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read) noexcept; -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -ulint buf_pool_size_align(ulint size) noexcept; - /** Verify that post encryption checksum match with the calculated checksum. This function should be called only if tablespace contains crypt data metadata. @param page page frame @@ -516,7 +508,7 @@ public: /** buf_pool.LRU status mask in state() */ static constexpr uint32_t LRU_MASK= 7U << 29; - /** lock covering the contents of frame */ + /** lock covering the contents of frame() */ block_lock lock; /** pointer to aligned, uncompressed page frame of innodb_page_size */ byte *frame; @@ -525,8 +517,6 @@ public: is also protected by buf_pool.mutex */ page_zip_des_t zip; #ifdef UNIV_DEBUG - /** whether this->list is in buf_pool.zip_hash; protected by buf_pool.mutex */ - bool in_zip_hash; /** whether this->LRU is in buf_pool.LRU (in_file()); protected by buf_pool.mutex */ bool in_LRU_list; @@ -540,7 +530,7 @@ public: /** list member in one of the lists of buf_pool; protected by buf_pool.mutex or buf_pool.flush_list_mutex - state() == NOT_USED: buf_pool.free or buf_pool.withdraw + state() == NOT_USED: buf_pool.free in_file() && oldest_modification(): buf_pool.flush_list (protected by buf_pool.flush_list_mutex) @@ -581,7 +571,7 @@ public: lock() /* not copied */, frame(b.frame), zip(b.zip), #ifdef UNIV_DEBUG - in_zip_hash(b.in_zip_hash), in_LRU_list(b.in_LRU_list), + in_LRU_list(b.in_LRU_list), in_page_hash(b.in_page_hash), in_free_list(b.in_free_list), #endif /* UNIV_DEBUG */ list(b.list), LRU(b.LRU), old(b.old), freed_page_clock(b.freed_page_clock), @@ -598,7 +588,6 @@ public: id_= id; zip.fix= state; oldest_modification_= 0; - ut_d(in_zip_hash= false); ut_d(in_free_list= false); ut_d(in_LRU_list= false); ut_d(in_page_hash= false); @@ -831,10 +820,6 @@ struct buf_block_t{ buf_pool.page_hash can point to buf_page_t or buf_block_t */ #ifdef UNIV_DEBUG - /** whether page.list is in buf_pool.withdraw - ((state() == NOT_USED)) and the buffer pool is being shrunk; - protected by buf_pool.mutex */ - bool in_withdraw_list; /** whether unzip_LRU is in buf_pool.unzip_LRU (in_file() && frame && zip.data); protected by buf_pool.mutex */ @@ -908,15 +893,10 @@ struct buf_block_t{ @param state initial state() */ void initialise(const page_id_t page_id, ulint zip_size, uint32_t state) noexcept; -}; -/**********************************************************************//** -Compute the hash fold value for blocks in buf_pool.zip_hash. */ -/* @{ */ -#define BUF_POOL_ZIP_FOLD_PTR(ptr) (ulint(ptr) >> srv_page_size_shift) -#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->page.frame) -#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b)) -/* @} */ + /** Calculate the page frame address */ + IF_DBUG(,inline) byte *frame_address() const noexcept; +}; /** A "Hazard Pointer" class used to iterate over buf_pool.LRU or buf_pool.flush_list. A hazard pointer is a buf_page_t pointer @@ -1084,59 +1064,66 @@ struct buf_buddy_stat_t { /** The buffer pool */ class buf_pool_t { - /** A chunk of buffers */ - struct chunk_t - { - /** number of elements in blocks[] */ - size_t size; - /** memory allocated for the page frames */ - unsigned char *mem; - /** descriptor of mem */ - ut_new_pfx_t mem_pfx; - /** array of buffer control blocks */ - buf_block_t *blocks; + /** arrays of buf_block_t followed by page frames; + aliged to and repeating every innodb_buffer_pool_extent_size; + each extent comprises pages_in_extent[] blocks */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) char *memory; + /** the allocation of the above memory, possibly including some + alignment loss at the beginning */ + char *memory_unaligned; + /** the virtual address range size of memory_unaligned */ + size_t size_unaligned; +#ifdef UNIV_PFS_MEMORY + /** the "owner thread" of the buffer pool allocation */ + PSI_thread *owner; +#endif + /** initialized number of block descriptors */ + size_t n_blocks; + /** number of blocks that need to be freed in shrink() */ + size_t n_blocks_to_withdraw; + /** first block to withdraw in shrink() */ + const buf_page_t *first_to_withdraw; - /** Map of first page frame address to chunks[] */ - using map= std::map, - ut_allocator>>; - /** Chunk map that may be under construction by buf_resize_thread() */ - static map *map_reg; - /** Current chunk map for lookup only */ - static map *map_ref; + /** amount of memory allocated to the buffer pool and descriptors; + protected by mutex */ + Atomic_relaxed size_in_bytes; - /** @return the memory size bytes. */ - size_t mem_size() const noexcept { return mem_pfx.m_size; } - - /** Register the chunk */ - void reg() noexcept - { map_reg->emplace(map::value_type(blocks->page.frame, this)); } - - /** Allocate a chunk of buffer frames. - @param bytes requested size - @return whether the allocation succeeded */ - inline bool create(size_t bytes) noexcept; - -#ifdef UNIV_DEBUG - /** Find a block that points to a ROW_FORMAT=COMPRESSED page - @param data pointer to the start of a ROW_FORMAT=COMPRESSED page frame - @return the block - @retval nullptr if not found */ - const buf_block_t *contains_zip(const void *data) const noexcept - { - const buf_block_t *block= blocks; - for (auto i= size; i--; block++) - if (block->page.zip.data == data) - return block; - return nullptr; - } - - /** Check that all blocks are in a replaceable state. - @return address of a non-free block - @retval nullptr if all freed */ - inline const buf_block_t *not_freed() const noexcept; -#endif /* UNIV_DEBUG */ - }; public: + /** The requested innodb_buffer_pool_size */ + size_t size_in_bytes_requested; +#if defined __linux__ || !defined DBUG_OFF + /** The minimum allowed innodb_buffer_pool_size in garbage_collect() */ + size_t size_in_bytes_auto_min; +#endif + /** The maximum allowed innodb_buffer_pool_size */ + size_t size_in_bytes_max; + + /** @return the current size of the buffer pool, in bytes */ + size_t curr_pool_size() const noexcept { return size_in_bytes; } + + /** @return the current size of the buffer pool, in pages */ + TPOOL_SUPPRESS_TSAN size_t curr_size() const noexcept { return n_blocks; } + /** @return the maximum usable size of the buffer pool, in pages */ + TPOOL_SUPPRESS_TSAN size_t usable_size() const noexcept + { return n_blocks - n_blocks_to_withdraw - UT_LIST_GET_LEN(withdrawn); } + + /** Determine the used size of the buffer pool in bytes. + @param n_blocks size of the buffer pool in blocks + @return the size needed for n_blocks in bytes, for innodb_page_size */ + static size_t blocks_in_bytes(size_t n_blocks) noexcept; + +#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) + /** Enable buffers to be dumped to core files. + + A convenience function, not called anyhwere directly however + it is left available for gdb or any debugger to call + in the event that you want all of the memory to be dumped + to a core file. + + @return number of errors found in madvise() calls */ + static int madvise_do_dump() noexcept; +#endif + /** Hash cell chain in page_hash_table */ struct hash_chain { @@ -1144,106 +1131,58 @@ public: buf_page_t *first; }; private: - /** Withdraw blocks from the buffer pool until meeting withdraw_target. - @return whether retry is needed */ - inline bool withdraw_blocks() noexcept; + /** Determine the number of blocks in a buffer pool of a particular size. + @param size_in_bytes innodb_buffer_pool_size in bytes + @return number of buffer pool pages */ + static size_t get_n_blocks(size_t size_in_bytes) noexcept; - /** Determine if a pointer belongs to a buf_block_t. It can be a pointer to - the buf_block_t itself or a member of it. - @param ptr a pointer that will not be dereferenced - @return whether the ptr belongs to a buf_block_t struct */ - bool is_block_field(const void *ptr) const noexcept - { - const chunk_t *chunk= chunks; - const chunk_t *const echunk= chunk + ut_min(n_chunks, n_chunks_new); + /** The outcome of shrink() */ + enum shrink_status{SHRINK_DONE= -1, SHRINK_IN_PROGRESS= 0, SHRINK_ABORT}; - /* TODO: protect chunks with a mutex (the older pointer will - currently remain during resize()) */ - for (; chunk < echunk; chunk++) - if (ptr >= reinterpret_cast(chunk->blocks) && - ptr < reinterpret_cast(chunk->blocks + chunk->size)) - return true; - return false; - } + /** Attempt to shrink the buffer pool. + @param size requested innodb_buffer_pool_size in bytes + @retval whether the shrinking was completed */ + ATTRIBUTE_COLD shrink_status shrink(size_t size) noexcept; - /** Try to reallocate a control block. - @param block control block to reallocate - @return whether the reallocation succeeded */ - inline bool realloc(buf_block_t *block) noexcept; + /** Finish shrinking the buffer pool. + @param size the new innodb_buffer_pool_size in bytes + @param reduced how much the innodb_buffer_pool_size was reduced */ + inline void shrunk(size_t size, size_t reduced) noexcept; public: - bool is_initialised() const noexcept { return chunks != nullptr; } + bool is_initialised() const noexcept { return memory != nullptr; } /** Create the buffer pool. @return whether the creation failed */ - bool create(); + bool create() noexcept; /** Clean up after successful create() */ void close() noexcept; - /** Resize from srv_buf_pool_old_size to srv_buf_pool_size. */ - inline void resize(); + /** Resize the buffer pool. + @param size requested innodb_buffer_pool_size in bytes + @param thd current connnection */ + ATTRIBUTE_COLD void resize(size_t size, THD *thd) noexcept; -#ifdef __linux__ /** Collect garbage (release pages from the LRU list) */ - inline void garbage_collect(); -#endif + inline void garbage_collect() noexcept; - /** @return whether resize() is in progress */ - bool resize_in_progress() const noexcept - { - return UNIV_UNLIKELY(resizing.load(std::memory_order_relaxed)); - } - - /** @return the current size in blocks */ - size_t get_n_pages() const noexcept - { - ut_ad(is_initialised()); - size_t size= 0; - for (auto j= ut_min(n_chunks_new, n_chunks); j--; ) - size+= chunks[j].size; - return size; - } - - /** Determine whether a frame is intended to be withdrawn during resize(). + /** Determine whether a frame needs to be withdrawn during resize(). @param ptr pointer within a buf_page_t::frame + @param size size_in_bytes_requested @return whether the frame will be withdrawn */ - bool will_be_withdrawn(const byte *ptr) const noexcept + bool will_be_withdrawn(const byte *ptr, size_t size) const noexcept { - ut_ad(n_chunks_new < n_chunks); -#ifdef SAFE_MUTEX - if (resize_in_progress()) - mysql_mutex_assert_owner(&mutex); -#endif /* SAFE_MUTEX */ - - for (const chunk_t *chunk= chunks + n_chunks_new, - * const echunk= chunks + n_chunks; - chunk != echunk; chunk++) - if (ptr >= chunk->blocks->page.frame && - ptr < (chunk->blocks + chunk->size - 1)->page.frame + srv_page_size) - return true; - return false; + const char *p= reinterpret_cast(ptr); + ut_ad(p >= memory); + ut_ad(p < memory + size_in_bytes_max); + return p >= memory + size; } - /** Determine whether a block is intended to be withdrawn during resize(). + /** Withdraw a block if needed in case resize() is shrinking. @param bpage buffer pool block - @return whether the frame will be withdrawn */ - bool will_be_withdrawn(const buf_page_t &bpage) const noexcept - { - ut_ad(n_chunks_new < n_chunks); -#ifdef SAFE_MUTEX - if (resize_in_progress()) - mysql_mutex_assert_owner(&mutex); -#endif /* SAFE_MUTEX */ - - for (const chunk_t *chunk= chunks + n_chunks_new, - * const echunk= chunks + n_chunks; - chunk != echunk; chunk++) - if (&bpage >= &chunk->blocks->page && - &bpage < &chunk->blocks[chunk->size].page) - return true; - return false; - } + @return whether the block was withdrawn */ + ATTRIBUTE_COLD bool withdraw(buf_page_t &bpage) noexcept; /** Release and evict a corrupted page. @param bpage x-latched page that was found corrupted @@ -1257,31 +1196,18 @@ public: #ifdef UNIV_DEBUG /** Find a block that points to a ROW_FORMAT=COMPRESSED page @param data pointer to the start of a ROW_FORMAT=COMPRESSED page frame + @param shift number of least significant address bits to ignore @return the block @retval nullptr if not found */ - const buf_block_t *contains_zip(const void *data) const noexcept - { - mysql_mutex_assert_owner(&mutex); - for (const chunk_t *chunk= chunks, * const end= chunks + n_chunks; - chunk != end; chunk++) - if (const buf_block_t *block= chunk->contains_zip(data)) - return block; - return nullptr; - } - + const buf_block_t *contains_zip(const void *data, size_t shift= 0) + const noexcept; /** Assert that all buffer pool pages are in a replaceable state */ void assert_all_freed() noexcept; #endif /* UNIV_DEBUG */ #ifdef BTR_CUR_HASH_ADAPT /** Clear the adaptive hash index on all pages in the buffer pool. */ - inline void clear_hash_index() noexcept; - - /** Get a buffer block from an adaptive hash index pointer. - This function does not return if the block is not identified. - @param ptr pointer to within a page frame - @return pointer to block, never NULL */ - inline buf_block_t *block_from_ahi(const byte *ptr) const noexcept; + void clear_hash_index() noexcept; #endif /* BTR_CUR_HASH_ADAPT */ /** @@ -1304,13 +1230,27 @@ public: return empty_lsn; } - /** Determine if a buffer block was created by chunk_t::create(). - @param block block descriptor (not dereferenced) - @return whether block has been created by chunk_t::create() */ - bool is_uncompressed(const buf_block_t *block) const noexcept + /** Look up the block descriptor for a page frame address. + @param ptr address within a valid page frame + @return the corresponding block descriptor */ + static buf_block_t *block_from(const void *ptr) noexcept; + + /** Access a block while holding the buffer pool mutex. + @param pos position between 0 and get_n_pages() + @return the block descriptor */ + buf_block_t *get_nth_page(size_t pos) const noexcept; + +#ifdef UNIV_DEBUG + /** Determine if an object is within the curr_pool_size() + and associated with an uncompressed page. + @param ptr memory object (not dereferenced) + @return whether the object is valid in the current buffer pool */ + bool is_uncompressed_current(const void *ptr) const noexcept { - return is_block_field(reinterpret_cast(block)); + const ptrdiff_t d= static_cast(ptr) - memory; + return d >= 0 && size_t(d) < curr_pool_size(); } +#endif public: /** page_fix() mode of operation */ @@ -1342,6 +1282,16 @@ public: buf_block_t *page_fix(const page_id_t id) noexcept { return page_fix(id, nullptr, FIX_WAIT_READ); } + /** Validate a block descriptor. + @param b block descriptor that may be invalid after shrink() + @param latch page_hash latch for id + @param id page identifier + @return b->page.fix() if b->page.id() == id + @retval 0 if b is invalid */ + TRANSACTIONAL_TARGET + uint32_t page_guess(buf_block_t *b, page_hash_latch &latch, + const page_id_t id) noexcept; + /** Decompress a page and relocate the block descriptor @param b buffer-fixed compressed-only ROW_FORMAT=COMPRESSED page @param chain hash table chain for b->id().fold() @@ -1357,23 +1307,30 @@ public: bool page_hash_contains(const page_id_t page_id, hash_chain &chain) noexcept; /** @return whether less than 1/4 of the buffer pool is available */ - TPOOL_SUPPRESS_TSAN - bool running_out() const noexcept - { - return !recv_recovery_is_on() && - UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < - (n_chunks_new * chunks->size) / 4; - } + bool running_out() const noexcept; /** @return whether the buffer pool is running low */ bool need_LRU_eviction() const noexcept; - /** @return whether the buffer pool is shrinking */ - inline bool is_shrinking() const noexcept + /** @return number of blocks resize() needs to evict from the buffer pool */ + size_t is_shrinking() const noexcept { - return n_chunks_new < n_chunks; + mysql_mutex_assert_owner(&mutex); + return n_blocks_to_withdraw + UT_LIST_GET_LEN(withdrawn); } + /** @return number of blocks in resize() waiting to be withdrawn */ + size_t to_withdraw() const noexcept + { + mysql_mutex_assert_owner(&mutex); + return n_blocks_to_withdraw; + } + + /** @return the shrinking size of the buffer pool, in bytes + @retval 0 if resize() is not shrinking the buffer pool */ + size_t shrinking_size() const noexcept + { return is_shrinking() ? size_in_bytes_requested : 0; } + #ifdef UNIV_DEBUG /** Validate the buffer pool. */ void validate() noexcept; @@ -1390,7 +1347,6 @@ public: mysql_mutex_assert_owner(&mutex); ut_ad(bpage->in_LRU_list); ut_ad(bpage->in_page_hash); - ut_ad(!bpage->in_zip_hash); ut_ad(bpage->in_file()); lru_hp.adjust(bpage); lru_scan_itr.adjust(bpage); @@ -1410,26 +1366,8 @@ public: /** @name General fields */ /* @{ */ - ulint curr_pool_size; /*!< Current pool size in bytes */ ulint LRU_old_ratio; /*!< Reserve this much of the buffer pool for "old" blocks */ -#ifdef UNIV_DEBUG - ulint buddy_n_frames; /*!< Number of frames allocated from - the buffer pool to the buddy system */ - ulint mutex_exit_forbidden; /*!< Forbid release mutex */ -#endif - ut_allocator allocator; /*!< Allocator used for - allocating memory for the the "chunks" - member. */ - ulint n_chunks; /*!< number of buffer pool chunks */ - ulint n_chunks_new; /*!< new number of buffer pool chunks. - both n_chunks{,new} are protected under - mutex */ - chunk_t* chunks; /*!< buffer pool chunks */ - chunk_t* chunks_old; /*!< old buffer pool chunks to be freed - after resizing buffer pool */ - /** current pool size in pages */ - Atomic_counter curr_size; /** read-ahead request size in pages */ Atomic_counter read_ahead_area; @@ -1541,12 +1479,6 @@ public: /** Look up a page in a hash bucket chain. */ inline buf_page_t *get(const page_id_t id, const hash_chain &chain) const noexcept; - - /** Exclusively aqcuire all latches */ - inline void write_lock_all() noexcept; - - /** Release all latches */ - inline void write_unlock_all() noexcept; }; /** Buffer pool mutex */ @@ -1563,9 +1495,6 @@ public: indexed by page_id_t. Protected by both mutex and page_hash.lock_get(). */ page_hash_table page_hash; - /** map of block->frame to buf_block_t blocks that belong - to buf_buddy_alloc(); protected by buf_pool.mutex */ - hash_table_t zip_hash; /** number of pending unzip() */ Atomic_counter n_pend_unzip; @@ -1696,30 +1625,29 @@ public: Set whenever the free list grows, along with a broadcast of done_free. Protected by buf_pool.mutex. */ Atomic_relaxed try_LRU_scan; - /** Whether we have warned to be running out of buffer pool */ - std::atomic_flag LRU_warned; /* @} */ /** @name LRU replacement algorithm fields */ /* @{ */ - UT_LIST_BASE_NODE_T(buf_page_t) free; - /*!< base node of the free - block list */ +private: + /** Whether we have warned to be running out of buffer pool; + only modified by buf_flush_page_cleaner(): + set while holding mutex, cleared while holding flush_list_mutex */ + Atomic_relaxed LRU_warned; + + /** withdrawn blocks during resize() */ + UT_LIST_BASE_NODE_T(buf_page_t) withdrawn; + +public: + /** list of blocks available for allocate() */ + UT_LIST_BASE_NODE_T(buf_page_t) free; + /** broadcast each time when the free list grows or try_LRU_scan is set; protected by mutex */ pthread_cond_t done_free; - UT_LIST_BASE_NODE_T(buf_page_t) withdraw; - /*!< base node of the withdraw - block list. It is only used during - shrinking buffer pool size, not to - reuse the blocks will be removed */ - - ulint withdraw_target;/*!< target length of withdraw - block list, when withdrawing */ - /** "hazard pointer" used during scan of LRU while doing LRU list batch. Protected by buf_pool_t::mutex. */ LRUHp lru_hp; @@ -1757,10 +1685,21 @@ public: # error "BUF_BUDDY_LOW > UNIV_ZIP_SIZE_MIN" #endif + /** Clear LRU_warned */ + void LRU_warned_clear() noexcept + { + mysql_mutex_assert_owner(&flush_list_mutex); + LRU_warned= false; + } + /** Reserve a buffer. */ buf_tmp_buffer_t *io_buf_reserve(bool wait_for_reads) noexcept { return io_buf.reserve(wait_for_reads); } + /** Try to allocate a block. + @return a buffer block + @retval nullptr if no blocks are available */ + buf_block_t *allocate() noexcept; /** Remove a block from flush_list. @param bpage buffer pool page */ void delete_from_flush_list(buf_page_t *bpage) noexcept; @@ -1783,6 +1722,13 @@ public: /** Issue a warning that we could not free up buffer pool pages. */ ATTRIBUTE_COLD void LRU_warn() noexcept; + /** Print buffer pool flush state information. */ + ATTRIBUTE_COLD void print_flush_info() const noexcept; + + /** Collect buffer pool metadata. + @param pool_info buffer pool metadata */ + void get_info(buf_pool_info_t *pool_info) noexcept; + private: /** Temporary memory for page_compressed and encrypted I/O */ struct io_buf_t @@ -1799,9 +1745,6 @@ private: /** Reserve a buffer */ buf_tmp_buffer_t *reserve(bool wait_for_reads) noexcept; } io_buf; - - /** whether resize() is in the critical path */ - std::atomic resizing; }; /** The InnoDB buffer pool */ @@ -1950,24 +1893,6 @@ inline void buf_page_t::set_old(bool old) noexcept this->old= old; } -#ifdef UNIV_DEBUG -/** Forbid the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_forbid() do { \ - mysql_mutex_assert_owner(&buf_pool.mutex); \ - buf_pool.mutex_exit_forbidden++; \ -} while (0) -/** Allow the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_allow() do { \ - mysql_mutex_assert_owner(&buf_pool.mutex); \ - ut_ad(buf_pool.mutex_exit_forbidden--); \ -} while (0) -#else -/** Forbid the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_forbid() ((void) 0) -/** Allow the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_allow() ((void) 0) -#endif - /********************************************************************** Let us list the consistency conditions for different control block states. diff --git a/storage/innobase/include/buf0buf.inl b/storage/innobase/include/buf0buf.inl index 8103ac2f7ef..c90eee27b62 100644 --- a/storage/innobase/include/buf0buf.inl +++ b/storage/innobase/include/buf0buf.inl @@ -37,7 +37,7 @@ inline bool buf_page_peek_if_young(const buf_page_t *bpage) /* FIXME: bpage->freed_page_clock is 31 bits */ return((buf_pool.freed_page_clock & ((1UL << 31) - 1)) < (bpage->freed_page_clock - + (buf_pool.curr_size + + (buf_pool.curr_size() * (BUF_LRU_OLD_RATIO_DIV - buf_pool.LRU_old_ratio) / (BUF_LRU_OLD_RATIO_DIV * 4)))); } diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index d7fb1c609ee..33343521e41 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -185,6 +185,9 @@ public: my_cond_wait(&cond, &mutex.m_mutex); mysql_mutex_unlock(&mutex); } + + /** Print double write state information. */ + ATTRIBUTE_COLD void print_info() const noexcept; }; /** The doublewrite buffer */ diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index f70d4e410bc..a45fc726652 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -55,10 +55,6 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) @return true if found and freed */ bool buf_LRU_scan_and_free_block(ulint limit= ULINT_UNDEFINED); -/** @return a buffer block from the buf_pool.free list -@retval NULL if the free list is empty */ -buf_block_t* buf_LRU_get_free_only(); - /** How to acquire a block */ enum buf_LRU_get { /** The caller is not holding buf_pool.mutex */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 4a7fb63f318..9b0a3665f41 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1638,6 +1638,27 @@ bool dict_table_have_virtual_index( dict_table_t* table); +/** Helper for opening the InnoDB persistent statistics tables */ +class dict_stats final +{ + MDL_context *mdl_context= nullptr; + MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; + dict_table_t *table_stats= nullptr, *index_stats= nullptr; + +public: + dict_stats()= default; + + /** Open the statistics tables. + @return whether the operation failed */ + bool open(THD *thd) noexcept; + + /** Close the statistics tables after !open_tables(thd). */ + void close() noexcept; + + dict_table_t *table() const noexcept { return table_stats; } + dict_table_t *index() const noexcept { return index_stats; } +}; + #include "dict0dict.inl" #endif diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 6317b0e8710..fe34a99b27e 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -118,15 +118,17 @@ struct recv_dblwr_t const fil_space_t *space= nullptr, byte *tmp_buf= nullptr) const noexcept; - /** Find the doublewrite copy of an encrypted page with the - smallest FIL_PAGE_LSN that is large enough for recovery. + /** Find the doublewrite copy of an encrypted/page_compressed + page with the smallest FIL_PAGE_LSN that is large enough for + recovery. @param space tablespace object @param page_no page number to find - @param buf buffer for unencrypted page + @param buf buffer for unencrypted/uncompressed page @return buf @retval nullptr if the page was not found in doublewrite buffer */ - byte *find_encrypted_page(const fil_node_t &space, uint32_t page_no, - byte *buf) noexcept; + ATTRIBUTE_COLD byte *find_deferred_page(const fil_node_t &space, + uint32_t page_no, + byte *buf) noexcept; /** Restore the first page of the given tablespace from doublewrite buffer. diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index c375d5a5e1d..2bc80abb562 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1015,6 +1015,8 @@ size_t os_aio_pending_reads() noexcept; size_t os_aio_pending_reads_approx() noexcept; /** @return number of pending writes */ size_t os_aio_pending_writes() noexcept; +/** @return approximate number of pending writes */ +size_t os_aio_pending_writes_approx() noexcept; /** Wait until there are no pending asynchronous writes. @param declare whether the wait will be declared in tpool */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 43174b0a9dc..4af1f891865 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -223,17 +223,6 @@ extern uint srv_flush_log_at_timeout; extern my_bool srv_adaptive_flushing; extern my_bool srv_flush_sync; -/** Requested size in bytes */ -extern ulint srv_buf_pool_size; -/** Requested buffer pool chunk size */ -extern size_t srv_buf_pool_chunk_unit; -/** Scan depth for LRU flush batch i.e.: number of blocks scanned*/ -/** Previously requested size */ -extern ulint srv_buf_pool_old_size; -/** Current size as scaling factor for the other components */ -extern ulint srv_buf_pool_base_size; -/** Current size in bytes */ -extern ulint srv_buf_pool_curr_size; /** Dump this % of each buffer pool during BP dump */ extern ulong srv_buf_pool_dump_pct; #ifdef UNIV_DEBUG @@ -255,8 +244,8 @@ extern ulong srv_io_capacity; /* We use this dummy default value at startup for max_io_capacity. The real value is set based on the value of io_capacity. */ -#define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (~0UL) -#define SRV_MAX_IO_CAPACITY_LIMIT (~0UL) +#define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (UINT32_MAX) +#define SRV_MAX_IO_CAPACITY_LIMIT (UINT32_MAX) extern ulong srv_max_io_capacity; /* The "innodb_stats_method" setting, decides how InnoDB is going @@ -580,7 +569,7 @@ struct export_var_t{ innodb_async_io_stats_t async_write_stats; char innodb_buffer_pool_dump_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool dump status */ char innodb_buffer_pool_load_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool load status */ - char innodb_buffer_pool_resize_status[512];/*!< Buf pool resize status */ + char innodb_buffer_pool_resize_status[65];/*!< Buf pool resize status */ my_bool innodb_buffer_pool_load_incomplete;/*!< Buf pool load incomplete */ ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */ ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 1fc8b52e940..ea6c9a909db 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4344,13 +4344,12 @@ dberr_t lock_table_children(dict_table_t *table, trx_t *trx) children.end()) continue; /* We already acquired MDL on this child table. */ MDL_ticket *mdl= nullptr; - child->acquire(); child= dict_acquire_mdl_shared(child, mdl_context, &mdl, DICT_TABLE_OP_NORMAL); if (child) { - if (!mdl) - child->release(); + if (mdl) + child->acquire(); children.emplace_back(table_mdl{child, mdl}); goto rescan; } diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index d25e6822910..dffb26cf06e 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1347,7 +1347,11 @@ void log_free_check() } } -extern void buf_resize_shutdown(); +#ifdef __linux__ +extern void buf_mem_pressure_shutdown() noexcept; +#else +inline void buf_mem_pressure_shutdown() noexcept {} +#endif /** Make a checkpoint at the latest lsn on shutdown. */ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() @@ -1363,8 +1367,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() srv_master_timer.reset(); } - /* Wait for the end of the buffer resize task.*/ - buf_resize_shutdown(); + buf_mem_pressure_shutdown(); dict_stats_shutdown(); srv_shutdown_state = SRV_SHUTDOWN_CLEANUP; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index f141c69388f..58557e0f9d6 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1391,34 +1391,18 @@ inline void recv_sys_t::free(const void *data) ut_ad(!ut_align_offset(data, ALIGNMENT)); mysql_mutex_assert_owner(&mutex); - /* MDEV-14481 FIXME: To prevent race condition with buf_pool.resize(), - we must acquire and hold the buffer pool mutex here. */ - ut_ad(!buf_pool.resize_in_progress()); - - auto *chunk= buf_pool.chunks; - for (auto i= buf_pool.n_chunks; i--; chunk++) + buf_block_t *block= buf_pool.block_from(data); + ut_ad(block->page.frame == page_align(data)); + ut_ad(block->page.state() == buf_page_t::MEMORY); + ut_ad(uint16_t(block->page.free_offset - 1) < srv_page_size); + ut_ad(block->page.used_records); + if (!--block->page.used_records) { - if (data < chunk->blocks->page.frame) - continue; - const size_t offs= (reinterpret_cast(data) - - chunk->blocks->page.frame) >> srv_page_size_shift; - if (offs >= chunk->size) - continue; - buf_block_t *block= &chunk->blocks[offs]; - ut_ad(block->page.frame == page_align(data)); - ut_ad(block->page.state() == buf_page_t::MEMORY); - ut_ad(uint16_t(block->page.free_offset - 1) < srv_page_size); - ut_ad(block->page.used_records); - if (!--block->page.used_records) - { - block->page.hash= nullptr; - UT_LIST_REMOVE(blocks, block); - MEM_MAKE_ADDRESSABLE(block->page.frame, srv_page_size); - buf_block_free(block); - } - return; + block->page.hash= nullptr; + UT_LIST_REMOVE(blocks, block); + MEM_MAKE_ADDRESSABLE(block->page.frame, srv_page_size); + buf_block_free(block); } - ut_ad(0); } @@ -1967,12 +1951,13 @@ ATTRIBUTE_COLD void recv_sys_t::wait_for_pool(size_t pages) { mysql_mutex_unlock(&mutex); os_aio_wait_until_no_pending_reads(false); + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&mutex); garbage_collect(); mysql_mutex_lock(&buf_pool.mutex); - bool need_more= UT_LIST_GET_LEN(buf_pool.free) < pages; + const size_t available= UT_LIST_GET_LEN(buf_pool.free); mysql_mutex_unlock(&buf_pool.mutex); - if (need_more) + if (available < pages) buf_flush_sync_batch(lsn); } @@ -4854,28 +4839,43 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id, lsn_t max_lsn, goto check_if_corrupted; } -byte *recv_dblwr_t::find_encrypted_page(const fil_node_t &node, - uint32_t page_no, - byte *buf) noexcept +ATTRIBUTE_COLD +byte *recv_dblwr_t::find_deferred_page(const fil_node_t &node, + uint32_t page_no, + byte *buf) noexcept { - ut_ad(node.space->crypt_data); ut_ad(node.space->full_crc32()); mysql_mutex_lock(&recv_sys.mutex); byte *result_page= nullptr; + bool is_encrypted= node.space->crypt_data && + node.space->crypt_data->is_encrypted(); for (list::iterator page_it= pages.begin(); page_it != pages.end(); page_it++) { if (page_get_page_no(*page_it) != page_no || buf_page_is_corrupted(true, *page_it, node.space->flags)) continue; + + if (is_encrypted && + !mach_read_from_4(*page_it + FIL_PAGE_FCRC32_KEY_VERSION)) + continue; + memcpy(buf, *page_it, node.space->physical_size()); buf_tmp_buffer_t *slot= buf_pool.io_buf_reserve(false); ut_a(slot); slot->allocate(); - bool invalidate= - !fil_space_decrypt(node.space, slot->crypt_buf, buf) || - (node.space->is_compressed() && - !fil_page_decompress(slot->crypt_buf, buf, node.space->flags)); + + bool invalidate= false; + if (is_encrypted) + { + invalidate= !fil_space_decrypt(node.space, slot->crypt_buf, buf); + if (!invalidate && node.space->is_compressed()) + goto decompress; + } + else +decompress: + invalidate= !fil_page_decompress(slot->crypt_buf, buf, + node.space->flags); slot->release(); if (invalidate || diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 320d511eb4c..e9dd66e6091 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -168,7 +168,7 @@ inline void buf_pool_t::insert_into_flush_list(buf_page_t *prev, else flush_list_bytes+= block->physical_size(); - ut_ad(flush_list_bytes <= curr_pool_size); + ut_ad(flush_list_bytes <= size_in_bytes); if (prev) UT_LIST_INSERT_AFTER(flush_list, prev, &block->page); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index c38197cebd7..ec00ca78ea4 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -3341,6 +3341,12 @@ size_t os_aio_pending_writes() noexcept return write_slots->pending_io_count(); } +/** @return approximate number of pending writes */ +size_t os_aio_pending_writes_approx() noexcept +{ + return write_slots->pending_io_count(); +} + /** Wait until all pending asynchronous reads have completed. @param declare whether the wait will be declared in tpool */ void os_aio_wait_until_no_pending_reads(bool declare) noexcept diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index d2d3714c586..ac6dca37b56 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2748,6 +2748,12 @@ err_exit: DBUG_EXECUTE_IF("row_ins_row_level", goto row_level_insert;); +#ifdef WITH_WSREP + /* Appliers never execute bulk insert statements directly. */ + if (trx->is_wsrep() && !wsrep_thd_is_local_transaction(trx->mysql_thd)) + goto row_level_insert; +#endif /* WITH_WSREP */ + if (!(flags & BTR_NO_UNDO_LOG_FLAG) && page_is_empty(block->page.frame) && !entry->is_metadata() && !trx->duplicates @@ -2777,15 +2783,11 @@ avoid_bulk: goto row_level_insert; } #ifdef WITH_WSREP - if (trx->is_wsrep()) + if (trx->is_wsrep() && + wsrep_append_table_key(trx->mysql_thd, *index->table)) { - if (!wsrep_thd_is_local_transaction(trx->mysql_thd)) - goto row_level_insert; - if (wsrep_append_table_key(trx->mysql_thd, *index->table)) - { - trx->error_state = DB_ROLLBACK; - goto err_exit; - } + trx->error_state = DB_ROLLBACK; + goto err_exit; } #endif /* WITH_WSREP */ diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index dc79e039b68..efd2abfd659 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -4034,14 +4034,7 @@ void UndorecApplier::log_update(const dtuple_t &tuple, if (!(this->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { for (ulint i = 0; i < dict_table_get_n_v_cols(table); i++) - dfield_get_type( - dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING; - } - - if (is_update) - { - old_row= dtuple_copy(row, heap); - row_upd_replace(old_row, &old_ext, clust_index, update, heap); + dfield_get_type(dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING; } if (table->n_v_cols) @@ -4049,6 +4042,12 @@ void UndorecApplier::log_update(const dtuple_t &tuple, (cmpl_info & UPD_NODE_NO_ORD_CHANGE) ? nullptr : undo_rec); + if (is_update) + { + old_row= dtuple_copy(row, heap); + row_upd_replace(old_row, &old_ext, clust_index, update, heap); + } + bool success= true; dict_index_t *index= dict_table_get_next_index(clust_index); while (index) diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 2a22403e125..5234dd10a8d 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1288,12 +1288,13 @@ srv_mon_process_existing_counter( /* innodb_buffer_pool_pages_total */ case MONITOR_OVLD_BUF_POOL_PAGE_TOTAL: - value = buf_pool.get_n_pages(); + case MONITOR_OVLD_BUFFER_POOL_SIZE: + value = buf_pool.curr_size(); break; /* innodb_buffer_pool_pages_misc */ case MONITOR_OVLD_BUF_POOL_PAGE_MISC: - value = buf_pool.get_n_pages() + value = buf_pool.curr_size() - UT_LIST_GET_LEN(buf_pool.LRU) - UT_LIST_GET_LEN(buf_pool.free); break; @@ -1412,10 +1413,6 @@ srv_mon_process_existing_counter( value = srv_page_size; break; - case MONITOR_OVLD_BUFFER_POOL_SIZE: - value = srv_buf_pool_size; - break; - /* innodb_row_lock_current_waits */ case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT: // dirty read without lock_sys.wait_mutex diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 5c34b356790..31d5bdf5732 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -176,16 +176,6 @@ srv_printf_innodb_monitor() will request mutex acquisition with mysql_mutex_lock(), which will wait until it gets the mutex. */ #define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT) -/** copy of innodb_buffer_pool_size */ -ulint srv_buf_pool_size; -/** Requested buffer pool chunk size */ -size_t srv_buf_pool_chunk_unit; -/** Previously requested size */ -ulint srv_buf_pool_old_size; -/** Current size as scaling factor for the other components */ -ulint srv_buf_pool_base_size; -/** Current size in bytes */ -ulint srv_buf_pool_curr_size; /** Dump this % of each buffer pool during BP dump */ ulong srv_buf_pool_dump_pct; /** Abort load after this amount of pages */ @@ -875,6 +865,7 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_read_requests = buf_pool.stat.n_page_gets; + mysql_mutex_lock(&buf_pool.mutex); export_vars.innodb_buffer_pool_bytes_data = buf_pool.stat.LRU_bytes + (UT_LIST_GET_LEN(buf_pool.unzip_LRU) @@ -884,12 +875,21 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_pages_latched = buf_get_latched_pages_number(); #endif /* UNIV_DEBUG */ - export_vars.innodb_buffer_pool_pages_total = buf_pool.get_n_pages(); + export_vars.innodb_buffer_pool_pages_total = buf_pool.curr_size(); export_vars.innodb_buffer_pool_pages_misc = - buf_pool.get_n_pages() + export_vars.innodb_buffer_pool_pages_total - UT_LIST_GET_LEN(buf_pool.LRU) - UT_LIST_GET_LEN(buf_pool.free); + if (size_t shrinking = buf_pool.is_shrinking()) { + snprintf(export_vars.innodb_buffer_pool_resize_status, + sizeof export_vars.innodb_buffer_pool_resize_status, + "Withdrawing blocks. (%zu/%zu).", + buf_pool.to_withdraw(), shrinking); + } else { + export_vars.innodb_buffer_pool_resize_status[0] = '\0'; + } + mysql_mutex_unlock(&buf_pool.mutex); export_vars.innodb_max_trx_id = trx_sys.get_max_trx_id(); export_vars.innodb_history_list_length = trx_sys.history_size_approx(); @@ -1057,6 +1057,7 @@ void srv_monitor_task(void*) now -= start; ulong waited = static_cast(now / 1000000); if (waited >= threshold) { + buf_pool.print_flush_info(); ib::fatal() << dict_sys.fatal_msg; } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 9c295149d6e..4ca8c67743d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1368,31 +1368,10 @@ dberr_t srv_start(bool create_new_db) fil_system.create(srv_file_per_table ? 50000 : 5000); - ib::info() << "Initializing buffer pool, total size = " - << ib::bytes_iec{srv_buf_pool_size} - << ", chunk size = " << ib::bytes_iec{srv_buf_pool_chunk_unit}; - if (buf_pool.create()) { - ib::error() << "Cannot allocate memory for the buffer pool"; - return(srv_init_abort(DB_ERROR)); } - ib::info() << "Completed initialization of buffer pool"; - -#ifdef UNIV_DEBUG - /* We have observed deadlocks with a 5MB buffer pool but - the actual lower limit could very well be a little higher. */ - - if (srv_buf_pool_size <= 5 * 1024 * 1024) { - - ib::info() << "Small buffer pool size (" - << ib::bytes_iec{srv_buf_pool_size} - << "), the flst_validate() debug function can cause a" - << " deadlock if the buffer pool fills up."; - } -#endif /* UNIV_DEBUG */ - log_sys.create(); recv_sys.create(); lock_sys.create(srv_lock_table_size); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 9f594108a21..049de3f230f 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1052,16 +1052,25 @@ inline trx_purge_rec_t purge_sys_t::fetch_next_rec() /** Close all tables that were opened in a purge batch for a worker. @param node purge task context @param thd purge coordinator thread handle */ -static void trx_purge_close_tables(purge_node_t *node, THD *thd) +static void trx_purge_close_tables(purge_node_t *node, THD *thd) noexcept { for (auto &t : node->tables) { - if (!t.second.first); - else if (t.second.first == reinterpret_cast(-1)); - else + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) + table->release(); + } + + MDL_context *mdl_context= static_cast(thd_mdl_context(thd)); + + for (auto &t : node->tables) + { + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) { - dict_table_close(t.second.first, thd, t.second.second); t.second.first= reinterpret_cast(-1); + if (mdl_context != nullptr && t.second.second != nullptr) + mdl_context->release_lock(t.second.second); } } } @@ -1073,36 +1082,35 @@ void purge_sys_t::wait_FTS(bool also_sys) } __attribute__((nonnull)) -/** Aqcuire a metadata lock on a table. +/** Acquire a metadata lock on a table. @param table table handle @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { ut_ad(dict_sys.frozen_not_locked()); *mdl= nullptr; if (!table->is_readable() || table->corrupted) - { - table->release(); return nullptr; - } size_t db_len= dict_get_db_name_len(table->name.m_name); if (db_len == 0) - return table; /* InnoDB system tables are not covered by MDL */ + { + /* InnoDB system tables are not covered by MDL */ + got_table: + table->acquire(); + return table; + } if (purge_sys.must_wait_FTS()) - { must_wait: - table->release(); return reinterpret_cast(-1); - } char db_buf[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1]; @@ -1110,7 +1118,7 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ - return table; + goto got_table; { MDL_request request; @@ -1123,37 +1131,38 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, goto must_wait; } - return table; + goto got_table; } /** Open a table handle for the purge of committed transaction history @param table_id InnoDB table identifier @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_open(table_id_t table_id, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { - dict_sys.freeze(SRW_LOCK_CALL); + dict_table_t *table; - dict_table_t *table= dict_sys.find_table(table_id); - - if (table) - table->acquire(); - else + for (;;) { + dict_sys.freeze(SRW_LOCK_CALL); + table= dict_sys.find_table(table_id); + if (table) + break; dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); table= dict_load_table_on_id(table_id, DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); if (!table) return nullptr; - dict_sys.freeze(SRW_LOCK_CALL); + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ } table= trx_purge_table_acquire(table, mdl_context, mdl); @@ -1172,10 +1181,7 @@ dict_table_t *purge_sys_t::close_and_reopen(table_id_t id, THD *thd, for (que_thr_t *thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); thr; thr= UT_LIST_GET_NEXT(thrs, thr)) - { - purge_node_t *node= static_cast(thr->child); - trx_purge_close_tables(node, thd); - } + trx_purge_close_tables(static_cast(thr->child), thd); m_active= false; wait_FTS(false); @@ -1231,9 +1237,6 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, static_cast(thd_mdl_context(thd)); ut_ad(mdl_context); - const size_t max_pages= - std::min(buf_pool.curr_size * 3 / 4, size_t{srv_purge_batch_size}); - while (UNIV_LIKELY(srv_undo_sources) || !srv_fast_shutdown) { /* Track the max {trx_id, undo_no} for truncating the @@ -1283,12 +1286,12 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, ut_ad(!table_node->in_progress); } - if (purge_sys.n_pages_handled() >= max_pages) + const size_t size{purge_sys.n_pages_handled()}; + if (size >= size_t{srv_purge_batch_size} || + size >= buf_pool.usable_size() * 3 / 4) break; } - purge_sys.m_active= false; - #ifdef UNIV_DEBUG thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); for (ulint i= 0; thr && i < *n_work_items; @@ -1337,6 +1340,8 @@ static void trx_purge_wait_for_workers_to_complete() TRANSACTIONAL_INLINE void purge_sys_t::batch_cleanup(const purge_sys_t::iterator &head) { + m_active= false; + /* Release the undo pages. */ for (auto p : pages) p.second->unfix(); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 0c369be6b16..6b280bd8ecc 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -458,7 +458,7 @@ void trx_t::free() /** Transition to committed state, to release implicit locks. */ TRANSACTIONAL_INLINE inline void trx_t::commit_state() { - ut_d(auto trx_state{state}); + ut_d(auto trx_state= state); ut_ad(trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE); diff --git a/storage/innobase/unittest/innodb_ahi-t.cc b/storage/innobase/unittest/innodb_ahi-t.cc index 1b5f4d895d8..b394502fa69 100644 --- a/storage/innobase/unittest/innodb_ahi-t.cc +++ b/storage/innobase/unittest/innodb_ahi-t.cc @@ -15,8 +15,9 @@ uint32_t srv_page_size_shift= 14; ulong srv_page_size= 1 << 14; dict_sys_t dict_sys; buf_pool_t buf_pool; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_reg; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_ref; +buf_block_t *buf_pool_t::block_from(const void *ptr) noexcept +{ return nullptr; } +void buf_pool_t::clear_hash_index() noexcept {} void buf_pool_t::free_block(buf_block_t*) noexcept {} void dict_mem_table_free(dict_table_t*) {} diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c index a90a12612d8..3d89026376b 100644 --- a/storage/maria/ma_control_file.c +++ b/storage/maria/ma_control_file.c @@ -276,7 +276,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, int open_flags) { uchar buffer[CF_MAX_SIZE]; - char name[FN_REFLEN], errmsg_buff[256]; + char name[FN_REFLEN], errmsg_buff[512]; const char *errmsg, *lock_failed_errmsg= "Could not get an exclusive lock;" " file is probably in use by another process"; uint new_cf_create_time_size, new_cf_changeable_size, new_block_size; @@ -399,10 +399,14 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE || new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE || - new_cf_create_time_size + new_cf_changeable_size != file_size) + new_cf_create_time_size + new_cf_changeable_size > file_size) { error= CONTROL_FILE_INCONSISTENT_INFORMATION; - errmsg= "Sizes stored in control file are inconsistent"; + sprintf(errmsg_buff, + "Sizes stored in control file are inconsistent. " + "create_time_size: %u changeable_size: %u file_size: %llu", + new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size); + errmsg= errmsg_buff; goto err; } @@ -622,6 +626,20 @@ my_bool ma_control_file_inited(void) return (control_file_fd >= 0); } + + +static int check_zerofill(uchar *buffer, ulonglong offset, ulonglong length) +{ + uchar *pos= buffer + offset, *end= buffer+length; + while (pos < end) + { + if (*pos++) + return 1; + } + return 0; +} + + /** Print content of aria_log_control file */ @@ -629,6 +647,7 @@ my_bool ma_control_file_inited(void) my_bool print_aria_log_control() { uchar buffer[CF_MAX_SIZE]; + char errmsg_buff[512]; char name[FN_REFLEN], uuid_str[MY_UUID_STRING_LENGTH+1]; const char *errmsg; uint new_cf_create_time_size, new_cf_changeable_size; @@ -705,10 +724,14 @@ my_bool print_aria_log_control() if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE || new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE || - new_cf_create_time_size + new_cf_changeable_size != file_size) + new_cf_create_time_size + new_cf_changeable_size > file_size) { error= CONTROL_FILE_INCONSISTENT_INFORMATION; - errmsg= "Sizes stored in control file are inconsistent"; + sprintf(errmsg_buff, + "Sizes stored in control file are inconsistent. " + "create_time_size: %u changeable_size: %u file_size: %llu", + new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size); + errmsg= errmsg_buff; goto err; } checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size + @@ -732,6 +755,18 @@ my_bool print_aria_log_control() (buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0]; printf("recovery_failures: %u\n", recovery_fails); } + if (check_zerofill(buffer, new_cf_create_time_size + new_cf_changeable_size, file_size)) + { + printf("Warning: %s file_size is %llu (should be %llu) and contains unknown data.\n" + "It will still work but should be examined.\n", + name, (ulonglong) file_size, + (ulonglong) (new_cf_create_time_size + new_cf_changeable_size)); + } + else if (new_cf_create_time_size + new_cf_changeable_size < file_size) + printf("Note: file_size (%llu) is bigger than the expected file size %llu.\n" + "This is unexpected but will not cause any issues.\n", + (ulonglong) file_size, + (ulonglong) (new_cf_create_time_size + new_cf_changeable_size)); mysql_file_close(file, MYF(0)); DBUG_RETURN(0); diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c index 5e7925b937c..215afc7e063 100644 --- a/storage/maria/ma_unique.c +++ b/storage/maria/ma_unique.c @@ -139,6 +139,8 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record) { uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos); memcpy((void*) &pos,pos+keyseg->bit_start,sizeof(char*)); + if (!pos) + pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */ if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -236,6 +238,10 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b, } memcpy((void*) &pos_a, pos_a+keyseg->bit_start, sizeof(char*)); memcpy((void*) &pos_b, pos_b+keyseg->bit_start, sizeof(char*)); + if (pos_a == 0) + pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ + if (pos_b == 0) + pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ } if (type == HA_KEYTYPE_TEXT/* the CHAR data type*/) { diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index ecc2b354849..9c6ed4d80b1 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -115,6 +115,8 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); memcpy((char**) &pos, pos+keyseg->bit_start, sizeof(char*)); + if (!pos) + pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */ if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -211,6 +213,10 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, } memcpy((char**) &pos_a, pos_a+keyseg->bit_start, sizeof(char*)); memcpy((char**) &pos_b, pos_b+keyseg->bit_start, sizeof(char*)); + if (pos_a == 0) + pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ + if (pos_b == 0) + pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ } if (type == HA_KEYTYPE_TEXT/*The CHAR data type*/) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result index c493df58046..962caf7fec7 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result @@ -5,6 +5,7 @@ for child3 MDEV-26345 SELECT MIN on Spider table returns more rows than expected set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (a int, b int, PRIMARY KEY (a, b)); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result index 02831696714..aead41fa4bf 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result @@ -2,6 +2,7 @@ for master_1 for child2 for child3 SET spider_same_server_link= on; +SET global spider_same_server_link= on; CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result index 126c8591e0c..563180fa85e 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); CREATE TABLE t2 (b INT); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result index 0d0ad383d8f..a9ab6c3a8df 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (a INT); INSERT INTO t VALUES (23),(48); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result index bc7c5666919..eef05deb0f8 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c INT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result index 6f569dd2418..d96c73ae96e 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result index 252dc226354..ebe7fe25546 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result @@ -3,6 +3,7 @@ for child2 for child3 set @@optimizer_switch="semijoin=off"; set spider_same_server_link= 1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table ten(a int primary key); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result index ccd9125600d..a0c8b9ab778 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c BLOB) ENGINE=InnoDB; CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result index 5bfee3b18e3..a19e8c1ef80 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)); CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result index a661d5bcea7..9d6651b2ab4 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result @@ -2,6 +2,7 @@ for master_1 for child2 for child3 set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result new file mode 100644 index 00000000000..e02629ca9ec --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result @@ -0,0 +1,16 @@ +# +# MDEV-35807 Spider wrapper name is case sensitive +# +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +SELECT spider_direct_sql ('SELECT 1','','SRV "srv"'); +spider_direct_sql ('SELECT 1','','SRV "srv"') +1 +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result new file mode 100644 index 00000000000..5753a4aed89 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result @@ -0,0 +1,55 @@ +# +# MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table +# +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +set global spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB; +CREATE TABLE t1_s (c6 decimal(6,0)) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +Warnings: +Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead. +CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (123456), (654321); +/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 2; +/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 3; +set spider_quick_page_size= 1; +INSERT INTO t1 VALUES (777777); +/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +12345678 777777 +/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 0; +set spider_quick_page_size= 1024; +CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +Warnings: +Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead. +/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s; +MAX(c6) SUM(c6) +777777 1555554 +set spider_select_column_mode= 0; +/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s; +MAX(c6) SUM(c6) +777777 1555554 +drop table t2, t1_s, t1; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result new file mode 100644 index 00000000000..4adbbf9bf92 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result @@ -0,0 +1,21 @@ +# +# MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error +# +for master_1 +for child2 +for child3 +SET spider_same_server_link=ON, spider_net_read_timeout=1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t_remote (a INT); +CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"'; +Warnings: +Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead. +CREATE OR REPLACE TABLE t_remote LIKE t; +Got one of the listed errors +drop table t; +drop table if exists t_remote; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/subquery.result b/storage/spider/mysql-test/spider/bugfix/r/subquery.result index 2bc55e0ce92..5ed27f64b2c 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/subquery.result +++ b/storage/spider/mysql-test/spider/bugfix/r/subquery.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t1 (c1 int); create table t2 (c2 int); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test index 72069253e84..b14df3bf332 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test @@ -11,6 +11,7 @@ --echo set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test index 51620a5a23c..5e539e8e1e7 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test @@ -4,6 +4,7 @@ --enable_result_log --enable_query_log SET spider_same_server_link= on; +SET global spider_same_server_link= on; evalp CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test index a4e8d080677..1b08647acc8 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test index 246c405d935..3a56ae39ee7 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test @@ -9,6 +9,7 @@ --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; --let $srv=srv_mdev_29502 evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test index 65735d43e7d..2ee3d099c90 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test @@ -8,6 +8,7 @@ --enable_query_log set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test index a664c7ecfae..bac400bb364 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test index 8f76c1209b6..7f29c1bbdca 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test @@ -6,6 +6,7 @@ set @@optimizer_switch="semijoin=off"; set spider_same_server_link= 1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test index 6185990230b..7e02c3fb134 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test @@ -10,6 +10,7 @@ --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c BLOB) ENGINE=InnoDB; CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test index b0883f8fd90..d4ad5fa56d3 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test @@ -9,6 +9,7 @@ --enable_prepare_warnings set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test index f81259b99a9..e2a325dcc5a 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test @@ -4,6 +4,7 @@ --enable_result_log --enable_query_log set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test new file mode 100644 index 00000000000..cab648124cc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test @@ -0,0 +1,21 @@ +--echo # +--echo # MDEV-35807 Spider wrapper name is case sensitive +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +SELECT spider_direct_sql ('SELECT 1','','SRV "srv"'); +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test new file mode 100644 index 00000000000..601c0cdb1ef --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test @@ -0,0 +1,53 @@ +--echo # +--echo # MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--source include/have_innodb.inc +set spider_same_server_link= 1; +set global spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB; + +CREATE TABLE t1_s (c6 decimal(6,0)) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; + +CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (123456), (654321); + +/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 2; +/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 3; +set spider_quick_page_size= 1; +INSERT INTO t1 VALUES (777777); +/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 0; +set spider_quick_page_size= 1024; +CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s; + +set spider_select_column_mode= 0; +/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s; + +drop table t2, t1_s, t1; +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test new file mode 100644 index 00000000000..266350121cf --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test @@ -0,0 +1,32 @@ +--echo # +--echo # MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +SET spider_same_server_link=ON, spider_net_read_timeout=1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t_remote (a INT); +CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"'; +--disable_ps_protocol +--error ER_LOCK_WAIT_TIMEOUT,ER_NET_READ_INTERRUPTED +CREATE OR REPLACE TABLE t_remote LIKE t; +--enable_ps_protocol + +drop table t; +--disable_warnings +drop table if exists t_remote; +--enable_warnings +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/subquery.test b/storage/spider/mysql-test/spider/bugfix/t/subquery.test index d40b459702e..b80999df448 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/subquery.test +++ b/storage/spider/mysql-test/spider/bugfix/t/subquery.test @@ -9,6 +9,7 @@ --enable_prepare_warnings set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t1 (c1 int); create table t2 (c2 int); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index ff7f609be44..985e30de49d 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -2365,7 +2365,7 @@ int spider_db_fetch_table( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -2481,7 +2481,7 @@ int spider_db_fetch_key( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -2588,7 +2588,7 @@ int spider_db_fetch_minimum_columns( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -3346,7 +3346,7 @@ int spider_db_store_result( } position++; roop_count++; - row = current->result->fetch_row(); + row = current->result->fetch_row(result_list->skips); } } else { do { @@ -3368,7 +3368,7 @@ int spider_db_store_result( } } while ( page_size > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); } if ( @@ -3406,7 +3406,7 @@ int spider_db_store_result( roop_count++; } while ( result_list->limit_num > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); tmp_tbl->file->ha_end_bulk_insert(); page_size = result_list->limit_num; @@ -3625,7 +3625,7 @@ int spider_db_store_result_for_reuse_cursor( } current->dbton_id = current->result->dbton_id; SPIDER_DB_ROW *row; - if (!(row = current->result->fetch_row())) + if (!(row = current->result->fetch_row(result_list->skips))) { error_num = current->result->get_errno(); DBUG_PRINT("info",("spider set finish_flg point 3")); @@ -3701,7 +3701,7 @@ int spider_db_store_result_for_reuse_cursor( } position++; roop_count++; - row = current->result->fetch_row(); + row = current->result->fetch_row(result_list->skips); } } else { do { @@ -3723,7 +3723,7 @@ int spider_db_store_result_for_reuse_cursor( } } while ( page_size > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); } if ( @@ -3759,7 +3759,7 @@ int spider_db_store_result_for_reuse_cursor( roop_count++; } while ( result_list->limit_num > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); tmp_tbl->file->ha_end_bulk_insert(); page_size = result_list->limit_num; @@ -4302,9 +4302,8 @@ int spider_db_seek_next( } } } - DBUG_RETURN(spider_db_fetch(buf, spider, table)); - } else - DBUG_RETURN(spider_db_fetch(buf, spider, table)); + } + DBUG_RETURN(spider_db_fetch(buf, spider, table)); } int spider_db_seek_last( diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index cef84a737da..871a6dc1272 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -195,7 +195,7 @@ int spider_udf_direct_sql_create_conn_key( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper) + !strcasecmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL) @@ -1039,7 +1039,7 @@ int spider_udf_set_direct_sql_param_default( spider_dbton[roop_count].wrapper : "NULL")); if ( spider_dbton[roop_count].wrapper && - !strcmp(direct_sql->tgt_wrapper, + !strcasecmp(direct_sql->tgt_wrapper, spider_dbton[roop_count].wrapper) ) { if (spider_dbton[roop_count].db_access_type == diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 3459ead857f..d614cec3a9c 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -4125,7 +4125,7 @@ int spider_set_connect_info_default( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(share->tgt_wrappers[roop_count], + !strcasecmp(share->tgt_wrappers[roop_count], spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == @@ -4407,7 +4407,7 @@ int spider_set_connect_info_default_db_table( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(share->tgt_wrappers[roop_count], + !strcasecmp(share->tgt_wrappers[roop_count], spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 7a6d957fcfb..9dd56ac0ea6 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -844,225 +844,6 @@ error_alloc_alter_table: DBUG_RETURN(error_num); } -bool spider_cmp_trx_alter_table( - SPIDER_ALTER_TABLE *cmp1, - SPIDER_ALTER_TABLE *cmp2 -) { - int roop_count; - DBUG_ENTER("spider_cmp_trx_alter_table"); - if ( - cmp1->tmp_priority != cmp2->tmp_priority || - cmp1->link_count != cmp2->link_count || - cmp1->all_link_count != cmp2->all_link_count - ) - DBUG_RETURN(TRUE); - - for (roop_count = 0; roop_count < (int) cmp1->all_link_count; roop_count++) - { - if ( - ( - cmp1->tmp_server_names[roop_count] != - cmp2->tmp_server_names[roop_count] && - ( - !cmp1->tmp_server_names[roop_count] || - !cmp2->tmp_server_names[roop_count] || - strcmp(cmp1->tmp_server_names[roop_count], - cmp2->tmp_server_names[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_table_names[roop_count] != - cmp2->tmp_tgt_table_names[roop_count] && - ( - !cmp1->tmp_tgt_table_names[roop_count] || - !cmp2->tmp_tgt_table_names[roop_count] || - strcmp(cmp1->tmp_tgt_table_names[roop_count], - cmp2->tmp_tgt_table_names[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_dbs[roop_count] != - cmp2->tmp_tgt_dbs[roop_count] && - ( - !cmp1->tmp_tgt_dbs[roop_count] || - !cmp2->tmp_tgt_dbs[roop_count] || - strcmp(cmp1->tmp_tgt_dbs[roop_count], - cmp2->tmp_tgt_dbs[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_hosts[roop_count] != - cmp2->tmp_tgt_hosts[roop_count] && - ( - !cmp1->tmp_tgt_hosts[roop_count] || - !cmp2->tmp_tgt_hosts[roop_count] || - strcmp(cmp1->tmp_tgt_hosts[roop_count], - cmp2->tmp_tgt_hosts[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_usernames[roop_count] != - cmp2->tmp_tgt_usernames[roop_count] && - ( - !cmp1->tmp_tgt_usernames[roop_count] || - !cmp2->tmp_tgt_usernames[roop_count] || - strcmp(cmp1->tmp_tgt_usernames[roop_count], - cmp2->tmp_tgt_usernames[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_passwords[roop_count] != - cmp2->tmp_tgt_passwords[roop_count] && - ( - !cmp1->tmp_tgt_passwords[roop_count] || - !cmp2->tmp_tgt_passwords[roop_count] || - strcmp(cmp1->tmp_tgt_passwords[roop_count], - cmp2->tmp_tgt_passwords[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_sockets[roop_count] != - cmp2->tmp_tgt_sockets[roop_count] && - ( - !cmp1->tmp_tgt_sockets[roop_count] || - !cmp2->tmp_tgt_sockets[roop_count] || - strcmp(cmp1->tmp_tgt_sockets[roop_count], - cmp2->tmp_tgt_sockets[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_wrappers[roop_count] != - cmp2->tmp_tgt_wrappers[roop_count] && - ( - !cmp1->tmp_tgt_wrappers[roop_count] || - !cmp2->tmp_tgt_wrappers[roop_count] || - strcmp(cmp1->tmp_tgt_wrappers[roop_count], - cmp2->tmp_tgt_wrappers[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_cas[roop_count] != - cmp2->tmp_tgt_ssl_cas[roop_count] && - ( - !cmp1->tmp_tgt_ssl_cas[roop_count] || - !cmp2->tmp_tgt_ssl_cas[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_cas[roop_count], - cmp2->tmp_tgt_ssl_cas[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_capaths[roop_count] != - cmp2->tmp_tgt_ssl_capaths[roop_count] && - ( - !cmp1->tmp_tgt_ssl_capaths[roop_count] || - !cmp2->tmp_tgt_ssl_capaths[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_capaths[roop_count], - cmp2->tmp_tgt_ssl_capaths[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_certs[roop_count] != - cmp2->tmp_tgt_ssl_certs[roop_count] && - ( - !cmp1->tmp_tgt_ssl_certs[roop_count] || - !cmp2->tmp_tgt_ssl_certs[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_certs[roop_count], - cmp2->tmp_tgt_ssl_certs[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_ciphers[roop_count] != - cmp2->tmp_tgt_ssl_ciphers[roop_count] && - ( - !cmp1->tmp_tgt_ssl_ciphers[roop_count] || - !cmp2->tmp_tgt_ssl_ciphers[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_ciphers[roop_count], - cmp2->tmp_tgt_ssl_ciphers[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_keys[roop_count] != - cmp2->tmp_tgt_ssl_keys[roop_count] && - ( - !cmp1->tmp_tgt_ssl_keys[roop_count] || - !cmp2->tmp_tgt_ssl_keys[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_keys[roop_count], - cmp2->tmp_tgt_ssl_keys[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_default_files[roop_count] != - cmp2->tmp_tgt_default_files[roop_count] && - ( - !cmp1->tmp_tgt_default_files[roop_count] || - !cmp2->tmp_tgt_default_files[roop_count] || - strcmp(cmp1->tmp_tgt_default_files[roop_count], - cmp2->tmp_tgt_default_files[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_default_groups[roop_count] != - cmp2->tmp_tgt_default_groups[roop_count] && - ( - !cmp1->tmp_tgt_default_groups[roop_count] || - !cmp2->tmp_tgt_default_groups[roop_count] || - strcmp(cmp1->tmp_tgt_default_groups[roop_count], - cmp2->tmp_tgt_default_groups[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_dsns[roop_count] != - cmp2->tmp_tgt_dsns[roop_count] && - ( - !cmp1->tmp_tgt_dsns[roop_count] || - !cmp2->tmp_tgt_dsns[roop_count] || - strcmp(cmp1->tmp_tgt_dsns[roop_count], - cmp2->tmp_tgt_dsns[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_filedsns[roop_count] != - cmp2->tmp_tgt_filedsns[roop_count] && - ( - !cmp1->tmp_tgt_filedsns[roop_count] || - !cmp2->tmp_tgt_filedsns[roop_count] || - strcmp(cmp1->tmp_tgt_filedsns[roop_count], - cmp2->tmp_tgt_filedsns[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_drivers[roop_count] != - cmp2->tmp_tgt_drivers[roop_count] && - ( - !cmp1->tmp_tgt_drivers[roop_count] || - !cmp2->tmp_tgt_drivers[roop_count] || - strcmp(cmp1->tmp_tgt_drivers[roop_count], - cmp2->tmp_tgt_drivers[roop_count]) - ) - ) || - ( - cmp1->tmp_static_link_ids[roop_count] != - cmp2->tmp_static_link_ids[roop_count] && - ( - !cmp1->tmp_static_link_ids[roop_count] || - !cmp2->tmp_static_link_ids[roop_count] || - strcmp(cmp1->tmp_static_link_ids[roop_count], - cmp2->tmp_static_link_ids[roop_count]) - ) - ) || - cmp1->tmp_tgt_ports[roop_count] != cmp2->tmp_tgt_ports[roop_count] || - cmp1->tmp_tgt_ssl_vscs[roop_count] != - cmp2->tmp_tgt_ssl_vscs[roop_count] || - cmp1->tmp_monitoring_binlog_pos_at_failing[roop_count] != - cmp2->tmp_monitoring_binlog_pos_at_failing[roop_count] || - cmp1->tmp_link_statuses[roop_count] != - cmp2->tmp_link_statuses[roop_count] - ) - DBUG_RETURN(TRUE); - } - DBUG_RETURN(FALSE); -} - int spider_free_trx_alloc( SPIDER_TRX *trx ) { diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index f836486718a..48e75da2d65 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -67,11 +67,6 @@ int spider_create_trx_alter_table( bool now_create ); -bool spider_cmp_trx_alter_table( - SPIDER_ALTER_TABLE *cmp1, - SPIDER_ALTER_TABLE *cmp2 -); - SPIDER_TRX *spider_get_trx( THD *thd, bool regist_allocated_thds, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 9a31caff012..63540bfbbd5 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -280,6 +280,7 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *end = key + len; ulong tmp1= *nr1; ulong tmp2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < end ; key++) { @@ -300,6 +301,7 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), 'A ' and 'A' as identical */ const uchar *end= skip_trailing_space(key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_bin(cs, key, end - key, nr1, nr2); } diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index ba9c86214d2..76e03003403 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -716,7 +716,8 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end; register ulong m1= *nr1, m2= *nr2; - + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ + /* Remove end space. We have to do this to be able to compare 'AE' and 'Ä' as identical diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 97613e9371e..5d4ec8c3049 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -559,6 +559,7 @@ my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { register ulong m1= *nr1, m2= *nr2; const uchar *end= key + len; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); @@ -577,6 +578,7 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), 'A ' and 'A' as identical */ const uchar *end= skip_trailing_space(key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_mb_nopad_bin(cs, key, end - key, nr1, nr2); } diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index d86746a186f..55992514800 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -365,6 +365,7 @@ void my_hash_sort_simple_nopad(CHARSET_INFO *cs, register const uchar *sort_order=cs->sort_order; const uchar *end= key + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < (uchar*) end ; key++) { MY_HASH_ADD(m1, m2, (uint) sort_order[(uint) *key]); @@ -381,6 +382,7 @@ void my_hash_sort_simple(CHARSET_INFO *cs, register const uchar *sort_order=cs->sort_order; const uchar *end; uint16 space_weight= sort_order[' ']; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ /* Remove all trailing characters that are equal to space. diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 90568eaff00..c5205e0c9f6 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -39521,8 +39521,9 @@ struct mysql_0900_to_mariadb_1400_mapping mysql_0900_mapping[]= }; -static LEX_CSTRING mysql_utf8_bin= { STRING_WITH_LEN("utf8mb4_0900_bin") }; -static LEX_CSTRING mariadb_utf8_bin= { STRING_WITH_LEN("utf8mb4_bin") }; +static LEX_CSTRING + mysql_utf8mb4_0900_bin= {STRING_WITH_LEN("utf8mb4_0900_bin")}, + mariadb_utf8mb4_nopad_bin= {STRING_WITH_LEN("utf8mb4_nopad_bin")}; /* Map mysql character sets to MariaDB using the same definition but with @@ -39566,7 +39567,8 @@ my_bool mysql_utf8mb4_0900_collation_definitions_add() } } - if (add_alias_for_collation(&mariadb_utf8_bin, 46, &mysql_utf8_bin, 309)) + if (add_alias_for_collation(&mariadb_utf8mb4_nopad_bin, 1070, + &mysql_utf8mb4_0900_bin, 309)) return 1; return 0; } diff --git a/strings/ctype-uca.inl b/strings/ctype-uca.inl index 11e5b273663..bb32886610c 100644 --- a/strings/ctype-uca.inl +++ b/strings/ctype-uca.inl @@ -636,6 +636,7 @@ MY_FUNCTION_NAME(hash_sort)(CHARSET_INFO *cs, my_uca_scanner_param param; int space_weight= my_space_weight(&cs->uca->level[0]); register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_uca_scanner_param_init(¶m, cs, &cs->uca->level[0]); my_uca_scanner_init_any(&scanner, s, slen); @@ -691,6 +692,7 @@ MY_FUNCTION_NAME(hash_sort_nopad)(CHARSET_INFO *cs, my_uca_scanner scanner; my_uca_scanner_param param; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_uca_scanner_param_init(¶m, cs, &cs->uca->level[0]); my_uca_scanner_init_any(&scanner, s, slen); diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 65c610f5c45..7a4d6db3399 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1369,6 +1369,7 @@ my_hash_sort_utf16_nopad(CHARSET_INFO *cs, const uchar *e= s + slen; MY_CASEFOLD_INFO *uni_plane= cs->casefold; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res= mb_wc(cs, &wc, (uchar *) s, (uchar *) e)) > 0) { @@ -1386,6 +1387,7 @@ my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_ci_lengthsp(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf16_nopad(cs, s, lengthsp, nr1, nr2); } @@ -1474,6 +1476,7 @@ my_hash_sort_utf16_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end= pos + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */ for ( ; pos < end ; pos++) { @@ -1489,6 +1492,7 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs, const uchar *pos, size_t len, ulong *nr1, ulong *nr2) { size_t lengthsp= my_ci_lengthsp(cs, (const char *) pos, len); + DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf16_nopad_bin(cs, pos, lengthsp, nr1, nr2); } @@ -2204,6 +2208,7 @@ my_hash_sort_utf32_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e= s + slen; MY_CASEFOLD_INFO *uni_plane= cs->casefold; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((res= my_utf32_uni(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { @@ -2224,6 +2229,7 @@ my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_utf32(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf32_nopad(cs, s, lengthsp, nr1, nr2); } @@ -3045,6 +3051,7 @@ my_hash_sort_ucs2_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e=s+slen; MY_CASEFOLD_INFO *uni_plane= cs->casefold; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e)) >0) { @@ -3061,6 +3068,7 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_mb2(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_ucs2_nopad(cs, s, lengthsp, nr1, nr2); } @@ -3163,6 +3171,7 @@ my_hash_sort_ucs2_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end= key + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for ( ; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); @@ -3177,6 +3186,7 @@ my_hash_sort_ucs2_bin(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_mb2(cs, (const char *) key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_ucs2_nopad_bin(cs, key, lengthsp, nr1, nr2); } diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 0e1a756d296..7a7e7458523 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -534,6 +534,7 @@ static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t const uchar *e= s+slen; MY_CASEFOLD_INFO *uni_plane= cs->casefold; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res=my_utf8mb3_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 ) { @@ -554,6 +555,7 @@ static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen, 'A ' and 'A' as identical */ const uchar *e= skip_trailing_space(s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2); } @@ -2895,6 +2897,7 @@ my_hash_sort_utf8mb4_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e= s + slen; MY_CASEFOLD_INFO *uni_plane= cs->casefold; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((res= my_mb_wc_utf8mb4(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { @@ -2927,6 +2930,7 @@ my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, 'A ' and 'A' as identical */ const uchar *e= skip_trailing_space(s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2); } diff --git a/strings/strings_def.h b/strings/strings_def.h index 10edebb946d..d4888542bbc 100644 --- a/strings/strings_def.h +++ b/strings/strings_def.h @@ -82,7 +82,7 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) { const uchar *end= ptr + len; - + DBUG_ASSERT(ptr); /* Avoid UBSAN nullptr-with-offset */ if (len > 20) { const uchar *end_words= (const uchar *)(intptr) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 0aa157d930a..c85cfdab8c1 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -48,10 +48,13 @@ User=mysql Group=mysql # CAP_IPC_LOCK To allow memlock to be used as non-root user +# These are enabled by default +AmbientCapabilities=CAP_IPC_LOCK + # CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0 # does nothing for non-root, not needed if /etc/shadow is u+r # CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason -AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE +CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_AUDIT_WRITE # PrivateDevices=true implies NoNewPrivileges=true and # SUID auth_pam_tool suddenly doesn't do setuid anymore @@ -108,7 +111,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 31f1586f1bf..8fda6acbd1a 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -178,10 +178,13 @@ PrivateNetwork=false ## # CAP_IPC_LOCK To allow memlock to be used as non-root user +# These are enabled by default +AmbientCapabilities=CAP_IPC_LOCK + # CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0 # does nothing for non-root, not needed if /etc/shadow is u+r # CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason -AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE +CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_AUDIT_WRITE # PrivateDevices=true implies NoNewPrivileges=true and # SUID auth_pam_tool suddenly doesn't do setuid anymore @@ -219,7 +222,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 diff --git a/support-files/rpm/server-prein.sh b/support-files/rpm/server-prein.sh index 3d6b089366f..a57dcd348d2 100644 --- a/support-files/rpm/server-prein.sh +++ b/support-files/rpm/server-prein.sh @@ -28,10 +28,11 @@ startup script in %{_sysconfdir}/init.d/. if [ "$old_family" != "$new_family" ]; then error_text="$error_text -Upgrading directly from MySQL $old_family to MariaDB $new_family may not -be safe in all cases. A manual dump and restore using mysqldump is -recommended. It is important to review the MariaDB manual's Upgrading -section for version-specific incompatibilities. +Upgrading directly from MariaDB or MySQL $old_family +to MariaDB $new_family may not be safe in all cases. +A manual dump and restore using mariadb-dump (or mysqldump) is recommended. +It is important to review the MariaDB manual's Upgrading section for +version-specific incompatibilities. " fi @@ -39,23 +40,23 @@ section for version-specific incompatibilities. cat <&2 ****************************************************************** -A MySQL or MariaDB server package ($installed) is installed. +A MariaDB or MySQL server package ($installed) is installed. $error_text A manual upgrade is required. - Ensure that you have a complete, working backup of your data and my.cnf files -- Shut down the MySQL server cleanly -- Remove the existing MySQL packages. Usually this command will +- Shut down the MariaDB or MySQL server cleanly +- Remove the existing MariaDB or MySQL packages. Usually this command will list the packages you should remove: - rpm -qa | grep -i '^mysql-' + rpm -qa | grep -iE '^(mariadb|mysql)-' You may choose to use 'rpm --nodeps -ev ' to remove the package which contains the mysqlclient shared library. The library will be reinstalled by the MariaDB-shared package. - Install the new MariaDB packages supplied by $myvendor - Ensure that the MariaDB server is started -- Run the 'mysql_upgrade' program +- Run the 'mariadb-upgrade' program This is a brief description of the upgrade process. Important details can be found in the MariaDB manual, in the Upgrading section. @@ -65,8 +66,8 @@ HERE fi fi -# Create a MySQL user and group. Do not report any problems if it already exists. +# Create a MariaDB user and group. Do not report any problems if it already exists. groupadd -r %{mysqld_group} 2> /dev/null || true -useradd -M -r --home %{mysqldatadir} --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true +useradd -M -r --home %{mysqldatadir} --shell /sbin/nologin --comment "MariaDB server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true # The user may already exist, make sure it has the proper group nevertheless (BUG#12823) usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 26d282f01bc..542811ba966 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -22886,9 +22886,9 @@ void test_mdev_10075() DIE_UNLESS(rc == 1); mysql_free_result(result); + mysql_query(mysql, "drop table t1"); } - #ifndef EMBEDDED_LIBRARY /* MDEV-36080: Run a Prepared Statement that hits a failure when the query @@ -22967,9 +22967,54 @@ static void test_mdev_36080() rc= mysql_query(mysql, "drop table t0, t1, t2"); myquery(rc); } -#endif +static void test_mdev35953() +{ + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND bind[1]; + int vals[]= {1, 2}, count= array_elements(vals); + MYSQL *con= mysql_client_init(NULL); + DIE_UNLESS(con); + if (!mysql_real_connect(con, opt_host, opt_user, opt_password, current_db, + opt_port, opt_unix_socket, 0)) + { + fprintf(stderr, "Failed to connect to database: Error: %s\n", + mysql_error(con)); + exit(1); + } + rc= mysql_query(mysql, "create table t1 (a int)"); + myquery(rc); + + stmt= mysql_stmt_init(con); + rc= mysql_stmt_prepare(stmt, "insert into t1 (a) values (?)", -1); + check_execute(stmt, rc); + + memset(bind, 0, sizeof(bind)); + bind[0].buffer_type = MYSQL_TYPE_LONG; + bind[0].buffer = vals; + + mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &count); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_query(mysql, "alter table t1 add xx int"); + myquery(rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + mysql_stmt_close(stmt); + mysql_close(con); + + mysql_query(mysql, "drop table t1"); +} +#endif + static struct my_tests_st my_tests[]= { { "test_mdev_20516", test_mdev_20516 }, { "test_mdev24827", test_mdev24827 }, @@ -23290,6 +23335,7 @@ static struct my_tests_st my_tests[]= { { "test_mdev_10075", test_mdev_10075}, #ifndef EMBEDDED_LIBRARY { "test_mdev_36080", test_mdev_36080}, + { "test_mdev35953", test_mdev35953 }, #endif { 0, 0 } };