diff --git a/.gitignore b/.gitignore index 527f4a946cb..db9e19d8708 100644 --- a/.gitignore +++ b/.gitignore @@ -292,8 +292,6 @@ storage/mroonga/vendor/groonga/src/grnslap storage/mroonga/vendor/groonga/src/groonga storage/mroonga/vendor/groonga/src/groonga-benchmark storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset -storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result -storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result zlib/zconf.h xxx/* yyy/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 617226b5a36..3828420c6de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -248,6 +248,19 @@ 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) + 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") + ENDIF() + MY_CHECK_CXX_COMPILER_FLAG("-stdlib=libc++") + IF(NOT have_CXX__stdlib_libc__) + 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) + IF(NOT HAVE_LINK_FLAG__fsanitize_memory) + MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") + ENDIF() ENDIF() OPTION(WITH_GPROF "Enable profiling with gprof" OFF) @@ -261,7 +274,7 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO) # enable security hardening features, like most distributions do # in our benchmarks that costs about ~1% of performance, depending on the load OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) -IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF) +IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF AND NOT WITH_MSAN) # security-enhancing flags MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now") diff --git a/client/mysql.cc b/client/mysql.cc index 0b19a52771c..7484d253280 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1823,7 +1823,8 @@ static struct my_option my_long_options[] = "if the output is suspended. Doesn't use history file.", &quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"quick-max-column-width", 0, - "Maximal field length limit in case of --qick", &quick_max_column_width, + "Maximum number of characters displayed in a column header" + " when using --quick", &quick_max_column_width, &quick_max_column_width, 0, GET_ULONG, REQUIRED_ARG, LONG_MAX, 0, ULONG_MAX, 0, 1, 0}, {"raw", 'r', "Write fields without conversion. Used with --batch.", diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 6c205d78c3b..00870fa72e0 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -735,8 +735,8 @@ static int check_options(int argc, char **argv, char *operation) { int i= 0; /* loop counter */ int num_found= 0; /* number of options found (shortcut loop) */ - char config_file[FN_REFLEN]; /* configuration file name */ - char plugin_name[FN_REFLEN]; /* plugin name */ + char config_file[FN_REFLEN+1]; /* configuration file name */ + char plugin_name[FN_REFLEN+1]; /* plugin name */ /* Form prefix strings for the options. */ const char *basedir_prefix = "--basedir="; @@ -784,8 +784,8 @@ static int check_options(int argc, char **argv, char *operation) /* read the plugin config file and check for match against argument */ else { - if (safe_strcpy_truncated(plugin_name, sizeof plugin_name, argv[i]) || - safe_strcpy_truncated(config_file, sizeof config_file, argv[i]) || + if (safe_strcpy_truncated(plugin_name, sizeof(plugin_name)-1, argv[i]) || + safe_strcpy_truncated(config_file, sizeof(config_file)-1, argv[i]) || safe_strcat(config_file, sizeof(config_file), ".ini")) { fprintf(stderr, "ERROR: argument is too long.\n"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 1c9b6e10d11..22946132913 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -150,6 +150,7 @@ static char *ignore_server_ids_str, *do_server_ids_str; static char *start_pos_str, *stop_pos_str; static ulonglong start_position= BIN_LOG_HEADER_SIZE, stop_position= (longlong)(~(my_off_t)0) ; +static const longlong stop_position_default= (longlong)(~(my_off_t)0); #define start_position_mot ((my_off_t)start_position) #define stop_position_mot ((my_off_t)stop_position) @@ -3078,6 +3079,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, IO_CACHE cache,*file= &cache; uchar tmp_buff[BIN_LOG_HEADER_SIZE]; Exit_status retval= OK_CONTINUE; + my_time_t last_ev_when= MY_TIME_T_MAX; if (logname && strcmp(logname, "-") != 0) { @@ -3169,9 +3171,35 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info, llstr(old_off,llbuff)); goto err; } - // file->error == 0 means EOF, that's OK, we break in this case + // else file->error == 0 means EOF, that's OK, we break in this case + + /* + Emit a warning in the event that we finished processing input + before reaching the boundary indicated by --stop-position. + */ + if (((longlong)stop_position != stop_position_default) && + stop_position > my_b_tell(file)) + { + retval = OK_STOP; + warning("Did not reach stop position %llu before " + "end of input", stop_position); + } + + /* + Emit a warning in the event that we finished processing input + before reaching the boundary indicated by --stop-datetime. + */ + if (stop_datetime != MY_TIME_T_MAX && + stop_datetime > last_ev_when) + { + retval = OK_STOP; + warning("Did not reach stop datetime '%s' " + "before end of input", stop_datetime_str); + } + goto end; } + last_ev_when= ev->when; if ((retval= process_event(print_event_info, ev, old_off, logname)) != OK_CONTINUE) goto end; diff --git a/client/mysqldump.cc b/client/mysqldump.cc index fe70072ed08..4a6f62005a7 100644 --- a/client/mysqldump.cc +++ b/client/mysqldump.cc @@ -7432,7 +7432,7 @@ int main(int argc, char **argv) goto err; connection_pool.for_each_connection([](MYSQL *c) { if (start_transaction(c)) - maybe_die(EX_MYSQLERR, "Failed to start transaction on connection ID %u", mysql->thread_id); + maybe_die(EX_MYSQLERR, "Failed to start transaction on connection ID %lu", mysql->thread_id); }); } diff --git a/client/mysqlimport.cc b/client/mysqlimport.cc index b8c92b76950..fe89ebf526f 100644 --- a/client/mysqlimport.cc +++ b/client/mysqlimport.cc @@ -45,6 +45,9 @@ #include tpool::thread_pool *thread_pool; +static std::vector all_tp_connections; +std::atomic aborting{false}; +static void kill_tp_connections(MYSQL *mysql); static void db_error_with_table(MYSQL *mysql, char *table); static void db_error(MYSQL *mysql); @@ -81,7 +84,7 @@ struct table_load_params CREATE VIEW */ std::string tablename; /* name of the table */ std::string dbname; /* name of the database */ - ulonglong size; /* size of the data file */ + ulonglong size= 0; /* size of the data file */ }; std::unordered_set ignore_databases; @@ -479,9 +482,12 @@ static int exec_sql(MYSQL *mysql, const std::string& s) { if (mysql_query(mysql, s.c_str())) { - fprintf(stdout,"Error: %d, %s, when using statement: %s\n", - mysql_errno(mysql), mysql_error(mysql), s.c_str()); - db_error(mysql); + if (!aborting) + { + fprintf(stdout, "Error: %d, %s, when using statement: %s\n", + mysql_errno(mysql), mysql_error(mysql), s.c_str()); + db_error(mysql); + } return 1; } return 0; @@ -582,6 +588,8 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql) DBUG_ENTER("handle_one_table"); DBUG_PRINT("enter",("datafile: %s",params->data_file.c_str())); + if (aborting) + return 1; if (verbose && !params->sql_file.empty()) { fprintf(stdout, "Executing SQL script %s\n", params->sql_file.c_str()); @@ -644,6 +652,9 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql) if (exec_sql(mysql, sql_statement)) DBUG_RETURN(1); } + if (exec_sql(mysql, "SET collation_database=binary")) + DBUG_RETURN(1); + to_unix_path(hard_path); if (verbose) { @@ -828,20 +839,34 @@ static void db_disconnect(char *host, MYSQL *mysql) static void safe_exit(int error, MYSQL *mysql) { + if (error && ignore_errors) return; - if (mysql) - mysql_close(mysql); + bool expected= false; + if (!aborting.compare_exchange_strong(expected, true)) + return; if (thread_pool) { /* dirty exit. some threads are running, - memory is not freed, openssl not deinitialized */ + memory is not freed, openssl not deinitialized */ DBUG_ASSERT(error); + if (mysql) + { + /* + We still need tell server to kill all connections + so it does not keep busy with load. + */ + kill_tp_connections(mysql); + } + _exit(error); } - + if (mysql) + { + mysql_close(mysql); + } mysql_library_end(); free_defaults(argv_to_free); my_free(opt_password); @@ -853,6 +878,8 @@ static void safe_exit(int error, MYSQL *mysql) static void db_error_with_table(MYSQL *mysql, char *table) { + if (aborting) + return; my_printf_error(0,"Error: %d, %s, when using table: %s", MYF(0), mysql_errno(mysql), mysql_error(mysql), table); safe_exit(1, mysql); @@ -947,16 +974,48 @@ void load_single_table(void *arg) set_exitcode(error); } +static void init_tp_connections(size_t n) +{ + for (size_t i= 0; i < n; i++) + { + MYSQL *mysql= + db_connect(current_host, current_db, current_user, opt_password); + all_tp_connections.push_back(mysql); + } +} + +static void close_tp_connections() +{ + for (auto &conn : all_tp_connections) + { + db_disconnect(current_host, conn); + } + all_tp_connections.clear(); +} + +/* + If we end with an error, in one connection, + we need to kill all others. + + Otherwise, server will still be busy with load, + when we already exited. +*/ +static void kill_tp_connections(MYSQL *mysql) +{ + for (auto &conn : all_tp_connections) + mysql_kill(mysql, mysql_thread_id(conn)); +} + static void tpool_thread_init(void) { mysql_thread_init(); - thread_local_mysql= db_connect(current_host,current_db,current_user,opt_password); + static std::atomic next_connection(0); + assert(next_connection < all_tp_connections.size()); + thread_local_mysql= all_tp_connections[next_connection++]; } static void tpool_thread_exit(void) { - if (thread_local_mysql) - db_disconnect(current_host,thread_local_mysql); mysql_thread_end(); } @@ -1017,7 +1076,7 @@ static void scan_backup_dir(const char *dir, } for (size_t j= 0; j < dir_info2->number_of_files; j++) { - table_load_params par{}; + table_load_params par; par.dbname= dbname; fi= &dir_info2->dir_entry[j]; if (has_extension(fi->name, ".sql") || has_extension(fi->name, ".txt")) @@ -1144,6 +1203,7 @@ int main(int argc, char **argv) fatal_error("Too many connections, max value for --parallel is %d\n", MAX_THREADS); } + init_tp_connections(opt_use_threads); thread_pool= tpool::create_thread_pool_generic(opt_use_threads,opt_use_threads); thread_pool->set_thread_callbacks(tpool_thread_init,tpool_thread_exit); @@ -1155,6 +1215,7 @@ int main(int argc, char **argv) thread_pool->submit_task(&t); delete thread_pool; + close_tp_connections(); thread_pool= nullptr; files_to_load.clear(); } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 777aaa6e95b..688fa0285b2 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -164,6 +164,7 @@ static struct property prop_list[] = { { &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" }, { &ps2_protocol_enabled, 0, 0, 0, "$ENABLED_PS2_PROTOCOL" }, { &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"}, + { &cursor_protocol_enabled, 0, 0, 0, "$ENABLED_CURSOR_PROTOCOL"}, { &service_connection_enabled, 0, 1, 0, "$ENABLED_SERVICE_CONNECTION"}, { &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" }, { &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" }, @@ -181,6 +182,7 @@ enum enum_prop { P_PS, P_PS2, P_VIEW, + P_CURSOR, P_CONN, P_QUERY, P_RESULT, @@ -273,6 +275,7 @@ static regex_t ps_re; /* the query can be run using PS protocol */ static regex_t ps2_re; /* the query can be run using PS protocol with second execution*/ static regex_t sp_re; /* the query can be run as a SP */ static regex_t view_re; /* the query can be run as a view*/ +static regex_t cursor_re; /* the query can be run with cursor protocol*/ static void init_re(void); static int match_re(regex_t *, char *); @@ -398,6 +401,7 @@ enum enum_commands { Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_DISABLE_PS2_PROTOCOL, Q_ENABLE_PS2_PROTOCOL, Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL, + Q_DISABLE_CURSOR_PROTOCOL, Q_ENABLE_CURSOR_PROTOCOL, Q_DISABLE_SERVICE_CONNECTION, Q_ENABLE_SERVICE_CONNECTION, Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, @@ -495,6 +499,8 @@ const char *command_names[]= "enable_ps2_protocol", "disable_view_protocol", "enable_view_protocol", + "disable_cursor_protocol", + "enable_cursor_protocol", "disable_service_connection", "enable_service_connection", "enable_non_blocking_api", @@ -8720,13 +8726,22 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, #if MYSQL_VERSION_ID >= 50000 if (cursor_protocol_enabled) { + ps2_protocol_enabled = 0; + /* - Use cursor when retrieving result + Use cursor for queries matching the filter, + else reset cursor type */ - ulong type= CURSOR_TYPE_READ_ONLY; - if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) - die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", - mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + if (match_re(&cursor_re, query)) + { + /* + Use cursor when retrieving result + */ + ulong type= CURSOR_TYPE_READ_ONLY; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } } #endif @@ -8788,9 +8803,11 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, { /* When running in cursor_protocol get the warnings from execute here - and keep them in a separate string for later. + and keep them in a separate string for later. Cursor_protocol is used + only for queries matching the filter "cursor_re". */ - if (cursor_protocol_enabled && !disable_warnings) + if (cursor_protocol_enabled && match_re(&cursor_re, query) && + !disable_warnings) append_warnings(&ds_execute_warnings, mysql); if (!disable_result_log && @@ -8938,6 +8955,16 @@ end: var_set_errno(mysql_stmt_errno(stmt)); display_optimizer_trace(cn, ds); + #if MYSQL_VERSION_ID >= 50000 + if (cursor_protocol_enabled) + { + ulong type= CURSOR_TYPE_NO_CURSOR; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } + #endif + revert_properties(); /* Close the statement if reconnect, need new prepare */ @@ -9805,10 +9832,19 @@ void init_re(void) "^(" "[[:space:]]*SELECT[[:space:]])"; + /* + Filter for queries that can be run with + cursor protocol + */ + const char *cursor_re_str = + "^(" + "[[:space:]]*SELECT[[:space:]])"; + init_re_comp(&ps_re, ps_re_str); init_re_comp(&ps2_re, ps2_re_str); init_re_comp(&sp_re, sp_re_str); init_re_comp(&view_re, view_re_str); + init_re_comp(&cursor_re, cursor_re_str); } @@ -9846,6 +9882,7 @@ void free_re(void) regfree(&ps2_re); regfree(&sp_re); regfree(&view_re); + regfree(&cursor_re); } /****************************************************************************/ @@ -10624,6 +10661,17 @@ int main(int argc, char **argv) case Q_ENABLE_VIEW_PROTOCOL: set_property(command, P_VIEW, view_protocol); break; + case Q_DISABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, 0); + if (cursor_protocol) + set_property(command, P_PS, 0); + /* Close any open statements */ + close_statements(); + break; + case Q_ENABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, cursor_protocol); + set_property(command, P_PS, ps_protocol); + break; case Q_DISABLE_SERVICE_CONNECTION: set_property(command, P_CONN, 0); /* Close only util connections */ diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index 911fb75385e..78a0df6f911 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -30,12 +30,13 @@ MACRO (CHECK_LIBFMT) CHECK_CXX_SOURCE_RUNS( "#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 - #include + #include int main() { + using ArgStore= fmt::dynamic_format_arg_store; + ArgStore arg_store; int answer= 4321; - fmt::format_args::format_arg arg= - fmt::detail::make_arg(answer); - return fmt::vformat(\"{:L}\", fmt::format_args(&arg, 1)).compare(\"4,321\"); + arg_store.push_back(answer); + return fmt::vformat(\"{:L}\", arg_store).compare(\"4,321\"); }" HAVE_SYSTEM_LIBFMT) SET(CMAKE_REQUIRED_INCLUDES) ENDIF() diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake new file mode 100644 index 00000000000..4bcd844929f --- /dev/null +++ b/cmake/os/FreeBSD.cmake @@ -0,0 +1,19 @@ +# Copyright (C) 2024 MariaDB Foundation +# +# 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 + +# This file includes FreeBSD specific options and quirks, related to system checks + +# For all userspace dependencies +LINK_DIRECTORIES(/usr/local/lib) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index e224fcbd0a0..c5c9ac9e8cf 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -60,7 +60,6 @@ SET(HAVE_GETIFADDRS CACHE INTERNAL "") SET(HAVE_GETCWD 1 CACHE INTERNAL "") SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") -SET(HAVE_GETPAGESIZE CACHE INTERNAL "") SET(HAVE_GETPASS CACHE INTERNAL "") SET(HAVE_GETMNTENT CACHE INTERNAL "") SET(HAVE_GETMNTENT_IN_SYS_MNTAB CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 11e62b51355..1cb7e021ac9 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -150,7 +150,6 @@ #cmakedefine HAVE_GETCWD 1 #cmakedefine HAVE_GETHOSTBYADDR_R 1 #cmakedefine HAVE_GETHRTIME 1 -#cmakedefine HAVE_GETPAGESIZE 1 #cmakedefine HAVE_GETPAGESIZES 1 #cmakedefine HAVE_GETPASS 1 #cmakedefine HAVE_GETPASSPHRASE 1 diff --git a/configure.cmake b/configure.cmake index a39dc3109c2..7f90e286155 100644 --- a/configure.cmake +++ b/configure.cmake @@ -461,7 +461,6 @@ CHECK_SYMBOL_EXISTS(madvise "sys/mman.h" HAVE_DECL_MADVISE) CHECK_SYMBOL_EXISTS(getpagesizes "sys/mman.h" HAVE_GETPAGESIZES) CHECK_SYMBOL_EXISTS(tzname "time.h" HAVE_TZNAME) CHECK_SYMBOL_EXISTS(lrand48 "stdlib.h" HAVE_LRAND48) -CHECK_SYMBOL_EXISTS(getpagesize "unistd.h" HAVE_GETPAGESIZE) CHECK_SYMBOL_EXISTS(TIOCGWINSZ "sys/ioctl.h" GWINSZ_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(FIONREAD "sys/ioctl.h" FIONREAD_IN_SYS_IOCTL) CHECK_SYMBOL_EXISTS(TIOCSTAT "sys/ioctl.h" TIOCSTAT_IN_SYS_IOCTL) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index a328f5e0ec7..e837f7c74b6 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -64,6 +64,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #ifdef _WIN32 #include /* rmdir */ #endif +#include #ifdef _WIN32 #include @@ -1353,9 +1354,6 @@ out: return(ret); } -lsn_t server_lsn_after_lock; -extern void backup_wait_for_lsn(lsn_t lsn); - /** Release resources after backup_files() */ void backup_release() { @@ -1641,7 +1639,7 @@ is_aria_log_dir_file(const datadir_node_t &node) bool copy_back_aria_logs(const char *dstdir) { - std::unique_ptr + std::unique_ptr> ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy); datadir_node_t node; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index f7e588f2038..6a06111b489 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -205,6 +205,8 @@ 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 */ +lsn_t metadata_to_lsn; uint xtrabackup_parallel; @@ -235,7 +237,6 @@ my_bool opt_encrypted_backup; /* === metadata of backup === */ char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/ static lsn_t metadata_from_lsn; -lsn_t metadata_to_lsn; static lsn_t metadata_last_lsn; static ds_file_t* dst_log_file; @@ -281,9 +282,6 @@ my_bool xtrabackup_incremental_force_scan = FALSE; */ ulong xtrabackup_innodb_force_recovery = 0; -/* The flushed lsn which is read from data files */ -lsn_t flushed_lsn= 0; - ulong xb_open_files_limit= 0; char *xb_plugin_dir; char *xb_plugin_load; @@ -1331,6 +1329,9 @@ enum options_xtrabackup OPT_INNODB_BUFFER_POOL_FILENAME, OPT_INNODB_LOCK_WAIT_TIMEOUT, OPT_INNODB_LOG_BUFFER_SIZE, +#ifdef HAVE_INNODB_MMAP + OPT_INNODB_LOG_FILE_MMAP, +#endif #if defined __linux__ || defined _WIN32 OPT_INNODB_LOG_FILE_BUFFERING, #endif @@ -1894,6 +1895,13 @@ struct my_option xb_server_options[] = (G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0, GET_UINT, REQUIRED_ARG, 2U << 20, 2U << 20, log_sys.buf_size_max, 0, 4096, 0}, +#ifdef HAVE_INNODB_MMAP + {"innodb_log_file_mmap", OPT_INNODB_LOG_FILE_SIZE, + "Whether ib_logfile0 should be memory-mapped", + (G_PTR*) &log_sys.log_mmap, + (G_PTR*) &log_sys.log_mmap, 0, GET_BOOL, NO_ARG, + log_sys.log_mmap_default, 0, 0, 0, 0, 0}, +#endif #if defined __linux__ || defined _WIN32 {"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING, "Whether the file system cache for ib_logfile0 is enabled during --backup", @@ -3391,8 +3399,108 @@ skip: return(FALSE); } +#ifdef HAVE_INNODB_MMAP +static int +xtrabackup_copy_mmap_snippet(ds_file_t *ds, const byte *start, const byte *end) +{ + if (UNIV_UNLIKELY(start > end)) + { + if (int r= ds_write(ds, start, log_sys.buf + log_sys.file_size - start)) + return r; + start= log_sys.buf + log_sys.START_OFFSET; + } + return ds_write(ds, start, end - start); +} + +/** Copy memory-mapped log until the end of the log is reached +or the log_copying_stop signal is received +@return whether the operation failed */ +static bool xtrabackup_copy_mmap_logfile() +{ + mysql_mutex_assert_owner(&recv_sys.mutex); + recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn)); + recv_sys.len= size_t(log_sys.file_size); + const size_t seq_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; + const char one{'\1'}; + + for (unsigned retry_count{0};;) + { + recv_sys_t::parse_mtr_result r; + const byte *start= &log_sys.buf[recv_sys.offset]; + + if (recv_sys.parse_mmap(false) == recv_sys_t::OK) + { + const byte *end; + + do + { + /* Set the sequence bit (the backed-up log will not wrap around) */ + size_t seqo= recv_sys.offset - seq_offset; + if (seqo < log_sys.START_OFFSET) + seqo+= log_sys.file_size - log_sys.START_OFFSET; + const byte *seq= &log_sys.buf[seqo]; + ut_ad(*seq == log_sys.get_sequence_bit(recv_sys.lsn - seq_offset)); + if (!*seq) + { + if (xtrabackup_copy_mmap_snippet(dst_log_file, start, seq) || + ds_write(dst_log_file, &one, 1)) + goto write_error; + start = seq + 1; + } + } + while ((r= recv_sys.parse_mmap(false)) == recv_sys_t::OK); + + end= &log_sys.buf[recv_sys.offset]; + + if (xtrabackup_copy_mmap_snippet(dst_log_file, start, end)) + { + write_error: + msg("Error: write to ib_logfile0 failed"); + return true; + } + + start= end; + + pthread_cond_broadcast(&scanned_lsn_cond); + + if (r == recv_sys_t::GOT_EOF) + break; + + retry_count= 0; + } + else + { + if (metadata_to_lsn) + { + if (metadata_to_lsn <= recv_sys.lsn) + return false; + } + else if (xtrabackup_throttle && io_ticket-- < 0) + mysql_cond_wait(&wait_throttle, &recv_sys.mutex); + + if (!retry_count++) + msg("Retrying read of log at LSN=" LSN_PF, recv_sys.lsn); + else if (retry_count == 100) + break; + else + { + timespec abstime; + set_timespec_nsec(abstime, 1000000ULL /* 1 ms */); + if (!mysql_cond_timedwait(&log_copying_stop, &recv_sys.mutex, + &abstime)) + return true; + } + } + } + + if (verbose) + msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn); + return false; +} +#endif + /** Copy redo log until the current end of the log is reached -@return whether the operation failed */ +@return whether the operation failed */ static bool xtrabackup_copy_logfile() { mysql_mutex_assert_owner(&recv_sys.mutex); @@ -3400,16 +3508,17 @@ static bool xtrabackup_copy_logfile() ut_a(dst_log_file); ut_ad(recv_sys.is_initialised()); + +#ifdef HAVE_INNODB_MMAP + if (log_sys.is_mmap()) + return xtrabackup_copy_mmap_logfile(); +#endif const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U}; const size_t block_size_1{log_sys.write_size - 1}; - ut_ad(!log_sys.is_pmem()); - - { - recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & - block_size_1; - recv_sys.len= 0; - } + recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & + block_size_1; + recv_sys.len= 0; for (unsigned retry_count{0};;) { @@ -3505,35 +3614,70 @@ static bool xtrabackup_copy_logfile() return false; } -/** -Wait until redo log copying thread processes given lsn -*/ -void backup_wait_for_lsn(lsn_t lsn) +static bool backup_wait_timeout(lsn_t lsn, lsn_t last_lsn) { - mysql_mutex_lock(&recv_sys.mutex); - for (lsn_t last_lsn{recv_sys.lsn}; last_lsn < lsn; ) + if (last_lsn >= lsn) + return true; + msg("Was only able to copy log from " LSN_PF " to " LSN_PF + ", not " LSN_PF "; try increasing innodb_log_file_size", + log_sys.next_checkpoint_lsn, last_lsn, lsn); + return false; +} + +/** +Wait for enough log to be copied. +@param lsn log sequence number target +@return the reached log sequence number (may be less or more than lsn) +*/ +static lsn_t backup_wait_for_lsn_low(lsn_t lsn) +{ + mysql_mutex_assert_owner(&recv_sys.mutex); + + lsn_t last_lsn{recv_sys.lsn}; + + if (last_lsn >= lsn) + return last_lsn; + + msg("Waiting for log copy thread to read lsn " LSN_PF, lsn); + + while (log_copying_running && last_lsn < lsn) { timespec abstime; set_timespec(abstime, 5); if (my_cond_timedwait(&scanned_lsn_cond, &recv_sys.mutex.m_mutex, &abstime) && last_lsn == recv_sys.lsn) - die("Was only able to copy log from " LSN_PF " to " LSN_PF - ", not " LSN_PF "; try increasing innodb_log_file_size", - log_sys.next_checkpoint_lsn, last_lsn, lsn); + break; last_lsn= recv_sys.lsn; } - mysql_mutex_unlock(&recv_sys.mutex); + + return last_lsn; +} + +/** +Wait for enough log to be copied after BACKUP STAGE BLOCK_DDL. +@param lsn log sequence number target +@return whether log_copying_thread() copied everything until the target lsn +*/ +static bool backup_wait_for_lsn(lsn_t lsn) +{ + if (!lsn) + return true; + mysql_mutex_lock(&recv_sys.mutex); + ut_ad(!metadata_to_lsn); + ut_ad(!metadata_last_lsn); + lsn_t last_lsn{backup_wait_for_lsn_low(lsn)}; + mysql_mutex_unlock(&recv_sys.mutex); + return backup_wait_timeout(lsn, last_lsn); } -extern lsn_t server_lsn_after_lock; static void log_copying_thread() { my_thread_init(); mysql_mutex_lock(&recv_sys.mutex); while (!xtrabackup_copy_logfile() && - (!metadata_to_lsn || metadata_to_lsn > recv_sys.lsn)) + (!metadata_last_lsn || metadata_last_lsn > recv_sys.lsn)) { timespec abstime; set_timespec_nsec(abstime, 1000000ULL * xtrabackup_log_copy_interval); @@ -3557,7 +3701,7 @@ static void io_watching_thread() mysql_mutex_lock(&recv_sys.mutex); ut_ad(have_io_watching_thread); - while (log_copying_running && !metadata_to_lsn) + while (log_copying_running && !metadata_last_lsn) { timespec abstime; set_timespec(abstime, 1); @@ -4708,6 +4852,7 @@ end: static void stop_backup_threads() { + ut_ad(metadata_last_lsn); mysql_cond_broadcast(&log_copying_stop); if (log_copying_running || have_io_watching_thread) @@ -4731,38 +4876,58 @@ static void stop_backup_threads() mysql_cond_destroy(&log_copying_stop); } +/** +Wait for enough log to be copied. +@return whether log_copying_thread() copied everything until the target lsn +*/ +static bool backup_wait_for_commit_lsn() +{ + lsn_t lsn= get_current_lsn(mysql_connection); + mysql_mutex_lock(&recv_sys.mutex); + ut_ad(!metadata_to_lsn); + ut_ad(!metadata_last_lsn); + + lsn_t last_lsn= recv_sys.lsn; + + /* read the latest checkpoint lsn */ + if (recv_sys.find_checkpoint() == DB_SUCCESS && log_sys.is_latest()) + { + if (log_sys.next_checkpoint_lsn > lsn) + lsn= log_sys.next_checkpoint_lsn; + metadata_to_lsn= log_sys.next_checkpoint_lsn; + msg("mariabackup: The latest check point (for incremental): '" + LSN_PF "'", metadata_to_lsn); + } + else + { + msg("Error: recv_sys.find_checkpoint() failed."); + metadata_last_lsn= 1; + stop_backup_threads(); + mysql_mutex_unlock(&recv_sys.mutex); + return false; + } + + recv_sys.lsn= last_lsn; + ut_ad(metadata_to_lsn); + metadata_last_lsn= lsn; + + last_lsn= backup_wait_for_lsn_low(LSN_MAX); + + metadata_last_lsn= last_lsn; + stop_backup_threads(); + mysql_mutex_unlock(&recv_sys.mutex); + return backup_wait_timeout(lsn, last_lsn); +} + /** Implement the core of --backup @return whether the operation succeeded */ bool Backup_datasinks::backup_low() { - mysql_mutex_lock(&recv_sys.mutex); - ut_ad(!metadata_to_lsn); - - /* read the latest checkpoint lsn */ - { - const lsn_t lsn = recv_sys.lsn; - if (recv_sys.find_checkpoint() == DB_SUCCESS - && log_sys.is_latest()) { - metadata_to_lsn = log_sys.next_checkpoint_lsn; - msg("mariabackup: The latest check point" - " (for incremental): '" LSN_PF "'", - metadata_to_lsn); - } else { - msg("Error: recv_sys.find_checkpoint() failed."); - } - - recv_sys.lsn = lsn; - stop_backup_threads(); - } - - if (metadata_to_lsn && xtrabackup_copy_logfile()) { - mysql_mutex_unlock(&recv_sys.mutex); - ds_close(dst_log_file); - dst_log_file = NULL; - return false; - } - - mysql_mutex_unlock(&recv_sys.mutex); + ut_d(mysql_mutex_lock(&recv_sys.mutex)); + ut_ad(metadata_last_lsn); + ut_ad(metadata_to_lsn); + ut_ad(!log_copying_running); + ut_d(mysql_mutex_unlock(&recv_sys.mutex)); if (ds_close(dst_log_file) || !metadata_to_lsn) { dst_log_file = NULL; @@ -4779,7 +4944,7 @@ bool Backup_datasinks::backup_low() for (uint32_t id : failed_ids) { msg("mariabackup: Failed to read undo log " - "tablespace space id %d and there is no undo " + "tablespace space id " UINT32PF " and there is no undo " "tablespace truncation redo record.", id); } @@ -4866,17 +5031,17 @@ private: // TODO: this came from the old code, where it was not thread-safe // too, use separate mysql connection per thread here DBUG_MARIABACKUP_EVENT("before_copy", node->space->name()); - DBUG_EXECUTE_FOR_KEY("wait_innodb_redo_before_copy", - node->space->name(), - backup_wait_for_lsn( - get_current_lsn(mysql_connection));); + DBUG_EXECUTE_FOR_KEY("wait_innodb_redo_before_copy", + node->space->name(), + backup_wait_for_lsn( + get_current_lsn(mysql_connection));); /* copy the datafile */ if(xtrabackup_copy_datafile(m_backup_datasinks.m_data, - m_backup_datasinks.m_meta, - node, thread_num, NULL, - xtrabackup_incremental - ? wf_incremental : wf_write_through, - m_corrupted_pages)) + m_backup_datasinks.m_meta, + node, thread_num, NULL, + xtrabackup_incremental + ? wf_incremental : wf_write_through, + m_corrupted_pages)) die("mariabackup: Error: failed to copy datafile."); // TODO: this came from the old code, where it was not thread-safe // too, use separate mysql connection per thread here @@ -4884,8 +5049,8 @@ private: m_tasks.finish_task(1); } - Backup_datasinks &m_backup_datasinks; - CorruptedPages &m_corrupted_pages; + Backup_datasinks &m_backup_datasinks; + CorruptedPages &m_corrupted_pages; TasksGroup m_tasks; }; @@ -5086,9 +5251,9 @@ class BackupStages { return false; } - msg("Waiting for log copy thread to read lsn %llu", - server_lsn_after_lock); - backup_wait_for_lsn(server_lsn_after_lock); + if (!backup_wait_for_lsn(server_lsn_after_lock)) { + return false; + } corrupted_pages.backup_fix_ddl(backup_datasinks.m_data, backup_datasinks.m_meta); @@ -5124,11 +5289,28 @@ class BackupStages { } // Copy log tables tail - if (!m_common_backup.copy_log_tables(true)) { + if (!m_common_backup.copy_log_tables(true) || + !m_common_backup.close_log_tables()) { msg("Error on copy log tables"); return false; } + // Copy just enough log to cover the latest commit. + // Meanwhile, there could be some active transactions + // that are modifying the database and writing more + // log. Not copying log for them will save busy work + // and avoid some rollback of the incomplete + // transactions after the backup has been restored. + // + // We find the current InnoDB LSN by executing + // SHOW ENGINE INNODB STATUS, which in the case of + // general_log=1, log_output='TABLES' + // would be written to the table mysql.general_log + // that we just finished copying above. + if (!backup_wait_for_commit_lsn()) { + return false; + } + // Copy stats tables if (!m_common_backup.copy_stats_tables()) { msg("Error on copy stats tables"); @@ -5146,11 +5328,6 @@ class BackupStages { return false; } - if (!m_common_backup.close_log_tables()) { - msg("Error on close log tables"); - return false; - } - if (!backup_files_from_datadir(backup_datasinks.m_data, fil_path_to_mysql_datadir, "aws-kms-key")) { @@ -5292,13 +5469,14 @@ static bool xtrabackup_backup_func() undo_space_trunc = backup_undo_trunc; first_page_init = backup_first_page_op; metadata_to_lsn = 0; + metadata_last_lsn = 0; /* initialize components */ if(innodb_init_param()) { fail: if (log_copying_running) { mysql_mutex_lock(&recv_sys.mutex); - metadata_to_lsn = 1; + metadata_last_lsn = 1; stop_backup_threads(); mysql_mutex_unlock(&recv_sys.mutex); } @@ -5330,9 +5508,8 @@ fail: goto fail; } - if (!log_sys.create()) { - goto fail; - } + log_sys.create(); + /* get current checkpoint_lsn */ { log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -5483,14 +5660,9 @@ fail: xb_data_files_close(); - /* Make sure that the latest checkpoint was included */ - if (metadata_to_lsn > recv_sys.lsn) { - msg("Error: failed to copy enough redo log (" - "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").", - recv_sys.lsn, metadata_to_lsn); - goto fail; - } - + ut_ad(!log_copying_running); + ut_ad(metadata_to_lsn <= recv_sys.lsn); + ut_ad(metadata_last_lsn == recv_sys.lsn); innodb_shutdown(); log_file_op = NULL; undo_space_trunc = NULL; @@ -6683,9 +6855,7 @@ error: } recv_sys.create(); - if (!log_sys.create()) { - goto error; - } + log_sys.create(); recv_sys.recovery_on = true; xb_fil_io_init(); diff --git a/include/my_bit.h b/include/my_bit.h index 8ee8b41c8d4..e86c3ec883f 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -175,6 +175,11 @@ static inline uchar last_byte_mask(uint bits) return (uchar) ((2U << used) - 1); } +static inline uint my_bits_in_bytes(uint n) +{ + return ((n + 7) / 8); +} + #ifdef _MSC_VER #include #endif diff --git a/include/my_cpu.h b/include/my_cpu.h index e536ff285f9..003087dd94d 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -24,6 +24,7 @@ */ #ifdef _ARCH_PWR8 +#ifdef __GLIBC__ #include /* Very low priority */ #define HMT_very_low() __ppc_set_ppr_very_low() @@ -37,6 +38,18 @@ #define HMT_medium_high() __ppc_set_ppr_med_high() /* High priority */ #define HMT_high() asm volatile("or 3,3,3") +#else /* GLIBC */ +#if defined(__FreeBSD__) +#include +#include +#endif +#define HMT_very_low() __asm__ volatile ("or 31,31,31") +#define HMT_low() __asm__ volatile ("or 1,1,1") +#define HMT_medium_low() __asm__ volatile ("or 6,6,6") +#define HMT_medium() __asm__ volatile ("or 2,2,2") +#define HMT_medium_high() __asm__ volatile ("or 5,5,5") +#define HMT_high() asm volatile("or 3,3,3") +#endif /* GLIBC */ #else #define HMT_very_low() #define HMT_low() @@ -81,7 +94,13 @@ static inline void MY_RELAX_CPU(void) __asm__ __volatile__ ("pause"); #endif #elif defined(_ARCH_PWR8) - __ppc_get_timebase(); +#ifdef __FreeBSD__ + uint64_t __tb; + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); +#else + /* Changed from __ppc_get_timebase for musl compatibility */ + __builtin_ppc_get_timebase(); +#endif #elif defined __GNUC__ && (defined __arm__ || defined __aarch64__) /* 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 fa0b8935e68..bbfaf959163 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1063,11 +1063,7 @@ extern int my_win_pclose(FILE*); #endif /* my_getpagesize */ -#ifdef HAVE_GETPAGESIZE -#define my_getpagesize() getpagesize() -#else int my_getpagesize(void); -#endif int my_msync(int, void *, size_t, int); diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index a0d0a338a0e..cf94364c1cf 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -209,7 +209,7 @@ extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd); extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd); /* Return true if thd is in BF mode, either high_priority or TOI */ extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync); -/* Return true if thd is streaming */ +/* Return true if thd is streaming in progress */ extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd); extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd); /* Return thd retry counter */ diff --git a/man/comp_err.1 b/man/comp_err.1 index 6f000869797..5bda07b7ea1 100644 --- a/man/comp_err.1 +++ b/man/comp_err.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBCOMP_ERR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBCOMP_ERR\fR" "1" "4 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -23,7 +23,7 @@ comp_err \- compile MariaDB error message file creates the errmsg\&.sys file that is used by -\fBmysqld\fR +\fBmariadbd\fR to determine the error messages to display for different error codes\&. \fBcomp_err\fR normally is run automatically when MariaDB is built\&. It compiles the @@ -39,7 +39,7 @@ mysqld_ername\&.h, and sql_state\&.h header files\&. .PP -For more information about how error messages are defined, see the MySQL Internals Manual\&. +For more information about how error messages are defined, see the MariaDB Manual\&. .PP Invoke \fBcomp_err\fR @@ -141,7 +141,7 @@ Print some debugging information when the program exits\&. \fB\-H \fR\fB\fIfile_name\fR\fR .sp The name of the error header file\&. The default is -mysqld_error\&.h\&. +mariadbd_error\&.h\&. .RE .sp .RS 4 @@ -247,7 +247,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index 4e03abf1d3c..28708728079 100644 --- a/man/galera_new_cluster.1 +++ b/man/galera_new_cluster.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 18da2fa5fd0..1d93c865b0d 100644 --- a/man/galera_recovery.1 +++ b/man/galera_recovery.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_RECOVERY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBGALERA_RECOVERY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index ae7a5b03523..1046d4a0d74 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBINNOCHECKSUM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBINNOCHECKSUM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -303,7 +303,7 @@ Displays version information and exits\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2023 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-access.1 b/man/mariadb-access.1 index 762c1959584..eb01301a573 100644 --- a/man/mariadb-access.1 +++ b/man/mariadb-access.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ACCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-ACCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlaccess +.\" mariadb-access .SH "NAME" -mariadb-access \- client for checking access privileges (mysqlaccess is now a symlink to mariadb-access) +mariadb-access \- client for checking access privileges (mariadb-access is now a symlink to mariadb-access) .SH "SYNOPSIS" -.HP \w'\fBmysqlaccess\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-access\ [\fR\fB\fIhost_name\fR\fR\fB\ [\fR\fB\fIuser_name\fR\fR\fB\ [\fR\fB\fIdb_name\fR\fR\fB]]]\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-access [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqlaccess\fR +\fBmariadb-access\fR is a diagnostic tool written by Yves Carlier\&. It checks the access privileges for a host name, user name, and database combination\&. Note that -\fBmysqlaccess\fR +\fBmariadb-access\fR checks access using only the user, db, and @@ -33,20 +33,20 @@ procs_priv tables\&. .PP Invoke -\fBmysqlaccess\fR +\fBmariadb-access\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlaccess [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-access [\fR\fB\fIhost_name\fR\fR\fB [\fR\fB\fIuser_name\fR\fR\fB [\fR\fB\fIdb_name\fR\fR\fB]]] [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlaccess\fR +\fBmariadb-access\fR supports the following options\&. .sp .RS 4 @@ -57,8 +57,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: help option -.\" help option: mysqlaccess +.\" mariadb-access: help option +.\" help option: mariadb-access \fB\-\-help\fR, \fB\-?\fR .sp @@ -73,8 +73,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: brief option -.\" brief option: mysqlaccess +.\" mariadb-access: brief option +.\" brief option: mariadb-access \fB\-\-brief\fR, \fB\-b\fR .sp @@ -89,12 +89,12 @@ Generate reports in single\-line tabular format\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: commit option -.\" commit option: mysqlaccess +.\" mariadb-access: commit option +.\" commit option: mariadb-access \fB\-\-commit\fR .sp Copy the new access privileges from the temporary tables to the original grant tables\&. The grant tables must be flushed for the new privileges to take effect\&. (For example, execute a -\fBmysqladmin reload\fR +\fBmariadb-admin reload\fR command\&.) .RE .sp @@ -106,8 +106,8 @@ command\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: copy option -.\" copy option: mysqlaccess +.\" mariadb-access: copy option +.\" copy option: mariadb-access \fB\-\-copy\fR .sp Reload the temporary grant tables from original ones\&. @@ -121,8 +121,8 @@ Reload the temporary grant tables from original ones\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: db option -.\" db option: mysqlaccess +.\" mariadb-access: db option +.\" db option: mariadb-access \fB\-\-db=\fR\fB\fIdb_name\fR\fR, \fB\-d \fR\fB\fIdb_name\fR\fR .sp @@ -137,8 +137,8 @@ Specify the database name\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: debug option -.\" debug option: mysqlaccess +.\" mariadb-access: debug option +.\" debug option: mariadb-access \fB\-\-debug=\fR\fB\fIN\fR\fR .sp Specify the debug level\&. @@ -154,8 +154,8 @@ can be an integer from 0 to 3\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: host option -.\" host option: mysqlaccess +.\" mariadb-access: host option +.\" host option: mariadb-access \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -170,12 +170,12 @@ The host name to use in the access privileges\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: howto option -.\" howto option: mysqlaccess +.\" mariadb-access: howto option +.\" howto option: mariadb-access \fB\-\-howto\fR .sp Display some examples that show how to use -\fBmysqlaccess\fR\&. +\fBmariadb-access\fR\&. .RE .sp .RS 4 @@ -186,8 +186,8 @@ Display some examples that show how to use .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: old_server option -.\" old_server option: mysqlaccess +.\" mariadb-access: old_server option +.\" old_server option: mariadb-access \fB\-\-old_server\fR .sp Connect to a very old MySQL server (before MySQL 3\&.21) that does not know how to handle full @@ -202,8 +202,8 @@ WHERE clauses\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: password option -.\" password option: mysqlaccess +.\" mariadb-access: password option +.\" password option: mariadb-access \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -214,7 +214,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlaccess\fR +\fBmariadb-access\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. See @@ -229,8 +229,8 @@ Section\ \&5.3.2.2, \(lqEnd-User Guidelines for Password Security\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: plan option -.\" plan option: mysqlaccess +.\" mariadb-access: plan option +.\" plan option: mariadb-access \fB\-\-plan\fR .sp Display suggestions and ideas for future releases\&. @@ -244,8 +244,8 @@ Display suggestions and ideas for future releases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: preview option -.\" preview option: mysqlaccess +.\" mariadb-access: preview option +.\" preview option: mariadb-access \fB\-\-preview\fR .sp Show the privilege differences after making changes to the temporary grant tables\&. @@ -259,8 +259,8 @@ Show the privilege differences after making changes to the temporary grant table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: relnotes option -.\" relnotes option: mysqlaccess +.\" mariadb-access: relnotes option +.\" relnotes option: mariadb-access \fB\-\-relnotes\fR .sp Display the release notes\&. @@ -274,8 +274,8 @@ Display the release notes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: rhost option -.\" rhost option: mysqlaccess +.\" mariadb-access: rhost option +.\" rhost option: mariadb-access \fB\-\-rhost=\fR\fB\fIhost_name\fR\fR, \fB\-H \fR\fB\fIhost_name\fR\fR .sp @@ -290,8 +290,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: rollback option -.\" rollback option: mysqlaccess +.\" mariadb-access: rollback option +.\" rollback option: mariadb-access \fB\-\-rollback\fR .sp Undo the most recent changes to the temporary grant tables\&. @@ -305,8 +305,8 @@ Undo the most recent changes to the temporary grant tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: spassword option -.\" spassword option: mysqlaccess +.\" mariadb-access: spassword option +.\" spassword option: mariadb-access \fB\-\-spassword[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-P[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -317,7 +317,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlaccess\fR +\fBmariadb-access\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. See @@ -332,8 +332,8 @@ Section\ \&5.3.2.2, \(lqEnd-User Guidelines for Password Security\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: superuser option -.\" superuser option: mysqlaccess +.\" mariadb-access: superuser option +.\" superuser option: mariadb-access \fB\-\-superuser=\fR\fB\fIuser_name\fR\fR, \fB\-U \fR\fB\fIuser_name\fR\fR .sp @@ -348,8 +348,8 @@ Specify the user name for connecting as the superuser\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: table option -.\" table option: mysqlaccess +.\" mariadb-access: table option +.\" table option: mariadb-access \fB\-\-table\fR, \fB\-t\fR .sp @@ -364,8 +364,8 @@ Generate reports in table format\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: user option -.\" user option: mysqlaccess +.\" mariadb-access: user option +.\" user option: mariadb-access \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -380,8 +380,8 @@ The user name to use in the access privileges\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlaccess: version option -.\" version option: mysqlaccess +.\" mariadb-access: version option +.\" version option: mariadb-access \fB\-\-version\fR, \fB\-v\fR .sp @@ -389,33 +389,33 @@ Display version information and exit\&. .RE .PP If your MariaDB distribution is installed in some non\-standard location, you must change the location where -\fBmysqlaccess\fR +\fBmariadb-access\fR expects to find the -\fBmysql\fR +\fBmariadb\fR client\&. Edit the -mysqlaccess +mariadb-access script at approximately line 18\&. Search for a line that looks like this: .sp .if n \{\ .RS 4 .\} .nf -$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable +$MYSQL = '/usr/local/bin/mariadb'; # path to mariadb executable .fi .if n \{\ .RE .\} .PP Change the path to reflect the location where -\fBmysql\fR +\fBmariadb\fR actually is stored on your system\&. If you do not do this, a Broken pipe error will occur when you run -\fBmysqlaccess\fR\&. +\fBmariadb-access\fR\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-admin.1 b/man/mariadb-admin.1 index 85dab8d2682..db970e1a0cd 100644 --- a/man/mariadb-admin.1 +++ b/man/mariadb-admin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ADMIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-ADMIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqladmin +.\" mariadb-admin .\" administration: server .\" server administration .SH "NAME" -mariadb-admin \- client for administering a MariaDB server (mysqladmin is now a symlink to mariadb-admin) +mariadb-admin \- client for administering a MariaDB server (mariadb-admin is now a symlink to mariadb-admin) .SH "SYNOPSIS" -.HP \w'\fBmysqladmin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u -\fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR +.HP \w'\fBmariadb-admin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]\ [\fR\fB\fIcommand\fR\fR\fB\ [\fR\fB\fIcommand\-arg\fR\fR\fB]]\ \&.\&.\&.\fR\ 'u +\fBmariadb-admin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR .SH "DESCRIPTION" .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR is a client for performing administrative operations\&. You can use it to check the server's configuration and current status, to create and drop databases, and more\&. .PP Invoke -\fBmysqladmin\fR +\fBmariadb-admin\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqladmin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR +shell> \fBmariadb-admin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB] [\fR\fB\fIcommand\fR\fR\fB [\fR\fB\fIcommand\-arg\fR\fR\fB]] \&.\&.\&.\fR .fi .if n \{\ .RE .\} .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR supports the following commands\&. Some of the commands take an argument following the command name\&. .sp .RS 4 @@ -387,9 +387,9 @@ password \fInew\-password\fR Set a new password\&. This changes the password to \fInew\-password\fR for the account that you use with -\fBmysqladmin\fR +\fBmariadb-admin\fR for connecting to the server\&. Thus, the next time you invoke -\fBmysqladmin\fR +\fBmariadb-admin\fR (or any other client program) using the same account, you will need to specify the new password\&. .sp If the @@ -400,7 +400,7 @@ value contains spaces or other characters that are special to your command inter .RS 4 .\} .nf -shell> \fBmysqladmin password "my new password"\fR +shell> \fBmariadb-admin password "my new password"\fR .fi .if n \{\ .RE @@ -424,9 +424,9 @@ password command with flush\-privileges on the same command line to re\-enable the grant tables because the flush operation occurs after you connect\&. However, you can use -\fBmysqladmin flush\-privileges\fR +\fBmariadb-admin flush\-privileges\fR to re\-enable the grant table and then use a separate -\fBmysqladmin password\fR +\fBmariadb-admin password\fR command to change the password\&. .sp .5v .RE @@ -443,7 +443,7 @@ command to change the password\&. ping .sp Check whether the server is alive\&. The return status from -\fBmysqladmin\fR +\fBmariadb-admin\fR is 0 if the server is running, 1 if it is not\&. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running\&. .RE @@ -602,7 +602,7 @@ All commands can be shortened to any unique prefix\&. For example: .RS 4 .\} .nf -shell> \fBmysqladmin proc stat\fR +shell> \fBmariadb-admin proc stat\fR +\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | Id | User | Host | db | Command | Time | State | Info | +\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -619,7 +619,7 @@ Open tables: 19 Queries per second avg: 0\&.0268 .\" status command: results .PP The -\fBmysqladmin status\fR +\fBmariadb-admin status\fR command result displays the following values: .sp .RS 4 @@ -739,7 +739,7 @@ The number of tables that currently are open\&. Memory in use .sp The amount of memory allocated directly by -\fBmysqld\fR\&. This value is displayed only when MariaDB has been compiled with +\fBmariadbd\fR\&. This value is displayed only when MariaDB has been compiled with \fB\-\-with\-debug=full\fR\&. .RE .sp @@ -755,23 +755,23 @@ The amount of memory allocated directly by Maximum memory used .sp The maximum amount of memory allocated directly by -\fBmysqld\fR\&. This value is displayed only when MariaDB has been compiled with +\fBmariadbd\fR\&. This value is displayed only when MariaDB has been compiled with \fB\-\-with\-debug=full\fR\&. .RE .PP If you execute -\fBmysqladmin shutdown\fR +\fBmariadb-admin shutdown\fR when connecting to a local server using a Unix socket file, -\fBmysqladmin\fR +\fBmariadb-admin\fR waits until the server's process ID file has been removed, to ensure that the server has stopped properly\&. -.\" mysqladmin command options -.\" command options: mysqladmin -.\" options: command-line: mysqladmin -.\" startup parameters: mysqladmin +.\" mariadb-admin command options +.\" command options: mariadb-admin +.\" options: command-line: mariadb-admin +.\" startup parameters: mariadb-admin .PP -\fBmysqladmin\fR +\fBmariadb-admin\fR supports the following options, which can be specified on the command line or in the -[mysqladmin] +[mariadb-admin] and [client] option file groups\&. @@ -784,8 +784,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: help option -.\" help option: mysqladmin +.\" mariadb-admin: help option +.\" help option: mariadb-admin \fB\-\-help\fR, \fB\-?\fR .sp @@ -800,8 +800,8 @@ Display help and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: character-sets-dir option -.\" character-sets-dir option: mysqladmin +.\" mariadb-admin: character-sets-dir option +.\" character-sets-dir option: mariadb-admin \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -815,8 +815,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: compress option -.\" compress option: mysqladmin +.\" mariadb-admin: compress option +.\" compress option: mariadb-admin \fB\-\-compress\fR, \fB\-C\fR .sp @@ -831,8 +831,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: connect-timeout option -.\" connect-timeout option: mysqladmin +.\" mariadb-admin: connect-timeout option +.\" connect-timeout option: mariadb-admin \fB\-\-connect-timeout=\fR\fB\fItimeout\fR\fR .sp Equivalent to \fB\-\-connect_timeout\fR, see the end of this section\&. @@ -846,8 +846,8 @@ Equivalent to \fB\-\-connect_timeout\fR, see the end of this section\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: count option -.\" count option: mysqladmin +.\" mariadb-admin: count option +.\" count option: mariadb-admin \fB\-\-count=\fR\fB\fIN\fR\fR, \fB\-c \fR\fB\fIN\fR\fR .sp @@ -864,14 +864,14 @@ option is given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug option -.\" debug option: mysqladmin +.\" mariadb-admin: debug option +.\" debug option: mariadb-admin \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqladmin.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-admin.trace'. .RE .sp .RS 4 @@ -882,8 +882,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqladmin.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug-check option -.\" debug-check option: mysqladmin +.\" mariadb-admin: debug-check option +.\" debug-check option: mariadb-admin \fB\-\-debug\-check\fR .sp Check memory and open file usage at exit.\&. @@ -897,8 +897,8 @@ Check memory and open file usage at exit.\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: debug-info option -.\" debug-info option: mysqladmin +.\" mariadb-admin: debug-info option +.\" debug-info option: mariadb-admin \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -912,8 +912,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: default-auth option -.\" default-auth option: mysqladmin +.\" mariadb-admin: default-auth option +.\" default-auth option: mariadb-admin \fB\-\-default\-auth\fR .sp Default authentication client-side plugin to use\&. @@ -927,8 +927,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: default-character-set option -.\" default-character-set option: mysqladmin +.\" mariadb-admin: default-character-set option +.\" default-character-set option: mariadb-admin \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -944,8 +944,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: defaults-extra-file option -.\" defaults-extra-file option: mysqladmin +.\" mariadb-admin: defaults-extra-file option +.\" defaults-extra-file option: mariadb-admin \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -960,8 +960,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: defaults-file option -.\" defaults-file option: mysqladmin +.\" mariadb-admin: defaults-file option +.\" defaults-file option: mariadb-admin \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. Must be given as first option\&. @@ -975,8 +975,8 @@ Set \fB\fIfilename\fR\fR as the file to read default options from, override glob .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: force option -.\" force option: mysqladmin +.\" mariadb-admin: force option +.\" force option: mariadb-admin \fB\-\-force\fR, \fB\-f\fR .sp @@ -993,8 +993,8 @@ command\&. With multiple commands, continue even if an error occurs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: host option -.\" host option: mysqladmin +.\" mariadb-admin: host option +.\" host option: mariadb-admin \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -1009,8 +1009,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: local option -.\" local option: mysqladmin +.\" mariadb-admin: local option +.\" local option: mariadb-admin \fB\-\-local\fR, \fB\-l\fR .sp @@ -1021,8 +1021,8 @@ Suppress the SQL command(s) from being written to the binary log by using FLUSH .ie n \{\ \h'-04'\(bu\h'+03'\c .\} -.\" mysqladmin: no-beep option -.\" no-beep option: mysqladmin +.\" mariadb-admin: no-beep option +.\" no-beep option: mariadb-admin \fB\-\-no\-beep\fR, \fB\-b\fR .sp @@ -1037,8 +1037,8 @@ Suppress the warning beep that is emitted by default for errors such as a failur .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: no-defaults option -.\" no-defaults option: mysqladmin +.\" mariadb-admin: no-defaults option +.\" no-defaults option: mariadb-admin \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -1052,8 +1052,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: password option -.\" password option: mysqladmin +.\" mariadb-admin: password option +.\" password option: mariadb-admin \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -1066,7 +1066,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqladmin\fR +\fBmariadb-admin\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. @@ -1080,8 +1080,8 @@ Specifying a password on the command line should be considered insecure\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: pipe option -.\" pipe option: mysqladmin +.\" mariadb-admin: pipe option +.\" pipe option: mariadb-admin \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -1096,8 +1096,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: port option -.\" port option: mysqladmin +.\" mariadb-admin: port option +.\" port option: mariadb-admin \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -1114,8 +1114,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: print-defaults option -.\" print-defaults option: mysqladmin +.\" mariadb-admin: print-defaults option +.\" print-defaults option: mariadb-admin \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -1129,8 +1129,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: protocol option -.\" protocol option: mysqladmin +.\" mariadb-admin: protocol option +.\" protocol option: mariadb-admin \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -1144,8 +1144,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: relative option -.\" relative option: mysqladmin +.\" mariadb-admin: relative option +.\" relative option: mariadb-admin \fB\-\-relative\fR, \fB\-r\fR .sp @@ -1164,8 +1164,8 @@ command\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: shutdown-timeout option -.\" shutdown-timeout option: mysqladmin +.\" mariadb-admin: shutdown-timeout option +.\" shutdown-timeout option: mariadb-admin \fB\-\-shutdown\-timeout\fR\fB\fItimeout\fR\fR .sp Equivalent of \fB\-\-shutdown_timeout\fR, see the end of this section\&. @@ -1179,8 +1179,8 @@ Equivalent of \fB\-\-shutdown_timeout\fR, see the end of this section\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: silent option -.\" silent option: mysqladmin +.\" mariadb-admin: silent option +.\" silent option: mariadb-admin \fB\-\-silent\fR, \fB\-s\fR .sp @@ -1195,8 +1195,8 @@ Exit silently if a connection to the server cannot be established\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: sleep option -.\" sleep option: mysqladmin +.\" mariadb-admin: sleep option +.\" sleep option: mariadb-admin \fB\-\-sleep=\fR\fB\fIdelay\fR\fR, \fB\-i \fR\fB\fIdelay\fR\fR .sp @@ -1207,7 +1207,7 @@ seconds in between\&. The option determines the number of iterations\&. If \fB\-\-count\fR is not given, -\fBmysqladmin\fR +\fBmariadb-admin\fR executes commands indefinitely until interrupted\&. .RE .sp @@ -1219,8 +1219,8 @@ executes commands indefinitely until interrupted\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: socket option -.\" socket option: mysqladmin +.\" mariadb-admin: socket option +.\" socket option: mariadb-admin \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -1237,8 +1237,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-admin: SSL options +.\" SSL options: mariadb-admin \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -1253,8 +1253,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-admin: SSL CA option +.\" SSL CA option: mariadb-admin \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -1269,8 +1269,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-admin: SSL CA Path option +.\" SSL CA Path option: mariadb-admin \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1285,8 +1285,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-admin: SSL Cert option +.\" SSL Cert option: mariadb-admin \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1301,8 +1301,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-admin: SSL Cipher option +.\" SSL Cipher option: mariadb-admin \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1317,8 +1317,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-admin: SSL Key option +.\" SSL Key option: mariadb-admin \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1333,8 +1333,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-admin: SSL Crl option +.\" SSL CRL option: mariadb-admin \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1349,8 +1349,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-admin: SSL Crlpath option +.\" SSL Crlpath option: mariadb-admin \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1365,8 +1365,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-admin: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-admin \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1380,8 +1380,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: TLS Version option -.\" TLS Version option: mysqladmin +.\" mariadb-admin: TLS Version option +.\" TLS Version option: mariadb-admin \fB\-\-tls\-version=\fR\fB\fIname\fR\fR, .sp Accepts a comma-separated list of TLS protocol versions\&. A TLS protocol version will only be enabled if it @@ -1396,8 +1396,8 @@ is present in this list\&. All other TLS protocol versions will not be permitted .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: user option -.\" user option: mysqladmin +.\" mariadb-admin: user option +.\" user option: mariadb-admin \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1412,8 +1412,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: verbose option -.\" verbose option: mysqladmin +.\" mariadb-admin: verbose option +.\" verbose option: mariadb-admin \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1428,8 +1428,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: version option -.\" version option: mysqladmin +.\" mariadb-admin: version option +.\" version option: mariadb-admin \fB\-\-version\fR, \fB\-V\fR .sp @@ -1444,8 +1444,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: vertical option -.\" vertical option: mysqladmin +.\" mariadb-admin: vertical option +.\" vertical option: mariadb-admin \fB\-\-vertical\fR, \fB\-E\fR .sp @@ -1461,8 +1461,8 @@ Print output vertically\&. This is similar to .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: wait option -.\" wait option: mysqladmin +.\" mariadb-admin: wait option +.\" wait option: mariadb-admin \fB\-\-wait[=\fR\fB\fIcount\fR\fR\fB]\fR, \fB\-w[\fR\fB\fIcount\fR\fR\fB]\fR .sp @@ -1479,8 +1479,8 @@ value is given, it indicates the number of times to retry\&. The default is one .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: --wait-for-all-slaves option -.\" --wait-for-all-slaves option: mysqladmin +.\" mariadb-admin: --wait-for-all-slaves option +.\" --wait-for-all-slaves option: mariadb-admin \fB\-\-wait\-for\-all\-slaves\fR .sp Wait for the last binlog event to be sent to all connected slaves before shutting down\&. @@ -1522,7 +1522,7 @@ The maximum number of seconds to wait for server shutdown\&. The default value i .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-backup.1 b/man/mariadb-backup.1 index 705234fe67b..fc7c4d6552a 100644 --- a/man/mariadb-backup.1 +++ b/man/mariadb-backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-binlog.1 b/man/mariadb-binlog.1 index 7103fa22f2b..ba03372f046 100644 --- a/man/mariadb-binlog.1 +++ b/man/mariadb-binlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-BINLOG\fR" "1" "14 April 2021" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-BINLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,31 +11,31 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlbinlog +.\" mariadb-binlog .SH "NAME" -mariadb-binlog \- utility for processing binary log files (mysqlbinlog is now a symlink to mariadb-binlog) +mariadb-binlog \- utility for processing binary log files (mariadb-binlog is now a symlink to mariadb-binlog) .SH "SYNOPSIS" -.HP \w'\fBmysqlbinlog\ [\fR\fBoptions\fR\fB]\ \fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u -\fBmysqlbinlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR +.HP \w'\fBmariadb-binlog\ [\fR\fBoptions\fR\fB]\ \fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.\fR\ 'u +\fBmariadb-binlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP The server's binary log consists of files containing \(lqevents\(rq that describe modifications to database contents\&. The server writes these files in binary format\&. To display their contents in text format, use the -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR utility\&. You can also use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to display the contents of relay log files written by a slave server in a replication setup because relay logs have the same format as binary logs\&. .PP Invoke -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-binlog [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR .fi .if n \{\ .RE @@ -48,7 +48,7 @@ binlog\&.000003, use this command: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.0000003\fR +shell> \fBmariadb-binlog binlog\&.0000003\fR .fi .if n \{\ .RE @@ -90,12 +90,12 @@ error_code indicates the result from executing the event\&. Zero means that no error occurred\&. .PP The output from -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR can be re\-executed (for example, by using it as input to -\fBmysql\fR) to redo the statements in the log\&. This is useful for recovery operations after a server crash\&. For other usage examples, see the discussion later in this section\&. +\fBmariadb\fR) to redo the statements in the log\&. This is useful for recovery operations after a server crash\&. For other usage examples, see the discussion later in this section\&. .PP Normally, you use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to read binary log files directly and apply them to the local MariaDB server\&. It is also possible to read binary logs from a remote server by using the \fB\-\-read\-from\-remote\-server\fR option\&. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server\&. These options are @@ -108,9 +108,9 @@ option\&. To read remote binary logs, the connection parameter options can be gi \fB\-\-read\-from\-remote\-server\fR option\&. .PP -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR supports the following options, which can be specified on the command line or in the -[mysqlbinlog] +[mariadb-binlog] and [client] option file groups\&. @@ -123,8 +123,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: help option -.\" help option: mysqlbinlog +.\" mariadb-binlog: help option +.\" help option: mariadb-binlog \fB\-\-help\fR, \fB\-?\fR .sp @@ -139,8 +139,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: base64-output option -.\" base64-output option: mysqlbinlog +.\" mariadb-binlog: base64-output option +.\" base64-output option: mariadb-binlog \fB\-\-base64\-output=\fR\fB\fIvalue\fR\fR\fB\fR .sp This option determines when events should be displayed encoded as base\-64 strings using @@ -178,7 +178,7 @@ option is given\&. Automatic BINLOG display is the only safe behavior if you intend to use the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to re\-execute binary log file contents\&. The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form\&. .sp .5v .RE @@ -196,7 +196,7 @@ NEVER causes BINLOG statements not to be displayed\&. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR exits with an error if a row event is found that must be displayed using BINLOG\&. .RE @@ -211,7 +211,7 @@ BINLOG\&. .\} DECODE\-ROWS specifies to -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR that you intend for row events to be decoded and displayed as commented SQL statements by also specifying the \fB\-\-verbose\fR option\&. Like @@ -239,7 +239,7 @@ For examples that show the effect of and \fB\-\-verbose\fR on row event output, see -the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. +the section called \(lqMARIADB-BINLOG ROW EVENT DISPLAY\(rq\&. .RE .RE .sp @@ -251,8 +251,8 @@ the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: binlog-row-event-max-size option -.\" binlog-row-event-max-size option: mysqlbinlog +.\" mariadb-binlog: binlog-row-event-max-size option +.\" binlog-row-event-max-size option: mariadb-binlog \fB\-\-binlog\-row\-event\-max\-size\=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -266,8 +266,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: character-sets-dir option -.\" character-sets-dir option: mysqlbinlog +.\" mariadb-binlog: character-sets-dir option +.\" character-sets-dir option: mariadb-binlog \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -281,13 +281,13 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: database option -.\" database option: mysqlbinlog +.\" mariadb-binlog: database option +.\" database option: mariadb-binlog \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-d \fR\fB\fIdb_name\fR\fR .sp This option causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to output entries from the binary log (local log only) that occur while \fIdb_name\fR has been selected as the default database by @@ -296,11 +296,11 @@ USE\&. The \fB\-\-database\fR option for -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR is similar to the \fB\-\-binlog\-do\-db\fR option for -\fBmysqld\fR, but can be used to specify only one database\&. If +\fBmariadbd\fR, but can be used to specify only one database\&. If \fB\-\-database\fR is given multiple times, only the last instance is used\&. .sp @@ -378,7 +378,7 @@ INSERT INTO t2 (j) VALUES(203); .RE .\} .sp -\fBmysqlbinlog \-\-database=test\fR +\fBmariadb-binlog \-\-database=test\fR does not output the first two INSERT statements because there is no default database\&. It outputs the three @@ -389,7 +389,7 @@ INSERT statements following USE db2\&. .sp -\fBmysqlbinlog \-\-database=db2\fR +\fBmariadb-binlog \-\-database=db2\fR does not output the first two INSERT statements because there is no default database\&. It does not output the three @@ -401,10 +401,10 @@ statements following USE db2\&. .PP \fBRow-based logging\fR. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR outputs only entries that change tables belonging to \fIdb_name\fR\&. The default database has no effect on this\&. Suppose that the binary log just described was created using row\-based logging rather than statement\-based logging\&. -\fBmysqlbinlog \-\-database=test\fR +\fBmariadb-binlog \-\-database=test\fR outputs only those entries that modify t1 in the test database, regardless of whether @@ -415,7 +415,7 @@ binlog_format set to MIXED and you want it to be possible to use -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with the \fB\-\-database\fR option, you must ensure that tables that are modified are in the database selected by @@ -433,7 +433,7 @@ USE\&. (In particular, no cross\-database updates should be used\&.) .ps -1 .br This option did not work correctly for -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with row\-based logging prior to MySQL 5\&.1\&.37\&. .sp .5v .RE @@ -448,14 +448,14 @@ with row\-based logging prior to MySQL 5\&.1\&.37\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug option -.\" debug option: mysqlbinlog +.\" mariadb-binlog: debug option +.\" debug option: mariadb-binlog \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlbinlog.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-binlog.trace'. .RE .sp .RS 4 @@ -466,8 +466,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlbinlog.trace' .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug-check option -.\" debug-check option: mysqlbinlog +.\" mariadb-binlog: debug-check option +.\" debug-check option: mariadb-binlog \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -481,8 +481,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: debug-info option -.\" debug-info option: mysqlbinlog +.\" mariadb-binlog: debug-info option +.\" debug-info option: mariadb-binlog \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -496,8 +496,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: defaults-extra-file option -.\" defaults-extra-file option: mysqlbinlog +.\" mariadb-binlog: defaults-extra-file option +.\" defaults-extra-file option: mariadb-binlog \fB\-\-defaults\-extra\-file=\fR\fB\fIname\fR .sp Read this file after the global files are read\&. @@ -511,8 +511,8 @@ Read this file after the global files are read\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: defaults-file option -.\" defaults-file option: mysqlbinlog +.\" mariadb-binlog: defaults-file option +.\" defaults-file option: mariadb-binlog \fB\-\-defaults\-file=\fR\fB\fIname\fR .sp Only read default options from the given file\&. @@ -526,8 +526,8 @@ Only read default options from the given file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: default-auth option -.\" default-auth option: mysqlbinlog +.\" mariadb-binlog: default-auth option +.\" default-auth option: mariadb-binlog \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -541,8 +541,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: disable-log-bin option -.\" disable-log-bin option: mysqlbinlog +.\" mariadb-binlog: disable-log-bin option +.\" disable-log-bin option: mariadb-binlog \fB\-\-disable\-log\-bin\fR, \fB\-D\fR .sp @@ -553,7 +553,7 @@ option and are sending the output to the same MariaDB server\&. This option also This option requires that you have the SUPER privilege\&. It causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to include a SET sql_log_bin = 0 statement in its output to disable binary logging of the remaining output\&. The @@ -571,8 +571,8 @@ privilege\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: flashback option -.\" flashback option: mysqlbinlog +.\" mariadb-binlog: flashback option +.\" flashback option: mariadb-binlog \fB\-\-flashback\fR, \fB\-B\fR .sp @@ -587,8 +587,8 @@ Support flashback mode\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: force-if-open option -.\" force-if-open option: mysqlbinlog +.\" mariadb-binlog: force-if-open option +.\" force-if-open option: mariadb-binlog \fB\-\-force\-if\-open\fR .sp Force if binlog was not closed properly. Defaults to on; use \fB--skip-force-if-open\fR to disable\&. @@ -602,15 +602,15 @@ Force if binlog was not closed properly. Defaults to on; use \fB--skip-force-if- .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: force-read option -.\" force-read option: mysqlbinlog +.\" mariadb-binlog: force-read option +.\" force-read option: mariadb-binlog \fB\-\-force\-read\fR, \fB\-f\fR .sp With this option, if -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues\&. Without this option, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR stops if it reads such an event\&. .RE .sp @@ -622,13 +622,13 @@ stops if it reads such an event\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: hexdump option -.\" hexdump option: mysqlbinlog +.\" mariadb-binlog: hexdump option +.\" hexdump option: mariadb-binlog \fB\-\-hexdump\fR, \fB\-H\fR .sp Display a hex dump of the log in comments, as described in -the section called \(lqMYSQLBINLOG HEX DUMP FORMAT\(rq\&. The hex output can be helpful for replication debugging\&. +the section called \(lqMARIADB-BINLOG HEX DUMP FORMAT\(rq\&. The hex output can be helpful for replication debugging\&. .RE .sp .RS 4 @@ -639,8 +639,8 @@ the section called \(lqMYSQLBINLOG HEX DUMP FORMAT\(rq\&. The hex output can be .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: host option -.\" host option: mysqlbinlog +.\" mariadb-binlog: host option +.\" host option: mariadb-binlog \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -655,8 +655,8 @@ Get the binary log from the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: local-load option -.\" local-load option: mysqlbinlog +.\" mariadb-binlog: local-load option +.\" local-load option: mariadb-binlog \fB\-\-local\-load=\fR\fB\fIpath\fR\fR, \fB\-l \fR\fB\fIpath\fR\fR .sp @@ -673,8 +673,8 @@ in the specified directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: no-defaults option -.\" no-defaults option: mysqlbinlog +.\" mariadb-binlog: no-defaults option +.\" no-defaults option: mariadb-binlog \fB\-\-no\-defaults\fR .sp Don't read default options from any option file\&. @@ -688,8 +688,8 @@ Don't read default options from any option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: offset option -.\" offset option: mysqlbinlog +.\" mariadb-binlog: offset option +.\" offset option: mariadb-binlog \fB\-\-offset=\fR\fB\fIN\fR\fR, \fB\-o \fR\fB\fIN\fR\fR .sp @@ -706,12 +706,12 @@ entries in the log\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: open-files-limit option -.\" open-files-limit option: mysqlbinlog +.\" mariadb-binlog: open-files-limit option +.\" open-files-limit option: mariadb-binlog \fB\-\-open\-files\-limit=\fR\fB\fINUM\fR\fR .sp Sets the open_files_limit variable, which is used to reserve file descriptors for -\fBmysqlbinlog\fR\&. +\fBmariadb-binlog\fR\&. .RE .sp .RS 4 @@ -722,8 +722,8 @@ Sets the open_files_limit variable, which is used to reserve file descriptors fo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: password option -.\" password option: mysqlbinlog +.\" mariadb-binlog: password option +.\" password option: mariadb-binlog \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -736,7 +736,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You @@ -751,8 +751,8 @@ can use an option file to avoid giving the password on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: plugin-dir option -.\" plugin-dir option: mysqlbinlog +.\" mariadb-binlog: plugin-dir option +.\" plugin-dir option: mariadb-binlog \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -766,8 +766,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: print-defaults option -.\" print-defaults option: mysqlbinlog +.\" mariadb-binlog: print-defaults option +.\" print-defaults option: mariadb-binlog \fB\-\-print\-defaults\fR .sp Print the program argument list from all option files and exit\&. @@ -781,8 +781,8 @@ Print the program argument list from all option files and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: port option -.\" port option: mysqlbinlog +.\" mariadb-binlog: port option +.\" port option: mariadb-binlog \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -800,8 +800,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: protocol option -.\" protocol option: mysqlbinlog +.\" mariadb-binlog: protocol option +.\" protocol option: mariadb-binlog \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -815,8 +815,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: raw option -.\" raw option: mysqlbinlog +.\" mariadb-binlog: raw option +.\" raw option: mariadb-binlog \fB\-\-raw\fR .sp Requires \fB-R\fR\&. Output raw binlog data instead of SQL statements\&. Output files named after server logs\&. @@ -830,8 +830,8 @@ Requires \fB-R\fR\&. Output raw binlog data instead of SQL statements\&. Output .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: read-from-remote-server option -.\" read-from-remote-server option: mysqlbinlog +.\" mariadb-binlog: read-from-remote-server option +.\" read-from-remote-server option: mariadb-binlog \fB\-\-read\-from\-remote\-server\fR, \fB\-R\fR .sp @@ -854,8 +854,8 @@ This option requires that the remote server be running\&. It works only for bina .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: result-file option -.\" result-file option: mysqlbinlog +.\" mariadb-binlog: result-file option +.\" result-file option: mariadb-binlog \fB\-\-result\-file=\fR\fB\fIname\fR\fR, \fB\-r \fR\fB\fIname\fR\fR .sp @@ -870,8 +870,8 @@ Direct output to the given file\&. With --raw this is a prefix for the file name .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: rewrite-db option -.\" rewrite-db option: mysqlbinlog +.\" mariadb-binlog: rewrite-db option +.\" rewrite-db option: mariadb-binlog \fB\-\-rewrite\-db=\fR\fB\fIname\fR\fR, \fB\-r \fR\fB\fIname\fR\fR .sp @@ -896,8 +896,8 @@ quote the value (e.g. \fB--rewrite-db="oldname->newname"\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: server-id option -.\" server-id option: mysqlbinlog +.\" mariadb-binlog: server-id option +.\" server-id option: mariadb-binlog \fB\-\-server\-id=\fR\fB\fIid\fR\fR .sp Display only those events created by the server having the given server ID\&. @@ -911,8 +911,8 @@ Display only those events created by the server having the given server ID\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: set-charset option -.\" set-charset option: mysqlbinlog +.\" mariadb-binlog: set-charset option +.\" set-charset option: mariadb-binlog \fB\-\-set\-charset=\fR\fB\fIcharset_name\fR\fR .sp Add a @@ -928,8 +928,8 @@ statement to the output to specify the character set to be used for processing l .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: short-form option -.\" short-form option: mysqlbinlog +.\" mariadb-binlog: short-form option +.\" short-form option: mariadb-binlog \fB\-\-short\-form\fR, \fB\-s\fR .sp @@ -947,8 +947,8 @@ base64-output, consider using \fB--base64-output=never\fR instead\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: socket option -.\" socket option: mysqlbinlog +.\" mariadb-binlog: socket option +.\" socket option: mariadb-binlog \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -965,8 +965,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: start-datetime option -.\" start-datetime option: mysqlbinlog +.\" mariadb-binlog: start-datetime option +.\" start-datetime option: mariadb-binlog \fB\-\-start\-datetime=\fR\fB\fIdatetime\fR\fR .sp Start reading the binary log at the first event having a timestamp equal to or later than the @@ -974,7 +974,7 @@ Start reading the binary log at the first event having a timestamp equal to or l argument\&. The \fIdatetime\fR value is relative to the local time zone on the machine where you run -\fBmysqlbinlog\fR\&. The value should be in a format accepted for the +\fBmariadb-binlog\fR\&. The value should be in a format accepted for the DATETIME or TIMESTAMP @@ -984,7 +984,7 @@ data types\&. For example: .RS 4 .\} .nf -shell> \fBmysqlbinlog \-\-start\-datetime="2014\-12\-25 11:25:56" binlog\&.000003\fR +shell> \fBmariadb-binlog \-\-start\-datetime="2014\-12\-25 11:25:56" binlog\&.000003\fR .fi .if n \{\ .RE @@ -1001,8 +1001,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: start-position option -.\" start-position option: mysqlbinlog +.\" mariadb-binlog: start-position option +.\" start-position option: mariadb-binlog \fB\-\-start\-position=\fR\fB\fIN\fR\fR, \fB\-j \fR\fB\fIN\fR\fR .sp @@ -1027,8 +1027,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: gtid-strict-mode -.\" gtid-strict-mode option: mysqlbinlog +.\" mariadb-binlog: gtid-strict-mode +.\" gtid-strict-mode option: mariadb-binlog \fB\-\-gtid\-strict\-mode .sp Process binlog according to gtid-strict-mode specification\&. The start, stop @@ -1044,8 +1044,8 @@ numbers of any gtid domain must comprise monotically growing sequence\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-datetime option -.\" stop-datetime option: mysqlbinlog +.\" mariadb-binlog: stop-datetime option +.\" stop-datetime option: mariadb-binlog \fB\-\-stop\-datetime=\fR\fB\fIdatetime\fR\fR .sp Stop reading the binary log at the first event having a timestamp equal to or later than the @@ -1067,8 +1067,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-never option -.\" stop-never option: mysqlbinlog +.\" mariadb-binlog: stop-never option +.\" stop-never option: mariadb-binlog \fB\-\-stop\-never\fR .sp Wait for more data from the server instead of stopping at the end of the last log\&. Implies \fB--to-last-log\fR\&. @@ -1082,8 +1082,8 @@ Wait for more data from the server instead of stopping at the end of the last lo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-never-slave-server-id option -.\" stop-never-slave-server-id option: mysqlbinlog +.\" mariadb-binlog: stop-never-slave-server-id option +.\" stop-never-slave-server-id option: mariadb-binlog \fB\-\-stop\-never-slave-server-id\fR .sp The slave server_id used for \fB--read-from-remote-server --stop-never\fR\&. @@ -1097,8 +1097,8 @@ The slave server_id used for \fB--read-from-remote-server --stop-never\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: stop-position option -.\" stop-position option: mysqlbinlog +.\" mariadb-binlog: stop-position option +.\" stop-position option: mariadb-binlog \fB\-\-stop\-position=\fR\fB\fIN\fR\fR .sp Stop reading the binary log at the first event having a position equal to or @@ -1120,8 +1120,8 @@ This option is useful for point\-in\-time recovery\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: table option -.\" table option: mysqlbinlog +.\" mariadb-binlog: table option +.\" table option: mariadb-binlog \fB\-\-table\fR, \fB\-T\fR .sp @@ -1137,8 +1137,8 @@ List entries for just this table (local log only)\&. .IP \(bu 2.3 .\} -.\" mysqlbinlog: to-last-log option -.\" to-last-log option: mysqlbinlog +.\" mariadb-binlog: to-last-log option +.\" to-last-log option: mariadb-binlog \fB\-\-to\-last\-log\fR, \fB\-t\fR .sp @@ -1154,8 +1154,8 @@ Do not stop at the end of the requested binary log from a MariaDB server, but ra .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: user option -.\" user option: mysqlbinlog +.\" mariadb-binlog: user option +.\" user option: mariadb-binlog \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1170,8 +1170,8 @@ The MariaDB username to use when connecting to a remote server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: verbose option -.\" verbose option: mysqlbinlog +.\" mariadb-binlog: verbose option +.\" verbose option: mariadb-binlog \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1183,7 +1183,7 @@ For examples that show the effect of and \fB\-\-verbose\fR on row event output, see -the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. +the section called \(lqMARIADB-BINLOG ROW EVENT DISPLAY\(rq\&. .RE .sp .RS 4 @@ -1194,8 +1194,8 @@ the section called \(lqMYSQLBINLOG ROW EVENT DISPLAY\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlbinlog: version option -.\" version option: mysqlbinlog +.\" mariadb-binlog: version option +.\" version option: mariadb-binlog \fB\-\-version\fR, \fB\-V\fR .sp @@ -1221,9 +1221,9 @@ Specify the number of open file descriptors to reserve\&. .RE .PP You can pipe the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR into the -\fBmysql\fR +\fBmariadb\fR client to execute the events contained in the binary log\&. This technique is used to recover from a crash when you have an old backup\&. For example: .sp @@ -1231,7 +1231,7 @@ backup\&. For example: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.000001 | mariadb \-u root \-p\fR .fi .if n \{\ .RE @@ -1243,32 +1243,32 @@ Or: .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.[0\-9]* | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.[0\-9]* | mariadb \-u root \-p\fR .fi .if n \{\ .RE .\} .PP You can also redirect the output of -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to a text file instead, if you need to modify the statement log first (for example, to remove statements that you do not want to execute for some reason)\&. After editing the file, execute the statements that it contains by using it as input to the -\fBmysql\fR +\fBmariadb\fR program: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 > tmpfile\fR +shell> \fBmariadb-binlog binlog\&.000001 > tmpfile\fR shell> \&.\&.\&. \fIedit tmpfile\fR \&.\&.\&. -shell> \fBmysql \-u root \-p < tmpfile\fR +shell> \fBmariadb \-u root \-p < tmpfile\fR .fi .if n \{\ .RE .\} .PP When -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR is invoked with the \fB\-\-start\-position\fR option, it displays only those events with an offset in the binary log greater than or equal to a given position (the given position must match the start of one event)\&. It also has options to stop and start when it sees an event with a given date and time\&. This enables you to perform point\-in\-time recovery using the @@ -1283,8 +1283,8 @@ If you have more than one binary log to execute on the MariaDB server, the safe .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 | mysql \-u root \-p # DANGER!!\fR -shell> \fBmysqlbinlog binlog\&.000002 | mysql \-u root \-p # DANGER!!\fR +shell> \fBmariadb-binlog binlog\&.000001 | mariadb \-u root \-p # DANGER!!\fR +shell> \fBmariadb-binlog binlog\&.000002 | mariadb \-u root \-p # DANGER!!\fR .fi .if n \{\ .RE @@ -1293,22 +1293,22 @@ shell> \fBmysqlbinlog binlog\&.000002 | mysql \-u root \-p # DANGER!!\fR Processing binary logs this way using different connections to the server causes problems if the first log file contains a CREATE TEMPORARY TABLE statement and the second log contains a statement that uses the temporary table\&. When the first -\fBmysql\fR +\fBmariadb\fR process terminates, the server drops the temporary table\&. When the second -\fBmysql\fR +\fBmariadb\fR process attempts to use the table, the server reports \(lqunknown table\&.\(rq .PP To avoid problems like this, use a \fIsingle\fR -\fBmysql\fR +\fBmariadb\fR process to execute the contents of all binary logs that you want to process\&. Here is one way to do so: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 binlog\&.000002 | mysql \-u root \-p\fR +shell> \fBmariadb-binlog binlog\&.000001 binlog\&.000002 | mariadb \-u root \-p\fR .fi .if n \{\ .RE @@ -1320,19 +1320,19 @@ Another approach is to write all the logs to a single file and then process the .RS 4 .\} .nf -shell> \fBmysqlbinlog binlog\&.000001 > /tmp/statements\&.sql\fR -shell> \fBmysqlbinlog binlog\&.000002 >> /tmp/statements\&.sql\fR -shell> \fBmysql \-u root \-p \-e "source /tmp/statements\&.sql"\fR +shell> \fBmariadb-binlog binlog\&.000001 > /tmp/statements\&.sql\fR +shell> \fBmariadb-binlog binlog\&.000002 >> /tmp/statements\&.sql\fR +shell> \fBmariadb \-u root \-p \-e "source /tmp/statements\&.sql"\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR can produce output that reproduces a LOAD DATA INFILE operation without the original data file\&. -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR copies the data to a temporary file and writes a LOAD DATA LOCAL INFILE statement that refers to the file\&. The default location of the directory where these files are written is system\-specific\&. To specify a directory explicitly, use the @@ -1340,7 +1340,7 @@ statement that refers to the file\&. The default location of the directory where option\&. .PP Because -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR converts LOAD DATA INFILE statements to @@ -1370,19 +1370,19 @@ automatically deleted because they are needed until you actually execute those s \fIoriginal_file_name\-#\-#\fR\&. .sp .5v .RE -.SH "MYSQLBINLOG HEX DUMP FORMAT" +.SH "MARIADB-BINLOG HEX DUMP FORMAT" .PP The \fB\-\-hexdump\fR option causes -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to produce a hex dump of the binary log contents: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlbinlog \-\-hexdump master\-bin\&.000001\fR +shell> \fBmariadb-binlog \-\-hexdump master\-bin\&.000001\fR .fi .if n \{\ .RE @@ -1772,11 +1772,11 @@ T} .TE .sp 1 .RE -.SH "MYSQLBINLOG ROW EVENT DISPLAY" -.\" BINLOG statement: mysqlbinlog output +.SH "MARIADB-BINLOG ROW EVENT DISPLAY" +.\" BINLOG statement: mariadb-binlog output .PP The following examples illustrate how -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR displays row events that specify data modifications\&. These correspond to events with the WRITE_ROWS_EVENT, UPDATE_ROWS_EVENT, and @@ -1810,7 +1810,7 @@ COMMIT; .\} .PP By default, -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR displays row events encoded as base\-64 strings using BINLOG statements\&. Omitting extraneous lines, the output for the row events produced by the preceding statement sequence looks like this: @@ -1819,7 +1819,7 @@ statements\&. Omitting extraneous lines, the output for the row events produced .RS 4 .\} .nf -shell> \fBmysqlbinlog \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1843,7 +1843,7 @@ fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; To see the row events as comments in the form of \(lqpseudo\-SQL\(rq statements, run -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR with the \fB\-\-verbose\fR or @@ -1855,7 +1855,7 @@ option\&. The output will contain lines beginning with .RS 4 .\} .nf -shell> \fBmysqlbinlog \-v \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-v \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1905,7 +1905,7 @@ twice to also display data types and some metadata for each column\&. The output .RS 4 .\} .nf -shell> \fBmysqlbinlog \-vv \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-vv \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -1946,7 +1946,7 @@ fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; .\} .PP You can tell -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR to suppress the BINLOG statements for row events by using the @@ -1963,7 +1963,7 @@ provides a convenient way to see row events only as SQL statements: .RS 4 .\} .nf -shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\fR +shell> \fBmariadb-binlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F @@ -2013,7 +2013,7 @@ shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\f You should not suppress BINLOG statements if you intend to re\-execute -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR output\&. .sp .5v .RE @@ -2115,7 +2115,7 @@ clause\&. .RE .PP Proper interpretation of row events requires the information from the format description event at the beginning of the binary log\&. Because -\fBmysqlbinlog\fR +\fBmariadb-binlog\fR does not know in advance whether the rest of the log contains row events, by default it displays the format description event using a BINLOG statement in the initial part of the output\&. @@ -2128,7 +2128,7 @@ option can be used to prevent this header from being written\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2021 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-check.1 b/man/mariadb-check.1 index 0b101ccb7d1..3a401bd4071 100644 --- a/man/mariadb-check.1 +++ b/man/mariadb-check.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CHECK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CHECK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,20 +11,20 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlcheck +.\" mariadb-check .\" maintenance: tables .\" repair: tables .\" tables: maintenance .\" tables: repair .SH "NAME" -mariadb-check \- a table maintenance program (mysqlcheck is now a symlink to mariadb-check) +mariadb-check \- a table maintenance program (mariadb-check is now a symlink to mariadb-check) .SH "SYNOPSIS" -.HP \w'\fBmysqlcheck\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u -\fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR +.HP \w'\fBmariadb-check\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u +\fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR .SH "DESCRIPTION" .PP The -\fBmysqlcheck\fR +\fBmariadb-check\fR client performs table maintenance: It checks, repairs, optimizes, or analyzes tables\&. .PP Each table is locked and therefore unavailable to other sessions while it is being processed, although for check operations, the table is locked with a @@ -34,26 +34,26 @@ lock only\&. Table maintenance operations can be time\-consuming, particularly f or \fB\-\-all\-databases\fR option to process all tables in one or more databases, an invocation of -\fBmysqlcheck\fR +\fBmariadb-check\fR might take a long time\&. (This is also true for -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR because that program invokes -\fBmysqlcheck\fR +\fBmariadb-check\fR to check all tables and repair them if necessary\&.) .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR is similar in function to \fBmyisamchk\fR, but works differently\&. The main operational difference is that -\fBmysqlcheck\fR +\fBmariadb-check\fR must be used when the -\fBmysqld\fR +\fBmariadbd\fR server is running, whereas \fBmyisamchk\fR should be used when it is not\&. The benefit of using -\fBmysqlcheck\fR +\fBmariadb-check\fR is that you do not have to stop the server to perform table maintenance\&. .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR uses the SQL statements CHECK TABLE, REPAIR TABLE, @@ -64,7 +64,7 @@ in a convenient way for the user\&. It determines which statements to use for th The MyISAM storage engine supports all four maintenance operations, so -\fBmysqlcheck\fR +\fBmariadb-check\fR can be used to perform any of them on MyISAM tables\&. Other storage engines do not necessarily support all operations\&. In such cases, an error message is displayed\&. For example, if @@ -77,7 +77,7 @@ table, an attempt to check it produces this result: .RS 4 .\} .nf -shell> \fBmysqlcheck test t\fR +shell> \fBmariadb-check test t\fR test\&.t note : The storage engine for the table doesn't support check .fi @@ -86,7 +86,7 @@ note : The storage engine for the table doesn't support check .\} .PP If -\fBmysqlcheck\fR +\fBmariadb-check\fR is unable to repair a table, see the MariaDB Knowledge Base for manual table repair strategies\&. This will be the case, for example, for InnoDB @@ -95,7 +95,7 @@ CHECK TABLE, but not repaired with REPAIR TABLE\&. .PP The use of -\fBmysqlcheck\fR +\fBmariadb-check\fR with partitioned tables is not supported\&. .if n \{\ .sp @@ -115,15 +115,15 @@ It is best to make a backup of a table before performing a table repair operatio .RE .PP There are three general ways to invoke -\fBmysqlcheck\fR: +\fBmariadb-check\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR -shell> \fBmysqlcheck [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-check [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR .fi .if n \{\ .RE @@ -137,18 +137,18 @@ or \fB\-\-all\-databases\fR option, entire databases are checked\&. .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR has a special feature compared to other client programs\&. The default behavior of checking tables (\fB\-\-check\fR) can be changed by renaming the binary\&. If you want to have a tool that repairs tables by default, you should just make a copy of -\fBmysqlcheck\fR +\fBmariadb-check\fR named -\fBmysqlrepair\fR, or make a symbolic link to -\fBmysqlcheck\fR +\fBmariadb-repair\fR, or make a symbolic link to +\fBmariadb-check\fR named -\fBmysqlrepair\fR\&. If you invoke -\fBmysqlrepair\fR, it repairs tables\&. +\fBmariadb-repair\fR\&. If you invoke +\fBmariadb-repair\fR, it repairs tables\&. .PP The following names can be used to change -\fBmysqlcheck\fR +\fBmariadb-check\fR default behavior\&. .TS allbox tab(:); @@ -156,7 +156,7 @@ l l l l l l. T{ -\fBmysqlrepair\fR +\fBmariadb-repair\fR T}:T{ The default option is \fB\-\-repair\fR T} @@ -173,9 +173,9 @@ T} .TE .sp 1 .PP -\fBmysqlcheck\fR +\fBmariadb-check\fR supports the following options, which can be specified on the command line or in the -[mysqlcheck] +[mariadb-check] and [client] option file groups\&. @@ -189,8 +189,8 @@ The \fB-c\fR, \fB-r\fR, \fB-a\fR and \fB-o\fR options are exclusive to each othe .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: help option -.\" help option: mysqlcheck +.\" mariadb-check: help option +.\" help option: mariadb-check \fB\-\-help\fR, \fB\-?\fR .sp @@ -205,8 +205,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: all-databases option -.\" all-databases option: mysqlcheck +.\" mariadb-check: all-databases option +.\" all-databases option: mariadb-check \fB\-\-all\-databases\fR, \fB\-A\fR .sp @@ -223,8 +223,8 @@ option and naming all the databases on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: all-in-1 option -.\" all-in-1 option: mysqlcheck +.\" mariadb-check: all-in-1 option +.\" all-in-1 option: mariadb-check \fB\-\-all\-in\-1\fR, \fB\-1\fR .sp @@ -239,8 +239,8 @@ Instead of issuing a statement for each table, execute a single statement for ea .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: analyze option -.\" analyze option: mysqlcheck +.\" mariadb-check: analyze option +.\" analyze option: mariadb-check \fB\-\-analyze\fR, \fB\-a\fR .sp @@ -255,8 +255,8 @@ Analyze the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: auto-repair option -.\" auto-repair option: mysqlcheck +.\" mariadb-check: auto-repair option +.\" auto-repair option: mariadb-check \fB\-\-auto\-repair\fR .sp If a checked table is corrupted, automatically fix it\&. Any necessary repairs are done after all tables have been checked\&. @@ -270,8 +270,8 @@ If a checked table is corrupted, automatically fix it\&. Any necessary repairs a .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: character-sets-dir option -.\" character-sets-dir option: mysqlcheck +.\" mariadb-check: character-sets-dir option +.\" character-sets-dir option: mariadb-check \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -285,8 +285,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check option -.\" check option: mysqlcheck +.\" mariadb-check: check option +.\" check option: mariadb-check \fB\-\-check\fR, \fB\-c\fR .sp @@ -301,8 +301,8 @@ Check the tables for errors\&. This is the default operation\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check-only-changed option -.\" check-only-changed option: mysqlcheck +.\" mariadb-check: check-only-changed option +.\" check-only-changed option: mariadb-check \fB\-\-check\-only\-changed\fR, \fB\-C\fR .sp @@ -317,8 +317,8 @@ Check only tables that have changed since the last check or that have not been c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: check-upgrade option -.\" check-upgrade option: mysqlcheck +.\" mariadb-check: check-upgrade option +.\" check-upgrade option: mariadb-check \fB\-\-check\-upgrade\fR, \fB\-g\fR .sp @@ -341,8 +341,8 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: compress option -.\" compress option: mysqlcheck +.\" mariadb-check: compress option +.\" compress option: mariadb-check \fB\-\-compress\fR .sp Compress all information sent between the client and the server if both support compression\&. @@ -356,13 +356,13 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: databases option -.\" databases option: mysqlcheck +.\" mariadb-check: databases option +.\" databases option: mariadb-check \fB\-\-databases\fR, \fB\-B\fR .sp Process all tables in the named databases\&. Normally, -\fBmysqlcheck\fR +\fBmariadb-check\fR treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&. .RE .sp @@ -374,8 +374,8 @@ treats the first name argument on the command line as a database name and follow .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug option -.\" debug option: mysqlcheck +.\" mariadb-check: debug option +.\" debug option: mariadb-check \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -392,8 +392,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug-check option -.\" debug-check option: mysqlcheck +.\" mariadb-check: debug-check option +.\" debug-check option: mariadb-check \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -407,8 +407,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: debug-info option -.\" debug-info option: mysqlcheck +.\" mariadb-check: debug-info option +.\" debug-info option: mariadb-check \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -422,8 +422,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: default-auth option -.\" default-auth option: mysqlcheck +.\" mariadb-check: default-auth option +.\" default-auth option: mariadb-check \fB\-\-default\-auth=\fR\fB\fIname\fR\fR .sp Default authentication client-side plugin to use\&. @@ -437,8 +437,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: default-character-set option -.\" default-character-set option: mysqlcheck +.\" mariadb-check: default-character-set option +.\" default-character-set option: mariadb-check \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -454,8 +454,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-extra-file option -.\" defaults-extra-file option: mysqlcheck +.\" mariadb-check: defaults-extra-file option +.\" defaults-extra-file option: mariadb-check \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -470,8 +470,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-file option -.\" defaults-file option: mysqlcheck +.\" mariadb-check: defaults-file option +.\" defaults-file option: mariadb-check \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -486,8 +486,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: extended option -.\" extended option: mysqlcheck +.\" mariadb-check: extended option +.\" extended option: mariadb-check \fB\-\-extended\fR, \fB\-e\fR .sp @@ -505,8 +505,8 @@ instead of the much faster repair by sorting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fast option -.\" fast option: mysqlcheck +.\" mariadb-check: fast option +.\" fast option: mariadb-check \fB\-\-fast\fR, \fB\-F\fR .sp @@ -521,8 +521,8 @@ Check only tables that have not been closed properly\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fix-db-names option -.\" fix-db-names option: mysqlcheck +.\" mariadb-check: fix-db-names option +.\" fix-db-names option: mariadb-check \fB\-\-fix\-db\-names\fR .sp Convert database names to the format used since MySQL 5\&.1\&. Only database names that contain special characters are affected\&. @@ -536,8 +536,8 @@ Convert database names to the format used since MySQL 5\&.1\&. Only database nam .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: fix-table-names option -.\" fix-table-names option: mysqlcheck +.\" mariadb-check: fix-table-names option +.\" fix-table-names option: mariadb-check \fB\-\-fix\-table\-names\fR .sp Convert table names (including views) to the format used since MySQL 5\&.1\&. Only table names that contain special characters are affected\&. @@ -551,8 +551,8 @@ Convert table names (including views) to the format used since MySQL 5\&.1\&. On .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: flush option -.\" flush option: mysqlcheck +.\" mariadb-check: flush option +.\" flush option: mariadb-check \fB\-\-flush\fR, .sp Flush each table after check. This is useful if you don't @@ -567,8 +567,8 @@ want to have the checked tables take up space in the caches after the check\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: force option -.\" force option: mysqlcheck +.\" mariadb-check: force option +.\" force option: mariadb-check \fB\-\-force\fR, \fB\-f\fR .sp @@ -583,8 +583,8 @@ Continue even if an SQL error occurs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: host option -.\" host option: mysqlcheck +.\" mariadb-check: host option +.\" host option: mariadb-check \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -599,8 +599,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: medium-check option -.\" medium-check option: mysqlcheck +.\" mariadb-check: medium-check option +.\" medium-check option: mariadb-check \fB\-\-medium\-check\fR, \fB\-m\fR .sp @@ -617,8 +617,8 @@ operation\&. This finds only 99\&.99% of all errors, which should be good enough .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: no-defaults option -.\" no-defaults option: mysqlcheck +.\" mariadb-check: no-defaults option +.\" no-defaults option: mariadb-check \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -632,8 +632,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: optimize option -.\" optimize option: mysqlcheck +.\" mariadb-check: optimize option +.\" optimize option: mariadb-check \fB\-\-optimize\fR, \fB\-o\fR .sp @@ -648,8 +648,8 @@ Optimize the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: password option -.\" password option: mysqlcheck +.\" mariadb-check: password option +.\" password option: mariadb-check \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -662,7 +662,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlcheck\fR +\fBmariadb-check\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -676,8 +676,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: persisent option -.\" persistent option: mysql +.\" mariadb-check: persisent option +.\" persistent option: mariadb-check \fB\-\-persistent\fR, \fB\-Z\fR .sp @@ -692,8 +692,8 @@ Used with ANALYZE TABLE to append the option PERSISENT FOR ALL. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: pipe option -.\" pipe option: mysql +.\" mariadb-check: pipe option +.\" pipe option: mariadb-check \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -708,8 +708,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: plugin-dir option -.\" plugin-dir option: mysqlcheck +.\" mariadb-check: plugin-dir option +.\" plugin-dir option: mariadb-check \fB\-\-plugin\-dir=\fR\fB\fIname\fR\fR .sp Directory for client-side plugins\&. @@ -723,8 +723,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: port option -.\" port option: mysqlcheck +.\" mariadb-check: port option +.\" port option: mariadb-check \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -740,8 +740,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: print-defaults option -.\" print-defaults option: mysqlcheck +.\" mariadb-check: print-defaults option +.\" print-defaults option: mariadb-check \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -756,8 +756,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: process-tables option -.\" process-tables option: mysqlcheck +.\" mariadb-check: process-tables option +.\" process-tables option: mariadb-check \fB\-\-process\-tables\fR .sp Perform the requested operation on tables. Defaults to on; use \fB--skip-process-tables\fR to disable\&. @@ -771,8 +771,8 @@ Perform the requested operation on tables. Defaults to on; use \fB--skip-process .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: process-views option -.\" process-views option: mysqlcheck +.\" mariadb-check: process-views option +.\" process-views option: mariadb-check \fB\-\-process\-views=\fB\fIval\fR .sp Perform the requested operation (only CHECK VIEW or REPAIR VIEW). Possible values are NO, YES (correct the checksum, if necessary, add the mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle the algorithm MERGE<->TEMPTABLE\&. @@ -786,8 +786,8 @@ Perform the requested operation (only CHECK VIEW or REPAIR VIEW). Possible value .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: protocol option -.\" protocol option: mysqlcheck +.\" mariadb-check: protocol option +.\" protocol option: mariadb-check \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -801,8 +801,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: quick option -.\" quick option: mysqlcheck +.\" mariadb-check: quick option +.\" quick option: mariadb-check \fB\-\-quick\fR, \fB\-q\fR .sp @@ -819,8 +819,8 @@ If you are using this option to repair tables, it tries to repair only the index .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: repair option -.\" repair option: mysqlcheck +.\" mariadb-check: repair option +.\" repair option: mariadb-check \fB\-\-repair\fR, \fB\-r\fR .sp @@ -835,8 +835,8 @@ Perform a repair that can fix almost anything except unique keys that are not un .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: silent option -.\" silent option: mysqlcheck +.\" mariadb-check: silent option +.\" silent option: mariadb-check \fB\-\-silent\fR, \fB\-s\fR .sp @@ -851,8 +851,8 @@ Silent mode\&. Print only error messages\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: skip-database option -.\" skip-database option: mysqlcheck +.\" mariadb-check: skip-database option +.\" skip-database option: mariadb-check \fB\-\-skip\-database=\fB\fIdb_name\fR .sp Don't process the database (case-sensitive) specified as argument\&. @@ -866,8 +866,8 @@ Don't process the database (case-sensitive) specified as argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: socket option -.\" socket option: mysqlcheck +.\" mariadb-check: socket option +.\" socket option: mariadb-check \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -884,8 +884,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-check: SSL options +.\" SSL options: mariadb-check \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -900,8 +900,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-check: SSL CA option +.\" SSL CA option: mariadb-check \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -916,8 +916,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-check: SSL CA Path option +.\" SSL CA Path option: mariadb-check \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -932,8 +932,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-check: SSL Cert option +.\" SSL Cert option: mariadb-check \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -948,8 +948,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-check: SSL Cipher option +.\" SSL Cipher option: mariadb-check \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -964,8 +964,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-check: SSL Key option +.\" SSL Key option: mariadb-check \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -980,8 +980,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-check: SSL Crl option +.\" SSL CRL option: mariadb-check \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -996,8 +996,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-check: SSL Crlpath option +.\" SSL Crlpath option: mariadb-check \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1012,8 +1012,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-check: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-check \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1027,8 +1027,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: tables option -.\" tables option: mysqlcheck +.\" mariadb-check: tables option +.\" tables option: mariadb-check \fB\-\-tables\fR .sp Override the @@ -1046,8 +1046,8 @@ option\&. All name arguments following the option are regarded as table names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: use-frm option -.\" use-frm option: mysqlcheck +.\" mariadb-check: use-frm option +.\" use-frm option: mariadb-check \fB\-\-use\-frm\fR .sp For repair operations on @@ -1067,8 +1067,8 @@ header is corrupted\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: user option -.\" user option: mysqlcheck +.\" mariadb-check: user option +.\" user option: mariadb-check \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1083,13 +1083,13 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: verbose option -.\" verbose option: mysqlcheck +.\" mariadb-check: verbose option +.\" verbose option: mariadb-check \fB\-\-verbose\fR, \fB\-v\fR .sp Verbose mode\&. Print information about the various stages of program operation\&. -Using one \fB--verbose\fR option will give you more information about what mysqlcheck is +Using one \fB--verbose\fR option will give you more information about what mariadb-check is doing\&. .sp Using two \fB--verbose\fR options will also give you connection information\&. @@ -1106,8 +1106,8 @@ the check phase\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: version option -.\" version option: mysqlcheck +.\" mariadb-check: version option +.\" version option: mariadb-check \fB\-\-version\fR, \fB\-V\fR .sp @@ -1122,8 +1122,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: write-binlog option -.\" write-binlog option: mysqlcheck +.\" mariadb-check: write-binlog option +.\" write-binlog option: mariadb-check \fB\-\-write\-binlog\fR .sp This option is enabled by default, so that @@ -1131,7 +1131,7 @@ ANALYZE TABLE, OPTIMIZE TABLE, and REPAIR TABLE statements generated by -\fBmysqlcheck\fR +\fBmariadb-check\fR are written to the binary log\&. Use \fB\-\-skip\-write\-binlog\fR to cause @@ -1143,7 +1143,7 @@ when these statements should not be sent to replication slaves or run when using .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-client-test.1 b/man/mariadb-client-test.1 index 2866dfa5029..dba0aa6f225 100644 --- a/man/mariadb-client-test.1 +++ b/man/mariadb-client-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,37 +11,37 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_client_test -.\" mysql_client_test_embedded +.\" mariadb-client-test +.\" mariadb-client-test-embedded .SH "NAME" -mariadb-client-test \- test client API (mysql_client_test is now a symlink to mariadb-client-test) +mariadb-client-test \- test client API (mariadb-client-test is now a symlink to mariadb-client-test) .br -mariadb-client-test-embedded \- test client API for embedded server (mysql_client_test_embedded is now a symlink to mariadb-client-test-embedded) +mariadb-client-test-embedded \- test client API for embedded server (mariadb-client-test-embedded is now a symlink to mariadb-client-test-embedded) .SH "SYNOPSIS" -.HP \w'\fBmysql_client_test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u -\fBmysql_client_test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR -.HP \w'\fBmysql_client_test_embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u -\fBmysql_client_test_embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +.HP \w'\fBmariadb-client-test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u +\fBmariadb-client-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +.HP \w'\fBmariadb-client-test-embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fItest_name\fR\fR\fB]\ \&.\&.\&.\fR\ 'u +\fBmariadb-client-test-embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR .SH "DESCRIPTION" .PP The -\fBmysql_client_test\fR +\fBmariadb-client-test\fR program is used for testing aspects of the MariaDB client API that cannot be tested using -\fBmysqltest\fR +\fBmariadb-test\fR and its test language\&. -\fBmysql_client_test_embedded\fR +\fBmariadb-client-test-embedded\fR is similar but used for testing the embedded server\&. Both programs are run as part of the test suite\&. .PP The source code for the programs can be found in in -tests/mysql_client_test\&.c +tests/mariadb-client-test\&.c in a source distribution\&. The program serves as a good source of examples illustrating how to use various features of the client API\&. .PP -\fBmysql_client_test\fR +\fBmariadb-client-test\fR is used in a test by the same name in the main tests suite of -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR but may also be run directly\&. Unlike the other programs listed here, it does not read an external description of what tests to run\&. Instead, all tests are coded into the program, which is written to cover all aspects of the C language API\&. .PP -\fBmysql_client_test\fR +\fBmariadb-client-test\fR supports the following options: .sp .RS 4 @@ -52,8 +52,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: help option -.\" help option: mysql_client_test +.\" mariadb-client-test: help option +.\" help option: mariadb-client-test \fB\-\-help\fR, \fB\-?\fR .sp @@ -69,8 +69,8 @@ Display a help message and exit\&. .IP \(bu 2.3 .\} \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR, -.\" mysql_client_test: basedir option -.\" basedir option: mysql_client_test +.\" mariadb-client-test: basedir option +.\" basedir option: mariadb-client-test \fB\-b \fR\fB\fIdir_name\fR\fR .sp The base directory for the tests\&. @@ -85,8 +85,8 @@ The base directory for the tests\&. .IP \(bu 2.3 .\} \fB\-\-count=\fR\fB\fIcount\fR\fR, -.\" mysql_client_test: count option -.\" count option: mysql_client_test +.\" mariadb-client-test: count option +.\" count option: mariadb-client-test \fB\-t \fR\fB\fIcount\fR\fR .sp The number of times to execute the tests\&. @@ -100,8 +100,8 @@ The number of times to execute the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: database option -.\" database option: mysql_client_test +.\" mariadb-client-test: database option +.\" database option: mariadb-client-test \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -116,14 +116,14 @@ The database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: debug option -.\" debug option: mysql_client_test +.\" mariadb-client-test: debug option +.\" debug option: mariadb-client-test \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-#[\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is 'd:t:o,/tmp/mysql_client_test.trace'. +value is 'd:t:o,/tmp/mariadb-client-test.trace'. .RE .sp .RS 4 @@ -135,8 +135,8 @@ value is 'd:t:o,/tmp/mysql_client_test.trace'. .IP \(bu 2.3 .\} \fB\-\-getopt\-ll\-test=\fR\fB\fIoption\fR\fR, -.\" mysql_client_test: getopt-ll-test option -.\" getopt-ll-test option: mysql_client_test +.\" mariadb-client-test: getopt-ll-test option +.\" getopt-ll-test option: mariadb-client-test \fB\-g \fR\fB\fIoption\fR\fR .sp Option to use for testing bugs in the @@ -152,8 +152,8 @@ library\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: host option -.\" host option: mysql_client_test +.\" mariadb-client-test: host option +.\" host option: mariadb-client-test \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -168,8 +168,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: password option -.\" password option: mysql_client_test +.\" mariadb-client-test: password option +.\" password option: mariadb-client-test \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -178,8 +178,8 @@ The password to use when connecting to the server\&. If you use the short option have a space between the option and the password\&. If you omit the \fIpassword\fR value following the -.\" mysql_client_test: password option -.\" password option: mysql_client_test +.\" mariadb-client-test: password option +.\" password option: mariadb-client-test \fB\-\-password\fR or \fB\-p\fR @@ -194,8 +194,8 @@ option on the command line, you are prompted for one\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: port option -.\" port option: mysql_client_test +.\" mariadb-client-test: port option +.\" port option: mariadb-client-test \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -211,8 +211,8 @@ The TCP/IP port number to use for the connection\&. .IP \(bu 2.3 .\} \fB\-\-server\-arg=\fR\fB\fIarg\fR\fR, -.\" mysql_client_test: server-arg option -.\" server-arg option: mysql_client_test +.\" mariadb-client-test: server-arg option +.\" server-arg option: mariadb-client-test \fB\-A \fR\fB\fIarg\fR\fR .sp Argument to send to the embedded server\&. @@ -240,8 +240,8 @@ Show all test names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: silent option -.\" silent option: mysql_client_test +.\" mariadb-client-test: silent option +.\" silent option: mariadb-client-test \fB\-\-silent\fR, \fB\-s\fR .sp @@ -256,8 +256,8 @@ Be more silent\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: socket option -.\" socket option: mysql_client_test +.\" mariadb-client-test: socket option +.\" socket option: mariadb-client-test \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -278,8 +278,8 @@ localhost \fB\-c\fR .sp The option is used when called from -\fBmysql\-test\-run\&.pl\fR, so that -\fBmysql_client_test\fR +\fBmariadb\-test\-run\&.pl\fR, so that +\fBmariadb-client-test\fR may optionally behave in a different way than if called manually, for example by skipping some tests\&. Currently, there is no difference in behavior but the option is included in order to make this possible\&. .RE .sp @@ -291,8 +291,8 @@ may optionally behave in a different way than if called manually, for example by .sp -1 .IP \(bu 2.3 .\} -.\" mysql_client_test: user option -.\" user option: mysql_client_test +.\" mariadb-client-test: user option +.\" user option: mariadb-client-test \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -308,17 +308,17 @@ The MariaDB user name to use when connecting to the server\&. .IP \(bu 2.3 .\} \fB\-v \fR\fB\fIdir_name\fR\fR, -.\" mysql_client_test: vardir option -.\" vardir option: mysql_client_test +.\" mariadb-client-test: vardir option +.\" vardir option: mariadb-client-test \fB\-\-vardir=\fR\fB\fIdir_name\fR\fR .sp The data directory for tests\&. The default is -mysql\-test/var\&. +mariadb\-test/var\&. .RE .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1 index 487ad003aec..9a04fe53a49 100644 --- a/man/mariadb-conv.1 +++ b/man/mariadb-conv.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONV\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONV\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -90,7 +90,7 @@ Treat the specified characters as delimiters\&. .SH "COPYRIGHT" .br .PP -Copyright 2020 MariaDB Foundation +Copyright 2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-convert-table-format.1 b/man/mariadb-convert-table-format.1 index 89f6f37bcf9..90daee617f8 100644 --- a/man/mariadb-convert-table-format.1 +++ b/man/mariadb-convert-table-format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,18 +11,18 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_convert_table_format +.\" mariadb_convert_table_format .SH "NAME" -mariadb-convert-table-format \- convert tables to use a given storage engine (mysql_convert_table_format is now a symlink to mariadb-convert-table-format) +mariadb-convert-table-format \- convert tables to use a given storage engine (mariadb-convert-table-format is now a symlink to mariadb-convert-table-format) .SH "SYNOPSIS" -.HP \w'\fBmysql_convert_table_format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u -\fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR +.HP \w'\fBmariadb-convert-table-format\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u +\fBmariadb-convert-table-format [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_convert_table_format\fR +\fBmariadb_convert_table_format\fR converts the tables in a database to use a particular storage engine (MyISAM by default)\&. -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR is written in Perl and requires that the DBI and @@ -31,14 +31,14 @@ Perl modules be installed (see Section\ \&2.15, \(lqPerl Installation Notes\(rq)\&. .PP Invoke -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_convert_table_format [\fR\fB\fIoptions\fR\fR\fB]\fR\fB\fIdb_name\fR\fR +shell> \fBmariadb-convert-table-format [\fR\fB\fIoptions\fR\fR\fB]\fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -48,7 +48,7 @@ The \fIdb_name\fR argument indicates the database containing the tables to be converted\&. .PP -\fBmysql_convert_table_format\fR +\fBmariadb-convert-table-format\fR supports the options described in the following list\&. .sp .RS 4 @@ -59,8 +59,8 @@ supports the options described in the following list\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: help option -.\" help option: mysql_convert_table_format +.\" mariadb-convert-table-format: help option +.\" help option: mariadb-convert-table-format \fB\-\-help\fR .sp Display a help message and exit\&. @@ -74,8 +74,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: force option -.\" force option: mysql_convert_table_format +.\" mariadb-convert-table-format: force option +.\" force option: mariadb-convert-table-format \fB\-\-force\fR .sp Continue even if errors occur\&. @@ -89,8 +89,8 @@ Continue even if errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: host option -.\" host option: mysql_convert_table_format +.\" mariadb-convert-table-format: host option +.\" host option: mariadb-convert-table-format \fB\-\-host=\fR\fB\fIhost_name\fR\fR .sp Connect to the MariaDB server on the given host\&. @@ -104,8 +104,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: password option -.\" password option: mysql_convert_table_format +.\" mariadb-convert-table-format: password option +.\" password option: mariadb-convert-table-format \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. @@ -121,8 +121,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: port option -.\" port option: mysql_convert_table_format +.\" mariadb-convert-table-format: port option +.\" port option: mariadb-convert-table-format \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for the connection\&. @@ -136,8 +136,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: socket option -.\" socket option: mysql_convert_table_format +.\" mariadb-convert-table-format: socket option +.\" socket option: mariadb-convert-table-format \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp For connections to @@ -152,8 +152,8 @@ localhost, the Unix socket file to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: type option -.\" type option: mysql_convert_table_format +.\" mariadb-convert-table-format: type option +.\" type option: mariadb-convert-table-format \fB\-\-type=\fR\fB\fIengine_name\fR\fR .sp Specify the storage engine that the tables should be converted to use\&. The default is @@ -169,8 +169,8 @@ if this option is not given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: user option -.\" user option: mysql_convert_table_format +.\" mariadb-convert-table-format: user option +.\" user option: mariadb-convert-table-format \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. @@ -184,8 +184,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: verbose option -.\" verbose option: mysql_convert_table_format +.\" mariadb-convert-table-format: verbose option +.\" verbose option: mariadb-convert-table-format \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -199,8 +199,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_convert_table_format: version option -.\" version option: mysql_convert_table_format +.\" mariadb-convert-table-format: version option +.\" version option: mariadb-convert-table-format \fB\-\-version\fR .sp Display version information and exit\&. @@ -208,7 +208,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dump.1 b/man/mariadb-dump.1 index bbb5b59c714..61aca2be527 100644 --- a/man/mariadb-dump.1 +++ b/man/mariadb-dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMP\fR" "1" "24 October 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-DUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,42 +11,42 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqldump +.\" mariadb-dump .\" dumping: databases and tables .\" backups: databases and tables .\" databases: dumping .\" tables: dumping .SH "NAME" -mariadb-dump \- a database backup program (mysqldump is now a symlink to mariadb-dump) +mariadb-dump \- a database backup program (mariadb-dump is now a symlink to mariadb-dump) .SH "SYNOPSIS" -.HP \w'\fBmysqldump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u -\fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR +.HP \w'\fBmariadb-dump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u +\fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR .SH "DESCRIPTION" .PP The -\fBmysqldump\fR +\fBmariadb-dump\fR client is a backup program originally written by Igor Romanenko\&. It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MariaDB server)\&. The dump typically contains SQL statements to create the table, populate it, or both\&. However, -\fBmysqldump\fR +\fBmariadb-dump\fR can also be used to generate files in CSV, other delimited text, or XML format\&. .PP If you are doing a backup on the server and your tables all are MyISAM tables, consider using the -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR instead because it can accomplish faster backups and faster restores\&. See -\fBmysqlhotcopy\fR(1)\&. +\fBmariadb-hotcopy\fR(1)\&. .PP There are four general ways to invoke -\fBmysqldump\fR: +\fBmariadb-dump\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR -shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR +shell> \fBmariadb-dump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR .fi .if n \{\ .RE @@ -60,7 +60,7 @@ or \fB\-\-all\-databases\fR option, entire databases are dumped\&. .PP -\fBmysqldump\fR +\fBmariadb-dump\fR does not dump the INFORMATION_SCHEMA or performance_schema databases by default\&. To dump these, @@ -69,12 +69,12 @@ name them explicitly on the command line, although you must also use the option\&. .PP To see a list of the options your version of -\fBmysqldump\fR +\fBmariadb-dump\fR supports, execute -\fBmysqldump \-\-help\fR\&. +\fBmariadb-dump \-\-help\fR\&. .PP Some -\fBmysqldump\fR +\fBmariadb-dump\fR options are shorthand for groups of other options: .sp .RS 4 @@ -174,7 +174,7 @@ would not have the intended effect; it is the same as \fB\-\-skip\-opt\fR by itself\&. .PP -\fBmysqldump\fR +\fBmariadb-dump\fR can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it\&. Buffering in memory can be a problem if you are dumping large tables\&. To dump tables row by row, use the \fB\-\-quick\fR option (or @@ -186,7 +186,7 @@ option (and hence \fB\-\-skip\-quick\fR\&. .PP If you are using a recent version of -\fBmysqldump\fR +\fBmariadb-dump\fR to generate a dump to be reloaded into a very old MySQL server, you should not use the \fB\-\-opt\fR or @@ -196,13 +196,13 @@ option\&. Use instead\&. .RE .PP -\fBmysqldump\fR +\fBmariadb-dump\fR supports the following options, which can be specified on the command line or in the -[mysqldump] +[mariadb-dump] and [client] option file groups\&. -\fBmysqldump\fR +\fBmariadb-dump\fR also supports the options for processing option file\&. .sp .RS 4 @@ -213,8 +213,8 @@ also supports the options for processing option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: help option -.\" help option: mysqldump +.\" mariadb-dump: help option +.\" help option: mariadb-dump \fB\-\-help\fR, \fB\-?\fR .sp @@ -229,8 +229,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-database option -.\" add-drop-database option: mysqldump +.\" mariadb-dump: add-drop-database option +.\" add-drop-database option: mariadb-dump \fB\-\-add\-drop\-database\fR .sp Add a @@ -254,8 +254,8 @@ statements are written unless one of those options is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-table option -.\" add-drop-table option: mysqldump +.\" mariadb-dump: add-drop-table option +.\" add-drop-table option: mariadb-dump \fB\-\-add\-drop\-table\fR .sp Add a @@ -273,8 +273,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-drop-trigger option -.\" add-drop-trigger option: mysqldump +.\" mariadb-dump: add-drop-trigger option +.\" add-drop-trigger option: mariadb-dump \fB\-\-add\-drop\-trigger\fR .sp Add a @@ -292,8 +292,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: add-locks option -.\" add-locks option: mysqldump +.\" mariadb-dump: add-locks option +.\" add-locks option: mariadb-dump \fB\-\-add\-locks\fR .sp Surround each table dump with @@ -311,8 +311,8 @@ statements\&. This results in faster inserts when the dump file is reloaded\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: all-databases option -.\" all-databases option: mysqldump +.\" mariadb-dump: all-databases option +.\" all-databases option: mariadb-dump \fB\-\-all\-databases\fR, \fB\-A\fR .sp @@ -329,15 +329,15 @@ option and naming all the databases on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: all-tablespaces option -.\" all-tablespaces option: mysqldump +.\" mariadb-dump: all-tablespaces option +.\" all-tablespaces option: mariadb-dump \fB\-\-all\-tablespaces\fR, \fB\-Y\fR .sp Adds to a table dump all SQL statements needed to create any tablespaces used by an NDBCLUSTER table\&. This information is not otherwise included in the output from -\fBmysqldump\fR\&. This option is currently relevant only to MySQL Cluster tables\&. +\fBmariadb-dump\fR\&. This option is currently relevant only to MySQL Cluster tables\&. .sp .RE .sp @@ -349,8 +349,8 @@ table\&. This information is not otherwise included in the output from .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: allow-keywords option -.\" allow-keywords option: mysqldump +.\" mariadb-dump: allow-keywords option +.\" allow-keywords option: mariadb-dump \fB\-\-allow\-keywords\fR .sp Allow creation of column names that are keywords\&. This works by prefixing each column name with the table name\&. @@ -364,8 +364,8 @@ Allow creation of column names that are keywords\&. This works by prefixing each .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: apply-slave-statements option -.\" apply-slave-statements option: mysqldump +.\" mariadb-dump: apply-slave-statements option +.\" apply-slave-statements option: mariadb-dump \fB\-\-apply\-slave\-statements\fR .sp Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump\&. @@ -379,8 +379,8 @@ Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump\& .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: as-of option -.\" as-of option: mysqldump +.\" mariadb-dump: as-of option +.\" as-of option: mariadb-dump \fB\-\-as\-of=\fR\fB\fIname\fR\fR .sp Dump system versioned table as of specified timestamp\&. @@ -394,8 +394,8 @@ Dump system versioned table as of specified timestamp\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: character-sets-dir option -.\" character-sets-dir option: mysqldump +.\" mariadb-dump: character-sets-dir option +.\" character-sets-dir option: mariadb-dump \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -409,8 +409,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: comments option -.\" comments option: mysqldump +.\" mariadb-dump: comments option +.\" comments option: mariadb-dump \fB\-\-comments\fR, \fB\-i\fR .sp @@ -426,8 +426,8 @@ Write additional information in the dump file such as program version, server ve .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compact option -.\" compact option: mysqldump +.\" mariadb-dump: compact option +.\" compact option: mariadb-dump \fB\-\-compact\fR .sp Produce more compact output\&. This option enables the @@ -448,8 +448,8 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compatible option -.\" compatible option: mysqldump +.\" mariadb-dump: compatible option +.\" compatible option: mariadb-dump \fB\-\-compatible=\fR\fB\fIname\fR\fR .sp Produce output that is more compatible with other database systems or with older MySQL servers\&. The value of @@ -481,8 +481,8 @@ does not map data types to Oracle types or use Oracle comment syntax\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: complete-insert option -.\" complete-insert option: mysqldump +.\" mariadb-dump: complete-insert option +.\" complete-insert option: mariadb-dump \fB\-\-complete\-insert\fR, \fB\-c\fR .sp @@ -499,8 +499,8 @@ statements that include column names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: compress option -.\" compress option: mysqldump +.\" mariadb-dump: compress option +.\" compress option: mariadb-dump \fB\-\-compress\fR, \fB\-C\fR .sp @@ -515,8 +515,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: copy-s3-tables option -.\" copy-s3-tables option: mysqldump +.\" mariadb-dump: copy-s3-tables option +.\" copy-s3-tables option: mariadb-dump \fB\-\-copy\-s3\-tables\fR .sp By default S3 tables are ignored\&. With this option set, the result file will contain a CREATE statement @@ -531,8 +531,8 @@ for a similar Aria table, followed by the table data and ending with an ALTER TA .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: create-options option -.\" create-options option: mysqldump +.\" mariadb-dump: create-options option +.\" create-options option: mariadb-dump \fB\-\-create\-options\fR, \fB\-a\fR .sp @@ -549,13 +549,13 @@ statements\&. Use \fB\-\-skip-create-options\fR to disable. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: databases option -.\" databases option: mysqldump +.\" mariadb-dump: databases option +.\" databases option: mariadb-dump \fB\-\-databases\fR, \fB\-B\fR .sp Dump several databases\&. Normally, -\fBmysqldump\fR +\fBmariadb-dump\fR treats the first name argument on the command line as a database name and following names as table names\&. With this option, it treats all name arguments as database names\&. CREATE DATABASE and @@ -571,14 +571,14 @@ statements are included in the output before each new database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug option -.\" debug option: mysqldump +.\" mariadb-dump: debug option +.\" debug option: mariadb-dump \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mysqldump.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mariadb-dump.trace'. .RE .sp .RS 4 @@ -589,8 +589,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mysqldump.tr .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug-check option -.\" debug-check option: mysqldump +.\" mariadb-dump: debug-check option +.\" debug-check option: mariadb-dump \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -604,8 +604,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: debug-info option -.\" debug-info option: mysqldump +.\" mariadb-dump: debug-info option +.\" debug-info option: mariadb-dump \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -619,8 +619,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: default-auth option -.\" default-auth option: mysqldump +.\" mariadb-dump: default-auth option +.\" default-auth option: mariadb-dump \fB\-\-default\-auth\fR .sp Default authentication client-side plugin to use\&. @@ -634,14 +634,14 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: default-character-set option -.\" default-character-set option: mysqldump +.\" mariadb-dump: default-character-set option +.\" default-character-set option: mariadb-dump \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use \fIcharset_name\fR as the default character set\&. If no character set is specified, -\fBmysqldump\fR +\fBmariadb-dump\fR uses utf8\&. .sp @@ -655,8 +655,8 @@ utf8\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: defaults-extra-file option -.\" defaults-extra-file option: mysqldump +.\" mariadb-dump: defaults-extra-file option +.\" defaults-extra-file option: mariadb-dump \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -671,8 +671,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: defaults-file option -.\" defaults-file option: mysqldump +.\" mariadb-dump: defaults-file option +.\" defaults-file option: mariadb-dump \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -691,7 +691,7 @@ Must be given as first option\&. .\" defaults-group-suffix option: my_print_defaults \fB\-\-defaults\-group\-suffix=\fR\fB\fIstr\fR\fR, .sp -Also read groups with a suffix of \fIstr\fR\&. For example, since mysqldump normally reads the [client] and [mysqldump] groups, \-\-defaults\-group\-suffix=x would cause it to also read the groups [mysqldump_x] and [client_x]\&. +Also read groups with a suffix of \fIstr\fR\&. For example, since mariadb-dump normally reads the [client] and [mariadb-dump] groups, \-\-defaults\-group\-suffix=x would cause it to also read the groups [mariadb-dump_x] and [client_x]\&. .RE .sp .RS 4 @@ -702,8 +702,8 @@ Also read groups with a suffix of \fIstr\fR\&. For example, since mysqldump norm .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: delayed-insert option -.\" delayed-insert option: mysqldump +.\" mariadb-dump: delayed-insert option +.\" delayed-insert option: mariadb-dump \fB\-\-delayed\-insert\fR .sp Write @@ -721,8 +721,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: delete-master-logs option -.\" delete-master-logs option: mysqldump +.\" mariadb-dump: delete-master-logs option +.\" delete-master-logs option: mariadb-dump \fB\-\-delete\-master\-logs\fR .sp On a master replication server, delete the binary logs by sending a @@ -739,8 +739,8 @@ statement to the server after performing the dump operation\&. This option autom .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: disable-keys option -.\" disable-keys option: mysqldump +.\" mariadb-dump: disable-keys option +.\" disable-keys option: mariadb-dump \fB\-\-disable\-keys\fR, \fB\-K\fR .sp @@ -763,14 +763,14 @@ tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-date option -.\" dump-date option: mysqldump +.\" mariadb-dump: dump-date option +.\" dump-date option: mariadb-dump \fB\-\-dump\-date\fR .sp If the \fB\-\-comments\fR option is given, -\fBmysqldump\fR +\fBmariadb-dump\fR produces a comment at the end of the dump of the following form: .sp .if n \{\ @@ -802,8 +802,8 @@ suppresses date printing\& .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-history option -.\" dump-history option: mysqldump +.\" mariadb-dump: dump-history option +.\" dump-history option: mariadb-dump \fB\-\-dump\-history\fR .sp Dump tables with history. Until this option, mariadb-dump could not read historical rows from versioned tables, @@ -818,8 +818,8 @@ and so historical data would not be backed up\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: dump-slave option -.\" dump-slave option: mysqldump +.\" mariadb-dump: dump-slave option +.\" dump-slave option: mariadb-dump \fB\-\-dump\-slave[=\fR\fB\fIvalue\fR\fR\fB]\fR .sp Used for producing a dump file from a replication slave server that can be used to set up another slave server @@ -829,7 +829,7 @@ output; if set to 2, that command will be prefixed with a comment symbol\&. This \-\-lock\-all\-tables on, unless \-\-single-transaction is specified too (in which case a global read lock is only taken a short time at the beginning of the dump \- don't forget to read about \-\-single-transaction below)\&. In all cases any action on logs will happen at the exact moment of the dump\&. Option automatically turns -\-\-lock\-tables off\&. Using this option causes mysqldump to stop the slave SQL thread before beginning the dump, +\-\-lock\-tables off\&. Using this option causes mariadb-dump to stop the slave SQL thread before beginning the dump, and restart it again after completion\&. .RE .sp @@ -841,8 +841,8 @@ and restart it again after completion\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: events option -.\" events option: mysqldump +.\" mariadb-dump: events option +.\" events option: mariadb-dump \fB\-\-events\fR, \fB\-E\fR .sp @@ -857,8 +857,8 @@ Include Event Scheduler events for the dumped databases in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: extended-insert option -.\" extended-insert option: mysqldump +.\" mariadb-dump: extended-insert option +.\" extended-insert option: mariadb-dump \fB\-\-extended\-insert\fR, \fB\-e\fR .sp @@ -877,17 +877,17 @@ lists\&. This results in a smaller dump file and speeds up inserts when the file .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: fields-terminated-by option -.\" fields-terminated-by option: mysqldump +.\" mariadb-dump: fields-terminated-by option +.\" fields-terminated-by option: mariadb-dump \fB\-\-fields\-terminated\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-enclosed-by option -.\" fields-enclosed-by option: mysqldump +.\" mariadb-dump: fields-enclosed-by option +.\" fields-enclosed-by option: mariadb-dump \fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-optionally-enclosed-by option -.\" fields-optionally-enclosed-by option: mysqldump +.\" mariadb-dump: fields-optionally-enclosed-by option +.\" fields-optionally-enclosed-by option: mariadb-dump \fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqldump: fields-escaped-by option -.\" fields-escaped-by option: mysqldump +.\" mariadb-dump: fields-escaped-by option +.\" fields-escaped-by option: mariadb-dump \fB\-\-fields\-escaped\-by=\&.\&.\&.\fR .sp These options are used with the @@ -906,8 +906,8 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: first-slave option -.\" first-slave option: mysqldump +.\" mariadb-dump: first-slave option +.\" first-slave option: mariadb-dump \fB\-\-first\-slave\fR .sp Removed in MariaDB 5.5\&. Use @@ -923,8 +923,8 @@ instead\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: flush-logs option -.\" flush-logs option: mysqldump +.\" mariadb-dump: flush-logs option +.\" flush-logs option: mariadb-dump \fB\-\-flush\-logs\fR, \fB\-F\fR .sp @@ -952,8 +952,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: flush-privileges option -.\" flush-privileges option: mysqldump +.\" mariadb-dump: flush-privileges option +.\" flush-privileges option: mariadb-dump \fB\-\-flush\-privileges\fR .sp Send a @@ -975,21 +975,21 @@ database for proper restoration\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: force option -.\" force option: mysqldump +.\" mariadb-dump: force option +.\" force option: mariadb-dump \fB\-\-force\fR, \fB\-f\fR .sp Continue even if an SQL error occurs during a table dump\&. .sp One use for this option is to cause -\fBmysqldump\fR +\fBmariadb-dump\fR to continue executing even when it encounters a view that has become invalid because the definition refers to a table that has been dropped\&. Without \fB\-\-force\fR, -\fBmysqldump\fR +\fBmariadb-dump\fR exits with an error message\&. With \fB\-\-force\fR, -\fBmysqldump\fR +\fBmariadb-dump\fR prints the error message, but it also writes an SQL comment containing the view definition to the dump output and continues executing\&. .RE .sp @@ -1001,8 +1001,8 @@ prints the error message, but it also writes an SQL comment containing the view .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: gtid option -.\" gtid option: mysqldump +.\" mariadb-dump: gtid option +.\" gtid option: mariadb-dump \fB\-\-gtid\fR .sp Available from MariaDB 10.0.13, and is used together with \fB\-\-master\-data\fR and \fB\-\-dump\-slave\fR to more conveniently set up a new GTID slave\&. It causes those options to output SQL statements that configure the slave to use the global transaction ID to connect to the master instead of old-style filename/offset positions\&. The old-style positions are still included in comments when \fB\-\-gtid\fR is used; likewise the GTID position is included in comments even if \fB\-\-gtid\fR is not used\&. @@ -1016,8 +1016,8 @@ Available from MariaDB 10.0.13, and is used together with \fB\-\-master\-data\fR .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: header option -.\" header option: mysqldump +.\" mariadb-dump: header option +.\" header option: mariadb-dump \fB\-\-header\fR .sp Used together with --tab. When enabled, adds header with column names to the top of output txt files. @@ -1031,8 +1031,8 @@ Used together with --tab. When enabled, adds header with column names to the top .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: hex-blob option -.\" hex-blob option: mysqldump +.\" mariadb-dump: hex-blob option +.\" hex-blob option: mariadb-dump \fB\-\-hex\-blob\fR .sp Dump binary columns using hexadecimal notation (for example, 'abc' becomes @@ -1052,8 +1052,8 @@ BIT\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: host option -.\" host option: mysqldump +.\" mariadb-dump: host option +.\" host option: mariadb-dump \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -1069,8 +1069,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: ignore-table option -.\" ignore-table option: mysqldump +.\" mariadb-dump: ignore-table option +.\" ignore-table option: mariadb-dump \fB\-\-ignore\-table=\fR\fB\fIdb_name\&.tbl_name\fR\fR .sp Do not dump the given table, which must be specified using both the database and table names\&. To ignore multiple tables, use this option multiple times\&. This option also can be used to ignore views\&. @@ -1084,8 +1084,8 @@ Do not dump the given table, which must be specified using both the database and .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: include-master-host-port option -.\" include-master-host-port option: mysqldump +.\" mariadb-dump: include-master-host-port option +.\" include-master-host-port option: mariadb-dump \fB\-\-include\-master\-host\-port\fR .sp Add the MASTER_HOST and MASTER_PORT options for the CHANGE MASTER TO statement when using @@ -1100,8 +1100,8 @@ the \fB--dump-slave\fR option for a slave dump\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: insert-ignore option -.\" insert-ignore option: mysqldump +.\" mariadb-dump: insert-ignore option +.\" insert-ignore option: mariadb-dump \fB\-\-insert\-ignore\fR .sp Write @@ -1119,8 +1119,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lines-terminated-by option -.\" lines-terminated-by option: mysqldump +.\" mariadb-dump: lines-terminated-by option +.\" lines-terminated-by option: mariadb-dump \fB\-\-lines\-terminated\-by=\&.\&.\&.\fR .sp This option is used with the @@ -1139,8 +1139,8 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lock-all-tables option -.\" lock-all-tables option: mysqldump +.\" mariadb-dump: lock-all-tables option +.\" lock-all-tables option: mariadb-dump \fB\-\-lock\-all\-tables\fR, \fB\-x\fR .sp @@ -1158,8 +1158,8 @@ and .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: lock-tables option -.\" lock-tables option: mysqldump +.\" mariadb-dump: lock-tables option +.\" lock-tables option: mariadb-dump \fB\-\-lock\-tables\fR, \fB\-l\fR .sp @@ -1189,8 +1189,8 @@ Use \fB--skip-lock-tables\fR to disable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: log-error option -.\" log-error option: mysqldump +.\" mariadb-dump: log-error option +.\" log-error option: mariadb-dump \fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR .sp Log warnings and errors by appending them to the named file\&. The default is to do no logging\&. @@ -1204,8 +1204,8 @@ Log warnings and errors by appending them to the named file\&. The default is to .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: log-queries option -.\" log-queries option: mysqldump +.\" mariadb-dump: log-queries option +.\" log-queries option: mariadb-dump \fB\-\-log\-queries\fR\fR .sp When restoring the dump, the server will, if logging is turned on, log the queries to the general and slow query log\&. @@ -1220,8 +1220,8 @@ Defaults to on; use \fB--skip-log-queries\fR to disable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: master-data option -.\" master-data option: mysqldump +.\" mariadb-dump: master-data option +.\" master-data option: mariadb-dump \fB\-\-master\-data[=\fR\fB\fIvalue\fR\fR\fB]\fR .sp Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master\&. It causes the dump output to include a @@ -1260,8 +1260,8 @@ Stop the slave's SQL thread and get its current status: .RS 4 .\} .nf -mysql> \fBSTOP SLAVE SQL_THREAD;\fR -mysql> \fBSHOW SLAVE STATUS;\fR +mariadb> \fBSTOP SLAVE SQL_THREAD;\fR +mariadb> \fBSHOW SLAVE STATUS;\fR .fi .if n \{\ .RE @@ -1302,7 +1302,7 @@ Dump the slave server: .RS 4 .\} .nf -shell> \fBmysqldump \-\-master\-data=2 \-\-all\-databases > dumpfile\fR +shell> \fBmariadb-dump \-\-master\-data=2 \-\-all\-databases > dumpfile\fR .fi .if n \{\ .RE @@ -1323,7 +1323,7 @@ Restart the slave: .RS 4 .\} .nf -mysql> \fBSTART SLAVE;\fR +mariadb> \fBSTART SLAVE;\fR .fi .if n \{\ .RE @@ -1344,7 +1344,7 @@ On the new slave, load the dump file: .RS 4 .\} .nf -shell> \fBmysql < dumpfile\fR +shell> \fBmariadb < dumpfile\fR .fi .if n \{\ .RE @@ -1365,7 +1365,7 @@ On the new slave, set the replication coordinates to those of the master server .RS 4 .\} .nf -mysql> \fBCHANGE MASTER TO\fR +mariadb> \fBCHANGE MASTER TO\fR \-> \fBMASTER_LOG_FILE = '\fR\fB\fIfile_name\fR\fR\fB', MASTER_LOG_POS = \fR\fB\fIfile_pos\fR\fR\fB;\fR .fi .if n \{\ @@ -1388,8 +1388,8 @@ to point the slave to the correct master server host\&. Add any such parameters .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: max-allowed-packet option -.\" max-allowed-packet option: mysqldump +.\" mariadb-dump: max-allowed-packet option +.\" max-allowed-packet option: mariadb-dump \fB\-\-max\-allowed\-packet=\fR\fB\fIlength\fR\fR .sp Sets the maximum packet length to send to or receive from server\&. @@ -1403,8 +1403,8 @@ Sets the maximum packet length to send to or receive from server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: max-statement-time option -.\" max-statement-time option: mysqldump +.\" mariadb-dump: max-statement-time option +.\" max-statement-time option: mariadb-dump \fB\-\-max\-statement\-time=\fR\fB\fIseconds\fR\fR .sp Sets the maximum time any statement can run before being timed out by the server. (Default value is 0 (no limit))\& @@ -1418,8 +1418,8 @@ Sets the maximum time any statement can run before being timed out by the server .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: net-buffer-length option -.\" net-buffer-length option: mysqldump +.\" mariadb-dump: net-buffer-length option +.\" net-buffer-length option: mariadb-dump \fB\-\-net\-buffer\-length=\fR\fB\fIlength\fR\fR .sp Sets the buffer size for TCP/IP and socket communication\&. @@ -1433,8 +1433,8 @@ Sets the buffer size for TCP/IP and socket communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-autocommit option -.\" no-autocommit option: mysqldump +.\" mariadb-dump: no-autocommit option +.\" no-autocommit option: mariadb-dump \fB\-\-no\-autocommit\fR .sp Enclose the @@ -1454,8 +1454,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-create-db option -.\" no-create-db option: mysqldump +.\" mariadb-dump: no-create-db option +.\" no-create-db option: mariadb-dump \fB\-\-no\-create\-db\fR, \fB\-n\fR .sp @@ -1476,8 +1476,8 @@ option is given\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-create-info option -.\" no-create-info option: mysqldump +.\" mariadb-dump: no-create-info option +.\" no-create-info option: mariadb-dump \fB\-\-no\-create\-info\fR, \fB\-t\fR .sp @@ -1494,8 +1494,8 @@ statements that re\-create each dumped table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-data option -.\" no-data option: mysqldump +.\" mariadb-dump: no-data option +.\" no-data option: mariadb-dump \fB\-\-no\-data\fR, \fB\-d\fR .sp @@ -1512,8 +1512,8 @@ statement for the table (for example, to create an empty copy of the table by lo .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-defaults option -.\" no-defaults option: mysqldump +.\" mariadb-dump: no-defaults option +.\" no-defaults option: mariadb-dump \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -1527,8 +1527,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: no-set-names option -.\" no-set-names option: mysqldump +.\" mariadb-dump: no-set-names option +.\" no-set-names option: mariadb-dump \fB\-\-no\-set\-names\fR, \fB\-N\fR .sp @@ -1544,8 +1544,8 @@ This has the same effect as .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: opt option -.\" opt option: mysqldump +.\" mariadb-dump: opt option +.\" opt option: mariadb-dump \fB\-\-opt\fR .sp This option is shorthand\&. It is the same as specifying @@ -1571,8 +1571,8 @@ See the discussion at the beginning of this section for information about select .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: order-by-primary option -.\" order-by-primary option: mysqldump +.\" mariadb-dump: order-by-primary option +.\" order-by-primary option: mariadb-dump \fB\-\-order\-by\-primary\fR .sp Dump each table's rows sorted by its primary key, or by its first unique index, if such an index exists\&. This is useful when dumping a @@ -1590,8 +1590,8 @@ table, but will make the dump operation take considerably longer\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: order-by-size option -.\" order-by-size option: mysqldump +.\" mariadb-dump: order-by-size option +.\" order-by-size option: mariadb-dump \fB\-\-order\-by\-size\fR .sp Dump each table according to their size, smallest first. Useful when using \-\-single-transaction on tables @@ -1608,8 +1608,8 @@ and by dumping those first, this reduces the chance that a \-\-single-transactio .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: parallel option -.\" parallel option: mysqldump +.\" mariadb-dump: parallel option +.\" parallel option: mariadb-dump \fB\-\-parallel=#\fR, \fB\-j\fR .sp @@ -1628,8 +1628,8 @@ adding more parallel jobs does not bring better performance. .IP \(bu 2.3 .\} -.\" mysqldump: password option -.\" password option: mysqldump +.\" mariadb-dump: password option +.\" password option: mariadb-dump \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -1642,7 +1642,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqldump\fR +\fBmariadb-dump\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -1656,8 +1656,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: pipe option -.\" pipe option: mysqldump +.\" mariadb-dump: pipe option +.\" pipe option: mariadb-dump \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -1672,8 +1672,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: plugin-dir option -.\" plugin-dir option: mysqldump +.\" mariadb-dump: plugin-dir option +.\" plugin-dir option: mariadb-dump \fB\-\-plugin\-dir\fR .sp Directory for client-side plugins\&. @@ -1687,8 +1687,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: port option -.\" port option: mysqldump +.\" mariadb-dump: port option +.\" port option: mariadb-dump \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -1704,8 +1704,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: protocol option -.\" protocol option: mysqldump +.\" mariadb-dump: protocol option +.\" protocol option: mariadb-dump \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -1719,13 +1719,13 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: quick option -.\" quick option: mysqldump +.\" mariadb-dump: quick option +.\" quick option: mariadb-dump \fB\-\-quick\fR, \fB\-q\fR .sp This option is useful for dumping large tables\&. It forces -\fBmysqldump\fR +\fBmariadb-dump\fR to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out\&. .RE .sp @@ -1737,8 +1737,8 @@ to retrieve rows for a table from the server a row at a time rather than retriev .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: print-defaults option -.\" print-defaults option: mysqldump +.\" mariadb-dump: print-defaults option +.\" print-defaults option: mariadb-dump \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -1752,8 +1752,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: quote-names option -.\" quote-names option: mysqldump +.\" mariadb-dump: quote-names option +.\" quote-names option: mariadb-dump \fB\-\-quote\-names\fR, \fB\-Q\fR .sp @@ -1778,8 +1778,8 @@ that may enable .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: replace option -.\" replace option: mysqldump +.\" mariadb-dump: replace option +.\" replace option: mariadb-dump \fB\-\-replace\fR .sp Write @@ -1797,8 +1797,8 @@ statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: result-file option -.\" result-file option: mysqldump +.\" mariadb-dump: result-file option +.\" result-file option: mariadb-dump \fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR, \fB\-r \fR\fB\fIfile_name\fR\fR .sp @@ -1817,8 +1817,8 @@ carriage return/newline sequences\&. The result file is created and its previous .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: routines option -.\" routines option: mysqldump +.\" mariadb-dump: routines option +.\" routines option: mariadb-dump \fB\-\-routines\fR, \fB\-R\fR .sp @@ -1851,8 +1851,8 @@ database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: set-charset option -.\" set-charset option: mysqldump +.\" mariadb-dump: set-charset option +.\" set-charset option: mariadb-dump \fB\-\-set\-charset\fR .sp Add @@ -1871,8 +1871,8 @@ statement, use .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: single-transaction option -.\" single-transaction option: mysqldump +.\" mariadb-dump: single-transaction option +.\" single-transaction option: mariadb-dump \fB\-\-single\-transaction\fR .sp This option sends a @@ -1900,7 +1900,7 @@ RENAME TABLE, TRUNCATE TABLE\&. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the SELECT that is performed by -\fBmysqldump\fR +\fBmariadb-dump\fR to retrieve the table contents to obtain incorrect contents or fail\&. .sp The @@ -1925,8 +1925,8 @@ option with .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-add-drop-table option -.\" skip-add-drop-table option: mysqldump +.\" mariadb-dump: skip-add-drop-table option +.\" skip-add-drop-table option: mariadb-dump \fB\-\-skip\-add\-drop\-table\fR .sp Disable the @@ -1942,8 +1942,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-add-locks option -.\" skip-add-locks option: mysqldump +.\" mariadb-dump: skip-add-locks option +.\" skip-add-locks option: mariadb-dump \fB\-\-skip\-add\-locks\fR .sp Disable the @@ -1959,8 +1959,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-comments option -.\" skip-comments option: mysqldump +.\" mariadb-dump: skip-comments option +.\" skip-comments option: mariadb-dump \fB\-\-skip\-comments\fR .sp Disable the @@ -1976,8 +1976,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-compact option -.\" skip-compact option: mysqldump +.\" mariadb-dump: skip-compact option +.\" skip-compact option: mariadb-dump \fB\-\-skip\-compact\fR .sp Disable the @@ -1993,8 +1993,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-disable-keys option -.\" skip-disable-keys option: mysqldump +.\" mariadb-dump: skip-disable-keys option +.\" skip-disable-keys option: mariadb-dump \fB\-\-skip\-disable\-keys\fR .sp Disable the @@ -2010,8 +2010,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-extended-insert option -.\" skip-extended-insert option: mysqldump +.\" mariadb-dump: skip-extended-insert option +.\" skip-extended-insert option: mariadb-dump \fB\-\-skip\-extended\-insert\fR .sp Disable the @@ -2027,8 +2027,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-opt option -.\" skip-opt option: mysqldump +.\" mariadb-dump: skip-opt option +.\" skip-opt option: mariadb-dump \fB\-\-skip\-opt\fR .sp Disable the @@ -2044,8 +2044,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-quick option -.\" skip-quick option: mysqldump +.\" mariadb-dump: skip-quick option +.\" skip-quick option: mariadb-dump \fB\-\-skip\-quick\fR .sp Disable the @@ -2061,8 +2061,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-quote-names option -.\" skip-quote-names option: mysqldump +.\" mariadb-dump: skip-quote-names option +.\" skip-quote-names option: mariadb-dump \fB\-\-skip\-quote\-names\fR .sp Disable the @@ -2078,8 +2078,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-set-charset option -.\" skip-set-charset option: mysqldump +.\" mariadb-dump: skip-set-charset option +.\" skip-set-charset option: mariadb-dump \fB\-\-skip\-set\-charset\fR .sp Disable the @@ -2095,8 +2095,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-triggers option -.\" skip-triggers option: mysqldump +.\" mariadb-dump: skip-triggers option +.\" skip-triggers option: mariadb-dump \fB\-\-skip\-triggers\fR .sp Disable the @@ -2112,8 +2112,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: skip-tz-utc option -.\" skip-tz-utc option: mysqldump +.\" mariadb-dump: skip-tz-utc option +.\" skip-tz-utc option: mariadb-dump \fB\-\-skip\-tz\-utc\fR .sp Disable the @@ -2129,8 +2129,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: socket option -.\" socket option: mysqldump +.\" mariadb-dump: socket option +.\" socket option: mariadb-dump \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -2147,8 +2147,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-admin: SSL options +.\" SSL options: mariadb-admin \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -2163,8 +2163,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-admin: SSL CA option +.\" SSL CA option: mariadb-admin \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -2179,8 +2179,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-admin: SSL CA Path option +.\" SSL CA Path option: mariadb-admin \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -2195,8 +2195,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-admin: SSL Cert option +.\" SSL Cert option: mariadb-admin \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -2211,8 +2211,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-admin: SSL Cipher option +.\" SSL Cipher option: mariadb-admin \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -2227,8 +2227,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-admin: SSL Key option +.\" SSL Key option: mariadb-admin \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -2243,8 +2243,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-admin: SSL Crl option +.\" SSL CRL option: mariadb-admin \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -2259,8 +2259,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-admin: SSL Crlpath option +.\" SSL Crlpath option: mariadb-admin \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -2275,8 +2275,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-admin: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-admin \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -2290,8 +2290,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: Dump system tables option -.\" Dump system tables option: mysqladmin +.\" mariadb-admin: Dump system tables option +.\" Dump system tables option: mariadb-admin \fB\-\-system=\fR\fB\fI{all, users, plugins, udfs, servers, stats, timezones}\fR\fR .sp Dump the system tables in the mysql database in a logical form\&. This option is an empty set by default\&. @@ -2393,13 +2393,13 @@ To help in migrating from MySQL to MariaDB, this option is designed to be able t .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tab option -.\" tab option: mysqldump +.\" mariadb-dump: tab option +.\" tab option: mariadb-dump \fB\-\-tab=\fR\fB\fIpath\fR\fR, \fB\-T \fR\fB\fIpath\fR\fR .sp Produce tab\-separated text\-format data files\&. For each dumped table, -\fBmysqldump\fR +\fBmariadb-dump\fR creates a \fItbl_name\fR\&.sql file that contains the @@ -2420,9 +2420,9 @@ file that contains its data\&. The option value is the directory in which to wri .ps -1 .br This option should be used only when -\fBmysqldump\fR +\fBmariadb-dump\fR is run on the same machine as the -\fBmysqld\fR +\fBmariadbd\fR server\&. You must have the FILE privilege, and the server must have permission to write files in the directory that you specify\&. @@ -2449,8 +2449,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tables option -.\" tables option: mysqldump +.\" mariadb-dump: tables option +.\" tables option: mariadb-dump \fB\-\-tables\fR .sp Override the @@ -2458,7 +2458,7 @@ Override the or \fB\-B\fR option\&. -\fBmysqldump\fR +\fBmariadb-dump\fR regards all name arguments following the option as table names\&. .RE .sp @@ -2470,8 +2470,8 @@ regards all name arguments following the option as table names\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: triggers option -.\" triggers option: mysqldump +.\" mariadb-dump: triggers option +.\" triggers option: mariadb-dump \fB\-\-triggers\fR .sp Include triggers for each dumped table in the output\&. This option is enabled by default; disable it with @@ -2486,14 +2486,14 @@ Include triggers for each dumped table in the output\&. This option is enabled b .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: tz-utc option -.\" tz-utc option: mysqldump +.\" mariadb-dump: tz-utc option +.\" tz-utc option: mariadb-dump \fB\-\-tz\-utc\fR .sp This option enables TIMESTAMP columns to be dumped and reloaded between servers in different time zones\&. -\fBmysqldump\fR +\fBmariadb-dump\fR sets its connection time zone to UTC and adds SET TIME_ZONE='+00:00' to the dump file\&. Without this option, @@ -2514,8 +2514,8 @@ is enabled by default\&. To disable it, use .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: user option -.\" user option: mysqldump +.\" mariadb-dump: user option +.\" user option: mariadb-dump \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -2530,8 +2530,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: verbose option -.\" verbose option: mysqldump +.\" mariadb-dump: verbose option +.\" verbose option: mariadb-dump \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -2546,8 +2546,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: version option -.\" version option: mysqldump +.\" mariadb-dump: version option +.\" version option: mariadb-dump \fB\-\-version\fR, \fB\-V\fR .sp @@ -2562,8 +2562,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: where option -.\" where option: mysqldump +.\" mariadb-dump: where option +.\" where option: mariadb-dump \fB\-\-where='\fR\fB\fIwhere_condition\fR\fR\fB'\fR, \fB\-w '\fR\fB\fIwhere_condition\fR\fR\fB'\fR .sp @@ -2594,8 +2594,8 @@ Examples: .sp -1 .IP \(bu 2.3 .\} -.\" mysqldump: xml option -.\" xml option: mysqldump +.\" mariadb-dump: xml option +.\" xml option: mariadb-dump \fB\-\-xml\fR, \fB\-X\fR .sp @@ -2630,23 +2630,23 @@ T} .TE .sp 1 The output from the -\fBmysql\fR +\fBmariadb\fR client when run using the \fB\-\-xml\fR option also follows the preceding rules\&. (See -the section called \(lqMYSQL OPTIONS\(rq\&.) +the section called \(lqMARIADB OPTIONS\(rq\&.) .sp XML output from -\fBmysqldump\fR +\fBmariadb-dump\fR includes the XML namespace, as shown here: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-xml \-u root world City\fR +shell> \fBmariadb-dump \-\-xml \-u root world City\fR - + @@ -2680,7 +2680,7 @@ Collation="latin1_swedish_ci" Create_options="" Comment="" /> - + .fi .if n \{\ .RE @@ -2737,7 +2737,7 @@ statements (as with the or \fB\-\-opt\fR option), -\fBmysqldump\fR +\fBmariadb-dump\fR creates rows up to net_buffer_length length\&. If you increase this variable, you should also ensure that the @@ -2746,14 +2746,14 @@ variable in the MariaDB server is at least this large\&. .RE .PP A common use of -\fBmysqldump\fR +\fBmariadb-dump\fR is for making a backup of an entire database: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file\&.sql\fR\fR +shell> \fBmariadb-dump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file\&.sql\fR\fR .fi .if n \{\ .RE @@ -2765,7 +2765,7 @@ You can load the dump file back into the server like this: .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file\&.sql\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file\&.sql\fR\fR .fi .if n \{\ .RE @@ -2777,20 +2777,20 @@ Or like this: .RS 4 .\} .nf -shell> \fBmysql \-e "source \fR\fB\fI/path\-to\-backup/backup\-file\&.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \-e "source \fR\fB\fI/path\-to\-backup/backup\-file\&.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE .\} .PP -\fBmysqldump\fR +\fBmariadb-dump\fR is also very useful for populating databases by copying data from one MariaDB server to another: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-opt \fR\fB\fIdb_name\fR\fR\fB | mysql \-\-host=\fR\fB\fIremote_host\fR\fR\fB \-C \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb-dump \-\-opt \fR\fB\fIdb_name\fR\fR\fB | mariadb \-\-host=\fR\fB\fIremote_host\fR\fR\fB \-C \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -2802,7 +2802,7 @@ It is possible to dump several databases with one command: .RS 4 .\} .nf -shell> \fBmysqldump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \&.\&.\&.] > my_databases\&.sql\fR +shell> \fBmariadb-dump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \&.\&.\&.] > my_databases\&.sql\fR .fi .if n \{\ .RE @@ -2816,7 +2816,7 @@ option: .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2825,14 +2825,14 @@ shell> \fBmysqldump \-\-all\-databases > all_databases\&.sql\fR For InnoDB tables, -\fBmysqldump\fR +\fBmariadb-dump\fR provides a way of making an online backup: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2851,7 +2851,7 @@ when you need to restore an old backup and replay the changes that happened sinc .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-master\-data=2 > all_databases\&.sql\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-master\-data=2 > all_databases\&.sql\fR .fi .if n \{\ .RE @@ -2863,7 +2863,7 @@ Or: .RS 4 .\} .nf -shell> \fBmysqldump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR +shell> \fBmariadb-dump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR \fB> all_databases\&.sql\fR .fi .if n \{\ @@ -2878,15 +2878,15 @@ options can be used simultaneously, which provides a convenient way to make an o InnoDB storage engine\&. .PP -.\" mysqldump: views -.\" mysqldump: problems -.\" mysqldump: workarounds +.\" mariadb-dump: views +.\" mariadb-dump: problems +.\" mariadb-dump: workarounds .PP If you encounter problems backing up views, please read the section that covers restrictions on views which describes a workaround for backing up views when this fails due to insufficient privileges\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dumpslow.1 b/man/mariadb-dumpslow.1 index 960c634dded..d7d575e06e5 100644 --- a/man/mariadb-dumpslow.1 +++ b/man/mariadb-dumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMPSLOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-DUMPSLOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,20 +11,20 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqldumpslow +.\" mariadb-dumpslow .SH "NAME" -mariadb-dumpslow \- Summarize slow query log files (mysqldumpslow is now a symlink to mariadb-dumpslow) +mariadb-dumpslow \- Summarize slow query log files (mariadb-dumpslow is now a symlink to mariadb-dumpslow) .SH "SYNOPSIS" -.HP \w'\fBmysqldumpslow\ [\fR\fBoptions\fR\fB]\ [\fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.]\fR\ 'u -\fBmysqldumpslow [\fR\fBoptions\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR +.HP \w'\fBmariadb-dumpslow\ [\fR\fBoptions\fR\fB]\ [\fR\fB\fIlog_file\fR\fR\fB\ \&.\&.\&.]\fR\ 'u +\fBmariadb-dumpslow [\fR\fBoptions\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR .SH "DESCRIPTION" .PP The MariaDB slow query log contains information about queries that take a long time to execute\&. -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR parses MariaDB slow query log files and prints a summary of their contents\&. .PP Normally, -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR groups queries that are similar except for the particular values of number and string data values\&. It \(lqabstracts\(rq these values to N and 'S' when displaying summary output\&. The @@ -34,20 +34,20 @@ and options can be used to modify value abstracting behavior\&. .PP Invoke -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqldumpslow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-dumpslow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE .\} .PP -\fBmysqldumpslow\fR +\fBmariadb-dumpslow\fR supports the following options\&. .sp .RS 4 @@ -58,8 +58,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: help option -.\" help option: mysqldumpslow +.\" mariadb-dumpslow: help option +.\" help option: mariadb-dumpslow \fB\-\-help\fR .sp Display a help message and exit\&. @@ -86,8 +86,8 @@ Do not abstract all numbers to N and strings to 'S'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: debug option -.\" debug option: mysqldumpslow +.\" mariadb-dumpslow: debug option +.\" debug option: mariadb-dumpslow \fB\-\-debug\fR, \fB\-d\fR .sp @@ -135,7 +135,7 @@ file name\&. The value can contain a wildcard\&. The default is \fB\-i \fR\fB\fIname\fR\fR .sp Name of server instance (if using -\fBmysql\&.server\fR +\fBmariadb\&.server\fR startup script)\&. .RE .sp @@ -289,8 +289,8 @@ queries in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqldumpslow: verbose option -.\" verbose option: mysqldumpslow +.\" mariadb-dumpslow: verbose option +.\" verbose option: mariadb-dumpslow \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -303,8 +303,8 @@ Example of usage: .RS 4 .\} .nf -shell> \fBmysqldumpslow\fR -Reading mysql slow query log from /usr/local/mysql/data/mysqld51\-apple\-slow\&.log +shell> \fBmariadb-dumpslow\fR +Reading mariadb slow query log from /usr/local/mysql/data/mysqld51\-apple\-slow\&.log Count: 1 Time=4\&.32s (4s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@localhost insert into t2 select * from t1 Count: 3 Time=2\&.53s (7s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@localhost @@ -318,7 +318,7 @@ Count: 3 Time=2\&.13s (6s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@local .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-find-rows.1 b/man/mariadb-find-rows.1 index c80490c23f0..d93972f016b 100644 --- a/man/mariadb-find-rows.1 +++ b/man/mariadb-find-rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIND-ROWS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-FIND-ROWS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,15 +11,15 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_find_rows +.\" mariadb-find-rows .SH "NAME" -mariadb-find-rows \- extract SQL statements from files (mysql_find_rows is now a symlink to mariadb-find-rows) +mariadb-find-rows \- extract SQL statements from files (mariadb-find-rows is now a symlink to mariadb-find-rows) .SH "SYNOPSIS" -.HP \w'\fBmysql_find_rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u -\fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR +.HP \w'\fBmariadb-find-rows\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIfile_name\fR\fR\fB\ \&.\&.\&.]\fR\ 'u +\fBmariadb-find-rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR .SH "DESCRIPTION" .PP -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR reads files containing SQL statements and extracts statements that match a given regular expression or that contain USE \fIdb_name\fR or @@ -27,14 +27,14 @@ SET statements\&. The utility was written for use with update log files (as used prior to MySQL 5\&.0) and as such expects statements to be terminated with semicolon (;) characters\&. It may be useful with other files that contain SQL statements as long as statements are terminated with semicolons\&. .PP Invoke -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-find-rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE @@ -43,7 +43,7 @@ shell> \fBmysql_find_rows [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIfile_name\fR\fR\ Each \fIfile_name\fR argument should be the name of file containing SQL statements\&. If no file names are given, -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR reads the standard input\&. .PP Examples: @@ -52,14 +52,14 @@ Examples: .RS 4 .\} .nf -mysql_find_rows \-\-regexp=problem_table \-\-rows=20 < update\&.log -mysql_find_rows \-\-regexp=problem_table update\-log\&.1 update\-log\&.2 +mariadb-find-rows \-\-regexp=problem_table \-\-rows=20 < update\&.log +mariadb-find-rows \-\-regexp=problem_table update\-log\&.1 update\-log\&.2 .fi .if n \{\ .RE .\} .PP -\fBmysql_find_rows\fR +\fBmariadb-find-rows\fR supports the following options: .sp .RS 4 @@ -70,8 +70,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: help option -.\" help option: mysql_find_rows +.\" mariadb-find-rows: help option +.\" help option: mariadb-find-rows \fB\-\-help\fR, \fB\-\-Information\fR .sp @@ -86,8 +86,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: regexp option -.\" regexp option: mysql_find_rows +.\" mariadb-find-rows: regexp option +.\" regexp option: mariadb-find-rows \fB\-\-regexp=\fR\fB\fIpattern\fR\fR .sp Display queries that match the pattern\&. @@ -101,8 +101,8 @@ Display queries that match the pattern\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: rows option -.\" rows option: mysql_find_rows +.\" mariadb-find-rows: rows option +.\" rows option: mariadb-find-rows \fB\-\-rows=\fR\fB\fIN\fR\fR .sp Quit after displaying @@ -118,8 +118,8 @@ queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: skip-use-db option -.\" skip-use-db option: mysql_find_rows +.\" mariadb-find-rows: skip-use-db option +.\" skip-use-db option: mariadb-find-rows \fB\-\-skip\-use\-db\fR .sp Do not include @@ -135,8 +135,8 @@ statements in the output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_find_rows: start_row option -.\" start_row option: mysql_find_rows +.\" mariadb-find-rows: start_row option +.\" start_row option: mariadb-find-rows \fB\-\-start_row=\fR\fB\fIN\fR\fR .sp Start output from this row\&. @@ -144,7 +144,7 @@ Start output from this row\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-fix-extensions.1 b/man/mariadb-fix-extensions.1 index 2313b9f6586..14e6975ac88 100644 --- a/man/mariadb-fix-extensions.1 +++ b/man/mariadb-fix-extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_fix_extensions +.\" mariadb-fix-extensions .SH "NAME" -mariadb-fix-extensions \- normalize table file name extensions (mysql_fix_extensions is now a symlink to mariadb-fix-extensions) +mariadb-fix-extensions \- normalize table file name extensions (mariadb-fix-extensions is now a symlink to mariadb-fix-extensions) .SH "SYNOPSIS" -.HP \w'\fBmysql_fix_extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u -\fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR +.HP \w'\fBmariadb-fix-extensions\ \fR\fB\fIdata_dir\fR\fR\ 'u +\fBmariadb-fix-extensions \fR\fB\fIdata_dir\fR\fR .SH "DESCRIPTION" .PP This script is deprecated and will be removed in a later release. .PP -\fBmysql_fix_extensions\fR +\fBmariadb-fix-extensions\fR converts the extensions for MyISAM (or @@ -39,16 +39,16 @@ and renames them to have extensions of \&.ISM, respectively\&. This can be useful after transferring the files from a system with case\-insensitive file names (such as Windows) to a system with case\-sensitive file names\&. .PP Invoke -\fBmysql_fix_extensions\fR +\fBmariadb-fix-extensions\fR like this, where \fIdata_dir\fR -is the path name to the MySQL data directory\&. +is the path name to the MariaDB data directory\&. .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR +shell> \fBmariadb-fix-extensions \fR\fB\fIdata_dir\fR\fR .fi .if n \{\ .RE @@ -56,7 +56,7 @@ shell> \fBmysql_fix_extensions \fR\fB\fIdata_dir\fR\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-hotcopy.1 b/man/mariadb-hotcopy.1 index 01f26c15ab5..94e4f9c1005 100644 --- a/man/mariadb-hotcopy.1 +++ b/man/mariadb-hotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-HOTCOPY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-HOTCOPY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,19 +11,19 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlhotcopy +.\" mariadb-hotcopy .\" dumping: databases and tables .\" backups: databases and tables .\" databases: dumping .\" tables: dumping .SH "NAME" -mariadb-hotcopy \- a database backup program (mysqlhotcopy is now a symlink to mariadb-hotcopy) +mariadb-hotcopy \- a database backup program (mariadb-hotcopy is now a symlink to mariadb-hotcopy) .SH "SYNOPSIS" -.HP \w'\fBmysqlhotcopy\ \fR\fB\fIarguments\fR\fR\ 'u -\fBmysqlhotcopy \fR\fB\fIarguments\fR\fR +.HP \w'\fBmariadb-hotcopy\ \fR\fB\fIarguments\fR\fR\ 'u +\fBmariadb-hotcopy \fR\fB\fIarguments\fR\fR .SH "DESCRIPTION" .PP -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR is a Perl script that was originally written and contributed by Tim Bunce\&. It uses FLUSH TABLES, LOCK TABLES, and @@ -31,7 +31,7 @@ cp or scp to make a database backup\&. It is a fast way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located\&. -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR works only for backing up MyISAM and @@ -39,7 +39,7 @@ ARCHIVE tables\&. It runs on Unix and NetWare\&. .PP To use -\fBmysqlhotcopy\fR, you must have read access to the files for the tables that you are backing up, the +\fBmariadb-hotcopy\fR, you must have read access to the files for the tables that you are backing up, the SELECT privilege for those tables, the RELOAD @@ -52,7 +52,7 @@ privilege (to be able to lock the tables)\&. .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_directory\fR\fR\fB]\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_directory\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -62,7 +62,7 @@ shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fI/path/to/new_director .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name_1\fR\fR\fB \&.\&.\&. \fR\fB\fIdb_name_n\fR\fR\fB \fR\fB\fI/path/to/new_directory\fR\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name_1\fR\fR\fB \&.\&.\&. \fR\fB\fIdb_name_n\fR\fR\fB \fR\fB\fI/path/to/new_directory\fR\fR .fi .if n \{\ .RE @@ -74,7 +74,7 @@ Back up tables in the given database that match a regular expression: .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB\&./\fR\fB\fIregex\fR\fR\fB/\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB\&./\fR\fB\fIregex\fR\fR\fB/\fR .fi .if n \{\ .RE @@ -86,15 +86,15 @@ The regular expression for the table name can be negated by prefixing it with a .RS 4 .\} .nf -shell> \fBmysqlhotcopy \fR\fB\fIdb_name\fR\fR\fB\&./~\fR\fB\fIregex\fR\fR\fB/\fR +shell> \fBmariadb-hotcopy \fR\fB\fIdb_name\fR\fR\fB\&./~\fR\fB\fIregex\fR\fR\fB/\fR .fi .if n \{\ .RE .\} .PP -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR supports the following options, which can be specified on the command line or in the -[mysqlhotcopy] +[mariadb-hotcopy] and [client] option file groups\&. @@ -107,8 +107,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: help option -.\" help option: mysqlhotcopy +.\" mariadb-hotcopy: help option +.\" help option: mariadb-hotcopy \fB\-\-help\fR, \fB\-?\fR .sp @@ -123,8 +123,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: addtodest option -.\" addtodest option: mysqlhotcopy +.\" mariadb-hotcopy: addtodest option +.\" addtodest option: mariadb-hotcopy \fB\-\-addtodest\fR .sp Do not rename target directory (if it exists); merely add files to it\&. @@ -138,8 +138,8 @@ Do not rename target directory (if it exists); merely add files to it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: allowold option -.\" allowold option: mysqlhotcopy +.\" mariadb-hotcopy: allowold option +.\" allowold option: mariadb-hotcopy \fB\-\-allowold\fR .sp Do not abort if a target exists; rename it by adding an @@ -155,8 +155,8 @@ suffix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: checkpoint option -.\" checkpoint option: mysqlhotcopy +.\" mariadb-hotcopy: checkpoint option +.\" checkpoint option: mariadb-hotcopy \fB\-\-checkpoint=\fR\fB\fIdb_name\fR\fR\fB\&.\fR\fB\fItbl_name\fR\fR .sp Insert checkpoint entries into the specified database @@ -173,20 +173,20 @@ and table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: chroot option -.\" chroot option: mysqlhotcopy +.\" mariadb-hotcopy: chroot option +.\" chroot option: mariadb-hotcopy \fB\-\-chroot=\fR\fB\fIpath\fR\fR .sp Base directory of the \fBchroot\fR jail in which -\fBmysqld\fR +\fBmariadbd\fR operates\&. The \fIpath\fR value should match that of the \fB\-\-chroot\fR option given to -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .RE .sp .RS 4 @@ -197,8 +197,8 @@ option given to .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: debug option -.\" debug option: mysqlhotcopy +.\" mariadb-hotcopy: debug option +.\" debug option: mariadb-hotcopy \fB\-\-debug\fR .sp Enable debug output\&. @@ -212,8 +212,8 @@ Enable debug output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: dryrun option -.\" dryrun option: mysqlhotcopy +.\" mariadb-hotcopy: dryrun option +.\" dryrun option: mariadb-hotcopy \fB\-\-dryrun\fR, \fB\-n\fR .sp @@ -228,8 +228,8 @@ Report actions without performing them\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: flushlog option -.\" flushlog option: mysqlhotcopy +.\" mariadb-hotcopy: flushlog option +.\" flushlog option: mariadb-hotcopy \fB\-\-flushlog\fR .sp Flush logs after all tables are locked\&. @@ -243,8 +243,8 @@ Flush logs after all tables are locked\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: host option -.\" host option: mysqlhotcopy +.\" mariadb-hotcopy: host option +.\" host option: mariadb-hotcopy \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -261,8 +261,8 @@ using a Unix socket file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: keepold option -.\" keepold option: mysqlhotcopy +.\" mariadb-hotcopy: keepold option +.\" keepold option: mariadb-hotcopy \fB\-\-keepold\fR .sp Do not delete previous (renamed) target when done\&. @@ -276,8 +276,8 @@ Do not delete previous (renamed) target when done\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: method option -.\" method option: mysqlhotcopy +.\" mariadb-hotcopy: method option +.\" method option: mariadb-hotcopy \fB\-\-method=\fR\fB\fIcommand\fR\fR .sp The method for copying files (cp @@ -294,8 +294,8 @@ cp\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: noindices option -.\" noindices option: mysqlhotcopy +.\" mariadb-hotcopy: noindices option +.\" noindices option: mariadb-hotcopy \fB\-\-noindices\fR .sp Do not include full index files for @@ -312,8 +312,8 @@ tables in the backup\&. This makes the backup smaller and faster\&. The indexes .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: old-server option -.\" old-server option: mysqlhotcopy +.\" mariadb-hotcopy: old-server option +.\" old-server option: mariadb-hotcopy \fB\-\-old\-server\fR .sp Connect to old MySQL-server (before v5.5) which doesn't have FLUSH TABLES WITH READ LOCK fully implemented.\&. @@ -327,8 +327,8 @@ Connect to old MySQL-server (before v5.5) which doesn't have FLUSH TABLES WITH R .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: password option -.\" password option: mysqlhotcopy +.\" mariadb-hotcopy: password option +.\" password option: mariadb-hotcopy \fB\-\-password=\fR\fB\fIpassword\fR\fR, \fB\-p\fR\fB\fIpassword\fR\fR .sp @@ -345,8 +345,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: port option -.\" port option: mysqlhotcopy +.\" mariadb-hotcopy: port option +.\" port option: mariadb-hotcopy \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -361,8 +361,8 @@ The TCP/IP port number to use when connecting to the local server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: quiet option -.\" quiet option: mysqlhotcopy +.\" mariadb-hotcopy: quiet option +.\" quiet option: mariadb-hotcopy \fB\-\-quiet\fR, \fB\-q\fR .sp @@ -377,8 +377,8 @@ Be silent except for errors\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: record_log_pos option -.\" record_log_pos option: mysqlhotcopy +.\" mariadb-hotcopy: record_log_pos option +.\" record_log_pos option: mariadb-hotcopy \fB\-\-record_log_pos=\fR\fB\fIdb_name\fR\fR\fB\&.\fR\fB\fItbl_name\fR\fR .sp Record master and slave status in the specified database @@ -395,8 +395,8 @@ and table .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: regexp option -.\" regexp option: mysqlhotcopy +.\" mariadb-hotcopy: regexp option +.\" regexp option: mariadb-hotcopy \fB\-\-regexp=\fR\fB\fIexpr\fR\fR .sp Copy all databases with names that match the given regular expression\&. @@ -410,8 +410,8 @@ Copy all databases with names that match the given regular expression\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: resetmaster option -.\" resetmaster option: mysqlhotcopy +.\" mariadb-hotcopy: resetmaster option +.\" resetmaster option: mariadb-hotcopy \fB\-\-resetmaster\fR .sp Reset the binary log after locking all the tables\&. @@ -425,8 +425,8 @@ Reset the binary log after locking all the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: resetslave option -.\" resetslave option: mysqlhotcopy +.\" mariadb-hotcopy: resetslave option +.\" resetslave option: mariadb-hotcopy \fB\-\-resetslave\fR .sp Reset the @@ -442,8 +442,8 @@ file after locking all the tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: socket option -.\" socket option: mysqlhotcopy +.\" mariadb-hotcopy: socket option +.\" socket option: mariadb-hotcopy \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -459,8 +459,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: suffix option -.\" suffix option: mysqlhotcopy +.\" mariadb-hotcopy: suffix option +.\" suffix option: mariadb-hotcopy \fB\-\-suffix=\fR\fB\fIstr\fR\fR .sp The suffix to use for names of copied databases\&. @@ -474,8 +474,8 @@ The suffix to use for names of copied databases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: tmpdir option -.\" tmpdir option: mysqlhotcopy +.\" mariadb-hotcopy: tmpdir option +.\" tmpdir option: mariadb-hotcopy \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR .sp The temporary directory\&. The default is @@ -490,8 +490,8 @@ The temporary directory\&. The default is .sp -1 .IP \(bu 2.3 .\} -.\" mysqlhotcopy: user option -.\" user option: mysqlhotcopy +.\" mariadb-hotcopy: user option +.\" user option: mariadb-hotcopy \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -501,7 +501,7 @@ The MariaDB user name to use when connecting to the server\&. Use perldoc for additional -\fBmysqlhotcopy\fR +\fBmariadb-hotcopy\fR documentation, including information about the structure of the tables needed for the \fB\-\-checkpoint\fR and @@ -512,7 +512,7 @@ options: .RS 4 .\} .nf -shell> \fBperldoc mysqlhotcopy\fR +shell> \fBperldoc mariadb-hotcopy\fR .fi .if n \{\ .RE @@ -520,7 +520,7 @@ shell> \fBperldoc mysqlhotcopy\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-import.1 b/man/mariadb-import.1 index 99578950ad3..2c23aca8d17 100644 --- a/man/mariadb-import.1 +++ b/man/mariadb-import.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-IMPORT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-IMPORT\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,44 +11,44 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlimport +.\" mariadb-import .\" importing: data .\" data: importing .\" files: text .\" text files: importing .SH "NAME" -mariadb-import \- a data import program (mysqlimport is now a symlink to mariadb-import) +mariadb-import \- a data import program (mariadb-import is now a symlink to mariadb-import) .SH "SYNOPSIS" -.HP \w'\fBmysqlimport\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \fR\fB\fItextfile1\fR\fR\fB\ \&.\&.\&.\fR\ 'u -\fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB \&.\&.\&.\fR +.HP \w'\fBmariadb-import\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\fB\ \fR\fB\fItextfile1\fR\fR\fB\ \&.\&.\&.\fR\ 'u +\fBmariadb-import [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP The -\fBmysqlimport\fR +\fBmariadb-import\fR client provides a command\-line interface to the LOAD DATA INFILE SQL statement\&. Most options to -\fBmysqlimport\fR +\fBmariadb-import\fR correspond directly to clauses of LOAD DATA INFILE syntax\&. .PP Invoke -\fBmysqlimport\fR +\fBmariadb-import\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB [\fR\fB\fItextfile2\fR\fR\fB \&.\&.\&.]\fR +shell> \fBmariadb-import [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB [\fR\fB\fItextfile2\fR\fR\fB \&.\&.\&.]\fR .fi .if n \{\ .RE .\} .PP For each text file named on the command line, -\fBmysqlimport\fR +\fBmariadb-import\fR strips any extension from the file name and uses the result to determine the name of the table into which to import the file's contents\&. For example, files named patient\&.txt, patient\&.text, and @@ -57,13 +57,13 @@ all would be imported into a table named patient\&. .PP .PP -\fBmysqlimport\fR +\fBmariadb-import\fR supports the following options, which can be specified on the command line or in the -[mysqlimport] +[mariadb-import] and [client] option file groups\&. -\fBmysqlimport\fR +\fBmariadb-import\fR also supports the options for processing option files\&. .sp .RS 4 @@ -74,8 +74,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: help option -.\" help option: mysqlimport +.\" mariadb-import: help option +.\" help option: mariadb-import \fB\-\-help\fR, \fB\-?\fR .sp @@ -90,8 +90,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: character-sets-dir option -.\" character-sets-dir option: mysqlimport +.\" mariadb-import: character-sets-dir option +.\" character-sets-dir option: mariadb-import \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -105,8 +105,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: columns option -.\" columns option: mysqlimport +.\" mariadb-import: columns option +.\" columns option: mariadb-import \fB\-\-columns=\fR\fB\fIcolumn_list\fR\fR, \fB\-c \fR\fB\fIcolumn_list\fR\fR .sp @@ -121,8 +121,8 @@ This option takes a comma\-separated list of column names as its value\&. The or .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: compress option -.\" compress option: mysqlimport +.\" mariadb-import: compress option +.\" compress option: mariadb-import \fB\-\-compress\fR, \fB\-C\fR .sp @@ -137,8 +137,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug option -.\" debug option: mysqlimport +.\" mariadb-import: debug option +.\" debug option: mariadb-import \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -155,8 +155,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug-check option -.\" debug-check option: mysqlimport +.\" mariadb-import: debug-check option +.\" debug-check option: mariadb-import \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -170,8 +170,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: debug-info option -.\" debug-info option: mysqlimport +.\" mariadb-import: debug-info option +.\" debug-info option: mariadb-import \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -185,8 +185,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: default-auth option -.\" default-auth option: mysqlimport +.\" mariadb-import: default-auth option +.\" default-auth option: mariadb-import \fB\-\-default\-auth=\fIplugin_name\fR .sp Default authentication client-side plugin to use\&. @@ -200,8 +200,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: default-character-set option -.\" default-character-set option: mysqlimport +.\" mariadb-import: default-character-set option +.\" default-character-set option: mariadb-import \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -217,8 +217,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: defaults-extra-file option -.\" defaults-extra-file option: mysqlimport +.\" mariadb-import: defaults-extra-file option +.\" defaults-extra-file option: mariadb-import \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -233,8 +233,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: defaults-file option -.\" defaults-file option: mysqlimport +.\" mariadb-import: defaults-file option +.\" defaults-file option: mariadb-import \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -249,8 +249,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: delete option -.\" delete option: mysqlimport +.\" mariadb-import: delete option +.\" delete option: mariadb-import \fB\-\-delete\fR, \fB\-d\fR .sp @@ -265,17 +265,17 @@ Empty the table before importing the text file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: fields-terminated-by option -.\" fields-terminated-by option: mysqlimport +.\" mariadb-import: fields-terminated-by option +.\" fields-terminated-by option: mariadb-import \fB\-\-fields\-terminated\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-enclosed-by option -.\" fields-enclosed-by option: mysqlimport +.\" mariadb-import: fields-enclosed-by option +.\" fields-enclosed-by option: mariadb-import \fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-optionally-enclosed-by option -.\" fields-optionally-enclosed-by option: mysqlimport +.\" mariadb-import: fields-optionally-enclosed-by option +.\" fields-optionally-enclosed-by option: mariadb-import \fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR, -.\" mysqlimport: fields-escaped-by option -.\" fields-escaped-by option: mysqlimport +.\" mariadb-import: fields-escaped-by option +.\" fields-escaped-by option: mariadb-import \fB\-\-fields\-escaped\-by=\&.\&.\&.\fR .sp These options have the same meaning as the corresponding clauses for @@ -290,14 +290,14 @@ LOAD DATA INFILE\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: force option -.\" force option: mysqlimport +.\" mariadb-import: force option +.\" force option: mariadb-import \fB\-\-force\fR, \fB\-f\fR .sp Ignore errors\&. For example, if a table for a text file does not exist, continue processing any remaining files\&. Without \fB\-\-force\fR, -\fBmysqlimport\fR +\fBmariadb-import\fR exits if a table does not exist\&. .RE .sp @@ -309,8 +309,8 @@ exits if a table does not exist\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: host option -.\" host option: mysqlimport +.\" mariadb-import: host option +.\" host option: mariadb-import \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -326,8 +326,8 @@ localhost\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore option -.\" ignore option: mysqlimport +.\" mariadb-import: ignore option +.\" ignore option: mariadb-import \fB\-\-ignore\fR, \fB\-i\fR .sp @@ -344,8 +344,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore-foreign-keys option -.\" ignore-foreign-keys option: mysqlimport +.\" mariadb-import: ignore-foreign-keys option +.\" ignore-foreign-keys option: mariadb-import \fB\-\-ignore\-foreign\-keys\fR, \fB\-k\fR .sp @@ -360,8 +360,8 @@ Disable foreign key checks while importing the data\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: ignore-lines option -.\" ignore-lines option: mysqlimport +.\" mariadb-import: ignore-lines option +.\" ignore-lines option: mariadb-import \fB\-\-ignore\-lines=\fR\fB\fIN\fR\fR .sp Ignore the first @@ -377,8 +377,8 @@ lines of the data file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: lines-terminated-by option -.\" lines-terminated-by option: mysqlimport +.\" mariadb-import: lines-terminated-by option +.\" lines-terminated-by option: mariadb-import \fB\-\-lines\-terminated\-by=\&.\&.\&.\fR .sp This option has the same meaning as the corresponding clause for @@ -394,8 +394,8 @@ LOAD DATA INFILE\&. For example, to import Windows files that have lines termina .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: local option -.\" local option: mysqlimport +.\" mariadb-import: local option +.\" local option: mariadb-import \fB\-\-local\fR, \fB\-L\fR .sp @@ -410,8 +410,8 @@ Read input files locally from the client host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: lock-tables option -.\" lock-tables option: mysqlimport +.\" mariadb-import: lock-tables option +.\" lock-tables option: mariadb-import \fB\-\-lock\-tables\fR, \fB\-l\fR .sp @@ -428,8 +428,8 @@ tables for writing before processing any text files\&. This ensures that all tab .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: low-priority option -.\" low-priority option: mysqlimport +.\" mariadb-import: low-priority option +.\" low-priority option: mariadb-import \fB\-\-low\-priority\fR .sp Use @@ -448,8 +448,8 @@ MERGE)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: no-defaults option -.\" no-defaults option: mysqlimport +.\" mariadb-import: no-defaults option +.\" no-defaults option: mariadb-import \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -464,8 +464,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: password option -.\" password option: mysqlimport +.\" mariadb-import: password option +.\" password option: mariadb-import \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -478,7 +478,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlimport\fR +\fBmariadb-import\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -492,8 +492,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: pipe option -.\" pipe option: mysqlimport +.\" mariadb-import: pipe option +.\" pipe option: mariadb-import \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -508,8 +508,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: plugin-dir option -.\" plugin-dir option: mysqlimport +.\" mariadb-import: plugin-dir option +.\" plugin-dir option: mariadb-import \fB\-\-plugin\-dir=\fR\fB\fIname\fR\fR .sp Directory for client-side plugins\&. @@ -523,8 +523,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: port option -.\" port option: mysqlimport +.\" mariadb-import: port option +.\" port option: mariadb-import \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -540,8 +540,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: protocol option -.\" protocol option: mysqlimport +.\" mariadb-import: protocol option +.\" protocol option: mariadb-import \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -555,8 +555,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: print-defaults option -.\" print-defaults option: mysqlimport +.\" mariadb-import: print-defaults option +.\" print-defaults option: mariadb-import \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -571,8 +571,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: replace option -.\" replace option: mysqlimport +.\" mariadb-import: replace option +.\" replace option: mariadb-import \fB\-\-replace\fR, \fB\-r\fR .sp @@ -593,8 +593,8 @@ options control handling of input rows that duplicate existing rows on unique ke .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: silent option -.\" silent option: mysqlimport +.\" mariadb-import: silent option +.\" silent option: mariadb-import \fB\-\-silent\fR, \fB\-s\fR .sp @@ -609,8 +609,8 @@ Silent mode\&. Produce output only when errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: socket option -.\" socket option: mysqlimport +.\" mariadb-import: socket option +.\" socket option: mariadb-import \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -627,8 +627,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL options -.\" SSL options: mysqladmin +.\" mariadb-import: SSL options +.\" SSL options: mariadb-import \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -643,8 +643,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA option -.\" SSL CA option: mysqladmin +.\" mariadb-import: SSL CA option +.\" SSL CA option: mariadb-import \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -659,8 +659,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL CA Path option -.\" SSL CA Path option: mysqladmin +.\" mariadb-import: SSL CA Path option +.\" SSL CA Path option: mariadb-import \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -675,8 +675,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cert option -.\" SSL Cert option: mysqladmin +.\" mariadb-import: SSL Cert option +.\" SSL Cert option: mariadb-import \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -691,8 +691,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Cipher option -.\" SSL Cipher option: mysqladmin +.\" mariadb-import: SSL Cipher option +.\" SSL Cipher option: mariadb-import \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -707,8 +707,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Key option -.\" SSL Key option: mysqladmin +.\" mariadb-import: SSL Key option +.\" SSL Key option: mariadb-import \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -723,8 +723,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crl option -.\" SSL CRL option: mysqladmin +.\" mariadb-import: SSL Crl option +.\" SSL CRL option: mariadb-import \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -739,8 +739,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Crlpath option -.\" SSL Crlpath option: mysqladmin +.\" mariadb-import: SSL Crlpath option +.\" SSL Crlpath option: mariadb-import \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -755,8 +755,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqladmin: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqladmin +.\" mariadb-import: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-import \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -770,8 +770,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: user option -.\" user option: mysqlimport +.\" mariadb-import: user option +.\" user option: mariadb-import \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -786,8 +786,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: use-threads option -.\" use-threads option: mysqlimport +.\" mariadb-import: use-threads option +.\" use-threads option: mariadb-import \fB\-\-use\-threads=\fR\fB\fIN\fR\fR .sp Load files in parallel using @@ -803,8 +803,8 @@ threads\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: verbose option -.\" verbose option: mysqlimport +.\" mariadb-import: verbose option +.\" verbose option: mariadb-import \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -819,8 +819,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlimport: version option -.\" version option: mysqlimport +.\" mariadb-import: version option +.\" version option: mariadb-import \fB\-\-version\fR, \fB\-V\fR .sp @@ -828,13 +828,13 @@ Display version information and exit\&. .RE .PP Here is a sample session that demonstrates use of -\fBmysqlimport\fR: +\fBmariadb-import\fR: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR +shell> \fBmariadb \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR shell> \fBed\fR a 100 Max Sydow @@ -847,9 +847,9 @@ shell> \fBod \-c imptest\&.txt\fR 0000000 1 0 0 \et M a x S y d o w \en 1 0 0000020 1 \et C o u n t D r a c u l a \en 0000040 -shell> \fBmysqlimport \-\-local test imptest\&.txt\fR +shell> \fBmariadb-import \-\-local test imptest\&.txt\fR test\&.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 -shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR +shell> \fBmariadb \-e 'SELECT * FROM imptest' test\fR +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | id | n | +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -863,7 +863,7 @@ shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-install-db.1 b/man/mariadb-install-db.1 index f945c259748..53ff26bdeae 100644 --- a/man/mariadb-install-db.1 +++ b/man/mariadb-install-db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-INSTALL-DB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-INSTALL-DB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,54 +11,54 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_install_db +.\" mariadb-install-db .SH "NAME" -mariadb-install-db \- initialize MariaDB data directory (mysql_install_db is now a symlink to mariadb-install-db) +mariadb-install-db \- initialize MariaDB data directory (mariadb-install-db is now a symlink to mariadb-install-db) .SH "SYNOPSIS" -.HP \w'\fBmysql_install_db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-install-db\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-install-db [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR initializes the MariaDB data directory and creates the system tables that it contains, if they do not exist\&. .PP To invoke -\fBmysql_install_db\fR, use the following syntax: +\fBmariadb-install-db\fR, use the following syntax: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_install_db [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-install-db [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP Because the MariaDB server, -\fBmysqld\fR, needs to access the data directory when it runs later, you should either run -\fBmysql_install_db\fR +\fBmariadbd\fR, needs to access the data directory when it runs later, you should either run +\fBmariadb-install-db\fR from the same account that will be used for running -\fBmysqld\fR +\fBmariadbd\fR or run it as root and use the \fB\-\-user\fR option to indicate the user name that -\fBmysqld\fR +\fBmariadbd\fR will run as\&. It might be necessary to specify other options such as \fB\-\-basedir\fR or \fB\-\-datadir\fR if -\fBmysql_install_db\fR +\fBmariadb-install-db\fR does not use the correct locations for the installation directory or data directory\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBbin/mysql_install_db \-\-user=mysql \e\fR +shell> \fBbin/mariadb-install-db \-\-user=mysql \e\fR \fB\-\-basedir=/opt/mysql/mysql \e\fR \fB\-\-datadir=/opt/mysql/mysql/data\fR .fi @@ -66,9 +66,9 @@ shell> \fBbin/mysql_install_db \-\-user=mysql \e\fR .RE .\} .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR needs to invoke -\fBmysqld\fR +\fBmariadbd\fR with the \fB\-\-bootstrap\fR and @@ -81,17 +81,17 @@ option, and \fB\-\-skip\-grant\-tables\fR will be disabled\&. To handle this, set the -MYSQLD_BOOTSTRAP +mariadbd_BOOTSTRAP environment variable to the full path name of a server that has all options enabled\&. -\fBmysql_install_db\fR +\fBmariadb-install-db\fR will use that server\&. .PP -\fBmysql_install_db\fR +\fBmariadb-install-db\fR supports the following options, which can be specified on the command line or in the -[mysql_install_db] +[mariadb-install-db] and (if they are common to -\fBmysqld\fR) -[mysqld] +\fBmariadbd\fR) +[mariadbd] option file groups\&. .sp .RS 4 @@ -102,8 +102,8 @@ option file groups\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: basedir option -.\" basedir option: mysql_install_db +.\" mariadb-install-db: basedir option +.\" basedir option: mariadb-install-db \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp The path to the MariaDB installation directory\&. @@ -117,8 +117,8 @@ The path to the MariaDB installation directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: builddir option -.\" builddir option: mysql_install_db +.\" mariadb-install-db: builddir option +.\" builddir option: mariadb-install-db \fB\-\-builddir=\fIpath\fR .sp If using \fB--srcdir\fR with out-of-directory builds, you will need to set this @@ -133,8 +133,8 @@ to the location of the build directory where built files reside.\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: cross-bootstrap option -.\" cross-bootstrap option: mysql_install_db +.\" mariadb-install-db: cross-bootstrap option +.\" cross-bootstrap option: mariadb-install-db \fB\-\-cross\-bootstrap\fR .sp For internal use. Used when building the MariaDB system tables on a different host than the target.\&. @@ -148,10 +148,10 @@ For internal use. Used when building the MariaDB system tables on a different ho .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: datadir option -.\" datadir option: mysql_install_db -.\" mysql_install_db: ldata option -.\" ldata option: mysql_install_db +.\" mariadb-install-db: datadir option +.\" datadir option: mariadb-install-db +.\" mariadb-install-db: ldata option +.\" ldata option: mariadb-install-db \fB\-\-datadir=\fR\fB\fIpath\fR\fR, \fB\-\-ldata=\fR\fB\fIpath\fR\fR .sp @@ -166,8 +166,8 @@ The path to the MariaDB data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-extra-file option -.\" defaults-extra-file option: mysqlcheck +.\" mariadb-install-db: defaults-extra-file option +.\" defaults-extra-file option: mariadb-install-db \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -182,8 +182,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: defaults-file option -.\" defaults-file option: mysqlcheck +.\" mariadb-install-db: defaults-file option +.\" defaults-file option: mariadb-install-db \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -198,8 +198,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: defaults-group-suffix option -.\" defaults-group-suffix option: mysql_install_db +.\" mariadb-install-db: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb-install-db \fB\-\-defaults\-group\-suffix=\fR\fB\fIname\fR\fR .sp In addition to the given groups, also read groups with this suffix\&. @@ -213,12 +213,12 @@ In addition to the given groups, also read groups with this suffix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: force option -.\" force option: mysql_install_db +.\" mariadb-install-db: force option +.\" force option: mariadb-install-db \fB\-\-force\fR .sp Cause -\fBmysql_install_db\fR +\fBmariadb-install-db\fR to run even if DNS does not work\&. In that case, grant table entries that normally use host names will use IP addresses\&. .RE .sp @@ -230,8 +230,8 @@ to run even if DNS does not work\&. In that case, grant table entries that norma .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: help option -.\" help option: mysqlcheck +.\" mariadb-install-db: help option +.\" help option: mariadb-install-db \fB\-\-help\fR .sp Display a help message and exit\&. @@ -245,8 +245,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: no-defaults option -.\" no-defaults option: mysqlcheck +.\" mariadb-install-db: no-defaults option +.\" no-defaults option: mariadb-install-db \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -260,8 +260,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysqlcheck: print-defaults option -.\" print-defaults option: mysqlcheck +.\" mariadb-install-db: print-defaults option +.\" print-defaults option: mariadb-install-db \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -276,8 +276,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: rpm option -.\" rpm option: mysql_install_db +.\" mariadb-install-db: rpm option +.\" rpm option: mariadb-install-db \fB\-\-rpm\fR .sp For internal use\&. This option is used by RPM files during the MariaDB installation process\&. @@ -291,8 +291,8 @@ For internal use\&. This option is used by RPM files during the MariaDB installa .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: skip-name-resolve option -.\" skip-name-resolve option: mysql_install_db +.\" mariadb-install-db: skip-name-resolve option +.\" skip-name-resolve option: mariadb-install-db \fB\-\-skip\-name\-resolve\fR .sp Use IP addresses rather than host names when creating grant table entries\&. This option can be useful if your DNS does not work\&. @@ -306,12 +306,12 @@ Use IP addresses rather than host names when creating grant table entries\&. Thi .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: srcdir option -.\" srcdir option: mysql_install_db +.\" mariadb-install-db: srcdir option +.\" srcdir option: mariadb-install-db \fB\-\-srcdir=\fR\fB\fIpath\fR\fR .sp For internal use\&. The directory under which -\fBmysql_install_db\fR +\fBmariadb-install-db\fR looks for support files such as the error message file and the file for populating the help tables\&.4\&. .RE .sp @@ -323,17 +323,17 @@ looks for support files such as the error message file and the file for populati .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: user option -.\" user option: mysql_install_db +.\" mariadb-install-db: user option +.\" user option: mariadb-install-db \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The login user name to use for running -\fBmysqld\fR\&. Files and directories created by -\fBmysqld\fR +\fBmariadbd\fR\&. Files and directories created by +\fBmariadbd\fR will be owned by this user\&. You must be root to use this option\&. By default, -\fBmysqld\fR +\fBmariadbd\fR runs using your current login name and files and directories that it creates will be owned by you\&. .RE .sp @@ -345,8 +345,8 @@ runs using your current login name and files and directories that it creates wil .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: extra-file option -.\" extra-file option: mysql_install_db +.\" mariadb-install-db: extra-file option +.\" extra-file option: mariadb-install-db \fB\-\-extra-file=\fR\fB\fIfile_path\fR\fR .sp Add user defined SQL file, to be executed following regular database initialization. @@ -360,8 +360,8 @@ Add user defined SQL file, to be executed following regular database initializat .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: verbose option -.\" verbose option: mysql_install_db +.\" mariadb-install-db: verbose option +.\" verbose option: mariadb-install-db \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -375,8 +375,8 @@ Verbose mode\&. Print more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_install_db: windows option -.\" windows option: mysql_install_db +.\" mariadb-install-db: windows option +.\" windows option: mariadb-install-db \fB\-\-windows\fR .sp For internal use\&. This option is used for creating Windows distributions\&. @@ -384,7 +384,7 @@ For internal use\&. This option is used for creating Windows distributions\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-plugin.1 b/man/mariadb-plugin.1 index 0512bb50ed2..a383d99da1e 100644 --- a/man/mariadb-plugin.1 +++ b/man/mariadb-plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-PLUGIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-PLUGIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -20,16 +20,16 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_plugin +.\" mariadb-plugin .SH "NAME" -mariadb-plugin \- configure MariaDB server plugins (mysql_plugin is now a symlink to mariadb-plugin) +mariadb-plugin \- configure MariaDB server plugins (mariadb-plugin is now a symlink to mariadb-plugin) .SH "SYNOPSIS" -.HP \w'\fBmysql_plugin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIplugin\fR\fR\fB\ {ENABLE|DISABLE}\fR\ 'u -\fBmysql_plugin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIplugin\fR\fR\fB {ENABLE|DISABLE}\fR +.HP \w'\fBmariadb-plugin\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIplugin\fR\fR\fB\ {ENABLE|DISABLE}\fR\ 'u +\fBmariadb-plugin [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIplugin\fR\fR\fB {ENABLE|DISABLE}\fR .SH "DESCRIPTION" .PP The -\fBmysql_plugin\fR +\fBmariadb-plugin\fR utility enables MariaDB administrators to manage which plugins a MariaDB server loads\&. It provides an alternative to manually specifying the \fB\-\-plugin\-load\fR option at server startup or using the @@ -39,11 +39,11 @@ UNINSTALL PLUGIN statements at runtime\&. .PP Depending on whether -\fBmysql_plugin\fR +\fBmariadb-plugin\fR is invoked to enable or disable plugins, it inserts or deletes rows in the mysql\&.plugin table that serves as a plugin registry\&. (To perform this operation, -\fBmysql_plugin\fR +\fBmariadb-plugin\fR invokes the MariaDB server in bootstrap mode\&. This means that the server must not already be running\&.) For normal server startups, the server loads and enables plugins listed in mysql\&.plugin automatically\&. For additional control over plugin activation, use @@ -51,15 +51,15 @@ automatically\&. For additional control over plugin activation, use options named for specific plugins\&. .PP Each invocation of -\fBmysql_plugin\fR +\fBmariadb-plugin\fR reads a configuration file to determine how to configure the plugins contained in a single plugin library object file\&. To invoke -\fBmysql_plugin\fR, use this syntax: +\fBmariadb-plugin\fR, use this syntax: .sp .if n \{\ .RS 4 .\} .nf -mysql_plugin [\fIoptions\fR] \fIplugin\fR {ENABLE|DISABLE} +mariadb-plugin [\fIoptions\fR] \fIplugin\fR {ENABLE|DISABLE} .fi .if n \{\ .RE @@ -89,7 +89,7 @@ myplugins\&. Suppose that this plugin library contains three plugins, plugin1, plugin2, and plugin3, all of which should be configured under -\fBmysql_plugin\fR +\fBmariadb-plugin\fR control\&. By convention, configuration files have a suffix of \&.ini and the same basename as the plugin library, so the default configuration file name for this plugin library is @@ -118,14 +118,14 @@ or are taken as comments and ignored\&. .PP To enable the plugins listed in the configuration file, invoke -\fBmysql_plugin\fR +\fBmariadb-plugin\fR this way: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_plugin myplugins ENABLE\fR +shell> \fBmariadb-plugin myplugins ENABLE\fR .fi .if n \{\ .RE @@ -137,25 +137,25 @@ rather than ENABLE\&. .PP An error occurs if -\fBmysql_plugin\fR +\fBmariadb-plugin\fR cannot find the configuration file or plugin library file, or if -\fBmysql_plugin\fR +\fBmariadb-plugin\fR cannot start the MariaDB server\&. .PP -\fBmysql_plugin\fR +\fBmariadb-plugin\fR supports the following options, which can be specified on the command line or in the -[mysqld] +[mariadbd] group of any option file\&. For options specified in a -[mysqld] +[mariadbd] group, -\fBmysql_plugin\fR +\fBmariadb-plugin\fR recognizes the \fB\-\-basedir\fR, \fB\-\-datadir\fR, and \fB\-\-plugin\-dir\fR options and ignores others\&. .PP -mysql_plugin Options +mariadb-plugin Options .sp .RS 4 .ie n \{\ @@ -165,8 +165,8 @@ mysql_plugin Options .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: help option -.\" help option: mysql_plugin +.\" mariadb-plugin: help option +.\" help option: mariadb-plugin \fB\-\-help\fR, \fB\-?\fR .sp @@ -181,8 +181,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: basedir option -.\" basedir option: mysql_plugin +.\" mariadb-plugin: basedir option +.\" basedir option: mariadb-plugin \fB\-\-basedir=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp @@ -197,8 +197,8 @@ The server base directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: datadir option -.\" datadir option: mysql_plugin +.\" mariadb-plugin: datadir option +.\" datadir option: mariadb-plugin \fB\-\-datadir=\fR\fB\fIpath\fR\fR, \fB\-d \fR\fB\fIpath\fR\fR .sp @@ -213,8 +213,8 @@ The server data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: my-print-defaults option -.\" my-print-defaults option: mysql_plugin +.\" mariadb-plugin: my-print-defaults option +.\" my-print-defaults option: mariadb-plugin \fB\-\-my\-print\-defaults=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp @@ -231,13 +231,13 @@ program\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: mysqld option -.\" mysqld option: mysql_plugin -\fB\-\-mysqld=\fR\fB\fIpath\fR\fR, +.\" mariadb-plugin: mariadbd option +.\" mariadbd option: mariadb-plugin +\fB\-\-mariadbd=\fR\fB\fIpath\fR\fR, \fB\-b \fR\fB\fIpath\fR\fR .sp The path to the -\fBmysqld\fR +\fBmariadbd\fR server\&. .RE .sp @@ -249,15 +249,15 @@ server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: no-defaults option -.\" no-defaults option: mysql_plugin +.\" mariadb-plugin: no-defaults option +.\" no-defaults option: mariadb-plugin \fB\-\-no\-defaults\fR, \fB\-p\fR .sp Do not read values from the configuration file\&. This option enables an administrator to skip reading defaults from the configuration file\&. .sp With -\fBmysql_plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support +\fBmariadb-plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support \fB\-\-no\-defaults\fR\&. .RE .sp @@ -269,8 +269,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: plugin-dir option -.\" plugin-dir option: mysql_plugin +.\" mariadb-plugin: plugin-dir option +.\" plugin-dir option: mariadb-plugin \fB\-\-plugin\-dir=\fR\fB\fIpath\fR\fR, \fB\-p \fR\fB\fIpath\fR\fR .sp @@ -285,13 +285,13 @@ The server plugin directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: plugin-ini option -.\" plugin-ini option: mysql_plugin +.\" mariadb-plugin: plugin-ini option +.\" plugin-ini option: mariadb-plugin \fB\-\-plugin\-ini=\fR\fB\fIfile_name\fR\fR, \fB\-i \fR\fB\fIfile_name\fR\fR .sp The -\fBmysql_plugin\fR +\fBmariadb-plugin\fR configuration file\&. Relative path names are interpreted relative to the current directory\&. If this option is not given, the default is \fIplugin\fR\&.ini in the plugin directory, where @@ -309,13 +309,13 @@ argument on the command line\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: print-defaults option -.\" print-defaults option: mysql_plugin +.\" mariadb-plugin: print-defaults option +.\" print-defaults option: mariadb-plugin \fB\-\-print\-defaults\fR, \fB\-P\fR .sp Display the default values from the configuration file\&. This option causes -\fBmysql_plugin\fR +\fBmariadb-plugin\fR to print the defaults for \fB\-\-basedir\fR, \fB\-\-datadir\fR, and @@ -323,7 +323,7 @@ to print the defaults for if they are found in the configuration file\&. If no value for a variable is found, nothing is shown\&. .sp With -\fBmysql_plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support +\fBmariadb-plugin\fR, this option need not be given first on the command line, unlike most other MariaDB programs that support \fB\-\-print\-defaults\fR\&. .RE .sp @@ -335,8 +335,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: verbose option -.\" verbose option: mysql_plugin +.\" mariadb-plugin: verbose option +.\" verbose option: mariadb-plugin \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -351,8 +351,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysql_plugin: version option -.\" version option: mysql_plugin +.\" mariadb-plugin: version option +.\" version option: mariadb-plugin \fB\-\-version\fR, \fB\-V\fR .sp @@ -361,7 +361,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2019 MariaDB Foundation +Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-secure-installation.1 b/man/mariadb-secure-installation.1 index 0d30ee24087..aff28db32f9 100644 --- a/man/mariadb-secure-installation.1 +++ b/man/mariadb-secure-installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,12 +11,12 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_secure_installation +.\" mariadb-secure-installation .SH "NAME" -mariadb-secure-installation \- improve MariaDB installation security (mysql_secure_installation is now a symlink to mariadb-secure-installation) +mariadb-secure-installation \- improve MariaDB installation security (mariadb-secure-installation is now a symlink to mariadb-secure-installation) .SH "SYNOPSIS" -.HP \w'\fBmysql_secure_installation\fR\ 'u -\fBmysql_secure_installation\fR +.HP \w'\fBmariadb-secure-installation\fR\ 'u +\fBmariadb-secure-installation\fR .SH "DESCRIPTION" .PP This program enables you to improve the security of your MariaDB installation in the following ways: @@ -71,14 +71,14 @@ test database, which by default can be accessed by anonymous users\&. .RE .PP -\fBmysql_secure_installation\fR +\fBmariadb-secure-installation\fR can be invoked without arguments: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_secure_installation\fR +shell> \fBmariadb-secure-installation\fR .fi .if n \{\ .RE @@ -86,7 +86,7 @@ shell> \fBmysql_secure_installation\fR .PP The script will prompt you to determine which actions to perform\&. .PP -\fBmysql_secure_installation\fR +\fBmariadb-secure-installation\fR accepts some options: .sp .RS 4 @@ -97,8 +97,8 @@ accepts some options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: basedir option -.\" basedir option: mysql_secure_installation +.\" mariadb-secure-installation: basedir option +.\" basedir option: mariadb-secure-installation \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR .sp Base directory\&. @@ -112,8 +112,8 @@ Base directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: defaults-extra-file option -.\" defaults-extra-file option: mysql_secure_installation +.\" mariadb-secure-installation: defaults-extra-file option +.\" defaults-extra-file option: mariadb-secure-installation \fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR .sp Additional option file\&. @@ -127,8 +127,8 @@ Additional option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: defaults-file option -.\" defaults-file option: mysql_secure_installation +.\" mariadb-secure-installation: defaults-file option +.\" defaults-file option: mariadb-secure-installation \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp Option file\&. @@ -142,8 +142,8 @@ Option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_secure_installation: no-defaults option -.\" no-defaults option: mysql_secure_installation +.\" mariadb-secure-installation: no-defaults option +.\" no-defaults option: mariadb-secure-installation \fB\-\-no\-defaults\fR .sp Don't read any defaults file\&. @@ -153,7 +153,7 @@ Other unrecognized options will be passed on to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 258c1793b41..3ee9d54f2be 100644 --- a/man/mariadb-service-convert.1 +++ b/man/mariadb-service-convert.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "3 September 2024" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -9,11 +9,11 @@ .\" disable justification (adjust text to left margin only) .ad l .SH NAME -mariadb-service-convert \- generate a mariadb.service file based on the current mysql/mariadb settings +mariadb-service-convert \- generate a mariadb.service file based on the current mariadb settings .SH DESCRIPTION -Use: Generate a mariadb.service file based on the current mysql/mariadb settings\. +Use: Generate a mariadb.service file based on the current mariadb settings\. This is to assist distro maintainers in migrating to systemd service definations from -a user mysqld_safe settings in the my.cnf files\. +a user mariadbd-safe settings in the my.cnf files\. .PP Redirect output to user directory like /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf .PP diff --git a/man/mariadb-setpermission.1 b/man/mariadb-setpermission.1 index 7725ad69828..f5c7f78156b 100644 --- a/man/mariadb-setpermission.1 +++ b/man/mariadb-setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SETPERMISSION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SETPERMISSION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_setpermission +.\" mariadb-setpermission .SH "NAME" -mariadb-setpermission \- interactively set permissions in grant tables (mysql_setpermission is now a symlink to mariadb-setpermission) +mariadb-setpermission \- interactively set permissions in grant tables (mariadb-setpermission is now a symlink to mariadb-setpermission) .SH "SYNOPSIS" -.HP \w'\fBmysql_setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-setpermission\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR is a Perl script that was originally written and contributed by Luuk de Boer\&. It interactively sets permissions in the MariaDB grant tables\&. -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR is written in Perl and requires that the DBI and @@ -29,14 +29,14 @@ DBD::MariaDB Perl modules be installed\&. .PP Invoke -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-setpermission [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -47,7 +47,7 @@ should be either \fB\-\-help\fR to display the help message, or options that indicate how to connect to the MariaDB server\&. The account used when you connect determines which permissions you have when attempting to modify existing permissions in the grant tables\&. .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR also reads options from the [client] and @@ -56,7 +56,7 @@ groups in the \&.my\&.cnf file in your home directory, if the file exists\&. .PP -\fBmysql_setpermission\fR +\fBmariadb-setpermission\fR supports the following options: .sp .RS 4 @@ -67,8 +67,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: help option -.\" help option: mysql_setpermission +.\" mariadb-setpermission: help option +.\" help option: mariadb-setpermission \fB\-\-help\fR .sp Display a help message and exit\&. @@ -82,8 +82,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: host option -.\" host option: mysql_setpermission +.\" mariadb-setpermission: host option +.\" host option: mariadb-setpermission \fB\-\-host=\fR\fB\fIhost_name\fR\fR .sp Connect to the MariaDB server on the given host\&. @@ -97,8 +97,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: password option -.\" password option: mysql_setpermission +.\" mariadb-setpermission: password option +.\" password option: mariadb-setpermission \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. @@ -114,8 +114,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: port option -.\" port option: mysql_setpermission +.\" mariadb-setpermission: port option +.\" port option: mariadb-setpermission \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for the connection\&. @@ -129,8 +129,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: socket option -.\" socket option: mysql_setpermission +.\" mariadb-setpermission: socket option +.\" socket option: mariadb-setpermission \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp For connections to @@ -145,8 +145,8 @@ localhost, the Unix socket file to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_setpermission: user option -.\" user option: mysql_setpermission +.\" mariadb-setpermission: user option +.\" user option: mariadb-setpermission \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. @@ -154,7 +154,7 @@ The MariaDB user name to use when connecting to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-show.1 b/man/mariadb-show.1 index 85b20a971fb..cefd05ff4be 100644 --- a/man/mariadb-show.1 +++ b/man/mariadb-show.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SHOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SHOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,39 +11,39 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlshow +.\" mariadb-show .\" databases: displaying .\" displaying: database information .\" tables: displaying .\" columns: displaying .\" showing: database information .SH "NAME" -mariadb-show \- display database, table, and column information (mysqlshow is now a symlink to mariadb-show) +mariadb-show \- display database, table, and column information (mariadb-show is now a symlink to mariadb-show) .SH "SYNOPSIS" -.HP \w'\fBmysqlshow\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ [\fR\fB\fIcol_name\fR\fR\fB]]]\fR\ 'u -\fBmysqlshow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR +.HP \w'\fBmariadb-show\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ [\fR\fB\fIcol_name\fR\fR\fB]]]\fR\ 'u +\fBmariadb-show [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR .SH "DESCRIPTION" .PP The -\fBmysqlshow\fR +\fBmariadb-show\fR client can be used to quickly see which databases exist, their tables, or a table's columns or indexes\&. .PP -\fBmysqlshow\fR +\fBmariadb-show\fR provides a command\-line interface to several SQL SHOW statements\&. The same information can be obtained by using those statements directly\&. For example, you can issue them from the -\fBmysql\fR +\fBmariadb\fR client program\&. .PP Invoke -\fBmysqlshow\fR +\fBmariadb-show\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlshow [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR +shell> \fBmariadb-show [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB [\fR\fB\fIcol_name\fR\fR\fB]]]\fR .fi .if n \{\ .RE @@ -98,18 +98,18 @@ and wildcard characters\&. This might cause some confusion when you try to display the columns for a table with a \(lq_\(rq in the name, because in this case, -\fBmysqlshow\fR +\fBmariadb-show\fR shows you only the table names that match the pattern\&. This is easily fixed by adding an extra \(lq%\(rq last on the command line as a separate argument\&. .PP -\fBmysqlshow\fR +\fBmariadb-show\fR supports the following options, which can be specified on the command line or in the -[mysqlshow] +[mariadb-show] and [client] option file groups\&. -\fBmysqlshow\fR +\fBmariadb-show\fR also supports the options for processing option files described. .sp .RS 4 @@ -120,8 +120,8 @@ also supports the options for processing option files described. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: help option -.\" help option: mysqlshow +.\" mariadb-show: help option +.\" help option: mariadb-show \fB\-\-help\fR, \fB\-?\fR .sp @@ -136,8 +136,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: character-sets-dir option -.\" character-sets-dir option: mysqlshow +.\" mariadb-show: character-sets-dir option +.\" character-sets-dir option: mariadb-show \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR, \fB\-c\fR \fIpath\fR\fR .sp @@ -152,8 +152,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: compress option -.\" compress option: mysqlshow +.\" mariadb-show: compress option +.\" compress option: mariadb-show \fB\-\-compress\fR, \fB\-C\fR .sp @@ -168,8 +168,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: count option -.\" count option: mysqlshow +.\" mariadb-show: count option +.\" count option: mariadb-show \fB\-\-count\fR .sp Show the number of rows per table\&. This can be slow for non\-MyISAM @@ -184,8 +184,8 @@ tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug option -.\" debug option: mysqlshow +.\" mariadb-show: debug option +.\" debug option: mariadb-show \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -202,8 +202,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug-check option -.\" debug-check option: mysqlshow +.\" mariadb-show: debug-check option +.\" debug-check option: mariadb-show \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -217,8 +217,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: debug-info option -.\" debug-info option: mysqlshow +.\" mariadb-show: debug-info option +.\" debug-info option: mariadb-show \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -232,8 +232,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: default-auth option -.\" default-auth option: mysqlshow +.\" mariadb-show: default-auth option +.\" default-auth option: mariadb-show \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -247,8 +247,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: default-character-set option -.\" default-character-set option: mysqlshow +.\" mariadb-show: default-character-set option +.\" default-character-set option: mariadb-show \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -264,8 +264,8 @@ as the default character set\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-extra-file option -.\" defaults-extra-file option: mysqlshow +.\" mariadb-show: defaults-extra-file option +.\" defaults-extra-file option: mariadb-show \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -280,8 +280,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-file option -.\" defaults-file option: mysqlshow +.\" mariadb-show: defaults-file option +.\" defaults-file option: mariadb-show \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -296,8 +296,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: defaults-group-suffix option -.\" defaults-group-suffix option: mysqlshow +.\" mariadb-show: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb-show \fB\-\-defaults\-group\-suffix=\fR\fB\fIsuffix\fR\fR .sp In addition to the groups named on the command line, read groups that have the given suffix\&. @@ -311,8 +311,8 @@ In addition to the groups named on the command line, read groups that have the g .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: host option -.\" host option: mysqlshow +.\" mariadb-show: host option +.\" host option: mariadb-show \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -327,8 +327,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: keys option -.\" keys option: mysqlshow +.\" mariadb-show: keys option +.\" keys option: mariadb-show \fB\-\-keys\fR, \fB\-k\fR .sp @@ -343,8 +343,8 @@ Show table indexes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: no-defaults option -.\" no-defaults option: mysqlshow +.\" mariadb-show: no-defaults option +.\" no-defaults option: mariadb-show \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -359,8 +359,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: password option -.\" password option: mysqlshow +.\" mariadb-show: password option +.\" password option: mariadb-show \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -373,7 +373,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlshow\fR +\fBmariadb-show\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -387,8 +387,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: pipe option -.\" pipe option: mysqlshow +.\" mariadb-show: pipe option +.\" pipe option: mariadb-show \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -403,8 +403,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: plugin-dir option -.\" plugin-dir option: mysqlshow +.\" mariadb-show: plugin-dir option +.\" plugin-dir option: mariadb-show \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -418,8 +418,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: port option -.\" port option: mysqlshow +.\" mariadb-show: port option +.\" port option: mariadb-show \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -435,8 +435,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: protocol option -.\" protocol option: mysqlshow +.\" mariadb-show: protocol option +.\" protocol option: mariadb-show \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -450,8 +450,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: print-defaults option -.\" print-defaults option: mysqlshow +.\" mariadb-show: print-defaults option +.\" print-defaults option: mariadb-show \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -466,8 +466,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: show-table-type option -.\" show-table-type option: mysqlshow +.\" mariadb-show: show-table-type option +.\" show-table-type option: mariadb-show \fB\-\-show\-table\-type\fR, \fB\-t\fR .sp @@ -486,8 +486,8 @@ VIEW\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: socket option -.\" socket option: mysqlshow +.\" mariadb-show: socket option +.\" socket option: mariadb-show \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -504,8 +504,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL options -.\" SSL options: mysqlshow +.\" mariadb-show: SSL options +.\" SSL options: mariadb-show \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -520,8 +520,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA option -.\" SSL CA option: mysqlshow +.\" mariadb-show: SSL CA option +.\" SSL CA option: mariadb-show \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -536,8 +536,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA Path option -.\" SSL CA Path option: mysqlshow +.\" mariadb-show: SSL CA Path option +.\" SSL CA Path option: mariadb-show \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -552,8 +552,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cert option -.\" SSL Cert option: mysqlshow +.\" mariadb-show: SSL Cert option +.\" SSL Cert option: mariadb-show \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -568,8 +568,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cipher option -.\" SSL Cipher option: mysqlshow +.\" mariadb-show: SSL Cipher option +.\" SSL Cipher option: mariadb-show \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -584,8 +584,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Key option -.\" SSL Key option: mysqlshow +.\" mariadb-show: SSL Key option +.\" SSL Key option: mariadb-show \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -600,8 +600,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crl option -.\" SSL CRL option: mysqlshow +.\" mariadb-show: SSL Crl option +.\" SSL CRL option: mariadb-show \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -616,8 +616,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crlpath option -.\" SSL Crlpath option: mysqlshow +.\" mariadb-show: SSL Crlpath option +.\" SSL Crlpath option: mariadb-show \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -632,8 +632,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqlshow +.\" mariadb-show: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-show \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -647,8 +647,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: status option -.\" status option: mysqlshow +.\" mariadb-show: status option +.\" status option: mariadb-show \fB\-\-status\fR, \fB\-i\fR .sp @@ -663,8 +663,8 @@ Display extra information about each table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: user option -.\" user option: mysqlshow +.\" mariadb-show: user option +.\" user option: mariadb-show \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -679,8 +679,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: verbose option -.\" verbose option: mysqlshow +.\" mariadb-show: verbose option +.\" verbose option: mariadb-show \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -695,8 +695,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: version option -.\" version option: mysqlshow +.\" mariadb-show: version option +.\" version option: mariadb-show \fB\-\-version\fR, \fB\-V\fR .sp @@ -705,7 +705,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-slap.1 b/man/mariadb-slap.1 index dbb458cea36..edcc2b3a6a9 100644 --- a/man/mariadb-slap.1 +++ b/man/mariadb-slap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SLAP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SLAP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,27 +11,27 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqlslap +.\" mariadb-slap .\" load emulation .SH "NAME" -mariadb-slap \- load emulation client (mysqlslap is now a symlink to mariadb-slap) +mariadb-slap \- load emulation client (mariadb-slap is now a symlink to mariadb-slap) .SH "SYNOPSIS" -.HP \w'\fBmysqlslap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-slap\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-slap [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR is a diagnostic program designed to emulate client load for a MariaDB server and to report the timing of each stage\&. It works as if multiple clients are accessing the server\&. .PP Invoke -\fBmysqlslap\fR +\fBmariadb-slap\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqlslap [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-slap [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE @@ -44,10 +44,10 @@ or enable you to specify a string containing an SQL statement or a file containing statements\&. If you specify a file, by default it must contain one statement per line\&. (That is, the implicit statement delimiter is the newline character\&.) Use the \fB\-\-delimiter\fR option to specify a different delimiter, which enables you to specify statements that span multiple lines or place multiple statements on a single line\&. You cannot include comments in a file; -\fBmysqlslap\fR +\fBmariadb-slap\fR does not understand them\&. .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR runs in three stages: .sp .RS 4 @@ -91,7 +91,7 @@ Supply your own create and query SQL statements, with 50 clients querying and 20 .RS 4 .\} .nf -mysqlslap \-\-delimiter=";" \e +mariadb-slap \-\-delimiter=";" \e \-\-create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" \e \-\-query="SELECT * FROM a" \-\-concurrency=50 \-\-iterations=200 .fi @@ -100,7 +100,7 @@ mysqlslap \-\-delimiter=";" \e .\} .PP Let -\fBmysqlslap\fR +\fBmariadb-slap\fR build the query SQL statement with a table of two INT columns and three @@ -111,7 +111,7 @@ columns\&. Use five clients querying 20 times each\&. Do not create the table or .RS 4 .\} .nf -mysqlslap \-\-concurrency=5 \-\-iterations=20 \e +mariadb-slap \-\-concurrency=5 \-\-iterations=20 \e \-\-number\-int\-cols=2 \-\-number\-char\-cols=3 \e \-\-auto\-generate\-sql .fi @@ -129,7 +129,7 @@ then run all the queries in the query file with five clients (five times each): .RS 4 .\} .nf -mysqlslap \-\-concurrency=5 \e +mariadb-slap \-\-concurrency=5 \e \-\-iterations=5 \-\-query=query\&.sql \-\-create=create\&.sql \e \-\-delimiter=";" .fi @@ -137,13 +137,13 @@ mysqlslap \-\-concurrency=5 \e .RE .\} .PP -\fBmysqlslap\fR +\fBmariadb-slap\fR supports the following options, which can be specified on the command line or in the -[mysqlslap] +[mariadb-slap] and [client] option file groups\&. -\fBmysqlslap\fR +\fBmariadb-slap\fR also supports the options for processing option files\&. .sp .RS 4 @@ -154,8 +154,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: help option -.\" help option: mysqlslap +.\" mariadb-slap: help option +.\" help option: mariadb-slap \fB\-\-help\fR, \fB\-?\fR .sp @@ -170,8 +170,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql option -.\" auto-generate-sql option: mysqlslap +.\" mariadb-slap: auto-generate-sql option +.\" auto-generate-sql option: mariadb-slap \fB\-\-auto\-generate\-sql\fR, \fB\-a\fR .sp @@ -186,8 +186,8 @@ Generate SQL statements automatically when they are not supplied in files or via .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-add-autoincrement option -.\" auto-generate-sql-add-autoincrement option: mysqlslap +.\" mariadb-slap: auto-generate-sql-add-autoincrement option +.\" auto-generate-sql-add-autoincrement option: mariadb-slap \fB\-\-auto\-generate\-sql\-add\-autoincrement\fR .sp Add an @@ -203,8 +203,8 @@ column to automatically generated tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-execute-number option -.\" auto-generate-sql-execute-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-execute-number option +.\" auto-generate-sql-execute-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-execute\-number=\fR\fB\fIN\fR\fR .sp Specify how many queries to generate automatically\&. @@ -218,8 +218,8 @@ Specify how many queries to generate automatically\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-guid-primary option -.\" auto-generate-sql-guid-primary option: mysqlslap +.\" mariadb-slap: auto-generate-sql-guid-primary option +.\" auto-generate-sql-guid-primary option: mariadb-slap \fB\-\-auto\-generate\-sql\-guid\-primary\fR .sp Add a GUID\-based primary key to automatically generated tables\&. @@ -233,8 +233,8 @@ Add a GUID\-based primary key to automatically generated tables\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-load-type option -.\" auto-generate-sql-load-type option: mysqlslap +.\" mariadb-slap: auto-generate-sql-load-type option +.\" auto-generate-sql-load-type option: mariadb-slap \fB\-\-auto\-generate\-sql\-load\-type=\fR\fB\fItype\fR\fR .sp Specify the test load type\&. The allowable values are @@ -259,8 +259,8 @@ mixed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-secondary-indexes option -.\" auto-generate-sql-secondary-indexes option: mysqlslap +.\" mariadb-slap: auto-generate-sql-secondary-indexes option +.\" auto-generate-sql-secondary-indexes option: mariadb-slap \fB\-\-auto\-generate\-sql\-secondary\-indexes=\fR\fB\fIN\fR\fR .sp Specify how many secondary indexes to add to automatically generated tables\&. By default, none are added\&. @@ -274,8 +274,8 @@ Specify how many secondary indexes to add to automatically generated tables\&. B .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-unique-query-number option -.\" auto-generate-sql-unique-query-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-unique-query-number option +.\" auto-generate-sql-unique-query-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-unique\-query\-number=\fR\fB\fIN\fR\fR .sp How many different queries to generate for automatic tests\&. For example, if you run a @@ -291,8 +291,8 @@ test that performs 1000 selects, you can use this option with a value of 1000 to .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-unique-write-number option -.\" auto-generate-sql-unique-write-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-unique-write-number option +.\" auto-generate-sql-unique-write-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-unique\-write\-number=\fR\fB\fIN\fR\fR .sp How many different queries to generate for @@ -307,8 +307,8 @@ How many different queries to generate for .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: auto-generate-sql-write-number option -.\" auto-generate-sql-write-number option: mysqlslap +.\" mariadb-slap: auto-generate-sql-write-number option +.\" auto-generate-sql-write-number option: mariadb-slap \fB\-\-auto\-generate\-sql\-write\-number=\fR\fB\fIN\fR\fR .sp How many row inserts to perform on each thread\&. The default is 100\&. @@ -322,8 +322,8 @@ How many row inserts to perform on each thread\&. The default is 100\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: commit option -.\" commit option: mysqlslap +.\" mariadb-slap: commit option +.\" commit option: mariadb-slap \fB\-\-commit=\fR\fB\fIN\fR\fR .sp How many statements to execute before committing\&. The default is 0 (no commits are done)\&. @@ -337,8 +337,8 @@ How many statements to execute before committing\&. The default is 0 (no commits .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: compress option -.\" compress option: mysqlslap +.\" mariadb-slap: compress option +.\" compress option: mariadb-slap \fB\-\-compress\fR, \fB\-C\fR .sp @@ -353,8 +353,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: concurrency option -.\" concurrency option: mysqlslap +.\" mariadb-slap: concurrency option +.\" concurrency option: mariadb-slap \fB\-\-concurrency=\fR\fB\fIN\fR\fR, \fB\-c \fR\fB\fIN\fR\fR .sp @@ -371,8 +371,8 @@ statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: create option -.\" create option: mysqlslap +.\" mariadb-slap: create option +.\" create option: mariadb-slap \fB\-\-create=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to use for creating the table\&. @@ -386,8 +386,8 @@ The file or string containing the statement to use for creating the table\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: create-schema option -.\" create-schema option: mysqlslap +.\" mariadb-slap: create-schema option +.\" create-schema option: mariadb-slap \fB\-\-create\-schema=\fR\fB\fIvalue\fR\fR .sp The schema in which to run the tests\&. @@ -401,8 +401,8 @@ The schema in which to run the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: csv option -.\" csv option: mysqlslap +.\" mariadb-slap: csv option +.\" csv option: mariadb-slap \fB\-\-csv[=\fR\fB\fIfile_name\fR\fR\fB]\fR .sp Generate output in comma\-separated values format\&. The output goes to the named file, or to the standard output if no file is given\&. @@ -416,14 +416,14 @@ Generate output in comma\-separated values format\&. The output goes to the name .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug option -.\" debug option: mysqlslap +.\" mariadb-slap: debug option +.\" debug option: mariadb-slap \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlslap.trace'. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mariadb-slap.trace'. .RE .sp .RS 4 @@ -434,8 +434,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlslap.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug-check option -.\" debug-check option: mysqlslap +.\" mariadb-slap: debug-check option +.\" debug-check option: mariadb-slap \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -449,8 +449,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: debug-info option -.\" debug-info option: mysqlslap +.\" mariadb-slap: debug-info option +.\" debug-info option: mariadb-slap \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -465,8 +465,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: default-auth option -.\" default-auth option: mysqlslap +.\" mariadb-slap: default-auth option +.\" default-auth option: mariadb-slap \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -480,8 +480,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: defaults-extra-file option -.\" defaults-extra-file option: mysqlslap +.\" mariadb-slap: defaults-extra-file option +.\" defaults-extra-file option: mariadb-slap \fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been @@ -496,8 +496,8 @@ read\&. Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: defaults-file option -.\" defaults-file option: mysqlslap +.\" mariadb-slap: defaults-file option +.\" defaults-file option: mariadb-slap \fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. @@ -512,8 +512,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: delimiter option -.\" delimiter option: mysqlslap +.\" mariadb-slap: delimiter option +.\" delimiter option: mariadb-slap \fB\-\-delimiter=\fR\fB\fIstr\fR\fR, \fB\-F \fR\fB\fIstr\fR\fR .sp @@ -528,8 +528,8 @@ The delimiter to use in SQL statements supplied in files or via command options\ .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: detach option -.\" detach option: mysqlslap +.\" mariadb-slap: detach option +.\" detach option: mariadb-slap \fB\-\-detach=\fR\fB\fIN\fR\fR .sp Detach (close and reopen) each connection after each @@ -545,8 +545,8 @@ statements\&. The default is 0 (connections are not detached)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: engine option -.\" engine option: mysqlslap +.\" mariadb-slap: engine option +.\" engine option: mariadb-slap \fB\-\-engine=\fR\fB\fIengine_name\fR\fR, \fB\-e \fR\fB\fIengine_name\fR\fR .sp @@ -563,8 +563,8 @@ each engine\&. You can also specify an option for an engine after a colon, for e .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: host option -.\" host option: mysqlslap +.\" mariadb-slap: host option +.\" host option: mariadb-slap \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -579,8 +579,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: init-command option -.\" init-command option: mysqlslap +.\" mariadb-slap: init-command option +.\" init-command option: mariadb-slap \fB\-\-init\-command=str\fR .sp SQL Command to execute when connecting to MariaDB server\&. Will automatically be re\-executed when reconnecting\&. @@ -594,8 +594,8 @@ SQL Command to execute when connecting to MariaDB server\&. Will automatically b .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: iterations option -.\" iterations option: mysqlslap +.\" mariadb-slap: iterations option +.\" iterations option: mariadb-slap \fB\-\-iterations=\fR\fB\fIN\fR\fR, \fB\-i \fR\fB\fIN\fR\fR .sp @@ -610,8 +610,8 @@ The number of times to run the tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: no-defaults option -.\" no-defaults option: mysqlslap +.\" mariadb-slap: no-defaults option +.\" no-defaults option: mariadb-slap \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the @@ -626,8 +626,8 @@ first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: no-drop option -.\" no-drop option: mysqlslap +.\" mariadb-slap: no-drop option +.\" no-drop option: mariadb-slap \fB\-\-no\-drop\fR .sp Do not drop any schema created during the test after the test is complete\&. @@ -641,8 +641,8 @@ Do not drop any schema created during the test after the test is complete\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-char-cols option -.\" number-char-cols option: mysqlslap +.\" mariadb-slap: number-char-cols option +.\" number-char-cols option: mariadb-slap \fB\-\-number\-char\-cols=\fR\fB\fIN\fR\fR, \fB\-x \fR\fB\fIN\fR\fR .sp @@ -661,8 +661,8 @@ is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-int-cols option -.\" number-int-cols option: mysqlslap +.\" mariadb-slap: number-int-cols option +.\" number-int-cols option: mariadb-slap \fB\-\-number\-int\-cols=\fR\fB\fIN\fR\fR, \fB\-y \fR\fB\fIN\fR\fR .sp @@ -681,12 +681,12 @@ is specified\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: number-of-queries option -.\" number-of-queries option: mysqlslap +.\" mariadb-slap: number-of-queries option +.\" number-of-queries option: mariadb-slap \fB\-\-number\-of\-queries=\fR\fB\fIN\fR\fR .sp Limit each client to approximately this many queries\&. Query counting takes into account the statement delimiter\&. For example, if you invoke -\fBmysqlslap\fR +\fBmariadb-slap\fR as follows, the ; delimiter is recognized so that each instance of the query string counts as two queries\&. As a result, 5 rows (not 10) are inserted\&. @@ -695,7 +695,7 @@ delimiter is recognized so that each instance of the query string counts as two .RS 4 .\} .nf -shell> \fBmysqlslap \-\-delimiter=";" \-\-number\-of\-queries=10\fR +shell> \fBmariadb-slap \-\-delimiter=";" \-\-number\-of\-queries=10\fR \fB\-\-query="use test;insert into t values(null)"\fR .fi .if n \{\ @@ -711,12 +711,12 @@ shell> \fBmysqlslap \-\-delimiter=";" \-\-number\-of\-queries=10\fR .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: only-print option -.\" only-print option: mysqlslap +.\" mariadb-slap: only-print option +.\" only-print option: mariadb-slap \fB\-\-only\-print\fR .sp Do not connect to databases\&. -\fBmysqlslap\fR +\fBmariadb-slap\fR only prints what it would have done\&. .RE .sp @@ -728,8 +728,8 @@ only prints what it would have done\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: password option -.\" password option: mysqlslap +.\" mariadb-slap: password option +.\" password option: mariadb-slap \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -742,7 +742,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysqlslap\fR +\fBmariadb-slap\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -756,8 +756,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pipe option -.\" pipe option: mysqlslap +.\" mariadb-slap: pipe option +.\" pipe option: mariadb-slap \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -772,8 +772,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: plugin-dir option -.\" plugin-dir option: mysqlslap +.\" mariadb-slap: plugin-dir option +.\" plugin-dir option: mariadb-slap \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -787,8 +787,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: port option -.\" port option: mysqlslap +.\" mariadb-slap: port option +.\" port option: mariadb-slap \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -804,8 +804,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: post-query option -.\" post-query option: mysqlslap +.\" mariadb-slap: post-query option +.\" post-query option: mariadb-slap \fB\-\-post\-query=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to execute after the tests have completed\&. This execution is not counted for timing purposes\&. @@ -819,8 +819,8 @@ The file or string containing the statement to execute after the tests have comp .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: post-system option -.\" post-system option: mysqlslap +.\" mariadb-slap: post-system option +.\" post-system option: mariadb-slap \fB\-\-post\-system=\fR\fB\fIstr\fR\fR .sp The string to execute via @@ -836,8 +836,8 @@ after the tests have completed\&. This execution is not counted for timing purpo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pre-query option -.\" pre-query option: mysqlslap +.\" mariadb-slap: pre-query option +.\" pre-query option: mariadb-slap \fB\-\-pre\-query=\fR\fB\fIvalue\fR\fR .sp The file or string containing the statement to execute before running the tests\&. This execution is not counted for timing purposes\&. @@ -851,8 +851,8 @@ The file or string containing the statement to execute before running the tests\ .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: pre-system option -.\" pre-system option: mysqlslap +.\" mariadb-slap: pre-system option +.\" pre-system option: mariadb-slap \fB\-\-pre\-system=\fR\fB\fIstr\fR\fR .sp The string to execute via @@ -868,8 +868,8 @@ before running the tests\&. This execution is not counted for timing purposes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: print-defaults option -.\" print-defaults option: mysqlslap +.\" mariadb-slap: print-defaults option +.\" print-defaults option: mariadb-slap \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. @@ -884,8 +884,8 @@ This must be given as the first argument\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: protocol option -.\" protocol option: mysqlslap +.\" mariadb-slap: protocol option +.\" protocol option: mariadb-slap \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -899,8 +899,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: query option -.\" query option: mysqlslap +.\" mariadb-slap: query option +.\" query option: mariadb-slap \fB\-\-query=\fR\fB\fIvalue\fR\fR, \fB\-q \fR\fB\fIvalue\fR\fR .sp @@ -917,8 +917,8 @@ statement to use for retrieving data\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: shared-memory-base-name option -.\" shared-memory-base-name option: mysqlslap +.\" mariadb-slap: shared-memory-base-name option +.\" shared-memory-base-name option: mariadb-slap \fB\-\-shared\-memory\-base\-name=\fR\fB\fIname\fR\fR .sp On Windows, the shared\-memory name to use, for connections made via shared memory to a local server\&. This option applies only if the server supports shared\-memory connections\&. @@ -932,8 +932,8 @@ On Windows, the shared\-memory name to use, for connections made via shared memo .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: silent option -.\" silent option: mysqlslap +.\" mariadb-slap: silent option +.\" silent option: mariadb-slap \fB\-\-silent\fR, \fB\-s\fR .sp @@ -948,8 +948,8 @@ Silent mode\&. No output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: socket option -.\" socket option: mysqlslap +.\" mariadb-slap: socket option +.\" socket option: mariadb-slap \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -966,8 +966,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL options -.\" SSL options: mysqlshow +.\" mariadb-slap: SSL options +.\" SSL options: mariadb-slap \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -982,8 +982,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA option -.\" SSL CA option: mysqlshow +.\" mariadb-slap: SSL CA option +.\" SSL CA option: mariadb-slap \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -998,8 +998,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL CA Path option -.\" SSL CA Path option: mysqlshow +.\" mariadb-slap: SSL CA Path option +.\" SSL CA Path option: mariadb-slap \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1014,8 +1014,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cert option -.\" SSL Cert option: mysqlshow +.\" mariadb-slap: SSL Cert option +.\" SSL Cert option: mariadb-slap \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1030,8 +1030,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Cipher option -.\" SSL Cipher option: mysqlshow +.\" mariadb-slap: SSL Cipher option +.\" SSL Cipher option: mariadb-slap \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1046,8 +1046,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Key option -.\" SSL Key option: mysqlshow +.\" mariadb-slap: SSL Key option +.\" SSL Key option: mariadb-slap \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1062,8 +1062,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crl option -.\" SSL CRL option: mysqlshow +.\" mariadb-slap: SSL Crl option +.\" SSL CRL option: mariadb-slap \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1078,8 +1078,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Crlpath option -.\" SSL Crlpath option: mysqlshow +.\" mariadb-slap: SSL Crlpath option +.\" SSL Crlpath option: mariadb-slap \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1094,8 +1094,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqlshow: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqlshow +.\" mariadb-slap: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-slap \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1109,8 +1109,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: user option -.\" user option: mysqlslap +.\" mariadb-slap: user option +.\" user option: mariadb-slap \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1125,8 +1125,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: verbose option -.\" verbose option: mysqlslap +.\" mariadb-slap: verbose option +.\" verbose option: mariadb-slap \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1141,8 +1141,8 @@ Verbose mode\&. Print more information about what the program does\&. This optio .sp -1 .IP \(bu 2.3 .\} -.\" mysqlslap: version option -.\" version option: mysqlslap +.\" mariadb-slap: version option +.\" version option: mariadb-slap \fB\-\-version\fR, \fB\-V\fR .sp @@ -1151,7 +1151,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-test.1 b/man/mariadb-test.1 index b1326ba8dbe..5baef13d4e0 100644 --- a/man/mariadb-test.1 +++ b/man/mariadb-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqltest -.\" mysqltest_embedded +.\" mariadb-test +.\" mariadb-test-embedded .SH "NAME" -mariadb-test \- program to run test cases (mysqltest is now a symlink to mariadb-test) +mariadb-test \- program to run test cases (mariadb-test is now a symlink to mariadb-test) .br -mysqltest_embedded \- program to run embedded test cases +mariadb-test-embedded \- program to run embedded test cases .SH "SYNOPSIS" -.HP \w'\fBmysqltest\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u -\fBmysqltest [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR -.HP \w'\fBmysqltest_embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u -\fBmysqltest_embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR +.HP \w'\fBmariadb-test\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u +\fBmariadb-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR +.HP \w'\fBmariadb-test-embedded\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB]\fR\ 'u +\fBmariadb-test-embedded [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysqltest\fR +\fBmariadb-test\fR program runs a test case against a MariaDB server and optionally compares the output with a result file\&. This program reads input written in a special test language\&. Typically, you invoke -\fBmysqltest\fR +\fBmariadb-test\fR via -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR rather than invoking it directly\&. .PP -\fBmysqltest_embedded\fR +\fBmariadb-test-embedded\fR is similar but is built with support for the -libmysqld +libmariadbd embedded server\&. .PP Features of -\fBmysqltest\fR: +\fBmariadb-test\fR: .sp .RS 4 .ie n \{\ @@ -82,7 +82,7 @@ Can test whether the result from an SQL statement or shell command is as expecte .IP \(bu 2.3 .\} Can connect to one or more standalone -\fBmysqld\fR +\fBmariadbd\fR servers and switch between connections .RE .sp @@ -94,24 +94,24 @@ servers and switch between connections .sp -1 .IP \(bu 2.3 .\} -Can connect to an embedded server (libmysqld), if MariaDB is compiled with support for -libmysqld\&. (In this case, the executable is named -\fBmysqltest_embedded\fR +Can connect to an embedded server (libmariadbd), if MariaDB is compiled with support for +libmariadbd\&. (In this case, the executable is named +\fBmariadb-test-embedded\fR rather than -\fBmysqltest\fR\&.) +\fBmariadb-test\fR\&.) .RE .PP By default, -\fBmysqltest\fR +\fBmariadb-test\fR reads the test case on the standard input\&. To run -\fBmysqltest\fR +\fBmariadb-test\fR this way, you normally invoke it like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqltest [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB] < \fR\fB\fItest_file\fR\fR +shell> \fBmariadb-test [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB] < \fR\fB\fItest_file\fR\fR .fi .if n \{\ .RE @@ -122,10 +122,10 @@ You can also name the test case file with a option\&. .PP The exit value from -\fBmysqltest\fR +\fBmariadb-test\fR is 0 for success, 1 for failure, and 62 if it skips the test case (for example, if after checking some preconditions it decides not to run the test)\&. .PP -\fBmysqltest\fR +\fBmariadb-test\fR supports the following options: .sp .RS 4 @@ -136,8 +136,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: help option -.\" help option: mysqltest +.\" mariadb-test: help option +.\" help option: mariadb-test \fB\-\-help\fR, \fB\-?\fR .sp @@ -152,8 +152,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: basedir option -.\" basedir option: mysqltest +.\" mariadb-test: basedir option +.\" basedir option: mariadb-test \fB\-\-basedir=\fR\fB\fIdir_name\fR\fR, \fB\-b \fR\fB\fIdir_name\fR\fR .sp @@ -168,8 +168,8 @@ The base directory for tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: character-sets-dir option -.\" character-sets-dir option: mysqltest +.\" mariadb-test: character-sets-dir option +.\" character-sets-dir option: mariadb-test \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -183,8 +183,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: compress option -.\" compress option: mysqltest +.\" mariadb-test: compress option +.\" compress option: mariadb-test \fB\-\-compress\fR, \fB\-C\fR .sp @@ -199,8 +199,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: connect-timeout option -.\" connect-timeout option: mysqltest +.\" mariadb-test: connect-timeout option +.\" connect-timeout option: mariadb-test \fB\-\-connect\-timeout=\fInum\fR .sp This can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options to change the number of seconds before an unsuccessful connection attempt times out\&. @@ -214,8 +214,8 @@ This can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: continue-on-error option -.\" continue-on-error option: mysqltest +.\" mariadb-test: continue-on-error option +.\" continue-on-error option: mariadb-test \fB\-\-continue\-on\-error\fR .sp Continue test even if we got an error\&. This is mostly @@ -232,8 +232,8 @@ a newly created big test file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: cursor-protocol option -.\" cursor-protocol option: mysqltest +.\" mariadb-test: cursor-protocol option +.\" cursor-protocol option: mariadb-test \fB\-\-cursor\-protocol\fR .sp Use cursors for prepared statements\&. @@ -247,8 +247,8 @@ Use cursors for prepared statements\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: database option -.\" database option: mysqltest +.\" mariadb-test: database option +.\" database option: mariadb-test \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -263,14 +263,14 @@ The default database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug option -.\" debug option: mysqltest +.\" mariadb-test: debug option +.\" debug option: mariadb-test \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-#[\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is 'd:t:S:i:O,/tmp/mysqltest.trace'. +value is 'd:t:S:i:O,/tmp/mariadb-test.trace'. .RE .sp .RS 4 @@ -281,8 +281,8 @@ value is 'd:t:S:i:O,/tmp/mysqltest.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug-check option -.\" debug-check option: mysqltest +.\" mariadb-test: debug-check option +.\" debug-check option: mariadb-test \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -296,8 +296,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: debug-info option -.\" debug-info option: mysqltest +.\" mariadb-test: debug-info option +.\" debug-info option: mariadb-test \fB\-\-debug\-info\fR .sp Print debugging information and memory and CPU usage statistics when the program exits\&. @@ -311,8 +311,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: host option -.\" host option: mysqltest +.\" mariadb-test: host option +.\" host option: mariadb-test \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -327,8 +327,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: logdir option -.\" logdir option: mysqltest +.\" mariadb-test: logdir option +.\" logdir option: mariadb-test \fB\-\-logdir=\fR\fB\fIdir_name\fR\fR .sp The directory to use for log files\&. @@ -342,8 +342,8 @@ The directory to use for log files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: mark-progress option -.\" mark-progress option: mysqltest +.\" mariadb-test: mark-progress option +.\" mark-progress option: mariadb-test \fB\-\-mark\-progress\fR .sp Write the line number and elapsed time to @@ -358,8 +358,8 @@ Write the line number and elapsed time to .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: max-connect-retries option -.\" max-connect-retries option: mysqltest +.\" mariadb-test: max-connect-retries option +.\" max-connect-retries option: mariadb-test \fB\-\-max\-connect\-retries=\fR\fB\fInum\fR\fR .sp The maximum number of connection attempts when connecting to server\&. @@ -373,8 +373,8 @@ The maximum number of connection attempts when connecting to server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: max-connections option -.\" max-connections option: mysqltest +.\" mariadb-test: max-connections option +.\" max-connections option: mariadb-test \fB\-\-max\-connections=\fR\fB\fInum\fR\fR .sp The maximum number of simultaneous server connections per client (that is, per test)\&. If not set, the maximum is 128\&. Minimum allowed limit is 8, maximum is 5120\&. @@ -388,8 +388,8 @@ The maximum number of simultaneous server connections per client (that is, per t .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: no-defaults option -.\" no-defaults option: mysqltest +.\" mariadb-test: no-defaults option +.\" no-defaults option: mariadb-test \fB\-\-no\-defaults\fR .sp Do not read default options from any option files\&. If used, this must be the first option\&. @@ -403,8 +403,8 @@ Do not read default options from any option files\&. If used, this must be the f .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: non-blocking-api option -.\" non-blocking-api option: mysqltest +.\" mariadb-test: non-blocking-api option +.\" non-blocking-api option: mariadb-test \fB\-\-non\-blocking\-api\fR .sp Use the non-blocking client API for communication\&. @@ -418,8 +418,8 @@ Use the non-blocking client API for communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: overlay-dir option -.\" overlay-dir option: mysqltest +.\" mariadb-test: overlay-dir option +.\" overlay-dir option: mariadb-test \fB\-\-overlay\-dir=\fIdir_name\fR .sp Overlay directory\&. @@ -433,8 +433,8 @@ Overlay directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: password option -.\" password option: mysqltest +.\" mariadb-test: password option +.\" password option: mariadb-test \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -457,8 +457,8 @@ option on the command line, you are prompted for one\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: plugin-dir option -.\" plugin-dir option: mysqltest +.\" mariadb-test: plugin-dir option +.\" plugin-dir option: mariadb-test \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -472,8 +472,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: port option -.\" port option: mysqltest +.\" mariadb-test: port option +.\" port option: mariadb-test \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -489,12 +489,12 @@ my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: prologue option -.\" prologue option: mysqltest +.\" mariadb-test: prologue option +.\" prologue option: mariadb-test \fB\-\-prologue=\fR\fB\fIname\fR\fR .sp Include the contents of the given file before processing the contents of the test file\&. The included file should have the same format as other -\fBmysqltest\fR +\fBmariadb-test\fR test files\&. This option has the same effect as putting a \-\-source \fIfile_name\fR command as the first line of the test file\&. @@ -508,8 +508,8 @@ command as the first line of the test file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: protocol option -.\" protocol option: mysqltest +.\" mariadb-test: protocol option +.\" protocol option: mariadb-test \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -523,8 +523,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: ps-protocol option -.\" ps-protocol option: mysqltest +.\" mariadb-test: ps-protocol option +.\" ps-protocol option: mariadb-test \fB\-\-ps\-protocol\fR .sp Use the prepared\-statement protocol for communication\&. @@ -538,13 +538,13 @@ Use the prepared\-statement protocol for communication\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: quiet option -.\" quiet option: mysqltest +.\" mariadb-test: quiet option +.\" quiet option: mariadb-test \fB\-\-quiet\fR .sp Suppress all normal output\&. This is a synonym for -.\" mysqltest: silent option -.\" silent option: mysqltest +.\" mariadb-test: silent option +.\" silent option: mariadb-test \fB\-\-silent\fR\&. .RE .sp @@ -556,8 +556,8 @@ Suppress all normal output\&. This is a synonym for .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: record option -.\" record option: mysqltest +.\" mariadb-test: record option +.\" record option: mariadb-test \fB\-\-record\fR, \fB\-r\fR .sp @@ -575,15 +575,15 @@ option, if that option is given\&. It is an error to use this option without als .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: result-file option -.\" result-file option: mysqltest +.\" mariadb-test: result-file option +.\" result-file option: mariadb-test \fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR, \fB\-R \fR\fB\fIfile_name\fR\fR .sp This option specifies the file for test case expected results\&. \fB\-\-result\-file\fR, together with \fB\-\-record\fR, determines how -\fBmysqltest\fR +\fBmariadb-test\fR treats the test actual and expected results for a test case: .sp .RS 4 @@ -595,7 +595,7 @@ treats the test actual and expected results for a test case: .IP \(bu 2.3 .\} If the test produces no results, -\fBmysqltest\fR +\fBmariadb-test\fR exits with an error message to that effect, unless \fB\-\-result\-file\fR is given and the named file is an empty file\&. @@ -612,7 +612,7 @@ is given and the named file is an empty file\&. Otherwise, if \fB\-\-result\-file\fR is not given, -\fBmysqltest\fR +\fBmariadb-test\fR sends test results to the standard output\&. .RE .sp @@ -628,9 +628,9 @@ With \fB\-\-result\-file\fR but not \fB\-\-record\fR, -\fBmysqltest\fR +\fBmariadb-test\fR reads the expected results from the given file and compares them with the actual results\&. If the results do not match, -\fBmysqltest\fR +\fBmariadb-test\fR writes a \&.reject file in the same directory as the result file, outputs a diff of the two files, and exits with an error\&. @@ -648,7 +648,7 @@ With both \fB\-\-result\-file\fR and \fB\-\-record\fR, -\fBmysqltest\fR +\fBmariadb-test\fR updates the given file by writing the actual test results to it\&. .RE .RE @@ -661,8 +661,8 @@ updates the given file by writing the actual test results to it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: result-format-version option -.\" result-format-version option: mysqltest +.\" mariadb-test: result-format-version option +.\" result-format-version option: mariadb-test \fB\-\-result\-format\-version=\fI#\fR .sp Version of the result file format to use\&. @@ -676,8 +676,8 @@ Version of the result file format to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: server-arg option -.\" server-arg option: mysqltest +.\" mariadb-test: server-arg option +.\" server-arg option: mariadb-test \fB\-\-server\-arg=\fR\fB\fIvalue\fR\fR, \fB\-A \fR\fB\fIvalue\fR\fR .sp @@ -695,8 +695,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: server-file option -.\" server-file option: mysqltest +.\" mariadb-test: server-file option +.\" server-file option: mariadb-test \fB\-\-server\-file=\fR\fB\fIfile_name\fR\fR, \fB\-F \fR\fB\fIfile_name\fR\fR .sp @@ -711,8 +711,8 @@ Read arguments for the embedded server from the given file\&. The file should co .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: silent option -.\" silent option: mysqltest +.\" mariadb-test: silent option +.\" silent option: mariadb-test \fB\-\-silent\fR, \fB\-s\fR .sp @@ -727,8 +727,8 @@ Suppress all normal output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: sleep option -.\" sleep option: mysqltest +.\" mariadb-test: sleep option +.\" sleep option: mariadb-test \fB\-\-sleep=\fR\fB\fInum\fR\fR, \fB\-T \fR\fB\fInum\fR\fR .sp @@ -752,8 +752,8 @@ commands in the test case\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: socket option -.\" socket option: mysqltest +.\" mariadb-test: socket option +.\" socket option: mariadb-test \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -770,12 +770,12 @@ localhost .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: sp-protocol option -.\" sp-protocol option: mysqltest +.\" mariadb-test: sp-protocol option +.\" sp-protocol option: mariadb-test \fB\-\-sp\-protocol\fR .sp Execute DML statements within a stored procedure\&. For every DML statement, -\fBmysqltest\fR +\fBmariadb-test\fR creates and invokes a stored procedure that executes the statement rather than executing the statement directly\&. .RE .sp @@ -787,8 +787,8 @@ creates and invokes a stored procedure that executes the statement rather than e .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL options -.\" SSL options: mysqltest +.\" mariadb-test: SSL options +.\" SSL options: mariadb-test \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -803,8 +803,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL CA option -.\" SSL CA option: mysqltest +.\" mariadb-test: SSL CA option +.\" SSL CA option: mariadb-test \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -819,8 +819,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL CA Path option -.\" SSL CA Path option: mysqltest +.\" mariadb-test: SSL CA Path option +.\" SSL CA Path option: mariadb-test \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -835,8 +835,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Cert option -.\" SSL Cert option: mysqltest +.\" mariadb-test: SSL Cert option +.\" SSL Cert option: mariadb-test \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -851,8 +851,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Cipher option -.\" SSL Cipher option: mysqltest +.\" mariadb-test: SSL Cipher option +.\" SSL Cipher option: mariadb-test \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -867,8 +867,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Key option -.\" SSL Key option: mysqltest +.\" mariadb-test: SSL Key option +.\" SSL Key option: mariadb-test \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -883,8 +883,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Crl option -.\" SSL CRL option: mysqltest +.\" mariadb-test: SSL Crl option +.\" SSL CRL option: mariadb-test \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -899,8 +899,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Crlpath option -.\" SSL Crlpath option: mysqltest +.\" mariadb-test: SSL Crlpath option +.\" SSL Crlpath option: mariadb-test \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -915,8 +915,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysqltest +.\" mariadb-test: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-test \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -930,8 +930,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: suite-dir option -.\" suite-dir option: mysqltest +.\" mariadb-test: suite-dir option +.\" suite-dir option: mariadb-test \fB\-\-suite\-dir=\fIdir_name\fR .sp Suite directory\&. @@ -945,8 +945,8 @@ Suite directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: tail-lines option -.\" tail-lines option: mysqltest +.\" mariadb-test: tail-lines option +.\" tail-lines option: mariadb-test \fB\-\-tail\-lines=\fR\fB\fInn\fR\fR .sp Specify how many lines of the result to include in the output if the test fails because an SQL statement fails\&. The default is 0, meaning no lines of result printed\&. @@ -960,8 +960,8 @@ Specify how many lines of the result to include in the output if the test fails .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: test-file option -.\" test-file option: mysqltest +.\" mariadb-test: test-file option +.\" test-file option: mariadb-test \fB\-\-test\-file=\fR\fB\fIfile_name\fR\fR, \fB\-x \fR\fB\fIfile_name\fR\fR .sp @@ -976,13 +976,13 @@ Read test input from this file\&. The default is to read from the standard input .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: timer-file option -.\" timer-file option: mysqltest +.\" mariadb-test: timer-file option +.\" timer-file option: mariadb-test \fB\-\-timer\-file=\fR\fB\fIfile_name\fR\fR, \fB\-m \fR\fB\fIfile_name\fR\fR .sp If given, the number of microseconds spent running the test will be written to this file\&. This is used by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR for its reporting\&. .RE .sp @@ -994,8 +994,8 @@ for its reporting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: tmpdir option -.\" tmpdir option: mysqltest +.\" mariadb-test: tmpdir option +.\" tmpdir option: mariadb-test \fB\-\-tmpdir=\fR\fB\fIdir_name\fR\fR, \fB\-t \fR\fB\fIdir_name\fR\fR .sp @@ -1010,8 +1010,8 @@ The temporary directory where socket files are created\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: user option -.\" user option: mysqltest +.\" mariadb-test: user option +.\" user option: mariadb-test \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1026,8 +1026,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: verbose option -.\" verbose option: mysqltest +.\" mariadb-test: verbose option +.\" verbose option: mariadb-test \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1042,8 +1042,8 @@ Verbose mode\&. Print out more information about what the program does\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: version option -.\" version option: mysqltest +.\" mariadb-test: version option +.\" version option: mariadb-test \fB\-\-version\fR, \fB\-V\fR .sp @@ -1058,8 +1058,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqltest: view-protocol option -.\" view-protocol option: mysqltest +.\" mariadb-test: view-protocol option +.\" view-protocol option: mariadb-test \fB\-\-view\-protocol\fR .sp Every @@ -1069,7 +1069,7 @@ statement is wrapped inside a view\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-tzinfo-to-sql.1 b/man/mariadb-tzinfo-to-sql.1 index e287db0c9ce..f1b751229d7 100644 --- a/man/mariadb-tzinfo-to-sql.1 +++ b/man/mariadb-tzinfo-to-sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "22 April 2022" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,17 +11,17 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_tzinfo_to_sql +.\" mariadb-tzinfo-to-sql .\" time zone tables .SH "NAME" -mariadb-tzinfo-to-sql \- load the time zone tables (mysql_tzinfo_to_sql is now a symlink to mariadb-tzinfo-to-sql) +mariadb-tzinfo-to-sql \- load the time zone tables (mariadb-tzinfo-to-sql is now a symlink to mariadb-tzinfo-to-sql) .SH "SYNOPSIS" -.HP \w'\fBmysql_tzinfo_to_sql\ \fR\fB\fIarguments\fR\fR\ 'u -\fBmysql_tzinfo_to_sql \fR\fB\fIarguments\fR\fR +.HP \w'\fBmariadb-tzinfo-to-sql\ \fR\fB\fIarguments\fR\fR\ 'u +\fBmariadb-tzinfo-to-sql \fR\fB\fIarguments\fR\fR .SH "DESCRIPTION" .PP The -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR program loads the time zone tables in the mysql database\&. It is used on systems that have a @@ -31,45 +31,45 @@ database (the set of files describing time zones)\&. Examples of such systems ar directory (/usr/share/lib/zoneinfo on Solaris)\&. .PP -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR can be invoked several ways: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_dir\fR\fR -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file tz_name\fR\fR -shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR -shell> \fBmysql_tzinfo_to_sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_dir\fR\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_file tz_name\fR\fR +shell> \fBmariadb-tzinfo-to-sql \-\-leap \fR\fB\fItz_file\fR\fR +shell> \fBmariadb-tzinfo-to-sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR .fi .if n \{\ .RE .\} .PP For the first invocation syntax, pass the zoneinfo directory path name to -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR and send the output into the -\fBmysql\fR +\fBmariadb\fR program\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql /usr/share/zoneinfo | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql /usr/share/zoneinfo | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR reads your system's time zone files and generates SQL statements from them\&. -\fBmysql\fR +\fBmariadb\fR processes those statements to load the time zone tables\&. .PP The second syntax causes -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR to load a single time zone file \fItz_file\fR that corresponds to a time zone name @@ -79,14 +79,14 @@ that corresponds to a time zone name .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file\fR\fR\fB \fR\fB\fItz_name\fR\fR\fB | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql \fR\fB\fItz_file\fR\fR\fB \fR\fB\fItz_name\fR\fR\fB | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP If your time zone needs to account for leap seconds, invoke -\fBmysql_tzinfo_to_sql\fR +\fBmariadb-tzinfo-to-sql\fR using the third syntax, which initializes the leap second information\&. \fItz_file\fR is the name of your time zone file: @@ -95,21 +95,21 @@ is the name of your time zone file: .RS 4 .\} .nf -shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mysql \-u root mysql\fR +shell> \fBmariadb-tzinfo-to-sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mariadb \-u root mysql\fR .fi .if n \{\ .RE .\} .PP Using the \-\-skip\-write\-binlog option prevents writing of changes to the binary log or to other Galera -cluster members. This can be used with any form of running \fBmysql_tzinfo_to_sql\fR. +cluster members. This can be used with any form of running \fBmariadb-tzinfo-to-sql\fR. .PP After running -\fBmysql_tzinfo_to_sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&. +\fBmariadb-tzinfo-to-sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-upgrade.1 b/man/mariadb-upgrade.1 index fb4988cd040..32d506d8dfe 100644 --- a/man/mariadb-upgrade.1 +++ b/man/mariadb-upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-UPGRADE\fR" "1" "20 July 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-UPGRADE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,26 +11,26 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_upgrade -.\" upgrading MySQL -.\" MySQL: upgrading +.\" mariadb-upgrade +.\" upgrading MariaDB +.\" MariaDB: upgrading .SH "NAME" -mariadb-upgrade \- check tables for MariaDB upgrade (mysql_upgrade is now a symlink to mariadb-upgrade) +mariadb-upgrade \- check tables for MariaDB upgrade (mariadb-upgrade is now a symlink to mariadb-upgrade) .SH "SYNOPSIS" -.HP \w'\fBmysql_upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb-upgrade\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb-upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR examines all tables in all databases for incompatibilities with the current version of the MariaDB Server\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added\&. .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR should be executed each time you upgrade MariaDB\&. .PP If a table is found to have a possible incompatibility, -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR performs a table check\&. If any problems are found, a table repair is attempted\&. .if n \{\ .sp @@ -46,7 +46,7 @@ performs a table check\&. If any problems are found, a table repair is attempted .br .PP On Windows Server 2008 and Windows Vista, you must run -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR with administrator privileges\&. You can do this by running a Command Prompt as Administrator and running the command\&. Failure to do so may result in the upgrade failing to execute correctly\&. .sp .5v .RE @@ -70,31 +70,31 @@ performing an upgrade\&. .RE .PP To use -\fBmysql_upgrade\fR, make sure that the server is running, and then invoke it like this: +\fBmariadb-upgrade\fR, make sure that the server is running, and then invoke it like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb-upgrade [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP After running -\fBmysql_upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&. +\fBmariadb-upgrade\fR, stop the server and restart it so that any changes made to the system tables take effect\&. .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR executes the following commands to check and repair tables and to upgrade the system tables: .sp .if n \{\ .RS 4 .\} .nf -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair -mysql < \fIfix_priv_tables\fR -mysqlcheck \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names +mariadb-check \-\-all\-databases \-\-check\-upgrade \-\-auto\-repair +mariadb < \fIfix_priv_tables\fR +mariadb-check \-\-all\-databases \-\-check\-upgrade \-\-fix\-db\-names \-\-fix\-table\-names .fi .if n \{\ .RE @@ -111,9 +111,9 @@ Notes about the preceding commands: .IP \(bu 2.3 .\} Because -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR invokes -\fBmysqlcheck\fR +\fBmariadb-check\fR with the \fB\-\-all\-databases\fR option, it processes all tables in all databases, which might take a long time to complete\&. Each table is locked and therefore unavailable to other sessions while it is being processed\&. Check and repair operations can be time\-consuming, particularly for large tables\&. @@ -146,43 +146,43 @@ statement\&. .\} \fIfix_priv_tables\fR represents a script generated internally by -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR that contains SQL statements to upgrade the tables in the mysql database\&. .RE .PP All checked and repaired tables are marked with the current MariaDB version number\&. This ensures that next time you run -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR with the same version of the server, it can tell whether there is any need to check or repair the table again\&. -.\" mysql_upgrade_info file: mysql_upgrade -.\" mysql_upgrade: mysql_upgrade_info file +.\" mariadb-upgrade_info file: mariadb-upgrade +.\" mariadb-upgrade: mariadb-upgrade_info file .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also saves the MariaDB version number in a file named -mysql_upgrade_info +mariadb-upgrade_info in the data directory\&. This is used to quickly check whether all tables have been checked for this release so that table\-checking can be skipped\&. To ignore this file and perform the check regardless, use the \fB\-\-force\fR option\&. .PP -For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&. +For this reason, \fBmariadb-upgrade\fR needs to be run as a user with write access to the data directory\&. .PP If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR is included in the server RPM but requires the client RPM because the latter includes -\fBmysqlcheck\fR\&. +\fBmariadb-check\fR\&. .PP .PP -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR supports the following options, which can be specified on the command line or in the -[mysql_upgrade] +[mariadb-upgrade] and [client] option file groups\&. Other options are passed to -\fBmysqlcheck\fR\&. For example, it might be necessary to specify the +\fBmariadb-check\fR\&. For example, it might be necessary to specify the \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR option\&. -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR also supports the options for processing option files\&. .sp .RS 4 @@ -193,8 +193,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: help option -.\" help option: mysql_upgrade +.\" mariadb-upgrade: help option +.\" help option: mariadb-upgrade \fB\-\-help\fR, \fB\-?\fR .sp @@ -209,8 +209,8 @@ Display a short help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: basedir option -.\" basedir option: mysql_upgrade +.\" mariadb-upgrade: basedir option +.\" basedir option: mariadb-upgrade \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -224,8 +224,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: character-sets-dir option -.\" character-sets-dir option: mysql_upgrade +.\" mariadb-upgrade: character-sets-dir option +.\" character-sets-dir option: mariadb-upgrade \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -239,8 +239,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: check-if-upgrade-is-needed option -.\" check-if-upgrade-is-needed option: mysql_upgrade +.\" mariadb-upgrade: check-if-upgrade-is-needed option +.\" check-if-upgrade-is-needed option: mariadb-upgrade \fB\-\-check\-if\-upgrade\-is\-needed\fR .sp Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgrade needed or current version couldn't be determined, 1 when no action required\&. @@ -254,8 +254,8 @@ Exit with a status code indicating if an upgrade is needed\&. Returns 0 if upgra .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: datadir option -.\" datadir option: mysql_upgrade +.\" mariadb-upgrade: datadir option +.\" datadir option: mariadb-upgrade \fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -269,8 +269,8 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug option -.\" debug option: mysql_upgrade +.\" mariadb-upgrade: debug option +.\" debug option: mariadb-upgrade \fB\-\-debug=\fR\fB\fIpath\fR\fR, \fB\-# \fIpath\fR\fR .sp @@ -285,8 +285,8 @@ For debug builds, output debug log\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug-check option -.\" debug-check option: mysql_upgrade +.\" mariadb-upgrade: debug-check option +.\" debug-check option: mariadb-upgrade \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -300,8 +300,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: debug-info option -.\" debug-info option: mysql_upgrade +.\" mariadb-upgrade: debug-info option +.\" debug-info option: mariadb-upgrade \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -316,8 +316,8 @@ Print debugging information and memory and CPU usage statistics when the program .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: default-character-set option -.\" default-character-set option: mysql_upgrade +.\" mariadb-upgrade: default-character-set option +.\" default-character-set option: mariadb-upgrade \fB\-\-default\-character\-set=\fR\fB\fIname\fR\fR .sp Old option accepted for backward compatibility but ignored\&. @@ -331,16 +331,16 @@ Old option accepted for backward compatibility but ignored\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: force option -.\" force option: mysql_upgrade +.\" mariadb-upgrade: force option +.\" force option: mariadb-upgrade \fB\-\-force\fR .sp Ignore the -mysql_upgrade_info +mariadb-upgrade_info file and force execution of -\fBmysqlcheck\fR +\fBmariadb-check\fR even if -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR has already been executed for the current version of MariaDB\&. .RE .sp @@ -352,8 +352,8 @@ has already been executed for the current version of MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: host option -.\" host option: mysql_upgrade +.\" mariadb-upgrade: host option +.\" host option: mariadb-upgrade \fB\-\-host\fR .sp Connect to MariaDB on the given host\&. @@ -367,8 +367,8 @@ Connect to MariaDB on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: password option -.\" password option: mysql_upgrade +.\" mariadb-upgrade: password option +.\" password option: mariadb-upgrade \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -381,7 +381,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -395,8 +395,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: port option -.\" port option: mysql_upgrade +.\" mariadb-upgrade: port option +.\" port option: mariadb-upgrade \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -411,8 +411,8 @@ The TCP/IP port number to use for the connection\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: protocol option -.\" protocol option: mysql_upgrade +.\" mariadb-upgrade: protocol option +.\" protocol option: mariadb-upgrade \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -426,8 +426,8 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: silent option -.\" silent option: mysql_upgrade +.\" mariadb-upgrade: silent option +.\" silent option: mariadb-upgrade \fB\-\-silent\fR .sp Print less information\&. @@ -441,8 +441,8 @@ Print less information\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: socket option -.\" socket option: mysql_upgrade +.\" mariadb-upgrade: socket option +.\" socket option: mariadb-upgrade \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -458,8 +458,8 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL options -.\" SSL options: mysql_upgrade +.\" mariadb-upgrade: SSL options +.\" SSL options: mariadb-upgrade \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -474,8 +474,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL CA option -.\" SSL CA option: mysql_upgrade +.\" mariadb-upgrade: SSL CA option +.\" SSL CA option: mariadb-upgrade \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -490,8 +490,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL CA Path option -.\" SSL CA Path option: mysql_upgrade +.\" mariadb-upgrade: SSL CA Path option +.\" SSL CA Path option: mariadb-upgrade \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -506,8 +506,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Cert option -.\" SSL Cert option: mysql_upgrade +.\" mariadb-upgrade: SSL Cert option +.\" SSL Cert option: mariadb-upgrade \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -522,8 +522,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Cipher option -.\" SSL Cipher option: mysql_upgrade +.\" mariadb-upgrade: SSL Cipher option +.\" SSL Cipher option: mariadb-upgrade \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -538,8 +538,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Key option -.\" SSL Key option: mysql_upgrade +.\" mariadb-upgrade: SSL Key option +.\" SSL Key option: mariadb-upgrade \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -554,8 +554,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Crl option -.\" SSL CRL option: mysql_upgrade +.\" mariadb-upgrade: SSL Crl option +.\" SSL CRL option: mariadb-upgrade \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -570,8 +570,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Crlpath option -.\" SSL Crlpath option: mysql_upgrade +.\" mariadb-upgrade: SSL Crlpath option +.\" SSL Crlpath option: mariadb-upgrade \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -586,8 +586,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysql_upgrade +.\" mariadb-upgrade: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb-upgrade \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -601,8 +601,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: tmpdir option -.\" tmpdir option: mysql_upgrade +.\" mariadb-upgrade: tmpdir option +.\" tmpdir option: mariadb-upgrade \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR, \fB\-t \fR\fB\fIpath\fR\fR .sp @@ -617,8 +617,8 @@ The path name of the directory to use for creating temporary files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: upgrade-system-tables option -.\" upgrade-system-tables option: mysql_upgrade +.\" mariadb-upgrade: upgrade-system-tables option +.\" upgrade-system-tables option: mariadb-upgrade \fB\-\-upgrade\-system\-tables\fR\fR, \fB\-s \fR .sp @@ -633,8 +633,8 @@ Only upgrade the system tables in the mysql database\&. Tables in other database .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: user option -.\" user option: mysql_upgrade +.\" mariadb-upgrade: user option +.\" user option: mariadb-upgrade \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -649,15 +649,15 @@ The MariaDB user name to use when connecting to the server and not using the cur .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: verbose option -.\" verbose option: mysql_upgrade +.\" mariadb-upgrade: verbose option +.\" verbose option: mariadb-upgrade \fB\-\-verbose\fR .sp Display more output about the process\&. Using it twice will print connection arguments; using it 3 times will print out all CHECK, RENAME and ALTER TABLE commands used during the check phase; using it 4 times (added in MariaDB 10.0.14) will also write out all mariadb-check commands used; using it 5 times will print all -the mariadb commands used and their results while running mysql_fix_privilege_tables script\&. +the mariadb commands used and their results while running mariadb-fix-privilege-tables script\&. .RE .sp .RS 4 @@ -668,8 +668,8 @@ the mariadb commands used and their results while running mysql_fix_privilege_ta .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: version option -.\" version option: mysql_upgrade +.\" mariadb-upgrade: version option +.\" version option: mariadb-upgrade \fB\-\-version\fR, \fB\-V\fR .sp @@ -684,8 +684,8 @@ Output version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: version-check option -.\" version-check option: mysql_upgrade +.\" mariadb-upgrade: version-check option +.\" version-check option: mariadb-upgrade \fB\-\-version\-check\fR, \fB\-k\fR .sp @@ -703,18 +703,18 @@ it was built/distributed. Defaults to on; use \fB\-\-skip\-version\-check\fR to .sp -1 .IP \(bu 2.3 .\} -.\" mysql_upgrade: write-binlog option -.\" write-binlog option: mysql_upgrade +.\" mariadb-upgrade: write-binlog option +.\" write-binlog option: mariadb-upgrade \fB\-\-write\-binlog\fR .sp Cause binary logging to be enabled while -\fBmysql_upgrade\fR +\fBmariadb-upgrade\fR runs\&. .RE .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-waitpid.1 b/man/mariadb-waitpid.1 index 268518d5b98..3c4448d3faa 100644 --- a/man/mariadb-waitpid.1 +++ b/man/mariadb-waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-WAITPID\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-WAITPID\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,34 +11,34 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_waitpid +.\" mariadb-waitpid .SH "NAME" -mariadb-waitpid \- kill process and wait for its termination (mysql_waitpid is now a symlink to mariadb-waitpid) +mariadb-waitpid \- kill process and wait for its termination (mariadb-waitpid is now a symlink to mariadb-waitpid) .SH "SYNOPSIS" -.HP \w'\fBmysql_waitpid\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpid\fR\fR\fB\ \fR\fB\fIwait_time\fR\fR\ 'u -\fBmysql_waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR +.HP \w'\fBmariadb-waitpid\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIpid\fR\fR\fB\ \fR\fB\fIwait_time\fR\fR\ 'u +\fBmariadb-waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR signals a process to terminate and waits for the process to exit\&. It uses the kill() system call and Unix signals, so it runs on Unix and Unix\-like systems\&. .PP Invoke -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR +shell> \fBmariadb-waitpid [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIpid\fR\fR\fB \fR\fB\fIwait_time\fR\fR .fi .if n \{\ .RE .\} .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR sends signal 0 to the process identified by \fIpid\fR and waits up to @@ -50,16 +50,16 @@ and must be positive integers\&. .PP If process termination occurs within the wait time or the process does not exist, -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR returns 0\&. Otherwise, it returns 1\&. .PP If the kill() system call cannot handle signal 0, -\fBmysql_waitpid()\fR +\fBmariadb-waitpid()\fR uses signal 1 instead\&. .PP -\fBmysql_waitpid\fR +\fBmariadb-waitpid\fR supports the following options: .sp .RS 4 @@ -70,8 +70,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: help option -.\" help option: mysql_waitpid +.\" mariadb-waitpid: help option +.\" help option: mariadb-waitpid \fB\-\-help\fR, \fB\-?\fR, \fB\-I\fR @@ -87,8 +87,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: verbose option -.\" verbose option: mysql_waitpid +.\" mariadb-waitpid: verbose option +.\" verbose option: mariadb-waitpid \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -103,8 +103,8 @@ Verbose mode\&. Display a warning if signal 0 could not be used and signal 1 is .sp -1 .IP \(bu 2.3 .\} -.\" mysql_waitpid: version option -.\" version option: mysql_waitpid +.\" mariadb-waitpid: version option +.\" version option: mariadb-waitpid \fB\-\-version\fR, \fB\-V\fR .sp @@ -113,7 +113,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb.1 b/man/mariadb.1 index fec2b5c3724..2e65f9c50bb 100644 --- a/man/mariadb.1 +++ b/man/mariadb.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,7 +11,7 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql +.\" mariadb .\" command-line tool .\" tools: command-line .\" scripts: SQL @@ -20,11 +20,11 @@ .SH "NAME" mariadb \- the MariaDB command\-line tool (mysql is now a symlink to mariadb) .SH "SYNOPSIS" -.HP \w'\fBmysql\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u -\fBmysql [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR +.HP \w'\fBmariadb\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdb_name\fR\fR\ 'u +\fBmariadb [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR .SH "DESCRIPTION" .PP -\fBmysql\fR +\fBmariadb\fR is a simple SQL shell (with GNU readline capabilities)\&. It supports interactive and non\-interactive use\&. When used interactively, query results are presented in an ASCII\-table format\&. When used non\-interactively (for example, as a filter), the result is presented in tab\-separated format\&. The output format can be changed using command options\&. @@ -32,21 +32,21 @@ capabilities)\&. It supports interactive and non\-interactive use\&. When used i If you have problems due to insufficient memory for large result sets, use the \fB\-\-quick\fR option\&. This forces -\fBmysql\fR +\fBmariadb\fR to retrieve results from the server a row at a time rather than retrieving the entire result set and buffering it in memory before displaying it\&. This is done by returning the result set using the -mysql_use_result() +mariadb_use_result() C API function in the client/server library rather than mysql_store_result()\&. .PP Using -\fBmysql\fR +\fBmariadb\fR is very easy\&. Invoke it from the prompt of your command interpreter as follows: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -58,7 +58,7 @@ Or: .RS 4 .\} .nf -shell> \fBmysql \-\-user=\fR\fB\fIuser_name\fR\fR\fB \-\-password=\fR\fB\fIyour_password\fR\fR\fB \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \-\-user=\fR\fB\fIuser_name\fR\fR\fB \-\-password=\fR\fB\fIyour_password\fR\fR\fB \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE @@ -71,9 +71,9 @@ Then type an SQL statement, end it with and press Enter\&. .PP Typing Control\-C causes -\fBmysql\fR +\fBmariadb\fR to attempt to kill the current statement\&. If this cannot be done, or Control\-C is typed again before the statement is killed, -\fBmysql\fR +\fBmariadb\fR exits\&. .PP You can execute SQL statements in a script file (batch file) like this: @@ -82,22 +82,22 @@ You can execute SQL statements in a script file (batch file) like this: .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIscript\&.sql\fR\fR\fB > \fR\fB\fIoutput\&.tab\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIscript\&.sql\fR\fR\fB > \fR\fB\fIoutput\&.tab\fR\fR .fi .if n \{\ .RE .\} -.SH "MYSQL OPTIONS" -.\" mysql command options -.\" command options: mysql -.\" options: command-line: mysql -.\" startup parameters: mysql +.SH "MARIADB OPTIONS" +.\" mariadb command options +.\" command options: mariadb +.\" options: command-line: mariadb +.\" startup parameters: mariadb .PP -\fBmysql\fR +\fBmariadb\fR supports the following options, which can be specified on the command line or in the -[mysql], [client], [client-server] or [client-mariadb] +[mariadb], [client], [client-server] or [client-mariadb] option file groups\&. -\fBmysql\fR +\fBmariadb\fR also supports the options for processing option files\&. .sp .RS 4 @@ -108,8 +108,8 @@ also supports the options for processing option files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: help option -.\" help option: mysql +.\" mariadb: help option +.\" help option: mariadb \fB\-\-help\fR, \fB\-?\fR, \fB\-I\fR @@ -125,8 +125,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: abort-source-on-error option -.\" abort-source-on-error: mysql +.\" mariadb: abort-source-on-error option +.\" abort-source-on-error: mariadb \fB\-\-abort\-source\-on\-error\fR .sp Abort 'source filename' operations in case of errors\&. @@ -140,20 +140,20 @@ Abort 'source filename' operations in case of errors\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: auto-rehash option -.\" auto-rehash option: mysql +.\" mariadb: auto-rehash option +.\" auto-rehash option: mariadb \fB\-\-auto\-rehash\fR .sp Enable automatic rehashing\&. This option is on by default, which enables database, table, and column name completion\&. Use \fB\-\-disable\-auto\-rehash\fR, \fB\-\-no\-auto\-rehash\fR, or \fB\-\-skip\-auto\-rehash\fR to disable rehashing\&. That causes -\fBmysql\fR +\fBmariadb\fR to start faster, but you must issue the rehash command if you want to use name completion\&. .sp To complete a name, enter the first part and press Tab\&. If the name is unambiguous, -\fBmysql\fR +\fBmariadb\fR completes it\&. Otherwise, you can press Tab again to see the possible names that begin with what you have typed so far\&. Completion does not occur if there is no default database\&. .RE .sp @@ -165,8 +165,8 @@ completes it\&. Otherwise, you can press Tab again to see the possible names tha .sp -1 .IP \(bu 2.3 .\} -.\" mysql: auto-vertical-output option -.\" auto-vertical-output option: mysql +.\" mariadb: auto-vertical-output option +.\" auto-vertical-output option: mariadb \fB\-\-auto\-vertical\-output\fR .sp Automatically switch to vertical output mode if the result is wider than the terminal width\&. @@ -180,13 +180,13 @@ Automatically switch to vertical output mode if the result is wider than the ter .sp -1 .IP \(bu 2.3 .\} -.\" mysql: batch option -.\" batch option: mysql +.\" mariadb: batch option +.\" batch option: mariadb \fB\-\-batch\fR, \fB\-B\fR .sp Print results using tab as the column separator, with each row on a new line\&. With this option, -\fBmysql\fR +\fBmariadb\fR does not use the history file\&. .sp Batch mode results in nontabular output format and escaping of special characters\&. Escaping may be disabled by using raw mode; see the description for the @@ -202,15 +202,15 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: binary-mode option -.\" binary-mode option: mysql +.\" mariadb: binary-mode option +.\" binary-mode option: mariadb \fB\-\-binary\-mode\fR .sp Binary mode allows certain character sequences to be processed as data that would otherwise be treated with a special meaning by the parser\&. Specifically, this switch turns off parsing of all client commands except \eC and DELIMITER in non-interactive mode (i\&.e\&., when binary mode is combined -with either 1) piped input, 2) the --batch mysql option, or 3) the 'source' +with either 1) piped input, 2) the --batch mariadb option, or 3) the 'source' command)\&. Also, in binary mode, occurrences of '\er\en' and ASCII '\e0' are preserved within strings, whereas by default, '\er\en' is translated to '\en' and '\e0' is disallowed in user input\&. @@ -224,8 +224,8 @@ and '\e0' is disallowed in user input\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: character-sets-dir option -.\" character-sets-dir option: mysql +.\" mariadb: character-sets-dir option +.\" character-sets-dir option: mariadb \fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR .sp The directory where character sets are installed\&. @@ -239,8 +239,8 @@ The directory where character sets are installed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: column-names option -.\" column-names option: mysql +.\" mariadb: column-names option +.\" column-names option: mariadb \fB\-\-column\-names\fR .sp Write column names in results\&. @@ -254,8 +254,8 @@ Write column names in results\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: column-type-info option -.\" column-type-info option: mysql +.\" mariadb: column-type-info option +.\" column-type-info option: mariadb \fB\-\-column\-type\-info\fR, \fB\-m\fR .sp @@ -270,8 +270,8 @@ Display result set metadata\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: comments option -.\" comments option: mysql +.\" mariadb: comments option +.\" comments option: mariadb \fB\-\-comments\fR, \fB\-c\fR .sp @@ -286,8 +286,8 @@ Whether to preserve comments in statements sent to the server\&. The default is .sp -1 .IP \(bu 2.3 .\} -.\" mysql: compress option -.\" compress option: mysql +.\" mariadb: compress option +.\" compress option: mariadb \fB\-\-compress\fR, \fB\-C\fR .sp @@ -302,8 +302,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysql: connect-timeout option -.\" connect-timeout option: mysql +.\" mariadb: connect-timeout option +.\" connect-timeout option: mariadb \fB\-\-connect\-timeout=\fR\fB\fIseconds\fR\fR .sp Set the number of seconds before connection timeout\&. (Default value is 0\&.) @@ -317,8 +317,8 @@ Set the number of seconds before connection timeout\&. (Default value is 0\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: database option -.\" database option: mysql +.\" mariadb: database option +.\" database option: mariadb \fB\-\-database=\fR\fB\fIdb_name\fR\fR, \fB\-D \fR\fB\fIdb_name\fR\fR .sp @@ -333,8 +333,8 @@ The database to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug option -.\" debug option: mysql +.\" mariadb: debug option +.\" debug option: mariadb \fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR, \fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR .sp @@ -351,8 +351,8 @@ string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysql.trace'. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug-check option -.\" debug-check option: mysql +.\" mariadb: debug-check option +.\" debug-check option: mariadb \fB\-\-debug\-check\fR .sp Print some debugging information when the program exits\&. @@ -366,8 +366,8 @@ Print some debugging information when the program exits\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: debug-info option -.\" debug-info option: mysql +.\" mariadb: debug-info option +.\" debug-info option: mariadb \fB\-\-debug\-info\fR, \fB\-T\fR .sp @@ -382,8 +382,8 @@ Prints debugging information and memory and CPU usage statistics when the progra .sp -1 .IP \(bu 2.3 .\} -.\" mysql: default-auth option -.\" default-auth option: mysql +.\" mariadb: default-auth option +.\" default-auth option: mariadb \fB\-\-default\-auth=\fR\fB\fIname\fR .sp Default authentication client-side plugin to use\&. @@ -397,8 +397,8 @@ Default authentication client-side plugin to use\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: default-character-set option -.\" default-character-set option: mysql +.\" mariadb: default-character-set option +.\" default-character-set option: mariadb \fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR .sp Use @@ -408,7 +408,7 @@ as the default character set for the client and connection\&. A common issue that can occur when the operating system uses utf8 or another multi\-byte character set is that output from the -\fBmysql\fR +\fBmariadb\fR client is formatted incorrectly, due to the fact that the MariaDB client uses the latin1 character set by default\&. You can usually fix such issues by using this option to force the client to use the system character set instead\&. @@ -422,8 +422,8 @@ character set by default\&. You can usually fix such issues by using this option .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-extra-file option -.\" defaults-extra-file option: mysql +.\" mariadb: defaults-extra-file option +.\" defaults-extra-file option: mariadb \fB\-\-defaults-extra-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&. @@ -438,8 +438,8 @@ Must be given as first option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-file option -.\" defaults-file option: mysql +.\" mariadb: defaults-file option +.\" defaults-file option: mariadb \fB\-\-defaults-file=\fR\fB\fIfilename\fR\fR .sp Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&. Must be given as first option\&. @@ -453,8 +453,8 @@ Set \fB\fIfilename\fR\fR as the file to read default options from, override glob .sp -1 .IP \(bu 2.3 .\} -.\" mysql: defaults-group-suffix option -.\" defaults-group-suffix option: mysql +.\" mariadb: defaults-group-suffix option +.\" defaults-group-suffix option: mariadb \fB\-\-defaults\-group\-suffix=\fR\fB\fIsuffix\fR\fR .sp In addition to the groups named on the command line, read groups that have the given suffix\&. @@ -468,8 +468,8 @@ In addition to the groups named on the command line, read groups that have the g .sp -1 .IP \(bu 2.3 .\} -.\" mysql: delimiter option -.\" delimiter option: mysql +.\" mariadb: delimiter option +.\" delimiter option: mariadb \fB\-\-delimiter=\fR\fB\fIstr\fR\fR .sp Set the statement delimiter\&. The default is the semicolon character (\(lq;\(rq)\&. @@ -483,18 +483,18 @@ Set the statement delimiter\&. The default is the semicolon character (\(lq;\(rq .sp -1 .IP \(bu 2.3 .\} -.\" mysql: disable named commands -.\" disable named command: mysql +.\" mariadb: disable named commands +.\" disable named command: mariadb \fB\-\-disable\-named\-commands\fR .sp Disable named commands\&. Use the \e* form only, or use named commands only at the beginning of a line ending with a semicolon (\(lq;\(rq)\&. -\fBmysql\fR +\fBmariadb\fR starts with this option \fIenabled\fR by default\&. However, even with this option, long\-format commands still work from the first line\&. See -the section called \(lqMYSQL COMMANDS\(rq\&. +the section called \(lqMARIADB COMMANDS\(rq\&. .RE .sp .RS 4 @@ -505,8 +505,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: enable cleartext plugin option -.\" enable cleartext plugin option: mysql +.\" mariadb: enable cleartext plugin option +.\" enable cleartext plugin option: mariadb \fB\-\-enable\-cleartext\-plugin\fR .sp Obsolete option\&. Exists only for MySQL compatibility\&. @@ -520,8 +520,8 @@ Obsolete option\&. Exists only for MySQL compatibility\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: execute option -.\" execute option: mysql +.\" mariadb: execute option +.\" execute option: mariadb \fB\-\-execute=\fR\fB\fIstatement\fR\fR, \fB\-e \fR\fB\fIstatement\fR\fR .sp @@ -537,8 +537,8 @@ Execute the statement and quit\&. Disables \fB\-\-force\fR and history file\&. T .sp -1 .IP \(bu 2.3 .\} -.\" mysql: force option -.\" force option: mysql +.\" mariadb: force option +.\" force option: mariadb \fB\-\-force\fR, \fB\-f\fR .sp @@ -553,8 +553,8 @@ Continue even if an SQL error occurs\&. Sets \fB\-\-abort\-source\-on-error\fR t .sp -1 .IP \(bu 2.3 .\} -.\" mysql: host option -.\" host option: mysql +.\" mariadb: host option +.\" host option: mariadb \fB\-\-host=\fR\fB\fIhost_name\fR\fR, \fB\-h \fR\fB\fIhost_name\fR\fR .sp @@ -569,8 +569,8 @@ Connect to the MariaDB server on the given host\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: html option -.\" html option: mysql +.\" mariadb: html option +.\" html option: mariadb \fB\-\-html\fR, \fB\-H\fR .sp @@ -585,8 +585,8 @@ Produce HTML output\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: ignore-spaces option -.\" ignore-spaces option: mysql +.\" mariadb: ignore-spaces option +.\" ignore-spaces option: mariadb \fB\-\-ignore\-spaces\fR, \fB\-i\fR .sp @@ -601,8 +601,8 @@ Ignore spaces after function names\&. Allows one to have spaces (including tab c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: init-command option -.\" init-command option: mysql +.\" mariadb: init-command option +.\" init-command option: mariadb \fB\-\-init\-command=\fR\fB\fIstr\fR\fR\fR .sp SQL Command to execute when connecting to the MariaDB server\&. Will automatically be re-executed when reconnecting\&. @@ -616,8 +616,8 @@ SQL Command to execute when connecting to the MariaDB server\&. Will automatical .sp -1 .IP \(bu 2.3 .\} -.\" mysql: line-numbers option -.\" line-numbers option: mysql +.\" mariadb: line-numbers option +.\" line-numbers option: mariadb \fB\-\-line\-numbers\fR .sp Write line numbers for errors\&. Disable this with @@ -632,8 +632,8 @@ Write line numbers for errors\&. Disable this with .sp -1 .IP \(bu 2.3 .\} -.\" mysql: local-infile option -.\" local-infile option: mysql +.\" mariadb: local-infile option +.\" local-infile option: mariadb \fB\-\-local\-infile[={0|1}]\fR .sp Enable or disable @@ -658,8 +658,8 @@ has no effect if the server does not also support it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: max-allowed-packet option -.\" max-allowed-packet option: mysql +.\" mariadb: max-allowed-packet option +.\" max-allowed-packet option: mariadb \fB\-\-max\-allowed\-packet=\fR\fB\fInum\fR\fR .sp Set the maximum packet length to send to or receive from the server\&. (Default value is 16MB, largest 1GB\&.) @@ -673,8 +673,8 @@ Set the maximum packet length to send to or receive from the server\&. (Default .sp -1 .IP \(bu 2.3 .\} -.\" mysql: max-join-size option -.\" max-join-size option: mysql +.\" mariadb: max-join-size option +.\" max-join-size option: mariadb \fB\-\-max\-join\-size=\fR\fB\fInum\fR\fR .sp Set the automatic limit for rows in a join when using @@ -689,13 +689,13 @@ Set the automatic limit for rows in a join when using .sp -1 .IP \(bu 2.3 .\} -.\" mysql: named-commands option -.\" named-commands option: mysql +.\" mariadb: named-commands option +.\" named-commands option: mariadb \fB\-\-named\-commands\fR, \fB\-G\fR .sp Enable named -\fBmysql\fR +\fBmariadb\fR commands\&. Long\-format commands are allowed, not just short\-format commands\&. For example, quit and @@ -703,7 +703,7 @@ and both are recognized\&. Use \fB\-\-skip\-named\-commands\fR to disable named commands\&. See -the section called \(lqMYSQL COMMANDS\(rq\&. Disabled by default\&. +the section called \(lqMARIADB COMMANDS\(rq\&. Disabled by default\&. .RE .sp .RS 4 @@ -716,8 +716,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. Disabled by default\&. .\} \h'-04'\(bu\h'+03'\c .\} -.\" mysql: net-buffer-length option -.\" net-buffer-length option: mysql +.\" mariadb: net-buffer-length option +.\" net-buffer-length option: mariadb \fB\-\-net\-buffer\-length=\fR\fB\fIsize\fR\fR .sp Set the buffer size for TCP/IP and socket communication\&. (Default value is 16KB\&.) @@ -731,8 +731,8 @@ Set the buffer size for TCP/IP and socket communication\&. (Default value is 16K .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-auto-rehash option -.\" no-auto-rehash option: mysql +.\" mariadb: no-auto-rehash option +.\" no-auto-rehash option: mariadb \fB\-\-no\-auto\-rehash\fR, \fB\-A\fR .sp @@ -749,8 +749,8 @@ This has the same effect as .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-beep option -.\" no-beep option: mysql +.\" mariadb: no-beep option +.\" no-beep option: mariadb \fB\-\-no\-beep\fR, \fB\-b\fR .sp @@ -765,8 +765,8 @@ Do not beep when errors occur\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: no-defaults option -.\" no-defaults option: mysql +.\" mariadb: no-defaults option +.\" no-defaults option: mariadb \fB\-\-no\-defaults\fR .sp Do not read default options from any option file\&. This must be given as the first argument\&. @@ -780,8 +780,8 @@ Do not read default options from any option file\&. This must be given as the fi .sp -1 .IP \(bu 2.3 .\} -.\" mysql: one-database option -.\" one-database option: mysql +.\" mariadb: one-database option +.\" one-database option: mariadb \fB\-\-one\-database\fR, \fB\-o\fR .sp @@ -796,8 +796,8 @@ Ignore statements except those those that occur while the default database is th .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pager option -.\" pager option: mysql +.\" mariadb: pager option +.\" pager option: mariadb \fB\-\-pager[=\fR\fB\fIcommand\fR\fR\fB]\fR .sp Use the given command for paging query output\&. If the command is omitted, the default pager is the value of your @@ -807,7 +807,7 @@ environment variable\&. Valid pagers are \fBmore\fR, \fBcat [> filename]\fR, and so forth\&. This option works only on Unix and only in interactive mode\&. To disable paging, use \fB\-\-skip\-pager\fR\&. -the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&. +the section called \(lqMARIADB COMMANDS\(rq, discusses output paging further\&. .RE .sp .RS 4 @@ -818,8 +818,8 @@ the section called \(lqMYSQL COMMANDS\(rq, discusses output paging further\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: password option -.\" password option: mysql +.\" mariadb: password option +.\" password option: mariadb \fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR, \fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR .sp @@ -832,7 +832,7 @@ value following the or \fB\-p\fR option on the command line, -\fBmysql\fR +\fBmariadb\fR prompts for one\&. .sp Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. @@ -846,8 +846,8 @@ Specifying a password on the command line should be considered insecure\&. You c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pipe option -.\" pipe option: mysql +.\" mariadb: pipe option +.\" pipe option: mariadb \fB\-\-pipe\fR, \fB\-W\fR .sp @@ -862,8 +862,8 @@ On Windows, connect to the server via a named pipe\&. This option applies only i .sp -1 .IP \(bu 2.3 .\} -.\" mysql: plugin-dir option -.\" plugin-dir option: mysql +.\" mariadb: plugin-dir option +.\" plugin-dir option: mariadb \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -877,8 +877,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: port option -.\" port option: mysql +.\" mariadb: port option +.\" port option: mariadb \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp @@ -894,8 +894,8 @@ Forces --protocol=tcp when specified on the command line without other connectio .sp -1 .IP \(bu 2.3 .\} -.\" mysql: print-defaults option -.\" print-defaults option: mysql +.\" mariadb: print-defaults option +.\" print-defaults option: mariadb \fB\-\-print\-defaults\fR .sp Print the program argument list and exit\&. This must be given as the first argument\&. @@ -909,8 +909,8 @@ Print the program argument list and exit\&. This must be given as the first argu .sp -1 .IP \(bu 2.3 .\} -.\" mysql: progress-reports option -.\" progress-reports option: mysql +.\" mariadb: progress-reports option +.\" progress-reports option: mariadb \fB\-\-progress\-reports\fR .sp Get progress reports for long running commands (such as ALTER TABLE)\&. (Defaults to on; use \fB\-\-skip\-progress\-reports\fR to disable\&.) @@ -924,12 +924,12 @@ Get progress reports for long running commands (such as ALTER TABLE)\&. (Default .sp -1 .IP \(bu 2.3 .\} -.\" mysql: prompt option -.\" prompt option: mysql +.\" mariadb: prompt option +.\" prompt option: mariadb \fB\-\-prompt=\fR\fB\fIformat_str\fR\fR .sp Set the prompt to the specified format\&. The special sequences that the prompt can contain are described in -the section called \(lqMYSQL COMMANDS\(rq\&. +the section called \(lqMARIADB COMMANDS\(rq\&. .RE .sp .RS 4 @@ -940,8 +940,8 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: protocol option -.\" protocol option: mysql +.\" mariadb: protocol option +.\" protocol option: mariadb \fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR .sp The connection protocol to use for connecting to the server\&. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want\&. @@ -955,13 +955,13 @@ The connection protocol to use for connecting to the server\&. It is useful when .sp -1 .IP \(bu 2.3 .\} -.\" mysql: quick option -.\" quick option: mysql +.\" mariadb: quick option +.\" quick option: mariadb \fB\-\-quick\fR, \fB\-q\fR .sp Do not cache each query result, print each row as it is received\&. This may slow down the server if the output is suspended\&. With this option, -\fBmysql\fR +\fBmariadb\fR does not use the history file\&. .RE .sp @@ -973,8 +973,8 @@ does not use the history file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: raw option -.\" raw option: mysql +.\" mariadb: raw option +.\" raw option: mariadb \fB\-\-raw\fR, \fB\-r\fR .sp @@ -999,19 +999,19 @@ The following example demonstrates tabular versus nontabular output and the use .RS 4 .\} .nf -% \fBmysql\fR -mysql> SELECT CHAR(92); +% \fBmariadb\fR +mariadb> SELECT CHAR(92); +\-\-\-\-\-\-\-\-\-\-+ | CHAR(92) | +\-\-\-\-\-\-\-\-\-\-+ | \e | +\-\-\-\-\-\-\-\-\-\-+ -% \fBmysql \-s\fR -mysql> SELECT CHAR(92); +% \fBmariadb \-s\fR +mariadb> SELECT CHAR(92); CHAR(92) \e\e -% \fBmysql \-s \-r\fR -mysql> SELECT CHAR(92); +% \fBmariadb \-s \-r\fR +mariadb> SELECT CHAR(92); CHAR(92) \e .fi @@ -1028,8 +1028,8 @@ CHAR(92) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: reconnect option -.\" reconnect option: mysql +.\" mariadb: reconnect option +.\" reconnect option: mariadb \fB\-\-reconnect\fR .sp If the connection to the server is lost, automatically try to reconnect\&. A single reconnect attempt is made each time the connection is lost\&. Enabled by default, to disable use @@ -1044,10 +1044,10 @@ If the connection to the server is lost, automatically try to reconnect\&. A sin .sp -1 .IP \(bu 2.3 .\} -.\" mysql: safe-updates option -.\" safe-updates option: mysql -.\" mysql: i-am-a-dummy option -.\" i-am-a-dummy option: mysql +.\" mariadb: safe-updates option +.\" safe-updates option: mariadb +.\" mariadb: i-am-a-dummy option +.\" i-am-a-dummy option: mariadb \fB\-\-safe\-updates\fR, \fB\-\-i\-am\-a\-dummy\fR, \fB\-U\fR @@ -1059,7 +1059,7 @@ DELETE statements that specify which rows to modify by using key values\&. If you have set this option in an option file, you can override it by using \fB\-\-safe\-updates\fR on the command line\&. See -the section called \(lqMYSQL TIPS\(rq, for more information about this option\&. +the section called \(lqMARIADB TIPS\(rq, for more information about this option\&. .RE .sp .RS 4 @@ -1070,8 +1070,8 @@ the section called \(lqMYSQL TIPS\(rq, for more information about this option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: secure-auth option -.\" secure-auth option: mysql +.\" mariadb: secure-auth option +.\" secure-auth option: mariadb \fB\-\-secure\-auth\fR .sp Do not send passwords to the server in old (pre\-4\&.1\&.1) format\&. This prevents connections except for servers that use the newer password format\&. @@ -1085,8 +1085,8 @@ Do not send passwords to the server in old (pre\-4\&.1\&.1) format\&. This preve .sp -1 .IP \(bu 2.3 .\} -.\" mysql: select-limit option -.\" select-limit option: mysql +.\" mariadb: select-limit option +.\" select-limit option: mariadb \fB\-\-select\-limit=\fR\fB\fIlimit\fR\fR .sp Set automatic limit for SELECT when using \fB\-\-safe\-updates\fR\&. (Default value is 1,000\&.) @@ -1100,8 +1100,8 @@ Set automatic limit for SELECT when using \fB\-\-safe\-updates\fR\&. (Default va .sp -1 .IP \(bu 2.3 .\} -.\" mysql: server-arg option -.\" server-arg option: mysql +.\" mariadb: server-arg option +.\" server-arg option: mariadb \fB\-\-server\-arg=\fR\fB\fIname\fR\fR .sp Send \fB\fIname\fR\fR as a parameter to the embedded server\&. @@ -1115,8 +1115,8 @@ Send \fB\fIname\fR\fR as a parameter to the embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: show-warnings option -.\" show-warnings option: mysql +.\" mariadb: show-warnings option +.\" show-warnings option: mariadb \fB\-\-show\-warnings\fR .sp Cause warnings to be shown after each statement if there are any\&. This option applies to interactive and batch mode\&. @@ -1130,8 +1130,8 @@ Cause warnings to be shown after each statement if there are any\&. This option .sp -1 .IP \(bu 2.3 .\} -.\" mysql: sigint-ignore option -.\" sigint-ignore option: mysql +.\" mariadb: sigint-ignore option +.\" sigint-ignore option: mariadb \fB\-\-sigint\-ignore\fR .sp Ignore @@ -1147,8 +1147,8 @@ signals (typically the result of typing Control\-C)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: silent option -.\" silent option: mysql +.\" mariadb: silent option +.\" silent option: mariadb \fB\-\-silent\fR, \fB\-s\fR .sp @@ -1167,8 +1167,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-auto-rehash option -.\" skip-auto-rehash option: mysql +.\" mariadb: skip-auto-rehash option +.\" skip-auto-rehash option: mariadb \fB\-\-skip\-auto\-rehash\fR .sp Disable automatic rehashing\&. Synonym for \fB\-\-disable\-auto\-rehash\fR\&. @@ -1182,8 +1182,8 @@ Disable automatic rehashing\&. Synonym for \fB\-\-disable\-auto\-rehash\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-column-names option -.\" skip-column-names option: mysql +.\" mariadb: skip-column-names option +.\" skip-column-names option: mariadb \fB\-\-skip\-column\-names\fR, \fB\-N\fR .sp @@ -1198,8 +1198,8 @@ Do not write column names in results\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: skip-line-numbers option -.\" skip-line-numbers option: mysql +.\" mariadb: skip-line-numbers option +.\" skip-line-numbers option: mariadb \fB\-\-skip\-line\-numbers\fR, \fB\-L\fR .sp @@ -1214,8 +1214,8 @@ Do not write line numbers for errors\&. Useful when you want to compare result f .sp -1 .IP \(bu 2.3 .\} -.\" mysql: socket option -.\" socket option: mysql +.\" mariadb: socket option +.\" socket option: mariadb \fB\-\-socket=\fR\fB\fIpath\fR\fR, \fB\-S \fR\fB\fIpath\fR\fR .sp @@ -1232,8 +1232,8 @@ Forces --protocol=socket when specified on the command line without other connec .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL options -.\" SSL options: mysql +.\" mariadb: SSL options +.\" SSL options: mariadb \fB\-\-ssl\fR .sp Enable SSL for connection (automatically enabled with other flags). Disable with @@ -1248,8 +1248,8 @@ Enable SSL for connection (automatically enabled with other flags). Disable with .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL CA option -.\" SSL CA option: mysql +.\" mariadb: SSL CA option +.\" SSL CA option: mariadb \fB\-\-ssl\-ca=\fIname\fR .sp CA file in PEM format (check OpenSSL docs, implies @@ -1264,8 +1264,8 @@ CA file in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL CA Path option -.\" SSL CA Path option: mysql +.\" mariadb: SSL CA Path option +.\" SSL CA Path option: mariadb \fB\-\-ssl\-capath=\fIname\fR .sp CA directory (check OpenSSL docs, implies @@ -1280,8 +1280,8 @@ CA directory (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Cert option -.\" SSL Cert option: mysql +.\" mariadb: SSL Cert option +.\" SSL Cert option: mariadb \fB\-\-ssl\-cert=\fIname\fR .sp X509 cert in PEM format (check OpenSSL docs, implies @@ -1296,8 +1296,8 @@ X509 cert in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Cipher option -.\" SSL Cipher option: mysql +.\" mariadb: SSL Cipher option +.\" SSL Cipher option: mariadb \fB\-\-ssl\-cipher=\fIname\fR .sp SSL cipher to use (check OpenSSL docs, implies @@ -1312,8 +1312,8 @@ SSL cipher to use (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Key option -.\" SSL Key option: mysql +.\" mariadb: SSL Key option +.\" SSL Key option: mariadb \fB\-\-ssl\-key=\fIname\fR .sp X509 key in PEM format (check OpenSSL docs, implies @@ -1328,8 +1328,8 @@ X509 key in PEM format (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Crl option -.\" SSL CRL option: mysql +.\" mariadb: SSL Crl option +.\" SSL CRL option: mariadb \fB\-\-ssl\-crl=\fIname\fR .sp Certificate revocation list (check OpenSSL docs, implies @@ -1344,8 +1344,8 @@ Certificate revocation list (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Crlpath option -.\" SSL Crlpath option: mysql +.\" mariadb: SSL Crlpath option +.\" SSL Crlpath option: mariadb \fB\-\-ssl\-crlpath=\fIname\fR .sp Certificate revocation list path (check OpenSSL docs, implies @@ -1360,8 +1360,8 @@ Certificate revocation list path (check OpenSSL docs, implies .sp -1 .IP \(bu 2.3 .\} -.\" mysql: SSL Verify Server Cert option -.\" SSL Verify Server Cert option: mysql +.\" mariadb: SSL Verify Server Cert option +.\" SSL Verify Server Cert option: mariadb \fB\-\-ssl\-verify\-server\-cert\fR .sp Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\&. @@ -1375,8 +1375,8 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: table option -.\" table option: mysql +.\" mariadb: table option +.\" table option: mariadb \fB\-\-table\fR, \fB\-t\fR .sp @@ -1391,12 +1391,12 @@ Display output in table format\&. This is the default for interactive use, but c .sp -1 .IP \(bu 2.3 .\} -.\" mysql: tee option -.\" tee option: mysql +.\" mariadb: tee option +.\" tee option: mariadb \fB\-\-tee=\fR\fB\fIfile_name\fR\fR .sp Append a copy of output to the given file\&. This option works only in interactive mode\&. -the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&. +the section called \(lqMARIADB COMMANDS\(rq, discusses tee files further\&. .RE .sp .RS 4 @@ -1407,8 +1407,8 @@ the section called \(lqMYSQL COMMANDS\(rq, discusses tee files further\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: unbuffered option -.\" unbuffered option: mysql +.\" mariadb: unbuffered option +.\" unbuffered option: mariadb \fB\-\-unbuffered\fR, \fB\-n\fR .sp @@ -1423,8 +1423,8 @@ Flush the buffer after each query\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: user option -.\" user option: mysql +.\" mariadb: user option +.\" user option: mariadb \fB\-\-user=\fR\fB\fIuser_name\fR\fR, \fB\-u \fR\fB\fIuser_name\fR\fR .sp @@ -1439,8 +1439,8 @@ The MariaDB user name to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: verbose option -.\" verbose option: mysql +.\" mariadb: verbose option +.\" verbose option: mariadb \fB\-\-verbose\fR, \fB\-v\fR .sp @@ -1457,8 +1457,8 @@ produces table output format even in batch mode\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: version option -.\" version option: mysql +.\" mariadb: version option +.\" version option: mariadb \fB\-\-version\fR, \fB\-V\fR .sp @@ -1473,8 +1473,8 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: vertical option -.\" vertical option: mysql +.\" mariadb: vertical option +.\" vertical option: mariadb \fB\-\-vertical\fR, \fB\-E\fR .sp @@ -1490,8 +1490,8 @@ Print query output rows vertically (one line per column value)\&. Without this o .sp -1 .IP \(bu 2.3 .\} -.\" mysql: wait option -.\" wait option: mysql +.\" mariadb: wait option +.\" wait option: mariadb \fB\-\-wait\fR, \fB\-w\fR .sp @@ -1506,8 +1506,8 @@ If the connection cannot be established, wait and retry instead of aborting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: xml option -.\" xml option: mysql +.\" mariadb: xml option +.\" xml option: mariadb \fB\-\-xml\fR, \fB\-X\fR .sp @@ -1515,10 +1515,10 @@ Produce XML output\&. The output when \fB\-\-xml\fR is used with -\fBmysql\fR +\fBmariadb\fR matches that of -\fBmysqldump \fR\fB\fB\-\-xml\fR\fR\&. See -\fBmysqldump\fR(1) +\fBmariadb-dump \fR\fB\fB\-\-xml\fR\fR\&. See +\fBmariadb-dump\fR(1) for details\&. .sp The XML output also uses an XML namespace, as shown here: @@ -1527,7 +1527,7 @@ The XML output also uses an XML namespace, as shown here: .RS 4 .\} .nf -shell> \fBmysql \-\-xml \-uroot \-e "SHOW VARIABLES LIKE 'version%'"\fR +shell> \fBmariadb \-\-xml \-uroot \-e "SHOW VARIABLES LIKE 'version%'"\fR @@ -1632,15 +1632,15 @@ statements when using .\" environment variable: MARIADB_HISTFILE .\" HOME environment variable .\" environment variable: HOME -.\" mysql history file -.\" command-line history: mysql +.\" mariadb history file +.\" command-line history: mariadb .\" .mariadb_history file .PP On Unix, the -\fBmysql\fR +\fBmariadb\fR client writes a record of executed statements to a history file\&. By default, this file is named \&.mariadb_history -and is created in your home directory\&. For backwards compatibility \&.mysql_history will be used if present and +and is created in your home directory\&. For backwards compatibility \&.mariadb_history will be used if present and \&.mariadb_history is missing\&. To specify a different file, set the value of the MARIADB_HISTFILE environment variable\&. The environment variable MYSQL_HISTFILE will be used if MARIADB_HISTFILE isn't present\&. @@ -1692,42 +1692,42 @@ shell> \fBln \-s /dev/null $HOME/\&.mariadb_history\fR .sp You need do this only once\&. .RE -.SH "MYSQL COMMANDS" +.SH "MARIADB COMMANDS" .PP -\fBmysql\fR +\fBmariadb\fR sends each SQL statement that you issue to the server to be executed\&. There is also a set of commands that -\fBmysql\fR +\fBmariadb\fR itself interprets\&. For a list of these commands, type help or \eh at the -mysql> +mariadb> prompt: -.\" mysql commands: list of +.\" mariadb commands: list of .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp\fR -List of all MySQL commands: +mariadb> \fBhelp\fR +List of all MariaDB commands: Note that all text commands must be first on line and end with ';' ? (\e?) Synonym for 'help'\&. clear (\ec) Clear command\&. connect (\er) Reconnect to the server\&. Optional arguments are db and host\&. delimiter (\ed) Set statement delimiter\&. edit (\ee) Edit command with $EDITOR\&. -ego (\eG) Send command to mysql server, display result vertically\&. -exit (\eq) Exit mysql\&. Same as quit\&. -go (\eg) Send command to mysql server\&. +ego (\eG) Send command to mariadb server, display result vertically\&. +exit (\eq) Exit mariadb\&. Same as quit\&. +go (\eg) Send command to mariadb server\&. help (\eh) Display this help\&. nopager (\en) Disable pager, print to stdout\&. notee (\et) Don't write into outfile\&. pager (\eP) Set PAGER [to_pager]\&. Print the query results via PAGER\&. print (\ep) Print current command\&. -prompt (\eR) Change your mysql prompt\&. -quit (\eq) Quit mysql\&. +prompt (\eR) Change your mariadb prompt\&. +quit (\eq) Quit mariadb\&. rehash (\e#) Rebuild completion hash\&. source (\e\&.) Execute an SQL script file\&. Takes a file name as an argument\&. status (\es) Get status information from the server\&. @@ -1759,23 +1759,23 @@ comments is not supported\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: help command -.\" help command: mysql +.\" mariadb: help command +.\" help command: mariadb \fBhelp [\fR\fB\fIarg\fR\fR\fB]\fR, \fB\eh [\fR\fB\fIarg\fR\fR\fB]\fR, \fB\e? [\fR\fB\fIarg\fR\fR\fB]\fR, \fB? [\fR\fB\fIarg\fR\fR\fB]\fR .sp Display a help message listing the available -\fBmysql\fR +\fBmariadb\fR commands\&. .sp If you provide an argument to the help command, -\fBmysql\fR +\fBmariadb\fR uses it as a search string to access server\-side help\&. For more information, see -the section called \(lqMYSQL SERVER-SIDE HELP\(rq\&. +the section called \(lqMARIADB SERVER-SIDE HELP\(rq\&. .RE .sp .RS 4 @@ -1786,15 +1786,15 @@ the section called \(lqMYSQL SERVER-SIDE HELP\(rq\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: charset command -.\" charset command: mysql +.\" mariadb: charset command +.\" charset command: mariadb \fBcharset \fR\fB\fIcharset_name\fR\fR, \fB\eC \fR\fB\fIcharset_name\fR\fR .sp Change the default character set and issue a SET NAMES statement\&. This enables the character set to remain synchronized on the client and server if -\fBmysql\fR +\fBmariadb\fR is run with auto\-reconnect enabled (which is not recommended), because the specified character set is used for reconnects\&. .RE .sp @@ -1806,8 +1806,8 @@ is run with auto\-reconnect enabled (which is not recommended), because the spec .sp -1 .IP \(bu 2.3 .\} -.\" mysql: clear command -.\" clear command: mysql +.\" mariadb: clear command +.\" clear command: mariadb \fBclear\fR, \fB\ec\fR .sp @@ -1822,8 +1822,8 @@ Clear the current input\&. Use this if you change your mind about executing the .sp -1 .IP \(bu 2.3 .\} -.\" mysql: connect command -.\" connect command: mysql +.\" mariadb: connect command +.\" connect command: mariadb \fBconnect [\fR\fB\fIdb_name\fR\fR\fB \fR\fB\fIhost_name\fR\fR\fB]]\fR, \fB\er [\fR\fB\fIdb_name\fR\fR\fB \fR\fB\fIhost_name\fR\fR\fB]]\fR .sp @@ -1838,19 +1838,19 @@ Reconnect to the server\&. The optional database name and host name arguments ma .sp -1 .IP \(bu 2.3 .\} -.\" mysql: delimiter command -.\" delimiter command: mysql +.\" mariadb: delimiter command +.\" delimiter command: mariadb \fBdelimiter \fR\fB\fIstr\fR\fR, \fB\ed \fR\fB\fIstr\fR\fR .sp Change the string that -\fBmysql\fR +\fBmariadb\fR interprets as the separator between SQL statements\&. The default is the semicolon character (\(lq;\(rq)\&. .sp The delimiter can be specified as an unquoted or quoted argument\&. Quoting can be done with either single quote (') or douple quote (") characters\&. To include a quote within a quoted string, either quote the string with the other quote character or escape the quote with a backslash (\(lq\e\(rq) character\&. Backslash should be avoided outside of quoted strings because it is the escape character for MariaDB\&. For an unquoted argument, the delmiter is read up to the first space or end of line\&. For a quoted argument, the delimiter is read up to the matching quote on the line\&. .sp When the delimiter recognized by -\fBmysql\fR +\fBmariadb\fR is set to something other than the default of \(lq;\(rq, instances of that character are sent to the server without interpretation\&. However, the server itself still interprets \(lq;\(rq @@ -1865,13 +1865,13 @@ as a statement delimiter and processes statements accordingly\&. This behavior o .sp -1 .IP \(bu 2.3 .\} -.\" mysql: edit command -.\" edit command: mysql +.\" mariadb: edit command +.\" edit command: mariadb \fBedit\fR, \fB\ee\fR .sp Edit the current input statement\&. -\fBmysql\fR +\fBmariadb\fR checks the values of the EDITOR and @@ -1893,8 +1893,8 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: ego command -.\" ego command: mysql +.\" mariadb: ego command +.\" ego command: mariadb \fBego\fR, \fB\eG\fR .sp @@ -1909,13 +1909,13 @@ Send the current statement to the server to be executed and display the result u .sp -1 .IP \(bu 2.3 .\} -.\" mysql: exit command -.\" exit command: mysql +.\" mariadb: exit command +.\" exit command: mariadb \fBexit\fR, \fB\eq\fR .sp Exit -\fBmysql\fR\&. +\fBmariadb\fR\&. .RE .sp .RS 4 @@ -1926,8 +1926,8 @@ Exit .sp -1 .IP \(bu 2.3 .\} -.\" mysql: go command -.\" go command: mysql +.\" mariadb: go command +.\" go command: mariadb \fBgo\fR, \fB\eg\fR .sp @@ -1942,8 +1942,8 @@ Send the current statement to the server to be executed\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: nopager command -.\" nopager command: mysql +.\" mariadb: nopager command +.\" nopager command: mariadb \fBnopager\fR, \fB\en\fR .sp @@ -1963,8 +1963,8 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: notee command -.\" notee command: mysql +.\" mariadb: notee command +.\" notee command: mariadb \fBnotee\fR, \fB\et\fR .sp @@ -1980,8 +1980,8 @@ Disable output copying to the tee file\&. See the description for .sp -1 .IP \(bu 2.3 .\} -.\" mysql: nowarning command -.\" nowarning command: mysql +.\" mariadb: nowarning command +.\" nowarning command: mariadb \fBnowarning\fR, \fB\ew\fR .sp @@ -1996,18 +1996,18 @@ Enable display of warnings after each statement\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: pager command -.\" pager command: mysql +.\" mariadb: pager command +.\" pager command: mariadb \fBpager [\fR\fB\fIcommand\fR\fR\fB]\fR, \fB\eP [\fR\fB\fIcommand\fR\fR\fB]\fR .sp Enable output paging\&. By using the \fB\-\-pager\fR option when you invoke -\fBmysql\fR, it is possible to browse or search query results in interactive mode with Unix programs such as +\fBmariadb\fR, it is possible to browse or search query results in interactive mode with Unix programs such as \fBless\fR, \fBmore\fR, or any other similar program\&. If you specify no value for the option, -\fBmysql\fR +\fBmariadb\fR checks the value of the PAGER environment variable and sets the pager to that\&. Pager functionality works only in interactive mode\&. @@ -2036,8 +2036,8 @@ for browsing output in some situations\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: print command -.\" print command: mysql +.\" mariadb: print command +.\" print command: mariadb \fBprint\fR, \fB\ep\fR .sp @@ -2052,21 +2052,21 @@ Print the current input statement without executing it\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: prompt command -.\" prompt command: mysql +.\" mariadb: prompt command +.\" prompt command: mariadb \fBprompt [\fR\fB\fIstr\fR\fR\fB]\fR, \fB\eR [\fR\fB\fIstr\fR\fR\fB]\fR .sp Reconfigure the -\fBmysql\fR +\fBmariadb\fR prompt to the given string\&. The special character sequences that can be used in the prompt are described later in this section\&. .sp If you specify the prompt command with no argument, -\fBmysql\fR +\fBmariadb\fR resets the prompt to the default of -mysql>\&. +mariadb>\&. .RE .sp .RS 4 @@ -2077,13 +2077,13 @@ mysql>\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: quit command -.\" quit command: mysql +.\" mariadb: quit command +.\" quit command: mariadb \fBquit\fR, \fB\eq\fR .sp Exit -\fBmysql\fR\&. +\fBmariadb\fR\&. .RE .sp .RS 4 @@ -2094,8 +2094,8 @@ Exit .sp -1 .IP \(bu 2.3 .\} -.\" mysql: rehash command -.\" rehash command: mysql +.\" mariadb: rehash command +.\" rehash command: mariadb \fBrehash\fR, \fB\e#\fR .sp @@ -2112,8 +2112,8 @@ option\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql: source command -.\" source command: mysql +.\" mariadb: source command +.\" source command: mariadb \fBsource \fR\fB\fIfile_name\fR\fR, \fB\e\&. \fR\fB\fIfile_name\fR\fR .sp @@ -2131,8 +2131,8 @@ or .sp -1 .IP \(bu 2.3 .\} -.\" mysql: status command -.\" status command: mysql +.\" mariadb: status command +.\" status command: mariadb \fBstatus\fR, \fB\es\fR .sp @@ -2141,7 +2141,7 @@ Provide status information about the connection and the server you are using\&. mode, status also prints the values for the -\fBmysql\fR +\fBmariadb\fR variables that affect your queries\&. .RE .sp @@ -2153,8 +2153,8 @@ variables that affect your queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: system command -.\" system command: mysql +.\" mariadb: system command +.\" system command: mariadb \fBsystem \fR\fB\fIcommand\fR\fR, \fB\e! \fR\fB\fIcommand\fR\fR .sp @@ -2173,16 +2173,16 @@ command works only in Unix\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: tee command -.\" tee command: mysql +.\" mariadb: tee command +.\" tee command: mariadb \fBtee [\fR\fB\fIfile_name\fR\fR\fB]\fR, \fB\eT [\fR\fB\fIfile_name\fR\fR\fB]\fR .sp By using the \fB\-\-tee\fR option when you invoke -\fBmysql\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&. -\fBmysql\fR +\fBmariadb\fR, you can log statements and their output\&. All the data displayed on the screen is appended into a given file\&. This can be very useful for debugging purposes also\&. +\fBmariadb\fR flushes results to the file after each statement, just before it prints its next prompt\&. Tee functionality works only in interactive mode\&. .sp You can enable this feature interactively with the @@ -2204,8 +2204,8 @@ again re\-enables logging\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: use command -.\" use command: mysql +.\" mariadb: use command +.\" use command: mariadb \fBuse \fR\fB\fIdb_name\fR\fR, \fB\eu \fR\fB\fIdb_name\fR\fR .sp @@ -2222,8 +2222,8 @@ as the default database\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql: warnings command -.\" warnings command: mysql +.\" mariadb: warnings command +.\" warnings command: mariadb \fBwarnings\fR, \fB\eW\fR .sp @@ -2248,7 +2248,7 @@ You can use it to write to a file and the results go only to the file: .RS 4 .\} .nf -mysql> \fBpager cat > /tmp/log\&.txt\fR +mariadb> \fBpager cat > /tmp/log\&.txt\fR .fi .if n \{\ .RE @@ -2260,7 +2260,7 @@ You can also pass any options for the program that you want to use as your pager .RS 4 .\} .nf -mysql> \fBpager less \-n \-i \-S\fR +mariadb> \fBpager less \-n \-i \-S\fR .fi .if n \{\ .RE @@ -2320,7 +2320,7 @@ to cause it to exit if output fits on one screen, which is convenient when no sc .RS 4 .\} .nf -mysql> \fBpager less \-n \-i \-S \-F \-X\fR +mariadb> \fBpager less \-n \-i \-S \-F \-X\fR .fi .if n \{\ .RE @@ -2341,7 +2341,7 @@ You can specify very complex pager commands for handling query output: .RS 4 .\} .nf -mysql> \fBpager cat | tee /dr1/tmp/res\&.txt \e\fR +mariadb> \fBpager cat | tee /dr1/tmp/res\&.txt \e\fR \fB| tee /dr2/tmp/res2\&.txt | less \-n \-i \-S\fR .fi .if n \{\ @@ -2371,7 +2371,7 @@ program and still have everything appended into a file the same time\&. The diff used with the \fBpager\fR command and the -\fBmysql\fR +\fBmariadb\fR built\-in \fBtee\fR command is that the built\-in @@ -2387,13 +2387,13 @@ used with does not log quite that much\&. Additionally, \fBtee\fR file logging can be turned on and off interactively from within -\fBmysql\fR\&. This is useful when you want to log some queries to a file, but not others\&. -.\" mysql prompt command +\fBmariadb\fR\&. This is useful when you want to log some queries to a file, but not others\&. +.\" mariadb prompt command .PP The \fBprompt\fR command reconfigures the default -mysql> +mariadb> prompt\&. The string for defining the prompt can contain the following special sequences\&. .TS allbox tab(:); @@ -2618,13 +2618,13 @@ shell> \fBexport MYSQL_PS1="(\eu@\eh) [\ed]> "\fR You can set the \fB\-\-prompt\fR option on the command line to -\fBmysql\fR\&. For example: +\fBmariadb\fR\&. For example: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \-\-prompt="(\eu@\eh) [\ed]> "\fR +shell> \fBmariadb \-\-prompt="(\eu@\eh) [\ed]> "\fR (user@host) [database]> .fi .if n \{\ @@ -2644,7 +2644,7 @@ shell> \fBmysql \-\-prompt="(\eu@\eh) [\ed]> "\fR You can set the prompt option in the -[mysql] +[mariadb] group of any MariaDB option file, such as /etc/my\&.cnf or the @@ -2655,7 +2655,7 @@ file in your home directory\&. For example: .RS 4 .\} .nf -[mysql] +[mariadb] prompt=(\e\eu@\e\eh) [\e\ed]>\e\e_ .fi .if n \{\ @@ -2674,7 +2674,7 @@ format: .RS 4 .\} .nf -[mysql] +[mariadb] prompt="\e\er:\e\em:\e\es> " .fi .if n \{\ @@ -2700,24 +2700,24 @@ prompt .RS 4 .\} .nf -mysql> \fBprompt (\eu@\eh) [\ed]>\e_\fR +mariadb> \fBprompt (\eu@\eh) [\ed]>\e_\fR PROMPT set to '(\eu@\eh) [\ed]>\e_' (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> prompt -Returning to default PROMPT of mysql> -mysql> +Returning to default PROMPT of mariadb> +mariadb> .fi .if n \{\ .RE .\} .RE -.SH "MYSQL SERVER-SIDE HELP" +.SH "MARIADB SERVER-SIDE HELP" .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp \fR\fB\fIsearch_string\fR\fR +mariadb> \fBhelp \fR\fB\fIsearch_string\fR\fR .fi .if n \{\ .RE @@ -2726,7 +2726,7 @@ mysql> \fBhelp \fR\fB\fIsearch_string\fR\fR If you provide an argument to the help command, -\fBmysql\fR +\fBmariadb\fR uses it as a search string to access server\-side help\&. The proper operation of this command requires that the help tables in the mysql database be initialized with help topic information. @@ -2737,7 +2737,7 @@ If there is no match for the search string, the search fails: .RS 4 .\} .nf -mysql> \fBhelp me\fR +mariadb> \fBhelp me\fR Nothing found Please try to run 'help contents' for a list of all accessible topics .fi @@ -2753,7 +2753,7 @@ to see a list of the help categories: .RS 4 .\} .nf -mysql> \fBhelp contents\fR +mariadb> \fBhelp contents\fR You asked for help about help category: "Contents" For more information, type 'help ', where is one of the following categories: @@ -2778,14 +2778,14 @@ following categories: .\} .PP If the search string matches multiple items, -\fBmysql\fR +\fBmariadb\fR shows a list of matching topics: .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBhelp logs\fR +mariadb> \fBhelp logs\fR Many help items for your request exist\&. To make a more specific request, please type 'help ', where is one of the following topics: @@ -2804,7 +2804,7 @@ Use a topic as the search string to see the help entry for that topic: .RS 4 .\} .nf -mysql> \fBhelp show binary logs\fR +mariadb> \fBhelp show binary logs\fR Name: 'SHOW BINARY LOGS' Description: Syntax: @@ -2813,7 +2813,7 @@ SHOW MASTER LOGS Lists the binary log files on the server\&. This statement is used as part of the procedure described in [purge\-binary\-logs], that shows how to determine which logs can be purged\&. -mysql> SHOW BINARY LOGS; +mariadb> SHOW BINARY LOGS; +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | Log_name | File_size | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ @@ -2830,38 +2830,38 @@ mysql> SHOW BINARY LOGS; .\" data: importing .\" files: text .\" text files: importing -.\" source (mysql client command) -.\" \. (mysql client command) -.\" mysql source (command for reading from text files) -.\" mysql \. (command for reading from text files) +.\" source (mariadb client command) +.\" \. (mariadb client command) +.\" mariadb source (command for reading from text files) +.\" mariadb \. (command for reading from text files) .PP The -\fBmysql\fR +\fBmariadb\fR client typically is used interactively, like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR .fi .if n \{\ .RE .\} .PP However, it is also possible to put your SQL statements in a file and then tell -\fBmysql\fR +\fBmariadb\fR to read its input from that file\&. To do so, create a text file \fItext_file\fR that contains the statements you wish to execute\&. Then invoke -\fBmysql\fR +\fBmariadb\fR as shown here: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fItext_file\fR\fR +shell> \fBmariadb \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fItext_file\fR\fR .fi .if n \{\ .RE @@ -2875,14 +2875,14 @@ statement as the first statement in the file, it is unnecessary to specify the d .RS 4 .\} .nf -shell> \fBmysql < text_file\fR +shell> \fBmariadb < text_file\fR .fi .if n \{\ .RE .\} .PP If you are already running -\fBmysql\fR, you can execute an SQL script file using the +\fBmariadb\fR, you can execute an SQL script file using the source command or \e\&. @@ -2892,8 +2892,8 @@ command: .RS 4 .\} .nf -mysql> \fBsource \fR\fB\fIfile_name\fR\fR -mysql> \fB\e\&. \fR\fB\fIfile_name\fR\fR +mariadb> \fBsource \fR\fB\fIfile_name\fR\fR +mariadb> \fB\e\&. \fR\fB\fIfile_name\fR\fR .fi .if n \{\ .RE @@ -2915,23 +2915,23 @@ The statement shown outputs \&. .PP You can also invoke -\fBmysql\fR +\fBmariadb\fR with the \fB\-\-verbose\fR option, which causes each statement to be displayed before the result that it produces\&. .PP -\fBmysql\fR +\fBmariadb\fR ignores Unicode byte order mark (BOM) characters at the beginning of input files\&. Presence of a BOM does not cause -\fBmysql\fR +\fBmariadb\fR to change its default character set\&. To do that, invoke -\fBmysql\fR +\fBmariadb\fR with an option such as \fB\-\-default\-character\-set=utf8\fR\&. .PP -.SH "MYSQL TIPS" +.SH "MARIADB TIPS" .PP This section describes some techniques that can help you use -\fBmysql\fR +\fBmariadb\fR more effectively\&. .SS "Displaying Query Results Vertically" .PP @@ -2941,7 +2941,7 @@ Some query results are much more readable when displayed vertically, instead of .RS 4 .\} .nf -mysql> \fBSELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\eG\fR +mariadb> \fBSELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\eG\fR *************************** 1\&. row *************************** msg_nro: 3068 date: 2000\-03\-01 23:29:50 @@ -2980,7 +2980,7 @@ clause\&. Normally, such a statement deletes all rows from the table\&. With When you use the \fB\-\-safe\-updates\fR option, -\fBmysql\fR +\fBmariadb\fR issues the following statement when it connects to the MariaDB server: .sp .if n \{\ @@ -3065,32 +3065,32 @@ options: .RS 4 .\} .nf -shell> \fBmysql \-\-safe\-updates \-\-select\-limit=500 \-\-max\-join\-size=10000\fR +shell> \fBmariadb \-\-safe\-updates \-\-select\-limit=500 \-\-max\-join\-size=10000\fR .fi .if n \{\ .RE .\} -.SS "Disabling mysql Auto\-Reconnect" +.SS "Disabling mariadb Auto\-Reconnect" .PP If the -\fBmysql\fR +\fBmariadb\fR client loses its connection to the server while sending a statement, it immediately and automatically tries to reconnect once to the server and send the statement again\&. However, even if -\fBmysql\fR +\fBmariadb\fR succeeds in reconnecting, your first connection has ended and all your previous session objects and settings are lost: temporary tables, the autocommit mode, and user\-defined and session variables\&. Also, any current transaction rolls back\&. This behavior may be dangerous for you, as in the following example where the server was shut down and restarted between the first and second statements without you knowing it: .sp .if n \{\ .RS 4 .\} .nf -mysql> \fBSET @a=1;\fR +mariadb> \fBSET @a=1;\fR Query OK, 0 rows affected (0\&.05 sec) -mysql> \fBINSERT INTO t VALUES(@a);\fR -ERROR 2006: MySQL server has gone away +mariadb> \fBINSERT INTO t VALUES(@a);\fR +ERROR 2006: MariaDB server has gone away No connection\&. Trying to reconnect\&.\&.\&. Connection id: 1 Current database: test Query OK, 1 row affected (1\&.30 sec) -mysql> \fBSELECT * FROM t;\fR +mariadb> \fBSELECT * FROM t;\fR +\-\-\-\-\-\-+ | a | +\-\-\-\-\-\-+ @@ -3105,9 +3105,9 @@ mysql> \fBSELECT * FROM t;\fR The @a user variable has been lost with the connection, and after the reconnection it is undefined\&. If it is important to have -\fBmysql\fR +\fBmariadb\fR terminate with an error if the connection has been lost, you can start the -\fBmysql\fR +\fBmariadb\fR client with the \fB\-\-skip\-reconnect\fR option\&. @@ -3115,7 +3115,7 @@ option\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb_config.1 b/man/mariadb_config.1 index 941e372864b..6e47a2240d5 100644 --- a/man/mariadb_config.1 +++ b/man/mariadb_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL_CONFIG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-CONFIG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,18 +11,18 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql_config +.\" mariadb-dump .SH "NAME" -mysql_config \- get compile options for compiling clients +mariadb-dump \- get compile options for compiling clients .SH "SYNOPSIS" -.HP \w'\fBmysql_config\ \fR\fB\fIoptions\fR\fR\ 'u -\fBmysql_config \fR\fB\fIoptions\fR\fR +.HP \w'\fBmariadb-dump\ \fR\fB\fIoptions\fR\fR\ 'u +\fBmariadb-dump \fR\fB\fIoptions\fR\fR .SH "DESCRIPTION" .PP -\fBmysql_config\fR +\fBmariadb-dump\fR provides you with useful information for compiling your MariaDB client and connecting it to MariaDB\&. .PP -\fBmysql_config\fR +\fBmariadb-dump\fR supports the following options\&. .sp .RS 4 @@ -33,8 +33,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: cflags option -.\" cflags option: mysql_config +.\" mariadb-dump: cflags option +.\" cflags option: mariadb-dump \fB\-\-cflags\fR .sp Compiler flags to find include files and critical compiler flags and defines used when compiling the @@ -52,8 +52,8 @@ for more portable options that contain only include paths\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: include option -.\" include option: mysql_config +.\" mariadb-dump: include option +.\" include option: mariadb-dump \fB\-\-include\fR .sp Compiler options to find MariaDB include files\&. @@ -67,10 +67,10 @@ Compiler options to find MariaDB include files\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libmysqld-libs option -.\" libmysqld-libs option: mysql_config -.\" mysql_config: embedded option -.\" embedded option: mysql_config +.\" mariadb-dump: libmysqld-libs option +.\" libmysqld-libs option: mariadb-dump +.\" mariadb-dump: embedded option +.\" embedded option: mariadb-dump \fB\-\-libmysqld\-libs\fR, \fB\-\-embedded\fR .sp @@ -85,8 +85,8 @@ Libraries and options required to link with the MariaDB embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libs option -.\" libs option: mysql_config +.\" mariadb-dump: libs option +.\" libs option: mariadb-dump \fB\-\-libs\fR .sp Libraries and options required to link with the MariaDB client library\&. @@ -100,8 +100,8 @@ Libraries and options required to link with the MariaDB client library\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: libs_r option -.\" libs_r option: mysql_config +.\" mariadb-dump: libs_r option +.\" libs_r option: mariadb-dump \fB\-\-libs_r\fR .sp Libraries and options required to link with the thread\-safe MariaDB client library\&. @@ -115,8 +115,8 @@ Libraries and options required to link with the thread\-safe MariaDB client libr .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: plugindir option -.\" plugindir option: mysql_config +.\" mariadb-dump: plugindir option +.\" plugindir option: mariadb-dump \fB\-\-plugindir\fR .sp The default plugin directory path name, defined when configuring MariaDB\&. @@ -130,8 +130,8 @@ The default plugin directory path name, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: port option -.\" port option: mysql_config +.\" mariadb-dump: port option +.\" port option: mariadb-dump \fB\-\-port\fR .sp The default TCP/IP port number, defined when configuring MariaDB\&. @@ -145,8 +145,8 @@ The default TCP/IP port number, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: socket option -.\" socket option: mysql_config +.\" mariadb-dump: socket option +.\" socket option: mariadb-dump \fB\-\-socket\fR .sp The default Unix socket file, defined when configuring MariaDB\&. @@ -160,8 +160,8 @@ The default Unix socket file, defined when configuring MariaDB\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: variable option -.\" variable option: mysql_config +.\" mariadb-dump: variable option +.\" variable option: mariadb-dump \fB\-\-variable=VAR\fR .sp Path to MariaDB include, library and plugin directories\&. \fBVAR\fR is one of @@ -176,23 +176,23 @@ Path to MariaDB include, library and plugin directories\&. \fBVAR\fR is one of .sp -1 .IP \(bu 2.3 .\} -.\" mysql_config: version option -.\" version option: mysql_config +.\" mariadb-dump: version option +.\" version option: mariadb-dump \fB\-\-version\fR .sp Version number for the MariaDB distribution\&. .RE .PP If you invoke -\fBmysql_config\fR +\fBmariadb-dump\fR with no options, it displays a list of all options that it supports, and their values: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql_config\fR -Usage: /usr/local/mysql/bin/mysql_config [options] +shell> \fBmariadb-dump\fR +Usage: /usr/local/mysql/bin/mariadb-dump [options] Options: \-\-cflags [\-I/usr/local/mysql/include/mysql \-mcpu=pentiumpro] \-\-include [\-I/usr/local/mysql/include/mysql] @@ -211,16 +211,16 @@ Options: .\} .PP You can use -\fBmysql_config\fR +\fBmariadb-dump\fR within a command line to include the value that it displays for a particular option\&. For example, to compile a MariaDB client program, use -\fBmysql_config\fR +\fBmariadb-dump\fR as follows: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBCFG=/usr/local/mysql/bin/mysql_config\fR +shell> \fBCFG=/usr/local/mysql/bin/mariadb-dump\fR shell> \fBsh \-c "gcc \-o progname `$CFG \-\-include` progname\&.c `$CFG \-\-libs`"\fR .fi .if n \{\ @@ -228,12 +228,12 @@ shell> \fBsh \-c "gcc \-o progname `$CFG \-\-include` progname\&.c `$CFG \-\-lib .\} .PP When you use -\fBmysql_config\fR +\fBmariadb-dump\fR this way, be sure to invoke it within backtick (\(lq`\(rq) characters\&. That tells the shell to execute it and substitute its output into the surrounding command\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-multi.1 b/man/mariadbd-multi.1 index e51e3875613..06f58c69e08 100644 --- a/man/mariadbd-multi.1 +++ b/man/mariadbd-multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-MULTI\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-MULTI\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,25 +11,25 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld_multi -.\" tools: mysqld_multi +.\" mariadbd-multi +.\" tools: mariadbd-multi .\" scripts -.\" multi mysqld +.\" multi mariadbd .SH "NAME" -mariadbd-multi \- manage multiple MariaDB servers (mysqld_multi is now a symlink to mariadbd-multi) +mariadbd-multi \- manage multiple MariaDB servers (mariadbd-multi is now a symlink to mariadbd-multi) .SH "SYNOPSIS" -.HP \w'\fBmysqld_multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u -\fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR +.HP \w'\fBmariadbd-multi\ [\fR\fB\fIoptions\fR\fR\fB]\ {start|stop|report}\ [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB]\ \&.\&.\&.]\fR\ 'u +\fBmariadbd-multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR .SH "DESCRIPTION" .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR is designed to manage several -\fBmysqld\fR +\fBmariadbd\fR processes that listen for connections on different Unix socket files and TCP/IP ports\&. It can start or stop servers, or report their current status\&. .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR searches for groups named -[mysqld\fIN\fR] +[mariadbd\fIN\fR] in my\&.cnf (or in the file named by the @@ -38,20 +38,20 @@ option)\&. \fIN\fR can be any positive integer\&. This number is referred to in the following discussion as the option group number, or \fIGNR\fR\&. Group numbers distinguish option groups from one another and are used as arguments to -\fBmysqld_multi\fR +\fBmariadbd-multi\fR to specify which servers you want to start, stop, or obtain a status report for\&. Options listed in these groups are the same that you would use in the -[mysqld] +[mariadbd] group used for starting -\fBmysqld\fR\&. However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. +\fBmariadbd\fR\&. However, when using multiple servers, it is necessary that each one use its own value for options such as the Unix socket file and TCP/IP port number\&. .PP To invoke -\fBmysqld_multi\fR, use the following syntax: +\fBmariadbd-multi\fR, use the following syntax: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR +shell> \fBmariadbd-multi [\fR\fB\fIoptions\fR\fR\fB] {start|stop|report} [\fR\fB\fIGNR\fR\fR\fB[,\fR\fB\fIGNR\fR\fR\fB] \&.\&.\&.]\fR .fi .if n \{\ .RE @@ -63,7 +63,7 @@ report indicate which operation to perform\&. You can perform the designated operation for a single server or multiple servers, depending on the \fIGNR\fR list that follows the option name\&. If there is no list, -\fBmysqld_multi\fR +\fBmariadbd-multi\fR performs the operation for all servers in the option file\&. .PP Each @@ -71,44 +71,44 @@ Each value represents an option group number or range of group numbers\&. The value should be the number at the end of the group name in the option file\&. For example, the \fIGNR\fR for a group named -[mysqld17] +[mariadbd17] is 17\&. To specify a range of numbers, separate the first and last numbers by a dash\&. The \fIGNR\fR value 10\-13 represents groups -[mysqld10] +[mariadbd10] through -[mysqld13]\&. Multiple groups or group ranges can be specified on the command line, separated by commas\&. There must be no whitespace characters (spaces or tabs) in the +[mariadbd13]\&. Multiple groups or group ranges can be specified on the command line, separated by commas\&. There must be no whitespace characters (spaces or tabs) in the \fIGNR\fR list; anything after a whitespace character is ignored\&. .PP This command starts a single server using option group -[mysqld17]: +[mariadbd17]: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi start 17\fR +shell> \fBmariadbd-multi start 17\fR .fi .if n \{\ .RE .\} .PP This command stops several servers, using option groups -[mysqld8] +[mariadbd8] and -[mysqld10] +[mariadbd10] through -[mysqld13]: +[mariadbd13]: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld_multi stop 8,10\-13\fR +shell> \fBmariadbd-multi stop 8,10\-13\fR .fi .if n \{\ .RE @@ -120,13 +120,13 @@ For an example of how you might set up an option file, use this command: .RS 4 .\} .nf -shell> \fBmysqld_multi \-\-example\fR +shell> \fBmariadbd-multi \-\-example\fR .fi .if n \{\ .RE .\} .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR searches for option files as follows: .sp .RS 4 @@ -137,8 +137,8 @@ searches for option files as follows: .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: no-defaults option -.\" no-defaults option: mysqld_multi +.\" mariadbd-multi: no-defaults option +.\" no-defaults option: mariadbd-multi With \fB\-\-no\-defaults\fR, no option files are read\&. .RE @@ -151,8 +151,8 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: defaults-file option -.\" defaults-file option: mysqld_multi +.\" mariadbd-multi: defaults-file option +.\" defaults-file option: mariadbd-multi With \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR, only the named file is read\&. .RE @@ -165,43 +165,43 @@ With .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: defaults-extra-file option -.\" defaults-extra-file option: mysqld_multi +.\" mariadbd-multi: defaults-extra-file option +.\" defaults-extra-file option: mariadbd-multi Otherwise, option files in the standard list of locations are read, including any file named by the \fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR option, if one is given\&. (If the option is given multiple times, the last value is used\&.) .RE .PP Option files read are searched for -[mysqld_multi] +[mariadbd-multi] and -[mysqld\fIN\fR] +[mariadbd\fIN\fR] option groups\&. The -[mysqld_multi] +[mariadbd-multi] group can be used for options to -\fBmysqld_multi\fR +\fBmariadbd-multi\fR itself\&. -[mysqld\fIN\fR] +[mariadbd\fIN\fR] groups can be used for options passed to specific -\fBmysqld\fR +\fBmariadbd\fR instances\&. .PP The -[mysqld] +[mariadbd] or -[mysqld_safe] +[mariadbd_safe] groups can be used for common options read by all instances of -\fBmysqld\fR +\fBmariadbd\fR or -\fBmysqld_safe\fR\&. You can specify a +\fBmariadbd_safe\fR\&. You can specify a \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR option to use a different configuration file for that instance, in which case the -[mysqld] +[mariadbd] or -[mysqld_safe] +[mariadbd_safe] groups from that file will be used for that instance\&. .PP -\fBmysqld_multi\fR +\fBmariadbd-multi\fR supports the following options\&. .sp .RS 4 @@ -212,8 +212,8 @@ supports the following options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: help option -.\" help option: mysqld_multi +.\" mariadbd-multi: help option +.\" help option: mariadbd-multi \fB\-\-help\fR .sp Display a help message and exit\&. @@ -227,8 +227,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: example option -.\" example option: mysqld_multi +.\" mariadbd-multi: example option +.\" example option: mariadbd-multi \fB\-\-example\fR .sp Display a sample option file\&. @@ -242,8 +242,8 @@ Display a sample option file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: log option -.\" log option: mysqld_multi +.\" mariadbd-multi: log option +.\" log option: mariadbd-multi \fB\-\-log=\fR\fB\fIfile_name\fR\fR .sp Specify the name of the log file\&. If the file exists, log output is appended to it\&. @@ -257,12 +257,12 @@ Specify the name of the log file\&. If the file exists, log output is appended t .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: mysqladmin option -.\" mysqladmin option: mysqld_multi -\fB\-\-mysqladmin=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-multi: mariadb-admin option +.\" mariadb-admin option: mariadbd-multi +\fB\-\-mariadb-admin=\fR\fB\fIprog_name\fR\fR .sp The -\fBmysqladmin\fR +\fBmariadb-admin\fR binary to be used to stop servers\&. .RE .sp @@ -274,33 +274,33 @@ binary to be used to stop servers\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: mysqld option -.\" mysqld option: mysqld_multi -\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-multi: mariadbd option +.\" mariadbd option: mariadbd-multi +\fB\-\-mariadbd=\fR\fB\fIprog_name\fR\fR .sp The -\fBmysqld\fR +\fBmariadbd\fR binary to be used\&. Note that you can specify -\fBmysqld_safe\fR +\fBmariadbd_safe\fR as the value for this option also\&. If you use -\fBmysqld_safe\fR +\fBmariadbd_safe\fR to start the server, you can include the -mysqld +mariadbd or ledir options in the corresponding -[mysqld\fIN\fR] +[mariadbd\fIN\fR] option group\&. These options indicate the name of the server that -\fBmysqld_safe\fR +\fBmariadbd_safe\fR should start and the path name of the directory where the server is located\&. (See the descriptions for these options in -\fBmysqld_safe\fR(1)\&.) Example: +\fBmariadbd_safe\fR(1)\&.) Example: .sp .if n \{\ .RS 4 .\} .nf -[mysqld38] -mysqld = mysqld\-debug +[mariadbd38] +mariadbd = mariadbd\-debug ledir = /opt/local/mysql/libexec .fi .if n \{\ @@ -316,8 +316,8 @@ ledir = /opt/local/mysql/libexec .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: no-log option -.\" no-log option: mysqld_multi +.\" mariadbd-multi: no-log option +.\" no-log option: mariadbd-multi \fB\-\-no\-log\fR .sp Print log information to @@ -333,12 +333,12 @@ rather than to the log file\&. By default, output goes to the log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: password option -.\" password option: mysqld_multi +.\" mariadbd-multi: password option +.\" password option: mariadbd-multi \fB\-\-password=\fR\fB\fIpassword\fR\fR .sp The password of the MariaDB account to use when invoking -\fBmysqladmin\fR\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. +\fBmariadb-admin\fR\&. Note that the password value is not optional for this option, unlike for other MariaDB programs\&. .RE .sp .RS 4 @@ -349,8 +349,8 @@ The password of the MariaDB account to use when invoking .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: silent option -.\" silent option: mysqld_multi +.\" mariadbd-multi: silent option +.\" silent option: mariadbd-multi \fB\-\-silent\fR .sp Silent mode; disable warnings\&. @@ -364,8 +364,8 @@ Silent mode; disable warnings\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: tcp-ip option -.\" tcp-ip option: mysqld_multi +.\" mariadbd-multi: tcp-ip option +.\" tcp-ip option: mariadbd-multi \fB\-\-tcp\-ip\fR .sp Connect to the MariaDB server(s) via the TCP/IP port instead of the UNIX socket\&. This affects stopping @@ -382,12 +382,12 @@ stop and report operations\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: user option -.\" user option: mysqld_multi +.\" mariadbd-multi: user option +.\" user option: mariadbd-multi \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The user name of the MariaDB account to use when invoking -\fBmysqladmin\fR\&. +\fBmariadb-admin\fR\&. .RE .sp .RS 4 @@ -398,8 +398,8 @@ The user name of the MariaDB account to use when invoking .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: verbose option -.\" verbose option: mysqld_multi +.\" mariadbd-multi: verbose option +.\" verbose option: mariadbd-multi \fB\-\-verbose\fR .sp Be more verbose\&. @@ -413,8 +413,8 @@ Be more verbose\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: version option -.\" version option: mysqld_multi +.\" mariadbd-multi: version option +.\" version option: mariadbd-multi \fB\-\-version\fR .sp Display version information and exit\&. @@ -428,15 +428,15 @@ Display version information and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_multi: wsrep-new-cluster option -.\" wsrep-new-cluster option: mysqld_multi +.\" mariadbd-multi: wsrep-new-cluster option +.\" wsrep-new-cluster option: mariadbd-multi \fB\-\-wsrep\-new\-cluster\fR .sp Bootstrap a cluster\&. .RE .PP Some notes about -\fBmysqld_multi\fR: +\fBmariadbd-multi\fR: .sp .RS 4 .ie n \{\ @@ -447,15 +447,15 @@ Some notes about .IP \(bu 2.3 .\} \fBMost important\fR: Before using -\fBmysqld_multi\fR +\fBmariadbd-multi\fR be sure that you understand the meanings of the options that are passed to the -\fBmysqld\fR +\fBmariadbd\fR servers and \fIwhy\fR you would want to have separate -\fBmysqld\fR +\fBmariadbd\fR processes\&. Beware of the dangers of using multiple -\fBmysqld\fR +\fBmariadbd\fR servers with the same data directory\&. Use separate data directories, unless you \fIknow\fR what you are doing\&. Starting multiple servers with the same data directory does @@ -474,7 +474,7 @@ give you extra performance in a threaded system\&. .IP \(bu 2.3 .\} \fBImportant\fR: Make sure that the data directory for each server is fully accessible to the Unix account that the specific -\fBmysqld\fR +\fBmariadbd\fR process is started as\&. \fIDo not\fR use the Unix @@ -495,9 +495,9 @@ what you are doing\&. .IP \(bu 2.3 .\} Make sure that the MariaDB account used for stopping the -\fBmysqld\fR +\fBmariadbd\fR servers (with the -\fBmysqladmin\fR +\fBmariadbadmin\fR program) has the same user name and password for each server\&. Also, make sure that the account has the SHUTDOWN privilege\&. If the servers that you want to manage have different user names or passwords for the administrative accounts, you might want to create an account on each server that has the same user name and password\&. For example, you might set up a common @@ -508,9 +508,9 @@ account by executing the following commands for each server: .RS 4 .\} .nf -shell> \fBmysql \-u root \-S /tmp/mysql\&.sock \-p\fR +shell> \fBmariadb \-u root \-S /tmp/mariadb\&.sock \-p\fR Enter password: -mysql> \fBGRANT SHUTDOWN ON *\&.*\fR +mariadb> \fBGRANT SHUTDOWN ON *\&.*\fR \-> \fBTO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';\fR .fi .if n \{\ @@ -520,7 +520,7 @@ mysql> \fBGRANT SHUTDOWN ON *\&.*\fR Change the connection parameters appropriately when connecting to each one\&. Note that the host name part of the account name must allow you to connect as multi_admin from the host where you want to run -\fBmysqld_multi\fR\&. +\fBmariadbd-multi\fR\&. .RE .sp .RS 4 @@ -532,7 +532,7 @@ from the host where you want to run .IP \(bu 2.3 .\} The Unix socket file and the TCP/IP port number must be different for every -\fBmysqld\fR\&. (Alternatively, if the host has multiple network addresses, you can use +\fBmariadbd\fR\&. (Alternatively, if the host has multiple network addresses, you can use \fB\-\-bind\-address\fR to cause different servers to listen to different interfaces\&.) .RE @@ -548,27 +548,27 @@ to cause different servers to listen to different interfaces\&.) The \fB\-\-pid\-file\fR option is very important if you are using -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to start -\fBmysqld\fR +\fBmariadbd\fR (for example, -\fB\-\-mysqld=mysqld_safe\fR) Every -\fBmysqld\fR +\fB\-\-mariadbd=mariadbd-safe\fR) Every +\fBmariadbd\fR should have its own process ID file\&. The advantage of using -\fBmysqld_safe\fR +\fBmariadbd-safe\fR instead of -\fBmysqld\fR +\fBmariadbd\fR is that -\fBmysqld_safe\fR +\fBmariadbd-safe\fR monitors its -\fBmysqld\fR +\fBmariadbd\fR process and restarts it if the process terminates due to a signal sent using kill \-9 or for other reasons, such as a segmentation fault\&. Please note that the -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script might require that you start it from a certain place\&. This means that you might have to change location to a certain directory before running -\fBmysqld_multi\fR\&. If you have problems starting, please see the -\fBmysqld_safe\fR +\fBmariadbd-multi\fR\&. If you have problems starting, please see the +\fBmariadbd-safe\fR script\&. Check especially the lines: .sp .if n \{\ @@ -578,7 +578,7 @@ script\&. Check especially the lines: \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- MY_PWD=`pwd` # Check if we are starting this relative (for the binary release) -if test \-d $MY_PWD/data/mysql \-a \e +if test \-d $MY_PWD/data/mariadb \-a \e \-f \&./share/mariadb/english/errmsg\&.sys \-a \e \-x \&./bin/mariadbd \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- @@ -588,7 +588,7 @@ if test \-d $MY_PWD/data/mysql \-a \e .\} .sp The test performed by these lines should be successful, or you might encounter problems\&. See -\fBmysqld_safe\fR(1)\&. +\fBmariadbd-safe\fR(1)\&. .RE .sp .RS 4 @@ -602,20 +602,20 @@ The test performed by these lines should be successful, or you might encounter p You might want to use the \fB\-\-user\fR option for -\fBmysqld\fR, but to do this you need to run the -\fBmysqld_multi\fR +\fBmariadbd\fR, but to do this you need to run the +\fBmariadbd-multi\fR script as the Unix root user\&. Having the option in the option file doesn't matter; you just get a warning if you are not the superuser and the -\fBmysqld\fR +\fBmariadbd\fR processes are started under your own Unix account\&. .RE .PP The following example shows how you might set up an option file for use with -\fBmysqld_multi\fR\&. The order in which the -\fBmysqld\fR +\fBmariadbd-multi\fR\&. The order in which the +\fBmariadbd\fR programs are started or stopped depends on the order in which they appear in the option file\&. Group numbers need not form an unbroken sequence\&. The first and fifth -[mysqld\fIN\fR] +[mariadbd\fIN\fR] groups were intentionally omitted from the example to illustrate that you can have \(lqgaps\(rq in the option file\&. This gives you more flexibility\&. @@ -627,33 +627,33 @@ in the option file\&. This gives you more flexibility\&. # This file should probably be in your home dir (~/\&.my\&.cnf) # or /etc/my\&.cnf # Version 2\&.1 by Jani Tolonen -[mysqld_multi] -mysqld = /usr/local/bin/mysqld_safe -mysqladmin = /usr/local/bin/mysqladmin +[mariadbd-multi] +mariadbd = /usr/local/bin/mariadbd-safe +mariadb-admin = /usr/local/bin/mariadb-admin user = multi_admin password = multipass -[mysqld2] -socket = /tmp/mysql\&.sock2 +[mariadbd2] +socket = /tmp/mariadb\&.sock2 port = 3307 pid\-file = /usr/local/mysql/var2/hostname\&.pid2 datadir = /usr/local/mysql/var2 language = /usr/local/share/mariadb/english user = john -[mysqld3] +[mariadbd3] socket = /tmp/mysql\&.sock3 port = 3308 pid\-file = /usr/local/mysql/var3/hostname\&.pid3 datadir = /usr/local/mysql/var3 language = /usr/local/share/mariadb/swedish user = monty -[mysqld4] +[mariadbd4] socket = /tmp/mysql\&.sock4 port = 3309 pid\-file = /usr/local/mysql/var4/hostname\&.pid4 datadir = /usr/local/mysql/var4 language = /usr/local/share/mariadb/estonia user = tonu -[mysqld6] +[mariadbd6] socket = /tmp/mysql\&.sock6 port = 3311 pid\-file = /usr/local/mysql/var6/hostname\&.pid6 @@ -668,7 +668,7 @@ user = jani .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-safe-helper.1 b/man/mariadbd-safe-helper.1 index 24bb980c37d..58b1707f504 100644 --- a/man/mariadbd-safe-helper.1 +++ b/man/mariadbd-safe-helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadbd-safe.1 b/man/mariadbd-safe.1 index 18bfc8bc4aa..aabe5a24ac9 100644 --- a/man/mariadbd-safe.1 +++ b/man/mariadbd-safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,58 +11,58 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld_safe -.\" tools: mysqld_safe +.\" mariadbd-safe +.\" tools: mariadbd-safe .\" scripts .SH "NAME" -mariadbd-safe \- MariaDB server startup script (mysqld_safe is now a symlink to mariadbd-safe) +mariadbd-safe \- MariaDB server startup script (mariadbd-safe is now a symlink to mariadbd-safe) .SH "SYNOPSIS" -.HP \w'\fBmysqld_safe\ \fR\fB\fIoptions\fR\fR\ 'u -\fBmysqld_safe \fR\fB\fIoptions\fR\fR +.HP \w'\fBmariadbd-safe\ \fR\fB\fIoptions\fR\fR\ 'u +\fBmariadbd-safe \fR\fB\fIoptions\fR\fR .SH "DESCRIPTION" .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is the recommended way to start a -\fBmysqld\fR +\fBmariadbd\fR server on Unix\&. -\fBmysqld_safe\fR +\fBmariadbd-safe\fR adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file\&. Descriptions of error logging is given later in this section\&. .sp -\fBmysqld_safe\fR +\fBmariadbd-safe\fR tries to start an executable named -\fBmysqld\fR\&. To override the default behavior and specify explicitly the name of the server you want to run, specify a -\fB\-\-mysqld\fR +\fBmariadbd\fR\&. To override the default behavior and specify explicitly the name of the server you want to run, specify a +\fB\-\-mariadbd\fR or -\fB\-\-mysqld\-version\fR +\fB\-\-mariadbd\-version\fR option to -\fBmysqld_safe\fR\&. You can also use +\fBmariadbd-safe\fR\&. You can also use \fB\-\-ledir\fR to indicate the directory where -\fBmysqld_safe\fR +\fBmariadbd-safe\fR should look for the server\&. .PP Many of the options to -\fBmysqld_safe\fR +\fBmariadbd-safe\fR are the same as the options to -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .PP Options unknown to -\fBmysqld_safe\fR +\fBmariadbd-safe\fR are passed to -\fBmysqld\fR +\fBmariadbd\fR if they are specified on the command line, but ignored if they are specified in the -[mysqld_safe], [mariadbd-safe] or [mariadbd_safe] +[mariadbd-safe] or [mariadbd_safe] groups of an option file\&. .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR reads all options from the -[mysqld], +[mariadbd], [server], -[mysqld_safe], [mariadbd-safe] and [mariadbd_safe] +[mariadbd-safe] and [mariadbd_safe] sections in option files\&. For example, if you specify a -[mysqld] +[mariadbd] section like this, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR will find and use the \fB\-\-log\-error\fR option: @@ -71,7 +71,7 @@ option: .RS 4 .\} .nf -[mysqld] +[mariadbd] log\-error=error\&.log .fi .if n \{\ @@ -79,14 +79,14 @@ log\-error=error\&.log .\} .PP For backward compatibility, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR also reads -[safe_mysqld] +[safe_mariadbd] sections, although you should rename such sections to -[mysqld_safe] +[mariadbd-safe] in current installations\&. .PP -\fBmysqld_safe\fR +\fBmariadbd-safe\fR supports the options in the following list\&. It also reads option files and supports the options for processing them. .sp .RS 4 @@ -97,8 +97,8 @@ supports the options in the following list\&. It also reads option files and sup .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: help option -.\" help option: mysqld_safe +.\" mariadbd-safe: help option +.\" help option: mariadbd-safe \fB\-\-help\fR .sp Display a help message and exit\&. @@ -112,8 +112,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: basedir option -.\" basedir option: mysqld_safe +.\" mariadbd-safe: basedir option +.\" basedir option: mariadbd-safe \fB\-\-basedir=\fR\fB\fIpath\fR\fR .sp The path to the MariaDB installation directory\&. @@ -127,12 +127,12 @@ The path to the MariaDB installation directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: core-file-size option -.\" core-file-size option: mysqld_safe +.\" mariadbd-safe: core-file-size option +.\" core-file-size option: mariadbd-safe \fB\-\-core\-file\-size=\fR\fB\fIsize\fR\fR .sp The size of the core file that -\fBmysqld\fR +\fBmariadbd\fR should be able to create\&. The option value is passed to \fBulimit \-c\fR\&. .RE @@ -145,11 +145,11 @@ should be able to create\&. The option value is passed to .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: crash-script option -.\" crash-script option: mysqld_safe +.\" mariadbd-safe: crash-script option +.\" crash-script option: mariadbd-safe \fB\-\-crash\-script=\fR\fB\fIfile\fR\fR .sp -Script to call in the event of mysqld crashing\&. +Script to call in the event of mariadbd crashing\&. .RE .sp .RS 4 @@ -160,8 +160,8 @@ Script to call in the event of mysqld crashing\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: datadir option -.\" datadir option: mysqld_safe +.\" mariadbd-safe: datadir option +.\" datadir option: mariadbd-safe \fB\-\-datadir=\fR\fB\fIpath\fR\fR .sp The path to the data directory\&. @@ -175,8 +175,8 @@ The path to the data directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: defaults-extra-file option -.\" defaults-extra-file option: mysqld_safe +.\" mariadbd-safe: defaults-extra-file option +.\" defaults-extra-file option: mariadbd-safe \fB\-\-defaults\-extra\-file=\fR\fB\fIpath\fR\fR .sp The name of an option file to be read in addition to the usual option files\&. This must be the first option on the command line if it is used\&. If the file does not exist or is otherwise inaccessible, the server will exit with an error\&. @@ -190,8 +190,8 @@ The name of an option file to be read in addition to the usual option files\&. T .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: defaults-file option -.\" defaults-file option: mysqld_safe +.\" mariadbd-safe: defaults-file option +.\" defaults-file option: mariadbd-safe \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp The name of an option file to be read instead of the usual option files\&. This must be the first option on the command line if it is used\&. @@ -205,8 +205,8 @@ The name of an option file to be read instead of the usual option files\&. This .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: flush-caches option -.\" flush-caches option: mysqld_safe +.\" mariadbd-safe: flush-caches option +.\" flush-caches option: mariadbd-safe \fB\-\-flush\-caches\fR .sp Flush and purge buffers/caches before starting the server\&. @@ -220,12 +220,12 @@ Flush and purge buffers/caches before starting the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: ledir option -.\" ledir option: mysqld_safe +.\" mariadbd-safe: ledir option +.\" ledir option: mariadbd-safe \fB\-\-ledir=\fR\fB\fIpath\fR\fR .sp If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR cannot find the server, use this option to indicate the path name to the directory where the server is located\&. .RE .sp @@ -237,8 +237,8 @@ cannot find the server, use this option to indicate the path name to the directo .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: log-error option -.\" log-error option: mysqld_safe +.\" mariadbd-safe: log-error option +.\" log-error option: mariadbd-safe \fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR .sp Write the error log to the given file\&. @@ -252,8 +252,8 @@ Write the error log to the given file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: malloc-lib option -.\" malloc-lib option: mysqld_safe +.\" mariadbd-safe: malloc-lib option +.\" malloc-lib option: mariadbd-safe \fB\-\-malloc\-lib=\fR\fB\fIlib\fR\fR .sp Preload shared library lib if available\&. @@ -267,14 +267,14 @@ Preload shared library lib if available\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: mysqld option -.\" mysqld option: mysqld_safe -\fB\-\-mysqld=\fR\fB\fIprog_name\fR\fR +.\" mariadbd-safe: mariadbd option +.\" mariadbd option: mariadbd-safe +\fB\-\-mariadbd=\fR\fB\fIprog_name\fR\fR .sp The name of the server program (in the ledir directory) that you want to start\&. This option is needed if you use the MariaDB binary distribution but have the data directory outside of the binary distribution\&. If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR cannot find the server, use the \fB\-\-ledir\fR option to indicate the path name to the directory where the server is located\&. @@ -288,26 +288,26 @@ option to indicate the path name to the directory where the server is located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: mysqld-version option -.\" mysqld-version option: mysqld_safe -\fB\-\-mysqld\-version=\fR\fB\fIsuffix\fR\fR +.\" mariadbd-safe: mariadbd-version option +.\" mariadbd-version option: mariadbd-safe +\fB\-\-mariadbd\-version=\fR\fB\fIsuffix\fR\fR .sp This option is similar to the -\fB\-\-mysqld\fR +\fB\-\-mariadbd\fR option, but you specify only the suffix for the server program name\&. The basename is assumed to be -\fBmysqld\fR\&. For example, if you use -\fB\-\-mysqld\-version=debug\fR, -\fBmysqld_safe\fR +\fBmariadbd\fR\&. For example, if you use +\fB\-\-mariadbd\-version=debug\fR, +\fBmariadbd-safe\fR starts the -\fBmysqld\-debug\fR +\fBmariadbd\-debug\fR program in the ledir directory\&. If the argument to -\fB\-\-mysqld\-version\fR +\fB\-\-mariadbd\-version\fR is empty, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR uses -\fBmysqld\fR +\fBmariadbd\fR in the ledir directory\&. @@ -321,8 +321,8 @@ directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: nice option -.\" nice option: mysqld_safe +.\" mariadbd-safe: nice option +.\" nice option: mariadbd-safe \fB\-\-nice=\fR\fB\fIpriority\fR\fR .sp Use the @@ -338,13 +338,13 @@ program to set the server's scheduling priority to the given value\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: no-auto-restart option -.\" no-auto-restart option: mysqld_safe +.\" mariadbd-safe: no-auto-restart option +.\" no-auto-restart option: mariadbd-safe \fB\-\-no\-auto\-restart\fR, \fB\-\-nowatch\fR, \fB\-\-no\-watch\fR .sp -Exit after starting mysqld\&. +Exit after starting mariadbd\&. .RE .sp .RS 4 @@ -355,8 +355,8 @@ Exit after starting mysqld\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: no-defaults option -.\" no-defaults option: mysqld_safe +.\" mariadbd-safe: no-defaults option +.\" no-defaults option: mariadbd-safe \fB\-\-no\-defaults\fR .sp Do not read any option files\&. This must be the first option on the command line if it is used\&. @@ -370,11 +370,11 @@ Do not read any option files\&. This must be the first option on the command lin .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: numa-interleave option -.\" numa-interleave option: mysqld_safe +.\" mariadbd-safe: numa-interleave option +.\" numa-interleave option: mariadbd-safe \fB\-\-numa\-interleave\fR .sp -Run mysqld with its memory interleaved on all NUMA nodes\&. +Run mariadbd with its memory interleaved on all NUMA nodes\&. .RE .sp .RS 4 @@ -385,15 +385,15 @@ Run mysqld with its memory interleaved on all NUMA nodes\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: open-files-limit option -.\" open-files-limit option: mysqld_safe +.\" mariadbd-safe: open-files-limit option +.\" open-files-limit option: mariadbd-safe \fB\-\-open\-files\-limit=\fR\fB\fIcount\fR\fR .sp The number of files that -\fBmysqld\fR +\fBmariadbd\fR should be able to open\&. The option value is passed to \fBulimit \-n\fR\&. Note that you need to start -\fBmysqld_safe\fR +\fBmariadbd-safe\fR as root for this to work properly! @@ -407,8 +407,8 @@ for this to work properly! .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: pid-file option -.\" pid-file option: mysqld_safe +.\" mariadbd-safe: pid-file option +.\" pid-file option: mariadbd-safe \fB\-\-pid\-file=\fR\fB\fIfile_name\fR\fR .sp The path name of the process ID file\&. @@ -422,8 +422,8 @@ The path name of the process ID file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: plugin-dir option -.\" plugin-dir option: mysqld_safe +.\" mariadbd-safe: plugin-dir option +.\" plugin-dir option: mariadbd-safe \fB\-\-plugin\-dir=\fIdir_name\fR .sp Directory for client-side plugins\&. @@ -437,8 +437,8 @@ Directory for client-side plugins\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: port option -.\" port option: mysqld_safe +.\" mariadbd-safe: port option +.\" port option: mariadbd-safe \fB\-\-port=\fR\fB\fIport_num\fR\fR .sp The port number that the server should use when listening for TCP/IP connections\&. The port number must be 1024 or higher unless the server is started by the @@ -454,12 +454,12 @@ system user\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: skip-kill-mysqld option -.\" skip-kill-mysqld option: mysqld_safe -\fB\-\-skip\-kill\-mysqld\fR +.\" mariadbd-safe: skip-kill-mariadbd option +.\" skip-kill-mariadbd option: mariadbd-safe +\fB\-\-skip\-kill\-mariadbd\fR .sp Do not try to kill stray -\fBmysqld\fR +\fBmariadbd\fR processes at startup\&. This option works only on Linux\&. .RE .sp @@ -471,8 +471,8 @@ processes at startup\&. This option works only on Linux\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: socket option -.\" socket option: mysqld_safe +.\" mariadbd-safe: socket option +.\" socket option: mariadbd-safe \fB\-\-socket=\fR\fB\fIpath\fR\fR .sp The Unix socket file that the server should use when listening for local connections\&. @@ -486,10 +486,10 @@ The Unix socket file that the server should use when listening for local connect .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: syslog option -.\" syslog option: mysqld_safe -.\" mysqld_safe: skip-syslog option -.\" skip-syslog option: mysqld_safe +.\" mariadbd-safe: syslog option +.\" syslog option: mariadbd-safe +.\" mariadbd-safe: skip-syslog option +.\" skip-syslog option: mariadbd-safe \fB\-\-syslog\fR, \fB\-\-skip\-syslog\fR .sp @@ -512,23 +512,23 @@ syslog; messages are written to an error log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: syslog-tag option -.\" syslog-tag option: mysqld_safe +.\" mariadbd-safe: syslog-tag option +.\" syslog-tag option: mariadbd-safe \fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR .sp For logging to syslog, messages from -\fBmysqld_safe\fR +\fBmariadbd-safe\fR and -\fBmysqld\fR +\fBmariadbd\fR are written with a tag of -mysqld_safe +mariadbd-safe and -mysqld, respectively\&. To specify a suffix for the tag, use +mariadbd, respectively\&. To specify a suffix for the tag, use \fB\-\-syslog\-tag=\fR\fB\fItag\fR\fR, which modifies the tags to be -mysqld_safe\-\fItag\fR +mariadbd-safe\-\fItag\fR and -mysqld\-\fItag\fR\&. +mariadbd\-\fItag\fR\&. .RE .sp .RS 4 @@ -539,8 +539,8 @@ mysqld\-\fItag\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: timezone option -.\" timezone option: mysqld_safe +.\" mariadbd-safe: timezone option +.\" timezone option: mariadbd-safe \fB\-\-timezone=\fR\fB\fItimezone\fR\fR .sp Set the @@ -556,12 +556,12 @@ time zone environment variable to the given option value\&. Consult your operati .sp -1 .IP \(bu 2.3 .\} -.\" mysqld_safe: user option -.\" user option: mysqld_safe +.\" mariadbd-safe: user option +.\" user option: mariadbd-safe \fB\-\-user={\fR\fB\fIuser_name\fR\fR\fB|\fR\fB\fIuser_id\fR\fR\fB}\fR .sp Run the -\fBmysqld\fR +\fBmariadbd\fR server as the user having the name \fIuser_name\fR or the numeric user ID @@ -570,7 +570,7 @@ in this context refers to a system login account, not a MariaDB user listed in t .RE .PP If you execute -\fBmysqld_safe\fR +\fBmariadbd-safe\fR with the \fB\-\-defaults\-file\fR or @@ -581,7 +581,7 @@ option to name an option file, the option must be the first one given on the com .RS 4 .\} .nf -mysql> \fBmysqld_safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR +mariadb> \fBmariadbd-safe \-\-port=\fR\fB\fIport_num\fR\fR\fB \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .fi .if n \{\ .RE @@ -593,16 +593,16 @@ Instead, use the following command: .RS 4 .\} .nf -mysql> \fBmysqld_safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR +mariadb> \fBmariadbd-safe \-\-defaults\-file=\fR\fB\fIfile_name\fR\fR\fB \-\-port=\fR\fB\fIport_num\fR\fR .fi .if n \{\ .RE .\} .PP The -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script is written so that it normally can start a server that was installed from either a source or a binary distribution of MariaDB, even though these types of distributions typically install the server in slightly different locations\&. -\fBmysqld_safe\fR +\fBmariadbd-safe\fR expects one of the following conditions to be true: .sp .RS 4 @@ -614,9 +614,9 @@ expects one of the following conditions to be true: .IP \(bu 2.3 .\} The server and databases can be found relative to the working directory (the directory from which -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is invoked)\&. For binary distributions, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR looks under its working directory for bin and @@ -626,7 +626,7 @@ libexec and var directories\&. This condition should be met if you execute -\fBmysqld_safe\fR +\fBmariadbd-safe\fR from your MariaDB installation directory (for example, /usr/local/mysql for a binary distribution)\&. @@ -641,7 +641,7 @@ for a binary distribution)\&. .IP \(bu 2.3 .\} If the server and databases cannot be found relative to the working directory, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR attempts to locate them by absolute path names\&. Typical locations are /usr/local/libexec and @@ -649,9 +649,9 @@ and .RE .PP Because -\fBmysqld_safe\fR +\fBmariadbd-safe\fR tries to find the server and databases relative to its own working directory, you can install a binary distribution of MariaDB anywhere, as long as you run -\fBmysqld_safe\fR +\fBmariadbd-safe\fR from the MariaDB installation directory: .sp .if n \{\ @@ -659,14 +659,14 @@ from the MariaDB installation directory: .\} .nf shell> \fBcd \fR\fB\fImysql_installation_directory\fR\fR -shell> \fBbin/mysqld_safe &\fR +shell> \fBbin/mariadbd-safe &\fR .fi .if n \{\ .RE .\} .PP If -\fBmysqld_safe\fR +\fBmariadbd-safe\fR fails, even when invoked from the MariaDB installation directory, you can specify the \fB\-\-ledir\fR and @@ -674,16 +674,16 @@ and options to indicate the directories in which the server and databases are located on your system\&. .PP When you use -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to start -\fBmysqld\fR, -\fBmysqld_safe\fR +\fBmariadbd\fR, +\fBmariadbd-safe\fR arranges for error (and notice) messages from itself and from -\fBmysqld\fR +\fBmariadbd\fR to go to the same destination\&. .PP There are several -\fBmysqld_safe\fR +\fBmariadbd-safe\fR options for controlling the destination of these messages: .sp .RS 4 @@ -754,28 +754,28 @@ are both given, a warning is issued and takes precedence\&. .PP When -\fBmysqld_safe\fR +\fBmariadbd-safe\fR writes a message, notices go to the logging destination (syslog or the error log file) and stdout\&. Errors go to the logging destination and stderr\&. .PP Normally, you should not edit the -\fBmysqld_safe\fR +\fBmariadbd-safe\fR script\&. Instead, configure -\fBmysqld_safe\fR +\fBmariadbd-safe\fR by using command\-line options or options in the -[mysqld_safe] +[mariadbd-safe] section of a my\&.cnf option file\&. In rare cases, it might be necessary to edit -\fBmysqld_safe\fR +\fBmariadbd-safe\fR to get it to start the server properly\&. However, if you do this, your modified version of -\fBmysqld_safe\fR +\fBmariadbd-safe\fR might be overwritten if you upgrade MariaDB in the future, so you should make a copy of your edited version that you can reinstall\&. .PP On NetWare, -\fBmysqld_safe\fR +\fBmariadbd-safe\fR is a NetWare Loadable Module (NLM) that is ported from the original Unix shell script\&. It starts the server as follows: .sp .RS 4 @@ -822,7 +822,7 @@ Provides a screen presence for the MariaDB server\&. .IP " 4." 4.2 .\} Starts -\fBmysqld\fR, monitors it, and restarts it if it terminates in error\&. +\fBmariadbd\fR, monitors it, and restarts it if it terminates in error\&. .RE .sp .RS 4 @@ -834,7 +834,7 @@ Starts .IP " 5." 4.2 .\} Sends error messages from -\fBmysqld\fR +\fBmariadbd\fR to the \fIhost_name\fR\&.err file in the data directory\&. @@ -849,7 +849,7 @@ file in the data directory\&. .IP " 6." 4.2 .\} Sends -\fBmysqld_safe\fR +\fBmariadbd-safe\fR screen output to the \fIhost_name\fR\&.safe file in the data directory\&. @@ -857,7 +857,7 @@ file in the data directory\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd.8 b/man/mariadbd.8 index 16280234034..e84a271127d 100644 --- a/man/mariadbd.8 +++ b/man/mariadbd.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD\fR" "8" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADBD\fR" "8" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,28 +11,28 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysqld: MariaDB server -.\" MariaDB server: mysqld +.\" mariadbd: MariaDB server +.\" MariaDB server: mariadbd .SH "NAME" -mariadbd \- the MariaDB server (mysqld is now a symlink to mariadbd) +mariadbd \- the MariaDB server (mariadbd is now a symlink to mariadbd) .SH "SYNOPSIS" -.HP \w'\fBmysqld\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysqld [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadbd\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadbd [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP -\fBmysqld\fR, also known as MariaDB Server, is the main program that does most of the work in a MariaDB installation\&. MariaDB Server manages access to the MariaDB data directory that contains databases and tables\&. The data directory is also the default location for other information such as log files and status files\&. +\fBmariadbd\fR, also known as MariaDB Server, is the main program that does most of the work in a MariaDB installation\&. MariaDB Server manages access to the MariaDB data directory that contains databases and tables\&. The data directory is also the default location for other information such as log files and status files\&. .PP When MariaDB server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients\&. .PP The -\fBmysqld\fR +\fBmariadbd\fR program has many options that can be specified at startup\&. For a complete list of options, run this command: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysqld \-\-verbose \-\-help\fR +shell> \fBmariadbd \-\-verbose \-\-help\fR .fi .if n \{\ .RE @@ -45,7 +45,7 @@ the MariaDB Knowledge Base\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mbstream.1 b/man/mbstream.1 index 9409d8660e5..da2d3fc2c39 100644 --- a/man/mbstream.1 +++ b/man/mbstream.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMBSTREAM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMBSTREAM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index ed6c136f395..f9355a9d232 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMSQL2MYSQL\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMSQL2MYSQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -13,17 +13,17 @@ .\" ----------------------------------------------------------------- .\" msql2mysql .SH "NAME" -msql2mysql \- convert mSQL programs for use with MySQL +msql2mysql \- convert mSQL programs for use with MariaDB .SH "SYNOPSIS" .HP \w'\fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB\ \&.\&.\&.\fR\ 'u \fBmsql2mysql\fR\fB\fIC\-source\-file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP -Initially, the MySQL C API was developed to be very similar to that for the mSQL database system\&. Because of this, mSQL programs often can be converted relatively easily for use with MySQL by changing the names of the C API functions\&. +Initially, the MySQL C API was developed to be very similar to that for the mSQL database system\&. Because of this, mSQL programs often can be converted relatively easily for use with MariaDB by changing the names of the C API functions\&. .PP The \fBmsql2mysql\fR -utility performs the conversion of mSQL C API function calls to their MySQL equivalents\&. +utility performs the conversion of mSQL C API function calls to their MariaDB equivalents\&. \fBmsql2mysql\fR converts the input file in place, so make a copy of the original before converting it\&. For example, use \fBmsql2mysql\fR @@ -53,7 +53,7 @@ utility to make the function name substitutions\&. See .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index 38f2c0a8fe1..8816e46b06e 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "18 December 2023" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -21,9 +21,9 @@ my_print_defaults \- display options from option files .PP \fBmy_print_defaults\fR displays the options that are present in option groups of option files\&. The output indicates what options will be used by programs that read the specified option groups\&. For example, the -\fBmysqlcheck\fR +\fBmariadb-check\fR program reads the -[mysqlcheck] +[mariadb-check] and [client] option groups\&. To see what options are present in those groups in the standard option files, invoke @@ -34,7 +34,7 @@ like this: .RS 4 .\} .nf -shell> \fBmy_print_defaults mysqlcheck client\fR +shell> \fBmy_print_defaults mariadb-check client\fR \-\-user=myusername \-\-password=secret \-\-host=localhost @@ -162,11 +162,11 @@ Read the same set of groups that the mariadbd binary does. .IP \(bu 2.3 .\} -.\" my_print_defaults: --mysqld option -.\" mysqld option: my_print_defaults -\fB\-\-mysqld\fR +.\" my_print_defaults: --mariadbd option +.\" mariadbd option: my_print_defaults +\fB\-\-mariadbd\fR .sp -Read the same set of groups that the mysqld binary does. +Read the same set of groups that the mariadbd binary does. .RE .sp .RS 4 @@ -219,7 +219,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_safe_process.1 b/man/my_safe_process.1 index 455e1b8860f..955275bfb01 100644 --- a/man/my_safe_process.1 +++ b/man/my_safe_process.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_SAFE_PROCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMY_SAFE_PROCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index 449ff55d37a..8df198f0354 100644 --- a/man/myisam_ftdump.1 +++ b/man/myisam_ftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAM_FTDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAM_FTDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -235,7 +235,7 @@ Verbose mode\&. Print more output about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamchk.1 b/man/myisamchk.1 index 1dc053337ec..fd68cf378b5 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMCHK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMCHK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -196,13 +196,13 @@ warning: clients are using or haven't closed the table properly .\} .PP This means that you are trying to check a table that has been updated by another program (such as the -\fBmysqld\fR +\fBmariadbd\fR server) that hasn't yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more MyISAM tables\&. .PP If -\fBmysqld\fR +\fBmariadbd\fR is running, you must force it to flush any table modifications that are still buffered in memory by using FLUSH TABLES\&. You should then ensure that no one is using the tables while you are running \fBmyisamchk\fR @@ -348,7 +348,7 @@ Display version information and exit\&. \fB\-w\fR .sp Instead of terminating with an error if the table is locked, wait until the table is unlocked before continuing\&. If you are running -\fBmysqld\fR +\fBmariadbd\fR with external locking disabled, the table can be locked only by another \fBmyisamchk\fR command\&. @@ -604,7 +604,7 @@ ft_stopword_file values to \fBmyisamchk\fR that you use for -\fBmysqld\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with +\fBmariadbd\fR\&. For example, if you have set the minimum word length to 3, you can repair a table with \fBmyisamchk\fR like this: .sp @@ -621,7 +621,7 @@ shell> \fBmyisamchk \-\-recover \-\-ft_min_word_len=3 \fR\fB\fItbl_name\fR\fR\fB To ensure that \fBmyisamchk\fR and the server use the same values for full\-text parameters, you can place each one in both the -[mysqld] +[mariadbd] and [myisamchk] sections of an option file: @@ -630,7 +630,7 @@ sections of an option file: .RS 4 .\} .nf -[mysqld] +[mariadbd] ft_min_word_len=3 [myisamchk] ft_min_word_len=3 @@ -803,7 +803,7 @@ operation\&. This finds only 99\&.99% of all errors, which should be good enough Do not mark the table as checked\&. This is useful if you use \fBmyisamchk\fR to check a table that is in use by some other application that does not use locking, such as -\fBmysqld\fR +\fBmariadbd\fR when run with external locking disabled\&. .RE .sp @@ -825,7 +825,7 @@ Store information in the file to indicate when the table was checked and whether the table crashed\&. This should be used to get full benefit of the \fB\-\-check\-only\-changed\fR option, but you shouldn't use this option if the -\fBmysqld\fR +\fBmariadbd\fR server is using the table and you are running it with external locking disabled\&. .RE .SH "MYISAMCHK REPAIR OPTIONS" @@ -2505,7 +2505,7 @@ instead of .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamlog.1 b/man/myisamlog.1 index dbf50cf7800..4f99586ff90 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMLOG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -218,7 +218,7 @@ Display version information\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisampack.1 b/man/myisampack.1 index 89dab7d8cf5..db999d33a13 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMPACK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYISAMPACK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -34,11 +34,11 @@ packs the data file 40%\(en70%\&. .PP When the table is used later, the server reads into memory the information needed to decompress columns\&. This results in much better performance when accessing individual rows, because you only have to uncompress exactly one row\&. .PP -MySQL uses +MariaDB uses mmap() when possible to perform memory mapping on compressed tables\&. If mmap() -does not work, MySQL falls back to normal read/write file operations\&. +does not work, MariaDB falls back to normal read/write file operations\&. .PP Please note the following: .sp @@ -51,7 +51,7 @@ Please note the following: .IP \(bu 2.3 .\} If the -\fBmysqld\fR +\fBmariadbd\fR server was invoked with external locking disabled, it is not a good idea to invoke \fBmyisampack\fR if the table might be updated by the server during the packing process\&. It is safest to compress tables with the server stopped\&. @@ -320,7 +320,7 @@ Display version information and exit\&. \fB\-w\fR .sp Wait and retry if the table is in use\&. If the -\fBmysqld\fR +\fBmariadbd\fR server was invoked with external locking disabled, it is not a good idea to invoke \fBmyisampack\fR if the table might be updated by the server during the packing process\&. @@ -798,7 +798,7 @@ The number of bits used in the Huffman tree\&. After you run \fBmyisampack\fR, you must run \fBmyisamchk\fR -to re\-create any indexes\&. At this time, you can also sort the index blocks and create statistics needed for the MySQL optimizer to work more efficiently: +to re\-create any indexes\&. At this time, you can also sort the index blocks and create statistics needed for the MariaDB optimizer to work more efficiently: .sp .if n \{\ .RS 4 @@ -810,10 +810,10 @@ shell> \fBmyisamchk \-rq \-\-sort\-index \-\-analyze \fR\fB\fItbl_name\fR\fR\fB\ .RE .\} .PP -After you have installed the packed table into the MySQL database directory, you should execute -\fBmysqladmin flush\-tables\fR +After you have installed the packed table into the MariaDB database directory, you should execute +\fBmariadb-admin flush\-tables\fR to force -\fBmysqld\fR +\fBmariadbd\fR to start using the new table\&. .PP To unpack a packed table, use the @@ -823,7 +823,7 @@ option to .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index 6024a2ece08..b6929463b43 100644 --- a/man/mysql-stress-test.pl.1 +++ b/man/mysql-stress-test.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\-STRESS\-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\-STRESS\-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,36 +11,36 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql-stress-test.pl +.\" mariadb-stress-test.pl .SH "NAME" -mysql-stress-test.pl \- server stress test program +mariadb-stress-test.pl \- server stress test program .SH "SYNOPSIS" -.HP \w'\fBmysql\-stress\-test\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb\-stress\-test\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR Perl script performs stress\-testing of the MariaDB server\&. .PP -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR requires a version of Perl that has been built with threads support\&. .PP Invoke -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +shell> \fBmariadb\-stress\-test\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .fi .if n \{\ .RE .\} .PP -\fBmysql\-stress\-test\&.pl\fR +\fBmariadb\-stress\-test\&.pl\fR supports the following options: .sp .RS 4 @@ -51,8 +51,8 @@ supports the following options: .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: help option -.\" help option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: help option +.\" help option: mariadb-stress-test.pl \fB\-\-help\fR .sp Display a help message and exit\&. @@ -66,8 +66,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: abort-on-error option -.\" abort-on-error option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: abort-on-error option +.\" abort-on-error option: mariadb-stress-test.pl \fB\-\-abort\-on\-error=\fR\fB\fIN\fR\fR .sp Causes the program to abort if an error with severity less than or equal to N was encountered\&. Set to 1 to abort on any error\&. @@ -81,8 +81,8 @@ Causes the program to abort if an error with severity less than or equal to N wa .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: check-tests-file option -.\" check-tests-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: check-tests-file option +.\" check-tests-file option: mariadb-stress-test.pl \fB\-\-check\-tests\-file\fR .sp Periodically check the file that lists the tests to be run\&. If it has been modified, reread the file\&. This can be useful if you update the list of tests to be run during a stress test\&. @@ -96,8 +96,8 @@ Periodically check the file that lists the tests to be run\&. If it has been mod .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: cleanup option -.\" cleanup option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: cleanup option +.\" cleanup option: mariadb-stress-test.pl \fB\-\-cleanup\fR .sp Force cleanup of the working directory\&. @@ -111,8 +111,8 @@ Force cleanup of the working directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: log-error-details option -.\" log-error-details option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: log-error-details option +.\" log-error-details option: mariadb-stress-test.pl \fB\-\-log\-error\-details\fR .sp Log error details in the global error log file\&. @@ -126,8 +126,8 @@ Log error details in the global error log file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: loop-count option -.\" loop-count option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: loop-count option +.\" loop-count option: mariadb-stress-test.pl \fB\-\-loop\-count=\fR\fB\fIN\fR\fR .sp In sequential test mode, the number of loops to execute before exiting\&. @@ -141,12 +141,12 @@ In sequential test mode, the number of loops to execute before exiting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: mysqltest option -.\" mysqltest option: mysql-stress-test.pl -\fB\-\-mysqltest=\fR\fB\fIpath\fR\fR +.\" mariadb-stress-test.pl: mariadb-test option +.\" mariadb-test option: mariadb-stress-test.pl +\fB\-\-mariadb-test=\fR\fB\fIpath\fR\fR .sp The path name to the -\fBmysqltest\fR +\fBmariadb-test\fR program\&. .RE .sp @@ -158,8 +158,8 @@ program\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-database option -.\" server-database option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-database option +.\" server-database option: mariadb-stress-test.pl \fB\-\-server\-database=\fR\fB\fIdb_name\fR\fR .sp The database to use for the tests\&. The default is @@ -174,8 +174,8 @@ test\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-host option -.\" server-host option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-host option +.\" server-host option: mariadb-stress-test.pl \fB\-\-server\-host=\fR\fB\fIhost_name\fR\fR .sp The host name of the local host to use for making a TCP/IP connection to the local server\&. By default, the connection is made to @@ -191,8 +191,8 @@ using a Unix socket file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-logs-dir option -.\" server-logs-dir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-logs-dir option +.\" server-logs-dir option: mariadb-stress-test.pl \fB\-\-server\-logs\-dir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -208,8 +208,8 @@ is the directory where all client session logs will be stored\&. Usually this is .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-password option -.\" server-password option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-password option +.\" server-password option: mariadb-stress-test.pl \fB\-\-server\-password=\fR\fB\fIpassword\fR\fR .sp The password to use when connecting to the server\&. @@ -223,8 +223,8 @@ The password to use when connecting to the server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-port option -.\" server-port option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-port option +.\" server-port option: mariadb-stress-test.pl \fB\-\-server\-port=\fR\fB\fIport_num\fR\fR .sp The TCP/IP port number to use for connecting to the server\&. The default is 3306\&. @@ -238,13 +238,13 @@ The TCP/IP port number to use for connecting to the server\&. The default is 330 .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-socket option -.\" server-socket option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-socket option +.\" server-socket option: mariadb-stress-test.pl \fB\-\-server\-socket=\fR\fB\fIfile_name\fR\fR .sp For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&. The default is -/tmp/mysql\&.sock\&. +/tmp/mariadb\&.sock\&. .RE .sp .RS 4 @@ -255,8 +255,8 @@ localhost, the Unix socket file to use, or, on Windows, the name of the named pi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: server-user option -.\" server-user option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: server-user option +.\" server-user option: mariadb-stress-test.pl \fB\-\-server\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server\&. The default is @@ -271,8 +271,8 @@ root\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: sleep-time option -.\" sleep-time option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: sleep-time option +.\" sleep-time option: mariadb-stress-test.pl \fB\-\-sleep\-time=\fR\fB\fIN\fR\fR .sp The delay in seconds between test executions\&. @@ -286,8 +286,8 @@ The delay in seconds between test executions\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-basedir option -.\" stress-basedir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-basedir option +.\" stress-basedir option: mariadb-stress-test.pl \fB\-\-stress\-basedir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -303,8 +303,8 @@ is the working directory for the test run\&. It is used as the temporary locatio .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-datadir option -.\" stress-datadir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-datadir option +.\" stress-datadir option: mariadb-stress-test.pl \fB\-\-stress\-datadir=\fR\fB\fIpath\fR\fR .sp The directory of data files to be used during testing\&. The default location is the @@ -322,8 +322,8 @@ option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-init-file option -.\" stress-init-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-init-file option +.\" stress-init-file option: mariadb-stress-test.pl \fB\-\-stress\-init\-file[=\fR\fB\fIpath\fR\fR\fB]\fR .sp \fIfile_name\fR @@ -340,8 +340,8 @@ in the test suite directory\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-mode option -.\" stress-mode option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-mode option +.\" stress-mode option: mariadb-stress-test.pl \fB\-\-stress\-mode=\fR\fB\fImode\fR\fR .sp This option indicates the test order in stress\-test mode\&. The @@ -362,8 +362,8 @@ random\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-suite-basedir option -.\" stress-suite-basedir option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-suite-basedir option +.\" stress-suite-basedir option: mariadb-stress-test.pl \fB\-\-stress\-suite\-basedir=\fR\fB\fIpath\fR\fR .sp This option is required\&. @@ -387,8 +387,8 @@ option\&.) .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: stress-tests-file option -.\" stress-tests-file option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: stress-tests-file option +.\" stress-tests-file option: mariadb-stress-test.pl \fB\-\-stress\-tests\-file[=\fR\fB\fIfile_name\fR\fR\fB]\fR .sp Use this option to run the stress tests\&. @@ -409,14 +409,14 @@ in the stress suite directory\&. (See .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: suite option -.\" suite option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: suite option +.\" suite option: mariadb-stress-test.pl \fB\-\-suite=\fR\fB\fIsuite_name\fR\fR .sp Run the named test suite\&. The default name is main (the regular test suite located in the -mysql\-test +mariadb\-test directory)\&. .RE .sp @@ -428,8 +428,8 @@ directory)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: test-count option -.\" test-count option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: test-count option +.\" test-count option: mariadb-stress-test.pl \fB\-\-test\-count=\fR\fB\fIN\fR\fR .sp The number of tests to execute before exiting\&. @@ -443,8 +443,8 @@ The number of tests to execute before exiting\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: test-duration option -.\" test-duration option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: test-duration option +.\" test-duration option: mariadb-stress-test.pl \fB\-\-test\-duration=\fR\fB\fIN\fR\fR .sp The duration of stress testing in seconds\&. @@ -458,8 +458,8 @@ The duration of stress testing in seconds\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: threads option -.\" threads option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: threads option +.\" threads option: mariadb-stress-test.pl \fB\-\-threads=\fR\fB\fIN\fR\fR .sp The number of threads\&. The default is 1\&. @@ -473,8 +473,8 @@ The number of threads\&. The default is 1\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-stress-test.pl: verbose option -.\" verbose option: mysql-stress-test.pl +.\" mariadb-stress-test.pl: verbose option +.\" verbose option: mariadb-stress-test.pl \fB\-\-verbose\fR .sp Verbose mode\&. Print more information about what the program does\&. @@ -482,7 +482,7 @@ Verbose mode\&. Print more information about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 1677c070f3b..a1ac726ae68 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\-TEST\-RUN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB\-TEST\-RUN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -11,31 +11,31 @@ .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- -.\" mysql-test-run.pl +.\" mariadb-test-run.pl .SH "NAME" -mysql-test-run.pl \- run MariaDB test suite +mariadb-test-run.pl \- run MariaDB test suite .SH "SYNOPSIS" -.HP \w'\fBmysql\-test\-run\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBmysql\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR +.HP \w'\fBmariadb\-test\-run\&.pl\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u +\fBmariadb\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB]\fR .SH "DESCRIPTION" .PP The -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR Perl script is the main application used to run the MariaDB test suite\&. It invokes -\fBmysqltest\fR +\fBmariadb-test\fR to run individual test cases\&. .PP Invoke -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR in the -mysql\-test +mariadb\-test directory like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBmysql\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR +shell> \fBmariadb\-test\-run\&.pl [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fItest_name\fR\fR\fB] \&.\&.\&.\fR .fi .if n \{\ .RE @@ -49,11 +49,11 @@ t/\fItest_name\fR\&.test\&. For each \fItest_name\fR argument, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR runs the named test case\&. With no \fItest_name\fR arguments, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR runs all \&.test files in the @@ -68,9 +68,9 @@ is assumed\&. Any leading path name is ignored\&. These commands are equivalent: .RS 4 .\} .nf -shell> \fBmysql\-test\-run\&.pl mytest\fR -shell> \fBmysql\-test\-run\&.pl mytest\&.test\fR -shell> \fBmysql\-test\-run\&.pl t/mytest\&.test\fR +shell> \fBmariadb\-test\-run\&.pl mytest\fR +shell> \fBmariadb\-test\-run\&.pl mytest\&.test\fR +shell> \fBmariadb\-test\-run\&.pl t/mytest\&.test\fR .fi .if n \{\ .RE @@ -89,7 +89,7 @@ A suite name can be given as part of the test name\&. That is, the syntax for na .\} .PP If a suite name is given, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR looks in that suite for the test\&. The test file corresponding to a test named \fIsuite_name\&.test_name\fR is found in @@ -98,7 +98,7 @@ main for the tests in the top t directory\&. With no suite name, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR looks in the default list of suites for a match and runs the test in any suites where it finds the test\&. Suppose that the default suite list is main, binlog, @@ -112,7 +112,7 @@ suites\&. With an argument of mytest or mytest\&.test, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will run mytest\&.test from the @@ -152,14 +152,14 @@ with anything in between\&. In the latter case, the pattern match is not anchore xmainytesta\&. .PP To perform setup prior to running tests, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR needs to invoke -\fBmysqld\fR +\fBmariadbd\fR with the \fB\-\-bootstrap\fR and \fB\-\-skip\-grant\-tables\fR -options\&. If MySQL was configured with the +options\&. If MariaDB was configured with the \fB\-\-disable\-grant\-options\fR option, \fB\-\-bootstrap\fR, @@ -168,7 +168,7 @@ option, will be disabled\&. To handle this, set the MYSQLD_BOOTSTRAP environment variable to the full path name of a server that has all options enabled\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will use that server to perform setup; it is not used to run the tests\&. .PP The @@ -182,7 +182,7 @@ is disabled\&. This is an expected failure that can be handled as follows: .\} .nf shell> \fBexport MYSQLD_BOOTSTRAP\fR -shell> \fBMYSQLD_BOOTSTRAP=/full/path/to/mysqld\fR +shell> \fBMYSQLD_BOOTSTRAP=/full/path/to/mariadbd\fR shell> \fBmake test force="\-\-skip\-test=init_file"\fR .fi .if n \{\ @@ -190,15 +190,15 @@ shell> \fBmake test force="\-\-skip\-test=init_file"\fR .\} .PP To run -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR on Windows, you'll need either Cygwin or ActiveState Perl to run it\&. You may also need to install the modules required by the script\&. To run the test script, change location into the -mysql\-test +mariadb\-test directory, set the MTR_VS_CONFIG environment variable to the configuration you selected earlier (or use the \fB\-\-vs\-config\fR option), and invoke -\fBmysql\-test\-run\&.pl\fR\&. For example (using Cygwin and the +\fBmariadb\-test\-run\&.pl\fR\&. For example (using Cygwin and the \fBbash\fR shell): .sp @@ -206,19 +206,19 @@ shell): .RS 4 .\} .nf -shell> \fBcd mysql\-test\fR +shell> \fBcd mariadb\-test\fR shell> \fBexport MTR_VS_CONFIG=debug\fR -shell> \fB\&./mysqltest\-run\&.pl \-\-force \-\-timer\fR -shell> \fB\&./mysqltest\-run\&.pl \-\-force \-\-timer \-\-ps\-protocol\fR +shell> \fB\&./mariadb-test\-run\&.pl \-\-force \-\-timer\fR +shell> \fB\&./mariadb-test\-run\&.pl \-\-force \-\-timer \-\-ps\-protocol\fR .fi .if n \{\ .RE .\} .PP -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR uses several environment variables\&. Some of them are listed in the following table\&. Some of these are set from the outside and used by -\fBmysql\-test\-run\&.pl\fR, others are set by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR, others are set by +\fBmariadb\-test\-run\&.pl\fR instead, and may be referred to in tests\&. .TS allbox tab(:); @@ -242,7 +242,7 @@ T} T{ MTR_VERSION T}:T{ -If set to 1, will run the older version 1 of \fBmysql\-test\-run\&.pl\fR\&. This will affect what functionailty is available and what command line options are supported\&. +If set to 1, will run the older version 1 of \fBmariadb\-test\-run\&.pl\fR\&. This will affect what functionailty is available and what command line options are supported\&. T} T{ MTR_MEM @@ -275,12 +275,12 @@ T} T{ MYSQL_TEST T}:T{ -Path name to \fBmysqltest\fR binary +Path name to \fBmariadb-test\fR binary T} T{ MYSQLD_BOOTSTRAP T}:T{ -Full path name to \fBmysqld\fR that has all options enabled +Full path name to \fBmariadbd\fR that has all options enabled T} T{ MYSQLTEST_VARDIR @@ -291,7 +291,7 @@ T} T{ MYSQL_TEST_DIR T}:T{ -Full path to the mysql\-test directory where tests +Full path to the mariadb\-test directory where tests are being run from T} T{ @@ -309,9 +309,9 @@ MTR_BUILD_THREAD\&. It gives the actual port number directly (will be rounded do MTR_BUILD_THREAD, the port number is found by multiplying this by 10 and adding 10000\&. .PP Tests sometimes rely on certain environment variables being defined\&. For example, certain tests assume that -MYSQL_TEST +MARIADB-TEST is defined so that -\fBmysqltest\fR +\fBmariadb-test\fR can invoke itself with exec $MYSQL_TEST\&. .PP @@ -319,18 +319,18 @@ Other tests may refer to the last three variables listed in the preceding table, $MYSQL_TMP_DIR/\fIfile_name\fR\&. .PP If you are running -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR version 1 by setting MTR_VERSION, note that this only affects the test driver, not the test client (and its language) or the tests themselves\&. .PP A few tests might not run with version 1 because they depend on some feature of version 2\&. You may have those tests skipped by adding the test name to the file lib/v1/incompatible\&.tests\&. This feature is available from MySQL 5\&.1\&.40\&. .PP -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR supports the options in the following list\&. An argument of \fB\-\-\fR tells -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR not to process any following arguments as options\&. .sp .RS 4 @@ -341,8 +341,8 @@ not to process any following arguments as options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: help option -.\" help option: mysql-test-run.pl +.\" mariadb-test-run.pl: help option +.\" help option: mariadb-test-run.pl \fB\-\-help\fR, \fB\-h\fR .sp @@ -357,8 +357,8 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: big-test option -.\" big-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: big-test option +.\" big-test option: mariadb-test-run.pl \fB\-\-big\-test\fR .sp Allow tests marked as "big" to run\&. Tests can be thus marked by including the line @@ -377,11 +377,11 @@ This is typically used for tests that take a very long to run, or that use many .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-dbx option -.\" boot-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-dbx option +.\" boot-dbx option: mariadb-test-run.pl \fB\-\-boot\-dbx\fR .sp -Run the mysqld server used for bootstrapping the database through the dbx debugger\&. +Run the mariadbd server used for bootstrapping the database through the dbx debugger\&. .RE .sp .RS 4 @@ -392,11 +392,11 @@ Run the mysqld server used for bootstrapping the database through the dbx debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-ddd option -.\" boot-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-ddd option +.\" boot-ddd option: mariadb-test-run.pl \fB\-\-boot\-ddd\fR .sp -Run the mysqld server used for bootstrapping the database through the ddd debugger\&. +Run the mariadbd server used for bootstrapping the database through the ddd debugger\&. .RE .sp .RS 4 @@ -407,11 +407,11 @@ Run the mysqld server used for bootstrapping the database through the ddd debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: boot-gdb option -.\" boot-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: boot-gdb option +.\" boot-gdb option: mariadb-test-run.pl \fB\-\-boot\-gdb\fR .sp -Run the mysqld server used for bootstrapping the database through the gdb debugger\&. +Run the mariadbd server used for bootstrapping the database through the gdb debugger\&. .RE .sp .RS 4 @@ -422,15 +422,15 @@ Run the mysqld server used for bootstrapping the database through the gdb debugg .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: build-thread option -.\" build-thread option: mysql-test-run.pl +.\" mariadb-test-run.pl: build-thread option +.\" build-thread option: mariadb-test-run.pl \fB\-\-[mtr\-]build\-thread=\fR\fB\fInumber\fR\fR .sp Specify a number to calculate port numbers from\&. The formula is 10 * \fIbuild_thread\fR + 10000\&. Instead of a number, it can be set to auto, which is also the default value, in which case -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will allocate a number unique to this host\&. .sp The value (number or @@ -451,8 +451,8 @@ is supported as an alternative\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: callgrind option -.\" callgrind option: mysql-test-run.pl +.\" mariadb-test-run.pl: callgrind option +.\" callgrind option: mariadb-test-run.pl \fB\-\-callgrind\fR .sp Instructs @@ -469,8 +469,8 @@ to use .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: check-testcases option -.\" check-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: check-testcases option +.\" check-testcases option: mariadb-test-run.pl \fB\-\-check\-testcases\fR .sp Check test cases for side effects\&. This is done by checking system state before and after each test case; if there is any difference, a warning to that effect will be written, but the test case will not be marked as failed because of it\&. This check is enabled by default\&. @@ -484,8 +484,8 @@ Check test cases for side effects\&. This is done by checking system state befor .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-bindir option -.\" client-bindir option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-bindir option +.\" client-bindir option: mariadb-test-run.pl \fB\-\-client\-bindir=\fR\fB\fIpath\fR\fR .sp The path to the directory where client binaries are located\&. @@ -499,12 +499,12 @@ The path to the directory where client binaries are located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-dbx option -.\" client-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-dbx option +.\" client-dbx option: mariadb-test-run.pl \fB\-\-client\-dbx\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBdbx\fR debugger\&. @@ -518,12 +518,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-ddd option -.\" client-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-ddd option +.\" client-ddd option: mariadb-test-run.pl \fB\-\-client\-ddd\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBddd\fR debugger\&. @@ -537,12 +537,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-debugger option -.\" client-debugger option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-debugger option +.\" client-debugger option: mariadb-test-run.pl \fB\-\-client\-debugger=\fR\fB\fIdebugger\fR\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the named debugger\&. .RE .sp @@ -554,12 +554,12 @@ in the named debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-gdb option -.\" client-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-gdb option +.\" client-gdb option: mariadb-test-run.pl \fB\-\-client\-gdb\fR .sp Start -\fBmysqltest\fR +\fBmariadb-test\fR in the \fBgdb\fR debugger\&. @@ -573,8 +573,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: client-libdir option -.\" client-libdir option: mysql-test-run.pl +.\" mariadb-test-run.pl: client-libdir option +.\" client-libdir option: mariadb-test-run.pl \fB\-\-client\-libdir=\fR\fB\fIpath\fR\fR .sp The path to the directory where client libraries are located\&. @@ -588,17 +588,17 @@ The path to the directory where client libraries are located\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: combination option -.\" combination option: mysql-test-run.pl +.\" mariadb-test-run.pl: combination option +.\" combination option: mariadb-test-run.pl \fB\-\-combination=\fR\fB\fIvalue\fR\fR .sp Extra options to pass to -\fBmysqld\fR\&. The value should consist of one or more comma\-separated -\fBmysqld\fR +\fBmariadbd\fR\&. The value should consist of one or more comma\-separated +\fBmariadbd\fR options\&. This option is similar to -\fB\-\-mysqld\fR +\fB\-\-mariadbd\fR but should be given two or more times\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR executes multiple test runs, using the options for each instance of \fB\-\-combination\fR in successive runs\&. If @@ -618,8 +618,8 @@ file in the suite directory\&. The file should contain a section of options for .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: comment option -.\" comment option: mysql-test-run.pl +.\" mariadb-test-run.pl: comment option +.\" comment option: mariadb-test-run.pl \fB\-\-comment=\fR\fB\fIstr\fR\fR .sp Write @@ -636,8 +636,8 @@ to the output within lines filled with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: compress option -.\" compress option: mysql-test-run.pl +.\" mariadb-test-run.pl: compress option +.\" compress option: mariadb-test-run.pl \fB\-\-compress\fR .sp Compress all information sent between the client and the server if both support compression\&. @@ -651,8 +651,8 @@ Compress all information sent between the client and the server if both support .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: cursor-protocol option -.\" cursor-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: cursor-protocol option +.\" cursor-protocol option: mariadb-test-run.pl \fB\-\-cursor\-protocol\fR .sp Use the cursor protocol between client and server @@ -668,12 +668,12 @@ Use the cursor protocol between client and server .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: dbx option -.\" dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: dbx option +.\" dbx option: mariadb-test-run.pl \fB\-\-dbx\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBdbx\fR debugger\&. @@ -687,12 +687,12 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ddd option -.\" ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: ddd option +.\" ddd option: mariadb-test-run.pl \fB\-\-ddd\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBddd\fR debugger\&. @@ -706,8 +706,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug option -.\" debug option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug option +.\" debug option: mariadb-test-run.pl \fB\-\-debug\fR .sp Dump trace output for all clients and servers\&. @@ -721,8 +721,8 @@ Dump trace output for all clients and servers\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-common option -.\" debug-common option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-common option +.\" debug-common option: mariadb-test-run.pl \fB\-\-debug\-common\fR .sp Same as \fB--debug\fR, but sets the 'd' debug flags to "query,info,error,enter,exit"\&. @@ -736,8 +736,8 @@ Same as \fB--debug\fR, but sets the 'd' debug flags to "query,info,error,enter,e .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-server option -.\" debug-server option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-server option +.\" debug-server option: mariadb-test-run.pl \fB\-\-debug\-server\fR .sp Use debug version of server, but without turning on tracing\&. @@ -751,12 +751,12 @@ Use debug version of server, but without turning on tracing\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debugger option -.\" debugger option: mysql-test-run.pl +.\" mariadb-test-run.pl: debugger option +.\" debugger option: mariadb-test-run.pl \fB\-\-debugger=\fR\fB\fIdebugger\fR\fR .sp Start -\fBmysqld\fR +\fBmariadbd\fR using the named debugger\&. .RE .sp @@ -768,20 +768,20 @@ using the named debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: debug-sync-timeout option -.\" debug-sync-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: debug-sync-timeout option +.\" debug-sync-timeout option: mariadb-test-run.pl \fB\-\-debug\-sync\-timeout=\fR\fB\fIN\fR\fR .sp Controls whether the Debug Sync facility for testing and debugging is enabled\&. The option value is a timeout in seconds\&. The default value is 300\&. A value of 0 disables Debug Sync\&. The value of this option also becomes the default timeout for individual synchronization points\&. .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR passes \fB\-\-loose\-debug\-sync\-timeout=\fR\fB\fIN\fR\fR to -\fBmysqld\fR\&. The +\fBmariadbd\fR\&. The \fB\-\-loose\fR prefix is used so that -\fBmysqld\fR +\fBmariadbd\fR does not fail if Debug Sync is not compiled in\&. .RE .sp @@ -793,8 +793,8 @@ does not fail if Debug Sync is not compiled in\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: defaults-file option -.\" defaults-file option: mysql-test-run.pl +.\" mariadb-test-run.pl: defaults-file option +.\" defaults-file option: mariadb-test-run.pl \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR .sp Use the named file as fixed config file template for all tests\&. @@ -808,8 +808,8 @@ Use the named file as fixed config file template for all tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: defaults_extra_file option -.\" default_extra_file option: mysql-test-run.pl +.\" mariadb-test-run.pl: defaults_extra_file option +.\" default_extra_file option: mariadb-test-run.pl \fB\-\-defaults_extra_file=\fR\fB\fIfile_name\fR\fR .sp Add setting from the named file to all generated configs\&. @@ -823,8 +823,8 @@ Add setting from the named file to all generated configs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: do-test option -.\" do-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: do-test option +.\" do-test option: mariadb-test-run.pl \fB\-\-do\-test=\fR\fB\fIprefix\fR\fR|\fB\fIregex\fR\fR .sp Run all test cases having a name that begins with the given @@ -860,8 +860,8 @@ xmainytestz\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: dry-run option -.\" dry-run option: mysql-test-run.pl +.\" mariadb-test-run.pl: dry-run option +.\" dry-run option: mariadb-test-run.pl \fB\-\-dry\-run\fR .sp Don't run any tests, print the list of tests that were selected for execution\&. @@ -875,12 +875,12 @@ Don't run any tests, print the list of tests that were selected for execution\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: embedded-server option -.\" embedded-server option: mysql-test-run.pl +.\" mariadb-test-run.pl: embedded-server option +.\" embedded-server option: mariadb-test-run.pl \fB\-\-embedded\-server\fR .sp Use a version of -\fBmysqltest\fR +\fBmariadb-test\fR built with the embedded server\&. .RE .sp @@ -892,8 +892,8 @@ built with the embedded server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: enable-disabled option -.\" enable-disabled option: mysql-test-run.pl +.\" mariadb-test-run.pl: enable-disabled option +.\" enable-disabled option: mariadb-test-run.pl \fB\-\-enable\-disabled\fR .sp Ignore any @@ -909,8 +909,8 @@ file, and also run tests marked as disabled\&. Success or failure of those tests .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: experimental option -.\" experimental option: mysql-test-run.pl +.\" mariadb-test-run.pl: experimental option +.\" experimental option: mariadb-test-run.pl \fB\-\-experimental=\fR\fB\fIfile_name\fR\fR .sp Specify a file that contains a list of test cases that should be displayed with the @@ -920,7 +920,7 @@ code rather than if they fail\&. .sp For an example of a file that might be specified via this option, see -mysql\-test/collections/default\&.experimental\&. +mariadb\-test/collections/default\&.experimental\&. .RE .sp .RS 4 @@ -931,13 +931,13 @@ mysql\-test/collections/default\&.experimental\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: extern option -.\" extern option: mysql-test-run.pl +.\" mariadb-test-run.pl: extern option +.\" extern option: mariadb-test-run.pl \fB\-\-extern\fR \fIoption\fR=\fIvalue\fR .sp Use an already running server\&. The option/value pair is what is needed by the -\fBmysql\fR +\fBmariadb\fR client to connect to the server\&. Each \fB\-\-extern\fR option can only take one option/value pair as an argument, so you need to repeat @@ -948,7 +948,7 @@ for each pair needed\&. Example: .RS 4 .\} .nf - \&./mysql\-test\-run\&.pl \-\-extern socket=var/tmp/mysqld\&.1\&.sock alias + \&./mariadb\-test\-run\&.pl \-\-extern socket=var/tmp/mariadbd\&.1\&.sock alias .fi .if n \{\ .RE @@ -967,8 +967,8 @@ file that requires the server to be restarted with specific options, the file wi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: fast option -.\" fast option: mysql-test-run.pl +.\" mariadb-test-run.pl: fast option +.\" fast option: mariadb-test-run.pl \fB\-\-fast\fR .sp Do not perform controlled shutdown when servers need to be restarted or at the end of the test run\&. This is equivalent to using @@ -983,8 +983,8 @@ Do not perform controlled shutdown when servers need to be restarted or at the e .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: force-restart option -.\" force-restart option: mysql-test-run.pl +.\" mariadb-test-run.pl: force-restart option +.\" force-restart option: mariadb-test-run.pl \fB\-\-force\-restart\fR .sp Always restart servers between tests\&. @@ -998,12 +998,12 @@ Always restart servers between tests\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: force option -.\" force option: mysql-test-run.pl +.\" mariadb-test-run.pl: force option +.\" force option: mariadb-test-run.pl \fB\-\-force\fR .sp Normally, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR exits if a test case fails\&. \fB\-\-force\fR causes execution to continue regardless of test case failure\&. @@ -1017,8 +1017,8 @@ causes execution to continue regardless of test case failure\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gcov option -.\" gcov option: mysql-test-run.pl +.\" mariadb-test-run.pl: gcov option +.\" gcov option: mariadb-test-run.pl \fB\-\-gcov\fR .sp Collect coverage information after the test\&. The result is a @@ -1034,8 +1034,8 @@ file per source and header file\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gcov-src-dir option -.\" gcov-src-dir option: mysql-test-run.pl +.\" mariadb-test-run.pl: gcov-src-dir option +.\" gcov-src-dir option: mariadb-test-run.pl \fB\-\-gcov\-src\-dir\fR .sp Colllect coverage only within the given subdirectory\&. For example, if you're only developing the SQL layer, @@ -1050,12 +1050,12 @@ it makes sense to use \fB--gcov-src-dir=sql\fR\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gdb option -.\" gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: gdb option +.\" gdb option: mariadb-test-run.pl \fB\-\-gdb\fR .sp Start the -\fBmysqld(s)\fR +\fBmariadbd(s)\fR in the \fBgdb\fR debugger\&. @@ -1069,8 +1069,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: gprof option -.\" gprof option: mysql-test-run.pl +.\" mariadb-test-run.pl: gprof option +.\" gprof option: mariadb-test-run.pl \fB\-\-gprof\fR .sp Collect profiling information using the @@ -1086,8 +1086,8 @@ profiling tool\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-dbx option -.\" manual-dbx option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-dbx option +.\" manual-dbx option: mariadb-test-run.pl \fB\-\-manual\-dbx\fR .sp Use a server that has already been started by the user in the @@ -1103,8 +1103,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-ddd option -.\" manual-ddd option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-ddd option +.\" manual-ddd option: mariadb-test-run.pl \fB\-\-manual\-ddd\fR .sp Use a server that has already been started by the user in the @@ -1120,8 +1120,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-debug option -.\" manual-debug option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-debug option +.\" manual-debug option: mariadb-test-run.pl \fB\-\-manual\-debug\fR .sp Use a server that has already been started by the user in a debugger\&. @@ -1135,8 +1135,8 @@ Use a server that has already been started by the user in a debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-gdb option -.\" manual-gdb option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-gdb option +.\" manual-gdb option: mariadb-test-run.pl \fB\-\-manual\-gdb\fR .sp Use a server that has already been started by the user in the @@ -1152,8 +1152,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: manual-lldb option -.\" manual-lldb option: mysql-test-run.pl +.\" mariadb-test-run.pl: manual-lldb option +.\" manual-lldb option: mariadb-test-run.pl \fB\-\-manual\-lldb\fR .sp Use a server that has already been started by the user in the @@ -1169,8 +1169,8 @@ debugger\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mark-progress option -.\" mark-progress option: mysql-test-run.pl +.\" mariadb-test-run.pl: mark-progress option +.\" mark-progress option: mariadb-test-run.pl \fB\-\-mark\-progress\fR .sp Marks progress with timing (in milliseconds) and line number in @@ -1185,12 +1185,12 @@ var/log/\fItestname\fR\&.progress\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-connections option -.\" max-connections option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-connections option +.\" max-connections option: mariadb-test-run.pl \fB\-\-max\-connections=\fR\fB\fInum\fR\fR .sp The maximum number of simultaneous server connections that may be used per test\&. If not set, the maximum is 128\&. Minimum allowed limit is 8, maximum is 5120\&. Corresponds to the same option for -\fBmysqltest\fR\&. +\fBmariadb-test\fR\&. .RE .sp .RS 4 @@ -1201,8 +1201,8 @@ The maximum number of simultaneous server connections that may be used per test\ .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-save-core option -.\" max-save-core option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-save-core option +.\" max-save-core option: mariadb-test-run.pl \fB\-\-max\-save\-core=\fR\fB\fIN\fR\fR .sp Limit the number of core files saved, to avoid filling up disks in case of a frequently crashing server\&. Defaults to 5, set to 0 for no limit\&. May also be set with the environment variable @@ -1217,8 +1217,8 @@ MTR_MAX_SAVE_CORE .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-save-datadir option -.\" max-save-datadir option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-save-datadir option +.\" max-save-datadir option: mariadb-test-run.pl \fB\-\-max\-save\-datadir=\fR\fB\fIN\fR\fR .sp Limit the number of data directories saved after failed tests, to avoid filling up disks in case of frequent failures\&. Defaults to 20, set to 0 for no limit\&. May also be set with the environment variable @@ -1233,8 +1233,8 @@ MTR_MAX_SAVE_DATADIR .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: max-test-fail option -.\" max-test-fail option: mysql-test-run.pl +.\" mariadb-test-run.pl: max-test-fail option +.\" max-test-fail option: mariadb-test-run.pl \fB\-\-max\-test\-fail=\fR\fB\fIN\fR\fR .sp Stop execution after the specified number of tests have failed, to avoid using up resources (and time) in case of massive failures\&. retries are not counted, nor are failures of tests marked experimental\&. Defaults to 10, set to 0 for no limit\&. May also be set with the environment variable @@ -1249,14 +1249,14 @@ MTR_MAX_TEST_FAIL .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mem option -.\" mem option: mysql-test-run.pl +.\" mariadb-test-run.pl: mem option +.\" mem option: mariadb-test-run.pl \fB\-\-mem\fR .sp This option is not supported on Windows\&. .sp Run the test suite in memory, using tmpfs or ramdisk\&. This can decrease test times significantly, in particular if you would otherwise be running over a remote file system\&. -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR attempts to find a suitable location using a built\-in list of standard locations for tmpfs and puts the var directory there\&. This option also affects placement of temporary files, which are created in @@ -1271,7 +1271,7 @@ is given, it is added to the beginning of the list of locations to search, so it Once you have run tests with \fB\-\-mem\fR within a -mysql\-testdirectory, a soflink +mariadb\-testdirectory, a soflink var will have been set up to the temporary directory, and this will be re\-used the next time, until the soflink is deleted\&. Thus, you do not have to repeat the \fB\-\-mem\fR @@ -1286,13 +1286,13 @@ option next time\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mysqld option -.\" mysqld option: mysql-test-run.pl -\fB\-\-mysqld=\fR\fB\fIvalue\fR\fR +.\" mariadb-test-run.pl: mariadbd option +.\" mariadbd option: mariadb-test-run.pl +\fB\-\-mariadbd=\fR\fB\fIvalue\fR\fR .sp Extra options to pass to -\fBmysqld\fR\&. The value should consist of one or more comma\-separated -\fBmysqld\fR +\fBmariadbd\fR\&. The value should consist of one or more comma\-separated +\fBmariadbd\fR options\&. .RE .sp @@ -1304,11 +1304,11 @@ options\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: mysqld-env option -.\" mysqld-env option: mysql-test-run.pl -\fB\-\-mysqld\-env=\fR\fB\fIVAR=VAL\fR\fR +.\" mariadb-test-run.pl: mariadbd-env option +.\" mariadbd-env option: mariadb-test-run.pl +\fB\-\-mariadbd\-env=\fR\fB\fIVAR=VAL\fR\fR .sp -Specify additional environment settings for "mysqld"\&. Use additional \fB--mysqld-env\fR options to set more than one variable\&. +Specify additional environment settings for "mariadbd"\&. Use additional \fB--mariadbd-env\fR options to set more than one variable\&. .RE .sp .RS 4 @@ -1319,8 +1319,8 @@ Specify additional environment settings for "mysqld"\&. Use additional \fB--mysq .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: nocheck-testcases option -.\" nocheck-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: nocheck-testcases option +.\" nocheck-testcases option: mariadb-test-run.pl \fB\-\-nocheck\-testcases\fR .sp Disable the check for test case side effects; see @@ -1336,8 +1336,8 @@ for a description\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: noreorder option -.\" noreorder option: mysql-test-run.pl +.\" mariadb-test-run.pl: noreorder option +.\" noreorder option: mariadb-test-run.pl \fB\-\-noreorder\fR .sp Do not reorder tests to reduce number of restarts, but run them in exactly the order given\&. If a whole suite is to be run, the tests are run in alphabetical order, though similar combinations will be grouped together\&. If more than one suite is listed, the tests are run one suite at a time, in the order listed\&. @@ -1351,12 +1351,12 @@ Do not reorder tests to reduce number of restarts, but run them in exactly the o .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: notimer option -.\" notimer option: mysql-test-run.pl +.\" mariadb-test-run.pl: notimer option +.\" notimer option: mariadb-test-run.pl \fB\-\-notimer\fR .sp Cause -\fBmysqltest\fR +\fBmariadb-test\fR not to generate a timing file\&. The effect of this is that the report from each test case does not include the timing in milliseconds as it normally does\&. .RE .sp @@ -1368,8 +1368,8 @@ not to generate a timing file\&. The effect of this is that the report from each .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: nowarnings option -.\" nowarnings option: mysql-test-run.pl +.\" mariadb-test-run.pl: nowarnings option +.\" nowarnings option: mariadb-test-run.pl \fB\-\-nowarnings\fR .sp Do not look for and report errors and warning in the server logs\&. @@ -1383,8 +1383,8 @@ Do not look for and report errors and warning in the server logs\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: parallel option -.\" parallel option: mysql-test-run.pl +.\" mariadb-test-run.pl: parallel option +.\" parallel option: mariadb-test-run.pl \fB\-\-parallel={\fR\fB\fIN\fR\fR\fB|auto}\fR .sp Run tests using @@ -1403,8 +1403,8 @@ for auto\-setting of .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: port-base option -.\" port-base option: mysql-test-run.pl +.\" mariadb-test-run.pl: port-base option +.\" port-base option: mariadb-test-run.pl \fB\-\-[mtr\-]port\-base=\fR\fB\fIP\fR\fR .sp Specify base of port numbers to be used; a block of 10 will be allocated\&. @@ -1413,7 +1413,7 @@ should be divisible by 10; if it is not, it will be rounded down\&. If running w .sp If the port number is given as auto, which is also the default, -\fBmysql\-test\-run\&.pl\fR will allocate a number unique to this host\&. The value may also be given with the environment variable +\fBmariadb\-test\-run\&.pl\fR will allocate a number unique to this host\&. The value may also be given with the environment variable MTR_PORT_BASE\&. .sp If both \fB\-\-build\-thread\fR and \fB\-\-port\-base\fR are used, @@ -1429,8 +1429,8 @@ takes precedence\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: print-testcases option -.\" print-testcases option: mysql-test-run.pl +.\" mariadb-test-run.pl: print-testcases option +.\" print-testcases option: mariadb-test-run.pl \fB\-\-print\-testcases\fR .sp Do not run any tests, but print details about all tests, in the order they would have been run\&. @@ -1444,8 +1444,8 @@ Do not run any tests, but print details about all tests, in the order they would .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ps-protocol option -.\" ps-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: ps-protocol option +.\" ps-protocol option: mariadb-test-run.pl \fB\-\-ps\-protocol\fR .sp Use the binary protocol between client and server\&. @@ -1459,14 +1459,14 @@ Use the binary protocol between client and server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: record option -.\" record option: mysql-test-run.pl +.\" mariadb-test-run.pl: record option +.\" record option: mariadb-test-run.pl \fB\-\-record\fR .sp Pass the \fB\-\-record\fR option to -\fBmysqltest\fR\&. This option requires a specific test case to be named on the command line\&. +\fBmariadb-test\fR\&. This option requires a specific test case to be named on the command line\&. .RE .sp .RS 4 @@ -1477,8 +1477,8 @@ option to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: reorder option -.\" reorder option: mysql-test-run.pl +.\" mariadb-test-run.pl: reorder option +.\" reorder option: mariadb-test-run.pl \fB\-\-reorder\fR .sp Reorder tests to minimize the number of server restarts needed\&. This is the default behavior\&. There is no guarantee that a particular set of tests will always end up in the same order\&. @@ -1492,8 +1492,8 @@ Reorder tests to minimize the number of server restarts needed\&. This is the de .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: repeat option -.\" repeat option: mysql-test-run.pl +.\" mariadb-test-run.pl: repeat option +.\" repeat option: mariadb-test-run.pl \fB\-\-repeat=\fR\fB\fIN\fR\fR .sp Run each test @@ -1509,8 +1509,8 @@ number of times\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: report-features option -.\" report-features option: mysql-test-run.pl +.\" mariadb-test-run.pl: report-features option +.\" report-features option: mariadb-test-run.pl \fB\-\-report\-features\fR .sp First run a "test" that reports MariaDB features, displaying the output of SHOW ENGINES and SHOW VARIABLES\&. This can be @@ -1525,8 +1525,8 @@ used to verify that binaries are built with all required features\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: report-times option -.\" report-times option: mysql-test-run.pl +.\" mariadb-test-run.pl: report-times option +.\" report-times option: mariadb-test-run.pl \fB\-\-report\-times\fR .sp Report how much time has been spent on different phases of test execution\&. @@ -1540,8 +1540,8 @@ Report how much time has been spent on different phases of test execution\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: retry option -.\" retry option: mysql-test-run.pl +.\" mariadb-test-run.pl: retry option +.\" retry option: mariadb-test-run.pl \fB\-\-retry=\fR\fB\fIN\fR\fR .sp If a test fails, it is retried up to a maximum of @@ -1568,8 +1568,8 @@ may fail in total, as each repetition is considered a new test case, which may i .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: retry-failure option -.\" retry-failure option: mysql-test-run.pl +.\" mariadb-test-run.pl: retry-failure option +.\" retry-failure option: mariadb-test-run.pl \fB\-\-retry\-failure=\fR\fB\fIN\fR\fR .sp When using the \fB-\-retry\fR option to retry failed tests, @@ -1584,8 +1584,8 @@ stop when N failures have occurred (default 2)\&. Setting it to 0 or 1 effective .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: shutdown-timeout option -.\" shutdown-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: shutdown-timeout option +.\" shutdown-timeout option: mariadb-test-run.pl \fB\-\-shutdown\-timeout=\fR\fB\fISECONDS\fR\fR .sp Max number of seconds to wait for servers to do controlled shutdown before killing them\&. Default is 10\&. @@ -1599,8 +1599,8 @@ Max number of seconds to wait for servers to do controlled shutdown before killi .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-combinations option -.\" skip-combinations option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-combinations option +.\" skip-combinations option: mariadb-test-run.pl \fB\-\-skip\-combinations\fR .sp Do not apply combinations; ignore combinations file or option\&. @@ -1614,8 +1614,8 @@ Do not apply combinations; ignore combinations file or option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-rpl option -.\" skip-rpl option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-rpl option +.\" skip-rpl option: mariadb-test-run.pl \fB\-\-skip\-rpl\fR .sp Skip replication test cases\&. @@ -1629,12 +1629,12 @@ Skip replication test cases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-ssl option -.\" skip-ssl option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-ssl option +.\" skip-ssl option: mariadb-test-run.pl \fB\-\-skip\-ssl\fR .sp Do not start -\fBmysqld\fR +\fBmariadbd\fR with support for SSL connections\&. .RE .sp @@ -1646,8 +1646,8 @@ with support for SSL connections\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-test option -.\" skip-test option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-test option +.\" skip-test option: mariadb-test-run.pl \fB\-\-skip\-test=\fR\fB\fIregex\fR\fR|\fR\fB\fIregex\fR\fR .sp Specify a regular expression to be applied to test case names\&. Cases with names that match the expression are skipped\&. tests to skip\&. @@ -1667,8 +1667,8 @@ option for details\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-test-list option -.\" skip-test-list option: mysql-test-run.pl +.\" mariadb-test-run.pl: skip-test-list option +.\" skip-test-list option: mariadb-test-run.pl \fB\-\-skip\-test\-list=\fB\fIFILE\fR .sp Skip the tests listed in FILE\&. Each line in the file is an entry and should be formatted as: : @@ -1686,7 +1686,7 @@ Skip the tests listed in FILE\&. Each line in the file is an entry and should be .sp \fB\-\-skip\-*\fR options not otherwise recognized by -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR are passed to the master server\&. .RE .sp @@ -1698,14 +1698,14 @@ are passed to the master server\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: sleep option -.\" sleep option: mysql-test-run.pl +.\" mariadb-test-run.pl: sleep option +.\" sleep option: mariadb-test-run.pl \fB\-\-sleep=\fR\fB\fIN\fR\fR .sp Pass \fB\-\-sleep=\fR\fB\fIN\fR\fR to -\fBmysqltest\fR\&. +\fBmariadb-test\fR\&. .RE .sp .RS 4 @@ -1716,8 +1716,8 @@ to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: sp-protocol option -.\" sp-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: sp-protocol option +.\" sp-protocol option: mariadb-test-run.pl \fB\-\-sp\-protocol\fR .sp Create a stored procedure to execute all queries\&. @@ -1731,18 +1731,18 @@ Create a stored procedure to execute all queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ssl option -.\" ssl option: mysql-test-run.pl +.\" mariadb-test-run.pl: ssl option +.\" ssl option: mariadb-test-run.pl \fB\-\-ssl\fR .sp If -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR is started with the \fB\-\-ssl\fR option, it sets up a secure connection for all test cases\&. In this case, if -\fBmysqld\fR +\fBmariadbd\fR does not support SSL, -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR exits with an error message: Couldn't find support for SSL .RE @@ -1755,8 +1755,8 @@ Couldn't find support for SSL .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: staging-run option -.\" staging-run option: mysql-test-run.pl +.\" mariadb-test-run.pl: staging-run option +.\" staging-run option: mariadb-test-run.pl \fB\-\-staging\-run\fR .sp Run a limited number of tests (no slow tests)\&. Used for running staging trees with valgrind\&. @@ -1770,21 +1770,21 @@ Run a limited number of tests (no slow tests)\&. Used for running staging trees .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-and-exit option -.\" start-and-exit option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-and-exit option +.\" start-and-exit option: mariadb-test-run.pl \fB\-\-start\fR .sp Initialize and start servers with the startup settings for the specified test case\&. You can use this option to start a server to which you can connect later\&. For example, after building a source distribution you can start a server and connect to it with the -\fBmysql\fR +\fBmariadb\fR client like this: .sp .if n \{\ .RS 4 .\} .nf -shell> \fBcd mysql\-test\fR -shell> \fB\&./mysql\-test\-run\&.pl \-\-start alias &\fR -shell> \fB\&.\&./mysql \-S \&./var/tmp/master\&.sock \-h localhost \-u root\fR +shell> \fBcd mariadb\-test\fR +shell> \fB\&./mariadb\-test\-run\&.pl \-\-start alias &\fR +shell> \fB\&.\&./mariadb \-S \&./var/tmp/master\&.sock \-h localhost \-u root\fR .fi .if n \{\ .RE @@ -1794,7 +1794,7 @@ If no tests are named on the command line, the server(s) will be started with se \fB\-\-start\fR option\&. .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR will stop once the server has been started, but will terminate if the server dies\&. If killed, it will also shut down the server\&. .RE .sp @@ -1806,12 +1806,12 @@ will stop once the server has been started, but will terminate if the server die .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-and-exit option -.\" start-and-exit option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-and-exit option +.\" start-and-exit option: mariadb-test-run.pl \fB\-\-start\-and\-exit\fR .sp Same -\fB\-\-start\fR, but mysql-test-run terminates and leaves just the server running\&. +\fB\-\-start\fR, but mariadb-test-run terminates and leaves just the server running\&. .RE .sp .RS 4 @@ -1822,8 +1822,8 @@ Same .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-dirty option -.\" start-dirty option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-dirty option +.\" start-dirty option: mariadb-test-run.pl \fB\-\-start\-dirty\fR .sp This is similar to @@ -1838,11 +1838,11 @@ This is similar to .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: start-from option -.\" start-from option: mysql-test-run.pl +.\" mariadb-test-run.pl: start-from option +.\" start-from option: mariadb-test-run.pl \fB\-\-start\-from=\fR\fB\fItest_name\fR\fR .sp -\fBmysql\-test\-run\&.pl\fR +\fBmariadb\-test\-run\&.pl\fR sorts the list of names of the test cases to be run, and then begins with \fItest_name\fR\&. .RE @@ -1855,11 +1855,11 @@ sorts the list of names of the test cases to be run, and then begins with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace option -.\" strace option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace option +.\" strace option: mariadb-test-run.pl \fB\-\-strace\fR .sp -Run the "mysqld" executables using strace. Default options are \fB-f -o var/log/'mysqld-name'.strace\fR\&. +Run the "mariadbd" executables using strace. Default options are \fB-f -o var/log/'mariadbd-name'.strace\fR\&. .RE .sp .RS 4 @@ -1870,17 +1870,17 @@ Run the "mysqld" executables using strace. Default options are \fB-f -o var/log/ .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace-client option -.\" strace-client option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace-client option +.\" strace-client option: mariadb-test-run.pl \fB\-\-strace\-client\fR .sp Create \fBstrace\fR output for -\fBmysqltest\fR, optionally specifying name and path +\fBmariadb-test\fR, optionally specifying name and path to the trace program to use\&. .sp -Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace +Example: \&./mariadb\-test\-run\&.pl \-\-strace\-client=ktrace .RE .sp .RS 4 @@ -1891,8 +1891,8 @@ Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: strace-option option -.\" strace-option option: mysql-test-run.pl +.\" mariadb-test-run.pl: strace-option option +.\" strace-option option: mariadb-test-run.pl \fB\-\-strace\-option\fR=\fR\fB\fIARGS\fR\fR .sp Option to give @@ -1908,11 +1908,11 @@ replaces default option(s)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stress option -.\" stress option: mysql-test-run.pl +.\" mariadb-test-run.pl: stress option +.\" stress option: mariadb-test-run.pl \fB\-\-stress=\fR\fB\fIARGS\fR\fR .sp -Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are separated by comma\&. +Run stress test, providing options to mariadb\-stress\-test\&.pl\&. Options are separated by comma\&. .RE .sp .RS 4 @@ -1923,8 +1923,8 @@ Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are se .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: suite option -.\" suite option: mysql-test-run.pl +.\" mariadb-test-run.pl: suite option +.\" suite option: mariadb-test-run.pl \fB\-\-suite[s]=\fR\fB\fIsuite_name...\fR\fR .sp Comma separated list of suite names to run. The default is: @@ -1942,11 +1942,11 @@ plugins-,roles-,rpl-,sys_vars-,unit-,vcol-"\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stop-file option -.\" stop-file option: mysql-test-run.pl +.\" mariadb-test-run.pl: stop-file option +.\" stop-file option: mariadb-test-run.pl \fB\-\-stop\-file=\fR\fB\fIfile\fR\fR .sp -If this file is detected, mysqltest will not start new tests until the file is removed (also MTR_STOP_FILE environment variable)\&. +If this file is detected, mariadb-test will not start new tests until the file is removed (also MTR_STOP_FILE environment variable)\&. .RE .sp .RS 4 @@ -1957,11 +1957,11 @@ If this file is detected, mysqltest will not start new tests until the file is r .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: stop-keep-alive option -.\" stop-keep-alive option: mysql-test-run.pl +.\" mariadb-test-run.pl: stop-keep-alive option +.\" stop-keep-alive option: mariadb-test-run.pl \fB\-\-stop\-keep\-alive=\fR\fB\fIsec\fR\fR .sp -Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mysqltest is waiting to remove the file (for buildbot) (also MTR_STOP_KEEP_ALIVE environment variable)\&. +Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mariadb-test is waiting to remove the file (for buildbot) (also MTR_STOP_KEEP_ALIVE environment variable)\&. .RE .sp .RS 4 @@ -1972,8 +1972,8 @@ Works with \fB--stop-file\fR, print messages every \fIsec\fR seconds when mysqlt .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: suite-timeout option -.\" suite-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: suite-timeout option +.\" suite-timeout option: mariadb-test-run.pl \fB\-\-suite\-timeout=\fR\fB\fIminutes\fR\fR .sp Specify the maximum test suite runtime in minutes\&. The default is 360\&. @@ -1987,8 +1987,8 @@ Specify the maximum test suite runtime in minutes\&. The default is 360\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: testcase-timeout option -.\" testcase-timeout option: mysql-test-run.pl +.\" mariadb-test-run.pl: testcase-timeout option +.\" testcase-timeout option: mariadb-test-run.pl \fB\-\-testcase\-timeout\fR .sp Specify the maximum test case runtime in minutes\&. The default is 15\&. @@ -2002,8 +2002,8 @@ Specify the maximum test case runtime in minutes\&. The default is 15\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timediff option -.\" timediff option: mysql-test-run.pl +.\" mariadb-test-run.pl: timediff option +.\" timediff option: mariadb-test-run.pl \fB\-\-timediff\fR .sp Used with \fB\-\-timestamp\fR, also print time passed since the previous test started\&. @@ -2017,12 +2017,12 @@ Used with \fB\-\-timestamp\fR, also print time passed since the previous test st .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timer option -.\" timer option: mysql-test-run.pl +.\" mariadb-test-run.pl: timer option +.\" timer option: mariadb-test-run.pl \fB\-\-timer\fR .sp Cause -\fBmysqltest\fR +\fBmariadb-test\fR to generate a timing file\&. The default file is named \&./var/log/timer\&. .RE @@ -2035,8 +2035,8 @@ to generate a timing file\&. The default file is named .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: timestamp option -.\" timestamp option: mysql-test-run.pl +.\" mariadb-test-run.pl: timestamp option +.\" timestamp option: mariadb-test-run.pl \fB\-\-timestamp\fR .sp Prints a timestamp before the test case name in each test report line, showing when the test ended\&. @@ -2050,8 +2050,8 @@ Prints a timestamp before the test case name in each test report line, showing w .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: tmpdir option -.\" tmpdir option: mysql-test-run.pl +.\" mariadb-test-run.pl: tmpdir option +.\" tmpdir option: mariadb-test-run.pl \fB\-\-tmpdir=\fR\fB\fIpath\fR\fR .sp The directory where temporary file are stored\&. The default location is @@ -2068,8 +2068,8 @@ will be set to the path for this directory, whether it has the default value or .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: user option -.\" user option: mysql-test-run.pl +.\" mariadb-test-run.pl: user option +.\" user option: mariadb-test-run.pl \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The MariaDB user name to use when connecting to the server (default root)\&. @@ -2083,11 +2083,11 @@ The MariaDB user name to use when connecting to the server (default root)\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: user-args option -.\" user-args option: mysql-test-run.pl +.\" mariadb-test-run.pl: user-args option +.\" user-args option: mariadb-test-run.pl \fB\-\-user\-args\fR .sp -In combination with \fBstart*\fR and no test name, drops arguments to mysqld except those specified with \fB\-\-mysqld\fR (if any)\&. +In combination with \fBstart*\fR and no test name, drops arguments to mariadbd except those specified with \fB\-\-mariadbd\fR (if any)\&. .RE .sp .RS 4 @@ -2098,14 +2098,14 @@ In combination with \fBstart*\fR and no test name, drops arguments to mysqld exc .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind option -.\" valgrind option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind option +.\" valgrind option: mariadb-test-run.pl \fB\-\-valgrind[\-all]\fR .sp Run -\fBmysqltest\fR +\fBmariadb-test\fR and -\fBmysqld\fR +\fBmariadbd\fR with \fBvalgrind\fR\&. This and the following \fB\-\-valgrind\fR @@ -2122,12 +2122,12 @@ support\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-mysqld option -.\" valgrind-mysqld option: mysql-test-run.pl -\fB\-\-valgrind\-mysqld\fR +.\" mariadb-test-run.pl: valgrind-mariadbd option +.\" valgrind-mariadbd option: mariadb-test-run.pl +\fB\-\-valgrind\-mariadbd\fR .sp Run the -\fBmysqld\fR +\fBmariadbd\fR server with \fBvalgrind\fR\&. .RE @@ -2140,14 +2140,14 @@ server with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-mysqltest option -.\" valgrind-mysqltest option: mysql-test-run.pl -\fB\-\-valgrind\-mysqltest\fR +.\" mariadb-test-run.pl: valgrind-mariadb-test option +.\" valgrind-mariadb-test option: mariadb-test-run.pl +\fB\-\-valgrind\-mariadb-test\fR .sp Run the -\fBmysqltest\fR +\fBmariadb-test\fR and -\fBmysql_client_test\fR +\fBmariadb-client-test\fR executables with \fBvalgrind\fR\&. .RE @@ -2160,8 +2160,8 @@ executables with .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-options option -.\" valgrind-options option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind-options option +.\" valgrind-options option: mariadb-test-run.pl \fB\-\-valgrind\-option=\fR\fB\fIstr\fR\fR .sp Option to give \fBvalgrind\fR. Replaces default option(s)\&. Can be specified more then once&. @@ -2175,8 +2175,8 @@ Option to give \fBvalgrind\fR. Replaces default option(s)\&. Can be specified mo .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: valgrind-path option -.\" valgrind-path option: mysql-test-run.pl +.\" mariadb-test-run.pl: valgrind-path option +.\" valgrind-path option: mariadb-test-run.pl \fB\-\-valgrind\-path=\fR\fB\fIpath\fR\fR .sp Path to the @@ -2192,8 +2192,8 @@ executable\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: vardir option -.\" vardir option: mysql-test-run.pl +.\" mariadb-test-run.pl: vardir option +.\" vardir option: mariadb-test-run.pl \fB\-\-vardir=\fR\fB\fIpath\fR\fR .sp Specify the path where files generated during the test run are stored\&. The default location is @@ -2210,8 +2210,8 @@ will be set to the path for this directory, whether it has the default value or .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: verbose option -.\" verbose option: mysql-test-run.pl +.\" mariadb-test-run.pl: verbose option +.\" verbose option: mariadb-test-run.pl \fB\-\-verbose\fR .sp Give more verbose output regarding test execution\&. Use the option twice to get even more output\&. Note that the output generated within each test case is not affected\&. @@ -2225,8 +2225,8 @@ Give more verbose output regarding test execution\&. Use the option twice to get .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: verbose-restart option -.\" verbose-restart option: mysql-test-run.pl +.\" mariadb-test-run.pl: verbose-restart option +.\" verbose-restart option: mariadb-test-run.pl \fB\-\-verbose\-restart\fR .sp Write when and why servers are restarted between test cases\&. @@ -2240,8 +2240,8 @@ Write when and why servers are restarted between test cases\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: view-protocol option -.\" view-protocol option: mysql-test-run.pl +.\" mariadb-test-run.pl: view-protocol option +.\" view-protocol option: mariadb-test-run.pl \fB\-\-view\-protocol\fR .sp Create a view to execute all non updating queries\&. @@ -2255,8 +2255,8 @@ Create a view to execute all non updating queries\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: vs-config option -.\" vs-config option: mysql-test-run.pl +.\" mariadb-test-run.pl: vs-config option +.\" vs-config option: mariadb-test-run.pl \fB\-\-vs\-config=\fR\fB\fIconfig_val\fR\fR .sp Visual Studio configuration used to create executables @@ -2272,8 +2272,8 @@ This option is for Windows only\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: wait-all option -.\" wait-all option: mysql-test-run.pl +.\" mariadb-test-run.pl: wait-all option +.\" wait-all option: mariadb-test-run.pl \fB\-\-wait\-all\fR .sp If @@ -2291,8 +2291,8 @@ is used, wait for all servers to exit before termination\&. Otherwise, it will t .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: warnings option -.\" warnings option: mysql-test-run.pl +.\" mariadb-test-run.pl: warnings option +.\" warnings option: mariadb-test-run.pl \fB\-\-warnings\fR .sp Search the server log for errors or warning after each test and report any suspicious ones; if any are found, the test will be marked as failed\&. This is the default behavior, it may be turned off with @@ -2304,7 +2304,7 @@ Search the server log for errors or warning after each test and report any suspi .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2020 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql.server.1 b/man/mysql.server.1 index b3eff1dd984..5a367298724 100644 --- a/man/mysql.server.1 +++ b/man/mysql.server.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\&.SERVER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMYSQL\&.SERVER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -35,7 +35,7 @@ directory with the name mysql\&. You need not install it manually\&. .PP Some vendors provide RPM packages that install a startup script under a different name such as -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .PP If you install MariaDB from a source distribution or using a binary distribution format that does not install \fBmysql\&.server\fR @@ -45,7 +45,7 @@ automatically, you can install it manually\&. reads options from the [mysql\&.server] and -[mysqld] +[mariadbd] sections of option files\&. For backward compatibility, it also reads [mysql_server] sections, although you should rename such sections to @@ -124,12 +124,12 @@ exits with an error\&. The default value is 900\&. A value of 0 means not to wai .sp -1 .IP \(bu 2.3 .\} -.\" mysql.server: use-mysqld_safe option -.\" use-mysqld_safe option: mysql.server -\fB\-\-use\-mysqld_safe\fR +.\" mysql.server: use-mariadbd_safe option +.\" use-mariadbd_safe option: mysql.server +\fB\-\-use\-mariadbd_safe\fR .sp Use -\fBmysqld_safe\fR +\fBmariadbd_safe\fR to start the server\&. This is the default\&. .RE .sp @@ -161,12 +161,12 @@ Use Instance Manager to start the server\&. \fB\-\-user=\fR\fB\fIuser_name\fR\fR .sp The login user name to use for running -\fBmysqld\fR\&. +\fBmariadbd\fR\&. .RE .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mytop.1 b/man/mytop.1 index 6585439fce9..d1ffa9d085d 100644 --- a/man/mytop.1 +++ b/man/mytop.1 @@ -1,4 +1,4 @@ -.TH MYTOP "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH MYTOP "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .SH NAME mytop \- display MariaDB server performance info like 'top' .SH "SEE ALSO" diff --git a/man/perror.1 b/man/perror.1 index 94a4bdb3be5..581387c1839 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBPERROR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBPERROR\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -143,7 +143,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/replace.1 b/man/replace.1 index f5327815bb1..adc79e9f451 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBREPLACE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBREPLACE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -153,7 +153,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index df97e405b86..e3e473bec0e 100644 --- a/man/resolve_stack_dump.1 +++ b/man/resolve_stack_dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -37,9 +37,9 @@ shell> \fBresolve_stack_dump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIsymbols_file\f .\} .PP The symbols file should include the output from the -\fBnm \-\-numeric\-sort mysqld\fR +\fBnm \-\-numeric\-sort mariadbd\fR command\&. The numeric dump file should contain a numeric stack track from -\fBmysqld\fR\&. If no numeric dump file is named on the command line, the stack trace is read from the standard input\&. +\fBmariadbd\fR\&. If no numeric dump file is named on the command line, the stack trace is read from the standard input\&. .PP \fBresolve_stack_dump\fR supports the following options\&. @@ -110,7 +110,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolveip.1 b/man/resolveip.1 index 8abc823b24b..c21a8d034ba 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVEIP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBRESOLVEIP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -92,7 +92,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2020 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/wsrep_sst_backup.1 b/man/wsrep_sst_backup.1 index d7b145575cc..fe69d6938fd 100644 --- a/man/wsrep_sst_backup.1 +++ b/man/wsrep_sst_backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_BACKUP\FR" "1" "22 May 2022" "MariaDB 10\&.3" "MariaDB Database System" +.TH "\FBWSREP_SST_BACKUP\FR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index 9fd5122c4b4..cf9e9a03dcd 100644 --- a/man/wsrep_sst_common.1 +++ b/man/wsrep_sst_common.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_COMMON\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_COMMON\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1 index 7259b028bbc..1bc94893677 100644 --- a/man/wsrep_sst_mariabackup.1 +++ b/man/wsrep_sst_mariabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 56581ae889e..6646df59e93 100644 --- a/man/wsrep_sst_mysqldump.1 +++ b/man/wsrep_sst_mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index 155cb8ce637..fab949e1ee4 100644 --- a/man/wsrep_sst_rsync.1 +++ b/man/wsrep_sst_rsync.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1 index 3eb67b3d718..7205dbc2e0c 100644 --- a/man/wsrep_sst_rsync_wan.1 +++ b/man/wsrep_sst_rsync_wan.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 132fdcff7bd..dbbd7459b52 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -258,8 +258,10 @@ select * from t2; insert into t2 (a) values (1025); --replace_result $MYSQLTEST_VARDIR .. +--disable_cursor_protocol --error ER_DUP_ENTRY eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1; +--enable_cursor_protocol select * from t2; rollback; select * from t2; @@ -279,8 +281,10 @@ select * from t2; --echo ======================================================================= insert into t2 (a) values (1027); +--disable_cursor_protocol --error ER_DUP_ENTRY select f2(27) into @foo; +--enable_cursor_protocol select * from t2; rollback; select * from t2; diff --git a/mysql-test/include/ctype_like_range_f1f2.inc b/mysql-test/include/ctype_like_range_f1f2.inc index def341e8d5e..59f668bfbba 100644 --- a/mysql-test/include/ctype_like_range_f1f2.inc +++ b/mysql-test/include/ctype_like_range_f1f2.inc @@ -17,6 +17,8 @@ INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +#enable after fix MDEV-31512 +--disable_cursor_protocol #check after fix MDEV-29290 --disable_view_protocol # Check pattern (important for ucs2, utf16, utf32) @@ -24,5 +26,6 @@ SELECT hex(concat(repeat(0xF1F2, 10), '%')); --echo 3 rows expected SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); -DROP TABLE t1; +--enable_cursor_protocol --enable_view_protocol +DROP TABLE t1; diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index 6fb8d58276f..2546980ddc3 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1646,7 +1646,10 @@ SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol --echo # All columns must be VARCHAR(9) with the same length: diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index a566a4d79c2..331f5c18a02 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -168,7 +168,9 @@ while ($_dt_tables) --disable_ps2_protocol --let $_dt_outfile= `SELECT @@datadir` --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table + --disable_cursor_protocol eval SELECT * INTO OUTFILE '$_dt_outfile' FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list`; + --enable_cursor_protocol --enable_ps2_protocol # Compare files. diff --git a/mysql-test/include/explain_utils.inc b/mysql-test/include/explain_utils.inc index c85e0d4d288..f4cc8e6ea00 100644 --- a/mysql-test/include/explain_utils.inc +++ b/mysql-test/include/explain_utils.inc @@ -28,6 +28,7 @@ --echo # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol if ($select) { --enable_prepare_warnings --disable_query_log @@ -164,5 +165,6 @@ SHOW STATUS WHERE (Variable_name LIKE 'Sort%' OR --enable_query_log --echo +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/include/function_defaults.inc b/mysql-test/include/function_defaults.inc index e8e1059f4be..86ccb697d28 100644 --- a/mysql-test/include/function_defaults.inc +++ b/mysql-test/include/function_defaults.inc @@ -824,6 +824,7 @@ eval CREATE TABLE t2 ( i $datetime DEFAULT $current_timestamp ON UPDATE $current_timestamp NOT NULL ); +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE 't3.dat' FROM dual; @@ -833,6 +834,7 @@ FROM dual; SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.918273; @@ -931,11 +933,13 @@ remove_file $MYSQLD_DATADIR/test/t5.dat; --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.089786; +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE "file1.dat" FROM dual; SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL INTO OUTFILE "file2.dat" FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Too short row diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc index 2d4e8345392..0fccee64372 100644 --- a/mysql-test/include/grant_cache.inc +++ b/mysql-test/include/grant_cache.inc @@ -55,6 +55,7 @@ set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; --disable_ps2_protocol +--disable_cursor_protocol reset query cache; flush status; @@ -175,6 +176,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; +--enable_cursor_protocol --enable_ps2_protocol # Cleanup diff --git a/mysql-test/include/have_tlsv13.inc b/mysql-test/include/have_tlsv13.inc new file mode 100644 index 00000000000..ef897d92f97 --- /dev/null +++ b/mysql-test/include/have_tlsv13.inc @@ -0,0 +1,10 @@ +--disable_query_log +connect (ssl_connection,localhost,root,,,,,SSL); + +if (`SELECT VARIABLE_VALUE NOT LIKE 'TLSv1.3' FROM information_schema.SESSION_STATUS WHERE VARIABLE_NAME = 'ssl_version'`) { + skip Needs TLSv1.3; +} + +disconnect ssl_connection; +connection default; +--enable_query_log diff --git a/mysql-test/include/optimizer_trace_no_costs.inc b/mysql-test/include/optimizer_trace_no_costs.inc new file mode 100644 index 00000000000..540ce06e685 --- /dev/null +++ b/mysql-test/include/optimizer_trace_no_costs.inc @@ -0,0 +1,11 @@ +# Mask the cost value from any field that looks like +# "xxx_cost" : double_number +# Print the +# "xxx_cost" : "REPLACED" +# instead +--replace_regex /(_cost": )[0-9.e-]+/\1"REPLACED"/ +#--replace_regex /(_cost": )[0-9.e-]+/"REPLACED"/ +#--replace_regex /[0-9]+/BBB/ + +#--replace_regex /("r_engine_stats":) {[^}]*}/\1 REPLACED/ + diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index 2b7af82907c..9facff43ec9 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -206,6 +206,7 @@ execute full_info ; --error 1064 prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +--disable_cursor_protocol --disable_query_log select '------ select column, .. into @parm,.. ------' as test_sequence ; --enable_query_log @@ -243,6 +244,7 @@ into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 from t9 where c1= ?" ; +--enable_cursor_protocol set @my_key= 1 ; execute stmt1 using @my_key ; # get as much information about the parameters as possible diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index 9e3ca549fea..840118206f5 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -28,6 +28,7 @@ drop table if exists t1,t2,t3; set @save_query_cache_size = @@global.query_cache_size; set GLOBAL query_cache_size = 1355776; +--disable_cursor_protocol # # Without auto_commit. # @@ -86,6 +87,7 @@ show status like "Qcache_hits"; commit; show status like "Qcache_queries_in_cache"; drop table t3,t2,t1; +--enable_cursor_protocol eval CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id))$partitions_id; select count(*) from t1; @@ -128,6 +130,7 @@ connection default; # This should be 'YES'. SHOW VARIABLES LIKE 'have_query_cache'; +--disable_cursor_protocol SET GLOBAL query_cache_size = 204800; flush global status; SET @@autocommit=1; @@ -190,6 +193,7 @@ disconnect connection1; connection default; set @@global.query_cache_size = @save_query_cache_size; drop table t2; +--enable_cursor_protocol SET global query_cache_type=default; --enable_view_protocol diff --git a/mysql-test/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc index 15e8089388c..88994b20f56 100644 --- a/mysql-test/include/query_cache_partitions.inc +++ b/mysql-test/include/query_cache_partitions.inc @@ -45,9 +45,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -81,9 +83,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -118,6 +122,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol BEGIN; UPDATE `t1` SET `cool` = 1 WHERE `id` = 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; @@ -127,6 +132,7 @@ BEGIN; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; ROLLBACK; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; diff --git a/mysql-test/include/test_outfile.inc b/mysql-test/include/test_outfile.inc index e50847b67a3..af64cc6ba5f 100644 --- a/mysql-test/include/test_outfile.inc +++ b/mysql-test/include/test_outfile.inc @@ -1,3 +1,5 @@ +--disable_cursor_protocol --disable_ps2_protocol eval select "Outfile OK" into outfile "$MYSQLTEST_VARDIR/tmp/outfile.test"; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/include/type_temporal_zero_default.inc b/mysql-test/include/type_temporal_zero_default.inc index 6553bfb6d86..4cc36ad572c 100644 --- a/mysql-test/include/type_temporal_zero_default.inc +++ b/mysql-test/include/type_temporal_zero_default.inc @@ -35,7 +35,9 @@ SET sql_mode=DEFAULT; --eval INSERT INTO t1 VALUES (DEFAULT,DEFAULT); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol +--disable_cursor_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1 +--enable_cursor_protocol DELETE FROM t1; --enable_ps2_protocol SET sql_mode=TRADITIONAL; diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc index 58bdac6f09e..1579b5b21e7 100644 --- a/mysql-test/include/write_var_to_file.inc +++ b/mysql-test/include/write_var_to_file.inc @@ -46,9 +46,11 @@ if (`SELECT LENGTH(@@secure_file_priv) > 0`) --let $_wvtf_suffix= `SELECT UUID()` --let $_wvtf_tmp_file= $MYSQLTEST_VARDIR/_wvtf_$_wvtf_suffix + --disable_cursor_protocol --disable_ps2_protocol --eval SELECT '$write_var' INTO DUMPFILE '$_wvtf_tmp_file' --enable_ps2_protocol + --enable_cursor_protocol --copy_file $_wvtf_tmp_file $write_to_file --remove_file $_wvtf_tmp_file } diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index b91285cfff9..edd3dbecf88 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -971,6 +971,7 @@ while ($count) commit; --enable_query_log +--disable_cursor_protocol select index_length into @unpaked_keys_size from information_schema.tables where table_name='t1'; alter table t1 pack_keys=1; @@ -984,6 +985,7 @@ alter table t1 max_rows=100; select max_data_length into @changed_max_data_length from information_schema.tables where table_name='t1'; select (@orig_max_data_length > @changed_max_data_length); +--enable_cursor_protocol drop table t1; diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test index f3917c9018b..1271e0f13e3 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -66,11 +66,13 @@ set debug_sync= 'now SIGNAL end'; --connection con2 commit; --connection default +--disable_cursor_protocol --disable_view_protocol select variable_value into @otd from information_schema.session_status where variable_name='Opened_table_definitions'; select * from t1; select variable_value-@otd from information_schema.session_status where variable_name='Opened_table_definitions'; --enable_view_protocol +--enable_cursor_protocol --echo # long transaction and add column create or replace table t1 (a int); diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test index 95e6d732907..6f4f9fb1e1e 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -1,6 +1,8 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol select * from mysql.user where user = 'root' and host = 'localhost'; --echo # Test syntax diff --git a/mysql-test/main/analyze_stmt_slow_query_log.test b/mysql-test/main/analyze_stmt_slow_query_log.test index 268203078f8..355292e3f6a 100644 --- a/mysql-test/main/analyze_stmt_slow_query_log.test +++ b/mysql-test/main/analyze_stmt_slow_query_log.test @@ -19,9 +19,11 @@ SET @@global.slow_query_log = ON; create table t1 (a int); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +--disable_cursor_protocol --disable_ps2_protocol select * from t1 where a<3; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; let SLOW_LOG_FILE= `select @@slow_query_log_file`; diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test index 3abd8d4d482..927954216c7 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.test +++ b/mysql-test/main/auto_increment_ranges_innodb.test @@ -11,9 +11,11 @@ set default_storage_engine=innodb; # create table t1 (pk int auto_increment primary key, f varchar(20)); insert t1 (f) values ('a'), ('b'), ('c'), ('d'); +--disable_cursor_protocol --disable_ps2_protocol select null, f into outfile 'load.data' from t1 limit 1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'load.data' into table t1; insert t1 (f) values ('<==='); select * from t1; diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index 68fbc00181d..5877b049fff 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -45,9 +45,11 @@ remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql; --echo # --disable_query_log create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --source include/kill_mysqld.inc --error 1 diff --git a/mysql-test/main/bug12427262.test b/mysql-test/main/bug12427262.test index 3a5642516a8..cf365852992 100644 --- a/mysql-test/main/bug12427262.test +++ b/mysql-test/main/bug12427262.test @@ -20,6 +20,7 @@ create table t9 (c1 int); create table t10 (c1 int); --enable_warnings +--disable_cursor_protocol # Query PS to know initial read count for frm file. --enable_prepare_warnings select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME @@ -33,16 +34,19 @@ show tables; select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; show full tables; +--disable_cursor_protocol # Query PS to know read count for frm file after above query. COUNT_READ # will be incremented by 1 as FRM file will be opened for above query. select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; diff --git a/mysql-test/main/client.result b/mysql-test/main/client.result index bc3b9f64e81..86620d58bc6 100644 --- a/mysql-test/main/client.result +++ b/mysql-test/main/client.result @@ -58,5 +58,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1"); +-----------+------------+----------------------+------+ drop table t1; # -# End of 10.7 tests +# End of 10.5 tests # diff --git a/mysql-test/main/client.test b/mysql-test/main/client.test index 20df85f0807..d7249c15e75 100644 --- a/mysql-test/main/client.test +++ b/mysql-test/main/client.test @@ -42,5 +42,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1"); drop table t1; --echo # ---echo # End of 10.7 tests +--echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index 4a34a9a89ea..45df5986902 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -448,3 +448,33 @@ FOUND 2 /This connection closed normally without authentication/ in mysqld.1.err SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; # End of 10.4 tests +# +# MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +# Connection_errors_internal +# +flush status; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 0 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set @max_con.save= @@max_connections; +set global max_connections= 10; +# ERROR 1040 +# ERROR 1040 +connection default; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 2 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set global max_connections= @max_con.save; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index 41e35d48d84..b8d074260b5 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -508,3 +508,38 @@ SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +--echo # Connection_errors_internal +--echo # + +flush status; + +show global status like 'Connection_errors%'; + +set @max_con.save= @@max_connections; +set global max_connections= 10; + +--disable_result_log +--disable_query_log +--let $n= 12 +while ($n) +{ + --error 0,ER_CON_COUNT_ERROR + --connect (con$n,localhost,root) + if ($mysql_errno) { + --echo # ERROR $mysql_errno + } + --dec $n +} + +--enable_result_log +--enable_query_log +--connection default +show global status like 'Connection_errors%'; +set global max_connections= @max_con.save; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/count_distinct2.test b/mysql-test/main/count_distinct2.test index f5d16527af3..0ab8169098f 100644 --- a/mysql-test/main/count_distinct2.test +++ b/mysql-test/main/count_distinct2.test @@ -62,6 +62,7 @@ while ($1) commit; --enable_query_log +--disable_cursor_protocol flush status; select count(distinct n) from t1; show status like 'Created_tmp_disk_tables'; @@ -83,6 +84,7 @@ flush status; select count(distinct s) from t1; show status like 'Created_tmp_disk_tables'; drop table t1; +--enable_cursor_protocol --enable_ps2_protocol # End of 4.1 tests diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result index 8bd0ca88335..477d4d53bbe 100644 --- a/mysql-test/main/create_user.result +++ b/mysql-test/main/create_user.result @@ -70,3 +70,12 @@ select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time % foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 mysql_native_password N N 0.000000 drop user foo; +# End of 10.2 tests +# +# MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +# +RENAME TABLE mysql.procs_priv TO mysql.temp; +CREATE USER a IDENTIFIED WITH 'a'; +ERROR HY000: Plugin 'a' is not loaded +RENAME TABLE mysql.temp TO mysql.procs_priv; +# End of 10.5 tests diff --git a/mysql-test/main/create_user.test b/mysql-test/main/create_user.test index f04cb3e302a..ef855ed5e86 100644 --- a/mysql-test/main/create_user.test +++ b/mysql-test/main/create_user.test @@ -56,3 +56,15 @@ create user foo with MAX_QUERIES_PER_HOUR 10 MAX_USER_CONNECTIONS 40; select * from mysql.user where user like 'foo'; drop user foo; + +--echo # End of 10.2 tests + +--echo # +--echo # MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +--echo # +RENAME TABLE mysql.procs_priv TO mysql.temp; +--error ER_PLUGIN_IS_NOT_LOADED +CREATE USER a IDENTIFIED WITH 'a'; +RENAME TABLE mysql.temp TO mysql.procs_priv; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index bebf02eafd9..a56b89cf3c8 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1048,14 +1048,14 @@ drop table t1; --echo # MDEV-16473: query with CTE when no database is set --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db_mdev_16473; use db_mdev_16473; drop database db_mdev_16473; +--disable_service_connection --echo # Now no default database is set select database(); +--enable_service_connection with cte as (select 1 as a) select * from cte; @@ -1073,7 +1073,6 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a; drop database db_mdev_16473; use test; ---enable_view_protocol --echo # --echo # MDEV-17154: using parameter markers for PS within CTEs more than once @@ -1220,8 +1219,6 @@ DROP TABLE test.t; --echo # MDEV-22781: create view with CTE without default database --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db; use db; drop database db; @@ -1231,7 +1228,9 @@ insert into db1.t1 values (3),(7),(1); create view db1.v1 as with t as (select * from db1.t1) select * from t; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; prepare stmt from " @@ -1240,14 +1239,15 @@ create view db1.v1 as with t as (select * from db1.t1) select * from t; execute stmt; deallocate prepare stmt; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; drop table db1.t1; drop database db1; use test; ---enable_view_protocol --echo # --echo # MDEV-24597: CTE with union used multiple times in query diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test index 8a8b6f8a824..bdf884768da 100644 --- a/mysql-test/main/ctype_big5.test +++ b/mysql-test/main/ctype_big5.test @@ -78,9 +78,11 @@ select hex(convert(_big5 0xC84041 using ucs2)); set names big5; create table t1 (a blob); insert into t1 values (0xEE00); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'test/t1.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index f4b3b8f9e9b..0b538533feb 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -1,3 +1,4 @@ + set names binary; --source include/ctype_numconv.inc @@ -232,8 +233,11 @@ SELECT DATE_FORMAT('2004-02-02','%W'); SELECT HEX(DATE_FORMAT('2004-02-02','%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01','%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); +--enable_cursor_protocol --enable_view_protocol --echo # latin1 format, binary result @@ -241,8 +245,11 @@ SELECT DATE_FORMAT('2004-02-02',_latin1'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # Binary format, latin1 result @@ -251,8 +258,11 @@ SELECT DATE_FORMAT('2004-02-02',_binary'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # --echo # End of 10.4 tests diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result index a223bf084e9..a8e5093a224 100644 --- a/mysql-test/main/ctype_filename.result +++ b/mysql-test/main/ctype_filename.result @@ -132,6 +132,33 @@ a c @002d1 @002d1 DROP TABLE t1; SET NAMES utf8; +# +# MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +# +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(204) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +Warnings: +Note 1246 Converting column 'a' from CHAR to VARCHAR +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(205) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +DROP TABLE t1; # End of 10.5 tests # # Start of 10.9 tests diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index f74ece22931..76c7cbf136c 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -20,10 +20,13 @@ drop table com1; create table `clock$` (a int); drop table `clock$`; +# Enable after fix MDEV-31553 +--disable_cursor_protocol # Enable after fix MDEV-29295 --disable_view_protocol select convert(convert(',' using filename) using binary); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member @@ -141,6 +144,28 @@ SET NAMES utf8; --enable_ps_protocol +--echo # +--echo # MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +--echo # + +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; + +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +--error ER_TOO_BIG_FIELDLENGTH +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +DROP TABLE t1; + --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test index 5ef4d349687..2c6a233a0de 100644 --- a/mysql-test/main/ctype_gbk.test +++ b/mysql-test/main/ctype_gbk.test @@ -65,10 +65,12 @@ CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, INSERT INTO t1 VALUES (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); +--disable_cursor_protocol --enable_prepare_warnings SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; --disable_prepare_warnings +--enable_cursor_protocol DROP TABLES t1; diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index c5251f9d4b2..60a08fe97c8 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -9008,6 +9008,12 @@ CAST(_latin1 0x61FF62 AS INT) Warnings: Warning 1292 Truncated incorrect INTEGER value: 'aÿb' # +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # # diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test index 7d5fde06d36..00f43553075 100644 --- a/mysql-test/main/ctype_latin1.test +++ b/mysql-test/main/ctype_latin1.test @@ -523,6 +523,13 @@ SELECT CAST(_latin1 0x617E62 AS INT); SELECT CAST(_latin1 0x61FF62 AS INT); +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_recoding.test b/mysql-test/main/ctype_recoding.test index 9b5f74d0b93..5c25d854137 100644 --- a/mysql-test/main/ctype_recoding.test +++ b/mysql-test/main/ctype_recoding.test @@ -74,13 +74,12 @@ SHOW TABLES IN SET CHARACTER SET koi8r; DROP DATABASE ÔÅÓÔ; -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol +--disable_service_connection SET NAMES koi8r; SELECT hex('ÔÅÓÔ'); SET character_set_connection=cp1251; SELECT hex('ÔÅÓÔ'); ---enable_view_protocol +--enable_service_connection USE test; # Bug#4417 diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index e5d0daaeaba..b0b71ee8d81 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -6779,5 +6779,20 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +DROP TABLE t1; +# +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index 58b355dcd4e..d58bd762f2d 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -75,11 +75,13 @@ DROP TABLE t1; --echo # Problem # 1 (original report): wrong parsing of ucs2 data SET character_set_connection=ucs2; +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 (@b) SET a=REVERSE(@b); @@ -92,9 +94,11 @@ remove_file $MYSQLD_DATADIR/test/tmpp.txt; --disable_ps2_protocol --echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +--disable_cursor_protocol --enable_prepare_warnings SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; --disable_prepare_warnings +--enable_cursor_protocol --enable_ps2_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 @@ -1220,6 +1224,20 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; --echo # --echo # End of 10.5 tests diff --git a/mysql-test/main/ctype_utf16.test b/mysql-test/main/ctype_utf16.test index 79c24ee3754..ab0f5775ffb 100644 --- a/mysql-test/main/ctype_utf16.test +++ b/mysql-test/main/ctype_utf16.test @@ -741,6 +741,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16, s4 LONGTEXT CHARACTER SET utf16 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -751,6 +753,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf16le.test b/mysql-test/main/ctype_utf16le.test index 15fbda6b2ee..5b8e8f22e5d 100644 --- a/mysql-test/main/ctype_utf16le.test +++ b/mysql-test/main/ctype_utf16le.test @@ -703,6 +703,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16le, s4 LONGTEXT CHARACTER SET utf16le ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -713,6 +715,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 25d8be1f2b5..335dd40071e 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -3352,6 +3352,15 @@ SET NAMES utf8mb4; # End of 10.11 tests # # +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# +# End of 10.5 tests +# +# # Start of 11.4 tests # # diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index 2c448b6190b..fc939c27929 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -795,6 +795,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf32, s4 LONGTEXT CHARACTER SET utf32 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8mb4, @@character_set_results=NULL; @@ -805,6 +807,7 @@ SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -1133,8 +1136,11 @@ SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); --echo # utf8 format, utf32 result SELECT DATE_FORMAT('2004-02-02',_utf8'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_utf8'%W')); +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_utf8'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h')); +--enable_cursor_protocol --echo # utf32 format, utf8 result SET NAMES utf8; @@ -1235,6 +1241,17 @@ SET NAMES utf8mb4; --enable_service_connection + +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; + +--echo # +--echo # End of 10.5 tests +--echo # + --echo # --echo # Start of 11.4 tests --echo # diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 33791d60049..a95d98bf2ca 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -1482,8 +1482,11 @@ SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20)); SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)); #Enable view-protocol after fix MDEV-33942 --disable_view_protocol +#Enable after fix MDEV-31512 +--disable_cursor_protocol SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI @@ -1562,12 +1565,15 @@ CREATE TABLE t1 ( ); --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test index 42541b28f15..997450b2bd1 100644 --- a/mysql-test/main/ctype_utf8mb4.test +++ b/mysql-test/main/ctype_utf8mb4.test @@ -1775,12 +1775,15 @@ CREATE TABLE t1 ( s4 LONGTEXT CHARACTER SET utf8mb4 ); --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8mb4, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; @@ -1912,7 +1915,9 @@ DROP TABLE t1; SET NAMES utf8mb4; SELECT COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--disable_cursor_protocol SELECT COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--enable_cursor_protocol SELECT COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E as int); diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index 38199a5678e..061c1961f13 100644 --- a/mysql-test/main/delete.result +++ b/mysql-test/main/delete.result @@ -565,6 +565,17 @@ where t2.b*10 < sum(t3.b))); drop table t1,t2,t3; End of 10.4 tests # +# MDEV-26459: Assertion `block_size <= 0xFFFFFFFFL' failed +# in calculate_block_sizes for 10.7 only +# +SET @sort_buffer_size_save= @@sort_buffer_size; +SET sort_buffer_size=1125899906842624; +CREATE TABLE t1 (a INT,b CHAR,KEY(a,b)); +DELETE a1 FROM t1 AS a1,t1 AS a2 WHERE a1.a=a2.a; +DROP TABLE t1; +SET sort_buffer_size= @sort_buffer_size_save; +# End of 10.11 tests +# # MDEV-29428: DELETE with ORDER BY without LIMIT clause # create table t1 (c1 integer, c2 integer, c3 integer); diff --git a/mysql-test/main/delete.test b/mysql-test/main/delete.test index 6c57e35c0d5..af55fe46ecb 100644 --- a/mysql-test/main/delete.test +++ b/mysql-test/main/delete.test @@ -627,6 +627,20 @@ drop table t1,t2,t3; --echo End of 10.4 tests +--echo # +--echo # MDEV-26459: Assertion `block_size <= 0xFFFFFFFFL' failed +--echo # in calculate_block_sizes for 10.7 only +--echo # + +SET @sort_buffer_size_save= @@sort_buffer_size; +SET sort_buffer_size=1125899906842624; +CREATE TABLE t1 (a INT,b CHAR,KEY(a,b)); +DELETE a1 FROM t1 AS a1,t1 AS a2 WHERE a1.a=a2.a; +DROP TABLE t1; +SET sort_buffer_size= @sort_buffer_size_save; + +--echo # End of 10.11 tests + --echo # --echo # MDEV-29428: DELETE with ORDER BY without LIMIT clause --echo # diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 81700f0b00d..33ca7ec9343 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -868,6 +868,8 @@ INSERT INTO example1463 VALUES ('David', 'Unknown', 100); INSERT INTO example1463 VALUES ('Edward', 'Success', 150); INSERT INTO example1463 VALUES ('Edward', 'Pending', 150); +#Enable after fix MDEV-31720 +--disable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, @@ -875,6 +877,7 @@ SELECT Customer, Success, SUM(OrderSize) FROM example1463) as subQ GROUP BY Success, Customer WITH ROLLUP; +--enable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test index 1d066039ffa..49929178111 100644 --- a/mysql-test/main/derived_view.test +++ b/mysql-test/main/derived_view.test @@ -42,6 +42,7 @@ explain extended select * from (select * from t1 where f1 in (2,3)) tt join (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; explain extended @@ -51,6 +52,7 @@ flush status; select * from (select * from t1 where f1 in (2,3)) tt where f11=2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo for merged views create view v1 as select * from t1; @@ -72,12 +74,14 @@ explain extended select * from v3 join v4 on f1=f2; --disable_ps2_protocol +--disable_cursor_protocol flush status; explain extended select * from v4 where f2 in (1,3); show status like 'Handler_read%'; flush status; select * from v4 where f2 in (1,3); show status like 'Handler_read%'; +--enable_cursor_protocol --echo for materialized derived tables --echo explain for simple derived @@ -92,8 +96,10 @@ flush status; explain select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; flush status; +--disable_cursor_protocol select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo for materialized views @@ -110,6 +116,7 @@ explain extended select * from t1 join v2 on f1=f2; select * from t1 join v2 on f1=f2; explain extended select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; @@ -122,6 +129,7 @@ flush status; select * from t1 join v2 on f1=f2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol explain extended select * from v1 join v4 on f1=f2; --source include/explain-no-costs.inc @@ -168,6 +176,7 @@ join (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z on x.f1 = z.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from @@ -178,6 +187,7 @@ join show status like 'Handler_read%'; flush status; --enable_ps2_protocol +--enable_cursor_protocol --echo merged in merged derived join merged in merged derived explain extended select * from diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test index fd0d4fdf36b..fa9bf387b8f 100644 --- a/mysql-test/main/distinct.test +++ b/mysql-test/main/distinct.test @@ -460,6 +460,7 @@ INSERT INTO t1 VALUES (2,2,'APPLE'); INSERT INTO t1 VALUES (3,2,'APPLE'); INSERT INTO t1 VALUES (4,3,'PEAR'); +--disable_cursor_protocol SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = 'APPLE'; SELECT @v1, @v2; @@ -508,6 +509,7 @@ SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE --enable_ps2_protocol LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2; --remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp +--enable_cursor_protocol SELECT @v19, @v20; SELECT * FROM t2; diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test index 85638bc290b..3c6f418ccd4 100644 --- a/mysql-test/main/empty_table.test +++ b/mysql-test/main/empty_table.test @@ -6,6 +6,8 @@ drop table if exists t1; --enable_warnings +# Enable after fix MDEV-31721 +--disable_cursor_protocol create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); --disable_ps2_protocol select count(*) from t1; @@ -24,6 +26,7 @@ drop table t1; select * from t2; --enable_ps2_protocol show status like "Empty_queries"; +--enable_cursor_protocol --echo # End of 4.1 tests diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index 4bcdb54e287..d5da96b7e33 100644 --- a/mysql-test/main/explain.test +++ b/mysql-test/main/explain.test @@ -48,7 +48,9 @@ set names latin1; # # Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line) # +--disable_cursor_protocol select 3 into @v1; +--enable_cursor_protocol explain select 3 into @v1; # @@ -154,7 +156,9 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INT not null); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; # EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE. diff --git a/mysql-test/main/features.test b/mysql-test/main/features.test index bd6bc22b02f..9d9c3de3c4f 100644 --- a/mysql-test/main/features.test +++ b/mysql-test/main/features.test @@ -156,12 +156,14 @@ show status like "feature_insert_returning"; --echo # create table t1(id1 int); insert into t1 values (1),(2); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile '../../tmp/features_outfile.1' from t1; select * from t1 into outfile '../../tmp/features_outfile.2'; --enable_ps2_protocol select id1 INTO @x from t1 where id1=1; select * from t1 where id1=1 into @y; +--enable_cursor_protocol select * from t1 where id1=@x; select @x=@y; drop table t1; diff --git a/mysql-test/main/flush_ssl.test b/mysql-test/main/flush_ssl.test index e7bd57b156a..c8be2896815 100644 --- a/mysql-test/main/flush_ssl.test +++ b/mysql-test/main/flush_ssl.test @@ -23,7 +23,9 @@ let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; --source include/start_mysqld.inc connect ssl_con,localhost,root,,,,,SSL; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +--enable_cursor_protocol let $ssl_not_after=`SELECT @ssl_not_after`; remove_file $ssl_cert; diff --git a/mysql-test/main/func_analyse.test b/mysql-test/main/func_analyse.test index 8a774485a65..86b5ac36004 100644 --- a/mysql-test/main/func_analyse.test +++ b/mysql-test/main/func_analyse.test @@ -24,7 +24,10 @@ EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); create table t1 (v varchar(128)) charset=latin1; insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd'); +#Enable after fix MDEV-31538 +--disable_cursor_protocol select * from t1 procedure analyse(); +--enable_cursor_protocol drop table t1; #decimal-related test diff --git a/mysql-test/main/func_des_encrypt.test b/mysql-test/main/func_des_encrypt.test index 20e2196f45f..20f4c46fbf5 100644 --- a/mysql-test/main/func_des_encrypt.test +++ b/mysql-test/main/func_des_encrypt.test @@ -56,7 +56,13 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT t1 VALUES (1),(2); +# There is a problem with cursor-protocol and DES_DECRYPT(), +# but DES_DECRYPT has been deprecated from MariaDB 10.10.0, +# and will be removed in a future release. That's why this +# case is excluded without bug +--disable_cursor_protocol SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/func_digest.test b/mysql-test/main/func_digest.test index afc3941e1b3..9043f6534b9 100644 --- a/mysql-test/main/func_digest.test +++ b/mysql-test/main/func_digest.test @@ -489,6 +489,8 @@ SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; --echo # Bug#54661 sha2() returns BINARY result --echo # +#Check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES binary; @@ -499,6 +501,7 @@ SET NAMES latin1; SELECT sha2('1',224); --disable_metadata --disable_view_protocol +--enable_cursor_protocol --echo # --echo # Start of 10.1 tests diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result index fe2757cf027..142d5176fc2 100644 --- a/mysql-test/main/func_extract.result +++ b/mysql-test/main/func_extract.result @@ -1470,5 +1470,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; # +# MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +# +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); +EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1') +NULL +Warnings: +Warning 1292 Incorrect interval value: '42949672955000x1' +# # End of 10.5 tests # diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test index dd808443f58..6167780b9bf 100644 --- a/mysql-test/main/func_extract.test +++ b/mysql-test/main/func_extract.test @@ -511,6 +511,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; +--echo # +--echo # MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +--echo # + +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index 09703db334a..5694c245033 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -409,11 +409,14 @@ drop table t1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # End of 4.1 tests @@ -499,11 +502,14 @@ set names latin1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test index 039867f9bcb..ba0ebbfd8cf 100644 --- a/mysql-test/main/func_group.test +++ b/mysql-test/main/func_group.test @@ -1,9 +1,9 @@ # # simple test of all group functions # -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } set @sav_dpi= @@div_precision_increment; diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 3b885ae6c1b..18263b26fcb 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -170,8 +170,10 @@ DROP TABLE t1; --echo # MDEV-4269: crash when grouping by values() --echo # +--disable_cursor_protocol SELECT @@default_storage_engine INTO @old_engine; set default_storage_engine=innodb; +--enable_cursor_protocol create table y select 1 b; select 1 from y group by b; diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 7595fc0de4c..230a2b5c480 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1775,6 +1775,15 @@ JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, {"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"} DROP TABLE t; # +# MDEV-27412: JSON_TABLE doesn't properly unquote strings +# +SET @data = '[{"Data": ""}]'; +SELECT +data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; +data + +# # End of 10.6 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 9c58338488d..16a7a578e36 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -26,7 +26,10 @@ select json_array(1); --disable_view_protocol select json_array(1, "text", false, null); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('["a", "b"]', '$', FALSE); +--enable_cursor_protocol --enable_view_protocol select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); @@ -89,12 +92,18 @@ select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp; select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp; select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp; +--enable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; +--enable_cursor_protocol select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp; @@ -136,11 +145,14 @@ select json_merge('a','b'); select json_merge('{"a":"b"}','{"c":"d"}'); SELECT JSON_MERGE('[1, 2]', '{"id": 47}'); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_type('{"k1":123, "k2":345}'); select json_type('[123, "k2", 345]'); select json_type("true"); select json_type('123'); select json_type('123.12'); +--enable_cursor_protocol select json_keys('{"a":{"c":1, "d":2}, "b":2}'); select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); @@ -168,15 +180,20 @@ insert into t1 values select json_search( json_col, 'all', 'foot' ) as ex from t1; drop table t1; - +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote('"abc"'); select json_unquote('abc'); +--enable_cursor_protocol + # # MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument. # create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1; insert into t1 values ('abc'),('def'); - + +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1; select json_unquote(json_object('bar', c)) as c1 from t1; select @@ -188,11 +205,15 @@ from t1 limit 1; create table t2 as select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1 limit 0; show create table t2; drop table t2; +--enable_cursor_protocol drop table t1; select json_object("a", json_object("b", "abcd")); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object("a", '{"b": "abcd"}'); +--enable_cursor_protocol select json_object("a", json_compact('{"b": "abcd"}')); select json_compact(NULL); @@ -269,8 +290,11 @@ select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ; select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ; select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +--enable_cursor_protocol # # MDEV-11856 json_search doesn't search for values with double quotes character (") @@ -465,9 +489,12 @@ drop table t1; --echo # MDEV-16750 JSON_SET mishandles unicode every second pair of arguments. --echo # +#enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp; +--enable_cursor_protocol --echo # --echo # MDEV-17121 JSON_ARRAY_APPEND @@ -1044,12 +1071,15 @@ create table t1 (a varchar(254)); insert into t1 values (concat('x64-', repeat('a', 60))); insert into t1 values (concat('x64-', repeat('b', 60))); insert into t1 values (concat('x64-', repeat('c', 60))); +#enable after fix MDEV-31554 +--disable_cursor_protocol #enable after MDEV-32454 fix --disable_view_protocol --disable_ps2_protocol select json_arrayagg(a) from t1; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t1; SET group_concat_max_len= default; @@ -1201,6 +1231,18 @@ SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_I SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t; DROP TABLE t; + +--echo # +--echo # MDEV-27412: JSON_TABLE doesn't properly unquote strings +--echo # + + +SET @data = '[{"Data": ""}]'; + +SELECT + data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; + --echo # --echo # End of 10.6 tests --echo # @@ -3888,10 +3930,13 @@ FROM JSON_TABLE( SELECT JSON_KEY_VALUE('{}', '$.key1'); +#enable after fix MDEV-31554 +--disable_cursor_protocol #enable after MDEV-32454 fix --disable_view_protocol SELECT JSON_KEY_VALUE('{"key1":"val1", "key2":"val2"}', '$') as exp; --enable_view_protocol +--enable_cursor_protocol SELECT jt.* FROM JSON_TABLE( JSON_KEY_VALUE('{"key1":"val1", "key2":"val2"}', '$'), '$[*]' @@ -4091,7 +4136,10 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES('[1,2,3]', '[2, 3, 4]'), ('[2 ,3, 4]', '[4, 5, 6]'); +#check after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY_INTERSECT(c1, c2) FROM t1; +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index b32a1a4634b..634511f54fa 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -567,11 +567,14 @@ select (1.175494351E-37 div 1.7976931348623157E+308); select round(999999999, -9); select round(999999999.0, -9); +#enable after fix MDEV-31555 +--disable_cursor_protocol #enable after fix MDEV-29526 --disable_view_protocol select round(999999999999999999, -18); select round(999999999999999999.0, -18); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#12537160 ASSERTION FAILED: diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index 34186db6cf9..709de4461bd 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -254,6 +254,7 @@ SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; # # Bug #35848: UUID() returns UUIDs with the wrong time # +--disable_cursor_protocol select @@session.time_zone into @save_tz; # make sure all times are UTC so the DayNr won't differ @@ -265,6 +266,7 @@ select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day; select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate; select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date; select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic; +--enable_cursor_protocol # these should be identical; date part of UUID should be current date select @my_uuid_date - @my_uuid_synthetic; diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 678c785d358..7597b09ba72 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5317,6 +5317,19 @@ SELECT SUBSTR(0,@a) FROM t; SUBSTR(0,@a) DROP TABLE t; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +SELECT BIN(c) FROM t1; +BIN(c) +1000000000000000000000000000000000000000000000000000000000000000 +DROP TABLE t1; +DO OCT(-9223372036854775808); +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 45ee892a29f..dcb0bb9c7a6 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -95,9 +95,12 @@ SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),r select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c'); --disable_view_protocol +#chaeck after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select replace('aaaa','a','bbbb'); --disable_metadata +--enable_cursor_protocol --enable_view_protocol select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') as exp; select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); @@ -148,7 +151,10 @@ select length(unhex(md5("abrakadabra"))); # # Bug #6564: QUOTE(NULL # +#enable after fix MDEV-31587 +--disable_cursor_protocol select concat('a', quote(NULL)); +--enable_cursor_protocol # # Wrong usage of functions @@ -747,8 +753,11 @@ create table t1 (i int); insert into t1 values (1000000000),(1); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select lpad(i, 7, ' ') as t from t1; select rpad(i, 7, ' ') as t from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -899,6 +908,8 @@ select format(NULL, NULL); select format(pi(), NULL); select format(NULL, 2); +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(NULL, NULL); @@ -906,16 +917,20 @@ select benchmark(0, NULL); select benchmark(100, NULL); select benchmark(NULL, 1+1); --enable_view_protocol +--enable_cursor_protocol # # Bug #20752: BENCHMARK with many iterations returns too quickly # # not a string, but belongs with the above Bug#22684 +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(-1, 1); --enable_view_protocol +--enable_cursor_protocol # # Please note: # 1) The collation of the password is irrelevant, the encryption uses @@ -983,26 +998,26 @@ select left('hello', -1); select left('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 4294967295); ---enable_view_protocol select left('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967296); ---enable_view_protocol select left('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select left('hello', -18446744073709551615); select left('hello', 18446744073709551615); select left('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 18446744073709551616); select left('hello', -18446744073709551617); select left('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select right('hello', 10); @@ -1011,26 +1026,26 @@ select right('hello', -1); select right('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 4294967295); ---enable_view_protocol select right('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967296); ---enable_view_protocol select right('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select right('hello', -18446744073709551615); select right('hello', 18446744073709551615); select right('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 18446744073709551616); select right('hello', -18446744073709551617); select right('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', 2, -1); @@ -1055,6 +1070,8 @@ select substring('hello', 18446744073709551617, 1); #enable after fix MDEV-28652 --disable_view_protocol select substring('hello', 1, -1); +#check after fix MDEV-31587 +--disable_cursor_protocol select substring('hello', 1, -4294967295); select substring('hello', 1, 4294967295); select substring('hello', 1, -4294967296); @@ -1070,6 +1087,7 @@ select substring('hello', 1, -18446744073709551616); select substring('hello', 1, 18446744073709551616); select substring('hello', 1, -18446744073709551617); select substring('hello', 1, 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', -1, -1); select substring('hello', -4294967295, -4294967295); @@ -1401,7 +1419,10 @@ create table t1(a float); insert into t1 values (1.33); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select format(a, 2) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -1516,9 +1537,11 @@ SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); --echo # CREATE TABLE t1 ( a TEXT ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt'; --enable_ps2_protocol +--enable_cursor_protocol SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1; @@ -1601,11 +1624,17 @@ SELECT format(12345678901234567890.123, 3, 'ar_AE'); SELECT format(12345678901234567890.123, 3, 'ar_SA'); SELECT format(12345678901234567890.123, 3, 'be_BY'); SELECT format(12345678901234567890.123, 3, 'de_DE'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'en_IN'); SELECT format(12345678901234567890.123, 3, 'en_US'); +--enable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'it_CH'); SELECT format(12345678901234567890.123, 3, 'ru_RU'); +#checkafter fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'ta_IN'); +--enable_cursor_protocol CREATE TABLE t1 (fmt CHAR(5) NOT NULL); INSERT INTO t1 VALUES ('ar_AE'); @@ -1617,6 +1646,8 @@ INSERT INTO t1 VALUES ('en_US'); INSERT INTO t1 VALUES ('it_CH'); INSERT INTO t1 VALUES ('ru_RU'); INSERT INTO t1 VALUES ('ta_IN'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; @@ -1624,6 +1655,7 @@ SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +--enable_cursor_protocol DROP TABLE t1; SELECT format(123, 1, 'Non-existent-locale'); @@ -2068,7 +2100,10 @@ DROP TABLE t1; --disable_view_protocol CREATE TABLE t1 (a INT, b TIME, c TIME); INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +--enable_cursor_protocol DROP TABLE t1; --enable_view_protocol @@ -2329,6 +2364,19 @@ CREATE TABLE t (c1 INT,c2 CHAR); SELECT SUBSTR(0,@a) FROM t; DROP TABLE t; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +SELECT BIN(c) FROM t1; +DROP TABLE t1; + +DO OCT(-9223372036854775808); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index ba9da20264e..d989380b967 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6395,6 +6395,17 @@ Warning 1292 Truncated incorrect time value: '8390000' Warning 1292 Truncated incorrect time value: '8390000' SET @@timestamp= DEFAULT; # +# MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +# +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +a +NULL +SET @@time_zone=DEFAULT; +DROP TABLE t1; +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 99f1820e9f6..f4478079a34 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -1288,7 +1288,10 @@ SET TIME_ZONE='+02:00'; --echo # CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 AS f2 FROM t1; +--enable_cursor_protocol SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0; DROP TABLE t1; @@ -1602,7 +1605,10 @@ SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DAT --echo # --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -2235,12 +2241,14 @@ SET @sav_slow_query_log= @@session.slow_query_log; --disable_ps2_protocol # @@slow_query_log ON check SET @@session.slow_query_log= ON; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @ts_func; --enable_ps2_protocol --enable_prepare_warnings SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -2252,12 +2260,13 @@ DELETE FROM t_trig; --disable_ps2_protocol # @@slow_query_log OFF check SET @@session.slow_query_log= OFF; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @func_ts; --enable_ps2_protocol SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; --disable_prepare_warnings - +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -3193,7 +3202,10 @@ SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); #enable after fix MDEV-29534 --disable_view_protocol SET time_zone='+00:00'; +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); +--enable_cursor_protocol SET time_zone=DEFAULT; --enable_view_protocol @@ -3246,6 +3258,17 @@ SELECT SET @@timestamp= DEFAULT; +--echo # +--echo # MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +--echo # + +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +SET @@time_zone=DEFAULT; +DROP TABLE t1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test index 4c3cb004000..050fcf6039c 100644 --- a/mysql-test/main/func_time_round.test +++ b/mysql-test/main/func_time_round.test @@ -181,7 +181,10 @@ SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; @@ -219,7 +222,10 @@ SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index 27c98069384..349b9e4c835 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -284,6 +284,7 @@ GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN; +--disable_cursor_protocol # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; @@ -303,6 +304,7 @@ GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN; # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol DELIMITER |; CREATE PROCEDURE p1() @@ -367,7 +369,9 @@ GET DIAGNOSTICS @var = NUMBER; SELECT @var; --enable_view_protocol +--disable_cursor_protocol SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol GET DIAGNOSTICS @var = NUMBER; SELECT @var; diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index fbfdb20fd7f..aef729161a9 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -403,9 +403,12 @@ select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as e --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol create table t1 (g GEOMETRY); select * from t1; select asbinary(g) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -3245,6 +3248,8 @@ CREATE TABLE t1 ( g GEOMETRY ) CHARACTER SET utf8; +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT * FROM t1; @@ -3350,6 +3355,7 @@ FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index 52f2f78bfe1..3779047124a 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -10,7 +10,9 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol connect (master,localhost,root,,); connection master; diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index 8f1402c283c..287aaebbbe6 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -4,7 +4,10 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol + set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -657,8 +660,10 @@ DROP DATABASE db1; # work out who we are. USE mysql; +--disable_cursor_protocol SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; +--enable_cursor_protocol # show current privs. SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; @@ -840,9 +845,11 @@ SHOW CREATE TABLE t1; --echo # INSERT INTO t1 VALUES (1), (2), (3); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' INTO TABLE t1 --remove_file $MYSQLTEST_VARDIR/tmp/bug27480.txt diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 8ee42e0f6e0..4d79ddaf5ad 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -21,7 +21,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -43,7 +46,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata diff --git a/mysql-test/main/greedy_optimizer.test b/mysql-test/main/greedy_optimizer.test index 2d14c79e721..524fb4ffde2 100644 --- a/mysql-test/main/greedy_optimizer.test +++ b/mysql-test/main/greedy_optimizer.test @@ -424,6 +424,7 @@ EXPLAIN SELECT * FROM t100,t10000,t10; EXPLAIN SELECT * FROM t10000,t10,t100; EXPLAIN SELECT * FROM t10000,t100,t10; +--disable_cursor_protocol ###### ## Ordering between T100,T10000 EQ-joined T10 will ## normally be with smallest EQ-table joined first @@ -715,6 +716,7 @@ SELECT COUNT(*) FROM t10,t10000 y,t10000 x WHERE x.k=t10.i AND y.i=x.k; --source include/check_qep.inc +--enable_cursor_protocol ######## diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index aaa954c5e30..385b3af6077 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -286,6 +286,7 @@ drop table t1; CREATE TABLE t1 (a char(1)); INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -294,11 +295,13 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol # Do the same tests with on-disk temporary tables set tmp_memory_table_size=0; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -307,6 +310,7 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol @@ -1676,7 +1680,7 @@ DROP TABLE t1, t2; # an additional util connection and other statistics data --disable_ps2_protocol --disable_view_protocol - +--disable_cursor_protocol FLUSH STATUS; # this test case *must* use Aria temp tables CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob); @@ -1686,6 +1690,7 @@ DROP TABLE t1; --echo the value below *must* be 1 show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index 12ae923599e..26661a2282c 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -1734,6 +1734,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1741,6 +1743,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1772,6 +1775,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1779,6 +1784,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; @@ -1905,6 +1911,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1912,6 +1920,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1943,6 +1952,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1950,6 +1961,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; diff --git a/mysql-test/main/handler_read_last.test b/mysql-test/main/handler_read_last.test index 390d5f092fc..56e0b091e67 100644 --- a/mysql-test/main/handler_read_last.test +++ b/mysql-test/main/handler_read_last.test @@ -9,6 +9,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT, INDEX (a)); INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a FROM t1 ORDER BY a LIMIT 1; @@ -26,6 +27,7 @@ FLUSH STATUS; SELECT a FROM t1 ORDER BY a DESC LIMIT 3; SHOW STATUS LIKE 'HANDLER_READ%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index ba11be710f1..f94fb237bb7 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -6293,4 +6293,14 @@ HAVING (SELECT MAX(b) FROM t1) = a AND a > b; a b 2 1 DROP TABLE t1; +# +# MDEV-25084: Moving equality with constant right side +# from HAVING to WHERE +# (fixed by the patch for MDEV-26402) +# +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +f a +DROP TABLE t1; End of 10.5 tests diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test index 78371a32e70..58a05a159cb 100644 --- a/mysql-test/main/having_cond_pushdown.test +++ b/mysql-test/main/having_cond_pushdown.test @@ -1738,4 +1738,16 @@ eval $q; DROP TABLE t1; + +--echo # +--echo # MDEV-25084: Moving equality with constant right side +--echo # from HAVING to WHERE +--echo # (fixed by the patch for MDEV-26402) +--echo # + +CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis; +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a; +DROP TABLE t1; + --echo End of 10.5 tests diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index 6af64189ce1..d3c9803b18c 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -1812,14 +1812,18 @@ drop database mysqltest; --disable_result_log SELECT * FROM INFORMATION_SCHEMA.TABLES; --enable_result_log +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --disable_result_log SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES; --enable_result_log --echo # The below SELECT query should give same output as above SELECT query. +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --echo # The below select should return '1' SELECT @val1 = @val2; diff --git a/mysql-test/main/information_schema_parameters.test b/mysql-test/main/information_schema_parameters.test index 72b7f2da803..2073730f556 100644 --- a/mysql-test/main/information_schema_parameters.test +++ b/mysql-test/main/information_schema_parameters.test @@ -297,10 +297,12 @@ CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) --echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, --echo # but we will use SPECIFIC_NAME for filtering records from mysql.proc FLUSH STATUS; +--disable_cursor_protocol --disable_ps2_protocol query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'test_func5'; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $count_routines count_routines SHOW STATUS LIKE 'handler_read%next'; @@ -308,6 +310,7 @@ SHOW STATUS LIKE 'handler_read%next'; --echo # We cannot use the index due to CONCAT(), and filtering by SPECIFIC_NAME --echo # does not work either since SPECIFIC_NAME = 'not_existing_proc'. See --echo # the difference in counters in comparison to the previous test +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS @@ -342,6 +345,7 @@ query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS AND SPECIFIC_NAME = 'процедурка'; SHOW STATUS LIKE 'handler_read%next'; --enable_ps2_protocol +--enable_cursor_protocol --replace_column 1 # SELECT COUNT(*) FROM information_schema.PARAMETERS diff --git a/mysql-test/main/information_schema_routines.test b/mysql-test/main/information_schema_routines.test index 2509f644b76..4a67499561b 100644 --- a/mysql-test/main/information_schema_routines.test +++ b/mysql-test/main/information_schema_routines.test @@ -270,11 +270,13 @@ CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) --echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, --echo # but we will use ROUTINE_NAME for filtering records from mysql.proc FLUSH STATUS; +--disable_cursor_protocol --disable_ps2_protocol --replace_column 24 25 query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'test_func5'; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $count_routines count_routines SHOW STATUS LIKE 'handler_read%next'; @@ -282,6 +284,7 @@ SHOW STATUS LIKE 'handler_read%next'; --echo # We cannot use the index due to CONCAT(), and filtering by ROUTINE_NAME --echo # does not work either since ROUTINE_NAME = 'not_existing_proc'. See --echo # the difference in counters in comparison to the previous test +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES @@ -320,6 +323,7 @@ query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES AND ROUTINE_NAME = 'процедурка'; SHOW STATUS LIKE 'handler_read%next'; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Test SHOW PROCEDURE STATUS. It's impossible to use the index here diff --git a/mysql-test/main/init_file.test b/mysql-test/main/init_file.test index 65e54db43ea..57acf7ce6e2 100644 --- a/mysql-test/main/init_file.test +++ b/mysql-test/main/init_file.test @@ -10,8 +10,10 @@ # Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time # INSERT INTO init_file.startup VALUES ( NOW() ); +--disable_cursor_protocol SELECT * INTO @X FROM init_file.startup limit 0,1; SELECT * INTO @Y FROM init_file.startup limit 1,1; +--enable_cursor_protocol SELECT YEAR(@X)-YEAR(@Y); --echo ok diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index 2c69c82500c..b9ab1636dca 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -30,6 +30,7 @@ ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS() INDEXES(); --enable_result_log --enable_query_log +--disable_cursor_protocol --disable_ps2_protocol explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; @@ -154,6 +155,7 @@ select o_orderkey, p_partkey and o_orderkey=l_orderkey and p_partkey=l_partkey; show /*d*/ status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug mdev-3851: ref access used instead of expected eq_ref access @@ -328,7 +330,9 @@ from t1 A, t1 B; explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; +--disable_cursor_protocol select * from t1, t2 where t2.a=t1.a and t2.b < 2; +--enable_cursor_protocol show /*e*/ status like 'handler_read%'; --enable_ps2_protocol diff --git a/mysql-test/main/insert.test b/mysql-test/main/insert.test index 0a1e63765a4..4b5a5181f09 100644 --- a/mysql-test/main/insert.test +++ b/mysql-test/main/insert.test @@ -596,9 +596,11 @@ CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as REPLACE INTO v1 SET f2 = 1; SELECT * from t1; drop view v1; +--disable_cursor_protocol --disable_ps2_protocol SELECT 0,0 INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION; --error ER_TRUNCATED_WRONG_VALUE LOAD DATA INFILE 't1.txt' INTO TABLE v1; diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test index 8e11981cc02..ef3114b37f0 100644 --- a/mysql-test/main/invisible_field.test +++ b/mysql-test/main/invisible_field.test @@ -251,10 +251,12 @@ DROP TABLE t1; create or replace table t1 (a int, b int invisible); insert into t1 values (1),(2); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol select * from t1 into outfile 'f'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'f' into table t1; select a,b from t1; load data infile 'f' into table t1 (a,@v) SET b=@v; @@ -264,9 +266,11 @@ select a,b from t1; truncate table t1; insert into t1(a,b) values (1,1),(2,2); +--disable_cursor_protocol --disable_ps2_protocol select a,b from t1 into outfile 'a'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'a' into table t1(a,b); select a,b from t1; load data infile 'a' into table t1 (a,@v) SET b=@v; diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index 73479f0fb92..0a1a60cc405 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -3508,6 +3508,74 @@ SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp; DROP TABLE t1,t2; # End of 10.6 tests # +# MDEV-34894: Poor query plan, because range estimates are not reused for ref(const) +# +create table t0 ( +a int, +b int, +dummy int +); +insert into t0 select seq,seq,seq from seq_1_to_10; +create table t1 ( +pk1 int, +pk2 int, +pk3 int, +key1 int, +key(key1), +filler char(100), +primary key(pk1,pk2,pk3) +); +insert into t1 +select +seq, seq, seq, +FLOOR(seq/2), +'filler-data' +from seq_1_to_10000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +update t1 set pk1=1 where pk1 between 1 and 200; +explain select * from t1 where pk1=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 231 +explain select * from t0,t1 where t1.pk1=t0.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t0.a 1 +create table t2 ( +col int +); +insert into t2 select seq from seq_1_to_10000; +# This must use this good query plan: +# t0 - ALL +# t1 - ref, key=key1, not PRIMARY as pk1=1 is true for 20% of all rows +# t2 - ALL +explain select * from t0, t1, t2 +where +t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and +t1.key1=t0.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 ref PRIMARY,key1 key1 5 test.t0.b 1 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using where; Using join buffer (flat, BNL join) +drop table t0,t1,t2; +CREATE OR REPLACE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT, key(a,b,c)) ENGINE=Aria; +INSERT INTO t1 select seq/10,mod(seq,2),seq from seq_1_to_1000; +update t1 set a=10 WHERE c < 100; +update t1 set a=12 WHERE a=11; +insert into t1 values (11,1,11), (11,2,11); +create or replace table t2 select seq from seq_1_to_10; +explain select count(*) from t1, t2 as seq where a=10 and b=seq.seq; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE seq ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 ref a a 8 const,test.seq.seq 5 Using where; Using index +explain select count(*) from t1, t2 as seq where a=11 and b=seq.seq; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 4 const 2 Using index +1 SIMPLE seq ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +drop table t1,t2; +# # MDEV-30256 Wrong result (missing rows) upon join with empty table # CREATE TABLE t1 (a INT); diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index 7a8c6a09732..1bdc686c2c3 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -658,6 +658,7 @@ insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t3 (a int not null, primary key(a)); insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +--disable_cursor_protocol flush status; --disable_ps2_protocol select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; @@ -665,6 +666,7 @@ select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; --echo We expect rnd_next=5, and read_key must be 0 because of short-cutting: show status like 'Handler_read%'; +--enable_cursor_protocol drop table t1, t2, t3; # @@ -960,6 +962,7 @@ INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), (8,'dd'),(9,'e'),(10,'ee'); INSERT INTO t2 VALUES (2,NULL); ANALYZE TABLE t1,t2; +--disable_cursor_protocol # This will ensure that status tables are read now and not part of the later # Handler_read% counts explain SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; @@ -968,6 +971,7 @@ FLUSH STATUS; SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; --enable_ps2_protocol SHOW STATUS LIKE 'Handler_read_%'; +--enable_cursor_protocol DROP TABLE t1, t2; --echo End of 5.1 tests @@ -1909,6 +1913,70 @@ SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp; DROP TABLE t1,t2; --echo # End of 10.6 tests +--source include/have_sequence.inc + +--echo # +--echo # MDEV-34894: Poor query plan, because range estimates are not reused for ref(const) +--echo # +create table t0 ( + a int, + b int, + dummy int +); +insert into t0 select seq,seq,seq from seq_1_to_10; + +create table t1 ( + pk1 int, + pk2 int, + pk3 int, + key1 int, + key(key1), + filler char(100), + primary key(pk1,pk2,pk3) +); + +insert into t1 +select + seq, seq, seq, + FLOOR(seq/2), + 'filler-data' +from seq_1_to_10000; +analyze table t1; + +update t1 set pk1=1 where pk1 between 1 and 200; + +explain select * from t1 where pk1=1; + +explain select * from t0,t1 where t1.pk1=t0.a; + +create table t2 ( + col int +); +insert into t2 select seq from seq_1_to_10000; + +--echo # This must use this good query plan: +--echo # t0 - ALL +--echo # t1 - ref, key=key1, not PRIMARY as pk1=1 is true for 20% of all rows +--echo # t2 - ALL +explain select * from t0, t1, t2 +where + t1.pk1=1 and t1.pk2=t2.col and t1.pk3=t0.dummy and + t1.key1=t0.b; + +drop table t0,t1,t2; + +CREATE OR REPLACE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT, key(a,b,c)) ENGINE=Aria; +INSERT INTO t1 select seq/10,mod(seq,2),seq from seq_1_to_1000; +update t1 set a=10 WHERE c < 100; +update t1 set a=12 WHERE a=11; +insert into t1 values (11,1,11), (11,2,11); +create or replace table t2 select seq from seq_1_to_10; + +explain select count(*) from t1, t2 as seq where a=10 and b=seq.seq; +# This will execute code in ReuseRangeEstimateForRef-4 +explain select count(*) from t1, t2 as seq where a=11 and b=seq.seq; +drop table t1,t2; + --echo # --echo # MDEV-30256 Wrong result (missing rows) upon join with empty table --echo # diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index a9292abd5bb..4f3121955b9 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -885,9 +885,11 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; +--disable_cursor_protocol flush status; SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; show status like 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1,t2; --enable_ps2_protocol @@ -1371,7 +1373,6 @@ drop table t1,t2,t3,t4; --echo # table is used in the on condition of an outer join --echo # --disable_ps2_protocol ---disable_view_protocol create table t1 (a int); insert into t1 values (NULL), (NULL), (NULL), (NULL); insert into t1 select * from t1; @@ -1403,16 +1404,18 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101); insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101); analyze table t1,t2,t3; - +--disable_view_protocol +--disable_cursor_protocol flush status; select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null; show status like "handler_read%"; flush status; select sum(t3.b) from t2 left join t3 on t3.a=t2.a and t2.a <> 10; show status like "handler_read%"; +--enable_cursor_protocol +--enable_view_protocol drop table t1,t2,t3; ---enable_view_protocol --enable_ps2_protocol --echo # diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result index fe15cc9e347..b1ea176c4d9 100644 --- a/mysql-test/main/join_outer_innodb.result +++ b/mysql-test/main/join_outer_innodb.result @@ -447,9 +447,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 -1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 3 Using index +1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where -1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 3 Using index +1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index 1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where @@ -469,9 +469,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 -1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 3 Using index +1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where -1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 3 Using index +1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index 1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where diff --git a/mysql-test/main/key_cache.test b/mysql-test/main/key_cache.test index 41acc363919..b03722fd0e9 100644 --- a/mysql-test/main/key_cache.test +++ b/mysql-test/main/key_cache.test @@ -306,7 +306,9 @@ update t1 set p=3 where p=1; set statement optimizer_scan_setup_cost=0 for update t2 set i=2 where i=1; select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +--disable_cursor_protocol select variable_value into @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; +--enable_cursor_protocol --replace_column 7 # select * from information_schema.key_caches where segment_number is null; diff --git a/mysql-test/main/kill_debug.test b/mysql-test/main/kill_debug.test index 6bade1d8d90..d861b8b4680 100644 --- a/mysql-test/main/kill_debug.test +++ b/mysql-test/main/kill_debug.test @@ -313,7 +313,9 @@ connection default; set debug_sync='now WAIT_FOR go0'; set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; evalp kill $id; +--disable_cursor_protocol select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached'; +--enable_cursor_protocol set debug_sync='now SIGNAL go3'; if (`select @@thread_handling != 'pool-of-threads'`) { # cannot check that a thread was added to thread pool on windows, but the test works there w/o the wait diff --git a/mysql-test/main/last_value.test b/mysql-test/main/last_value.test index 41cfdb5482d..9e90a8a25bb 100644 --- a/mysql-test/main/last_value.test +++ b/mysql-test/main/last_value.test @@ -33,6 +33,8 @@ DROP TABLE t1; SELECT LAST_VALUE(@last_a:=1,@last_b:=1); select @last_b; --enable_ps_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="hello"); @@ -41,6 +43,7 @@ SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03")); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL); select @last_b; +--enable_cursor_protocol --disable_metadata --error ER_PARSE_ERROR SELECT LAST_VALUE(); diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index d5111c60546..c6fc36e5dfb 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -23,6 +23,8 @@ insert into t2i values ('bb'), ('cc'), ('dd'), ('ff'); --echo Simple joins --echo ========================================================================= +#Check after fix MDEV-31522 +--disable_cursor_protocol --echo Simple nested loops join without blocking set @@join_cache_level=0; explain @@ -457,6 +459,7 @@ SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16; +--enable_cursor_protocol drop table t1,t2,t3; @@ -489,6 +492,7 @@ WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 LIMIT ROWS EXAMINED 120; +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 @@ -508,6 +512,7 @@ LIMIT ROWS EXAMINED 124; SHOW STATUS LIKE 'Handler_read%'; SHOW STATUS LIKE 'Handler_tmp%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1, t2; diff --git a/mysql-test/main/loaddata.test b/mysql-test/main/loaddata.test index 6a7caaf02a1..f7e070d9e35 100644 --- a/mysql-test/main/loaddata.test +++ b/mysql-test/main/loaddata.test @@ -44,7 +44,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; create table t1(id integer not null auto_increment primary key); insert into t1 values(0); disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' from t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1; enable_query_log; @@ -52,9 +54,11 @@ select * from t1; remove_file $MYSQLTEST_VARDIR/tmp/t1; disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; @@ -97,9 +101,11 @@ INSERT INTO t1 (c1) VALUES SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -187,9 +193,11 @@ create table t1(f1 int); insert into t1 values(1),(null); create table t2(f2 int auto_increment primary key); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1; --enable_ps2_protocol +--enable_cursor_protocol SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2; enable_query_log; @@ -206,20 +214,24 @@ create table t1(f1 int, f2 timestamp not null default current_timestamp); create table t2(f1 int); insert into t2 values(1),(2); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1; enable_query_log; select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; remove_file $MYSQLTEST_VARDIR/tmp/t2; delete from t1; disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; enable_query_log; @@ -238,9 +250,11 @@ INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1 SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; echo EOF; @@ -379,8 +393,10 @@ SET sql_mode = ''; --disable_ps2_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM; @@ -392,17 +408,21 @@ SELECT * FROM t1; # show we can write this with OUTFILE, forcing the parameters for now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 # now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 @@ -435,9 +455,11 @@ INSERT INTO t1 (id, val1) VALUES (3, '\tx'); --echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -454,9 +476,11 @@ eval SELECT LOAD_FILE("$file") as exp; --echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ' @@ -478,9 +502,11 @@ SET sql_mode = ''; --echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -503,9 +529,11 @@ SET sql_mode = ''; --echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ' @@ -547,9 +575,11 @@ INSERT INTO t1 VALUES (1); SET NAMES latin1; SET character_set_filesystem=filename; select @@character_set_filesystem; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't-1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 't-1' INTO TABLE t1; SELECT * FROM t1; @@ -571,9 +601,11 @@ select @@character_set_filesystem; --echo # CREATE TABLE t1(col0 LONGBLOB); +--disable_cursor_protocol --disable_ps2_protocol SELECT 'test' INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0; SELECT * FROM t1; @@ -642,9 +674,11 @@ disconnect con1; --echo # CREATE TABLE t1(f1 INT); +--disable_cursor_protocol --disable_ps2_protocol EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; --enable_ps2_protocol +--enable_cursor_protocol --disable_warnings LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; --enable_warnings @@ -661,7 +695,9 @@ remove_file $MYSQLD_DATADIR/test/t1.dat; --disable_ps2_protocol --let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1\n' INTO DUMPFILE '$file' +--enable_cursor_protocol --enable_ps2_protocol create table t1(a point); @@ -749,9 +785,11 @@ CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b)); INSERT INTO t1 VALUES (1,1); CREATE TABLE t2 (c INT); CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2; +--disable_cursor_protocol --disable_ps2_protocol SELECT a, b INTO OUTFILE '15645.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_WRONG_USAGE LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b); --error ER_WRONG_USAGE diff --git a/mysql-test/main/locking_clause.test b/mysql-test/main/locking_clause.test index ccf51103e49..d198bcf74c4 100644 --- a/mysql-test/main/locking_clause.test +++ b/mysql-test/main/locking_clause.test @@ -152,6 +152,7 @@ DROP USER test2@localhost; --echo # MYSQL 8 --echo # +--disable_cursor_protocol --enable_prepare_warnings SELECT 1 FROM DUAL LIMIT 1 INTO @var FOR UPDATE; SELECT 1 FROM DUAL LIMIT 1 FOR UPDATE INTO @var; @@ -163,3 +164,4 @@ SELECT 1 FROM DUAL LIMIT 1 INTO @var FOR UPDATE INTO @var; SELECT 1 UNION SELECT 1 FOR UPDATE INTO @var; SELECT 1 UNION SELECT 1 INTO @var FOR UPDATE; --disable_prepare_warnings +--enable_cursor_protocol diff --git a/mysql-test/main/log_crash.result b/mysql-test/main/log_crash.result new file mode 100644 index 00000000000..5a820a1fd01 --- /dev/null +++ b/mysql-test/main/log_crash.result @@ -0,0 +1,17 @@ +# +# MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +# table after crash recovery +# +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +# restart +DROP TABLE t; +SELECT count(*) FROM mysql.general_log; +count(*) +5 +Warnings: +Error 1194 Table 'general_log' is marked as crashed and should be repaired +# +# End of 10.5 tests +# diff --git a/mysql-test/main/log_crash.test b/mysql-test/main/log_crash.test new file mode 100644 index 00000000000..3a6a2ff4454 --- /dev/null +++ b/mysql-test/main/log_crash.test @@ -0,0 +1,25 @@ + +--source include/not_embedded.inc +--source include/have_csv.inc + +--echo # +--echo # MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +--echo # table after crash recovery +--echo # + +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); + +--disable_ps_protocol +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +--disable_ps_protocol +--let $shutdown_timeout= 0 +--source include/restart_mysqld.inc +DROP TABLE t; +--disable_ps_protocol +SELECT count(*) FROM mysql.general_log; +--enable_ps_protocol + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 085f15f752a..0b713061a40 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -45,6 +45,7 @@ show fields from mysql.slow_log; # # Check flush command # +--disable_cursor_protocol --disable_ps2_protocol flush slow logs; @@ -75,10 +76,12 @@ SET long_query_time=0.1; --echo # Although this query is disallowed by slow_query_log, it should still increment Slow_queries +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM @@ -89,11 +92,13 @@ SELECT --echo # Although this query is disallowed by log_slow_filter, it should still increment Slow_queries SET log_slow_filter=filesort; +--disable_cursor_protocol SELECT sleep(0.2) INTO @tmp FROM DUAL; SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM @@ -118,6 +123,7 @@ show session status like 'Slow_queries'; drop table t; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # End of 10.3 tests @@ -141,6 +147,7 @@ CREATE TABLE `tab_MDEV_30820` ( PRIMARY KEY (`id`) ); +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol @@ -185,7 +192,7 @@ drop function get_zero; --enable_view_protocol --enable_ps2_protocol ---enable_view_protocol +--enable_cursor_protocol --echo # End of 10.4 tests @@ -214,7 +221,7 @@ set log_slow_filter=default; set timestamp=default; let SEARCH_FILE=`select @@slow_query_log_file`; -let SEARCH_PATTERN=use.*2; +let SEARCH_PATTERN= use \`a\n.*2; let SEARCH_OUTPUT=matches; source include/search_pattern_in_file.inc; diff --git a/mysql-test/main/log_slow_innodb.test b/mysql-test/main/log_slow_innodb.test index ddba0463b63..cfbc1f33440 100644 --- a/mysql-test/main/log_slow_innodb.test +++ b/mysql-test/main/log_slow_innodb.test @@ -30,9 +30,11 @@ SET SESSION log_slow_verbosity='innodb,query_plan'; --let log_file=$log_slow_prefix-verbosity_1 --source include/log_slow_start.inc +--disable_cursor_protocol --disable_ps2_protocol SELECT sum(a+b) FROM t1; --enable_ps2_protocol +--enable_cursor_protocol UPDATE t1 set b=b+1 where a=1 or a=999; --source include/log_slow_stop.inc @@ -51,9 +53,11 @@ SET SESSION log_slow_verbosity='innodb,query_plan'; --let log_file=$log_slow_prefix-verbosity_2 --source include/log_slow_start.inc +--disable_cursor_protocol --disable_ps2_protocol SELECT 1; --enable_ps2_protocol +--enable_cursor_protocol --source include/log_slow_stop.inc --let log_slow_verbosity_expected_matches= 2 diff --git a/mysql-test/main/log_tables-big.test b/mysql-test/main/log_tables-big.test index 0861c79126e..c94e0179c91 100644 --- a/mysql-test/main/log_tables-big.test +++ b/mysql-test/main/log_tables-big.test @@ -16,6 +16,7 @@ connect (con2,localhost,root,,); # # Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values # +--disable_cursor_protocol --disable_ps2_protocol connection con1; set session long_query_time=10; @@ -38,5 +39,5 @@ connection default; disconnect con1; disconnect con2; --enable_ps2_protocol - +--enable_cursor_protocol set @@global.log_output = @log_output.saved; diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test index b030b3d53ec..cb07d006dd7 100644 --- a/mysql-test/main/log_tables.test +++ b/mysql-test/main/log_tables.test @@ -836,7 +836,9 @@ SET GLOBAL slow_query_log = @old_slow_query_log; --echo # Bug#21557 entries in the general query log truncated at 1000 characters. --echo # +--disable_cursor_protocol select CONNECTION_ID() into @thread_id; +--enable_cursor_protocol --disable_ps_protocol truncate table mysql.general_log; --enable_ps_protocol @@ -1007,9 +1009,12 @@ INSERT INTO t1 VALUES (3,3,3); INSERT INTO t1 VALUES (4,4,4); --disable_ps2_protocol +#Enable after fix MDEV-31522 +--disable_cursor_protocol SELECT SQL_NO_CACHE 'Bug#31700 - SCAN',f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f3=4; SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f2=3; SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2; +--enable_cursor_protocol --replace_column 1 TIMESTAMP SELECT start_time, rows_examined, rows_sent, sql_text FROM mysql.slow_log WHERE sql_text LIKE '%Bug#31700%' ORDER BY start_time; @@ -1037,6 +1042,7 @@ unlock tables; --echo # --echo # MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table --echo # +--disable_cursor_protocol truncate mysql.slow_log; set global log_output= 'TABLE'; create user u@localhost; @@ -1052,6 +1058,7 @@ select 'after evil-doing', sleep(0.2); select distinct sql_text from mysql.slow_log where sql_text like '%evil%'; set global log_output=default; drop user u@localhost; +--enable_cursor_protocol SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 654b6ab6aa1..ca5bd32e382 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -12,9 +12,11 @@ insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol create temporary table tmp (a varchar(1024), b int, c int, d int, e linestring, unique (e)); load data infile 'load.data' into table tmp; delete from tmp; @@ -226,9 +228,11 @@ drop table t1; --echo # CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY LOAD DATA INFILE 'load.data' INTO TABLE t1; select * from t1; @@ -242,9 +246,11 @@ DROP TABLE t1; CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (data); SELECT * FROM t1; @@ -509,9 +515,11 @@ drop table t2; --echo # create table t1 (pk int primary key, f blob, unique(f)) engine=innodb; insert t1 values (1, null); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.data' replace into table t1; select * from t1; drop table t1; diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index b5a8a7b7c0c..0795347a46b 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -2,9 +2,6 @@ # Test of --lower-case-table-names # -#remove this include after fix MDEV-27944 ---source include/no_view_protocol.inc - show variables like "lower_case_table_names"; create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); @@ -38,8 +35,10 @@ drop table t1; create database mysqltest; use MYSQLTEST; create table t1 (a int); +--disable_service_connection select T1.a from MYSQLTEST.T1; select t1.a from MYSQLTEST.T1; +--enable_service_connection select mysqltest.t1.* from MYSQLTEST.t1; select MYSQLTEST.t1.* from MYSQLTEST.t1; select MYSQLTEST.T1.* from MYSQLTEST.T1; diff --git a/mysql-test/main/lowercase_table_qcache.test b/mysql-test/main/lowercase_table_qcache.test index b6047a98c74..ceff2719353 100644 --- a/mysql-test/main/lowercase_table_qcache.test +++ b/mysql-test/main/lowercase_table_qcache.test @@ -13,6 +13,7 @@ set LOCAL query_cache_type=ON; drop database if exists MySQLtesT; --enable_warnings +--disable_cursor_protocol create database MySQLtesT; create table MySQLtesT.t1 (a int); select * from MySQLtesT.t1; @@ -30,6 +31,7 @@ disable_result_log; select * from MySQL.db; enable_result_log; show status like "Qcache_queries_in_cache"; +--enable_cursor_protocol set GLOBAL query_cache_size=@save_query_cache_size; set GLOBAL query_cache_type=default; diff --git a/mysql-test/main/mdev-21101.test b/mysql-test/main/mdev-21101.test index 543b587c5e6..99a8c3006e5 100644 --- a/mysql-test/main/mdev-21101.test +++ b/mysql-test/main/mdev-21101.test @@ -10,12 +10,14 @@ # different connections simultaneously, to force queueing occurs. # Verify connections are intact, even if queueing time exceeds wait_timeout +--disable_cursor_protocol SELECT @@global.wait_timeout, @@global.thread_pool_max_threads, @@global.thread_pool_size, @@global.thread_pool_oversubscribe, @@global.thread_pool_stall_limit INTO @_wait_timeout,@_thread_pool_max_threads,@_thread_pool_size, @_thread_pool_oversubscribe,@_thread_pool_stall_limit; +--enable_cursor_protocol SET @@global.wait_timeout=1, @@global.thread_pool_max_threads=2, diff --git a/mysql-test/main/mdev-31636.result b/mysql-test/main/mdev-31636.result new file mode 100644 index 00000000000..82dcd03027c --- /dev/null +++ b/mysql-test/main/mdev-31636.result @@ -0,0 +1,8 @@ +RESET MASTER; +SET +@@global.gtid_binlog_state='1-1-101,2-1-2002', +@@global.slave_parallel_mode=x; +ERROR 42000: Variable 'slave_parallel_mode' can't be set to the value of 'x' +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state + diff --git a/mysql-test/main/mdev-31636.test b/mysql-test/main/mdev-31636.test new file mode 100644 index 00000000000..b5affaef60c --- /dev/null +++ b/mysql-test/main/mdev-31636.test @@ -0,0 +1,7 @@ +--source include/have_log_bin.inc +RESET MASTER; +--error ER_WRONG_VALUE_FOR_VAR +SET + @@global.gtid_binlog_state='1-1-101,2-1-2002', + @@global.slave_parallel_mode=x; +SELECT @@global.gtid_binlog_state; diff --git a/mysql-test/main/myisam_debug.test b/mysql-test/main/myisam_debug.test index 2659a3f9347..f24639a7fd6 100644 --- a/mysql-test/main/myisam_debug.test +++ b/mysql-test/main/myisam_debug.test @@ -48,12 +48,14 @@ let $wait_condition= INFO = "INSERT INTO t1(id) SELECT id FROM t2"; --source include/wait_condition.inc +--disable_cursor_protocol --enable_prepare_warnings SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'wait_in_enable_indexes' AND INFO = "INSERT INTO t1(id) SELECT id FROM t2" INTO @thread_id; --disable_prepare_warnings +--enable_cursor_protocol KILL QUERY @thread_id; CHECK TABLE t1; diff --git a/mysql-test/main/mysqladmin.test b/mysql-test/main/mysqladmin.test index 2575c008a96..af9b3eb5bda 100644 --- a/mysql-test/main/mysqladmin.test +++ b/mysql-test/main/mysqladmin.test @@ -101,7 +101,9 @@ let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; --source include/restart_mysqld.inc connect ssl_con,localhost,root,,,,,SSL; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +--enable_cursor_protocol let $ssl_not_after=`SELECT @ssl_not_after`; remove_file $ssl_cert; diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index bdfca1397c9..2c1215f677a 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,6 +1,6 @@ ---- a/mysql-test/main/mysqld--help.result -+++ b/mysql-test/main/mysqld--help.result -@@ -216,6 +216,7 @@ The following specify which files/extra groups are read (specified before remain +--- main/mysqld--help.result ++++ main/mysqld--help,win.reject +@@ -216,6 +216,7 @@ --console Write error output on screen; don't remove the console window on Windows --core-file Write core on crashes @@ -8,7 +8,7 @@ -h, --datadir=name Path to the database root directory --deadlock-search-depth-long=# Long search depth for the two-step deadlock detection -@@ -717,6 +718,7 @@ The following specify which files/extra groups are read (specified before remain +@@ -724,6 +725,7 @@ Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -16,7 +16,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1414,6 +1416,10 @@ The following specify which files/extra groups are read (specified before remain +@@ -1431,6 +1433,10 @@ Alias for log_slow_query_file. Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -27,7 +27,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1438,6 +1444,7 @@ The following specify which files/extra groups are read (specified before remain +@@ -1455,6 +1461,7 @@ deleting or updating every row in a table --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) @@ -35,19 +35,20 @@ --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1517,6 +1524,11 @@ The following specify which files/extra groups are read (specified before remain +@@ -1534,6 +1541,12 @@ --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool + --thread-pool-min-threads=# + Minimum number of threads in the thread pool + --thread-pool-mode=name -+ Chose implementation of the threadpool. One of: windows, -+ generic ++ Chose implementation of the threadpool. Use 'windows' ++ unless you have a workload with a lot of concurrent ++ connections and minimal contention --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed -@@ -1555,8 +1567,8 @@ The following specify which files/extra groups are read (specified before remain +@@ -1572,8 +1585,8 @@ automatically convert it to an on-disk MyISAM or Aria table -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -58,7 +59,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1783,6 +1795,7 @@ myisam-sort-buffer-size 134216704 +@@ -1802,6 +1815,7 @@ myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -66,7 +67,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1957,6 +1970,7 @@ slave-transaction-retry-interval 0 +@@ -1977,6 +1991,7 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -74,7 +75,7 @@ sort-buffer-size 2097152 sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-safe-updates FALSE -@@ -1984,6 +1998,8 @@ thread-pool-dedicated-listener FALSE +@@ -2004,6 +2019,8 @@ thread-pool-exact-stats FALSE thread-pool-idle-timeout 60 thread-pool-max-threads 65536 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 2cc6136d53e..b98f422e33d 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -781,6 +781,15 @@ The following specify which files/extra groups are read (specified before remain --optimizer-index-block-copy-cost=# Cost of copying a key block from the cache to internal storage as part of an index scan + --optimizer-join-limit-pref-ratio=# + For queries with JOIN and ORDER BY LIMIT : make the + optimizer consider a join order that allows to short-cut + execution after producing #LIMIT matches if that promises + N times speedup. (A conservative setting here would be is + a high value, like 100 so the short-cutting plan is used + if it promises a speedup of 100x or more). Short-cutting + plans are inherently risky so the default is 0 which + means do not consider this optimization --optimizer-key-compare-cost=# Cost of checking a key against the end key condition --optimizer-key-copy-cost=# @@ -1814,6 +1823,7 @@ optimizer-disk-read-cost 10.24 optimizer-disk-read-ratio 0.02 optimizer-extra-pruning-depth 8 optimizer-index-block-copy-cost 0.0356 +optimizer-join-limit-pref-ratio 0 optimizer-key-compare-cost 0.011361 optimizer-key-copy-cost 0.015685 optimizer-key-lookup-cost 0.435777 diff --git a/mysql-test/main/mysqldump-max.test b/mysql-test/main/mysqldump-max.test index e85490b7352..6e92bb90ea2 100644 --- a/mysql-test/main/mysqldump-max.test +++ b/mysql-test/main/mysqldump-max.test @@ -81,8 +81,10 @@ drop table t6; # type to avoid Inno's column-number limits (~1000 columns) etc. # Here because it needs Inno-engine. +--disable_cursor_protocol SELECT @@global.default_storage_engine INTO @old_engine; SET GLOBAL default_storage_engine=InnoDB; +--enable_cursor_protocol --disable_query_log CREATE TABLE `t1` ( diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index d4c801d8e08..7268af5d23f 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -3046,7 +3046,9 @@ drop table t1; # # MDEV-32589 parallel-mysqldump - test "too many connections" # +--disable_cursor_protocol select @@max_connections into @save_max_connections; +--enable_cursor_protocol set global max_connections=10; --replace_result mariadb-dump.exe mariadb-dump --error 2 diff --git a/mysql-test/main/null.test b/mysql-test/main/null.test index 7256ce1cc5b..b7180d9d0a5 100644 --- a/mysql-test/main/null.test +++ b/mysql-test/main/null.test @@ -322,7 +322,10 @@ CREATE TABLE t1 (a YEAR(2)); --disable_prepare_warnings INSERT INTO t1 VALUES (0); SELECT a,NULLIF(a,2000),NULLIF(2000,a) FROM t1; +# Enable after fix MDEV-31722 +--disable_cursor_protocol SELECT a,NULLIF(a,2001),NULLIF(2001,a) FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/null_key.test b/mysql-test/main/null_key.test index 7fc21ee1e1d..6a9b8489e7d 100644 --- a/mysql-test/main/null_key.test +++ b/mysql-test/main/null_key.test @@ -244,11 +244,13 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; FLUSH STATUS ; --disable_ps2_protocol +--disable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; --disable_view_protocol SELECT FOUND_ROWS(); +--enable_cursor_protocol SHOW STATUS LIKE "handler_read%"; --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 3ce2eacc7d4..79fc7420078 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -833,7 +833,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; +--enable_cursor_protocol # this query creates one temporary table in itself, which we are not # interested in. @@ -855,7 +858,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; +--enable_cursor_protocol --disable_query_log --let $q = `show status like 'Created_tmp_tables';` @@ -1889,6 +1895,7 @@ insert into t1 analyze table t1; --enable_result_log +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol explain @@ -1912,6 +1919,7 @@ select b, count(*) num_cnt from t1 show status like '%Handler_read%'; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t0, t1; diff --git a/mysql-test/main/order_by_limit_join.result b/mysql-test/main/order_by_limit_join.result new file mode 100644 index 00000000000..ed3f20e87f7 --- /dev/null +++ b/mysql-test/main/order_by_limit_join.result @@ -0,0 +1,473 @@ +# +# MDEV-34720: Poor plan choice for large JOIN with ORDER BY and small LIMIT +# +create table t1 ( +a int, +b int, +c int, +col1 int, +col2 int, +index(a), +index(b), +index(col1) +); +insert into t1 select +mod(seq, 100), +mod(seq, 95), +seq, +seq, +seq +from +seq_1_to_10000; +create table t10 ( +a int, +a_value char(10), +key(a) +); +insert into t10 select seq, seq from seq_1_to_100; +create table t11 ( +b int, +b_value char(10), +key(b) +); +insert into t11 select seq, seq from seq_1_to_150; +set @tmp_os=@@optimizer_trace; +set optimizer_trace=1; +# +# Query 1 - basic example. +# +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a,b col1 5 NULL 10 Using where +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "table": "t1", + "rows_estimation": 10000, + "filesort_cost": "REPLACED", + "read_cost": "REPLACED", + "filesort_type": "priority_queue with row lookup", + "fanout": 1, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "direction": 1, + "rows_to_examine": 10, + "range_scan": false, + "scan_cost": "REPLACED", + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": "REPLACED", + "risk_ratio": 10, + "shortcut_join_cost": "REPLACED", + "shortcut_cost_with_risk": 0.492018616, + "use_shortcut_cost": true + } +] +# +# Query 2 - same as above but without a suitable index. +# +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +# t1 is first but there's no suitable index, +# so we use filesort but using temporary: +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 10000 Using where; Using filesort +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [], + "can_skip_filesort": false, + "full_join_cost": "REPLACED", + "risk_ratio": 10, + "shortcut_join_cost": "REPLACED", + "shortcut_cost_with_risk": 19.4241863, + "use_shortcut_cost": true + } +] +# +# Query 3: Counter example with large limit +# +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 5000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +# Same plan as above: +# Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 5000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.5, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "table": "t1", + "rows_estimation": 10000, + "filesort_cost": "REPLACED", + "read_cost": "REPLACED", + "filesort_type": "merge_sort with addon fields", + "fanout": 1, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "direction": 1, + "rows_to_examine": 5000, + "range_scan": false, + "scan_cost": "REPLACED", + "usable": false, + "cause": "cost" + } + ] + } + } + ], + "can_skip_filesort": false, + "full_join_cost": "REPLACED", + "risk_ratio": 10, + "shortcut_join_cost": "REPLACED", + "shortcut_cost_with_risk": 199.426608, + "use_shortcut_cost": false + } +] +# +# Query 4: LEFT JOIN makes it impossible to put ORDER-BY-table first, +# however the optimizer still puts it as sort_by_table. +# +set optimizer_join_limit_pref_ratio=10; +explain +select +* +from +t10 left join (t1 join t11 on t1.b=t11.b ) on t1.a=t10.a +order by +t1.col2 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 100 Using temporary; Using filesort +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +# This will show nothing as limit shortcut code figures that +# it's not possible to use t1 to construct shortcuts: +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +NULL +# +# Query 5: Same as Q1 but also with a semi-join +# +set optimizer_join_limit_pref_ratio=default; +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +where +t1.a in (select a from t10) and +t1.b in (select b from t11) +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t10 index a a 5 NULL 100 Using where; Using index; LooseScan; Using temporary; Using filesort +1 PRIMARY t10 ref a a 5 test.t10.a 1 +1 PRIMARY t1 ref a,b a 5 test.t10.a 100 Using where +1 PRIMARY t11 ref b b 5 test.t1.b 1 +1 PRIMARY t11 ref b b 5 test.t1.b 1 Using index; FirstMatch(t11) +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +where +t1.a in (select a from t10) and +t1.b in (select b from t11) +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index a,b col1 5 NULL 10 Using where +1 PRIMARY t10 ref a a 5 test.t1.a 1 +1 PRIMARY t11 ref b b 5 test.t1.b 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t10 index a a 5 NULL 100 Using index +3 MATERIALIZED t11 index b b 5 NULL 150 Using index +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "table": "t1", + "rows_estimation": 10000, + "filesort_cost": "REPLACED", + "read_cost": "REPLACED", + "filesort_type": "priority_queue with row lookup", + "fanout": 1, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "direction": 1, + "rows_to_examine": 10, + "range_scan": false, + "scan_cost": "REPLACED", + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": "REPLACED", + "risk_ratio": 10, + "shortcut_join_cost": "REPLACED", + "shortcut_cost_with_risk": 0.532449162, + "use_shortcut_cost": true + } +] +# +# Query 6: same as Query 1 but let's limit the search depth +# +set @tmp_osd=@@optimizer_search_depth; +set optimizer_search_depth=1; +set optimizer_join_limit_pref_ratio=default; +# Table t1 is not the first, have to use temporary+filesort: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL a NULL NULL NULL 100 Using where; Using temporary; Using filesort +1 SIMPLE t11 ALL b NULL NULL NULL 150 Using join buffer (flat, BNL join) +1 SIMPLE t1 ref a,b a 5 test.t10.a 100 Using where +set optimizer_join_limit_pref_ratio=10; +# t1 is first, key=col1 produces ordering, no filesort or temporary: +explain +select +* +from +t1 +join t10 on t1.a=t10.a +join t11 on t1.b=t11.b +order by +t1.col1 +limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index a,b col1 5 NULL 10 Using where +1 SIMPLE t10 ref a a 5 test.t1.a 1 +1 SIMPLE t11 ref b b 5 test.t1.b 1 +set @trace=(select trace from information_schema.optimizer_trace); +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; +JS +[ + { + "limit_fraction": 0.001, + "test_if_skip_sort_order_early": + [ + { + "reconsidering_access_paths_for_index_ordering": + { + "clause": "ORDER BY", + "table": "t1", + "rows_estimation": 10000, + "filesort_cost": "REPLACED", + "read_cost": "REPLACED", + "filesort_type": "priority_queue with row lookup", + "fanout": 1, + "possible_keys": + [ + { + "index": "a", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "b", + "can_resolve_order": false, + "cause": "not usable index for the query" + }, + { + "index": "col1", + "can_resolve_order": true, + "direction": 1, + "rows_to_examine": 10, + "range_scan": false, + "scan_cost": "REPLACED", + "chosen": true + } + ] + } + } + ], + "can_skip_filesort": true, + "full_join_cost": "REPLACED", + "risk_ratio": 10, + "shortcut_join_cost": "REPLACED", + "shortcut_cost_with_risk": 0.492018616, + "use_shortcut_cost": true + } +] +set optimizer_search_depth=@tmp_osd; +set optimizer_trace=@tmp_os; +set optimizer_join_limit_pref_ratio=default; +drop table t1, t10, t11; diff --git a/mysql-test/main/order_by_limit_join.test b/mysql-test/main/order_by_limit_join.test new file mode 100644 index 00000000000..f6fbb8d2ad4 --- /dev/null +++ b/mysql-test/main/order_by_limit_join.test @@ -0,0 +1,213 @@ +--echo # +--echo # MDEV-34720: Poor plan choice for large JOIN with ORDER BY and small LIMIT +--echo # + +--source include/have_sequence.inc + +# We need optimizer trace +--source include/not_embedded.inc + +create table t1 ( + a int, + b int, + c int, + col1 int, + col2 int, + index(a), + index(b), + index(col1) +); + +insert into t1 select + mod(seq, 100), + mod(seq, 95), + seq, + seq, + seq +from + seq_1_to_10000; + + +create table t10 ( + a int, + a_value char(10), + key(a) +); +insert into t10 select seq, seq from seq_1_to_100; + +create table t11 ( + b int, + b_value char(10), + key(b) +); +insert into t11 select seq, seq from seq_1_to_150; + +set @tmp_os=@@optimizer_trace; +set optimizer_trace=1; + +--echo # +--echo # Query 1 - basic example. +--echo # +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 2 - same as above but without a suitable index. +--echo # +let $query= +explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col2 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +eval $query; + +--echo # t1 is first but there's no suitable index, +--echo # so we use filesort but using temporary: +set optimizer_join_limit_pref_ratio=10; +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 3: Counter example with large limit +--echo # +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 5000; + +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=0; +eval $query; + +--echo # Same plan as above: +--echo # Table t1 is not the first, have to use temporary+filesort: +set optimizer_join_limit_pref_ratio=10; +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 4: LEFT JOIN makes it impossible to put ORDER-BY-table first, +--echo # however the optimizer still puts it as sort_by_table. +--echo # +set optimizer_join_limit_pref_ratio=10; +explain +select + * +from + t10 left join (t1 join t11 on t1.b=t11.b ) on t1.a=t10.a +order by + t1.col2 +limit 10; + +set @trace=(select trace from information_schema.optimizer_trace); +--echo # This will show nothing as limit shortcut code figures that +--echo # it's not possible to use t1 to construct shortcuts: +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 5: Same as Q1 but also with a semi-join +--echo # +set optimizer_join_limit_pref_ratio=default; +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +where + t1.a in (select a from t10) and + t1.b in (select b from t11) +order by + t1.col1 +limit 10; + +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + +--echo # +--echo # Query 6: same as Query 1 but let's limit the search depth +--echo # +set @tmp_osd=@@optimizer_search_depth; +set optimizer_search_depth=1; +let $query= explain +select + * +from + t1 + join t10 on t1.a=t10.a + join t11 on t1.b=t11.b +order by + t1.col1 +limit 10; + +set optimizer_join_limit_pref_ratio=default; +--echo # Table t1 is not the first, have to use temporary+filesort: +eval $query; + +set optimizer_join_limit_pref_ratio=10; + +--echo # t1 is first, key=col1 produces ordering, no filesort or temporary: +eval $query; + +set @trace=(select trace from information_schema.optimizer_trace); +--source include/optimizer_trace_no_costs.inc +select json_detailed(json_extract(@trace, '$**.join_limit_shortcut_choice')) as JS; + + +set optimizer_search_depth=@tmp_osd; +set optimizer_trace=@tmp_os; +set optimizer_join_limit_pref_ratio=default; +drop table t1, t10, t11; + diff --git a/mysql-test/main/order_by_pack_big.test b/mysql-test/main/order_by_pack_big.test index e39537b73a2..21ec803cd8a 100644 --- a/mysql-test/main/order_by_pack_big.test +++ b/mysql-test/main/order_by_pack_big.test @@ -145,16 +145,20 @@ set sort_buffer_size= 2097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file2' FROM t3 FORCE INDEX(idx) ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol diff_files $file1 $file2; @@ -171,9 +175,11 @@ set sort_buffer_size= 1097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; diff --git a/mysql-test/main/outfile.test b/mysql-test/main/outfile.test index 7f8f31bc748..f9bd76dcd95 100644 --- a/mysql-test/main/outfile.test +++ b/mysql-test/main/outfile.test @@ -21,29 +21,41 @@ drop table if exists t1; create table t1 (`a` blob); insert into t1 values("hello world"),("Hello mars"),(NULL); disable_query_log; +--disable_cursor_protocol eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.1")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.2")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.3")); # the following should give errors disable_query_log; +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.2" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.3" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 @@ -53,7 +65,9 @@ drop table t1; # Bug#8191 SELECT INTO OUTFILE insists on FROM clause disable_query_log; +--disable_cursor_protocol eval select 1 into outfile "../../tmp/outfile-test.4"; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.4")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 @@ -76,17 +90,21 @@ DROP TABLE t1; # Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM information_schema.schemata LIMIT 0, 5; +--enable_cursor_protocol # enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use information_schema; # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM schemata LIMIT 0, 5; +--enable_cursor_protocol enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use test; @@ -97,8 +115,10 @@ use test; # It should not be possible to write to a file outside of vardir create table t1(a int); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--disable_cursor_protocol --error ER_OPTION_PREVENTS_STATEMENT eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1; +--enable_cursor_protocol drop table t1; # @@ -110,6 +130,7 @@ create user user_1@localhost; grant all on mysqltest.* to user_1@localhost; connect (con28181_1,localhost,user_1,,mysqltest); +--disable_cursor_protocol --error ER_ACCESS_DENIED_ERROR eval select schema_name into outfile "../../tmp/outfile-test.4" @@ -117,18 +138,21 @@ fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_1; grant file on *.* to user_1@localhost; connect (con28181_2,localhost,user_1,,mysqltest); +--disable_cursor_protocol eval select schema_name into outfile "../../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_2; diff --git a/mysql-test/main/outfile_loaddata.test b/mysql-test/main/outfile_loaddata.test index 6a1958568c8..ee28655d533 100644 --- a/mysql-test/main/outfile_loaddata.test +++ b/mysql-test/main/outfile_loaddata.test @@ -17,7 +17,9 @@ INSERT INTO t1 VALUES (101, 202, '-r-', '=raker='); --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -32,7 +34,9 @@ DROP TABLE t2; --echo # Only numeric fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -47,7 +51,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -62,7 +68,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -77,7 +85,9 @@ DROP TABLE t2; --echo # Only string fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -100,7 +110,9 @@ SELECT HEX(c1) FROM t1; --let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1 +--enable_cursor_protocol TRUNCATE t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -135,13 +147,17 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # Error on multi-character ENCLOSED/ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345' +--enable_cursor_protocol --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345' +--enable_cursor_protocol --remove_file $file @@ -149,21 +165,27 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # LOAD DATA rises error or has unpredictable result -- to be fixed later --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -176,7 +198,9 @@ SELECT * FROM t1; SELECT * FROM t2; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' LINES STARTING BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -187,7 +211,9 @@ TRUNCATE t2; SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' LINES TERMINATED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -202,7 +228,9 @@ SELECT * FROM t2; --echo # Default (binary) charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -216,7 +244,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # latin1 charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -230,7 +260,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # KOI8-R charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -244,7 +276,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # UTF-8 charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -276,7 +310,9 @@ let $length= 800; --eval INSERT INTO t1 VALUES (REPEAT('.', $length)) --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo # should be greater than $length --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index 09ca6e292a1..5ddbaf29314 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -896,6 +896,7 @@ SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; --echo # "INTO" clause tests +--disable_cursor_protocol --enable_prepare_warnings SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM DUAL INTO @var17727401; @@ -942,6 +943,7 @@ SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE(); --error ER_PARSE_ERROR SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401; +--enable_cursor_protocol --echo # ORDER and LIMIT clause combinations diff --git a/mysql-test/main/parser_stack.test b/mysql-test/main/parser_stack.test index 5d53ff98902..a39f715addc 100644 --- a/mysql-test/main/parser_stack.test +++ b/mysql-test/main/parser_stack.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } # # These tests are designed to cause an internal parser stack overflow, diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 671b10278e8..6d211e332b6 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -478,6 +478,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); @@ -490,6 +491,7 @@ SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol # Bug#37329 Range scan on partitioned tables shows higher Handler_read_next # (marked as duplicate of Bug#35931) @@ -511,6 +513,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); @@ -535,6 +538,7 @@ SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED create table t1 (a int) partition by list ((a/3)*10 div 1) diff --git a/mysql-test/main/partition_csv.test b/mysql-test/main/partition_csv.test index 44013dd4b0a..2057d8cac3b 100644 --- a/mysql-test/main/partition_csv.test +++ b/mysql-test/main/partition_csv.test @@ -57,7 +57,9 @@ ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10; ALTER TABLE general_log RENAME TO gl_nonpartitioned; ALTER TABLE gl_partitioned RENAME TO general_log; +--disable_cursor_protocol SELECT @@global.log_output INTO @old_glo; +--enable_cursor_protocol SET GLOBAL log_output='table'; SET GLOBAL general_log =1; diff --git a/mysql-test/main/partition_explicit_prune.test b/mysql-test/main/partition_explicit_prune.test index 5aa79bf90e0..a3b74be58e0 100644 --- a/mysql-test/main/partition_explicit_prune.test +++ b/mysql-test/main/partition_explicit_prune.test @@ -9,6 +9,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; --echo # --echo # Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS --echo # +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol CREATE TABLE t1 (a int) @@ -625,6 +626,7 @@ SELECT * FROM t3 PARTITION (pNeg); DROP TABLE t1, t2, t3; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol --echo # Test from superseeded WL# 2682 # Partition select tests. # diff --git a/mysql-test/main/partition_range.test b/mysql-test/main/partition_range.test index e10ad870225..189f7eb9e37 100644 --- a/mysql-test/main/partition_range.test +++ b/mysql-test/main/partition_range.test @@ -983,6 +983,7 @@ EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; # view protocol will cause changed table counters --disable_view_protocol +--disable_cursor_protocol --disable_ps2_protocol FLUSH status; SELECT a, MAX(b) FROM t1_part WHERE a IN (10, 100) GROUP BY a; @@ -992,7 +993,7 @@ FLUSH status; SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a; SHOW status LIKE 'handler_read%'; --enable_ps2_protocol - +--enable_cursor_protocol --enable_view_protocol insert into t2 select 100,seq from seq_1_to_100; EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 26c388b7352..52c362a865d 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -91,7 +91,9 @@ UNINSTALL PLUGIN example; # INSTALL PLUGIN example SONAME 'ha_example'; +--disable_cursor_protocol select @@session.sql_mode into @old_sql_mode; +--enable_cursor_protocol # first, try normal sql_mode (no error, send OK) set session sql_mode=''; diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test index 7e60f196f65..1d3827fd7a2 100644 --- a/mysql-test/main/processlist.test +++ b/mysql-test/main/processlist.test @@ -66,7 +66,10 @@ set debug_sync='reset'; SET NAMES utf8; --vertical_results +#Check after fix MDEV-31514 +--disable_cursor_protocol SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'; +--enable_cursor_protocol --horizontal_results --echo # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 9cb9eaf3e76..b3a790f0965 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -2003,7 +2003,10 @@ prepare stmt from "create view v1 as select * from `t1` `b`"; prepare stmt from "select ?"; set @arg= 123456789.987654321; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; set @arg= "string"; select @arg; @@ -2012,7 +2015,10 @@ set @arg= 123456; select @arg; execute stmt using @arg; set @arg= cast(-12345.54321 as decimal(20, 10)); +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; deallocate prepare stmt; @@ -3334,6 +3340,8 @@ SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; --echo --echo -- Testing decs... +#Enable after fix MDEV-31495 +--disable_cursor_protocol --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; @@ -3341,6 +3349,7 @@ SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +--enable_cursor_protocol --echo DEALLOCATE PREPARE stmt_str; @@ -3573,7 +3582,9 @@ execute st; show status like '%Handler_read%'; flush status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1 use index() where a=3; +--enable_cursor_protocol show status like '%Handler_read%'; --enable_ps2_protocol flush status; diff --git a/mysql-test/main/ps_mem_leaks.result b/mysql-test/main/ps_mem_leaks.result index 95a1f317ae0..0e867ef0ea8 100644 --- a/mysql-test/main/ps_mem_leaks.result +++ b/mysql-test/main/ps_mem_leaks.result @@ -90,6 +90,243 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1; # End of 10.4 tests # +# MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +# +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +id value +1 1 +2 1 +3 NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +# Memory leak also could take place on running the DELETE statement +# with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); +CREATE PROCEDURE p1(p1 INT) +DELETE FROM t1 LIMIT p1; +CALL p1(0); +CALL p1(1); +CALL p1(2); +# Clean up +DROP TABLE t1; +DROP PROCEDURE p1; +# +# MDEV-34757: assertion of (mem_root->flags & 4) == 0 fails in 2nd ps execution with partition pruning +# +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +id value +1 10 +2 10 +3 10 +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (null,1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +select * from t1; +a +1 +2 +1 +3 +deallocate prepare stmt; +drop table t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (null,1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Using buffer +2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +select * from t1; +a +1 +2 +3 +4 +deallocate prepare stmt; +drop table t1, t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +execute stmt using @var1, @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +deallocate prepare stmt; +DROP TABLE t1,t2; +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); +CREATE PROCEDURE p1(p1 INT) +EXPLAIN DELETE FROM t1 LIMIT p1; +CALL p1(0); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +CALL p1(1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +CALL p1(2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +# Clean up +DROP TABLE t1; +DROP PROCEDURE p1; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +select * from t1; +a +1 +2 +3 +deallocate prepare stmt; +drop table t1, t2; +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( +partition p0 values in (1,2), +partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 where a = ?'; +execute stmt using @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching rows after partition pruning +select * from t1; +a +1 +2 +3 +4 +execute stmt using @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +select * from t1; +a +1 +2 +3 +4 +deallocate prepare stmt; +drop table t1, t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +execute stmt using @var1, @var1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL 3 Deleting all rows +deallocate prepare stmt; +DROP TABLE t1,t2; +# +# MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON +# +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +PREPARE stmt FROM "UPDATE t SET a = 0 LIMIT ?"; +EXECUTE stmt USING 0; +EXECUTE stmt USING 1; +DROP TABLE t; +# End of 10.5 tests +# # MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT # CREATE OR REPLACE TABLE t1(a INT); diff --git a/mysql-test/main/ps_mem_leaks.test b/mysql-test/main/ps_mem_leaks.test index 951bc7e337a..bedd4e2d939 100644 --- a/mysql-test/main/ps_mem_leaks.test +++ b/mysql-test/main/ps_mem_leaks.test @@ -5,6 +5,7 @@ # The cmake option -DWITH_PROTECT_STATEMENT_MEMROOT is used only # for debug build --source include/have_debug.inc +--source include/have_partition.inc --echo # --echo # MDEV-32369: Memory leak when executing PS for query with IN subquery @@ -111,6 +112,219 @@ DROP TABLE t1; --echo # End of 10.4 tests +--echo # +--echo # MDEV-34447: Memory leakage is detected on running the test main.ps against the server 11.1 +--echo # +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); + +PREPARE stmt FROM 'UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +EXECUTE stmt; +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +EXECUTE stmt; +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +--echo # Memory leak also could take place on running the DELETE statement +--echo # with the LIMIT clause. Check it. +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); + +CREATE PROCEDURE p1(p1 INT) + DELETE FROM t1 LIMIT p1; + +CALL p1(0); +CALL p1(1); +CALL p1(2); + +--echo # Clean up +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-34757: assertion of (mem_root->flags & 4) == 0 fails in 2nd ps execution with partition pruning +--echo # +# same as the first MDEV-34444 testcase but with explain +CREATE TABLE t1 (id INT, value INT); +CREATE TABLE t2 (id INT); + +PREPARE stmt FROM 'EXPLAIN UPDATE t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +# we are testing 2nd ps assertion failure, not explain output, which +# may vary from version to version +--disable_result_log +EXECUTE stmt; +--enable_result_log +INSERT INTO t1 VALUES (1,10),(2,10),(3,10); +INSERT INTO t2 VALUES (1),(2); +--disable_result_log +EXECUTE stmt; +--enable_result_log +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +# 2nd ps mem leak; partition pruning +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (null,1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# same but with explain +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (null,1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET a = (SELECT 1 FROM t2 WHERE a = t1.a) where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# top level impossible where +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# top level impossible where, with explain +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'EXPLAIN UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id) WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# Now we do delete instead of update + +# same as the second MDEV-34447 testcase but with explain +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1), (2), (3); + +CREATE PROCEDURE p1(p1 INT) + EXPLAIN DELETE FROM t1 LIMIT p1; + +CALL p1(0); +CALL p1(1); +CALL p1(2); + +--echo # Clean up +DROP TABLE t1; +DROP PROCEDURE p1; + +# partition pruning +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# same but with explain +set @var1=5; +set @var2=4; +create table t1 (a int) partition by list(a) ( + partition p0 values in (1,2), + partition p1 values in (3,4) +); +create table t2 (a int); +insert into t1 values (1),(2),(3),(4); +insert into t2 values (4); +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 where a = ?'; +execute stmt using @var1; +select * from t1; +execute stmt using @var2; +select * from t1; +deallocate prepare stmt; +drop table t1, t2; + +# top level impossible where +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +# top level impossible where, with explain +set @var1=1; +set @var2=2; +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); + +PREPARE stmt FROM 'EXPLAIN DELETE FROM t1 WHERE ?=?'; +execute stmt using @var1, @var2; +execute stmt using @var1, @var1; +deallocate prepare stmt; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-33858: Assertion `(mem_root->flags & 4) == 0' fails on 2nd execution of PS with -DWITH_PROTECT_STATEMENT_MEMROOT=ON +--echo # + +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); # Optional, fails either way +PREPARE stmt FROM "UPDATE t SET a = 0 LIMIT ?"; +EXECUTE stmt USING 0; +EXECUTE stmt USING 1; + +# CLeanup +DROP TABLE t; + +--echo # End of 10.5 tests + --echo # --echo # MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT --echo # diff --git a/mysql-test/main/ps_missed_cmds.test b/mysql-test/main/ps_missed_cmds.test index e8b4e263008..0bf12a2e477 100644 --- a/mysql-test/main/ps_missed_cmds.test +++ b/mysql-test/main/ps_missed_cmds.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } SET @save_storage_engine= @@default_storage_engine; diff --git a/mysql-test/main/ps_missed_cmds_not_embedded.test b/mysql-test/main/ps_missed_cmds_not_embedded.test index 2e7eebedf91..018334b912c 100644 --- a/mysql-test/main/ps_missed_cmds_not_embedded.test +++ b/mysql-test/main/ps_missed_cmds_not_embedded.test @@ -1,9 +1,9 @@ --source include/not_embedded.inc --source include/have_innodb.inc -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Test temporarily disabled for ps-protocol and cursor-protocol } SET @save_storage_engine= @@default_storage_engine; diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index 1df14d30d85..539c7db37cf 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -21,6 +21,7 @@ SET LOCAL query_cache_type= ON; # Reset query cache variables. +--disable_cursor_protocol flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; @@ -1806,6 +1807,7 @@ SELECT foo( LAST_INSERT_ID() ) from t1; show status like "Qcache_queries_in_cache"; DROP FUNCTION foo; drop table t1; +--enable_cursor_protocol --echo # --echo # MDEV-33861: main.query_cache fails with embedded after @@ -1861,7 +1863,9 @@ create table t1 (a text); insert into t1 values ('{"a":"foo"}'); flush global status; SHOW STATUS LIKE 'Qcache_inserts'; +--disable_cursor_protocol select * from t1, json_table(t1.a, '$' columns (f varchar(20) path '$.a')) as jt; +--enable_cursor_protocol SHOW STATUS LIKE 'Qcache_inserts'; drop table t1; diff --git a/mysql-test/main/query_cache_debug.test b/mysql-test/main/query_cache_debug.test index 5942e6f42aa..d9c6cb1c94f 100644 --- a/mysql-test/main/query_cache_debug.test +++ b/mysql-test/main/query_cache_debug.test @@ -94,7 +94,9 @@ connection con1; --reap SHOW STATUS LIKE "Qcache_queries_in_cache"; --echo # Test that it's cacheable +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol SHOW STATUS LIKE "Qcache_queries_in_cache"; disconnect con1; diff --git a/mysql-test/main/query_cache_innodb.test b/mysql-test/main/query_cache_innodb.test index 7ac96220c11..143cc5ee6d6 100644 --- a/mysql-test/main/query_cache_innodb.test +++ b/mysql-test/main/query_cache_innodb.test @@ -20,7 +20,9 @@ create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), for --disable_view_protocol insert into t1 values (1); insert into t2 values (1,1); +--disable_cursor_protocol select * from t2; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from t1; @@ -41,7 +43,9 @@ create table `t2$Ñ—` ( t2id int unsigned, id int unsigned, primary key(t2id, id) insert into `t1$Ñ—` values (1); insert into `t2$Ñ—`values (1,1); +--disable_cursor_protocol select * from `t2$Ñ—`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `t1$Ñ—`; @@ -63,7 +67,9 @@ create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2 insert into `#mysql50#t-1` values (1); insert into `#mysql50#t-2`values (1,1); +--disable_cursor_protocol select * from `#mysql50#t-2`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `#mysql50#t-1`; diff --git a/mysql-test/main/query_cache_merge.test b/mysql-test/main/query_cache_merge.test index c5951b5321c..5a90c94a90b 100644 --- a/mysql-test/main/query_cache_merge.test +++ b/mysql-test/main/query_cache_merge.test @@ -40,6 +40,7 @@ while ($1) # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol set @save_table_definition_cache= @@global.table_definition_cache; set @@global.table_definition_cache=512; create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; @@ -54,6 +55,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t2 SET @@global.query_cache_size=0; set @@global.table_definition_cache=@save_table_definition_cache; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -88,8 +90,10 @@ eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str); SET GLOBAL query_cache_size = 1048576; FLUSH STATUS; --disable_view_protocol +--disable_cursor_protocol SELECT a FROM t0 WHERE a = 1; SHOW STATUS LIKE "Qcache_queries_in_cache"; +--enable_cursor_protocol --enable_view_protocol let $c= 255; diff --git a/mysql-test/main/query_cache_notembedded.test b/mysql-test/main/query_cache_notembedded.test index 4b0da6a5553..92d861f06d3 100644 --- a/mysql-test/main/query_cache_notembedded.test +++ b/mysql-test/main/query_cache_notembedded.test @@ -26,6 +26,7 @@ drop table if exists t1, t2, t3, t11, t21; # # FLUSH QUERY CACHE # +--disable_cursor_protocol create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); @@ -85,6 +86,7 @@ flush query cache; show status like "Qcache_total_blocks"; show status like "Qcache_free_blocks"; drop table t1, t2, t3, t11, t21; +--enable_cursor_protocol # # do not use QC if tables locked (Bug#12385) @@ -114,6 +116,7 @@ disconnect root2; # improved to also test Bug#3583 and Bug#12990 # --disable_ps2_protocol +--disable_cursor_protocol flush query cache; reset query cache; flush global status; @@ -186,6 +189,7 @@ call f1(); call f3(); call f3(); call f1(); +--enable_cursor_protocol drop procedure f1; drop procedure f2; @@ -248,6 +252,7 @@ SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creat # # Bug #30269 Query cache eats memory # +--disable_cursor_protocol --disable_warnings DROP DATABASE IF EXISTS bug30269; --enable_warnings @@ -269,6 +274,7 @@ SELECT id FROM test1 WHERE id>2; show status like 'Qcache_queries_in_cache'; SELECT id FROM view1 WHERE id>2; show status like 'Qcache_queries_in_cache'; +--enable_cursor_protocol connection default; USE test; diff --git a/mysql-test/main/query_cache_with_views.test b/mysql-test/main/query_cache_with_views.test index 18b5a8323fd..498a0648081 100644 --- a/mysql-test/main/query_cache_with_views.test +++ b/mysql-test/main/query_cache_with_views.test @@ -18,6 +18,7 @@ set GLOBAL query_cache_size=1355776; flush global status; create table t1 (a int, b int); +--disable_cursor_protocol # queries with following views should not be in query cache create view v1 (c,d) as select sql_no_cache a,b from t1; create view v2 (c,d) as select a+rand(),b from t1; @@ -66,6 +67,7 @@ show status like "Qcache_hits"; drop view v1; set query_cache_type=default; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; @@ -110,6 +112,7 @@ drop table t1; # # BUG#15119: returning temptable view from the query cache. # +--disable_cursor_protocol --disable_ps2_protocol flush global status; create table t1 (a int, b int); @@ -137,6 +140,7 @@ show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index 98ad701f825..f956ef527b3 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -694,6 +694,7 @@ DROP INDEX CityName on City; CREATE INDEX Name ON City(Name); CREATE INDEX Population ON City(Population); +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol --replace_column 9 # @@ -758,6 +759,7 @@ ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test index a6359a1782b..e988dcf5baf 100644 --- a/mysql-test/main/select.test +++ b/mysql-test/main/select.test @@ -1860,10 +1860,15 @@ select wss_type from t1 where wss_type ='102935229216544104'; select wss_type from t1 where wss_type ='102935229216544093'; select wss_type from t1 where wss_type =102935229216544093; drop table t1; +--disable_cursor_protocol select 1+2,"aaaa",3.13*2.0 into @a,@b,@c; +--enable_cursor_protocol select @a; select @b; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @c; +--enable_cursor_protocol # # Test of removing redundant braces in the FROM part @@ -2213,7 +2218,10 @@ INSERT INTO t1 (SELECT * FROM t1 WHERE a = 50 AND b = 3); select found_rows(); SELECT * FROM t1; +# Check after fix MDEV-31522 +--disable_cursor_protocol select count(*) from t1; +--enable_cursor_protocol select found_rows(); select count(*) from t1 limit 2,3; select found_rows(); @@ -3752,6 +3760,7 @@ DROP TABLE t1; # # Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" # +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol CREATE TABLE t1 (a INT, b INT); @@ -3769,6 +3778,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol # # Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error @@ -3845,10 +3855,12 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (2),(3); --echo # Should not crash +--disable_cursor_protocol --error ER_SUBQUERY_NO_1_ROW SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/select_found.test b/mysql-test/main/select_found.test index dac16fdb727..abbfd6cc3ef 100644 --- a/mysql-test/main/select_found.test +++ b/mysql-test/main/select_found.test @@ -178,14 +178,19 @@ DROP TABLE t1; # # Bug #6089: queries which don't use any tables # - +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT 'foo'; +--enable_cursor_protocol SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo'; SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0; +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT FOUND_ROWS(); SELECT FOUND_ROWS(); +--enable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0; SELECT FOUND_ROWS(); diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result index f2b7e9396ba..8d44276995f 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.result +++ b/mysql-test/main/selectivity_innodb_notembedded.result @@ -229,6 +229,82 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using where +# 11.0+ will not attempt to use selectivity(key1): +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "plan_details": + { + "record_count": 1 + }, + "considered_access_paths": + [ + { + "access_type": "range", + "range_index": "PRIMARY", + "rows": 5, + "rows_after_filter": 5, + "rows_out": 2.490196078, + "cost": 0.00948507, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "rows_read": 5, + "rows_out": 2.490196078, + "cost": 0.00948507, + "uses_join_buffering": false + } + } +] +drop table t1; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_innodb_notembedded.test b/mysql-test/main/selectivity_innodb_notembedded.test index 387f7dcb7de..bc07bcad464 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.test +++ b/mysql-test/main/selectivity_innodb_notembedded.test @@ -3,6 +3,7 @@ --source include/big_test.inc --source include/default_optimizer_switch.inc --source include/not_embedded.inc +--source ./include/innodb_stable_estimates.inc SET SESSION STORAGE_ENGINE='InnoDB'; diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result index d47154fd294..d4dac4f5a51 100644 --- a/mysql-test/main/selectivity_notembedded.result +++ b/mysql-test/main/selectivity_notembedded.result @@ -224,6 +224,82 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where +# 11.0+ will not attempt to use selectivity(key1): +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "plan_details": + { + "record_count": 1 + }, + "considered_access_paths": + [ + { + "access_type": "range", + "range_index": "PRIMARY", + "rows": 5, + "rows_after_filter": 5, + "rows_out": 2.490196078, + "cost": 0.010014472, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "rows_read": 5, + "rows_out": 2.490196078, + "cost": 0.010014472, + "uses_join_buffering": false + } + } +] +drop table t1; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test index 323e4ca6bd6..f2e74b52136 100644 --- a/mysql-test/main/selectivity_notembedded.test +++ b/mysql-test/main/selectivity_notembedded.test @@ -220,6 +220,44 @@ from set optimizer_trace=@trace_tmp; drop table t1; +--echo # +--echo # MDEV-34993: Incorrect cardinality estimation causes poor query plan +--echo # + +create table t1 ( + pk int, + key1 int, + filler char(100), + index (key1, pk), + primary key (pk) +); + +insert into t1 +select + seq, FLOOR(seq/100), 'filler' +from + seq_1_to_1000; +analyze table t1; + +set optimizer_trace=1; +explain select * from t1 +where + pk in (1,2,3,4,5) and + key1 <= 4; + +--echo # 11.0+ will not attempt to use selectivity(key1): +select + json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from + information_schema.optimizer_trace; + +--echo # Must not include 1.79...e308 as cost: +select + json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from + information_schema.optimizer_trace; + +drop table t1; --echo # --echo # Clean up --echo # diff --git a/mysql-test/main/set_statement.test b/mysql-test/main/set_statement.test index b8df5b1797d..35bb8a026fe 100644 --- a/mysql-test/main/set_statement.test +++ b/mysql-test/main/set_statement.test @@ -976,6 +976,7 @@ SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; # # MDEV-6940: SET STATEMENT executed after SET GLOBAL does not work # +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol set @save_general_log=@@global.general_log; @@ -1048,6 +1049,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti --echo #--- --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol # # log_slow_verbosity is impossible to check because results are not written # in TABLE mode diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index ff84debd8d5..40fe52dd17e 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -67,7 +67,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 8 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 8 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 1 N 4097 0 8 def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 8 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 @@ -653,7 +653,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 4097 0 63 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 4097 0 63 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 6 N 4097 0 63 def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 4096 0 63 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 @@ -924,7 +924,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 192 2 N 4097 0 33 def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 36865 0 63 def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 192 7 N 4097 0 33 -def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 36865 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 3 2 1 N 36897 0 63 def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 192 1 N 4097 0 33 def information_schema STATISTICS STATISTICS COLLATION Collation 253 3 1 Y 4096 0 33 def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 36864 0 63 diff --git a/mysql-test/main/shutdown_debug.test b/mysql-test/main/shutdown_debug.test index 587b88dc55e..664b4aea25e 100644 --- a/mysql-test/main/shutdown_debug.test +++ b/mysql-test/main/shutdown_debug.test @@ -8,7 +8,9 @@ source include/have_debug.inc; call mtr.add_suppression('Thread .* did not exit'); set @old_dbug=@@global.debug_dbug; set global debug_dbug='+d,CONNECT_wait'; +--disable_cursor_protocol select variable_value into @cons from information_schema.global_status where variable_name='connections'; +--enable_cursor_protocol exec $MYSQL -e "select sleep(3600)" >/dev/null 2>&1 &; let $wait_condition= select variable_value>@cons from information_schema.global_status where variable_name='connections'; source include/wait_condition.inc; diff --git a/mysql-test/main/single_delete_update.test b/mysql-test/main/single_delete_update.test index 871fd06a67f..0ee9e95d17f 100644 --- a/mysql-test/main/single_delete_update.test +++ b/mysql-test/main/single_delete_update.test @@ -12,6 +12,7 @@ --echo # limit efficiently --echo # +--disable_cursor_protocol CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), (20),(21),(22),(23),(24),(25); @@ -459,3 +460,4 @@ SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; DROP TABLE t1, t2; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/main/sp-error.test b/mysql-test/main/sp-error.test index 584ef5a6375..4100f93d8df 100644 --- a/mysql-test/main/sp-error.test +++ b/mysql-test/main/sp-error.test @@ -12,8 +12,10 @@ drop table if exists t1, t2; # Backup the mysql.proc table --enable_prepare_warnings --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; --disable_prepare_warnings +--enable_cursor_protocol --enable_ps2_protocol # Make sure we don't have any procedures left. delete from mysql.proc; diff --git a/mysql-test/main/sp-no-valgrind.test b/mysql-test/main/sp-no-valgrind.test index 6bacc7b150c..10a238f9871 100644 --- a/mysql-test/main/sp-no-valgrind.test +++ b/mysql-test/main/sp-no-valgrind.test @@ -5,18 +5,24 @@ --echo # Warmup round, this might allocate some memory for session variable --echo # and the output +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp0() SELECT 1; SHOW CREATE PROCEDURE sp0; DROP PROCEDURE sp0; #Check that CREATE/SHOW does not use memory in caches. +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp1() SELECT 1; SHOW CREATE PROCEDURE sp1; +--disable_cursor_protocol SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol # FIXME: MDEV-26754 main.sp test fails for embedded server #SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; DROP PROCEDURE sp1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index fa983288ee0..8f3bca6b5b4 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -19,9 +19,9 @@ # Tests that require multibyte character sets, which are not always available, # go into separate files (e.g. sp-ucs2.test) -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source include/default_charset.inc @@ -3024,8 +3024,10 @@ create procedure bug5251() begin end| +--disable_cursor_protocol select created into @c1 from mysql.proc where db='test' and name='bug5251'| +--enable_cursor_protocol --sleep 2 alter procedure bug5251 comment 'foobar'| select count(*) from mysql.proc @@ -8255,12 +8257,16 @@ drop procedure if exists p; --enable_warnings set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); +--disable_cursor_protocol select @@sql_mode into @full_mode; +--enable_cursor_protocol create procedure p() as begin end; call p(); set @@sql_mode= @old_mode; # Rename SQL modes that differ in name between the server and the table definition. +--disable_cursor_protocol select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.proc where name = 'p' and sql_mode = @full_mode; drop procedure p; diff --git a/mysql-test/main/sp_trans.test b/mysql-test/main/sp_trans.test index e7adcccb9e1..653e418752e 100644 --- a/mysql-test/main/sp_trans.test +++ b/mysql-test/main/sp_trans.test @@ -612,9 +612,11 @@ drop table t3| # BUG#11758414: Default default_storage_engine not honored when set # from within a stored procedure # +--disable_cursor_protocol SELECT @@GLOBAL.default_storage_engine INTO @old_engine| SET @@GLOBAL.default_storage_engine=InnoDB| SET @@SESSION.default_storage_engine=InnoDB| +--enable_cursor_protocol # show defaults at define-time SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'| SHOW SESSION VARIABLES LIKE 'default_storage_engine'| diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index 30b2bac7da6..851bf849b6d 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -333,6 +333,7 @@ SELECT * FROM mysql.column_stats; --sorted_result SELECT * FROM mysql.index_stats; +--disable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol eval @@ -345,6 +346,7 @@ SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/save_index_stats' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM mysql.index_stats WHERE index_name IN ('idx1', 'idx4'); --enable_ps2_protocol +--enable_cursor_protocol ALTER TABLE t1 CHANGE COLUMN b x varchar(30); SHOW CREATE TABLE t1; diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test index 22b21bb345b..c5144514a0e 100644 --- a/mysql-test/main/status2.test +++ b/mysql-test/main/status2.test @@ -27,6 +27,7 @@ CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); +--disable_cursor_protocol --echo Assert Questions == 7 SHOW STATUS LIKE 'Questions'; SELECT testQuestion(); @@ -38,6 +39,7 @@ SHOW STATUS LIKE 'Questions'; SELECT 1; --echo Assert Questions == 13 SHOW STATUS LIKE 'Questions'; +--enable_cursor_protocol connect (con1,localhost,root,,); connection con1; SELECT 1; diff --git a/mysql-test/main/strict.test b/mysql-test/main/strict.test index 1819f399041..ce02003e088 100644 --- a/mysql-test/main/strict.test +++ b/mysql-test/main/strict.test @@ -60,7 +60,10 @@ INSERT INTO t1 VALUES ('2004-2-30'); set @@sql_mode='ansi,traditional'; INSERT IGNORE INTO t1 VALUES('2004-02-29'),('2004-13-15'),('0000-00-00'); +#Enable after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol drop table t1; # Test difference in behaviour with InnoDB and MyISAM tables diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 97c563b5bbe..f08177d72f3 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -76,10 +76,13 @@ SELECT ROW(1,2,3) = (SELECT 1,2,3); SELECT ROW(1,2,3) = (SELECT 1,2,1); SELECT ROW(1,2,3) < (SELECT 1,2,1); SELECT ROW(1,2,3) > (SELECT 1,2,1); +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol SELECT ROW(1,2,3) = (SELECT 1,2,NULL); --enable_view_protocol +--enable_cursor_protocol SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; @@ -521,8 +524,11 @@ select 1 IN (SELECT * from t1); select 3 IN (SELECT * from t1); select 10 IN (SELECT * from t1); select 1 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10 > ALL (SELECT * from t1); select 1 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10 > ANY (SELECT * from t1); drop table t1; create table t1 (a varchar(20)); @@ -535,8 +541,11 @@ select 'A' IN (SELECT * from t1); select 'DEF' IN (SELECT * from t1); select 'XYZS' IN (SELECT * from t1); select 'A' > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 'XYZS' > ALL (SELECT * from t1); select 'A' > ANY (SELECT * from t1); +--enable_cursor_protocol select 'XYZS' > ANY (SELECT * from t1); drop table t1; create table t1 (a float); @@ -549,15 +558,21 @@ select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol update t1 set a=NULL where a=2.5; select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10.5 > ANY (SELECT * from t1); --enable_prepare_warnings --enable_view_protocol @@ -1194,7 +1209,9 @@ let $outfile_rel= ../../tmp/subselect.out.file.1; --error 0,1 --remove_file $outfile_abs --enable_warnings +--disable_cursor_protocol eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1; +--enable_cursor_protocol delete from t1; eval load data infile "$outfile_rel" into table t1; --remove_file $outfile_abs @@ -3602,7 +3619,9 @@ DROP TABLE t1,t2; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -3640,7 +3659,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -3661,7 +3682,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5038,7 +5061,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -5055,7 +5080,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5447,8 +5474,10 @@ DROP TABLE t1,t2,t3; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); - + +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -5790,9 +5819,12 @@ DROP TABLE t1; CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM; INSERT INTO t1 VALUES ('u1'),('u2'); +#Check and enable after fix MDEV-34895 +--disable_ps2_protocol SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) ); FLUSH TABLES; SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) ); +--enable_ps2_protocol # Cleanup DROP TABLE t1; @@ -5876,10 +5908,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; flush status; flush global status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -5895,10 +5929,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; flush status; flush global status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; diff --git a/mysql-test/main/subselect3.inc b/mysql-test/main/subselect3.inc index 4cbad0a4090..e07d0c6810c 100644 --- a/mysql-test/main/subselect3.inc +++ b/mysql-test/main/subselect3.inc @@ -57,9 +57,11 @@ select a, oref, a in ( create table t3 (a int); insert into t3 values (NULL), (NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol select a in (select max(ie) from t1 where oref=4 group by grp) from t3; --enable_ps2_protocol +--enable_cursor_protocol show status like 'Handler_read_rnd_next'; select ' ^ This must show 11' Z; @@ -96,7 +98,9 @@ select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; --disable_ps2_protocol flush status; +--disable_cursor_protocol select oref, a from t2 where a in (select a from t1 where oref=t2.oref); +--enable_cursor_protocol # This will only show access to t2: show status like '%Handler_read_rnd_next'; @@ -106,7 +110,9 @@ insert into t2 values (NULL, 0),(NULL, 0), (NULL, 0), (NULL, 0); set optimizer_switch='subquery_cache=off'; flush status; +--disable_cursor_protocol select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; +--enable_cursor_protocol show status like '%Handler_read%'; select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z; set @@optimizer_switch=@save_optimizer_switch; @@ -645,9 +651,11 @@ DROP TABLE t1, t2; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); +--disable_cursor_protocol --disable_ps2_protocol select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; load data infile "../../tmp/subselect.out.file.1" into table t1; select * from t1; @@ -699,6 +707,8 @@ SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), DROP TABLE t1; +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol --echo # both columns should be same @@ -709,6 +719,7 @@ SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1); SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); --enable_view_protocol +--enable_cursor_protocol # # Bug #37362 Crash in do_field_eq @@ -816,11 +827,13 @@ set @save_optimizer_switch2=@@optimizer_switch; set optimizer_switch='subquery_cache=off'; --disable_ps2_protocol +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Check that the subquery only has to be evaluated once @@ -832,11 +845,13 @@ SHOW STATUS LIKE '%Handler_read_rnd_next'; INSERT INTO t1 VALUES (NULL, NULL); FLUSH STATUS; +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Handler_read_rnd_next should be one more than baseline @@ -982,9 +997,11 @@ set @@max_heap_table_size= 16384; explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); flush status; --disable_ps2_protocol +--disable_cursor_protocol select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); --enable_ps2_protocol show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol set @@max_heap_table_size=@save_max_heap_table_size; set @@optimizer_switch=@save_optimizer_switch; drop table t0, t1; diff --git a/mysql-test/main/subselect_cache.test b/mysql-test/main/subselect_cache.test index db095cbdcad..7bc897ea06b 100644 --- a/mysql-test/main/subselect_cache.test +++ b/mysql-test/main/subselect_cache.test @@ -24,7 +24,9 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1); --echo #single value subquery test (SELECT list) --disable_ps2_protocol flush global status; flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -44,6 +46,7 @@ select a, (select d from t2 where b=c), (select d from t2 where b=c union select set optimizer_switch='subquery_cache=off'; flush global status; flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; show status like "subquery_cache%"; @@ -174,6 +177,7 @@ select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c); show status like "subquery_cache%"; show status like '%Handler_read%'; set optimizer_switch='subquery_cache=on'; +--enable_cursor_protocol --echo #single value subquery test (PS) prepare stmt1 from 'select a, (select d from t2 where b=c) + 1 from t1'; @@ -194,6 +198,7 @@ drop procedure p1; --echo #IN subquery test flush global status; flush status; +--disable_cursor_protocol show status like "subquery_cache%"; select a, b , b in (select d from t2) as SUBS from t1; show status like "subquery_cache%"; @@ -344,6 +349,7 @@ flush global status; flush status; select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1; show status like "subquery_cache%"; show status like '%Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo #clean up @@ -428,12 +434,14 @@ DROP TABLE t1; flush global status; flush status; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); +--disable_cursor_protocol select a, a in (select a from t1) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < rand()) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext; show status like "subquery_cache%"; +--enable_cursor_protocol drop table t1; --enable_ps2_protocol @@ -461,6 +469,7 @@ insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5), (3,5), (100,3), (200,3), (10,6), (20,6), (20,7), (100,8), (200,8); insert into t2 values (1,1),(3,3),(20,20); +--disable_cursor_protocol --disable_ps2_protocol --echo aggregate function as parameter of subquery set optimizer_switch='subquery_cache=off'; @@ -487,6 +496,7 @@ select max(a), (select a from t2 where a=c) from t1 group by b; show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1,t2; @@ -501,6 +511,7 @@ insert into t1 values create table t2 (pk int, a int, primary key(pk)); insert into t2 select a,a from t0; +--disable_cursor_protocol --disable_ps2_protocol set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on'; flush global status; flush status; @@ -534,6 +545,7 @@ select * from t1 where a in (select pk from t2); show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t0,t1,t2; diff --git a/mysql-test/main/subselect_exists2in_costmat.test b/mysql-test/main/subselect_exists2in_costmat.test index dd3890496f5..9cb01f80a9a 100644 --- a/mysql-test/main/subselect_exists2in_costmat.test +++ b/mysql-test/main/subselect_exists2in_costmat.test @@ -47,9 +47,11 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol --enable_prepare_warnings select max(id) from City into @max_city_id; --disable_prepare_warnings +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_mat_cost.test b/mysql-test/main/subselect_mat_cost.test index 1a7e6caa7e1..46bed962ef7 100644 --- a/mysql-test/main/subselect_mat_cost.test +++ b/mysql-test/main/subselect_mat_cost.test @@ -54,9 +54,11 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol --enable_prepare_warnings select max(id) from City into @max_city_id; --disable_prepare_warnings +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test index 2636ddf1466..1a3816b46ab 100644 --- a/mysql-test/main/subselect_sj.test +++ b/mysql-test/main/subselect_sj.test @@ -2687,8 +2687,10 @@ CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam; INSERT INTO t3 VALUES (0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1); +--disable_cursor_protocol select @@max_heap_table_size into @tmp_max_heap_table_size; select @@join_buffer_size into @tmp_join_buffer_size; +--enable_cursor_protocol set max_heap_table_size=16*1024; --disable_query_log diff --git a/mysql-test/main/tlsv13.result b/mysql-test/main/tlsv13.result new file mode 100644 index 00000000000..772cfd85eae --- /dev/null +++ b/mysql-test/main/tlsv13.result @@ -0,0 +1,18 @@ +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +# restart: --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256 diff --git a/mysql-test/main/tlsv13.test b/mysql-test/main/tlsv13.test new file mode 100644 index 00000000000..f90b6849a86 --- /dev/null +++ b/mysql-test/main/tlsv13.test @@ -0,0 +1,43 @@ +--source include/have_ssl_communication.inc +--source include/require_openssl_client.inc +--source include/have_tlsv13.inc + +# +# BUG - SSL_CIPHER SYSTEM VARIABLE CANNOT CONFIGURE TLSV1.3 AND TLSV1.2 CIPHERS AT THE SAME TIME +# +# If users specify TLSv1.3 and TLSv1.2 ciphers, it will only configure the +# TLSv1.3 ciphers correctly but then it will keep all TLSv1.2 ciphers enabled. +# +# This is a potential security vulnerability because users trying to restrict +# secure TLSv1.3 and TLSv1.2 ciphers will unintentionally have insecure TLSv1.2 +# ciphers enabled on the database. +# +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; + +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher%';" + +# Check that other ciphers are correctly not supported by the server +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_256_GCM_SHA384 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +# TLSv1.3 ciphers are still supported if only TLSv1.2 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" + +# TLSv1.2 ciphers are not supported if only TLSv1.3 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" diff --git a/mysql-test/main/tmp_table_count-7586.test b/mysql-test/main/tmp_table_count-7586.test index 37f37541024..ff93a25039f 100644 --- a/mysql-test/main/tmp_table_count-7586.test +++ b/mysql-test/main/tmp_table_count-7586.test @@ -11,6 +11,7 @@ create table t2 (a int); insert into t2 values (1),(2),(3); create view v2 as select a from t2; +--disable_cursor_protocol flush status; select * from v2; --disable_ps_protocol @@ -23,6 +24,7 @@ select * from (select * from t2) T1; --disable_ps_protocol show status like '%Created_tmp_tables%'; --enable_ps_protocol +--enable_cursor_protocol explain select * from (select * from t2) T1; diff --git a/mysql-test/main/trigger-compat.test b/mysql-test/main/trigger-compat.test index 9c102993a6f..a8ad20073d6 100644 --- a/mysql-test/main/trigger-compat.test +++ b/mysql-test/main/trigger-compat.test @@ -68,11 +68,13 @@ let $MYSQLD_DATADIR = `select @@datadir`; eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch; # remove original t1.TRG file so SELECT INTO OUTFILE won't fail --remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG +--disable_cursor_protocol --disable_ps2_protocol eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' FROM patch; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE patch; --connection wl2818_definer_con --enable_query_log diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index f54a09bf7a4..7b5735b417a 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -634,7 +634,10 @@ set sql_mode=""; create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00'; set sql_mode="traditional"; insert into t1 values ('2004-01-01'); +#Check after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol set sql_mode=default; show create table t1; --replace_column 6 # diff --git a/mysql-test/main/type_binary.test b/mysql-test/main/type_binary.test index bfc9222762a..495c776cc75 100644 --- a/mysql-test/main/type_binary.test +++ b/mysql-test/main/type_binary.test @@ -135,6 +135,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a VARCHAR(39)); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT @@ -155,6 +157,7 @@ SELECT FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index 9b96b15a42f..5f8b0d0af2f 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -461,7 +461,10 @@ SHOW CREATE TABLE t2; DROP TABLE t2; --enable_metadata --disable_view_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT COALESCE(val, 1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata DROP TABLE t1; diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test index ade138ca851..52eee2bfa28 100644 --- a/mysql-test/main/type_date.test +++ b/mysql-test/main/type_date.test @@ -211,12 +211,15 @@ CREATE TABLE t2 (a DATE); CREATE INDEX i ON t1 (a); INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00'); INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00'); +#Check after fix MDEV-31516 +--disable_cursor_protocol SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; +--enable_cursor_protocol --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('1000-00-00'); SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test index 0d600f29cae..8ffee4f9866 100644 --- a/mysql-test/main/type_enum.test +++ b/mysql-test/main/type_enum.test @@ -237,7 +237,10 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (1),(2); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT AVG(f1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index 5fc20fb1557..436b3e13ef5 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -320,8 +320,10 @@ let $nine_65= select format(-1.7976931348623157E+307,256) as foo; select least(-1.1111111111111111111111111, - group_concat(1.7976931348623157E+308)) as foo; +--disable_cursor_protocol eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), ($nine_65)) into @a; +--enable_cursor_protocol --enable_result_log --echo End of 5.0 tests @@ -337,6 +339,8 @@ select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; --echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --echo # +#enable after fix MDEV-34213 +--disable_cursor_protocol #enable after fix MDEV-29552 --disable_view_protocol SELECT LEFT('a',EXP(50)); @@ -347,6 +351,7 @@ CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (1e30); SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; DROP TABLE t1; +--enable_cursor_protocol PREPARE stmt FROM 'SELECT LEFT(111,?)'; SET @a=1e30; diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index af9da5395c0..8de814c64b9 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -609,12 +609,15 @@ select round(99999999999999999.999,3); select round(-99999999999999999.999,3); #-- should return -100000000000000000.000 # +#enable after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28660 --disable_view_protocol select truncate(99999999999999999999999999999999999999,49); #-- should return 99999999999999999999999999999999999999.000 # --enable_view_protocol +--enable_cursor_protocol select truncate(99.999999999999999999999999999999999999,49); #-- should return 99.9999999999999999999999999999999 # @@ -1266,11 +1269,12 @@ DROP TABLE t1; let $nine_81= 999999999999999999999999999999999999999999999999999999999999999999999999999999999; - #view protocol generates additional warning --disable_view_protocol eval SELECT substring(('M') FROM ($nine_81)) AS foo; --enable_view_protocol +#check after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28661 --disable_view_protocol eval SELECT min($nine_81) AS foo; @@ -1284,6 +1288,7 @@ eval SELECT date_sub(($nine_81), day_minute) AS foo; eval SELECT truncate($nine_81, 28) AS foo; +--enable_cursor_protocol --enable_view_protocol --echo End of 5.0 tests diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index bee6614420c..d208759fca1 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -740,9 +740,11 @@ FLUSH TABLES; # 0xFF - record flags # 0x77777777 - TIMESTAMP integer part # 0xFFFFFF - TIMESTAMP bad fractional part +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY '' --enable_ps2_protocol +--enable_cursor_protocol --eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD --enable_query_log SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1; @@ -857,7 +859,10 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM; INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01'),('2003-01-01'); SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a; +#Enable after fix MDEV-31730 +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1) - a FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index 98f266587b1..29fc0de6223 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -160,7 +160,10 @@ DROP TABLE t1; CREATE TABLE t1(c1 YEAR(4)); INSERT INTO t1 VALUES (1901),(2155),(0000); SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +--enable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1; DROP TABLE t1; --enable_view_protocol diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index d87d446f733..11717eb43b1 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -250,6 +250,8 @@ DROP FUNCTION avgcost; #enable view prtotocol after fix MDEV-28677 --disable_view_protocol +#check after fix MDEV-31587 +--disable_cursor_protocol select * from mysql.func; --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; @@ -262,6 +264,7 @@ select * from mysql.func; --error 1305 select is_const(3); +--enable_cursor_protocol --enable_view_protocol # @@ -270,6 +273,8 @@ select is_const(3); --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; +#check after fix MDEV-31587 +--disable_cursor_protocol select is_const(3) as const, is_const(3.14) as const, @@ -297,6 +302,7 @@ select from bug18761; drop table bug18761; +--enable_cursor_protocol --error 1241 select is_const((1,2,3)); diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index f43b1b58847..39125ee8927 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -1119,6 +1119,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); +--disable_cursor_protocol -- echo # Tests fix in parser rule select_derived_union. SELECT a INTO @v FROM ( SELECT a FROM t1 @@ -1160,6 +1161,7 @@ SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO @v FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1; +--enable_cursor_protocol DROP TABLE t1; remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*; diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 509ffcc13e3..4f69c7a9ba6 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -238,9 +238,11 @@ insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0); # the view protocol creates an additional statistics data --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol flush status; select a from t1 order by a limit 1; show status like 'handler_read%'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -348,6 +350,7 @@ INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; +--disable_cursor_protocol --disable_ps2_protocol flush status; SELECT user_id FROM t1 WHERE request_id=9999999999999; @@ -359,6 +362,7 @@ show status like '%Handler_read%'; UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/user_var.test b/mysql-test/main/user_var.test index 15bc527601c..5a88c888d1d 100644 --- a/mysql-test/main/user_var.test +++ b/mysql-test/main/user_var.test @@ -293,7 +293,9 @@ drop table t1; # CREATE TABLE t1(a INT, b INT); INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20); +--disable_cursor_protocol SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; +--enable_cursor_protocol SELECT @a, @b; SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; DROP TABLE t1; @@ -387,7 +389,9 @@ DROP TABLE t1; # SAME USER VARIABLE = CRASH # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol --echo End of 5.1 tests @@ -462,7 +466,9 @@ DROP TABLE t1; --echo # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol # # MDEV-616 LP BUG#1002126 diff --git a/mysql-test/main/userstat-badlogin-4824.test b/mysql-test/main/userstat-badlogin-4824.test index e14eded3020..96b4368a707 100644 --- a/mysql-test/main/userstat-badlogin-4824.test +++ b/mysql-test/main/userstat-badlogin-4824.test @@ -14,7 +14,9 @@ set global userstat=1; --disable_ps2_protocol connect(foo, localhost, foo, foo, "*NO-ONE*"); +--disable_cursor_protocol select 1; +--enable_cursor_protocol disconnect foo; connection default; diff --git a/mysql-test/main/userstat.test b/mysql-test/main/userstat.test index fbf0de8dd88..d0f5499392b 100644 --- a/mysql-test/main/userstat.test +++ b/mysql-test/main/userstat.test @@ -9,8 +9,10 @@ --enable_prepare_warnings --disable_ps2_protocol +--disable_cursor_protocol select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; --disable_prepare_warnings +--enable_cursor_protocol show columns from information_schema.client_statistics; show columns from information_schema.user_statistics; show columns from information_schema.index_statistics; @@ -28,6 +30,7 @@ update t1 set b=1; update t1 set b=5 where a=2; delete from t1 where a=3; +--disable_cursor_protocol /* Empty query */ select * from t1 where a=999; @@ -37,11 +40,11 @@ drop table t1; --connect (ssl_con,localhost,root,,,,,SSL) SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --connection default +--enable_cursor_protocol # # Test the commit and rollback are counted # - create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; insert into t1 values(1,1); @@ -54,11 +57,13 @@ insert into t1 values(3,3); rollback; drop table t1; +--disable_cursor_protocol select sleep(1); show status like "rows%"; show status like "ha%"; select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key"; +--enable_cursor_protocol --disconnect ssl_con diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test index af89c1d0247..be3b83d0ea6 100644 --- a/mysql-test/main/variables.test +++ b/mysql-test/main/variables.test @@ -65,7 +65,10 @@ set @test_int=null,@test_double=null,@test_string=null,@test_string2=null; select @test_int,@test_double,@test_string,@test_string2; select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @t5; +--enable_cursor_protocol # # Test problem with WHERE and variables @@ -372,7 +375,9 @@ select @@key_buffer_size; select * from t1 where a=2; select * from t2 where a=3; check table t1,t2; +--disable_cursor_protocol select max(a) +1, max(a) +2 into @xx,@yy from t1; +--enable_cursor_protocol drop table t1,t2; # @@ -595,7 +600,9 @@ set global sql_mode=repeat('a',80); # create table t1 (a int); +--disable_cursor_protocol select a into @x from t1; +--enable_cursor_protocol show warnings; drop table t1; @@ -1130,7 +1137,9 @@ SET @@global.thread_stack= 7; # Bug #40657 - assertion with out of range variables and traditional sql_mode # +--disable_cursor_protocol SELECT @@global.expire_logs_days INTO @old_eld; +--enable_cursor_protocol SET GLOBAL expire_logs_days = -1; --echo needs to've been adjusted (0) @@ -1166,10 +1175,12 @@ SET GLOBAL auto_increment_offset=0; # # Bug#41030 Wrong meta data (incorrect fieldlen) # - +#Check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select @@default_storage_engine; --disable_metadata +--enable_cursor_protocol # # Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 26346dc666b..d7bfe514284 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6995,6 +6995,37 @@ DROP VIEW v2; DROP TABLE t; # End of 10.4 tests # +# MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +# in definition is failed with error +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE; +SELECT * FROM v1; +1 +1 +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from `t1` union select 1 AS `1` from DUAL where 1 group by 1 having 1 order by 1 for update latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE); +SELECT * FROM v1; +1 +1 +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from `t1` union (select 1 AS `1` from DUAL where 1 group by 1 having 1 for update) latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +# End of 10.5 tests +# # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct # CREATE TABLE t1 (id int, foo int); diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index ba4ca471a91..adec8702da5 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -2049,7 +2049,9 @@ flush status; flush global status; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -2060,9 +2062,11 @@ set @tmp=@@optimizer_switch; set @@optimizer_switch='derived_merge=OFF'; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol --disable_ps2_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -3119,6 +3123,7 @@ DROP VIEW IF EXISTS v1; let $query = SELECT * FROM (SELECT 1) AS t into @w; +--disable_cursor_protocol --enable_prepare_warnings eval $query; --error ER_PARSE_ERROR @@ -3126,6 +3131,7 @@ eval CREATE VIEW v1 AS $query; --echo # Previously the following would fail. eval $query; --disable_prepare_warnings +--enable_cursor_protocol # # Bug#24532 The return data type of IS TRUE is different from similar operations @@ -4165,6 +4171,7 @@ INSERT INTO t2 VALUES (9,90), (16, 160), (11,110), (1,10), (18,180), (2,20), (14,140), (15, 150), (12,120), (3,30), (17,170), (19,190); +--disable_cursor_protocol EXPLAIN EXTENDED SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8; FLUSH STATUS; @@ -4184,6 +4191,7 @@ SHOW STATUS LIKE 'Handler_read_%'; set statement optimizer_where_cost=100 FOR explain extended SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8; DROP VIEW v; +--enable_cursor_protocol DROP TABLE t1, t2; --enable_ps2_protocol @@ -6743,6 +6751,38 @@ DROP TABLE t; --echo # End of 10.4 tests +--echo # +--echo # MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +--echo # in definition is failed with error +--echo # + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE; + +SELECT * FROM v1; +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 + UNION + (SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE); +SELECT * FROM v1; + +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # End of 10.5 tests + --echo # --echo # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct --echo # diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index f106808bd18..765bc3ea7a4 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -691,15 +691,19 @@ use test; create view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def1 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; create definer=`test14256`@`%` view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def2 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; select @v1def1, @v1def2, @v1def1=@v1def2; diff --git a/mysql-test/main/wl4435_generated.inc b/mysql-test/main/wl4435_generated.inc index 5ea05a89402..df039c6347e 100644 --- a/mysql-test/main/wl4435_generated.inc +++ b/mysql-test/main/wl4435_generated.inc @@ -288,7 +288,10 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; +#Enable after fix MDEV-31495 +--disable_cursor_protocol SELECT @a, @a = 123.456789; +--enable_cursor_protocol DROP TEMPORARY TABLE tmp1; DROP PROCEDURE p1; diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index d8f2e745b45..3bc273d537c 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -250,7 +250,7 @@ my @opt_skip_test_list; our $opt_ssl_supported; our $opt_ps_protocol; my $opt_sp_protocol; -my $opt_cursor_protocol; +our $opt_cursor_protocol; my $opt_view_protocol; my $opt_non_blocking_api; @@ -5592,11 +5592,12 @@ sub start_check_testcase ($$$) { } my $errfile= "$opt_vardir/tmp/$name.err"; - My::Debugger::setup_client_args(\$args, \$exe_mysqltest); + my $exe= $exe_mysqltest; + My::Debugger::setup_client_args(\$args, \$exe); my $proc= My::SafeProcess->new ( name => $name, - path => $exe_mysqltest, + path => $exe, error => $errfile, output => $errfile, args => \$args, diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index 3e5e024ab88..760ae124540 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -18,7 +18,7 @@ sub skip_combinations { $skip{'include/platform.combinations'} = [ 'aix', 'win' ]; } - if ( $::opt_ps_protocol ) { + if ( $::opt_ps_protocol || $::opt_cursor_protocol) { $skip{'include/protocol.combinations'} = [ 'nm' ]; } else { $skip{'include/protocol.combinations'} = [ 'ps' ]; @@ -74,6 +74,8 @@ sub skip_combinations { $skip{'main/openssl_6975.test'} = 'no or wrong openssl version' unless $openssl_ver ge "1.0.1d" and $openssl_ver lt "1.1.1"; $skip{'main/func_kdf.combinations'} = [ $ssl_lib =~ /OpenSSL 1\.0\./ ? 'new' : 'old' ]; + $skip{'main/tlsv13.test'} = 'does not work with OpenSSL <= 1.1.1' + unless $ssl_lib =~ /WolfSSL/ or $openssl_ver ge "3.0.0"; sub utf8_command_line_ok() { if (IS_WINDOWS) { diff --git a/mysql-test/suite/archive/rnd_pos.test b/mysql-test/suite/archive/rnd_pos.test index 52e32fae0f9..ab57faed3b7 100644 --- a/mysql-test/suite/archive/rnd_pos.test +++ b/mysql-test/suite/archive/rnd_pos.test @@ -11,9 +11,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; @@ -24,9 +26,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; diff --git a/mysql-test/suite/binlog/include/database.test b/mysql-test/suite/binlog/include/database.test index e61198b2da2..a55cd7c5002 100644 --- a/mysql-test/suite/binlog/include/database.test +++ b/mysql-test/suite/binlog/include/database.test @@ -44,9 +44,11 @@ CREATE TABLE t2(c1 INT); let $prefix= `SELECT UUID()`; --echo # Create a file in the database directory --replace_result $prefix FAKE_FILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix'; --enable_ps2_protocol +--enable_cursor_protocol --echo --echo # 'DROP DATABASE' will fail if there is any other file in the the diff --git a/mysql-test/suite/binlog/r/binlog_mdev25611.result b/mysql-test/suite/binlog/r/binlog_mdev25611.result new file mode 100644 index 00000000000..04204a89f4e --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mdev25611.result @@ -0,0 +1,28 @@ +*** MDEV-25611: RESET MASTER hangs waiting for InnoDB to flush its log +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid"; +SET @old_flush= @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +SET @old_flush_timeout= @@GLOBAL.innoDB_flush_log_at_timeout; +SET GLOBAL innoDB_flush_log_at_timeout=2700; +connection default; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (3,1); +connect stop_purge,localhost,root,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +INSERT INTO t1 VALUES (4,2); +DELETE FROM t1 WHERE a in (1,2,3); +FLUSH BINARY LOGS; +connection stop_purge; +ROLLBACK; +connection default; +disconnect stop_purge; +RESET MASTER; +connection default; +DROP TABLE t1; +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL innodb_flush_log_at_trx_commit= @old_flush; +SET GLOBAL innoDB_flush_log_at_timeout= @old_flush_timeout; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result new file mode 100644 index 00000000000..6ce0f2d63e5 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_warn_stop_datetime.result @@ -0,0 +1,23 @@ + +# MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-datetime + +set timestamp=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +set timestamp=1000000010; +INSERT INTO t1 VALUES ("abirvalg"); +set timestamp=1000000020; +INSERT INTO t1 SELECT * FROM t1; +flush logs; +Case: Default, must not see warning. +# MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime before EOF, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime between records, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime at EOF, must not see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +Case: Stop datetime after EOF, must see warning. +# MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +WARNING: Did not reach stop datetime '2035-01-19 03:14:05' before end of input +DROP TABLE t1; +# End of binlog_mysqlbinlog_warn_stop_datetime.test diff --git a/mysql-test/suite/binlog/t/binlog_commit_wait.test b/mysql-test/suite/binlog/t/binlog_commit_wait.test index 7d7af2a90e2..dbd0e41407f 100644 --- a/mysql-test/suite/binlog/t/binlog_commit_wait.test +++ b/mysql-test/suite/binlog/t/binlog_commit_wait.test @@ -15,6 +15,7 @@ connect(con3,localhost,root,,test); # Get Initial status measurements --connection default +--disable_cursor_protocol SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status @@ -23,6 +24,7 @@ SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema WHERE variable_name = 'binlog_group_commit_trigger_timeout'; SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; +--enable_cursor_protocol # Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is # counted near when the groups its finalised. diff --git a/mysql-test/suite/binlog/t/binlog_mdev25611.test b/mysql-test/suite/binlog/t/binlog_mdev25611.test new file mode 100644 index 00000000000..fc40db8c1f5 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mdev25611.test @@ -0,0 +1,55 @@ +source include/have_innodb.inc; +source include/have_debug.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_mixed.inc; + +--echo *** MDEV-25611: RESET MASTER hangs waiting for InnoDB to flush its log +# Error injection to minimize extra log flushing inside innodb. +SET @old_dbug= @@global.DEBUG_DBUG; +SET GLOBAL debug_dbug="+d,ib_log_checkpoint_avoid"; +# Couple other settings that reduce redo log flushing, thus potentially +# triggering the hang. +SET @old_flush= @@GLOBAL.innodb_flush_log_at_trx_commit; +SET GLOBAL innodb_flush_log_at_trx_commit= 0; +SET @old_flush_timeout= @@GLOBAL.innoDB_flush_log_at_timeout; +SET GLOBAL innoDB_flush_log_at_timeout=2700; + +--connection default +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (3,1); + +connect (stop_purge,localhost,root,,); +# This blocks purge due to old data being still visible. +START TRANSACTION WITH CONSISTENT SNAPSHOT; + +--connection default +INSERT INTO t1 VALUES (4,2); +DELETE FROM t1 WHERE a in (1,2,3); + +# Rotate the binlog and wait for everything to settle down and latest binlog +# checkpoint to be done. The small sleep helps trigger the bug more reliably +# before the fix. +FLUSH BINARY LOGS; +--sleep 0.1 + +# Now unblock the purge, and wait for some purge records to be written +# to the redo log so the LSN is incremented but will not be synced to +# disk until something else happens. +--connection stop_purge +ROLLBACK; +--connection default +--disconnect stop_purge + +--sleep 0.1 + +# Now see if RESET MASTER will request and wait for a binlog checkpoint that is never reported. +RESET MASTER; + +# Clean up. +--connection default +DROP TABLE t1; +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL innodb_flush_log_at_trx_commit= @old_flush; +SET GLOBAL innoDB_flush_log_at_timeout= @old_flush_timeout; diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test index 3e18ef1e351..420a00462ee 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test @@ -7,7 +7,9 @@ CREATE TABLE t (a TEXT); # events of interest are guaranteed to stay in 000001 log RESET MASTER; --eval INSERT INTO t SET a=repeat('a', 1024) +--disable_cursor_protocol SELECT a into @a from t; +--enable_cursor_protocol FLUSH LOGS; DELETE FROM t; diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test new file mode 100644 index 00000000000..9d30544c5f4 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_warn_stop_datetime.test @@ -0,0 +1,42 @@ +--echo +--echo # MDEV-27037 mysqlbinlog emits a warning when reaching EOF before stop-datetime +--echo + +--source include/have_binlog_format_statement.inc + +--let ignored_output_file= $MYSQLTEST_VARDIR/tmp/warn_pos_test_file.out + +set timestamp=1000000000; +CREATE TABLE t1(word VARCHAR(20)); +set timestamp=1000000010; +INSERT INTO t1 VALUES ("abirvalg"); +set timestamp=1000000020; +INSERT INTO t1 SELECT * FROM t1; +--let MYSQLD_DATADIR= `select @@datadir;` +flush logs; + +--echo Case: Default, must not see warning. +--echo # MYSQL_BINLOG --short-form MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime before EOF, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:50' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime between records, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime at EOF, must not see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2001-09-08 21:46:55' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +--echo Case: Stop datetime after EOF, must see warning. +--echo # MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' MYSQLD_DATADIR/master-bin.000001 --result-file=ignored_output_file +--exec $MYSQL_BINLOG --short-form --stop-datetime='2035-01-19 03:14:05' $MYSQLD_DATADIR/master-bin.000001 --result-file=$ignored_output_file 2>&1 + +DROP TABLE t1; + +--remove_file $ignored_output_file + +--echo # End of binlog_mysqlbinlog_warn_stop_datetime.test diff --git a/mysql-test/suite/compat/oracle/t/update_innodb.test b/mysql-test/suite/compat/oracle/t/update_innodb.test index 79660920901..38030e04c23 100644 --- a/mysql-test/suite/compat/oracle/t/update_innodb.test +++ b/mysql-test/suite/compat/oracle/t/update_innodb.test @@ -8,8 +8,10 @@ SET sql_mode='ORACLE'; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb; INSERT INTO t1 VALUES (1); START TRANSACTION; +--disable_cursor_protocol --enable_prepare_warnings SELECT a AS a_con1 FROM t1 INTO @a FOR UPDATE; +--enable_cursor_protocol --connect(con2,localhost,root,,) SET sql_mode='ORACLE'; diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result index fd095f70bf2..3fc44be95aa 100644 --- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result +++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result @@ -1,6 +1,8 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted; key_version=1"); call mtr.add_suppression("InnoDB: Recovery failed to read page"); -call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[12]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test/t[12]\\.ibd' page \\[page id: space=[1-9][0-9]*, page number=3\\]"); +call mtr.add_suppression("InnoDB: File '.*test/t[12]\\.ibd' is corrupted"); call mtr.add_suppression("Table `test`\\.`t[12]` is corrupted"); # Restart mysqld --file-key-management-filename=keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test index 124b3ed17a2..83aac811f7c 100644 --- a/mysql-test/suite/encryption/t/innodb-compressed-blob.test +++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test @@ -6,7 +6,9 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted; key_version=1"); call mtr.add_suppression("InnoDB: Recovery failed to read page"); -call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[12]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test/t[12]\\.ibd' page \\[page id: space=[1-9][0-9]*, page number=3\\]"); +call mtr.add_suppression("InnoDB: File '.*test/t[12]\\.ibd' is corrupted"); call mtr.add_suppression("Table `test`\\.`t[12]` is corrupted"); --echo # Restart mysqld --file-key-management-filename=keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test index 83abb783c9e..c48e5cf5c73 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test @@ -2,6 +2,7 @@ --source include/have_innodb.inc --source include/have_file_key_management_plugin.inc +--disable_cursor_protocol SELECT CAST(variable_value AS INT) INTO @old_encrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; @@ -9,6 +10,7 @@ WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; SELECT CAST(variable_value AS INT) INTO @old_decrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted'; +--enable_cursor_protocol CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB; INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192; diff --git a/mysql-test/suite/engines/funcs/t/ld_null.test b/mysql-test/suite/engines/funcs/t/ld_null.test index 50cbce78044..e01c473baf3 100644 --- a/mysql-test/suite/engines/funcs/t/ld_null.test +++ b/mysql-test/suite/engines/funcs/t/ld_null.test @@ -3,7 +3,9 @@ DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '../../tmp/t1.dat' FROM t1; +--enable_cursor_protocol SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; --disable_query_log @@ -15,7 +17,9 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null2.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ESCAPED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1-2.dat' FIELDS ESCAPED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/ld_quote.test b/mysql-test/suite/engines/funcs/t/ld_quote.test index 89636fff2bb..b66a5e24ed8 100644 --- a/mysql-test/suite/engines/funcs/t/ld_quote.test +++ b/mysql-test/suite/engines/funcs/t/ld_quote.test @@ -4,7 +4,9 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10)); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_quote.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.dat' FIELDS ENCLOSED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/iuds/t/insert_calendar.test b/mysql-test/suite/engines/iuds/t/insert_calendar.test index 5d8380a1496..f957891bb1e 100644 --- a/mysql-test/suite/engines/iuds/t/insert_calendar.test +++ b/mysql-test/suite/engines/iuds/t/insert_calendar.test @@ -78,8 +78,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -152,8 +155,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -868,8 +874,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24 09:15:28'; @@ -942,8 +951,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26 00:00:00'; @@ -1016,8 +1028,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28 00:00:00'; @@ -2070,8 +2085,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2144,8 +2162,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -2864,8 +2885,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2938,8 +2962,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -3012,8 +3039,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; @@ -4067,8 +4097,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4141,8 +4174,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -4854,8 +4890,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4928,8 +4967,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -5002,8 +5044,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; diff --git a/mysql-test/suite/engines/iuds/t/insert_decimal.test b/mysql-test/suite/engines/iuds/t/insert_decimal.test index c75fa19506e..d6e1b43d0bf 100644 --- a/mysql-test/suite/engines/iuds/t/insert_decimal.test +++ b/mysql-test/suite/engines/iuds/t/insert_decimal.test @@ -60,8 +60,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -134,8 +137,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -388,8 +394,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -462,8 +471,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -711,8 +723,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -785,8 +800,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; diff --git a/mysql-test/suite/engines/iuds/t/insert_time.test b/mysql-test/suite/engines/iuds/t/insert_time.test index 0e5e21507a9..8a7a822b934 100644 --- a/mysql-test/suite/engines/iuds/t/insert_time.test +++ b/mysql-test/suite/engines/iuds/t/insert_time.test @@ -77,8 +77,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2009-01-17'; diff --git a/mysql-test/suite/events/events_bugs.test b/mysql-test/suite/events/events_bugs.test index 04ce048a364..421f3eaf33f 100644 --- a/mysql-test/suite/events/events_bugs.test +++ b/mysql-test/suite/events/events_bugs.test @@ -966,7 +966,9 @@ DROP USER evtest1@localhost; # scheduler to detect that --echo Sleep 4 seconds sleep 4; +--disable_cursor_protocol SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log; +--enable_cursor_protocol # Give the event mechanism ~ 4 seconds to do something wrong # (execute the event of the dropped user -> inser rows). --echo Sleep 4 seconds @@ -1186,9 +1188,11 @@ drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); create event e1 on schedule every 1 day do select 1; +--disable_cursor_protocol select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.event where name = 'e1' and sql_mode = @full_mode; drop event e1; diff --git a/mysql-test/suite/federated/federatedx_create_handlers.test b/mysql-test/suite/federated/federatedx_create_handlers.test index d5a5f3dbb18..22a94759678 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.test +++ b/mysql-test/suite/federated/federatedx_create_handlers.test @@ -8,6 +8,9 @@ ALTER DATABASE federated CHARACTER SET latin1; set global federated_pushdown=1; +#Enable after fix MDEV-31846 or in v. 10.5 and later +--disable_cursor_protocol + connection slave; DROP TABLE IF EXISTS federated.t1; @@ -859,4 +862,6 @@ connection default; set global federated_pushdown=0; +--enable_cursor_protocol + source include/federated_cleanup.inc; diff --git a/mysql-test/suite/funcs_1/datadict/datadict.pre b/mysql-test/suite/funcs_1/datadict/datadict.pre index cedc24aad13..4082ab7be31 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict.pre +++ b/mysql-test/suite/funcs_1/datadict/datadict.pre @@ -21,11 +21,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index fe770d1cb53..ec9ea6c3370 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -16,11 +16,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc index b3d0ef4cca5..12257cad1ce 100644 --- a/mysql-test/suite/funcs_1/datadict/is_tables.inc +++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc @@ -337,9 +337,11 @@ WHERE table_name = 't1_my_tablex'; ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1; SELECT table_name, checksum IS NOT NULL FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--disable_cursor_protocol SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # Enforce a time difference bigger than the smallest unit (1 second). --real_sleep 1.1 INSERT INTO db_datadict.t1_my_tablex SET f1 = 3; @@ -354,8 +356,10 @@ FROM information_schema.tables WHERE table_name = 't1_my_tablex'; # # Information is used later +--disable_cursor_protocol SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # # Check impact of DROP TABLE SELECT table_name FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index ae45f793e82..af3a942015b 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -470,7 +470,7 @@ def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) select NEVER NULL NO NO def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) select NEVER NULL NO NO def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NEVER NULL NO NO -def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) select NEVER NULL NO NO +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO int NULL NULL 10 0 NULL NULL NULL int(2) unsigned select NEVER NULL NO NO def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL NO NO def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select NEVER NULL NO NO def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NEVER NULL NO NO @@ -1138,7 +1138,7 @@ NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5) NULL information_schema STATISTICS NON_UNIQUE bigint NULL NULL NULL NULL bigint(1) 3.0000 information_schema STATISTICS INDEX_SCHEMA varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema STATISTICS INDEX_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) -NULL information_schema STATISTICS SEQ_IN_INDEX bigint NULL NULL NULL NULL bigint(2) +NULL information_schema STATISTICS SEQ_IN_INDEX int NULL NULL NULL NULL int(2) unsigned 3.0000 information_schema STATISTICS COLUMN_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema STATISTICS COLLATION varchar 1 3 utf8mb3 utf8mb3_general_ci varchar(1) NULL information_schema STATISTICS CARDINALITY bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 4da218a3951..2afc7e9094e 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -405,7 +405,7 @@ def information_schema STATISTICS INDEX_TYPE 14 NULL NO varchar 16 48 NULL NULL def information_schema STATISTICS NON_UNIQUE 4 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(1) NEVER NULL NO NO def information_schema STATISTICS NULLABLE 13 NULL NO varchar 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(3) NEVER NULL NO NO def information_schema STATISTICS PACKED 12 NULL YES varchar 10 30 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) NEVER NULL NO NO -def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO bigint NULL NULL 19 0 NULL NULL NULL bigint(2) NEVER NULL NO NO +def information_schema STATISTICS SEQ_IN_INDEX 7 NULL NO int NULL NULL 10 0 NULL NULL NULL int(2) unsigned NEVER NULL NO NO def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL NO NO def information_schema STATISTICS TABLE_CATALOG 1 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL NO NO def information_schema STATISTICS TABLE_NAME 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) NEVER NULL NO NO @@ -1007,7 +1007,7 @@ NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5) NULL information_schema STATISTICS NON_UNIQUE bigint NULL NULL NULL NULL bigint(1) 3.0000 information_schema STATISTICS INDEX_SCHEMA varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema STATISTICS INDEX_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) -NULL information_schema STATISTICS SEQ_IN_INDEX bigint NULL NULL NULL NULL bigint(2) +NULL information_schema STATISTICS SEQ_IN_INDEX int NULL NULL NULL NULL int(2) unsigned 3.0000 information_schema STATISTICS COLUMN_NAME varchar 64 192 utf8mb3 utf8mb3_general_ci varchar(64) 3.0000 information_schema STATISTICS COLLATION varchar 1 3 utf8mb3 utf8mb3_general_ci varchar(1) NULL information_schema STATISTICS CARDINALITY bigint NULL NULL NULL NULL bigint(21) diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 809c287d8d6..f271913d329 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -34,7 +34,7 @@ TABLE_NAME varchar(64) NO NULL NON_UNIQUE bigint(1) NO NULL INDEX_SCHEMA varchar(64) NO NULL INDEX_NAME varchar(64) NO NULL -SEQ_IN_INDEX bigint(2) NO NULL +SEQ_IN_INDEX int(2) unsigned NO NULL COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL @@ -54,7 +54,7 @@ STATISTICS CREATE TEMPORARY TABLE `STATISTICS` ( `NON_UNIQUE` bigint(1) NOT NULL, `INDEX_SCHEMA` varchar(64) NOT NULL, `INDEX_NAME` varchar(64) NOT NULL, - `SEQ_IN_INDEX` bigint(2) NOT NULL, + `SEQ_IN_INDEX` int(2) unsigned NOT NULL, `COLUMN_NAME` varchar(64) NOT NULL, `COLLATION` varchar(1), `CARDINALITY` bigint(21), @@ -74,7 +74,7 @@ TABLE_NAME varchar(64) NO NULL NON_UNIQUE bigint(1) NO NULL INDEX_SCHEMA varchar(64) NO NULL INDEX_NAME varchar(64) NO NULL -SEQ_IN_INDEX bigint(2) NO NULL +SEQ_IN_INDEX int(2) unsigned NO NULL COLUMN_NAME varchar(64) NO NULL COLLATION varchar(1) YES NULL CARDINALITY bigint(21) YES NULL diff --git a/mysql-test/suite/funcs_1/storedproc/param_check.inc b/mysql-test/suite/funcs_1/storedproc/param_check.inc index 203187f92b1..72c5ce15bc1 100644 --- a/mysql-test/suite/funcs_1/storedproc/param_check.inc +++ b/mysql-test/suite/funcs_1/storedproc/param_check.inc @@ -32,12 +32,16 @@ eval UPDATE t1_aux SET f1 = NULL; # Enforce that all user variables have the same data type and initial value. +--disable_cursor_protocol SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval UPDATE t1_aux SET f1 = $test_value; --enable_warnings +--disable_cursor_protocol SELECT f1 INTO @v1_tab FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval CALL sproc_1($test_value, @v1_proc); eval SET @v1_func = func_1($test_value); diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index 7d5a1ee3872..9f52d7644f4 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -176,9 +176,11 @@ SELECT 1 AS my_col FROM information_schema.tables WHERE table_name = 't1_third'; # # SELECT INTO USER VARIABLE +--disable_cursor_protocol SELECT table_name,table_schema INTO @table_name,@table_schema FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1; +--enable_cursor_protocol SELECT @table_name,@table_schema; # # SELECT INTO OUTFILE @@ -186,6 +188,7 @@ let $OUTFILE = $MYSQLTEST_VARDIR/tmp/datadict.out; --error 0,1 remove_file $OUTFILE; --replace_result $OUTFILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT table_name,table_schema INTO OUTFILE '$OUTFILE' @@ -194,6 +197,7 @@ LINES TERMINATED BY '\n' FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name; --enable_ps2_protocol +--enable_cursor_protocol cat_file $OUTFILE; remove_file $OUTFILE; # diff --git a/mysql-test/suite/funcs_1/t/row_count_func.test b/mysql-test/suite/funcs_1/t/row_count_func.test index fb207681bc6..4c3466f7a13 100644 --- a/mysql-test/suite/funcs_1/t/row_count_func.test +++ b/mysql-test/suite/funcs_1/t/row_count_func.test @@ -18,9 +18,11 @@ INSERT INTO t1 VALUES (1), (2), (3); --enable_info --echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt"; --disable_query_log # to avoid $MYSQL_TMP_DIR in query log +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * FROM t1 INTO OUTFILE "$MYSQL_TMP_DIR/bug21818.txt" --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --disable_info @@ -32,9 +34,11 @@ SELECT ROW_COUNT(); --echo --echo # -- Check 2. +--disable_cursor_protocol --enable_info SELECT a FROM t1 LIMIT 1 INTO @a; --disable_info +--enable_cursor_protocol --echo --disable_ps2_protocol diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test index e9c00742f01..621a4cc7f75 100644 --- a/mysql-test/suite/funcs_1/t/storedproc.test +++ b/mysql-test/suite/funcs_1/t/storedproc.test @@ -10,7 +10,10 @@ # ############################################################################ ---disable_ps_protocol +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) +{ + --skip Test temporarily disabled for ps-protocol and cursor-protocol +} --source include/default_charset.inc set sql_mode=""; @@ -29733,4 +29736,3 @@ DROP TABLE IF EXISTS res_t1; let $message= . +++ END OF SCRIPT +++; --source include/show_msg80.inc # ============================================================================== ---enable_ps_protocol diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc index 7169f160fb8..f982f93239e 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc @@ -124,8 +124,10 @@ let $message= 3.5.8.4 - multiple SQL; select * from db_test.t1_u; --sorted_result select * from db_test.t1_d; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; - +--enable_cursor_protocol let $message= 3.5.8.4 - single SQL - insert; --source include/show_msg.inc @@ -202,7 +204,10 @@ let $message= 3.5.8.3/4 - single SQL - select; f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; +--enable_cursor_protocol #Cleanup connection default; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_09.inc b/mysql-test/suite/funcs_1/triggers/triggers_09.inc index 93762b363df..92ea70240fc 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_09.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_09.inc @@ -93,10 +93,13 @@ let $message= Testcase 3.5.9.3:; Update tb3 Set f136=8 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -112,10 +115,14 @@ let $message= Testcase 3.5.9.3:; delete from tb3 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg2_a; @@ -167,10 +174,13 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4%' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -188,10 +198,14 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg3_a; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4f0619ca540..e00bdbf85c0 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -12,10 +12,6 @@ galera_as_slave_ctas : MDEV-28378 timeout galera_pc_recovery : MDEV-25199 cluster fails to start up -galera_bf_kill_debug : timeout after 900 seconds -galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos' -galera_parallel_simple : timeout related to wsrep_sync_wait -galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert() galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index aa2f0e2e777..efe803dcc9f 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -10,8 +10,8 @@ if (!$wsrep_recover_additional) --perl use strict; - my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; - my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + 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 ''; diff --git a/mysql-test/suite/galera/r/GCF-939.result b/mysql-test/suite/galera/r/GCF-939.result index f9b65bced42..2e94fc4a1b0 100644 --- a/mysql-test/suite/galera/r/GCF-939.result +++ b/mysql-test/suite/galera/r/GCF-939.result @@ -5,7 +5,11 @@ DROP TABLE t1; ERROR 42S02: Unknown table 'test.t1' CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); -GRA_.log +connection node_2; +SELECT * FROM t1; +f1 +1 +connection node_1; GRA_.log DROP TABLE t1; CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); diff --git a/mysql-test/suite/galera/r/MDEV-16509.result b/mysql-test/suite/galera/r/MDEV-16509.result index b56622da2c0..fecb397994c 100644 --- a/mysql-test/suite/galera/r/MDEV-16509.result +++ b/mysql-test/suite/galera/r/MDEV-16509.result @@ -28,6 +28,11 @@ wsrep_last_seen_gtid_do_not_match 1 SET DEBUG_SYNC = "now SIGNAL after_group_continue"; connection node_1; +SELECT * from t1; +f1 +1 +connection ctrl; +SET DEBUG_SYNC = "RESET"; SET SESSION wsrep_sync_wait = 0; connection ctrl; connection node_1; @@ -69,6 +74,11 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; connection node_1a; connection ctrl; SET DEBUG_SYNC = "RESET"; +SELECT * from t1; +f1 +1 +2 +3 DROP TABLE t1; disconnect ctrl; disconnect node_1a; diff --git a/mysql-test/suite/galera/r/MDEV-33133.result b/mysql-test/suite/galera/r/MDEV-33133.result new file mode 100644 index 00000000000..a326b5efc4d --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-33133.result @@ -0,0 +1,34 @@ +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) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_rollback_mdl_release'; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_1a; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ha_write_row_start SIGNAL may_toi WAIT_FOR bf_abort'; +INSERT INTO t1 VALUES (2); +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR may_toi'; +SET DEBUG_SYNC = 'after_wsrep_thd_abort WAIT_FOR sync.wsrep_rollback_mdl_release_reached'; +TRUNCATE TABLE t1; +connection node_1a; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_rollback_mdl_release'; +connection node_2; +INSERT INTO t1 VALUES (3); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +disconnect node_1a; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/MDEV-34647.result b/mysql-test/suite/galera/r/MDEV-34647.result index 16a4e839f13..0333f14ece1 100644 --- a/mysql-test/suite/galera/r/MDEV-34647.result +++ b/mysql-test/suite/galera/r/MDEV-34647.result @@ -39,7 +39,7 @@ id val 7 d 9 d 11 d -set global wsrep_mode=REPLICATE_MYISAM; +set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA'; create table t4(id serial, val varchar(100)) engine=myisam; insert into t4 values(null, 'a'); insert into t4 values(null, 'b'); @@ -95,6 +95,7 @@ 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/galera_bf_kill,debug.rdiff b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff new file mode 100644 index 00000000000..e02acc3de08 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff @@ -0,0 +1,37 @@ +--- 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 +@@ -77,4 +77,34 @@ a b + 5 2 + disconnect node_2a; + connection node_1; ++connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++connection node_2a; ++truncate t1; ++insert into t1 values (7,0); ++connection node_2; ++set wsrep_sync_wait=0; ++begin; ++update t1 set b=2 where a=7; ++connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++set wsrep_sync_wait=0; ++SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; ++connection node_1; ++update t1 set b=1 where a=7; ++connection node_2b; ++SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; ++connection node_2; ++connection node_2b; ++SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; ++connection node_2; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++commit; ++select * from t1; ++a b ++7 1 ++connection node_2a; ++SET DEBUG_SYNC= 'RESET'; ++SET GLOBAL debug_dbug = ""; ++disconnect node_2a; ++disconnect node_2b; ++connection node_1; + drop table t1; diff --git a/mysql-test/suite/galera/r/galera_bf_kill_debug.result b/mysql-test/suite/galera/r/galera_bf_kill_debug.result index c3eae243f47..52bd1b0e370 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill_debug.result +++ b/mysql-test/suite/galera/r/galera_bf_kill_debug.result @@ -22,16 +22,19 @@ update t1 set b= 1 where a=1; connection node_2b; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached"; connection node_2; -SET DEBUG_SYNC= 'before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; +SET DEBUG_SYNC= 'wsrep_kill_before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; connection node_2b; SET DEBUG_SYNC='now WAIT_FOR awake_reached'; SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort"; +connection node_1; +COMMIT; +connection node_2b; SET DEBUG_SYNC = "now SIGNAL continue_kill"; connection node_2; connection node_2a; select * from t1; -connection node_2; +connection node_2b; SET DEBUG_SYNC = "RESET"; drop table t1; disconnect node_2a; diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result index b626d963af8..c10c0a5c702 100644 --- a/mysql-test/suite/galera/r/galera_fk_multicolumn.result +++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; CREATE TABLE t0 ( f1 INT PRIMARY KEY, -f2 INT UNIQUE +f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( f1 INT PRIMARY KEY, diff --git a/mysql-test/suite/galera/r/galera_insert_bulk.result b/mysql-test/suite/galera/r/galera_insert_bulk.result index f4d4adf64e1..7191464ba64 100644 --- a/mysql-test/suite/galera/r/galera_insert_bulk.result +++ b/mysql-test/suite/galera/r/galera_insert_bulk.result @@ -2,6 +2,8 @@ connection node_2; connection node_1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +connection node_1; SET foreign_key_checks = 0; SET unique_checks = 0; START TRANSACTION; @@ -10,11 +12,20 @@ SET foreign_key_checks = 1; SET unique_checks = 1; INSERT INTO t1 VALUES (1001); connection node_1; +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +connection node_1; +SET foreign_key_checks = 0; +SET unique_checks = 0; START TRANSACTION; connection node_2; SET foreign_key_checks = 1; @@ -23,8 +34,14 @@ START TRANSACTION; INSERT INTO t1 VALUES (1001); connection node_1; COMMIT; -2 +3 connection node_2; +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; COMMIT; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result index 215f2b132b8..20b91ed2afd 100644 --- a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result +++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result @@ -209,7 +209,9 @@ DROP TABLE t1; connection node_2; SELECT * FROM t1; ERROR 42S02: Table 'test.t1' doesn't exist -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; +Warnings: +Warning 1292 Truncated incorrect wsrep_ignore_apply_errors value: '10' CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test\\.t1'' on query\\. Default database: 'test'\\. Query: 'DROP TABLE t1', Error_code: 1051"); @@ -218,3 +220,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); diff --git a/mysql-test/suite/galera/r/galera_vote_ddl.result b/mysql-test/suite/galera/r/galera_vote_ddl.result new file mode 100644 index 00000000000..bc5d99256e5 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_vote_ddl.result @@ -0,0 +1,70 @@ +connection node_2; +connection node_1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_1; +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); +connection node_1; +DROP TABLE nonexistent; +ERROR 42S02: Unknown table 'test.nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +TRUNCATE TABLE nonexistent; +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE nonexistent.t1 (s INT); +ERROR 42000: Unknown database 'nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE t1 (s INT); +ERROR 42S01: Table 't1' already exists +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +ALTER TABLE nonexistent ADD COLUMN (c INT); +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +DROP TABLE t1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 0; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 0; +connection node_1; +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); +connection node_1; +DROP TABLE nonexistent; +ERROR 42S02: Unknown table 'test.nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +TRUNCATE TABLE nonexistent; +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE nonexistent.t1 (s INT); +ERROR 42000: Unknown database 'nonexistent' +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +CREATE TABLE t1 (s INT); +ERROR 42S01: Table 't1' already exists +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +connection node_1; +ALTER TABLE nonexistent ADD COLUMN (c INT); +ERROR 42S02: Table 'test.nonexistent' doesn't exist +INSERT INTO t1 VALUES (DEFAULT); +connection node_2; +DROP TABLE t1; +connection node_1; +SET @@global.wsrep_ignore_apply_errors = 7; +connection node_2; +SET @@global.wsrep_ignore_apply_errors = 7; diff --git a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result new file mode 100644 index 00000000000..41275ede6d2 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: async IST sender failed to serve.*"); +SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; +connection node_2; +SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; +SET GLOBAL WSREP_ON=0; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_allowlist; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; +EXPECT_1 +1 +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; +EXPECT_2 +2 +INSERT INTO mysql.wsrep_allowlist (ip) VALUES (0); +SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig; +SELECT 1; +1 +1 +DELETE FROM mysql.wsrep_allowlist; +connection node_1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; +connection node_2; +Killing server ... +connection node_1; +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/r/mdev-22063.result b/mysql-test/suite/galera/r/mdev-22063.result index 585d70acb61..228f63d6688 100644 --- a/mysql-test/suite/galera/r/mdev-22063.result +++ b/mysql-test/suite/galera/r/mdev-22063.result @@ -17,12 +17,14 @@ SELECT * FROM s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 connection node_2; +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; SELECT * FROM t1; a SELECT * FROM s; next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count 1 1 9223372036854775806 1 1 1000 0 0 connection node_1; +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; DROP TABLE t1; DROP SEQUENCE s; # Case 2 REPLACE INTO ... SELECT with error @@ -240,3 +242,5 @@ pk DROP TABLE t1; DROP VIEW view_t1; SET GLOBAL wsrep_mode=DEFAULT; +connection node_2; +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test index 62bcdb818c7..a9b9077d5ef 100644 --- a/mysql-test/suite/galera/t/GCF-939.test +++ b/mysql-test/suite/galera/t/GCF-939.test @@ -13,6 +13,11 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +--connection node_2 +SELECT * FROM t1; + +--connection node_1 + # Expect only one GRA_*.log file # TODO replace_regex is somehow broken, it will filter out # result totally if replacement string is already in result @@ -20,7 +25,6 @@ INSERT INTO t1 VALUES (1); # to get GRA_.log two times, this works for some reason # --replace_regex /GRA_.+\.log/GRA_.log/ ---list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log --replace_regex /GRA_.+\.log/GRA_.log/ --list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log diff --git a/mysql-test/suite/galera/t/MDEV-16509.test b/mysql-test/suite/galera/t/MDEV-16509.test index 078f1e95a99..3f3e2d88f1b 100644 --- a/mysql-test/suite/galera/t/MDEV-16509.test +++ b/mysql-test/suite/galera/t/MDEV-16509.test @@ -58,6 +58,12 @@ SET DEBUG_SYNC = "now SIGNAL after_group_continue"; --connection node_1 --reap +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + +--connection ctrl +SET DEBUG_SYNC = "RESET"; # # Scenario 2: Verify that two INSERTs from two different connections @@ -137,6 +143,10 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; --connection ctrl SET DEBUG_SYNC = "RESET"; +--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + DROP TABLE t1; --disconnect ctrl diff --git a/mysql-test/suite/galera/t/MDEV-33133.test b/mysql-test/suite/galera/t/MDEV-33133.test new file mode 100644 index 00000000000..90d1f93f4cb --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-33133.test @@ -0,0 +1,80 @@ +# +# MDEV-33133: MDL conflict handling code should skip transactions +# BF-aborted before. +# +# It's possible that MDL conflict handling code is called more +# than once for a transaction when: +# - it holds more than one conflicting MDL lock +# - reschedule_waiters() is executed, +# which results in repeated attempts to BF-abort already aborted +# transaction. +# In such situations, it might be that BF-aborting logic sees +# a partially rolled back transaction and erroneously decides +# on future actions for such a transaction. +# +# The specific situation tested and fixed is when a SR transaction +# applied in the node gets BF-aborted by a started TOI operation. +# It's then caught with the server transaction already rolled back, +# but with no MDL locks yet released. This caused wrong state +# detection for such a transaction during repeated MDL conflict +# handling code execution. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1 + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_rollback_mdl_release'; + +--connection node_2 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +--connection node_1a +# Sync wait for SR transaction to replicate and apply fragment. +SELECT COUNT(*) FROM t1; +SET SESSION wsrep_retry_autocommit = 0; +SET DEBUG_SYNC = 'ha_write_row_start SIGNAL may_toi WAIT_FOR bf_abort'; +--send + INSERT INTO t1 VALUES (2); + +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR may_toi'; +# BF-abort SR transaction and wait until it reaches the point +# prior to release MDL locks. +# Then abort local INSERT, which will go through rescedule_waiters() +# and see SR transaction holding MDL locks but already rolled back. +# In this case SR transaction should be skipped in MDL conflict +# handling code. +SET DEBUG_SYNC = 'after_wsrep_thd_abort WAIT_FOR sync.wsrep_rollback_mdl_release_reached'; +--send + TRUNCATE TABLE t1; + +--connection node_1a +# Local INSERT gets aborted. +--error ER_LOCK_DEADLOCK +--reap +# Let the aborted SR transaction continue and finally release MDL locks, +# which in turn allows TRUNCATE to complete. +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_rollback_mdl_release'; + +--connection node_2 +# SR transaction has been BF-aborted. +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (3); + +--connection node_1 +# TRUNCATE completes. +--reap + +# Cleanup +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +--disconnect node_1a +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index 8840c233c6d..db776681aa1 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -22,7 +22,7 @@ insert into t3 select null, 'c'; insert into t3 select null, 'd' from t3; select * from t3; -set global wsrep_mode=REPLICATE_MYISAM; +set global wsrep_mode='REPLICATE_MYISAM,REPLICATE_ARIA'; create table t4(id serial, val varchar(100)) engine=myisam; insert into t4 values(null, 'a'); @@ -45,9 +45,8 @@ 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; set global wsrep_mode=default; - diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test index 14e28a42df4..c70662e16b4 100644 --- a/mysql-test/suite/galera/t/MW-329.test +++ b/mysql-test/suite/galera/t/MW-329.test @@ -87,7 +87,7 @@ while ($count) --enable_query_log --connection node_1b ---error 0,2013,1317,2026 +--error 0,1317,2013,2026 --reap --enable_query_log --enable_result_log diff --git a/mysql-test/suite/galera/t/galera_as_slave.test b/mysql-test/suite/galera/t/galera_as_slave.test index 581e050bbf4..2a149d8ba2c 100644 --- a/mysql-test/suite/galera/t/galera_as_slave.test +++ b/mysql-test/suite/galera/t/galera_as_slave.test @@ -55,7 +55,6 @@ INSERT INTO t1 VALUES (4,1); --connection node_3 DROP TABLE t1; - --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test index 20ce6036d0d..9647d78a094 100644 --- a/mysql-test/suite/galera/t/galera_backup_stage.test +++ b/mysql-test/suite/galera/t/galera_backup_stage.test @@ -87,7 +87,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); --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 = 'Commit' OR State='Waiting for certification') --source include/wait_condition.inc # nothing after BLOCK_DDL is applied diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1b35b609a96..1cb2e866cb4 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -154,4 +154,77 @@ select * from t1; --disconnect node_2a --connection node_1 + +source include/maybe_debug.inc; +if ($have_debug) { +# +# Test case 7: Start a transaction on node_2 and use KILL to abort +# a query in connection node_2a +# During the KILL execution replicate conflicting transaction from node_1 +# to BF abort the transaction executing the KILL +# + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +truncate t1; +insert into t1 values (7,0); + +--connection node_2 +set wsrep_sync_wait=0; + +# get the ID of connection to be later killed +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1 +--source include/wait_condition.inc +--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1` + +# start a transaction +begin; +update t1 set b=2 where a=7; + +# set sync point for incoming applying +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +set wsrep_sync_wait=0; + +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; + +# replicate conflicting transaction, should stopp in the sync point +--connection node_1 +update t1 set b=1 where a=7; + +# wait for the applier to reach the sync point +--connection node_2b +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +# issue KILL inside the transacion, implicit commit is expected +--connection node_2 +--disable_query_log +--send_eval KILL QUERY $k_thread +--enable_query_log + +# wait for the KILL processing to be seen in processlist +--connection node_2b +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND INFO LIKE 'KILL QUERY%' +--source include/wait_condition.inc + +# resume applying, BF abort should follow +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--error ER_LOCK_DEADLOCK +--reap + +commit; + +select * from t1; + +--connection node_2a +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL debug_dbug = ""; + +--disconnect node_2a +--disconnect node_2b + +--connection node_1 +} + drop table t1; diff --git a/mysql-test/suite/galera/t/galera_bf_kill_debug.test b/mysql-test/suite/galera/t/galera_bf_kill_debug.test index 6706734cc36..b8978cea11d 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill_debug.test +++ b/mysql-test/suite/galera/t/galera_bf_kill_debug.test @@ -66,7 +66,7 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached"; # # pause KILL execution before awake # -SET DEBUG_SYNC= 'before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; +SET DEBUG_SYNC= 'wsrep_kill_before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill'; --disable_query_log --send_eval KILL $k_thread --enable_query_log @@ -78,6 +78,11 @@ SET DEBUG_SYNC='now WAIT_FOR awake_reached'; # release applier and KILL operator SET GLOBAL debug_dbug = ""; SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort"; + +--connection node_1 +COMMIT; + +--connection node_2b SET DEBUG_SYNC = "now SIGNAL continue_kill"; --connection node_2 @@ -87,7 +92,7 @@ SET DEBUG_SYNC = "now SIGNAL continue_kill"; --error 0,1213,2013,2026 select * from t1; ---connection node_2 +--connection node_2b SET DEBUG_SYNC = "RESET"; drop table t1; @@ -126,7 +131,7 @@ SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached"; SET DEBUG_SYNC = "now SIGNAL bwoc_continue"; SET DEBUG_SYNC='RESET'; --connection node_2a ---error 0,1213 +--error 0,1213,2013,2026 --reap --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf b/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf new file mode 100644 index 00000000000..7df8ed28a4d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_lock_wait.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-debug=1 +auto_increment_offset=1 +auto_increment_increment=2 + +[mysqld.2] +wsrep-debug=1 +auto_increment_offset=2 +auto_increment_increment=2 diff --git a/mysql-test/suite/galera/t/galera_fk_lock_wait.test b/mysql-test/suite/galera/t/galera_fk_lock_wait.test index 150c7397f7e..0d731e154f2 100644 --- a/mysql-test/suite/galera/t/galera_fk_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_fk_lock_wait.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc CREATE TABLE parent(parent_id int not null AUTO_INCREMENT PRIMARY KEY, parent_name varchar(80)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_fk_multicolumn.test b/mysql-test/suite/galera/t/galera_fk_multicolumn.test index ad42f65924d..eeed46bca6c 100644 --- a/mysql-test/suite/galera/t/galera_fk_multicolumn.test +++ b/mysql-test/suite/galera/t/galera_fk_multicolumn.test @@ -7,7 +7,7 @@ CREATE TABLE t0 ( f1 INT PRIMARY KEY, - f2 INT UNIQUE + f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( diff --git a/mysql-test/suite/galera/t/galera_insert_bulk.test b/mysql-test/suite/galera/t/galera_insert_bulk.test index f58870d5f74..7faf8356420 100644 --- a/mysql-test/suite/galera/t/galera_insert_bulk.test +++ b/mysql-test/suite/galera/t/galera_insert_bulk.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc # # Make bulk insert BF-abort, but regular insert succeed. @@ -13,6 +15,10 @@ --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +# Delay applying of the single insert from the other node. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; + +--connection node_1 # Disable foreign and unique key checks to allow bulk insert. SET foreign_key_checks = 0; SET unique_checks = 0; @@ -30,7 +36,7 @@ while ($count < 1000) --connection node_2 -# Disable bulk insert. +# Disable bulk insert on this node. SET foreign_key_checks = 1; SET unique_checks = 1; @@ -38,10 +44,20 @@ SET unique_checks = 1; INSERT INTO t1 VALUES (1001); --connection node_1 + +# We need to trigger Galera-level certification conflict. For this: +# - start applying single insert from the other node before bulk insert certifies +# - certifying bulk insert will lead to the conflict +# - keep applying single insert +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; + --error ER_LOCK_DEADLOCK COMMIT; DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; # # Make bulk insert succeed, but regular insert BF-abort. @@ -50,8 +66,17 @@ DROP TABLE t1; --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +--connection node_2 +# Delay applying of the bulk insert from the other node. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; + +--connection node_1 --let $before_bulk_keys = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` +# Disable foreign and unique key checks to allow bulk insert. +SET foreign_key_checks = 0; +SET unique_checks = 0; + START TRANSACTION; --let $count=0 @@ -64,8 +89,7 @@ while ($count < 1000) --enable_query_log --connection node_2 - -# Disable bulk insert. +# Disable bulk insert on this node. SET foreign_key_checks = 1; SET unique_checks = 1; @@ -77,12 +101,23 @@ INSERT INTO t1 VALUES (1001); --connection node_1 COMMIT; -# Expect two keys to be added for bulk insert: DB-level shared key and table-level exclusive key. +# Expect three keys to be added for bulk insert: "zero-level" key, DB-level shared key and table-level exclusive key. --let $bulk_keys_count = `SELECT VARIABLE_VALUE - $before_bulk_keys FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'` --echo $bulk_keys_count --connection node_2 + +# We need to trigger Galera-level certification conflict. For this: +# - start applying bulk insert from the other node before local insert certifies +# - certifying local insert will lead to the conflict +# - keep applying bulk insert +SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached'; +SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb'; + --error ER_LOCK_DEADLOCK COMMIT; DROP TABLE t1; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC = 'RESET'; +--source include/galera_end.inc 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 ffd2306bfb3..d1d3b4eb9cd 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 @@ -10,11 +10,11 @@ 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' -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' -innodb-log-file-buffering +loose-innodb-log-file-buffering [sst] ssl-mode=VERIFY_CA diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index 89adaf8cbd2..48171a1777e 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -51,7 +51,7 @@ SET SESSION wsrep_sync_wait = 0; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Commit'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE 'Commit' or STATE = 'Waiting for certification'); --source include/wait_condition.inc UNLOCK TABLES; diff --git a/mysql-test/suite/galera/t/galera_pc_recovery.test b/mysql-test/suite/galera/t/galera_pc_recovery.test index 16abe6fc9ba..0fd9c8ab3d9 100644 --- a/mysql-test/suite/galera/t/galera_pc_recovery.test +++ b/mysql-test/suite/galera/t/galera_pc_recovery.test @@ -38,10 +38,10 @@ SELECT COUNT(*) = 1 FROM t1; --perl use strict; - my $wsrep_start_position1 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position1 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position1); - my $wsrep_start_position2 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; + my $wsrep_start_position2 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position2); die if $wsrep_start_position1 eq '' || $wsrep_start_position2 eq ''; diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 2954ae0f4cb..7c495102564 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -1,5 +1,9 @@ !include ../galera_2nodes.cnf +[mysqld] +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' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index c09615527fd..78897ffd738 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -7,6 +7,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_ssl_communication.inc +--source include/have_openssl.inc +--source include/force_restart.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 6cb80831d1f..8cb962cb95b 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -14,7 +14,7 @@ innodb_undo_tablespaces=0 wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' innodb_fast_shutdown=0 innodb_undo_tablespaces=3 -innodb_log_file_buffering +loose_innodb_log_file_buffering [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf index 1d02401decc..fdb73f1f052 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf @@ -2,5 +2,5 @@ [mysqld] wsrep_debug=1 -wsrep_sync_wait=15 +wsrep_sync_wait=0 loose-galera-var-ignore-apply-errors=1 diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test index de17c95b33e..02dd9fa8416 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test @@ -18,6 +18,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 1; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP TABLE t1; --connection node_2 @@ -28,6 +29,7 @@ SHOW TABLES; SET GLOBAL wsrep_on = OFF; CREATE SCHEMA s1; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP SCHEMA s1; --connection node_2 @@ -39,6 +41,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP INDEX idx1 ON t1; --connection node_2 @@ -51,6 +54,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP INDEX idx1; --connection node_2 @@ -63,6 +67,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP COLUMN f2; --connection node_2 @@ -83,6 +88,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DELETE FROM t1 WHERE f1 = 1; SELECT COUNT(*) AS expect_0 FROM t1; @@ -97,6 +103,7 @@ INSERT INTO t1 VALUES (2); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc START TRANSACTION; INSERT INTO t1 VALUES (3); DELETE FROM t1 WHERE f1 = 1; @@ -122,6 +129,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM t1; @@ -148,6 +156,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 SET AUTOCOMMIT=OFF; @@ -186,6 +195,7 @@ SET SESSION wsrep_on = OFF; DELETE FROM t2 WHERE f1 = 2; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; @@ -215,6 +225,7 @@ INSERT INTO child VALUES (1,1),(2,2),(3,3); SET SESSION wsrep_on = OFF; DELETE FROM child WHERE parent_id = 2; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM parent; @@ -241,6 +252,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 4; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); @@ -249,7 +261,7 @@ DROP TABLE t1; --connection node_2 --error ER_NO_SUCH_TABLE SELECT * FROM t1; -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); @@ -259,3 +271,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test index fb86b69d95a..6584eb1f736 100644 --- a/mysql-test/suite/galera/t/galera_var_reject_queries.test +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -5,10 +5,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -if (`select version() not like '10.10.3-%'`) { - skip disabled until new C/C; -} - CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 @@ -26,7 +22,7 @@ SELECT * FROM t1; # Original behavior was lost connection, # but since 10.1, we allow controlling connection to remain alive # ---error 0,2013 +--error 0,2013,2026 SET GLOBAL wsrep_reject_queries = ALL_KILL; --connection node_1a diff --git a/mysql-test/suite/galera/t/galera_vote_ddl.inc b/mysql-test/suite/galera/t/galera_vote_ddl.inc new file mode 100644 index 00000000000..80a543fb886 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_ddl.inc @@ -0,0 +1,54 @@ +--connection node_1 +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY); + +--connection node_1 +--error 1051 +DROP TABLE nonexistent; + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1146 +TRUNCATE TABLE nonexistent; + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1049 +CREATE TABLE nonexistent.t1 (s INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1050 +CREATE TABLE t1 (s INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +--error 1146 +ALTER TABLE nonexistent ADD COLUMN (c INT); + +# Verify cluster is intact +INSERT INTO t1 VALUES (DEFAULT); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_vote_ddl.test b/mysql-test/suite/galera/t/galera_vote_ddl.test new file mode 100644 index 00000000000..9db6e612e7e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_vote_ddl.test @@ -0,0 +1,34 @@ +# +# Test voting on identical DDL errors (error messages should match) +# + +--source include/galera_cluster.inc +--source include/have_binlog_format_row.inc + +# +# 1. Ignore all DDL errors (avoids voting) +# +--connection node_1 +--let $wsrep_ignore_apply_errors_saved1 = `SELECT @@global.wsrep_ignore_apply_errors` +SET @@global.wsrep_ignore_apply_errors = 7; +--connection node_2 +--let $wsrep_ignore_apply_errors_saved2 = `SELECT @@global.wsrep_ignore_apply_errors` +SET @@global.wsrep_ignore_apply_errors = 7; + +--source galera_vote_ddl.inc + +# +# 2. Don't ignore any errors (forces voting) +# +--connection node_1 +SET @@global.wsrep_ignore_apply_errors = 0; +--connection node_2 +SET @@global.wsrep_ignore_apply_errors = 0; + +--source galera_vote_ddl.inc + +--connection node_1 +--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved1 + +--connection node_2 +--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved2 diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test new file mode 100644 index 00000000000..9942d63f142 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_1 +call mtr.add_suppression("WSREP: async IST sender failed to serve.*"); +SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; + +--connection node_2 +SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; +SET GLOBAL WSREP_ON=0; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_allowlist; +SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster; +SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members; + +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_1 +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true'; + +--connection node_2 +--source include/kill_galera.inc + +--connection node_1 +--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 +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false'; + +# Cleanup +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/mdev-22063.test b/mysql-test/suite/galera/t/mdev-22063.test index ccc199e308f..260067d8a7b 100644 --- a/mysql-test/suite/galera/t/mdev-22063.test +++ b/mysql-test/suite/galera/t/mdev-22063.test @@ -16,6 +16,7 @@ SELECT * FROM t1; SELECT * FROM s; --connection node_2 +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 's' @@ -27,6 +28,7 @@ SELECT * FROM t1; SELECT * FROM s; --connection node_1 +SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; DROP TABLE t1; DROP SEQUENCE s; @@ -183,3 +185,6 @@ SELECT * FROM t1; DROP TABLE t1; DROP VIEW view_t1; SET GLOBAL wsrep_mode=DEFAULT; + +--connection node_2 +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf b/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf index ebe1d47f200..4c74375114f 100644 --- a/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf +++ b/mysql-test/suite/galera/t/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.cnf @@ -1,10 +1,10 @@ !include ../galera_2nodes_as_master.cnf [mysqld.1] -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.2] -innodb-log-file-buffering +loose-innodb-log-file-buffering [mysqld.3] -innodb-log-file-buffering +loose-innodb-log-file-buffering diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 3a6c38d81bb..c52df019c65 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -11,11 +11,6 @@ ############################################################################## galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed -galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)' -galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message -galera_pc_bootstrap : temporarily disabled at the request of Codership -galera_ipv6_mariabackup_section : temporarily disabled at the request of Codership -# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera -galera_ipv6_rsync : Can't connect to server on '::1' (115) -galera_ipv6_rsync_section : Can't connect to server on '::1' (115) -GCF-354 : MDEV-25614 Galera test failure on GCF-354 +galera_ipv6_rsync : MDEV-34842 Can't connect to server on '::1' (115) +galera_ipv6_rsync_section : MDEV-34842 Can't connect to server on '::1' (115) +galera_ipv6_mariabackup_section : MDEV-34842 Can't connect to server on '::1' (115) diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 832dd2a34e7..b8a75ea914b 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -48,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' [sst] sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log +transferfmt=@ENV.MTR_GALERA_TFMT [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result index c69de54747f..3fdd44fe9d3 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-354.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -1,20 +1,17 @@ connection node_2; connection node_1; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; connection node_2; connection node_3; connection node_2; -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; DROP SCHEMA test; connection node_3; -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; connection node_1; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE -1 +INSERT INTO test.t1 values (1); SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status Primary 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 1cb14cd3eff..b849cc9f368 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 @@ -223,10 +223,14 @@ select @@gtid_binlog_state; drop table t1; stop slave; reset slave; +Warnings: +Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos' cluster 2 node 1 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' cluster 1 node 1 connection node_1; change master to master_use_gtid=no, ignore_server_ids=(); diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result index ffc5ec0627a..91ff0342b8d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_consistency.result @@ -1,6 +1,9 @@ connection node_2; connection node_1; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; set wsrep_sync_wait=0; connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; @@ -44,9 +47,9 @@ connection node_1b; connection node_1; connection node_3; connection node_1; -CALL insert_row('node1', 500); +CALL insert_row('node1', 100); connection node_3; -CALL insert_row('node3', 500); +CALL insert_row('node3', 100); CREATE TABLE t2(i int primary key) engine=innodb; connection node_2; # Restart node_2 @@ -60,7 +63,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 connection node_2; # GTID in node2 show variables like 'wsrep_gtid_domain_id'; @@ -68,7 +71,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 connection node_3; # GTID in node3 show variables like 'wsrep_gtid_domain_id'; @@ -76,7 +79,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2503 +gtid_binlog_pos 1111-1-1703 # Shutdown node_3 connection node_3; SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; @@ -98,7 +101,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 connection node_2; # GTID in node2 show variables like 'wsrep_gtid_domain_id'; @@ -106,7 +109,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 connection node_3; # GTID in node3 show variables like 'wsrep_gtid_domain_id'; @@ -114,7 +117,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 # One by one shutdown all nodes connection node_3; # shutdown node_3 @@ -132,7 +135,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2554 +gtid_binlog_pos 1111-1-1754 ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -163,7 +166,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_2; node2 GTID show variables like 'wsrep_gtid_domain_id'; @@ -171,7 +174,7 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_3; node3 GTID show variables like 'wsrep_gtid_domain_id'; @@ -179,22 +182,22 @@ Variable_name Value wsrep_gtid_domain_id 1111 show variables like '%gtid_binlog_pos%'; Variable_name Value -gtid_binlog_pos 1111-1-2756 +gtid_binlog_pos 1111-1-1956 connection node_1; table size in node1 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_2; table size in node2 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_3; table size in node3 SELECT COUNT(*) FROM t1; COUNT(*) -2750 +1950 connection node_2; call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node"); call mtr.add_suppression("Sending JOIN failed: "); 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 16debb96fd9..d34324d2f91 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 @@ -45,6 +45,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); 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\\(\\)"); connection node_3; @@ -58,6 +59,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); 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\\(\\)"); SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result index d8d3abe40e9..345fa92c13d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result +++ b/mysql-test/suite/galera_3nodes/r/galera_toi_vote.result @@ -7,8 +7,9 @@ connection node_3; SET SESSION wsrep_on=OFF; DROP SCHEMA test; connection node_1; +SET SESSION lc_messages='fr_FR'; CREATE SCHEMA test; -ERROR HY000: Can't create database 'test'; database exists +ERROR HY000: Ne peut créer la base 'test'; elle existe déjà connection node_1; SET SESSION wsrep_sync_wait=0; connection node_2; diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test index 372f6329e8e..44dfa3deeb7 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.test +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test @@ -2,7 +2,9 @@ --source include/have_innodb.inc --source include/force_restart.inc ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--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 @@ -14,11 +16,11 @@ # 1. Create different inconsistencies on nodes 2 and 3 # --connection node_2 -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; DROP SCHEMA test; --connection node_3 -SET wsrep_on=OFF; +SET SESSION wsrep_on=OFF; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; # # 2. The following should generate different errors on nodes 2 and 3 and @@ -27,10 +29,10 @@ CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; # --connection node_1 CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; +INSERT INTO test.t1 values (1); --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' --source include/wait_condition.inc SHOW STATUS LIKE 'wsrep_cluster_status'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf index c27490faf36..c0acbe58ad3 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf @@ -1,38 +1,31 @@ !include ../galera_3nodes.cnf +[mysqld] +loose-galera-gtid-consistency=1 +wsrep_sst_auth="root:" +wsrep_sst_method=mariabackup +log_slave_updates=ON +log_bin=mariadb-bin-log +binlog-format=row +wsrep-gtid-mode=ON +wsrep-debug=1 +gtid-strict-mode=1 + [mysqld.1] wsrep-node-name="node1" -wsrep_gtid_domain_id=1111 gtid_domain_id=2 server_id=10999 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1111 [mysqld.2] wsrep-node-name="node2" -wsrep_gtid_domain_id=1112 gtid_domain_id=3 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1112 [mysqld.3] wsrep-node-name="node3" -wsrep_gtid_domain_id=1113 gtid_domain_id=4 -wsrep_sst_auth="root:" -wsrep_sst_method=mariabackup -log_slave_updates=ON -log_bin=mariadb-bin-log -binlog-format=row -wsrep-gtid-mode=ON +wsrep_gtid_domain_id=1113 [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test index f00972b0461..871014b39d0 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.test @@ -2,7 +2,6 @@ --source include/big_test.inc --source include/force_restart.inc - # # Testing gtid consistency in 3 node cluster when nodes drop # and join back to cluster. @@ -13,6 +12,13 @@ # from the bootstrap node (node_1), and use it # --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 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + --connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 set wsrep_sync_wait=0; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 @@ -98,10 +104,10 @@ show variables like '%gtid_binlog_pos%'; # while node 2 is absent # --connection node_1 -CALL insert_row('node1', 500); +CALL insert_row('node1', 100); --connection node_3 -CALL insert_row('node3', 500); +CALL insert_row('node3', 100); CREATE TABLE t2(i int primary key) engine=innodb; @@ -225,12 +231,19 @@ show variables like '%gtid_binlog_pos%'; # bootstap cluster in order node1 - node2 - node3 # send some inserts and DDL after each node started # ---sleep 5 + --echo # Bootstrap from node_1 --connection node_1 --let $restart_parameters = --wsrep_new_cluster --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--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 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + show variables like 'wsrep_gtid_domain_id'; show variables like '%gtid_binlog_pos%'; @@ -243,6 +256,13 @@ ANALYZE TABLE t2; --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--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 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + # # connection node_1b may not be functional anymore, after node was # shutdown, open node_1c for controlling node 1 state @@ -265,6 +285,14 @@ ALTER TABLE t2 ADD COLUMN (k int); --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect --source include/start_mysqld.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--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 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + + --connection node_1c --echo # wait until all nodes are back in cluster --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; @@ -335,12 +363,16 @@ DROP TABLE t2; DROP TABLE t3; --connection node_3 ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3' --source include/wait_condition.inc --connection node_2 ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3' --source include/wait_condition.inc +# Restore original auto_increment_offset values. +--let $galera_cluster_size=3 +--source ../galera/include/auto_increment_offset_restore.inc + --disconnect node_3 --disconnect node_2b --disconnect node_1b 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 80482151518..eb41137b8b3 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 @@ -193,6 +193,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); 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\\(\\)"); @@ -207,6 +208,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this CALL mtr.add_suppression("Aborting"); 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\\(\\)"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test index 6bc87cf8874..bd53c510cd4 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test +++ b/mysql-test/suite/galera_3nodes/t/galera_toi_vote.test @@ -24,6 +24,9 @@ DROP SCHEMA test; # This should fail on nodes 1 and 2 and succeed on node 3 --connection node_1 +# Make error message on source node different by changing locale +# It should still agree with node 2 +SET SESSION lc_messages='fr_FR'; --error ER_DB_CREATE_EXISTS CREATE SCHEMA test; diff --git a/mysql-test/suite/galera_sr/r/MDEV-34836.result b/mysql-test/suite/galera_sr/r/MDEV-34836.result new file mode 100644 index 00000000000..10d302c415f --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-34836.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk +FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); +connection node_1; +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +COUNT(*) +0 +ALTER TABLE parent AUTO_INCREMENT = 100; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE child, parent; +disconnect node_2; +disconnect node_1; 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 9b3d7a9e201..433cfa4e459 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 @@ -27,7 +27,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; connection node_2; INSERT INTO t1 VALUES (6); -ERROR HY000: Lost connection to server during query +Got one of the listed errors connection node_1; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 diff --git a/mysql-test/suite/galera_sr/t/MDEV-34836.test b/mysql-test/suite/galera_sr/t/MDEV-34836.test new file mode 100644 index 00000000000..840ebaede4c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-34836.test @@ -0,0 +1,56 @@ +# +# MDEV-34836: TOI transaction on FK-referenced parent table must BF abort +# SR transaction in progress on a child table. +# +# Applied SR transaction on the child table was not BF aborted by TOI running +# on the parent table for several reasons: +# Although SR correctly collected FK-referenced keys to parent, TOI in Galera +# disregards common certification index and simply sets itself to depend on the +# latest certified write set seqno. +# Since this write set was the fragment of SR transaction, TOI was allowed to run in +# parallel with SR presuming it would BF abort the latter. +# +# At the same time, DML transactions in the server don't grab MDL locks on FK-referenced +# tables, thus parent table wasn't protected by an MDL lock from SR and it couldn't +# provoke MDL lock conflict for TOI to BF abort SR transaction. +# In InnoDB, DDL transactions grab shared MDL locks on child tables, which is not enough +# to trigger MDL conflict in Galera. +# InnoDB-level Wsrep patch didn't contain correct conflict resolution logic due to the +# fact that it was believed MDL locking should always produce conflicts correctly. +# +# The fix brings conflict resolution rules similar to MDL-level checks to InnoDB, thus +# accounting for the problematic case. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); + +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk + FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; + +--connection node_2 +# Start SR transaction and make it lock both parent and child tales. +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); + +--connection node_1 +# Sync wait for SR transaction to replicate and apply fragments, thus +# locking parent table as well. +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +# Now run TOI on the parent, which BF-aborts the SR-transaction in progress. +ALTER TABLE parent AUTO_INCREMENT = 100; + +--connection node_2 +# Check that SR is BF-aborted. +--error ER_LOCK_DEADLOCK +COMMIT; + +# Cleanup +DROP TABLE child, parent; +--source include/galera_end.inc 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 0db36165e59..563f115ecf1 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 @@ -1,10 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc -if (`select version() not like '10.10.3-%'`) { - skip disabled until new C/C; -} - # # Test the effect of Cluster Configuration Change on a concurrently-running SR transaction # We use SET GLOBAL wsrep_cluster_address = '' to cause the master (node_2) to temporarily @@ -55,7 +51,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; --connection node_2 ---error 2013 # CR_SERVER_LOST +--error 2013,2026 INSERT INTO t1 VALUES (6); --connection node_1 diff --git a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc index f025752b5b1..7b6538a3085 100644 --- a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc +++ b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc @@ -626,9 +626,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc index cc45e250a60..48c4b0695f4 100644 --- a/mysql-test/suite/gcol/inc/gcol_keys.inc +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -782,9 +782,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test index 1edc9779d41..7ec4b3d4e35 100644 --- a/mysql-test/suite/gcol/t/gcol_bugfixes.test +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -674,9 +674,11 @@ DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -689,9 +691,11 @@ DROP TABLE t1; CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -711,9 +715,11 @@ CREATE TABLE t1 (id INT PRIMARY KEY, ts TIMESTAMP DEFAULT '1971-01-01 00:00:00', c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED); INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar'); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error 0,ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); INSERT IGNORE INTO t1 (id) VALUES (2); diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 7966953535c..d41cc0c02b1 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -258,10 +258,14 @@ disconnect truncate; connection default; DROP TABLE t1, t2; +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol --source include/wait_until_count_sessions.inc set debug_sync=reset; diff --git a/mysql-test/suite/handler/ps.test b/mysql-test/suite/handler/ps.test index 783d862435e..87f4cddf525 100644 --- a/mysql-test/suite/handler/ps.test +++ b/mysql-test/suite/handler/ps.test @@ -7,6 +7,10 @@ flush status; handler handler_a read first; # handler...read must be prepared in --ps-protocol mode --replace_result $PS_PROTOCOL OK +if($CURSOR_PROTOCOL) +{ + --replace_result $CURSOR_PROTOCOL OK +} --disable_ps_protocol show status like 'Com_stmt_prepare%'; --enable_ps_protocol diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk,ON.rdiff b/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff similarity index 53% rename from mysql-test/suite/innodb/r/alter_copy_bulk,ON.rdiff rename to mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff index 091b1df219e..6570c52def1 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk,ON.rdiff +++ b/mysql-test/suite/innodb/r/alter_copy_bulk,OFF.rdiff @@ -1,11 +1,11 @@ ---- alter_copy_bulk.result -+++ alter_copy_bulk.result -@@ -4,7 +4,7 @@ +--- bulk_copy_alter.result ++++ bulk_copy_alter,non_bulk_alter_copy.result +@@ -6,7 +6,7 @@ INSERT INTO t1 SELECT repeat('b', 200), seq FROM seq_3_to_65536; ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); ALTER TABLE t1 ALGORITHM=COPY, ADD PRIMARY KEY(f1(2)); --ERROR 23000: Duplicate entry 'aa' for key 'PRIMARY' -+ERROR 23000: Duplicate entry 'bb' for key 'PRIMARY' +-ERROR 23000: Duplicate entry 'bb' for key 'PRIMARY' ++ERROR 23000: Duplicate entry 'aa' for key 'PRIMARY' INSERT INTO t1 VALUES(repeat('a', 200), 1); - ALTER TABLE t1 ALGORITHM=COPY, ADD UNIQUE KEY(f2); + ALTER TABLE t1 ADD UNIQUE KEY(f2); ERROR 23000: Duplicate entry '1' for key 'f2_2' diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk.result b/mysql-test/suite/innodb/r/alter_copy_bulk.result index 5ffde8ed63c..51ba100e972 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk.result +++ b/mysql-test/suite/innodb/r/alter_copy_bulk.result @@ -1,10 +1,12 @@ +SET @default_stats_persistent= @@global.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= 0; CREATE TABLE t1(f1 CHAR(200), f2 INT NOT NULL)engine=InnoDB; INSERT INTO t1 SELECT repeat('a', 200), seq FROM seq_1_to_2; ALTER TABLE t1 ALGORITHM=COPY, FORCE; INSERT INTO t1 SELECT repeat('b', 200), seq FROM seq_3_to_65536; ALTER TABLE t1 ALGORITHM=COPY, ADD INDEX(f2); ALTER TABLE t1 ALGORITHM=COPY, ADD PRIMARY KEY(f1(2)); -ERROR 23000: Duplicate entry 'aa' for key 'PRIMARY' +ERROR 23000: Duplicate entry 'bb' for key 'PRIMARY' INSERT INTO t1 VALUES(repeat('a', 200), 1); ALTER TABLE t1 ALGORITHM=COPY, ADD UNIQUE KEY(f2); ERROR 23000: Duplicate entry '1' for key 'f2_2' @@ -48,3 +50,4 @@ ALTER TABLE t2 ALGORITHM=COPY, FORCE; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t2, t1; +SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff new file mode 100644 index 00000000000..e39d5c0e9db --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff @@ -0,0 +1,18 @@ +--- foreign_null.result ++++ foreign_null,COPY.result +@@ -139,6 +139,7 @@ + ALTER TABLE `t#2` DROP INDEX f1; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#1` MODIFY COLUMN f2 INT; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00231' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Drop referenced index and modify column + CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +@@ -147,6 +148,7 @@ + ALTER TABLE `t#1` DROP INDEX f2; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00232' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Self referential modifying column + CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; diff --git a/mysql-test/suite/innodb/r/foreign_null.result b/mysql-test/suite/innodb/r/foreign_null.result new file mode 100644 index 00000000000..a5d1afc7e0c --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null.result @@ -0,0 +1,156 @@ +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); +# modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, +FOREIGN KEY(f1) REFERENCES `t#1`(f2) +ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +ERROR HY000: Cannot change column 'f2': used in a foreign key constraint 't#2_ibfk_1' of table 'test.t#2' +DROP TABLE `t#2`, `t#1`; +# modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# foreign key constraint for multiple columns +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +ERROR HY000: Cannot change column 'f1': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2' +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET f2= NULL; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE) +SELECT * FROM t2; +f1 +1 +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +f1 +1 +DROP TABLE t2, t1; +# Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, +FOREIGN KEY fdx(f2) REFERENCES t1(f1), +FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; +ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx; +ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1); +ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx; +DROP TABLE t2, t1; +# Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#2` DROP INDEX f1; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +DROP TABLE `t#2`, `t#1`; +# Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#1` DROP INDEX f2; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE `t#2`, `t#1`; +# Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; +ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/import_hidden_fts.result b/mysql-test/suite/innodb/r/import_hidden_fts.result index 4d1a0583281..a05734beb24 100644 --- a/mysql-test/suite/innodb/r/import_hidden_fts.result +++ b/mysql-test/suite/innodb/r/import_hidden_fts.result @@ -1,3 +1,5 @@ +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index=ON; call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, fulltext f_idx(f2), @@ -9,7 +11,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect con1,localhost,root,,; +connect block_purge,localhost,root,,; START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; DELETE FROM t1 WHERE f1 > 1; @@ -22,6 +24,7 @@ UNLOCK TABLES; Warnings: Warning 1235 This version of MariaDB doesn't yet support 'FLUSH TABLES on a table that had an FTS index, created on a hidden column, the auxiliary tables haven't been dropped as yet. FTS auxiliary tables will not be flushed.' DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, f3 INT as (f1) VIRTUAL, INDEX(f3), @@ -43,3 +46,4 @@ t1 CREATE TABLE `t1` ( KEY `f4` (`f4`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DROP TABLE t1; +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result index c85dcf22c06..b58d21b0914 100644 --- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result +++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result @@ -16,7 +16,7 @@ CONSTRAINT test FOREIGN KEY (b) REFERENCES t2 (id) ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") show warnings; Level Code Message -Warning 121 Create or Alter table `test`.`t2` with foreign key constraint failed. Foreign key constraint `test`.`test` already exists on data dictionary. Foreign key constraint names need to be unique in database. Error in foreign key definition: CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `test`.`t2` (`id`). +Warning 121 CREATE or ALTER TABLE `test`.`t2` failed: duplicate name, CONSTRAINT `test` FOREIGN KEY (`b`) REFERENCES `t2` (`id`) Error 1005 Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update") Warning 1022 Can't write; duplicate key in table 't2' drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 22295b5e8ce..98f711b314a 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -456,11 +456,11 @@ ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 drop index b, drop index c, drop index d; ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; -ERROR HY000: Cannot change column 'b': used in a foreign key constraint 't2_ibfk_1' +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 MODIFY b INT NOT NULL, ALGORITHM=INPLACE; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; SET FOREIGN_KEY_CHECKS=0; alter table t2 DROP COLUMN b, ALGORITHM=COPY; @@ -481,10 +481,10 @@ info: Records: 0 Duplicates: 0 Warnings: 0 set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 add primary key (alpha), change a alpha int, change b beta int not null, change c charlie int not null; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL alter table t2 add primary key (alpha), change a alpha int, change c charlie int not null, change d delta int not null; -ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_3' SET NULL +ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_3' SET NULL alter table t2 add primary key (alpha), change a alpha int, change b beta int, modify c int not null; affected rows: 0 diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 6de6447482e..f273d33ea6e 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3073,7 +3073,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; ALTER TABLE t2 MODIFY a INT NOT NULL; -ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; DELETE FROM t1; DROP TABLE t2,t1; diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result index e4c4e899995..e34d4f3cdc2 100644 --- a/mysql-test/suite/innodb/r/log_file_size_online.result +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -19,6 +19,12 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; Variable_name Value innodb_log_file_size 4194304 FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err +SET @save=@@GLOBAL.innodb_log_file_buffering; +SET GLOBAL innodb_log_file_buffering=OFF; +SET GLOBAL innodb_log_file_buffering=ON; +SET GLOBAL innodb_log_file_buffering=@save; +SET GLOBAL innodb_log_file_mmap=OFF; +Got one of the listed errors SET GLOBAL innodb_log_file_size=5242880; connect con1,localhost,root; UPDATE t SET b='' WHERE a<10; diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result index e939738e6b5..846bcc01f71 100644 --- a/mysql-test/suite/innodb/r/purge.result +++ b/mysql-test/suite/innodb/r/purge.result @@ -117,7 +117,30 @@ t12963823 CREATE TABLE `t12963823` ( KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_33); +EXECUTE IMMEDIATE c; +END; +$$ +ERROR 42000: Too many key parts specified; max 32 parts allowed +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_32); +EXECUTE IMMEDIATE c; +END; +$$ +INSERT INTO t1() VALUES(); InnoDB 0 transactions not purged SET GLOBAL innodb_stats_persistent = @save_stats_persistent; +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci; diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index 99c862fea77..a50e6fb1886 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -82,4 +82,22 @@ WHERE database_name='test' AND table_name='t1' AND stat_name='size'; TIMESTAMPDIFF(DAY,last_update,now())<=1 1 DROP TABLE t1; +# +# MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/alter_copy_bulk.test b/mysql-test/suite/innodb/t/alter_copy_bulk.test index bc78661197c..7cd39cba761 100644 --- a/mysql-test/suite/innodb/t/alter_copy_bulk.test +++ b/mysql-test/suite/innodb/t/alter_copy_bulk.test @@ -2,6 +2,8 @@ --source include/have_partition.inc --source include/have_sequence.inc +SET @default_stats_persistent= @@global.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= 0; CREATE TABLE t1(f1 CHAR(200), f2 INT NOT NULL)engine=InnoDB; INSERT INTO t1 SELECT repeat('a', 200), seq FROM seq_1_to_2; # Buffer fits in the memory @@ -66,3 +68,4 @@ ALTER TABLE t1 ALGORITHM=COPY, FORCE; ALTER TABLE t2 ALGORITHM=COPY, FORCE; --disable_info DROP TABLE t2, t1; +SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test index e0451e121a6..9abc198843b 100644 --- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test +++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test @@ -4,7 +4,9 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +--disable_cursor_protocol select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol connect (ddl, localhost, root,,); update performance_schema.setup_instruments set enabled='yes'; update performance_schema.setup_consumers set enabled='yes'; @@ -26,7 +28,9 @@ send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE; connection default; SET DEBUG_SYNC = 'now WAIT_FOR go'; +--disable_cursor_protocol select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol SELECT @final_count - @init_count; diff --git a/mysql-test/suite/innodb/t/foreign_null.combinations b/mysql-test/suite/innodb/t/foreign_null.combinations new file mode 100644 index 00000000000..e84e17b06ac --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.combinations @@ -0,0 +1,2 @@ +[COPY] +[INPLACE] diff --git a/mysql-test/suite/innodb/t/foreign_null.test b/mysql-test/suite/innodb/t/foreign_null.test new file mode 100644 index 00000000000..6869154fc9f --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.test @@ -0,0 +1,225 @@ +--source include/have_innodb.inc +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); + +let $MYSQLD_DATADIR= `select @@datadir`; +let $algorithm=`select regexp_replace('$MTR_COMBINATIONS', 'innodb,\|,innodb', '')`; + +--echo # modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, + FOREIGN KEY(f1) REFERENCES `t#1`(f2) + ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # foreign key constraint for multiple columns +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, + FOREIGN KEY fdx(f2) REFERENCES t1(f1), + FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1),ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=0; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#2` DROP INDEX f1,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +let $error_code=0; +if ($algorithm == "COPY") +{ + let $error_code= ER_ERROR_ON_RENAME; +} + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#1` DROP INDEX f2,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/group_commit.test b/mysql-test/suite/innodb/t/group_commit.test index 3a2018bec5d..1f7ebe55d3d 100644 --- a/mysql-test/suite/innodb/t/group_commit.test +++ b/mysql-test/suite/innodb/t/group_commit.test @@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; # So concurrent insert won't happen on the table INSERT INTO t1 VALUES(100); +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test index 107fc6f4056..0167a95fe4d 100644 --- a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test @@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; # So concurrent insert won't happen on the table INSERT INTO t1 VALUES("default"); +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/import_hidden_fts.test b/mysql-test/suite/innodb/t/import_hidden_fts.test index 4129e258fe1..406f11f7642 100644 --- a/mysql-test/suite/innodb/t/import_hidden_fts.test +++ b/mysql-test/suite/innodb/t/import_hidden_fts.test @@ -1,5 +1,11 @@ --source include/have_innodb.inc --source include/have_sequence.inc + +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=ON; + # Table with virtual, fulltext, instant add, instant drop column # and purgeable rows call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); @@ -13,7 +19,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect(con1,localhost,root,,); +connect(block_purge,localhost,root,,); START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -26,6 +32,7 @@ ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, @@ -44,3 +51,5 @@ ALTER TABLE t1 IMPORT TABLESPACE; --enable_warnings SHOW CREATE TABLE t1; DROP TABLE t1; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index c81c5820336..2acda08d2ca 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -168,7 +168,7 @@ alter table t4 drop index d; alter table t2 drop index b; --error ER_DROP_INDEX_FK alter table t2 drop index b, drop index c, drop index d; ---error ER_FK_COLUMN_CANNOT_CHANGE +--error ER_FK_COLUMN_NOT_NULL alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; # NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on. set @old_sql_mode = @@sql_mode; @@ -1188,8 +1188,10 @@ DROP TABLE t; --echo # CREATE TABLE t1 (a VARCHAR(8), PRIMARY KEY(a DESC)) ENGINE=InnoDB; ALTER TABLE t1 RENAME COLUMN a TO b, ALGORITHM=INPLACE; +--disable_cursor_protocol SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id; +--enable_cursor_protocol SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; DROP TABLE t1; @@ -1218,8 +1220,10 @@ DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), b INT, KEY(a DESC,b)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,'foo',10); ALTER TABLE t1 RENAME COLUMN b TO c, ALGORITHM=INPLACE; +--disable_cursor_protocol SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id ORDER BY INDEX_ID DESC LIMIT 1; +--enable_cursor_protocol SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_none.test b/mysql-test/suite/innodb/t/innodb-page_compression_none.test index e4eaae8bcb2..3ca0e1afe32 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_none.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_none.test @@ -6,8 +6,9 @@ SET @save_compression_algorithm=@@GLOBAL.innodb_compression_algorithm; SET GLOBAL innodb_compression_algorithm=0; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @compress_errors FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error'; - +--enable_cursor_protocol CREATE TABLE t (c INT) page_compressed=1 page_compression_level=4 ENGINE=InnoDB; INSERT INTO t VALUES (1); diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test index 663b76a1f18..14a85afe49f 100644 --- a/mysql-test/suite/innodb/t/innodb-system-table-view.test +++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test @@ -13,10 +13,12 @@ LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; # The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats may # vary depending on whether the tables have been rebuilt # by previously run tests. +--disable_cursor_protocol SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_table_stats'; SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_index_stats'; +--enable_cursor_protocol SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index e493b42a416..3da3b1c9260 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -30,8 +30,10 @@ ENGINE=INNODB; SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`'; +--disable_cursor_protocol SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +--enable_cursor_protocol let SPACE=`SELECT @space`; @@ -88,10 +90,12 @@ WHERE table_name = '`test`.`ib_bp_test`'; # Load the table so that entries in the I_S table do not appear as NULL select count(*) from ib_bp_test LIMIT 0; +--disable_cursor_protocol # Check that async reads are executed during bufferpool load select variable_value into @innodb_async_reads_total_count_before from information_schema.global_status where variable_name='innodb_async_reads_total_count'; +--enable_cursor_protocol # Load SET GLOBAL innodb_buffer_pool_load_now = ON; diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test index 84977925548..45acb64ee88 100644 --- a/mysql-test/suite/innodb/t/innodb_bug51920.test +++ b/mysql-test/suite/innodb/t/innodb_bug51920.test @@ -22,11 +22,13 @@ let $wait_condition = WHERE INFO="UPDATE bug51920 SET i=2"; -- source include/wait_condition.inc +--disable_cursor_protocol --enable_prepare_warnings SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO="UPDATE bug51920 SET i=2" INTO @thread_id; --disable_prepare_warnings +--enable_cursor_protocol KILL @thread_id; let $wait_condition = diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test index 30364c06bb3..2dfe671e4e1 100644 --- a/mysql-test/suite/innodb/t/innodb_force_recovery.test +++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test @@ -21,15 +21,19 @@ SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc let $status=`SHOW ENGINE INNODB STATUS`; +--disable_cursor_protocol SELECT CAST(variable_value AS INTEGER) INTO @read1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests'; +--enable_cursor_protocol select * from t1; +--disable_cursor_protocol SELECT CAST(variable_value AS INTEGER) INTO @read2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests'; +--enable_cursor_protocol SELECT @read1>0, @read2>@read1; diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index c4453302166..445fc0282d8 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -625,7 +625,9 @@ CREATE TABLE t2 (a INT, b INT, --echo # set up our data elements INSERT INTO t1 (d) VALUES (1); INSERT INTO t2 (a,b) VALUES (1,1); +--disable_cursor_protocol SELECT SECOND(c) INTO @bug47453 FROM t2; +--enable_cursor_protocol SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test index 294f283b259..85dc789d7b5 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test +++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test @@ -99,8 +99,10 @@ ANALYZE TABLE bug12429573; # innodb_index_stats have been updated to the same value. If the bug is # present this check will fail. +--disable_cursor_protocol SELECT last_update INTO @last FROM mysql.innodb_table_stats WHERE table_name = 'bug12429573'; +--enable_cursor_protocol SELECT * FROM mysql.innodb_index_stats WHERE table_name = 'bug12429573' AND last_update!=@last; diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index ec9bb0b8802..7ec5c147a7f 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -560,9 +560,11 @@ DROP TABLE t; --echo # CREATE TABLE t (id INT) ENGINE=InnoDB; --replace_result $MYSQLTEST_VARDIR VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval select 1 into outfile "$MYSQLTEST_VARDIR/tmp/t.outfile"; --enable_ps2_protocol +--enable_cursor_protocol BEGIN; --replace_result $MYSQLTEST_VARDIR VARDIR eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t.outfile' INTO TABLE t; diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 9d19e4028ae..a4eded01931 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -809,18 +809,24 @@ SELECT * FROM t1; DROP TABLE t1; eval CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) $engine; +--disable_cursor_protocol SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol INSERT INTO t1 VALUES (-42, -123456); --enable_info ALTER TABLE t1 CHANGE t s SMALLINT; +--disable_cursor_protocol SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; ALTER TABLE t1 CHANGE m i INT; +--disable_cursor_protocol SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --disable_info SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; INSERT IGNORE INTO t1 VALUES (0, -123456); diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 973980e4fca..fa2b65ad92e 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -130,9 +130,11 @@ INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3); ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT ''; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol UPDATE IGNORE t1 SET pk = 0; LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; HANDLER t1 OPEN AS h; diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test index 3b56144ca43..14224ab9c47 100644 --- a/mysql-test/suite/innodb/t/log_file_size_online.test +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -25,6 +25,17 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB; --source include/search_pattern_in_file.inc +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET @save=@@GLOBAL.innodb_log_file_buffering; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=OFF; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=ON; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_buffering=@save; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_log_file_mmap=OFF; + send SET GLOBAL innodb_log_file_size=5242880; --connect con1,localhost,root diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test index fef3b3c41ce..4c661579dcf 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.test +++ b/mysql-test/suite/innodb/t/mem_pressure.test @@ -24,9 +24,11 @@ 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; diff --git a/mysql-test/suite/innodb/t/page_cleaner.test b/mysql-test/suite/innodb/t/page_cleaner.test index 1941b0ae40f..267d69b63c5 100644 --- a/mysql-test/suite/innodb/t/page_cleaner.test +++ b/mysql-test/suite/innodb/t/page_cleaner.test @@ -14,9 +14,11 @@ WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; --source include/wait_condition.inc SET GLOBAL innodb_max_dirty_pages_pct=90.0; +--disable_cursor_protocol select variable_value into @innodb_async_writes_total_count_before from information_schema.global_status where variable_name='innodb_async_writes_total_count'; +--enable_cursor_protocol CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; diff --git a/mysql-test/suite/innodb/t/purge.test b/mysql-test/suite/innodb/t/purge.test index d51aa6bbcf5..a78f15dcc66 100644 --- a/mysql-test/suite/innodb/t/purge.test +++ b/mysql-test/suite/innodb/t/purge.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc +--source include/have_sequence.inc --source include/test_db_charset_latin1.inc SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent; @@ -111,11 +112,37 @@ CREATE INDEX ndx_n ON t12963823 (n(500)); CREATE INDEX ndx_o ON t12963823 (o(500)); CREATE INDEX ndx_p ON t12963823 (p(500)); SHOW CREATE TABLE t12963823; -# We need to activate the purge thread before DROP TABLE. +DELIMITER $$; +--error ER_TOO_MANY_KEY_PARTS +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_33); + EXECUTE IMMEDIATE c; +END; +$$ +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_32); + EXECUTE IMMEDIATE c; +END; +$$ +DELIMITER ;$$ +INSERT INTO t1() VALUES(); + +# We need to activate the purge thread before DROP TABLE. -- source include/wait_all_purged.inc SET GLOBAL innodb_stats_persistent = @save_stats_persistent; +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; --source include/test_db_charset_restore.inc diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 8507f182be6..727353b2492 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -102,8 +102,10 @@ let $wait_condition = 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); diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index ad421587283..79bc107d0ea 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -80,5 +80,29 @@ SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='t1' AND stat_name='size'; DROP TABLE t1; +--echo # +--echo # MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +--echo # +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; + +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; + +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; + +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; + +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; --echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/temp_table_savepoint.test b/mysql-test/suite/innodb/t/temp_table_savepoint.test index 604cbf7e5a8..9960961bb7b 100644 --- a/mysql-test/suite/innodb/t/temp_table_savepoint.test +++ b/mysql-test/suite/innodb/t/temp_table_savepoint.test @@ -142,9 +142,11 @@ update ignore t5 set c1 = 20 where c1 = 140 ; select count(*) from t5 where c1 = 140; --replace_result $MYSQLTEST_VARDIR VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t5.outfile" from t5; --enable_ps2_protocol +--enable_cursor_protocol create temporary table temp_1 engine = innodb as select * from t5 where 1=2; diff --git a/mysql-test/suite/innodb_fts/t/opt.test b/mysql-test/suite/innodb_fts/t/opt.test index 19dfdcad8fd..efcc47af4a7 100644 --- a/mysql-test/suite/innodb_fts/t/opt.test +++ b/mysql-test/suite/innodb_fts/t/opt.test @@ -30,6 +30,7 @@ ANALYZE TABLE t1; SET STATEMENT use_stat_tables=never FOR ANALYZE TABLE wp; +--disable_cursor_protocol --disable_ps2_protocol # @@ -549,6 +550,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE wp, t1; --enable_ps2_protocol +--enable_cursor_protocol # Tests for FT hints. diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index a0abbb82479..c3a270c9ec2 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -408,7 +408,10 @@ select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))) --enable_metadata create table t1 (g GEOMETRY); select * from t1; +#Check after fix MDEV-31540 +--disable_cursor_protocol select ST_asbinary(g) from t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol drop table t1; diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index 87438f50582..731dfe86c65 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -398,11 +398,14 @@ select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))) select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val; --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata create table t1 (g GEOMETRY); select * from t1; select ST_asbinary(g) from t1; --disable_metadata +--enable_cursor_protocol --enable_view_protocol drop table t1; @@ -1440,7 +1443,9 @@ SELECT ST_Union('', ''), md5(1); --echo # fields after MDEV-25459 --echo # CREATE TABLE t1(l LINESTRING NOT NULL, SPATIAL INDEX(l))ENGINE=InnoDB; +--disable_cursor_protocol SELECT GROUP_CONCAT(CONCAT(seq, ' ', seq) SEPARATOR ',') INTO @g FROM seq_0_to_504; +--enable_cursor_protocol INSERT INTO t1 SET l=ST_GeomFromText(CONCAT('LINESTRING(',@g,',0 0)')); SELECT COUNT(*) FROM t1 WHERE MBRIntersects(GeomFromText('Polygon((0 0,0 10,10 10,10 0,0 0))'), l); DROP TABLE t1; diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index ac2050e7b1b..634a85923d8 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -1044,6 +1044,51 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY jt ALL NULL NULL NULL NULL 40 Table function: json_table drop table t1; # +# MDEV-25822: JSON_TABLE: default values should allow non-string literals +# +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +col1 +0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +col1 +5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +col1 +asdf +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +col1 +-0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +col1 +18446744073709551615 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; +col1 +2021-01-01 +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +col1 +5 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 5 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +col1 +18446744073709551615 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 18446744073709551615 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +col1 +asdf +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 'asdf' ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +# # End of 10.6 tests # # diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index 87573e1a40f..eebd4d1a3f0 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -552,10 +552,12 @@ Warning 1366 Incorrect double value: 'asdf' for column ``.`(temporary)`.`f` at r Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`d` at row 1 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON EMPTY)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON ERROR)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; x @@ -568,12 +570,14 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON EMPTY)) jt' at line 4 +x +2020-01-01 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON ERROR)) jt' at line 4 +x +NULL # # Bug#25413069: SIG11 IN CHECK_COLUMN_GRANT_IN_TABLE_REF # diff --git a/mysql-test/suite/json/t/json_no_table.test b/mysql-test/suite/json/t/json_no_table.test index 1c071c7e6c2..92756259ad9 100644 --- a/mysql-test/suite/json/t/json_no_table.test +++ b/mysql-test/suite/json/t/json_no_table.test @@ -330,8 +330,11 @@ SELECT JSON_DEPTH( json_compact( '"abc"') ); --echo error ER_INVALID_TYPE_FOR_JSON SELECT JSON_DEPTH( 1 ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH( 'abc' ); +--enable_cursor_protocol # returns 1 SELECT JSON_DEPTH( json_compact( 1) ); @@ -372,11 +375,14 @@ SELECT JSON_DEPTH '[ "a", true, "b" , { "e" : false }, "c" , null ]' ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH ( '[ "a", true, "b" , { "e" : false }, "c" , null' ); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_REMOVE function. @@ -585,6 +591,8 @@ SELECT JSON_MERGE --echo error ER_INVALID_JSON_TEXT_IN_PARAM select json_type('abc'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol #select i, json_type(j) from t1; select json_type('{"a": 2}'); select json_type('[1,2]'); @@ -651,6 +659,7 @@ select json_type(json_compact(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0) select json_type(json_compact(null)); select json_type(json_compact(null)) is null; # check that it is an SQL NULL select json_type(null) is null; # is an SQL NULL +--enable_cursor_protocol # # same, but now show the printable value: @@ -882,7 +891,10 @@ select json_extract( '[1]', '$**[0]' ); # should have same result select json_extract( '{ "a": 1 }', '$.a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -890,7 +902,10 @@ select json_extract( '{ "a": 1 }', '$**.a' ); # should have same result select json_extract( '{ "a": 1 }', '$[0].a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have the same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -998,7 +1013,10 @@ select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc # NULLs select json_array_append(NULL, '$.b', json_compact(1)); select json_array_append('[1,2,3]', NULL, json_compact(1)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('[1,2,3]', '$', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1019,9 +1037,12 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6); --echo # Auto-wrapping, since because the paths identify scalars. --echo # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]} +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}', '$.b', json_compact(4), '$.c', json_compact('"grape"')); +--enable_cursor_protocol --echo # should return {"a": "foo", "b": [1, 2, 3, 4], --echo # "c": ["apple", "pear", "grape"]} @@ -1061,7 +1082,10 @@ SELECT JSON_ARRAY_APPEND --echo # Bug#21373874 ASSERTION `PARENT' FAILED --echo # ---------------------------------------------------------------------- +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('{"a":1}', '$[0]', 100); +--enable_cursor_protocol select json_array_append('3', '$[0]', 100); select json_array_append('3', '$[0][0][0][0]', 100); @@ -1072,7 +1096,10 @@ select json_array_append('3', '$[0][0][0][0]', 100); # NULLs select json_insert(NULL, '$.b', json_compact(1)); select json_insert('[1,2,3]', NULL, json_compact(1)); +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('[1,2,3]', '$[3]', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1089,7 +1116,10 @@ select json_insert('[1,2,3]', '$[3]', 4); select json_insert('[1,2,3]', '$[10]', 4); select json_insert('{"c":4}', '$.c', 4); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"c":4}', '$.a', 4); +--enable_cursor_protocol select json_insert('1', '$', 4); select json_insert('1', '$[0]', 4); @@ -1200,7 +1230,10 @@ SELECT JSON_INSERT # NULLs select json_array_insert(NULL, '$.b[1]', 1); select json_array_insert('[1,2,3]', NULL, 1); +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_insert('[1,2,3]', '$[3]', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1218,6 +1251,8 @@ select json_array_insert('true', '$.a', 1); --echo error ER_INVALID_JSON_PATH_ARRAY_CELL select json_array_insert('true', '$.a[1].b', 1); +#Enable after fix MDEV-31554 +--disable_cursor_protocol # nop if there is no array at the path's parent select json_array_insert( 'true', '$[0]', false ); select json_array_insert( 'true', '$[1]', false ); @@ -1243,6 +1278,7 @@ select json_array_insert( '[1, 2, 3, 4]', '$[2]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[3]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[4]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[5]', false ); +--enable_cursor_protocol select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false ); select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false ); @@ -1268,7 +1304,10 @@ select json_insert('[]', '$**[1]', 6); select json_insert('[]', '$[*][1]', 6); # multiple paths, +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false ); +--enable_cursor_protocol select json_array_insert( '[ 1, 2, 3 ]', '$[1]', json_compact( '[ "a", "b", "c", "d" ]'), '$[1][2]', false ); @@ -1297,9 +1336,12 @@ select json_set(NULL, NULL); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select json_set(NULL, NULL, NULL, NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # Detect errors in nested function calls. --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$')); +--enable_cursor_protocol # positive test cases @@ -1308,7 +1350,10 @@ select json_set('[1,2,3]', '$[3]', 4); select json_set('[1,2,3]', '$[10]', 4); select json_set('{"c":4}', '$.c', 5); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{"c":4}', '$.a', 5); +--enable_cursor_protocol select json_set('1', '$', 4); select json_set('1', '$[0]', 4); @@ -1355,10 +1400,13 @@ select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', json_compact('{}')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] } select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', json_compact('[true, false]')); +--enable_cursor_protocol # returns [ 1, null, null, 2 ] select json_set('1', '$[3]', 2); @@ -1376,6 +1424,8 @@ SELECT JSON_SET JSON_OBJECT() ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]} SELECT JSON_SET ( @@ -1391,6 +1441,7 @@ SELECT JSON_SET '$.c', JSON_ARRAY( json_compact( 'true'), json_compact( 'false') ) ); +--enable_cursor_protocol # returns [1, 2] SELECT JSON_SET @@ -1473,6 +1524,8 @@ select json_array('[1,2,3]', NULL, json_compact(1)); select json_array('[1,2,3]', '$[3]', NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive test cases select json_array(); select json_array(3.14); @@ -1483,6 +1536,7 @@ select json_array(b'0', b'1', b'10'); # returns the empty array: [] SELECT JSON_ARRAY(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_OBJECT function. @@ -1498,9 +1552,12 @@ select json_object( 'a', 1, 'b' ); --echo error ER_JSON_DOCUMENT_NULL_KEY select json_object( null, 1 ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive tests select json_object(); select json_object( 'a', null ); +--enable_cursor_protocol select json_object( 'a', 1 ); select json_object( 'a', 1, 'b', 'foo' ); select json_object( 'a', 1, 'b', 'foo', 'c', json_compact( '{ "d": "wibble" }') ); @@ -1517,8 +1574,11 @@ select json_object( cast(json_array() as char), json_array()); select json_object( 1, json_array()); select json_object( cast(1 as char), json_array()); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the empty object: {} SELECT JSON_OBJECT(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_SEARCH function. @@ -1710,17 +1770,23 @@ select json_type(case (null is null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type(case (null is not null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +--enable_cursor_protocol select json_type( if(null is null, json_compact('null'), json_compact('[1,2,3]')) ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type( if(null is not null, json_compact('null'), json_compact('[1,2,3]'))); +--enable_cursor_protocol select cast(json_extract(json_compact(concat('[', json_compact('["A",2]'), ']')), '$[0][1]') as char) = 2; @@ -1765,8 +1831,11 @@ select json_quote(convert('abc' using utf8mb4)); select json_unquote('abc'); # should do nothing select json_unquote('"abc"'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(convert('"abc"' using ascii)); select json_unquote(convert('"abc"' using latin1)); +--enable_cursor_protocol select json_unquote(convert('"abc"' using utf8)); select json_unquote(convert('"abc"' using utf8mb4)); @@ -1775,8 +1844,11 @@ select json_unquote('"'); # should do nothing --echo error ER_INCORRECT_TYPE select json_quote(123); # integer not allowed +# Enable after fix MDEV-31554 +--disable_cursor_protocol --echo error ER_INCORRECT_TYPE select json_unquote(123); # integer not allowed +--enable_cursor_protocol select json_unquote('""'); # empty string select char_length(json_unquote('""')); # verify empty string @@ -1810,21 +1882,30 @@ select json_unquote(json_unquote(json_unquote( # long round trip of it # DATE/TIME will lose their quotes, too: select json_compact(cast('2015-01-15 23:24:25' as datetime)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(cast('2015-01-15 23:24:25' as datetime))); +--enable_cursor_protocol # as well as opaque values: select json_compact(st_geomfromtext('point(1 1)')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(st_geomfromtext('point(1 1)'))); +--enable_cursor_protocol # examples from the wl7909 spec # returns the SQL string literal abc SELECT JSON_UNQUOTE( '"abc"' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the SQL string literal "abc SELECT JSON_UNQUOTE( '"abc' ); --echo error ER_INCORRECT_TYPE SELECT JSON_UNQUOTE( 123 ); +--enable_cursor_protocol # returns the SQL string literal abc SELECT JSON_UNQUOTE @@ -1966,7 +2047,10 @@ SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]'); select json_object("a", ifnull(json_quote('test'), json_compact('null'))); select json_compact(concat('[', json_quote('ab'), ']')); select json_compact(concat('[', json_unquote('"12"'), ']')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_compact(concat('["', json_type( json_compact(1)), '"]')); +--enable_cursor_protocol --echo # --echo # Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED @@ -2125,7 +2209,10 @@ select json_quote( json_type( json_compact('{}') ) ); --echo # WHEN EXECUTED IN A VIEW OR JOIN --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_TYPE(JSON_OBJECT()); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT()); SELECT * FROM v1; drop view v1; @@ -2158,8 +2245,11 @@ SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not --echo # FOR BOOL WHEN USED VIA VIEW --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT JSON_ARRAY('key1', false, 'key2', true); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT * FROM v1; CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true); @@ -2282,9 +2372,12 @@ SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100); # LEAST and GREATEST treat JSON arguments as strings for now. They used to hit # an assertion if used in a JSON context and all arguments were JSON values, or # a mix of NULLs and JSON values. +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL), GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j FROM (SELECT json_compact('1') AS j1, json_compact('2') AS j2) t; +--enable_cursor_protocol --echo # --echo # Start of 11.4 tests diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 767585bc69b..ba582ee44f2 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -896,6 +896,30 @@ explain select c, drop table t1; +--echo # +--echo # MDEV-25822: JSON_TABLE: default values should allow non-string literals +--echo # +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; + +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +show create view v; +drop view v; + + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test index 47bc58fddc1..1c970eab2d4 100644 --- a/mysql-test/suite/json/t/json_table_mysql.test +++ b/mysql-test/suite/json/t/json_table_mysql.test @@ -448,11 +448,8 @@ SELECT * FROM JSON_TABLE('"asdf"', '$' COLUMNS( f FLOAT PATH '$', d DECIMAL PATH '$')) AS jt; -# DEFAULT NULL is not accepted syntax. ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; @@ -460,13 +457,10 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; -# We don't accept dates in DEFAULT ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' diff --git a/mysql-test/suite/mariabackup/log_tables.result b/mysql-test/suite/mariabackup/log_tables.result index 840efc718e9..2528691f1b4 100644 --- a/mysql-test/suite/mariabackup/log_tables.result +++ b/mysql-test/suite/mariabackup/log_tables.result @@ -1,5 +1,7 @@ CREATE TABLE t(i INT) ENGINE ARIA TRANSACTIONAL=1 ROW_FORMAT=PAGE PAGE_CHECKSUM=1; +SET GLOBAL general_log = 0; +TRUNCATE mysql.general_log; SET GLOBAL general_log = 1; SET GLOBAL log_output = 'TABLE'; INSERT INTO t VALUES (1); diff --git a/mysql-test/suite/mariabackup/log_tables.test b/mysql-test/suite/mariabackup/log_tables.test index fe540a1ca91..707057a80e6 100644 --- a/mysql-test/suite/mariabackup/log_tables.test +++ b/mysql-test/suite/mariabackup/log_tables.test @@ -7,9 +7,9 @@ CREATE TABLE t(i INT) ENGINE ARIA TRANSACTIONAL=1 ROW_FORMAT=PAGE PAGE_CHECKSUM=1; ---let $general_log_old = `SELECT @@global.general_log` ---let $log_output_old = `SELECT @@global.log_output` - +# Truncate the log in order to make the test ./mtr --repeat proof +SET GLOBAL general_log = 0; +TRUNCATE mysql.general_log; SET GLOBAL general_log = 1; SET GLOBAL log_output = 'TABLE'; @@ -43,7 +43,3 @@ SELECT * FROM mysql.general_log --rmdir $targetdir DROP TABLE t; ---disable_query_log ---eval SET GLOBAL general_log = $general_log_old ---eval SET GLOBAL log_output = $log_output_old ---enable_query_log diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre index 3c9bbe9a6a6..9a18c53d61d 100644 --- a/mysql-test/suite/parts/inc/partition.pre +++ b/mysql-test/suite/parts/inc/partition.pre @@ -57,7 +57,9 @@ let $ER_NO_PARTITION_FOR_GIVEN_VALUE= 1526; # Set the variable $engine_other to a storage engine <> $engine --disable_query_log +--disable_cursor_protocol eval SELECT UPPER($engine) = 'MEMORY' INTO @aux; +--enable_cursor_protocol let $aux= `SELECT @aux`; if ($aux) { @@ -69,6 +71,7 @@ if (!$aux) } --enable_query_log +--disable_cursor_protocol # Numbers used for # - partitioning Example: ... PARTITION part1 VALUES LESS THAN ($max_row_div2) # - INSERT/SELECT/UPDATE/DELETE Example: ... WHERE f_int1 > @max_row_div3 @@ -102,6 +105,7 @@ WHERE f_int1 BETWEEN 2 * @max_row_div3 AND @max_row; # let $insert_all= INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +--enable_cursor_protocol # Column list with definition for all tables to be checked let $column_list= f_int1 INTEGER DEFAULT 0, diff --git a/mysql-test/suite/parts/inc/partition_alter3.inc b/mysql-test/suite/parts/inc/partition_alter3.inc index 395f93f44f6..feebcf4ffaa 100644 --- a/mysql-test/suite/parts/inc/partition_alter3.inc +++ b/mysql-test/suite/parts/inc/partition_alter3.inc @@ -28,8 +28,10 @@ SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR) FROM t0_template WHERE f_int1 + 999 BETWEEN 1000 AND 9999; # 3. Calculate the number of inserted records. +--disable_cursor_protocol SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1) INTO @exp_row_count; +--enable_cursor_protocol # DEBUG SELECT @exp_row_count; # 4. Print the layout, check Readability --source suite/parts/inc/partition_layout.inc diff --git a/mysql-test/suite/parts/inc/partition_check.inc b/mysql-test/suite/parts/inc/partition_check.inc index ed323dfa245..4dad6bff16f 100644 --- a/mysql-test/suite/parts/inc/partition_check.inc +++ b/mysql-test/suite/parts/inc/partition_check.inc @@ -64,6 +64,7 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol let $my_stmt= SELECT COUNT(*) <> 0 INTO @aux FROM t1 WHERE f_int1 <> f_int2 OR f_char1 <> CAST(f_int1 AS CHAR) OR f_char1 <> f_char2 OR f_charbig <> CONCAT('===',f_char1,'===') @@ -148,6 +149,7 @@ if ($run) --echo # Sorry, have to abort. exit; } +--enable_cursor_protocol # Give a success message like in the other following tests --echo # check MIN/MAX(f_int2) success: 1 @@ -368,17 +370,21 @@ AND (MIN(f_int1) = 1) AND (MAX(f_int1) = @max_row) AS "" FROM t1; if ($any_unique) { # Calculate the number of records, where we will try INSERT ..... or REPLACE + --disable_cursor_protocol SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol # # Calculate the number of records, where we will get DUPLICATE KEY # f_int1 is sufficient for calculating this, because 1.1 # checks, that f_int1 = f_int2 is valid for all rows. + --disable_cursor_protocol SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol if ($debug) { SELECT @try_count, @clash_count; @@ -390,7 +396,9 @@ if ($any_unique) # 4 Some operations with single records # 4.1 Insert one record with a value for f_int1 which is lower than in all # existing records. +--disable_cursor_protocol SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -408,7 +416,9 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # # 4.2 Insert one record with a value for f_int1 which is higher than in all # existing records. +--disable_cursor_protocol SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -428,8 +438,10 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # the highest value of all existing records. # If f_int1 is used for the partitioning expression a movement of the # record to another partition/subpartition might appear. +--disable_cursor_protocol SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +--enable_cursor_protocol UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # Check of preceding statement via Select @@ -447,7 +459,9 @@ WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # record to another partition/subpartition might appear. # f_int1 gets the delicate value '-1'. SET @cur_value1= -1; +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +--enable_cursor_protocol # Bug#15968: Partitions: crash when INSERT with f_int1 = -1 into PARTITION BY HASH(f_int1) UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; @@ -461,7 +475,9 @@ WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; --enable_query_log # # 4.5 Delete the record with the highest value of f_int1. +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value FROM t1; +--enable_cursor_protocol DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # Check of preceding statements via Select if ($no_debug) @@ -751,8 +767,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(f_int1) INTO @start_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @start_count <> 0`; if ($run) @@ -770,7 +788,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol --enable_query_log # 7.1 Successful INSERT + COMMIT INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -839,8 +859,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-6 success: ' AS "", @my_count IN (0,@exp_inserted_rows) AS ""; let $run= `SELECT @my_count = 0`; @@ -872,7 +894,9 @@ COMMIT WORK; # 7.3 Failing INSERT (in mid of statement processing) + COMMIT SET @@session.sql_mode = 'traditional'; # Number of records where a INSERT has to be tried +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol # --disable_abort_on_error INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -890,8 +914,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-8 success: ' AS "", @my_count IN (@max_row_div2 - 1 - @max_row_div4 + 1,0) AS ""; let $run= `SELECT @my_count = @max_row_div2 - 1 - @max_row_div4 + 1`; diff --git a/mysql-test/suite/parts/inc/partition_check_read.inc b/mysql-test/suite/parts/inc/partition_check_read.inc index e42bb9c90ab..280580d67a6 100644 --- a/mysql-test/suite/parts/inc/partition_check_read.inc +++ b/mysql-test/suite/parts/inc/partition_check_read.inc @@ -27,7 +27,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE $col_to_check = $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -46,7 +48,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = @max_row + $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -64,7 +68,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = 1 - $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read1.inc b/mysql-test/suite/parts/inc/partition_check_read1.inc index 0b8b800a371..cb6b839130a 100644 --- a/mysql-test/suite/parts/inc/partition_check_read1.inc +++ b/mysql-test/suite/parts/inc/partition_check_read1.inc @@ -26,7 +26,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = '1000-02-10'; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -43,7 +45,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @exp_row_count INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -63,8 +67,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = CONCAT(CAST(999 + $num AS CHAR),'-02-10'); + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read2.inc b/mysql-test/suite/parts/inc/partition_check_read2.inc index 60964355d14..36421dec115 100644 --- a/mysql-test/suite/parts/inc/partition_check_read2.inc +++ b/mysql-test/suite/parts/inc/partition_check_read2.inc @@ -22,7 +22,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -39,7 +41,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @max_row INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -59,8 +63,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 23e4a9e1e95..6e98eb16223 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -58,11 +58,13 @@ eval INSERT INTO t0_definition SET state = 'new', file_list = @aux; # Print the old and new table layout, if they differ +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t0_definition tab1, t0_definition tab2 WHERE tab1.state = 'old' AND tab2.state = 'new' AND tab1.create_command = tab2.create_command AND tab1.file_list = tab2.file_list; +--enable_cursor_protocol let $run= `SELECT @aux`; if ($run) { diff --git a/mysql-test/suite/parts/inc/partition_trigg1.inc b/mysql-test/suite/parts/inc/partition_trigg1.inc index 7bb5aa162a9..c0d6ba4e867 100644 --- a/mysql-test/suite/parts/inc/partition_trigg1.inc +++ b/mysql-test/suite/parts/inc/partition_trigg1.inc @@ -24,7 +24,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','DELETE') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) @@ -72,7 +74,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','INSERT') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) diff --git a/mysql-test/suite/parts/inc/partition_trigg3.inc b/mysql-test/suite/parts/inc/partition_trigg3.inc index 34dbf4e2cd1..4d461a8a755 100644 --- a/mysql-test/suite/parts/inc/partition_trigg3.inc +++ b/mysql-test/suite/parts/inc/partition_trigg3.inc @@ -46,7 +46,9 @@ delimiter ;| # Additional statements because of Bug(limitation)#17704 SET @counter = 1; # Bug#18730 Partitions: crash on SELECT MIN() +--disable_cursor_protocol SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +--enable_cursor_protocol # Additional statements end eval $statement; DROP TRIGGER trg_3; diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index f875da01572..8eab745e004 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -3280,7 +3280,7 @@ x 42 52 alter table t1 convert partition p2 to table tp2; -ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)") +ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 0 "Internal error/check (Not system error)") # d,error_convert_partition_00: AFTER failure db.opt t1#P#p1.MYD @@ -3367,7 +3367,7 @@ x 52 LOCK TABLE t1 WRITE; alter table t1 convert partition p2 to table tp2; -ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)") +ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 0 "Internal error/check (Not system error)") # d,error_convert_partition_00: AFTER failure (under LOCK TABLE) db.opt t1#P#p1.MYD diff --git a/mysql-test/suite/perfschema/t/alter_table_progress.test b/mysql-test/suite/perfschema/t/alter_table_progress.test index d4933ac9006..7577672f12e 100644 --- a/mysql-test/suite/perfschema/t/alter_table_progress.test +++ b/mysql-test/suite/perfschema/t/alter_table_progress.test @@ -34,9 +34,11 @@ update performance_schema.threads truncate table performance_schema.events_statements_history_long; truncate table performance_schema.events_stages_history_long; +--disable_cursor_protocol --disable_query_log eval select $con1_THREAD_ID into @con1_thread_id; --enable_query_log +--enable_cursor_protocol --connection con1 @@ -52,10 +54,12 @@ SET DEBUG_SYNC='copy_data_between_tables_before SIGNAL found_row WAIT_FOR wait_r SET DEBUG_SYNC='now WAIT_FOR found_row'; # Find the statement id of the ALTER TABLE +--disable_cursor_protocol --enable_prepare_warnings select event_id from performance_schema.events_statements_current where thread_id = @con1_thread_id into @con1_stmt_id; --disable_prepare_warnings +--enable_cursor_protocol # completed 0 select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED diff --git a/mysql-test/suite/perfschema/t/dml_handler.test b/mysql-test/suite/perfschema/t/dml_handler.test index d289d89ce50..a1d5bc01f3f 100644 --- a/mysql-test/suite/perfschema/t/dml_handler.test +++ b/mysql-test/suite/perfschema/t/dml_handler.test @@ -21,9 +21,11 @@ CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS WHERE TABLE_SCHEMA='performance_schema' ORDER BY TABLE_NAME; +--disable_cursor_protocol --enable_prepare_warnings SELECT COUNT(*) FROM table_list INTO @table_count; +--enable_cursor_protocol let $count=`SELECT @table_count`; @@ -34,7 +36,9 @@ let $count=`SELECT @table_count`; while ($count > 0) { + --disable_cursor_protocol eval SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=$count; + --enable_cursor_protocol let $table_name = `SELECT @table_name`; --error ER_ILLEGAL_HA eval HANDLER performance_schema.$table_name OPEN; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test index d304cc5a1b8..58077973248 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index 6420b8b5300..ab3fd73ab45 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -17,8 +17,10 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connections into @saved_max_connections; select @@global.max_user_connections into @saved_max_user_connections; +--enable_cursor_protocol create user 'quota'@'santa.claus.ipv4.example.com'; grant select on test.* to 'quota'@'santa.claus.ipv4.example.com'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test index 6da99e02444..9d845b5e296 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index 7e412fdb545..f019ccf4ed0 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -23,13 +23,17 @@ reset query cache; flush global status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; show global status like "Qcache_hits"; +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; diff --git a/mysql-test/suite/perfschema/t/rpl_threads.test b/mysql-test/suite/perfschema/t/rpl_threads.test index fcecf775722..a7aa1fcff3b 100644 --- a/mysql-test/suite/perfschema/t/rpl_threads.test +++ b/mysql-test/suite/perfschema/t/rpl_threads.test @@ -29,11 +29,13 @@ connection master; # Read the ID of the binlog dump connection, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where COMMAND = "Binlog Dump" into @master_dump_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -49,11 +51,13 @@ sync_slave_with_master; # Read the ID of the SLAVE IO thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Waiting for master to send event%" into @slave_io_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -66,11 +70,13 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE # Read the ID of the SLAVE SQL thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Slave has read all relay log%" into @slave_sql_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST diff --git a/mysql-test/suite/perfschema/t/socket_connect.test b/mysql-test/suite/perfschema/t/socket_connect.test index 8290e289df1..3eae8fe2680 100644 --- a/mysql-test/suite/perfschema/t/socket_connect.test +++ b/mysql-test/suite/perfschema/t/socket_connect.test @@ -16,6 +16,7 @@ let $my_socket_debug_dbug=0; --echo #============================================================================== --source ../include/socket_ipv6.inc +--disable_cursor_protocol --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== @@ -291,3 +292,4 @@ WHERE EVENT_NAME LIKE '%client_connection%' AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin; --source include/wait_condition.inc exit; +--enable_cursor_protocol diff --git a/mysql-test/suite/perfschema/t/socket_instances_func.test b/mysql-test/suite/perfschema/t/socket_instances_func.test index 7e8dfe51d2f..266080fc696 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func.test @@ -51,9 +51,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -71,14 +73,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -99,14 +105,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port= `SELECT @port`; @@ -127,14 +137,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 3 (unix domain) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 3 (unix domain) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con3_port= `SELECT @port`; let $con3_thread_id= `SELECT @thread_id`; @@ -237,9 +251,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT DISTINCT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; @@ -270,9 +286,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; # Store the thread id of 'server_unix_socket' --echo # Get the 'server_unix_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; +--enable_cursor_protocol let $server_unix_thread_id= `SELECT @thread_id`; @@ -306,7 +324,9 @@ WHERE THREAD_ID = @thread_id; --echo #Compare server listener socket thread ids --disable_query_log ONCE +--disable_cursor_protocol eval SELECT ($server_tcpip_thread_id = $server_unix_thread_id) into @match_thread_id; +--disable_cursor_protocol select @match_thread_id; diff --git a/mysql-test/suite/perfschema/t/socket_instances_func_win.test b/mysql-test/suite/perfschema/t/socket_instances_func_win.test index 5faf0d24ec4..24774a51fa2 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func_win.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func_win.test @@ -47,9 +47,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -70,14 +72,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -102,14 +108,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port = `SELECT @port`; @@ -216,9 +226,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test index 4a6ee2b6277..aebe64e3f59 100644 --- a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test +++ b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test @@ -41,8 +41,10 @@ let $my_socket_debug_dbug= 0; --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== +--disable_cursor_protocol SELECT @@hostname INTO @MY_HOSTNAME; SELECT @@port INTO @MY_MASTER_PORT; +--enable_cursor_protocol if ($my_socket_debug) { @@ -145,7 +147,7 @@ WHERE t_inst.event_name LIKE '%client%' --connection default UPDATE performance_schema.threads SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID(); - +--disable_cursor_protocol --echo # --echo # 1.2 Get the default THREAD_ID; --echo # @@ -161,6 +163,7 @@ let $default_object_instance_begin= `SELECT @my_object_instance_begin`; --disable_query_log SELECT @my_object_instance_begin INTO @default_object_instance_begin; --enable_query_log +--enable_cursor_protocol if ($my_socket_debug) { diff --git a/mysql-test/suite/perfschema/t/table_schema.test b/mysql-test/suite/perfschema/t/table_schema.test index 935bd667f2d..6abbd403837 100644 --- a/mysql-test/suite/perfschema/t/table_schema.test +++ b/mysql-test/suite/perfschema/t/table_schema.test @@ -16,9 +16,11 @@ select * from information_schema.columns where table_schema="performance_schema" # Count the number of NUMBER_OF_BYTES columns. +--disable_cursor_protocol select count(*) into @count_byte_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%number_of_bytes"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -26,10 +28,12 @@ select @count_byte_columns > 0; # Confirm that all NUMBER_OF_BYTES columns are BIGINT signed. +--disable_cursor_protocol select count(*) into @count_byte_signed from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%number_of_bytes" and column_type not like "%unsigned"; +--enable_cursor_protocol select (@count_byte_columns - @count_byte_signed) = 0; @@ -38,9 +42,11 @@ select (@count_byte_columns - @count_byte_signed) = 0; # # Count the number of OBJECT_INSTANCE_BEGIN columns. +--disable_cursor_protocol select count(*) into @count_object_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%object_instance_begin"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -48,10 +54,12 @@ select @count_object_columns > 0; # Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned. +--disable_cursor_protocol select count(*) into @count_object_unsigned from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%object_instance_begin" and column_type like "%unsigned"; +--enable_cursor_protocol select (@count_object_columns - @count_object_unsigned) = 0; diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test index a6adaec75f1..c50fc5446c1 100644 --- a/mysql-test/suite/perfschema/t/thread_cache.test +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -36,8 +36,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # Expect 1, connection_id() is incremented for each new connection @@ -82,8 +84,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -110,8 +114,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -154,8 +160,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # When caching threads, the pthread that executed con2 was parked in the diff --git a/mysql-test/suite/perfschema/t/threads_mysql.test b/mysql-test/suite/perfschema/t/threads_mysql.test index e19b3664f21..cf0a1386b5f 100644 --- a/mysql-test/suite/perfschema/t/threads_mysql.test +++ b/mysql-test/suite/perfschema/t/threads_mysql.test @@ -64,7 +64,9 @@ TRUNCATE t1; INSERT INTO t1 SELECT thread_id FROM performance_schema.threads WHERE name LIKE 'thread/sql%'; +--disable_cursor_protocol SELECT COUNT(*) INTO @aux FROM t1; +--enable_cursor_protocol # Attention: # Just waiting for some new thread showing up is not sufficient because diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test index e20811c6096..aadd4cc7e65 100644 --- a/mysql-test/suite/period/t/overlaps.test +++ b/mysql-test/suite/period/t/overlaps.test @@ -264,18 +264,22 @@ insert into t values (1, '2020-03-03', '2020-03-10') on duplicate key update x = 2; select * from t; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'tmp_t.txt' into table t; --error ER_NOT_SUPPORTED_YET load data infile 'tmp_t.txt' replace into table t; remove_file $MYSQLD_DATADIR/test/tmp_t.txt; insert into t values (1, '2020-03-01', '2020-03-05'); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY load data infile 'tmp_t.txt' into table t; diff --git a/mysql-test/suite/period/t/versioning.test b/mysql-test/suite/period/t/versioning.test index 5d38d81349e..45ca12469df 100644 --- a/mysql-test/suite/period/t/versioning.test +++ b/mysql-test/suite/period/t/versioning.test @@ -12,7 +12,9 @@ eval create table t ( insert into t values('1999-01-01', '2018-12-12'), ('1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -28,7 +30,9 @@ insert into t values('1999-01-01', '2018-12-12'), --let $trig_table=t --source suite/period/create_triggers.inc +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -47,7 +51,9 @@ eval create or replace table t (x int, s date, e date, insert into t values(1, '1999-01-01', '2018-12-12'), (2, '1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol --sorted_result select * from t; diff --git a/mysql-test/suite/plugins/r/fulltext_plugin.result b/mysql-test/suite/plugins/r/fulltext_plugin.result index 2c104c98676..6fcba7735c9 100644 --- a/mysql-test/suite/plugins/r/fulltext_plugin.result +++ b/mysql-test/suite/plugins/r/fulltext_plugin.result @@ -1,3 +1,6 @@ +# +# BUG#39746 - Debug flag breaks struct definition (server crash) +# INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; @@ -5,3 +8,11 @@ DROP TABLE t1; UNINSTALL PLUGIN simple_parser; show status like 'a%status'; Variable_name Value +# +# MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +# +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; +# End of 10.5 tests diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test index f67397afdfe..cb154cae7ad 100644 --- a/mysql-test/suite/plugins/t/feedback_plugin_load.test +++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test @@ -18,7 +18,9 @@ select plugin_status from information_schema.plugins where plugin_name='feedback # so lets get back to it if it ever happens. # Lets say the plugin was used X times before this SELECT +--disable_cursor_protocol SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used'; +--enable_cursor_protocol # Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used'; diff --git a/mysql-test/suite/plugins/t/fulltext_plugin.test b/mysql-test/suite/plugins/t/fulltext_plugin.test index e9b4343e0dc..f6f6e169945 100644 --- a/mysql-test/suite/plugins/t/fulltext_plugin.test +++ b/mysql-test/suite/plugins/t/fulltext_plugin.test @@ -1,8 +1,9 @@ +--source include/not_embedded.inc --source include/have_simple_parser.inc -# -# BUG#39746 - Debug flag breaks struct definition (server crash) -# +--echo # +--echo # BUG#39746 - Debug flag breaks struct definition (server crash) +--echo # --replace_result .dll .so eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); @@ -15,3 +16,12 @@ UNINSTALL PLUGIN simple_parser; # show status like 'a%status'; +--echo # +--echo # MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +--echo # +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test index de3e9d59b01..5345bac12ff 100644 --- a/mysql-test/suite/plugins/t/qc_info.test +++ b/mysql-test/suite/plugins/t/qc_info.test @@ -4,10 +4,12 @@ set @save_query_cache_size=@@global.query_cache_size; # test that hits are correctly incremented reset query cache; +--disable_cursor_protocol --disable_ps2_protocol select * from t1; select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select hits, statement_text from information_schema.query_cache_info; drop table t1; diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc index c69ffa07ca8..8c2d4b6e227 100644 --- a/mysql-test/suite/plugins/t/qc_info_init.inc +++ b/mysql-test/suite/plugins/t/qc_info_init.inc @@ -9,11 +9,14 @@ set global query_cache_size=1355776; create table t1 (a int not null); insert into t1 values (1),(2),(3); +--disable_cursor_protocol --disable_ps2_protocol select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +--disable_cursor_protocol select @@time_zone into @time_zone; select @@default_week_format into @default_week_format; select @@character_set_client into @character_set_client; @@ -32,6 +35,7 @@ select * from t1; --enable_ps2_protocol --enable_result_log set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; +--enable_cursor_protocol --sorted_result --replace_column 5 # 20 # 24 # diff --git a/mysql-test/suite/roles/grant_revoke_current.test b/mysql-test/suite/roles/grant_revoke_current.test index fda55358b20..1c7bb0402df 100644 --- a/mysql-test/suite/roles/grant_revoke_current.test +++ b/mysql-test/suite/roles/grant_revoke_current.test @@ -1,5 +1,8 @@ --source include/not_embedded.inc + +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol --error ER_MALFORMED_DEFINER grant select on *.* to current_role; diff --git a/mysql-test/suite/roles/set_default_role_ps-6960.test b/mysql-test/suite/roles/set_default_role_ps-6960.test index fd965c2aa75..ce7bb96b5bb 100644 --- a/mysql-test/suite/roles/set_default_role_ps-6960.test +++ b/mysql-test/suite/roles/set_default_role_ps-6960.test @@ -4,7 +4,9 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol create role r1; prepare stmt from "set password = '11111111111111111111111111111111111111111'"; diff --git a/mysql-test/suite/rpl/include/check_type.inc b/mysql-test/suite/rpl/include/check_type.inc index c72754cad4f..26276391a63 100644 --- a/mysql-test/suite/rpl/include/check_type.inc +++ b/mysql-test/suite/rpl/include/check_type.inc @@ -43,7 +43,9 @@ connection master; eval INSERT INTO t1 VALUES(1, $source_value); if ($can_convert) { sync_slave_with_master; + --disable_cursor_protocol eval SELECT a = $target_value into @compare FROM t1; + --enable_cursor_protocol eval INSERT INTO type_conversions SET Source = "$source_type", Target = "$target_type", diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test index 6bc872cabe5..0a436b28b20 100644 --- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test +++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test @@ -37,9 +37,11 @@ source include/wait_for_slave_sql_to_stop.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read = $exec into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as one from ti; @@ -91,9 +93,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as zero from ti; @@ -130,9 +134,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select max(a) as two from tm; select max(a) as one from ti; diff --git a/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc new file mode 100644 index 00000000000..7f3602d6979 --- /dev/null +++ b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc @@ -0,0 +1,82 @@ +# ==== Purpose ==== +# +# If using DEBUG_SYNC to coordinate a slave's SQL DELAY via the DEBUG_DBUG +# identifier "sql_delay_by_debug_sync", this helper file will help synchronize +# a slave with the master for statements which don't need to be delayed. This +# can be helpful, for example, for setup/cleanup statements, if they must be +# run in the same lifetime as the statements used for the test. +# +# The actual synchronization will take place based on the input parameter +# slave_sync_method, which can be "gtid", "file_coord", or "none"; and will use +# the helper files sync_with_master_gtid.inc or sync_with_master.inc (or none +# at all), respectively. +# +# +# ==== Requirements ==== +# +# --source include/have_debug.inc +# --source include/have_debug_sync.inc +# set @@GLOBAL.debug_dbug= "+d,sql_delay_by_debug_sync"; +# +# +# ==== Usage ==== +# +# --let $slave_sync_method= gtid|file_coord|none +# [--let $num_event_groups= NUMBER] +# --source include/sync_with_master_sql_delay_debug_sync.inc +# +# +# Parameters: +# $slave_sync_method +# Value can be gtid, file_coord, or none; and will synchronize the slave +# with the master via this method (i.e. using sync_with_master_gtid.inc +# or sync_with_master.inc, respectively), after synchronizing the SQL +# delay +# +# $num_event_groups +# Number of event groups to synchronize the SQL delay for. If unset, will +# be default to 1. +# + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/begin_include_file.inc + +if (!$slave_sync_method) +{ + --die Parameter slave_sync_method must be set +} + +if (`select "$slave_sync_method" not like "gtid" and "$slave_sync_method" not like "file_coord" and "$slave_sync_method" not like "none"`) +{ + --die Parameter slave_sync_method must have value "gtid", "file_coord" or "none" +} + +if (`select "$slave_sync_method" not like "none" and strcmp("$master_pos", "") = 0`) +{ + --die sync_with_master.inc or sync_with_master_gtid.inc was not called to populate variable master_pos +} + +if (!$num_event_groups) +{ + --let $num_event_groups= 1 +} + +while ($num_event_groups) +{ + set debug_sync= "now WAIT_FOR at_sql_delay"; + set debug_sync= "now SIGNAL continue_sql_thread"; + --dec $num_event_groups +} + +if (`select "$slave_sync_method" LIKE "gtid"`) +{ + --source include/sync_with_master_gtid.inc +} + +if (`select "$slave_sync_method" LIKE "file_coord"`) +{ + --source include/sync_with_master.inc +} + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result index c41de974588..1c00180b3cc 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result @@ -5,14 +5,20 @@ include/master-slave.inc # connection slave; include/stop_slave.inc -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; -change master to master_delay=3, master_use_gtid=Slave_Pos; +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; +change master to master_delay=1, master_use_gtid=Slave_Pos; include/start_slave.inc connection master; create table t1 (a int); create table t2 (a int); -include/sync_slave_sql_with_master.inc +include/save_master_gtid.inc +connection slave; +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # # Pt 1) Ensure SBM is updated immediately upon arrival of the next event connection master; @@ -21,6 +27,7 @@ insert into t1 values (0); include/save_master_gtid.inc connection slave; # Waiting for transaction to arrive on slave and begin SQL Delay.. +set debug_sync= "now WAIT_FOR at_sql_delay"; # Validating SBM is updated on event arrival.. # ..done # MDEV-33856: New definition for Seconds_Behind_Master @@ -31,7 +38,17 @@ connection slave; # MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently # delaying a transaction; then when the reciprocal START SLAVE occurs, # if the event is still to be delayed, SBM should resume accordingly -include/stop_slave.inc +connection server_2; +# Ensure the kill from STOP SLAVE will be received before continuing the +# SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +STOP SLAVE; +connection slave; +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; +connection server_2; +include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; # Lock t1 on slave to ensure the event can't finish (and thereby update # Seconds_Behind_Master) so slow running servers don't accidentally # catch up to the master before checking SBM. @@ -39,6 +56,10 @@ connection server_2; LOCK TABLES t1 WRITE; include/start_slave.inc connection slave; +# SQL delay has no impact for the rest of the test case, so ignore it +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Waiting for replica to get blocked by the table lock # Sleeping 1s to increment SBM # Ensuring Seconds_Behind_Master increases after sleeping.. @@ -62,6 +83,13 @@ insert into t1 values (2); include/save_master_pos.inc connection slave; # Wait for first transaction to complete SQL delay and begin execution.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +# Wait for second transaction to complete SQL delay.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. # ..and that SBM wasn't calculated using prior committed transactions # ..done @@ -71,6 +99,8 @@ include/wait_for_slave_param.inc [Relay_Master_Log_File] include/wait_for_slave_param.inc [Exec_Master_Log_Pos] # Cleanup include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; CHANGE MASTER TO master_delay=0; include/start_slave.inc # diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test index 020dc63557f..ae4b0884228 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -58,9 +58,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' --enable_ps2_protocol +--enable_cursor_protocol ### ACTION: create a small file (< 4096 bytes) that will be later used ### in LOAD DATA INFILE to check for absence of binlog errors @@ -69,9 +71,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' --enable_ps2_protocol +--enable_cursor_protocol RESET MASTER; diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 7e5232974f9..bdedcaa3308 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } source include/have_binlog_format_mixed_or_row.inc; diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test index 762006eb6c4..0152a96617d 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -119,7 +119,9 @@ let $1=100; begin; while ($1) { + --disable_cursor_protocol eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + --enable_cursor_protocol set @data = repeat('a', @act_size); insert into t2 set data = @data; dec $1; @@ -162,7 +164,9 @@ let $1= 300; begin; while ($1) { + --disable_cursor_protocol eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + --enable_cursor_protocol insert into t3 set data= repeat('a', @act_size); dec $1; } diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 1350585ff93..2b757f57692 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -343,7 +343,9 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; --connection master DROP USER user_bug27606@localhost; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1'; +--enable_cursor_protocol update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 245ab8b609c..ef918842d4e 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -10,11 +10,13 @@ drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); insert into mysqltest1.t1 values (1); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); --replace_result \\ / 66 39 93 39 17 39 247 39 41 39 "File exists" "Directory not empty" diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 1d66c327633..f33ecfd7088 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -4,9 +4,9 @@ # Purpose: To test that event effects are replicated. # ################################################################## -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source include/master-slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index ee6daac71ea..1b93ddc3f0a 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -229,15 +229,19 @@ SET INSERT_ID=2; SET @c=2; SET @@rand_seed1=10000000, @@rand_seed2=1000000; INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored +--disable_cursor_protocol SELECT b into @b FROM test.t5; +--enable_cursor_protocol --let $b_master=`select @b` UPDATE test.t1 SET a=2; # to run trigger on slave --sync_slave_with_master # The proof: +--disable_cursor_protocol SELECT a AS 'ONE' into @a FROM test.t_slave; SELECT c AS 'NULL' into @c FROM test.t_slave; +--enable_cursor_protocol let $count= 1; let $table= test.t_slave; @@ -249,7 +253,9 @@ if (`SELECT @a != 2 and @c != NULL`) --die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context. } +--disable_cursor_protocol SELECT b into @b FROM test.t_slave; +--enable_cursor_protocol --let $b_slave=`select @b` --let $assert_text= Random values from master and slave must be different diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test index 5c17653da8a..cc32220f5d7 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test @@ -67,8 +67,10 @@ EOF # Since we injected error in the cleanup code, the rows should remain in # mysql.gtid_slave_pos. Check that we have at least 20 (more robust against # non-deterministic cleanup and future changes than checking for exact number). +--disable_cursor_protocol SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no FROM mysql.gtid_slave_pos; +--disable_cursor_protocol SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count)); SET GLOBAL debug_dbug= @old_dbug; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index acce6651b8d..0612aa6a565 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } --source include/no_valgrind_without_big.inc --let $rpl_topology=1->2 diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_local.test b/mysql-test/suite/rpl/t/rpl_loaddata_local.test index 01f5607ba0b..975bd110739 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_local.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_local.test @@ -27,9 +27,11 @@ set SQL_LOG_BIN=1; enable_query_log; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol #This will generate a 20KB file, now test LOAD DATA LOCAL truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -52,9 +54,11 @@ connection master; create table t1(a int); insert into t1 values (1), (2), (2), (3); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; create table t1(a int primary key); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -83,9 +87,11 @@ SET sql_mode='ignore_space'; CREATE TABLE t1(a int); insert into t1 values (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; @@ -109,7 +115,9 @@ sync_slave_with_master; connection master; let $MYSQLD_DATADIR= `select @@datadir`; +--disable_cursor_protocol SELECT @@SESSION.sql_mode INTO @old_mode; +--enable_cursor_protocol SET sql_mode='ignore_space'; @@ -117,9 +125,11 @@ CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -167,9 +177,11 @@ sync_slave_with_master; connection master; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -214,9 +226,11 @@ CREATE VIEW v1 AS SELECT * FROM t2 WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 0df424aa1ac..24477fa0230 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -37,9 +37,11 @@ while($rows) eval insert into t1 values (null); dec $rows; } +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; SET @@sql_log_bin= 1; diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index a49b3c30b87..edb72dc9925 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -69,9 +69,11 @@ connection master; let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT repeat('x',20) INTO OUTFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol disable_warnings; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test index 597295d1136..792696ec7c7 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev12179.test +++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test @@ -278,8 +278,10 @@ EOF --enable_reconnect --enable_prepare_warnings --source include/wait_until_connected_again.inc +--disable_cursor_protocol SELECT max(seq_no) FROM mysql.gtid_slave_pos_InnoDB into @seq_no; --disable_prepare_warnings +--enable_cursor_protocol --connection server_1 INSERT INTO t2(a) SELECT 1+MAX(a) FROM t2; diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index b9d65844b12..be55a208c3e 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -26,9 +26,11 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?')); --disable_warnings insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); --enable_warnings +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'rpl_misc_functions.outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol let $MYSQLD_DATADIR= `select @@datadir`; sync_slave_with_master; create temporary table t2 like t1; @@ -93,10 +95,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --enable_prepare_warnings # Dump table on slave +--disable_cursor_protocol --disable_ps2_protocol select * from t1 into outfile "../../tmp/t1_slave.txt"; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol # Load data from slave into temp table on master connection master; @@ -108,8 +112,10 @@ load data infile '../../tmp/t1_slave.txt' into table t1_slave; # Compare master and slave temp table, use subtraction # for floating point comparison of "double" +--disable_cursor_protocol select count(*) into @aux from t1 join t1_slave using (id) where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +--enable_cursor_protocol SELECT @aux; if (`SELECT @aux <> 12 OR @aux IS NULL`) { diff --git a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test index 2c9b4882c16..91c566a1234 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test @@ -3,6 +3,7 @@ # --source include/have_log_bin.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/master-slave.inc --echo # @@ -16,14 +17,23 @@ # Seconds_Behind_Master is based on the timestamp of the new transaction, # rather than the last committed transaction. # +# Note that the test doesn't actually use the value of MASTER_DELAY, but +# rather uses debug_sync to coordinate the end of the delay. This is to ensure +# that on slow machines, a delay doesn't pass before the test gets a chance to +# validate results. Additionally, it lets us continue testing after validation +# so we don't have to wait out a full delay unnecessarily. The debug_sync point +# is enabled via sql_delay_by_debug_sync, which will delay transactions based +# only on GTID events, so only one synchronization is needed per transaction. +# --connection slave --source include/stop_slave.inc --let $save_dbug= `SELECT @@GLOBAL.debug_dbug` --let $save_parallel_mode= `SELECT @@GLOBAL.slave_parallel_mode` -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; ---let $master_delay= 3 +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; + +--let $master_delay= 1 --eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos --source include/start_slave.inc @@ -31,7 +41,11 @@ set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; --let insert_ctr= 0 create table t1 (a int); create table t2 (a int); ---source include/sync_slave_sql_with_master.inc +--source include/save_master_gtid.inc +--connection slave +--let $slave_sync_method= gtid +--let $num_event_groups= 2 +--source include/sync_with_master_sql_delay_debug_sync.inc --echo # --echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event @@ -48,8 +62,7 @@ sleep 2; --connection slave --echo # Waiting for transaction to arrive on slave and begin SQL Delay.. ---let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; ---source include/wait_condition.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; --echo # Validating SBM is updated on event arrival.. --let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) @@ -75,13 +88,13 @@ if (`SELECT $mle_time_trx1_arrive_unix < ($ts_trx_before_ins - 1)`) --echo # Validating Slave_last_event_time is still from the last transaction.. # Note we infer Slave_last_event_time via Master_Slave_time_diff --let $time_diff_trx1_arrive= query_get_value(SHOW ALL SLAVES STATUS, Master_Slave_time_diff, 1) -if ($time_diff_trx1_arrive < 5) +if ($time_diff_trx1_arrive < 2) { --let $slave_time_trx1_arrive= query_get_value(SHOW ALL SLAVES STATUS, Slave_last_event_time, 1) --let $slave_time_trx1_arrive_unix= `SELECT truncate(unix_timestamp("$slave_time_trx1_arrive"), 0)` --echo # Slave_last_event_time: $slave_time_trx1_arrive_unix ($slave_time_trx1_arrive) --echo # Master_Slave_time_diff: $time_diff_trx1_arrive - --die Slave_last_event_time is too recent, should not be less than 5 seconds, ie. 3 from delay + 2 from sleep + --die Slave_last_event_time is too recent, should not be less than 2 seconds, ie. from sleeping } --echo # ..done @@ -90,7 +103,20 @@ if ($time_diff_trx1_arrive < 5) --echo # delaying a transaction; then when the reciprocal START SLAVE occurs, --echo # if the event is still to be delayed, SBM should resume accordingly ---source include/stop_slave.inc +--connection server_2 +--echo # Ensure the kill from STOP SLAVE will be received before continuing the +--echo # SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +--send STOP SLAVE + +--connection slave +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; + +--connection server_2 +--reap +--source include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; --echo # Lock t1 on slave to ensure the event can't finish (and thereby update --echo # Seconds_Behind_Master) so slow running servers don't accidentally @@ -101,6 +127,11 @@ LOCK TABLES t1 WRITE; --source include/start_slave.inc --connection slave + +--echo # SQL delay has no impact for the rest of the test case, so ignore it +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Waiting for replica to get blocked by the table lock --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock'; --source include/wait_condition.inc @@ -162,9 +193,14 @@ sleep 3; --connection slave --echo # Wait for first transaction to complete SQL delay and begin execution.. +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker'; --source include/wait_condition.inc +--echo # Wait for second transaction to complete SQL delay.. +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. --let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) --let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()` @@ -189,6 +225,8 @@ UNLOCK TABLES; --echo # Cleanup --source include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; --eval CHANGE MASTER TO master_delay=0 --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test index cc361a7b35b..9522a976b89 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_seq.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -147,7 +147,9 @@ if (`select $iter = 1`) --connection master CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; # select may return non-deterministically, don't print its result +--disable_cursor_protocol SELECT NEXT VALUE FOR s3 into @tmpvar; +--enable_cursor_protocol --source include/save_master_gtid.inc --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test index 2d5d08a4600..e74c1368bad 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -25,6 +25,11 @@ # Note that due to the sleep() command the insert is written to the binary # log in row format. +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test requires: cursor-protocol disabled +} + source include/have_binlog_format_statement.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test index c1b7e02319b..5ca2f4edb8f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test @@ -35,18 +35,22 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 1, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,1,@a); SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 2, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,2,@a); SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test; @@ -82,9 +86,11 @@ END $$ --delimiter ; SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @found_rows; --enable_ps2_protocol +--enable_cursor_protocol CALL just_log(2,3,@found_rows); SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test; @@ -105,7 +111,9 @@ END $$ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; --disable_ps2_protocol +--disable_cursor_protocol SELECT FOUND_ROWS() INTO @found_rows; +--enable_cursor_protocol SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows); --enable_ps2_protocol diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 0ec57715f79..90dec10e55a 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -346,7 +346,9 @@ GRANT PROCESS ON *.* TO user43748@127.0.0.1; connect (cont43748,127.0.0.1,user43748,meow,"*NO-ONE*",$SLAVE_MYPORT,); connection cont43748; +--disable_cursor_protocol SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; +--enable_cursor_protocol --error ER_KILL_DENIED_ERROR,ER_NO_SUCH_THREAD KILL @id; diff --git a/mysql-test/suite/rpl/t/rpl_xa.inc b/mysql-test/suite/rpl/t/rpl_xa.inc index 30e7a4bbe4a..dbe1fe91040 100644 --- a/mysql-test/suite/rpl/t/rpl_xa.inc +++ b/mysql-test/suite/rpl/t/rpl_xa.inc @@ -94,7 +94,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc + --enable_cursor_protocol --let $complete=`select if(floor(rand()*10)%2,'COMMIT','ROLLBACK')` --error 0 --disable_query_log @@ -117,8 +119,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc - + --enable_cursor_protocol --disconnect master_$xid --source include/wait_until_disconnected.inc diff --git a/mysql-test/suite/s3/basic.result b/mysql-test/suite/s3/basic.result index e24adc23a03..716900f873d 100644 --- a/mysql-test/suite/s3/basic.result +++ b/mysql-test/suite/s3/basic.result @@ -132,16 +132,19 @@ s3_block_size X s3_bucket X s3_debug X s3_host_name X +s3_no_content_type X s3_pagecache_age_threshold X s3_pagecache_buffer_size X s3_pagecache_division_limit X s3_pagecache_file_hash_size X s3_port X s3_protocol_version X +s3_provider X s3_region X s3_replicate_alter_as_create_select X s3_secret_key X s3_slave_ignore_updates X +s3_ssl_no_verify X s3_use_http X show variables like "s3_slave%"; Variable_name Value diff --git a/mysql-test/suite/s3/my.cnf b/mysql-test/suite/s3/my.cnf index 818b2a881d6..c98514fb19d 100644 --- a/mysql-test/suite/s3/my.cnf +++ b/mysql-test/suite/s3/my.cnf @@ -11,6 +11,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY s3-region=@ENV.S3_REGION s3-port=@ENV.S3_PORT s3-use-http=@ENV.S3_USE_HTTP +s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY +s3-provider=@ENV.S3_PROVIDER #s3-host-name=s3.amazonaws.com #s3-protocol-version=Amazon diff --git a/mysql-test/suite/s3/slave.cnf b/mysql-test/suite/s3/slave.cnf index 4f4d3d39ac7..729a48c49eb 100644 --- a/mysql-test/suite/s3/slave.cnf +++ b/mysql-test/suite/s3/slave.cnf @@ -10,6 +10,8 @@ s3-secret-key=@ENV.S3_SECRET_KEY s3-region=@ENV.S3_REGION s3-port=@ENV.S3_PORT s3-use-http=@ENV.S3_USE_HTTP +s3-ssl-no-verify=@ENV.S3_SSL_NO_VERIFY +s3-provider=@ENV.S3_PROVIDER # You can change the following when running the tests against # your own S3 setup diff --git a/mysql-test/suite/s3/suite.pm b/mysql-test/suite/s3/suite.pm index cdefbc5e323..383bf4f7798 100644 --- a/mysql-test/suite/s3/suite.pm +++ b/mysql-test/suite/s3/suite.pm @@ -20,6 +20,8 @@ if(connect(SOCK, $paddr)) $ENV{'S3_REGION'} = ""; $ENV{'S3_PROTOCOL_VERSION'} = "Auto"; $ENV{'S3_USE_HTTP'} = "ON"; + $ENV{'S3_SSL_NO_VERIFY'} = "OFF"; + $ENV{'S3_PROVIDER'} = "Default"; } else { @@ -62,6 +64,17 @@ else { $ENV{'S3_USE_HTTP'} = "OFF"; } + + if (!$ENV{'S3_SSL_NO_VERIFY'}) + { + $ENV{'S3_SSL_NO_VERIFY'} = "OFF"; + } + + if (!$ENV{'S3_PROVIDER'}) + { + $ENV{'S3_PROVIDER'} = "Default"; + } + } bless { }; diff --git a/mysql-test/suite/stress/t/ddl_innodb.test b/mysql-test/suite/stress/t/ddl_innodb.test index d5e23124b4b..79414a36a2a 100644 --- a/mysql-test/suite/stress/t/ddl_innodb.test +++ b/mysql-test/suite/stress/t/ddl_innodb.test @@ -1,4 +1,5 @@ --source include/no_valgrind_without_big.inc +--source include/maybe_debug.inc ######## t/ddl_innodb.test ###### # # Stress the storage engine InnoDB with CREATE/DROP TABLE/INDEX @@ -34,6 +35,13 @@ if (!$run) ##### Some preparations needed for the ddl*.inc scripts --source suite/stress/include/ddl.pre +if ($have_debug) { + --disable_query_log + SET @old_debug_dbug = @@global.debug_dbug; + SET DEBUG_DBUG="+d,ib_buf_create_intermittent_wait"; + --enable_query_log +} + --source suite/stress/include/ddl1.inc --source suite/stress/include/ddl2.inc --source suite/stress/include/ddl3.inc @@ -43,5 +51,11 @@ if (!$run) --source suite/stress/include/ddl7.inc --source suite/stress/include/ddl8.inc +if ($have_debug) { + --disable_query_log + SET @@global.debug_dbug = @old_debug_dbug; + --enable_query_log +} + ##### Cleanup --source suite/stress/include/ddl.cln diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 129fc162c23..871043d25e6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -4,6 +4,7 @@ variable_name not in ( 'innodb_numa_interleave', # only available WITH_NUMA 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS +'innodb_log_file_mmap', # only available on 64-bit 'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index f835a9596c4..a51ab048c37 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2422,6 +2422,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT For queries with JOIN and ORDER BY LIMIT : make the optimizer consider a join order that allows to short-cut execution after producing #LIMIT matches if that promises N times speedup. (A conservative setting here would be is a high value, like 100 so the short-cutting plan is used if it promises a speedup of 100x or more). Short-cutting plans are inherently risky so the default is 0 which means do not consider this optimization +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_KEY_COMPARE_COST VARIABLE_SCOPE GLOBAL VARIABLE_TYPE DOUBLE diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 98b6a735ffd..d09a0dd66e7 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2632,6 +2632,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME OPTIMIZER_JOIN_LIMIT_PREF_RATIO +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT For queries with JOIN and ORDER BY LIMIT : make the optimizer consider a join order that allows to short-cut execution after producing #LIMIT matches if that promises N times speedup. (A conservative setting here would be is a high value, like 100 so the short-cutting plan is used if it promises a speedup of 100x or more). Short-cutting plans are inherently risky so the default is 0 which means do not consider this optimization +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_KEY_COMPARE_COST VARIABLE_SCOPE GLOBAL VARIABLE_TYPE DOUBLE diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test index 8c5f8fa7bf0..c33eb057cc6 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test @@ -11,8 +11,10 @@ SELECT @@global.innodb_buffer_pool_dump_now; -- error 0,1 -- remove_file $file +--disable_cursor_protocol SELECT variable_value INTO @old_dump_status FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +--enable_cursor_protocol # A previous test could have run buffer pool dump already; # in this case we want to make sure that the current time is different diff --git a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test index 8bc7bd2dc4b..e29639a1779 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test @@ -23,10 +23,12 @@ set innodb_fil_make_page_dirty_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol --enable_prepare_warnings select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; --disable_prepare_warnings +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test index 148871478a7..0fd7a5eafcb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test @@ -21,7 +21,9 @@ select * from information_schema.session_variables where variable_name='innodb_r # # show that it's not read-only # +--disable_cursor_protocol select @@innodb_read_io_threads into @n; +--enable_cursor_protocol --disable_warnings set global innodb_read_io_threads = 1; --enable_warnings diff --git a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test index 29b8451867a..63bea91b879 100644 --- a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test @@ -23,10 +23,12 @@ set innodb_saved_page_number_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol --enable_prepare_warnings select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; --disable_prepare_warnings +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test index 9ee9f5ba619..b7123f74dcb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test @@ -21,7 +21,9 @@ select * from information_schema.session_variables where variable_name='innodb_w # # show that it's not read-only # +--disable_cursor_protocol select @@innodb_write_io_threads into @n; +--enable_cursor_protocol --disable_warnings set global innodb_write_io_threads=1; --enable_warnings diff --git a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test index db9bc8fb48f..1be82f5380e 100644 --- a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test +++ b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test @@ -43,7 +43,9 @@ SELECT @@log_slow_disabled_statements; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -53,7 +55,9 @@ SET SESSION log_slow_disabled_statements="call,admin"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra2 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -63,7 +67,9 @@ SET SESSION log_slow_disabled_statements=""; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra3 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -73,7 +79,9 @@ SET SESSION log_slow_disabled_statements="call,admin,slave,sp"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra4 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part5'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test index 105b594abbc..d8e984fa1f2 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test @@ -76,6 +76,8 @@ SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_size = 131072; SET GLOBAL query_cache_type = ON; +--disable_cursor_protocol + --echo '#---------------------FN_DYNVARS_132_01----------------------#' # #Check if results are cacheing on default value # @@ -168,6 +170,8 @@ SHOW STATUS LIKE 'Qcache_not_cached'; SHOW STATUS LIKE 'Qcache_queries_in_cache'; --echo 1 Expected +--enable_cursor_protocol + # # Cleanup # diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test index e1b5f4d1a12..e31c949fef0 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_type_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test @@ -62,6 +62,8 @@ SET @@GLOBAL.query_cache_size = 65536; --echo ** TESTING SESSION SCOPE ** +--disable_cursor_protocol + --echo '#--------------------FN_DYNVARS_135_01-------------------------#' # # Testing default value it should be ON by default @@ -284,6 +286,8 @@ connection con3; SELECT @@query_cache_type; --echo ON Expected +--enable_cursor_protocol + --echo --echo ** Cleanup ** --echo diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test index d9dff17b5a0..395bdaed343 100644 --- a/mysql-test/suite/sys_vars/t/secure_file_priv.test +++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test @@ -17,6 +17,7 @@ SHOW VARIABLES LIKE 'secure_file_priv'; # If we run tests with --mem, it will be /dev/shm. # If we run tests with --parallel, it will be mysql-test/var # (because MYSQLTEST_VARDIR in this case is mysql-test/var/N). +--disable_cursor_protocol --perl use File::Basename; @@ -41,6 +42,8 @@ EOF --remove_file $MYSQL_TMP_DIR/bug50373.inc --enable_query_log +--enable_cursor_protocol + DROP TABLE t1; --perl diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test index 8dcc0279e72..c8c8c664ea7 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test @@ -5,6 +5,11 @@ SET @global_log_output = @@global.log_output; # Begin the functionality testing for slow_query_log # ############################################################################### +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} + SET @@session.long_query_time=1; SET @@global.log_output = 'TABLE'; diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test index 77f947c9913..d398f711ad5 100644 --- a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test @@ -51,18 +51,22 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 0. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 1. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; @@ -81,7 +85,9 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 2. +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 2680e442da4..86f5ffddf1c 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -11,6 +11,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP 'innodb_numa_interleave', # only available WITH_NUMA 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS + 'innodb_log_file_mmap', # only available on 64-bit 'innodb_log_file_buffering', # only available on Linux and Windows 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysql-test/suite/vcol/t/load_data.test b/mysql-test/suite/vcol/t/load_data.test index 1b662818cd2..be247d106b9 100644 --- a/mysql-test/suite/vcol/t/load_data.test +++ b/mysql-test/suite/vcol/t/load_data.test @@ -5,9 +5,11 @@ create table t1 ( c1 varchar(10), c2 varchar(10), c3 int ); insert into t1 values ("a" , "b", 1), ("a" , "b", 2); create table t2 like t1 ; alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.csv' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.csv' ignore into table t2 ; select * from t2; insert into t2 (c1,c2,c3) values ("a" , "b", 4); diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test index bc8fcbd29c0..e9207d3bcdd 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test +++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test @@ -281,9 +281,11 @@ drop table t1; CREATE TABLE t1 (i INT, d1 DATE, d2 DATE NOT NULL, t TIMESTAMP, KEY(t)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'2023-03-16','2023-03-15','2012-12-12 12:12:12'); ALTER TABLE t1 MODIFY t FLOAT AS (i) PERSISTENT; +--disable_cursor_protocol --disable_ps2_protocol SELECT i, d1, d2 INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2); SELECT * FROM t1 WHERE d2 < d1; diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index 2e4342be54c..238a8a435fa 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -8,7 +8,9 @@ source sys_time.inc; set @@session.time_zone='+00:00'; set @@global.time_zone='+00:00'; +--disable_cursor_protocol select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; +--enable_cursor_protocol set @test_start=now(6); delimiter ~~; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 85448d21346..85d40b1e8e9 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -139,9 +139,11 @@ select * from t; update t set a=3 where a=1; select * from t; select * from t for system_time all; +--disable_cursor_protocol --enable_prepare_warnings select row_start from t where a=3 into @tm; --disable_prepare_warnings +--enable_cursor_protocol alter table t add column b int; select @tm=row_start from t where a=3; show create table t; diff --git a/mysql-test/suite/versioning/t/commit_id.test b/mysql-test/suite/versioning/t/commit_id.test index 96461f5c299..a64067563ef 100644 --- a/mysql-test/suite/versioning/t/commit_id.test +++ b/mysql-test/suite/versioning/t/commit_id.test @@ -18,21 +18,27 @@ insert into t1 values (); set @ts0= now(6); insert into t1 values (); +--disable_cursor_protocol --enable_prepare_warnings select sys_trx_start from t1 where id = last_insert_id() into @tx0; +--enable_cursor_protocol select transaction_id = @tx0 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts1= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx1; +--enable_cursor_protocol select transaction_id = @tx1 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts2= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx2; +--enable_cursor_protocol select transaction_id = @tx2 from mysql.transaction_registry order by transaction_id desc limit 1; @@ -72,22 +78,30 @@ select trt_trx_sees(0, @tx2); set transaction isolation level read uncommitted; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx3; +--enable_cursor_protocol select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3; set transaction isolation level read committed; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx4; +--enable_cursor_protocol select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4; set transaction isolation level serializable; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx5; +--enable_cursor_protocol select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5; set transaction isolation level repeatable read; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx6; +--enable_cursor_protocol select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6; --disable_prepare_warnings diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index 6a0d327fc35..6750c1ff1ce 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -220,9 +220,11 @@ show create table t3; --echo ## For versioned table insert into t1 values (1); +--disable_cursor_protocol select row_start from t1 into @row_start; insert into t0 (y) values (2); select st from t0 into @st; +--enable_cursor_protocol create or replace table t2 with system versioning as select * from t1; --replace_result $default_engine DEFAULT_ENGINE @@ -261,10 +263,12 @@ create or replace table t3 with system versioning select x23, row_start from t1; create or replace table t3 with system versioning select x23, row_end from t1; --echo # Prepare checking for historical row +--disable_cursor_protocol delete from t1; select row_end from t1 for system_time all into @row_end; delete from t0; select en from t0 for system_time all into @en; +--enable_cursor_protocol --echo ## Combinations of versioned + non-versioned create or replace table t2 (y int); @@ -280,9 +284,13 @@ insert into t2 (y) values (1), (2); delete from t2 where y = 2; create or replace table t3 select * from t2 for system_time all; +--disable_cursor_protocol select st, en from t3 where y = 1 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; +--disable_cursor_protocol select st, en from t3 where y = 2 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; --echo ## Default engine detection diff --git a/mysql-test/suite/versioning/t/cte.test b/mysql-test/suite/versioning/t/cte.test index d38f52dcd7e..7986af5ab3a 100644 --- a/mysql-test/suite/versioning/t/cte.test +++ b/mysql-test/suite/versioning/t/cte.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } --source include/have_innodb.inc --source include/default_optimizer_switch.inc @@ -42,7 +42,9 @@ insert into emp (emp_id, name, salary, dept_id, mgr) values (20, "john", 500, 10, 1), (30, "jane", 750, 10,1 ); +--disable_cursor_protocol select row_start into @ts_1 from emp where name="jane"; +--enable_cursor_protocol update emp set mgr=30 where name ="john"; @@ -54,7 +56,9 @@ with ancestors as ( select e.emp_id, e.name, e.mgr, e.salary from emp as e ) select * from ancestors for system_time as of @ts_1; +--disable_cursor_protocol select row_start into @ts_2 from emp where name="john"; +--enable_cursor_protocol let $q= /* All report to 'Bill' */ diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test index c87a2368d11..5e838877fad 100644 --- a/mysql-test/suite/versioning/t/data.test +++ b/mysql-test/suite/versioning/t/data.test @@ -38,8 +38,10 @@ insert into t1 values (1), (2); set timestamp=unix_timestamp('2011-11-11 11:11:11.111111'); delete from t1 where x = 1; set timestamp=default; +--disable_cursor_protocol select row_start, row_end into @s1, @e1 from t1 for system_time all where x = 1; select row_start, row_end into @s2, @e2 from t1 for system_time all where x = 2; +--enable_cursor_protocol create or replace table t2 ( x int, diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index 9debdcfec8c..ded6f46762b 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -42,7 +42,9 @@ eval create or replace table t1( with system versioning; insert into t1(x) values (1); +--disable_cursor_protocol select sys_start into @sys_start from t1; +--disable_cursor_protocol delete from t1; select * from t1; select x = 1 as A, sys_start = @sys_start as B, sys_end > sys_start as C from t1 for system_time all; diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index fe58a2b75ee..a69f9df739b 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -315,9 +315,11 @@ create or replace table subchild ( ) engine=innodb; insert into parent (value) values (23); +--disable_cursor_protocol --enable_prepare_warnings select id, value from parent into @id, @value; --disable_prepare_warnings +--enable_cursor_protocol insert into child values (default, @id, @value); insert into subchild values (default, @id, @value); @@ -399,21 +401,27 @@ INSERT INTO t2 VALUES (1,'against'),(2,'q'); SET SQL_MODE= ''; SET timestamp = 2; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 3; UPDATE t1 SET f13 = 'q'; SET timestamp = 4; LOAD DATA INFILE 't1.data' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data.2' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 5; LOAD DATA INFILE 't1.data.2' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't2.data' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 6; LOAD DATA INFILE 't2.data' REPLACE INTO TABLE t2; SET FOREIGN_KEY_CHECKS = OFF; @@ -556,9 +564,11 @@ delete from t0; --error ER_ROW_IS_REFERENCED_2 replace t0 values (1); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load_t0' from t0 ; --enable_ps2_protocol +--enable_cursor_protocol --error ER_ROW_IS_REFERENCED_2 load data infile 'load_t0' replace into table t0; diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index 45c0ddb1e37..1a8e8981065 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -52,9 +52,11 @@ drop view vt1_1; replace_result $sys_datatype_expl SYS_DATATYPE; eval create or replace table t1( id bigint primary key, a int, b int) with system versioning; insert into t1 values(1, 1, 1); +--disable_cursor_protocol --enable_prepare_warnings select row_start, row_end from t1 into @sys_start, @sys_end; --disable_prepare_warnings +--enable_cursor_protocol select id, a, b from t1; insert into t1 values(2, 2, 2); select id, a, b, row_start > @sys_start as C, row_end = @sys_end as D from t1 where id = 2; @@ -194,9 +196,11 @@ replace into t3 values (0, '1980-01-01 00:00:00', '1981-01-01 00:00:00'); --echo # LOAD DATA --let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data --replace_result $DATAFILE DATAFILE +--disable_cursor_protocol --disable_ps2_protocol eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t2 like t1; --replace_result $default_engine DEFAULT_ENGINE show create table t2; @@ -253,9 +257,11 @@ set sql_mode='STRICT_ALL_TABLES'; create or replace table t1 (a int) with system versioning; set system_versioning_insert_history= on; insert into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +--disable_cursor_protocol --disable_ps2_protocol select a,row_start,row_end into outfile 'mdev29813.txt' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t1 (a int primary key) with system versioning; load data infile 'mdev29813.txt' ignore into table t1 (a,row_start,row_end); diff --git a/mysql-test/suite/versioning/t/insert2.test b/mysql-test/suite/versioning/t/insert2.test index 0a1968f91ef..ee6f408d82d 100644 --- a/mysql-test/suite/versioning/t/insert2.test +++ b/mysql-test/suite/versioning/t/insert2.test @@ -50,7 +50,9 @@ insert into t1 (row_start) select row_end from t1; set sql_mode=''; insert into t1 (row_start, row_end) values (DEFAULT, 1); set sql_mode=default; +--disable_cursor_protocol select @@sql_mode into @saved_mode; +--enable_cursor_protocol set sql_mode= ''; insert into t1 (x, row_start, row_end) values (3, 4, 5); set sql_mode= @saved_mode; diff --git a/mysql-test/suite/versioning/t/load_data.test b/mysql-test/suite/versioning/t/load_data.test index 4b77d9f80bb..7234de7945c 100644 --- a/mysql-test/suite/versioning/t/load_data.test +++ b/mysql-test/suite/versioning/t/load_data.test @@ -5,11 +5,13 @@ CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING; INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol SELECT a, b, c FROM t1 INTO OUTFILE '15330.data'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE '15330.data' IGNORE INTO TABLE t1 (a,b,c); LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c); diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index ac4edeb52eb..fafdeb5c26e 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1020,6 +1020,7 @@ create or replace table t1 ( insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'MDEV-17891.data' from t1; --enable_ps2_protocol @@ -1028,6 +1029,7 @@ load data infile 'MDEV-17891.data' replace into table t1; load data infile 'MDEV-17891.data' replace into table t1; --error ER_RECORD_FILE_FULL load data infile 'MDEV-17891.data' replace into table t1; +--enable_cursor_protocol # Cleanup --remove_file $datadir/test/MDEV-17891.data @@ -1368,9 +1370,11 @@ partition by system_time limit 100 ( partition pn current); insert into t1 select seq from seq_0_to_49; +--disable_cursor_protocol --disable_ps2_protocol select x into outfile 'MDEV-20077.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'MDEV-20077.data' replace into table t1 (x); load data infile 'MDEV-20077.data' replace into table t1 (x); @@ -2209,9 +2213,11 @@ create or replace table t1 (x int primary key) with system versioning partition by system_time interval 1 hour auto; insert t1 values (1), (2), (3); +--disable_cursor_protocol --disable_ps2_protocol select x into outfile 'MDEV-17554.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 01:00:00'); load data infile 'MDEV-17554.data' replace into table t1 (x); diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index d804fe03fe5..48c6f3ffbcf 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -414,9 +414,11 @@ select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t connection master; --let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data --replace_result $DATAFILE DATAFILE +--disable_cursor_protocol --disable_ps2_protocol eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t3 like t1; set @@system_versioning_insert_history= 1; --replace_result $DATAFILE DATAFILE diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test index 7d5b6801d6f..87b3f6173ad 100644 --- a/mysql-test/suite/versioning/t/select.test +++ b/mysql-test/suite/versioning/t/select.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source suite/versioning/engines.inc --source suite/versioning/common.inc @@ -39,7 +39,9 @@ set @t0= now(6); if ($MTR_COMBINATION_TRX_ID) { --disable_query_log +--disable_cursor_protocol select sys_trx_start from t1 limit 1 into @x0; +--enable_cursor_protocol --enable_query_log } @@ -47,12 +49,16 @@ delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol select sys_trx_start from t1 where x = 3 and y = 33 into @t1; +--enable_cursor_protocol if ($MTR_COMBINATION_TRX_ID) { --disable_query_log set @x1= @t1; +--disable_cursor_protocol select trt_commit_ts(@x1) into @t1; +--enable_cursor_protocol --enable_query_log } @@ -131,12 +137,14 @@ delete from t1; insert into t1 values (3); delete from t1; +--disable_cursor_protocol select row_start into @start1 from t1 for system_time all where x = 1; select row_end into @end1 from t1 for system_time all where x = 1; select row_start into @start2 from t1 for system_time all where x = 2; select row_end into @end2 from t1 for system_time all where x = 2; select row_start into @start3 from t1 for system_time all where x = 3; select row_end into @end3 from t1 for system_time all where x = 3; +--enable_cursor_protocol select x as ASOF_x from t1 for system_time as of @start2; select x as ASOF_x from t1 for system_time as of @end2; @@ -270,7 +278,9 @@ create or replace table t1 ( insert into t1 values (1); set @ts= now(6); delete from t1; +--disable_cursor_protocol select sys_trx_start from t1 for system_time all into @trx_start; +--enable_cursor_protocol --echo ## ensure @trx_start is much lower than unix timestamp select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good; @@ -399,8 +409,10 @@ eval create or replace table t1 ( ) with system versioning; insert into t1 values (1); delete from t1; +--disable_cursor_protocol select row_start from t1 for system_time all into @t1; select row_end from t1 for system_time all into @t2; +--enable_cursor_protocol --disable_query_log if($MTR_COMBINATION_TRX_ID) { set @t1= trt_begin_ts(@t1); diff --git a/mysql-test/suite/versioning/t/select2.test b/mysql-test/suite/versioning/t/select2.test index 54bcbc77429..9d9efdc412e 100644 --- a/mysql-test/suite/versioning/t/select2.test +++ b/mysql-test/suite/versioning/t/select2.test @@ -22,13 +22,17 @@ insert into t1 (x, y) values (8, 108), (9, 109); set @t0= now(6); +--disable_cursor_protocol --enable_prepare_warnings select sys_start from t1 limit 1 into @x0; --disable_prepare_warnings +--enable_cursor_protocol + delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol --enable_prepare_warnings select sys_start from t1 where x = 3 and y = 33 into @t1; --disable_prepare_warnings @@ -36,6 +40,7 @@ if($MTR_COMBINATION_TRX_ID) { set @x1= @t1; select trt_commit_ts(@x1) into @t1; } +--enable_cursor_protocol select x, y from t1; select x as ASOF_x, y from t1 for system_time as of timestamp @t0; diff --git a/mysql-test/suite/versioning/t/simple.test b/mysql-test/suite/versioning/t/simple.test index b550b3967d9..6f0e52f4f5d 100644 --- a/mysql-test/suite/versioning/t/simple.test +++ b/mysql-test/suite/versioning/t/simple.test @@ -18,6 +18,7 @@ create or replace table emp ( ) with system versioning; +--disable_cursor_protocol select now() into @ts_0; insert into dept (dept_id, name) values (10, "accounting"); @@ -29,13 +30,16 @@ insert into emp (emp_id, name, salary, dept_id) values (1, "bill", 1000, 10); commit; select row_start into @ts_2 from emp where name="bill"; +--enable_cursor_protocol select * from emp; update emp set salary=2000 where name="bill"; commit; +--disable_cursor_protocol select row_start into @ts_3 from emp where name="bill"; +--enable_cursor_protocol select * from emp; select * from emp for system_time as of timestamp @ts_2; diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index fcb46832136..520e9092be8 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -40,11 +40,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=inplace; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -61,11 +65,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=copy; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -124,9 +132,11 @@ commit; --sleep 0.01 set @ts3= sysdate(6); +--disable_cursor_protocol select sys_start from t1 where x = 1 into @trx_id1; select sys_start from t1 where x = 2 into @trx_id2; select sys_start from t1 where x = 3 into @trx_id3; +--enable_cursor_protocol select @trx_id1 < @trx_id2, @trx_id2 < @trx_id3; select @ts1 < @ts2, @ts2 < @ts3; @@ -267,7 +277,9 @@ set @ts1= now(6); insert into t1 values (1); commit; +--disable_cursor_protocol select row_start from t1 into @trx_id; +--enable_cursor_protocol select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD; drop table t1; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 50bf331b1fe..54361a412d2 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -28,11 +28,15 @@ eval create table t1 ( with system versioning; set timestamp= unix_timestamp('2000-01-01 00:00:00'); insert into t1 values(1, 1, 1); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 01:00:00'); update t1 set x= 11, y= 11 where id = 1; select @tmp1 < sys_trx_start as A1, x, y from t1; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 02:00:00'); update t1 set y= 1 where id = 1; select @tmp1 = sys_trx_start as A2, x from t1; @@ -135,14 +139,18 @@ create table t2 like t1; insert into t1 values (1, "Jeremy", 3000); insert into t2 values (1, "Jeremy", 4000); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.name= "Jerry", t2.name= "Jerry" where t1.id = t2.id and t1.name = "Jeremy"; select @tmp1 < sys_trx_start as A1, name from t1; select @tmp2 < sys_trx_start as A2, name from t2; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.salary= 2500, t2.salary= 2500 where t1.id = t2.id and t1.name = "Jerry"; select @tmp1 = sys_trx_start as B1, salary from t1; select @tmp2 = sys_trx_start as B2, salary from t2; @@ -336,7 +344,9 @@ drop tables t1, t2, t3; create or replace table t1 (x int) with system versioning; insert t1 values (1); update t1 set x= 1; +--disable_cursor_protocol select row_start into @r from t1; +--enable_cursor_protocol select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r; drop table t1; diff --git a/mysql-test/suite/versioning/t/view.test b/mysql-test/suite/versioning/t/view.test index 94079cbb549..2f326cf03df 100644 --- a/mysql-test/suite/versioning/t/view.test +++ b/mysql-test/suite/versioning/t/view.test @@ -5,10 +5,14 @@ create or replace table t1 (x int) with system versioning; insert into t1 values (1); +--disable_cursor_protocol select now(6) into @t1; +--enable_cursor_protocol update t1 set x= 2; +--disable_cursor_protocol select now(6) into @t2; +--enable_cursor_protocol delete from t1; set @vt1= concat("create or replace view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'"); diff --git a/mysql-test/suite/wsrep/r/MDEV-33997.result b/mysql-test/suite/wsrep/r/MDEV-33997.result new file mode 100644 index 00000000000..f0e43462054 --- /dev/null +++ b/mysql-test/suite/wsrep/r/MDEV-33997.result @@ -0,0 +1,38 @@ +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +c +1 +1 +DROP TABLE t; +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +c +1 +DROP TABLE t; +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SELECT * FROM t; +c +DROP TABLE t; +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +COMMIT; +SELECT * FROM t; +c +1 +DROP TABLE t; diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.cnf b/mysql-test/suite/wsrep/t/MDEV-33997.cnf new file mode 100644 index 00000000000..489c4385dbd --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.combinations b/mysql-test/suite/wsrep/t/MDEV-33997.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/wsrep/t/MDEV-33997.test b/mysql-test/suite/wsrep/t/MDEV-33997.test new file mode 100644 index 00000000000..3d015244d7d --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-33997.test @@ -0,0 +1,49 @@ +--source include/have_wsrep.inc +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_partition.inc +# +# MDEV-33997: Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*) +# +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; + +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +DROP TABLE t; + +# +# MDEV-27296 : Assertion `((thd && (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on)) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed +# Second test case +# +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +DROP TABLE t; + +# +# We should not allow RSU for MyISAM +# +SET autocommit=1; +SET SESSION wsrep_osu_method=RSU; +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +--error ER_NOT_SUPPORTED_YET +INSERT INTO t SELECT 1 ; +SELECT * FROM t; +DROP TABLE t; + +SET SESSION wsrep_osu_method=RSU; +SET autocommit=0; + +CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2; +INSERT INTO t VALUES (1); +--error ER_NOT_SUPPORTED_YET +INSERT INTO t SELECT 1 ; +COMMIT; +SELECT * FROM t; +DROP TABLE t; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc index 22669438fe0..b131ac07641 100644 --- a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc +++ b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc @@ -18,7 +18,7 @@ --perl use strict; - my $wsrep_start_position = `grep '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; diff --git a/mysys/crc32/crc32c.cc b/mysys/crc32/crc32c.cc index 6de7af70db7..0d65d0027d4 100644 --- a/mysys/crc32/crc32c.cc +++ b/mysys/crc32/crc32c.cc @@ -455,7 +455,7 @@ static int arch_ppc_probe(void) { return arch_ppc_crc32; } -# elif defined __FreeBSD_version && __FreeBSD_version >= 1200000 +# elif defined __FreeBSD__ # include # include # include diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c index 62d077ccdc4..4087ead1663 100644 --- a/mysys/my_getpagesize.c +++ b/mysys/my_getpagesize.c @@ -16,8 +16,6 @@ #include "mysys_priv.h" -#ifndef HAVE_GETPAGESIZE - #if defined _WIN32 int my_getpagesize(void) @@ -27,6 +25,13 @@ int my_getpagesize(void) return si.dwPageSize; } +#elif defined _SC_PAGESIZE + +int my_getpagesize(void) +{ + return (int)sysconf(_SC_PAGESIZE); +} + #else /* Default implementation */ @@ -36,6 +41,3 @@ int my_getpagesize(void) } #endif - -#endif - diff --git a/mysys/my_init.c b/mysys/my_init.c index 1596952745a..1dd2e6e8100 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -157,9 +157,7 @@ my_bool my_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ my_global_flags= 0; -#ifdef _SC_PAGESIZE - my_system_page_size= sysconf(_SC_PAGESIZE); -#endif + my_system_page_size= my_getpagesize(); /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4.test b/plugin/type_inet/mysql-test/type_inet/type_inet4.test index b6b6300da47..8bb2a8259f8 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet4.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet4.test @@ -24,10 +24,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INET4); INSERT INTO t1 VALUES ('0.0.0.1'); +--disable_cursor_protocol --enable_metadata SELECT * FROM t1; SELECT CAST('0.0.0.1' AS INET4) AS a; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; @@ -1290,6 +1292,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INET4); +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1308,6 +1311,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index cb3d226f9b6..c3128140b71 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -18,7 +18,10 @@ CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('::1'); --enable_metadata SELECT * FROM t1; +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT CAST('::' AS INET6) AS a; +--enable_cursor_protocol --disable_metadata DROP TABLE t1; @@ -1430,6 +1433,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INET6); +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1448,6 +1453,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index 0979582a69a..63b9228c343 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -20,10 +20,12 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +--disable_cursor_protocol --enable_metadata SELECT * FROM t1; SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; @@ -1587,6 +1589,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a UUID); +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1605,6 +1608,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 9ff5e4e5f50..50aeb3a0b91 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -81,10 +81,10 @@ wsrep_recover_position() { # Parse server's error log for recovered position. The server prints # "..skipping position recovery.." if started without wsrep. - recovered_pos="$(grep 'WSREP: Recovered position:' $log_file)" + recovered_pos="$(grep -a 'WSREP: Recovered position:' $log_file)" if [ -z "$recovered_pos" ]; then - skipped="$(grep WSREP $log_file | grep 'skipping position recovery')" + skipped="$(grep -a WSREP $log_file | grep 'skipping position recovery')" if [ -z "$skipped" ]; then log "WSREP: Failed to recover position: '`cat $log_file`'" exit 1 diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 1416e8754bb..31e8d3fc597 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -266,9 +266,9 @@ wsrep_recover_position() { exit 1 fi - local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)" + local rp="$(grep -a 'WSREP: Recovered position:' $wr_logfile)" if [ -z "$rp" ]; then - local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')" + local skipped="$(grep -a WSREP $wr_logfile | grep 'skipping position recovery')" if [ -z "$skipped" ]; then log_error "WSREP: Failed to recover position: '`cat $wr_logfile`'" ret=1 diff --git a/scripts/sys_schema/README.md b/scripts/sys_schema/README.md index aff0949c402..f414f8424b1 100644 --- a/scripts/sys_schema/README.md +++ b/scripts/sys_schema/README.md @@ -1,8 +1,8 @@ -# The MySQL sys schema +# The MariaDB sys schema -A collection of views, functions and procedures to help MySQL administrators get insight in to MySQL Database usage. +A collection of views, functions and procedures to help MariaDB administrators get insight into MariaDB Database usage. -There are install files available for 5.6 and 5.7 respectively. To load these, you must position yourself within the directory that you downloaded to, as these top level files SOURCE individual files that are shared across versions in most cases (though not all). +There are install files available. To load these, you must position yourself within the directory that you downloaded to, as these top level files SOURCE individual files that are shared across versions in most cases (though not all). ## Overview of objects @@ -54,10 +54,10 @@ Summarizes statement activity, file IO and connections by host. When the host found is NULL, it is assumed to be a "background" thread. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc host_summary; +mariadb> desc host_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -76,7 +76,7 @@ mysql> desc host_summary; +------------------------+---------------+------+-----+---------+-------+ 12 rows in set (0.15 sec) -mysql> desc x$host_summary; +mariadb> desc x$host_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -99,7 +99,7 @@ mysql> desc x$host_summary; ##### Example ```SQL - mysql> select * from host_summary; + mariadb> select * from host_summary; +------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+ | host | statements | statement_latency | statement_avg_latency | table_scans | file_ios | file_io_latency | current_connections | total_connections | unique_users | +------+------------+-------------------+-----------------------+-------------+----------+-----------------+---------------------+-------------------+--------------+ @@ -118,7 +118,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_file_io; +mariadb> desc host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -128,7 +128,7 @@ mysql> desc host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ 3 rows in set (0.00 sec) -mysql> desc x$host_summary_by_file_io; +mariadb> desc x$host_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -142,7 +142,7 @@ mysql> desc x$host_summary_by_file_io; ##### Example ```SQL - mysql> select * from host_summary_by_file_io; + mariadb> select * from host_summary_by_file_io; +------------+-------+------------+ | host | ios | io_latency | +------------+-------+------------+ @@ -162,7 +162,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_file_io_type; +mariadb> desc host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -174,7 +174,7 @@ mysql> desc host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.70 sec) -mysql> desc x$host_summary_by_file_io_type; +mariadb> desc x$host_summary_by_file_io_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -190,7 +190,7 @@ mysql> desc x$host_summary_by_file_io_type; ##### Example ```SQL - mysql> select * from host_summary_by_file_io_type; + mariadb> select * from host_summary_by_file_io_type; +------------+--------------------------------------+-------+---------------+-------------+ | host | event_name | total | total_latency | max_latency | +------------+--------------------------------------+-------+---------------+-------------+ @@ -225,7 +225,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_stages; +mariadb> desc host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -237,7 +237,7 @@ mysql> desc host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.06 sec) -mysql> desc x$host_summary_by_stages; +mariadb> desc x$host_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -253,7 +253,7 @@ mysql> desc x$host_summary_by_stages; ##### Example ```SQL - mysql> select * from host_summary_by_stages; + mariadb> select * from host_summary_by_stages; +------+--------------------------------+-------+---------------+-------------+ | host | event_name | total | total_latency | avg_latency | +------+--------------------------------+-------+---------------+-------------+ @@ -287,7 +287,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_statement_latency; +mariadb> desc host_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -303,7 +303,7 @@ mysql> desc host_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ 9 rows in set (0.29 sec) -mysql> desc x$host_summary_by_statement_latency; +mariadb> desc x$host_summary_by_statement_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -323,7 +323,7 @@ mysql> desc x$host_summary_by_statement_latency; ##### Example ```SQL - mysql> select * from host_summary_by_statement_latency; + mariadb> select * from host_summary_by_statement_latency; +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | host | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -342,7 +342,7 @@ When the host found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc host_summary_by_statement_type; +mariadb> desc host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -359,7 +359,7 @@ mysql> desc host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ 10 rows in set (0.30 sec) -mysql> desc x$host_summary_by_statement_type; +mariadb> desc x$host_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -380,7 +380,7 @@ mysql> desc x$host_summary_by_statement_type; ##### Example ```SQL - mysql> select * from host_summary_by_statement_type; + mariadb> select * from host_summary_by_statement_type; +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | host | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+----------------------+--------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -402,7 +402,7 @@ Summarizes the output of the INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table, aggreg ##### Structures ```SQL -mysql> desc innodb_buffer_stats_by_schema; +mariadb> desc innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -416,7 +416,7 @@ mysql> desc innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ 7 rows in set (0.08 sec) -mysql> desc x$innodb_buffer_stats_by_schema; +mariadb> desc x$innodb_buffer_stats_by_schema; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -434,7 +434,7 @@ mysql> desc x$innodb_buffer_stats_by_schema; ##### Example ```SQL -mysql> select * from innodb_buffer_stats_by_schema; +mariadb> select * from innodb_buffer_stats_by_schema; +--------------------------+------------+------------+-------+--------------+-----------+-------------+ | object_schema | allocated | data | pages | pages_hashed | pages_old | rows_cached | +--------------------------+------------+------------+-------+--------------+-----------+-------------+ @@ -453,7 +453,7 @@ Summarizes the output of the INFORMATION_SCHEMA.INNODB_BUFFER_PAGE table, aggreg ##### Structures ```SQL -mysql> desc innodb_buffer_stats_by_table; +mariadb> desc innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -468,7 +468,7 @@ mysql> desc innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ 8 rows in set (0.09 sec) -mysql> desc x$innodb_buffer_stats_by_table; +mariadb> desc x$innodb_buffer_stats_by_table; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -487,7 +487,7 @@ mysql> desc x$innodb_buffer_stats_by_table; ##### Example ```SQL -mysql> select * from innodb_buffer_stats_by_table; +mariadb> select * from innodb_buffer_stats_by_table; +--------------------------+------------------------------------+------------+-----------+-------+--------------+-----------+-------------+ | object_schema | object_name | allocated | data | pages | pages_hashed | pages_old | rows_cached | +--------------------------+------------------------------------+------------+-----------+-------+--------------+-----------+-------------+ @@ -531,7 +531,7 @@ The lock waits are ordered by the age of the lock descending. ##### Structures ```SQL -mysql> desc sys.innodb_lock_waits; +mariadb> desc sys.innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------------------+-------+ @@ -564,7 +564,7 @@ mysql> desc sys.innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ 26 rows in set (0.01 sec) -mysql> desc sys.x$innodb_lock_waits; +mariadb> desc sys.x$innodb_lock_waits; +------------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------------------+-------+ @@ -601,7 +601,7 @@ mysql> desc sys.x$innodb_lock_waits; ##### Example ```SQL -mysql> SELECT * FROM innodb_lock_waits\G +mariadb> SELECT * FROM innodb_lock_waits\G *************************** 1. row *************************** wait_started: 2014-11-11 13:39:20 wait_age: 00:00:07 @@ -640,7 +640,7 @@ Shows the top IO consumers by thread, ordered by total latency. ##### Structures ```SQL -mysql> desc io_by_thread_by_latency; +mariadb> desc io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -655,7 +655,7 @@ mysql> desc io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ 8 rows in set (0.14 sec) -mysql> desc x$io_by_thread_by_latency; +mariadb> desc x$io_by_thread_by_latency; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -674,7 +674,7 @@ mysql> desc x$io_by_thread_by_latency; ##### Example ```SQL -mysql> select * from io_by_thread_by_latency; +mariadb> select * from io_by_thread_by_latency; +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ | user | total | total_latency | min_latency | avg_latency | max_latency | thread_id | processlist_id | +---------------------+-------+---------------+-------------+-------------+-------------+-----------+----------------+ @@ -701,7 +701,7 @@ Shows the top global IO consumers by bytes usage by file. ##### Structures ```SQL -mysql> desc io_global_by_file_by_bytes; +mariadb> desc io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -717,7 +717,7 @@ mysql> desc io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ 9 rows in set (0.15 sec) -mysql> desc x$io_global_by_file_by_bytes; +mariadb> desc x$io_global_by_file_by_bytes; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -737,7 +737,7 @@ mysql> desc x$io_global_by_file_by_bytes; ##### Example ```SQL -mysql> SELECT * FROM io_global_by_file_by_bytes LIMIT 5; +mariadb> SELECT * FROM io_global_by_file_by_bytes LIMIT 5; +--------------------------------------------+------------+------------+-----------+-------------+---------------+-----------+------------+-----------+ | file | count_read | total_read | avg_read | count_write | total_written | avg_write | total | write_pct | +--------------------------------------------+------------+------------+-----------+-------------+---------------+-----------+------------+-----------+ @@ -758,7 +758,7 @@ Shows the top global IO consumers by latency by file. ##### Structures ```SQL -mysql> desc io_global_by_file_by_latency; +mariadb> desc io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -774,7 +774,7 @@ mysql> desc io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ 9 rows in set (0.00 sec) -mysql> desc x$io_global_by_file_by_latency; +mariadb> desc x$io_global_by_file_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -794,7 +794,7 @@ mysql> desc x$io_global_by_file_by_latency; ##### Example ```SQL -mysql> select * from io_global_by_file_by_latency limit 5; +mariadb> select * from io_global_by_file_by_latency limit 5; +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ | file | total | total_latency | count_read | read_latency | count_write | write_latency | count_misc | misc_latency | +-----------------------------------------------------------+-------+---------------+------------+--------------+-------------+---------------+------------+--------------+ @@ -815,7 +815,7 @@ Shows the top global IO consumer classes by bytes usage. ##### Structures ```SQL -mysql> desc io_global_by_wait_by_bytes; +mariadb> desc io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ @@ -835,7 +835,7 @@ mysql> desc io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ 13 rows in set (0.02 sec) -mysql> desc x$io_global_by_wait_by_bytes; +mariadb> desc x$io_global_by_wait_by_bytes; +-----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------------+------+-----+---------+-------+ @@ -859,7 +859,7 @@ mysql> desc x$io_global_by_wait_by_bytes; ##### Example ```SQL -mysql> select * from io_global_by_wait_by_bytes; +mariadb> select * from io_global_by_wait_by_bytes; +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ | event_name | total | total_latency | min_latency | avg_latency | max_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | total_requested | +--------------------+--------+---------------+-------------+-------------+-------------+------------+------------+-----------+-------------+---------------+-------------+-----------------+ @@ -891,7 +891,7 @@ Shows the top global IO consumers by latency. ##### Structures ```SQL -mysql> desc io_global_by_wait_by_latency; +mariadb> desc io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -912,7 +912,7 @@ mysql> desc io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ 14 rows in set (0.19 sec) -mysql> desc x$io_global_by_wait_by_latency; +mariadb> desc x$io_global_by_wait_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -937,7 +937,7 @@ mysql> desc x$io_global_by_wait_by_latency; ##### Example ```SQL -mysql> SELECT * FROM io_global_by_wait_by_latency; +mariadb> SELECT * FROM io_global_by_wait_by_latency; +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ | event_name | total | total_latency | avg_latency | max_latency | read_latency | write_latency | misc_latency | count_read | total_read | avg_read | count_write | total_written | avg_written | +-------------------------+-------+---------------+-------------+-------------+--------------+---------------+--------------+------------+------------+-----------+-------------+---------------+-------------+ @@ -969,7 +969,7 @@ Shows the latest file IO, by file / thread. ##### Structures ```SQL -mysql> desc latest_file_io; +mariadb> desc latest_file_io; +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ @@ -981,7 +981,7 @@ mysql> desc latest_file_io; +-----------+--------------+------+-----+---------+-------+ 5 rows in set (0.10 sec) -mysql> desc x$latest_file_io; +mariadb> desc x$latest_file_io; +-----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------+------+-----+---------+-------+ @@ -997,7 +997,7 @@ mysql> desc x$latest_file_io; ##### Example ```SQL -mysql> select * from latest_file_io limit 5; +mariadb> select * from latest_file_io limit 5; +----------------------+----------------------------------------+------------+-----------+-----------+ | thread | file | latency | operation | requested | +----------------------+----------------------------------------+------------+-----------+-----------+ @@ -1013,14 +1013,14 @@ mysql> select * from latest_file_io limit 5; ##### Description -Summarizes memory use by host using the 5.7 Performance Schema instrumentation. +Summarizes memory use by host using the Performance Schema instrumentation. When the host found is NULL, it is assumed to be a local "background" thread. ##### Structures ```SQL -mysql> desc memory_by_host_by_current_bytes; +mariadb> desc memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1033,7 +1033,7 @@ mysql> desc memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ 6 rows in set (0.24 sec) -mysql> desc x$memory_by_host_by_current_bytes; +mariadb> desc x$memory_by_host_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1050,7 +1050,7 @@ mysql> desc x$memory_by_host_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; +mariadb> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; +------------+--------------------+-------------------+-------------------+-------------------+-----------------+ | host | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +------------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1063,14 +1063,14 @@ mysql> select * from memory_by_host_by_current_bytes WHERE host IS NOT NULL; ##### Description -Summarizes memory use by user using the 5.7 Performance Schema instrumentation. +Summarizes memory use by user using the Performance Schema instrumentation. The user columns shows either the background or foreground user name appropriately. ##### Structures ```SQL -mysql> desc memory_by_thread_by_current_bytes; +mariadb> desc memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------------+------+-----+---------+-------+ @@ -1084,7 +1084,7 @@ mysql> desc memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ 7 rows in set (0.49 sec) -mysql> desc x$memory_by_thread_by_current_bytes; +mariadb> desc x$memory_by_thread_by_current_bytes; +--------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------------+------+-----+---------+-------+ @@ -1102,7 +1102,7 @@ mysql> desc x$memory_by_thread_by_current_bytes; ##### Example ```SQL -mysql> select * from sys.memory_by_thread_by_current_bytes limit 5; +mariadb> select * from sys.memory_by_thread_by_current_bytes limit 5; +-----------+----------------+--------------------+-------------------+-------------------+-------------------+-----------------+ | thread_id | user | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +-----------+----------------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1118,14 +1118,14 @@ mysql> select * from sys.memory_by_thread_by_current_bytes limit 5; ##### Description -Summarizes memory use by user using the 5.7 Performance Schema instrumentation. +Summarizes memory use by user using the Performance Schema instrumentation. When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc memory_by_user_by_current_bytes; +mariadb> desc memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1138,7 +1138,7 @@ mysql> desc memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ 6 rows in set (0.06 sec) -mysql> desc x$memory_by_user_by_current_bytes; +mariadb> desc x$memory_by_user_by_current_bytes; +--------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------+------+-----+---------+-------+ @@ -1155,7 +1155,7 @@ mysql> desc x$memory_by_user_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_by_user_by_current_bytes; +mariadb> select * from memory_by_user_by_current_bytes; +------+--------------------+-------------------+-------------------+-------------------+-----------------+ | user | current_count_used | current_allocated | current_avg_alloc | current_max_alloc | total_allocated | +------+--------------------+-------------------+-------------------+-------------------+-----------------+ @@ -1173,7 +1173,7 @@ Shows the current memory usage within the server globally broken down by allocat ##### Structures ```SQL -mysql> desc memory_global_by_current_bytes; +mariadb> desc memory_global_by_current_bytes; +-------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+-------+ @@ -1187,7 +1187,7 @@ mysql> desc memory_global_by_current_bytes; +-------------------+--------------+------+-----+---------+-------+ 7 rows in set (0.08 sec) -mysql> desc x$memory_global_by_current_bytes; +mariadb> desc x$memory_global_by_current_bytes; +-------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------+------+-----+---------+-------+ @@ -1205,7 +1205,7 @@ mysql> desc x$memory_global_by_current_bytes; ##### Example ```SQL -mysql> select * from memory_global_by_current_bytes; +mariadb> select * from memory_global_by_current_bytes; +----------------------------------------+---------------+---------------+-------------------+------------+------------+----------------+ | event_name | current_count | current_alloc | current_avg_alloc | high_count | high_alloc | high_avg_alloc | +----------------------------------------+---------------+---------------+-------------------+------------+------------+----------------+ @@ -1227,7 +1227,7 @@ Shows the total memory usage within the server globally. ##### Structures ```SQL -mysql> desc memory_global_total; +mariadb> desc memory_global_total; +-----------------+------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+------+------+-----+---------+-------+ @@ -1235,7 +1235,7 @@ mysql> desc memory_global_total; +-----------------+------+------+-----+---------+-------+ 1 row in set (0.07 sec) -mysql> desc x$memory_global_total; +mariadb> desc x$memory_global_total; +-----------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+---------------+------+-----+---------+-------+ @@ -1247,7 +1247,7 @@ mysql> desc x$memory_global_total; ##### Example ```SQL -mysql> select * from memory_global_total; +mariadb> select * from memory_global_total; +-----------------+ | total_allocated | +-----------------+ @@ -1261,12 +1261,12 @@ mysql> select * from memory_global_total; Creates a union of the following information: - * performance_schema.global_status (information_schema.GLOBAL_STATUS in MySQL 5.6) + * performance_schema.global_status * information_schema.INNODB_METRICS - * Performance Schema global memory usage information (only in MySQL 5.7) + * Performance Schema global memory usage information * Current time -In MySQL 5.7 it is required that performance_schema = ON, though there is no requirements to which +It is required that performance_schema = ON, though there is no requirements to which instruments and consumers that are enabled. See also the description of the Enabled column below. For view has the following columns: @@ -1280,7 +1280,7 @@ For view has the following columns: ##### Structures ```SQL -mysql> DESC metrics; +mariadb> DESC metrics; +----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+--------------+------+-----+---------+-------+ @@ -1306,7 +1306,7 @@ mysq> DESC metrics_56; ##### Example ```SQL -mysql> SELECT * FROM metrics; +mariadb> SELECT * FROM metrics; +-----------------------------------------------+-------------------------...+--------------------------------------+---------+ | Variable_name | Variable_value ...| Type | Enabled | +-----------------------------------------------+-------------------------...+--------------------------------------+---------+ @@ -1348,10 +1348,10 @@ Performs less locking than the legacy sources, whilst giving extra information. The output includes both background threads and user connections by default. See also `session` / `x$session` for a view that contains only user session information. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc processlist; +mariadb> desc processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -1386,7 +1386,7 @@ mysql> desc processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ 28 rows in set (0.04 sec) -mysql> desc x$processlist; +mariadb> desc x$processlist; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -1425,7 +1425,7 @@ mysql> desc x$processlist; ##### Example ```SQL -mysql> select * from sys.processlist where conn_id is not null and command != 'daemon' and conn_id != connection_id()\G +mariadb> select * from sys.processlist where conn_id is not null and command != 'daemon' and conn_id != connection_id()\G *************************** 1. row *************************** thd_id: 44524 conn_id: 44502 @@ -1466,7 +1466,7 @@ Used to check whether Performance Schema is not able to monitor all runtime data ##### Structure ```SQL -mysql> desc ps_check_lost_instrumentation; +mariadb> desc ps_check_lost_instrumentation; +----------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------+------+-----+---------+-------+ @@ -1479,7 +1479,7 @@ mysql> desc ps_check_lost_instrumentation; ##### Example ```SQL -mysql> select * from ps_check_lost_instrumentation; +mariadb> select * from ps_check_lost_instrumentation; +----------------------------------------+----------------+ | variable_name | variable_value | +----------------------------------------+----------------+ @@ -1497,7 +1497,7 @@ Present current auto_increment usage/capacity in all tables. ##### Structures ```SQL -mysql> desc schema_auto_increment_columns; +mariadb> desc schema_auto_increment_columns; +----------------------+------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------+------------------------+------+-----+---------+-------+ @@ -1517,7 +1517,7 @@ mysql> desc schema_auto_increment_columns; ##### Example ```SQL -mysql> select * from schema_auto_increment_columns limit 5; +mariadb> select * from schema_auto_increment_columns limit 5; +-------------------+-------------------+-------------+-----------+-------------+-----------+-------------+---------------------+----------------+----------------------+ | table_schema | table_name | column_name | data_type | column_type | is_signed | is_unsigned | max_value | auto_increment | auto_increment_ratio | +-------------------+-------------------+-------------+-----------+-------------+-----------+-------------+---------------------+----------------+----------------------+ @@ -1540,7 +1540,7 @@ Ordered by the total wait time descending - top indexes are most contended. ##### Structures ```SQL -mysql> desc schema_index_statistics; +mariadb> desc schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -1558,7 +1558,7 @@ mysql> desc schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ 11 rows in set (0.17 sec) -mysql> desc x$schema_index_statistics; +mariadb> desc x$schema_index_statistics; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ @@ -1580,7 +1580,7 @@ mysql> desc x$schema_index_statistics; ##### Example ```SQL -mysql> select * from schema_index_statistics limit 5; +mariadb> select * from schema_index_statistics limit 5; +------------------+-------------+------------+---------------+----------------+---------------+----------------+--------------+----------------+--------------+----------------+ | table_schema | table_name | index_name | rows_selected | select_latency | rows_inserted | insert_latency | rows_updated | update_latency | rows_deleted | delete_latency | +------------------+-------------+------------+---------------+----------------+---------------+----------------+--------------+----------------+--------------+----------------+ @@ -1603,7 +1603,7 @@ Note: On instances with a large numbers of objects, this could take some time to ##### Structure ```SQL -mysql> desc schema_object_overview; +mariadb> desc schema_object_overview; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ @@ -1617,7 +1617,7 @@ mysql> desc schema_object_overview; ##### Example ```SQL -mysql> select * from schema_object_overview; +mariadb> select * from schema_object_overview; +--------------------+---------------+-------+ | db | object_type | count | +--------------------+---------------+-------+ @@ -1704,7 +1704,7 @@ Also includes the helper view (used by schema_table_statistics_with_buffer as we ##### Structures ```SQL -mysql> desc schema_table_statistics; +mariadb> desc schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -1730,7 +1730,7 @@ mysql> desc schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ 19 rows in set (0.12 sec) -mysql> desc x$schema_table_statistics; +mariadb> desc x$schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -1756,7 +1756,7 @@ mysql> desc x$schema_table_statistics; +-------------------+---------------------+------+-----+---------+-------+ 19 rows in set (0.13 sec) -mysql> desc x$ps_schema_table_statistics_io; +mariadb> desc x$ps_schema_table_statistics_io; +---------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------------+---------------+------+-----+---------+-------+ @@ -1777,7 +1777,7 @@ mysql> desc x$ps_schema_table_statistics_io; ##### Example ```SQL -mysql> select * from schema_table_statistics\G +mariadb> select * from schema_table_statistics\G *************************** 1. row *************************** table_schema: sys table_name: sys_config @@ -1811,7 +1811,7 @@ Also includes the the helper view `x$schema_flattened_keys`. ##### Structures ```SQL -mysql> desc sys.schema_redundant_indexes; +mariadb> desc sys.schema_redundant_indexes; +----------------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+--------------+------+-----+---------+-------+ @@ -1828,7 +1828,7 @@ mysql> desc sys.schema_redundant_indexes; +----------------------------+--------------+------+-----+---------+-------+ 10 rows in set (0.00 sec) -mysql> desc sys.x$schema_flattened_keys; +mariadb> desc sys.x$schema_flattened_keys; +----------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+-------------+------+-----+---------+-------+ @@ -1845,7 +1845,7 @@ mysql> desc sys.x$schema_flattened_keys; ##### Example ```SQL -mysql> select * from sys.schema_redundant_indexes\G +mariadb> select * from sys.schema_redundant_indexes\G *************************** 1. row *************************** table_schema: test table_name: rkey @@ -1859,7 +1859,7 @@ redundant_index_non_unique: 1 sql_drop_index: ALTER TABLE `test`.`rkey` DROP INDEX `j` 1 row in set (0.20 sec) -mysql> SHOW CREATE TABLE test.rkey\G +mariadb> SHOW CREATE TABLE test.rkey\G *************************** 1. row *************************** Table: rkey Create Table: CREATE TABLE `rkey` ( @@ -1882,7 +1882,7 @@ Shows sessions that are blocked waiting on table metadata locks, and who is bloc ##### Structures ```SQL -mysql> desc schema_table_lock_waits; +mariadb> desc schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------+-------+ @@ -1907,7 +1907,7 @@ mysql> desc schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ 18 rows in set (0.15 sec) -mysql> desc x$schema_table_lock_waits; +mariadb> desc x$schema_table_lock_waits; +------------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------------+---------------------+------+-----+---------+-------+ @@ -1936,7 +1936,7 @@ mysql> desc x$schema_table_lock_waits; ##### Example ```SQL -mysql> select * from sys.schema_table_lock_waits\G +mariadb> select * from sys.schema_table_lock_waits\G *************************** 1. row *************************** object_schema: test object_name: t @@ -1973,7 +1973,7 @@ Uses the x$ps_schema_table_statistics_io helper view from schema_table_statistic ##### Structures ```SQL -mysql> desc schema_table_statistics_with_buffer; +mariadb> desc schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+---------------------+------+-----+---------+-------+ @@ -2005,7 +2005,7 @@ mysql> desc schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ 25 rows in set (0.05 sec) -mysql> desc x$schema_table_statistics_with_buffer; +mariadb> desc x$schema_table_statistics_with_buffer; +----------------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------------+---------------------+------+-----+---------+-------+ @@ -2041,7 +2041,7 @@ mysql> desc x$schema_table_statistics_with_buffer; ##### Example ```SQL -mysql> select * from schema_table_statistics_with_buffer limit 1\G +mariadb> select * from schema_table_statistics_with_buffer limit 1\G *************************** 1. row *************************** table_schema: mem table_name: mysqlserver @@ -2078,7 +2078,7 @@ Finds tables that are being accessed by full table scans ordering by the number ##### Structures ```SQL -mysql> desc schema_tables_with_full_table_scans; +mariadb> desc schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -2089,7 +2089,7 @@ mysql> desc schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ 4 rows in set (0.02 sec) -mysql> desc x$schema_tables_with_full_table_scans; +mariadb> desc x$schema_tables_with_full_table_scans; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ @@ -2104,7 +2104,7 @@ mysql> desc x$schema_tables_with_full_table_scans; ##### Example ```SQL -mysql> select * from schema_tables_with_full_table_scans limit 5; +mariadb> select * from schema_tables_with_full_table_scans limit 5; +--------------------+--------------------------------+-------------------+-----------+ | object_schema | object_name | rows_full_scanned | latency | +--------------------+--------------------------------+-------------------+-----------+ @@ -2129,7 +2129,7 @@ PRIMARY (key) indexes are ignored. ##### Structure ```SQL -mysql> desc schema_unused_indexes; +mariadb> desc schema_unused_indexes; +---------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+-------+ @@ -2143,7 +2143,7 @@ mysql> desc schema_unused_indexes; ##### Example ```SQL -mysql> select * from schema_unused_indexes limit 5; +mariadb> select * from schema_unused_indexes limit 5; +--------------------+---------------------+--------------------+ | object_schema | object_name | index_name | +--------------------+---------------------+--------------------+ @@ -2165,10 +2165,10 @@ Performs less locking than the legacy sources, whilst giving extra information. The output of this view is restricted to threads from user sessions. See also processlist / x$processlist which contains both user and background threads. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc session; +mariadb> desc session; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -2203,7 +2203,7 @@ mysql> desc session; +------------------------+------------------------------------------+------+-----+---------+-------+ 28 rows in set (0.00 sec) -mysql> desc x$session; +mariadb> desc x$session; +------------------------+------------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+------------------------------------------+------+-----+---------+-------+ @@ -2242,7 +2242,7 @@ mysql> desc x$session; ##### Example ```SQL -mysql> select * from sys.session\G +mariadb> select * from sys.session\G *************************** 1. row *************************** thd_id: 24 conn_id: 2 @@ -2283,7 +2283,7 @@ Shows SSL version, cipher and the count of re-used SSL sessions per connection ##### Structures ```SQL -mysql> desc sys.session_ssl_status; +mariadb> desc sys.session_ssl_status; +---------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+---------------------+------+-----+---------+-------+ @@ -2298,7 +2298,7 @@ mysql> desc sys.session_ssl_status; ##### Example ```SQL -mysql> select * from session_ssl_status; +mariadb> select * from session_ssl_status; +-----------+-------------+--------------------+---------------------+ | thread_id | ssl_version | ssl_cipher | ssl_sessions_reused | +-----------+-------------+--------------------+---------------------+ @@ -2313,12 +2313,12 @@ mysql> select * from session_ssl_status; ##### Description -Lists a normalized statement view with aggregated statistics, mimics the MySQL Enterprise Monitor Query Analysis view, ordered by the total execution time per normalized statement +Lists a normalized statement view with aggregated statistics, ordered by the total execution time per normalized statement ##### Structures ```SQL -mysql> desc statement_analysis; +mariadb> desc statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2348,7 +2348,7 @@ mysql> desc statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ 23 rows in set (0.26 sec) -mysql> desc x$statement_analysis; +mariadb> desc x$statement_analysis; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2382,7 +2382,7 @@ mysql> desc x$statement_analysis; ##### Example ```SQL -mysql> select * from statement_analysis limit 1\G +mariadb> select * from statement_analysis limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2418,7 +2418,7 @@ Lists all normalized statements that have raised errors or warnings. ##### Structures ```SQL -mysql> desc statements_with_errors_or_warnings; +mariadb> desc statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------------------+-------+ @@ -2435,7 +2435,7 @@ mysql> desc statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ 10 rows in set (0.55 sec) -mysql> desc x$statements_with_errors_or_warnings; +mariadb> desc x$statements_with_errors_or_warnings; +-------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------------------+-------+ @@ -2456,7 +2456,7 @@ mysql> desc x$statements_with_errors_or_warnings; ##### Example ```SQL -mysql> select * from statements_with_errors_or_warnings LIMIT 1\G +mariadb> select * from statements_with_errors_or_warnings LIMIT 1\G *************************** 1. row *************************** query: CREATE OR REPLACE ALGORITHM = ... _delete` AS `rows_deleted` ... db: sys @@ -2481,7 +2481,7 @@ This view ignores SHOW statements, as these always cause a full table scan, and ##### Structures ```SQL -mysql> desc statements_with_full_table_scans; +mariadb> desc statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+------------------------+------+-----+---------------------+-------+ @@ -2502,7 +2502,7 @@ mysql> desc statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ 14 rows in set (0.04 sec) -mysql> desc x$statements_with_full_table_scans; +mariadb> desc x$statements_with_full_table_scans; +--------------------------+------------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+------------------------+------+-----+---------------------+-------+ @@ -2527,7 +2527,7 @@ mysql> desc x$statements_with_full_table_scans; ##### Example ```SQL -mysql> select * from statements_with_full_table_scans limit 1\G +mariadb> select * from statements_with_full_table_scans limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_tables_w ... ex_usage` . `COUNT_READ` DESC db: sys @@ -2559,7 +2559,7 @@ Also includes two helper views: ##### Structures ```SQL -mysql> desc statements_with_runtimes_in_95th_percentile; +mariadb> desc statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2582,7 +2582,7 @@ mysql> desc statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ 16 rows in set (0.11 sec) -mysql> desc x$statements_with_runtimes_in_95th_percentile; +mariadb> desc x$statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2605,7 +2605,7 @@ mysql> desc x$statements_with_runtimes_in_95th_percentile; +-------------------+---------------------+------+-----+---------------------+-------+ 16 rows in set (0.00 sec) -mysql> desc x$ps_digest_avg_latency_distribution; +mariadb> desc x$ps_digest_avg_latency_distribution; +--------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------------+------+-----+---------+-------+ @@ -2614,7 +2614,7 @@ mysql> desc x$ps_digest_avg_latency_distribution; +--------+---------------+------+-----+---------+-------+ 2 rows in set (0.10 sec) -mysql> desc x$ps_digest_95th_percentile_by_avg_us; +mariadb> desc x$ps_digest_95th_percentile_by_avg_us; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2627,7 +2627,7 @@ mysql> desc x$ps_digest_95th_percentile_by_avg_us; ##### Example ```SQL -mysql> select * from statements_with_runtimes_in_95th_percentile\G +mariadb> select * from statements_with_runtimes_in_95th_percentile\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2656,7 +2656,7 @@ Lists all normalized statements that have done sorts, ordered by total_latency d ##### Structures ```SQL -mysql> desc statements_with_sorting; +mariadb> desc statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2676,7 +2676,7 @@ mysql> desc statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ 13 rows in set (0.01 sec) -mysql> desc x$statements_with_sorting; +mariadb> desc x$statements_with_sorting; +-------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------------------+-------+ @@ -2700,7 +2700,7 @@ mysql> desc x$statements_with_sorting; ##### Example ```SQL -mysql> select * from statements_with_sorting limit 1\G +mariadb> select * from statements_with_sorting limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2726,7 +2726,7 @@ Lists all normalized statements that use temporary tables ordered by number of o ##### Structures ```SQL -mysql> desc statements_with_temp_tables; +mariadb> desc statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+---------------------+------+-----+---------------------+-------+ @@ -2744,7 +2744,7 @@ mysql> desc statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ 11 rows in set (0.30 sec) -mysql> desc x$statements_with_temp_tables; +mariadb> desc x$statements_with_temp_tables; +--------------------------+---------------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------------+---------------------+------+-----+---------------------+-------+ @@ -2766,7 +2766,7 @@ mysql> desc x$statements_with_temp_tables; ##### Example ```SQL -mysql> select * from statements_with_temp_tables limit 1\G +mariadb> select * from statements_with_temp_tables limit 1\G *************************** 1. row *************************** query: SELECT * FROM `schema_object_o ... MA` , `information_schema` ... db: sys @@ -2789,10 +2789,10 @@ Summarizes statement activity, file IO and connections by user. When the user found is NULL, it is assumed to be a "background" thread. -##### Structures (5.7) +##### Structures ```SQL -mysql> desc user_summary; +mariadb> desc user_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -2811,7 +2811,7 @@ mysql> desc user_summary; +------------------------+---------------+------+-----+---------+-------+ 12 rows in set (0.00 sec) -mysql> desc x$user_summary; +mariadb> desc x$user_summary; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ @@ -2834,7 +2834,7 @@ mysql> desc x$user_summary; ##### Example ```SQL -mysql> select * from user_summary\G +mariadb> select * from user_summary\G *************************** 1. row *************************** user: root statements: 4981 @@ -2874,7 +2874,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_file_io; +mariadb> desc user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2884,7 +2884,7 @@ mysql> desc user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ 3 rows in set (0.20 sec) -mysql> desc x$user_summary_by_file_io; +mariadb> desc x$user_summary_by_file_io; +------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+---------------+------+-----+---------+-------+ @@ -2898,7 +2898,7 @@ mysql> desc x$user_summary_by_file_io; ##### Example ```SQL -mysql> select * from user_summary_by_file_io; +mariadb> select * from user_summary_by_file_io; +------------+-------+------------+ | user | ios | io_latency | +------------+-------+------------+ @@ -2918,7 +2918,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_file_io_type; +mariadb> desc user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------+-------+ @@ -2930,7 +2930,7 @@ mysql> desc user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.02 sec) -mysql> desc x$user_summary_by_file_io_type; +mariadb> desc x$user_summary_by_file_io_type; +-------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------------+------+-----+---------+-------+ @@ -2946,7 +2946,7 @@ mysql> desc x$user_summary_by_file_io_type; ##### Example ```SQL -mysql> select * from user_summary_by_file_io_type; +mariadb> select * from user_summary_by_file_io_type; +------------+--------------------------------------+-------+-----------+-------------+ | user | event_name | total | latency | max_latency | +------------+--------------------------------------+-------+-----------+-------------+ @@ -2990,7 +2990,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_stages; +mariadb> desc user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3002,7 +3002,7 @@ mysql> desc user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.01 sec) -mysql> desc x$user_summary_by_stages; +mariadb> desc x$user_summary_by_stages; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3018,7 +3018,7 @@ mysql> desc x$user_summary_by_stages; ##### Example ```SQL -mysql> select * from user_summary_by_stages; +mariadb> select * from user_summary_by_stages; +------+--------------------------------+-------+---------------+-------------+ | user | event_name | total | total_latency | avg_latency | +------+--------------------------------+-------+---------------+-------------+ @@ -3052,7 +3052,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_statement_latency; +mariadb> desc user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3068,7 +3068,7 @@ mysql> desc user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ 9 rows in set (0.00 sec) -mysql> desc x$user_summary_by_statement_latency; +mariadb> desc x$user_summary_by_statement_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3088,7 +3088,7 @@ mysql> desc x$user_summary_by_statement_latency; ##### Example ```SQL -mysql> select * from user_summary_by_statement_latency; +mariadb> select * from user_summary_by_statement_latency; +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | user | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -3107,7 +3107,7 @@ When the user found is NULL, it is assumed to be a "background" thread. ##### Structures ```SQL -mysql> desc user_summary_by_statement_type; +mariadb> desc user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3124,7 +3124,7 @@ mysql> desc user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ 10 rows in set (0.21 sec) -mysql> desc x$user_summary_by_statement_type; +mariadb> desc x$user_summary_by_statement_type; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3145,7 +3145,7 @@ mysql> desc x$user_summary_by_statement_type; ##### Example ```SQL -mysql> select * from user_summary_by_statement_type; +mariadb> select * from user_summary_by_statement_type; +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ | user | statement | total | total_latency | max_latency | lock_latency | rows_sent | rows_examined | rows_affected | full_scans | +------+------------------+-------+---------------+-------------+--------------+-----------+---------------+---------------+------------+ @@ -3178,7 +3178,7 @@ Lists the top wait classes by average latency, ignoring idle (this may be very l ##### Structures ```SQL -mysql> desc wait_classes_global_by_avg_latency; +mariadb> desc wait_classes_global_by_avg_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3191,7 +3191,7 @@ mysql> desc wait_classes_global_by_avg_latency; +---------------+---------------+------+-----+---------+-------+ 6 rows in set (0.11 sec) -mysql> desc x$wait_classes_global_by_avg_latency; +mariadb> desc x$wait_classes_global_by_avg_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3208,7 +3208,7 @@ mysql> desc x$wait_classes_global_by_avg_latency; ##### Example ```SQL -mysql> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; +mariadb> select * from wait_classes_global_by_avg_latency where event_class != 'idle'; +-------------------+--------+---------------+-------------+-------------+-------------+ | event_class | total | total_latency | min_latency | avg_latency | max_latency | +-------------------+--------+---------------+-------------+-------------+-------------+ @@ -3230,7 +3230,7 @@ Lists the top wait classes by total latency, ignoring idle (this may be very lar ##### Structures ```SQL -mysql> desc wait_classes_global_by_latency; +mariadb> desc wait_classes_global_by_latency; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ @@ -3243,7 +3243,7 @@ mysql> desc wait_classes_global_by_latency; +---------------+---------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) -mysql> desc x$wait_classes_global_by_latency; +mariadb> desc x$wait_classes_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3260,7 +3260,7 @@ mysql> desc x$wait_classes_global_by_latency; ##### Example ```SQL -mysql> select * from wait_classes_global_by_latency; +mariadb> select * from wait_classes_global_by_latency; +-------------------+--------+---------------+-------------+-------------+-------------+ | event_class | total | total_latency | min_latency | avg_latency | max_latency | +-------------------+--------+---------------+-------------+-------------+-------------+ @@ -3282,7 +3282,7 @@ Lists the top wait events per user by their total latency, ignoring idle (this m ##### Structures ```SQL -mysql> desc waits_by_user_by_latency; +mariadb> desc waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3295,7 +3295,7 @@ mysql> desc waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) -mysql> desc x$waits_by_user_by_latency; +mariadb> desc x$waits_by_user_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3312,7 +3312,7 @@ mysql> desc x$waits_by_user_by_latency; ##### Example ```SQL -mysql> select * from waits_by_user_by_latency; +mariadb> select * from waits_by_user_by_latency; +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ | user | event | total | total_latency | avg_latency | max_latency | +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ @@ -3343,7 +3343,7 @@ Lists the top wait events per host by their total latency, ignoring idle (this m ##### Structures ```SQL -mysql> desc waits_by_host_by_latency; +mariadb> desc waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3356,7 +3356,7 @@ mysql> desc waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ 6 rows in set (0.36 sec) -mysql> desc x$waits_by_host_by_latency; +mariadb> desc x$waits_by_host_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3373,7 +3373,7 @@ mysql> desc x$waits_by_host_by_latency; ##### Example ```SQL - mysql> select * from waits_by_host_by_latency; + mariadb> select * from waits_by_host_by_latency; +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ | host | event | total | total_latency | avg_latency | max_latency | +------+-----------------------------------------------------+--------+---------------+-------------+-------------+ @@ -3404,7 +3404,7 @@ Lists the top wait events by their total latency, ignoring idle (this may be ver ##### Structures ```SQL -mysql> desc waits_global_by_latency; +mariadb> desc waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3416,7 +3416,7 @@ mysql> desc waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ 5 rows in set (0.01 sec) -mysql> desc x$waits_global_by_latency; +mariadb> desc x$waits_global_by_latency; +---------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------------+------+-----+---------+-------+ @@ -3432,7 +3432,7 @@ mysql> desc x$waits_global_by_latency; ##### Example ```SQL -mysql> select * from waits_global_by_latency; +mariadb> select * from waits_global_by_latency; +-----------------------------------------------------+---------+---------------+-------------+-------------+ | events | total | total_latency | avg_latency | max_latency | +-----------------------------------------------------+---------+---------------+-------------+-------------+ @@ -3486,7 +3486,7 @@ VARCHAR(64) ##### Example ```SQL -mysql> SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); +mariadb> SELECT sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd'); +----------------------------------------------------------------------------+ | sys.extract_schema_from_file_name('/var/lib/mysql/employees/employee.ibd') | +----------------------------------------------------------------------------+ @@ -3513,7 +3513,7 @@ VARCHAR(64) ##### Example ```SQL -mysql> SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); +mariadb> SELECT sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd'); +---------------------------------------------------------------------------+ | sys.extract_table_from_file_name('/var/lib/mysql/employees/employee.ibd') | +---------------------------------------------------------------------------+ @@ -3538,7 +3538,7 @@ TEXT ##### Example ```SQL -mysql> SELECT sys.format_bytes(2348723492723746) AS size; +mariadb> SELECT sys.format_bytes(2348723492723746) AS size; +----------+ | size | +----------+ @@ -3546,7 +3546,7 @@ mysql> SELECT sys.format_bytes(2348723492723746) AS size; +----------+ 1 row in set (0.00 sec) -mysql> SELECT sys.format_bytes(2348723492723) AS size; +mariadb> SELECT sys.format_bytes(2348723492723) AS size; +----------+ | size | +----------+ @@ -3554,7 +3554,7 @@ mysql> SELECT sys.format_bytes(2348723492723) AS size; +----------+ 1 row in set (0.00 sec) -mysql> SELECT sys.format_bytes(23487234) AS size; +mariadb> SELECT sys.format_bytes(23487234) AS size; +-----------+ | size | +-----------+ @@ -3581,7 +3581,7 @@ VARCHAR(512) CHARSET UTF8 ##### Example ```SQL -mysql> select @@datadir; +mariadb> select @@datadir; +-----------------------------------------------+ | @@datadir | +-----------------------------------------------+ @@ -3589,7 +3589,7 @@ mysql> select @@datadir; +-----------------------------------------------+ 1 row in set (0.06 sec) -mysql> select format_path('/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD') AS path; +mariadb> select format_path('/Users/mark/sandboxes/SmallTree/AMaster/data/mysql/proc.MYD') AS path; +--------------------------+ | path | +--------------------------+ @@ -3618,7 +3618,7 @@ LONGTEXT ##### Example ```SQL -mysql> SELECT sys.format_statement(digest_text) +mariadb> SELECT sys.format_statement(digest_text) -> FROM performance_schema.events_statements_summary_by_digest -> ORDER by sum_timer_wait DESC limit 5; +-------------------------------------------------------------------+ @@ -3651,7 +3651,7 @@ TEXT ##### Example ```SQL -mysql> select format_time(342342342342345); +mariadb> select format_time(342342342342345); +------------------------------+ | format_time(342342342342345) | +------------------------------+ @@ -3659,7 +3659,7 @@ mysql> select format_time(342342342342345); +------------------------------+ 1 row in set (0.00 sec) -mysql> select format_time(342342342); +mariadb> select format_time(342342342); +------------------------+ | format_time(342342342) | +------------------------+ @@ -3667,7 +3667,7 @@ mysql> select format_time(342342342); +------------------------+ 1 row in set (0.00 sec) -mysql> select format_time(34234); +mariadb> select format_time(34234); +--------------------+ | format_time(34234) | +--------------------+ @@ -3697,7 +3697,7 @@ TEXT ##### Example ```SQL -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------+ @@ -3705,10 +3705,10 @@ mysql> select @@sql_mode; +-----------------------------------------------------------------------------------+ 1 row in set (0.00 sec) -mysql> set sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); +mariadb> set sql_mode = sys.list_add(@@sql_mode, 'ANSI_QUOTES'); Query OK, 0 rows affected (0.06 sec) -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------------------+ @@ -3738,7 +3738,7 @@ TEXT ##### Example ```SQL -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ | @@sql_mode | +-----------------------------------------------------------------------------------------------+ @@ -3746,10 +3746,10 @@ mysql> select @@sql_mode; +-----------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) -mysql> set sql_mode = sys.list_drop(@@sql_mode, 'ONLY_FULL_GROUP_BY'); +mariadb> set sql_mode = sys.list_drop(@@sql_mode, 'ONLY_FULL_GROUP_BY'); Query OK, 0 rows affected (0.03 sec) -mysql> select @@sql_mode; +mariadb> select @@sql_mode; +----------------------------------------------------------------------------+ | @@sql_mode | +----------------------------------------------------------------------------+ @@ -3775,7 +3775,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_account_enabled('localhost', 'root'); +mariadb> SELECT sys.ps_is_account_enabled('localhost', 'root'); +------------------------------------------------+ | sys.ps_is_account_enabled('localhost', 'root') | +------------------------------------------------+ @@ -3800,7 +3800,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_consumer_enabled('events_stages_history'); +mariadb> SELECT sys.ps_is_consumer_enabled('events_stages_history'); +-----------------------------------------------------+ | sys.ps_is_consumer_enabled('events_stages_history') | +-----------------------------------------------------+ @@ -3813,7 +3813,7 @@ mysql> SELECT sys.ps_is_consumer_enabled('events_stages_history'); ##### Description -Returns whether an instrument is enabled by default in this version of MySQL. +Returns whether an instrument is enabled by default in this version of MariaDB. ##### Parameters @@ -3825,7 +3825,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +mariadb> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); +--------------------------------------------------------------+ | sys.ps_is_instrument_default_enabled('statement/sql/select') | +--------------------------------------------------------------+ @@ -3838,7 +3838,7 @@ mysql> SELECT sys.ps_is_instrument_default_enabled('statement/sql/select'); ##### Description -Returns whether an instrument is timed by default in this version of MySQL. +Returns whether an instrument is timed by default in this version of MariaDB. ##### Parameters @@ -3850,7 +3850,7 @@ ENUM('YES', 'NO') ##### Example ```SQL -mysql> SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +mariadb> SELECT sys.ps_is_instrument_default_timed('statement/sql/select'); +------------------------------------------------------------+ | sys.ps_is_instrument_default_timed('statement/sql/select') | +------------------------------------------------------------+ @@ -3875,7 +3875,7 @@ ENUM('YES', 'NO', 'UNKNOWN') ##### Example ```SQL -mysql> SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +mariadb> SELECT sys.ps_is_thread_instrumented(CONNECTION_ID()); +------------------------------------------------+ | sys.ps_is_thread_instrumented(CONNECTION_ID()) | +------------------------------------------------+ @@ -3900,7 +3900,7 @@ BIGINT UNSIGNED ##### Example ```SQL -mysql> SELECT sys.ps_thread_id(79); +mariadb> SELECT sys.ps_thread_id(79); +----------------------+ | sys.ps_thread_id(79) | +----------------------+ @@ -3908,7 +3908,7 @@ mysql> SELECT sys.ps_thread_id(79); +----------------------+ 1 row in set (0.00 sec) -mysql> SELECT sys.ps_thread_id(CONNECTION_ID()); +mariadb> SELECT sys.ps_thread_id(CONNECTION_ID()); +-----------------------------------+ | sys.ps_thread_id(CONNECTION_ID()) | +-----------------------------------+ @@ -3932,12 +3932,11 @@ Outputs a JSON formatted stack of all statements, stages and events within Perfo (line separation added for output) ```SQL - mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G + mariadb> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\G *************************** 1. row *************************** -thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2014-02-19 13:39:03", -"mysql_version": "5.7.3-m13","mysql_user": "root@localhost","events": -[{"nesting_event_id": "0", "event_id": "10", "timer_wait": 256.35, "event_info": -"sql/select", "wait_info": "select @@version_comment limit 1\nerrors: 0\nwarnings: 0\nlock time: +thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2024-09-04 21:21:44", +"mysql_version": "10.6.19-MariaDB","mysql_user": "msandbox@localhost","events": []} + ... ``` @@ -4054,7 +4053,7 @@ TEXT ##### Example ```SQL -mysql> SELECT sys.quote_identifier('my_identifier') AS Identifier; +mariadb> SELECT sys.quote_identifier('my_identifier') AS Identifier; +-----------------+ | Identifier | +-----------------+ @@ -4062,7 +4061,7 @@ mysql> SELECT sys.quote_identifier('my_identifier') AS Identifier; +-----------------+ 1 row in set (0.00 sec) -mysql> SELECT sys.quote_identifier('my`idenfier') AS Identifier; +mariadb> SELECT sys.quote_identifier('my`idenfier') AS Identifier; +----------------+ | Identifier | +----------------+ @@ -4104,7 +4103,7 @@ VARCHAR(128) ##### Example ```SQL -- Get the configuration value from sys.sys_config falling back on 128 if the option is not present in the table. -mysql> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; +mariadb> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; +-------+ | Value | +-------+ @@ -4113,7 +4112,7 @@ mysql> SELECT sys.sys_get_config('statement_truncate_len', 128) AS Value; 1 row in set (0.00 sec) -- Check whether the option is already set, if not assign - IFNULL(...) one liner example. -mysql> SET @sys.statement_truncate_len = IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 64)); +mariadb> SET @sys.statement_truncate_len = IFNULL(@sys.statement_truncate_len, sys.sys_get_config('statement_truncate_len', 64)); Query OK, 0 rows affected (0.00 sec) -- Check whether the option is already set, if not assign - IF ... THEN ... END IF example. @@ -4126,7 +4125,7 @@ END IF; ##### Description -Returns the major version of MySQL Server. +Returns the major version of MariaDB Server. ##### Returns @@ -4134,12 +4133,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.version_major(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_major() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 5 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.version_major(); ++-----------------+---------------------+ +| VERSION() | sys.version_major() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 10 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4147,7 +4146,7 @@ mysql> SELECT VERSION(), sys.version_major(); ##### Description -Returns the minor (release series) version of MySQL Server. +Returns the minor (release series) version of MariaDB Server. ##### Returns @@ -4155,12 +4154,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.server_minor(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_minor() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 7 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.server_minor(); ++-----------------+---------------------+ +| VERSION() | sys.version_minor() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 6 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4168,7 +4167,7 @@ mysql> SELECT VERSION(), sys.server_minor(); ##### Description -Returns the patch release version of MySQL Server. +Returns the patch release version of MariaDB Server. ##### Returns @@ -4176,12 +4175,12 @@ TINYINT UNSIGNED ##### Example ```SQL -mysql> SELECT VERSION(), sys.version_patch(); -+--------------------------------------+---------------------+ -| VERSION() | sys.version_patch() | -+--------------------------------------+---------------------+ -| 5.7.9-enterprise-commercial-advanced | 9 | -+--------------------------------------+---------------------+ +mariadb> SELECT VERSION(), sys.version_patch(); ++-----------------+---------------------+ +| VERSION() | sys.version_patch() | ++-----------------+---------------------+ +| 10.6.19-MariaDB | 19 | ++-----------------+---------------------+ 1 row in set (0.00 sec) ``` @@ -4205,7 +4204,7 @@ Useful for creating a "ps" synonym for "performance_schema", or "is" instead of ##### Example ```SQL -mysql> SHOW DATABASES; +mariadb> SHOW DATABASES; +--------------------+ | Database | +--------------------+ @@ -4217,7 +4216,7 @@ mysql> SHOW DATABASES; +--------------------+ 5 rows in set (0.00 sec) -mysql> CALL sys.create_synonym_db('performance_schema', 'ps'); +mariadb> CALL sys.create_synonym_db('performance_schema', 'ps'); +---------------------------------------+ | summary | +---------------------------------------+ @@ -4227,7 +4226,7 @@ mysql> CALL sys.create_synonym_db('performance_schema', 'ps'); Query OK, 0 rows affected (8.57 sec) -mysql> SHOW DATABASES; +mariadb> SHOW DATABASES; +--------------------+ | Database | +--------------------+ @@ -4240,7 +4239,7 @@ mysql> SHOW DATABASES; +--------------------+ 6 rows in set (0.00 sec) -mysql> SHOW FULL TABLES FROM ps; +mariadb> SHOW FULL TABLES FROM ps; +-----------------------------------------+------------+ | Tables_in_ps | Table_type | +-----------------------------------------+------------+ @@ -4260,7 +4259,6 @@ Create a report of the current status of the server for diagnostics purposes. Da * The GLOBAL VARIABLES * Several sys schema views including metrics or equivalent (depending on version and settings) * Queries in the 95th percentile -* Several ndbinfo views for MySQL Cluster * Replication (both master and slave) information. Some of the sys schema views are calculated as initial (optional), overall, delta: @@ -4278,10 +4276,6 @@ Some of the sys schema views are calculated as initial (optional), overall, delt Requires the SUPER privilege for "SET sql_log_bin = 0;". -Versions supported: -* MySQL 5.6: 5.6.10 and later -* MySQL 5.7: 5.7.9 and later - Some configuration options are supported: * sys.diagnostics.allow_i_s_tables @@ -4323,10 +4317,10 @@ Supported values are: ##### Example ```SQL -mysql> TEE diag.out; -mysql> CALL sys.diagnostics(120, 30, 'current'); +mariadb> TEE diag.out; +mariadb> CALL sys.diagnostics(120, 30, 'current'); ... -mysql> NOTEE; +mariadb> NOTEE; ``` #### ps_setup_disable_background_threads @@ -4341,7 +4335,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_disable_background_threads(); +mariadb> CALL sys.ps_setup_disable_background_threads(); +--------------------------------+ | summary | +--------------------------------+ @@ -4372,7 +4366,7 @@ The following configuration option is supported: ##### Example ```SQL -mysql> CALL sys.execute_prepared_stmt('SELECT * FROM sys.sys_config'); +mariadb> CALL sys.execute_prepared_stmt('SELECT * FROM sys.sys_config'); +------------------------+-------+---------------------+--------+ | variable | value | set_time | set_by | +------------------------+-------+---------------------+--------+ @@ -4397,7 +4391,7 @@ Disables consumers within Performance Schema matching the input pattern. To disable all consumers: ```SQL -mysql> CALL sys.ps_setup_disable_consumer(''); +mariadb> CALL sys.ps_setup_disable_consumer(''); +--------------------------+ | summary | +--------------------------+ @@ -4408,7 +4402,7 @@ mysql> CALL sys.ps_setup_disable_consumer(''); To disable just the event_stage consumers: ```SQL -mysql> CALL sys.ps_setup_disable_consumer('stage'); +mariadb> CALL sys.ps_setup_disable_consumer('stage'); +------------------------+ | summary | +------------------------+ @@ -4431,7 +4425,7 @@ Disables instruments within Performance Schema matching the input pattern. To disable all mutex instruments: ```SQL -mysql> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); +mariadb> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); +--------------------------+ | summary | +--------------------------+ @@ -4441,7 +4435,7 @@ mysql> CALL sys.ps_setup_disable_instrument('wait/synch/mutex'); ``` To disable just a specific TCP/IP based network IO instrument: ```SQL -mysql> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_socket'); +mariadb> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_socket'); +------------------------+ | summary | +------------------------+ @@ -4451,7 +4445,7 @@ mysql> CALL sys.ps_setup_disable_instrument('wait/io/socket/sql/server_tcpip_soc ``` To disable all instruments: ```SQL -mysql> CALL sys.ps_setup_disable_instrument(''); +mariadb> CALL sys.ps_setup_disable_instrument(''); +--------------------------+ | summary | +--------------------------+ @@ -4472,7 +4466,7 @@ Disable the given connection/thread in Performance Schema. ##### Example ```SQL -mysql> CALL sys.ps_setup_disable_thread(3); +mariadb> CALL sys.ps_setup_disable_thread(3); +-------------------+ | summary | +-------------------+ @@ -4482,7 +4476,7 @@ mysql> CALL sys.ps_setup_disable_thread(3); ``` To disable the current connection: ```SQL -mysql> CALL sys.ps_setup_disable_thread(CONNECTION_ID()); +mariadb> CALL sys.ps_setup_disable_thread(CONNECTION_ID()); +-------------------+ | summary | +-------------------+ @@ -4503,7 +4497,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_enable_background_threads(); +mariadb> CALL sys.ps_setup_enable_background_threads(); +-------------------------------+ | summary | +-------------------------------+ @@ -4526,7 +4520,7 @@ Enables consumers within Performance Schema matching the input pattern. To enable all consumers: ```SQL -mysql> CALL sys.ps_setup_enable_consumer(''); +mariadb> CALL sys.ps_setup_enable_consumer(''); +-------------------------+ | summary | +-------------------------+ @@ -4537,7 +4531,7 @@ mysql> CALL sys.ps_setup_enable_consumer(''); To enable just "waits" consumers: ```SQL -mysql> CALL sys.ps_setup_enable_consumer('waits'); +mariadb> CALL sys.ps_setup_enable_consumer('waits'); +-----------------------+ | summary | +-----------------------+ @@ -4561,7 +4555,7 @@ Enables instruments within Performance Schema matching the input pattern. To enable all mutex instruments: ```SQL -mysql> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); +mariadb> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); +-------------------------+ | summary | +-------------------------+ @@ -4571,7 +4565,7 @@ mysql> CALL sys.ps_setup_enable_instrument('wait/synch/mutex'); ``` To enable just a specific TCP/IP based network IO instrument: ```SQL -mysql> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_socket'); +mariadb> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_socket'); +-----------------------+ | summary | +-----------------------+ @@ -4581,7 +4575,7 @@ mysql> CALL sys.ps_setup_enable_instrument('wait/io/socket/sql/server_tcpip_sock ``` To enable all instruments: ```SQL -mysql> CALL sys.ps_setup_enable_instrument(''); +mariadb> CALL sys.ps_setup_enable_instrument(''); +-------------------------+ | summary | +-------------------------+ @@ -4603,7 +4597,7 @@ Enable the given connection/thread in Performance Schema. ##### Example ```SQL -mysql> CALL sys.ps_setup_enable_thread(3); +mariadb> CALL sys.ps_setup_enable_thread(3); +------------------+ | summary | +------------------+ @@ -4613,7 +4607,7 @@ mysql> CALL sys.ps_setup_enable_thread(3); ``` To enable the current connection: ```SQL -mysql> CALL sys.ps_setup_enable_thread(CONNECTION_ID()); +mariadb> CALL sys.ps_setup_enable_thread(CONNECTION_ID()); +------------------+ | summary | +------------------+ @@ -4638,16 +4632,16 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_setup_save(); +mariadb> CALL sys.ps_setup_save(); Query OK, 0 rows affected (0.08 sec) -mysql> UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; +mariadb> UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; Query OK, 547 rows affected (0.40 sec) Rows matched: 784 Changed: 547 Warnings: 0 /* Run some tests that need more detailed instrumentation here */ -mysql> CALL sys.ps_setup_reload_saved(); +mariadb> CALL sys.ps_setup_reload_saved(); Query OK, 0 rows affected (0.32 sec) ``` @@ -4663,7 +4657,7 @@ Resets the Performance Schema setup to the default settings. ##### Example ```SQL -mysql> CALL sys.ps_setup_reset_to_default(true)\G +mariadb> CALL sys.ps_setup_reset_to_default(true)\G *************************** 1. row *************************** status: Resetting: setup_actors DELETE @@ -4678,7 +4672,7 @@ VALUES ('%', '%', '%') 1 row in set (0.00 sec) ... -mysql> CALL sys.ps_setup_reset_to_default(false)\G +mariadb> CALL sys.ps_setup_reset_to_default(false)\G Query OK, 0 rows affected (0.00 sec) ``` @@ -4702,17 +4696,17 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> CALL sys.ps_setup_save(-1); +mariadb> CALL sys.ps_setup_save(-1); Query OK, 0 rows affected (0.08 sec) -mysql> UPDATE performance_schema.setup_instruments +mariadb> UPDATE performance_schema.setup_instruments -> SET enabled = 'YES', timed = 'YES'; Query OK, 547 rows affected (0.40 sec) Rows matched: 784 Changed: 547 Warnings: 0 /* Run some tests that need more detailed instrumentation here */ -mysql> CALL sys.ps_setup_reload_saved(); +mariadb> CALL sys.ps_setup_reload_saved(); Query OK, 0 rows affected (0.32 sec) ``` @@ -4720,10 +4714,8 @@ Query OK, 0 rows affected (0.32 sec) ##### Description -Shows all currently disable Performance Schema configuration. +Shows all currently disabled Performance Schema configurations. -Disabled users is only available for MySQL 5.7.6 and later. -In earlier versions it was only possible to enable users. ##### Parameters @@ -4732,7 +4724,7 @@ In earlier versions it was only possible to enable users. ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled(TRUE, TRUE); +mariadb> CALL sys.ps_setup_show_disabled(TRUE, TRUE); +----------------------------+ | performance_schema_enabled | +----------------------------+ @@ -4815,7 +4807,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled_consumers(); +mariadb> CALL sys.ps_setup_show_disabled_consumers(); +---------------------------+ | disabled_consumers | @@ -4841,7 +4833,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_disabled_instruments(); +mariadb> CALL sys.ps_setup_show_disabled_instruments(); ``` #### ps_setup_show_enabled @@ -4857,7 +4849,7 @@ Shows all currently enabled Performance Schema configuration. ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled(TRUE, TRUE); +mariadb> CALL sys.ps_setup_show_enabled(TRUE, TRUE); +----------------------------+ | performance_schema_enabled | +----------------------------+ @@ -4949,7 +4941,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled_consumers(); +mariadb> CALL sys.ps_setup_show_enabled_consumers(); +---------------------------+ | enabled_consumers | @@ -4975,7 +4967,7 @@ None ##### Example ```SQL -mysql> CALL sys.ps_setup_show_enabled_instruments(); +mariadb> CALL sys.ps_setup_show_enabled_instruments(); ``` #### ps_statement_avg_latency_histogram @@ -4992,7 +4984,7 @@ None. ##### Example ```SQL -mysql> CALL sys.ps_statement_avg_latency_histogram()\G +mariadb> CALL sys.ps_statement_avg_latency_histogram()\G *************************** 1. row *************************** Performance Schema Statement Digest Average Latency Histogram: @@ -5050,7 +5042,7 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> call ps_analyze_statement_digest('891ec6860f98ba46d89dd20b0c03652c', 10, 0.1, true, true); +mariadb> call ps_analyze_statement_digest('891ec6860f98ba46d89dd20b0c03652c', 10, 0.1, true, true); +--------------------+ | SUMMARY STATISTICS | +--------------------+ @@ -5145,7 +5137,7 @@ Requires the SUPER privilege for "SET sql_log_bin = 0;". ##### Example ```SQL -mysql> CALL sys.ps_trace_thread(25, CONCAT('/tmp/stack-', REPLACE(NOW(), ' ', '-'), '.dot'), NULL, NULL, TRUE, TRUE, TRUE); +mariadb> CALL sys.ps_trace_thread(25, CONCAT('/tmp/stack-', REPLACE(NOW(), ' ', '-'), '.dot'), NULL, NULL, TRUE, TRUE, TRUE); +-------------------+ | summary | +-------------------+ @@ -5201,7 +5193,7 @@ Truncates all summary tables within Performance Schema, resetting all aggregated ##### Example ```SQL -mysql> CALL sys.ps_truncate_all_tables(false); +mariadb> CALL sys.ps_truncate_all_tables(false); +---------------------+ | summary | +---------------------+ @@ -5306,22 +5298,22 @@ The following configuration options are supported: -- 6. Perform analyzis based on the new snapshot. -- 7. Perform analyzis based on the delta between the initial and new snapshots. -mysql> CALL sys.statement_performance_analyzer('create_tmp', 'mydb.tmp_digests_ini', NULL); +mariadb> CALL sys.statement_performance_analyzer('create_tmp', 'mydb.tmp_digests_ini', NULL); Query OK, 0 rows affected (0.08 sec) -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.02 sec) -mysql> CALL sys.statement_performance_analyzer('save', 'mydb.tmp_digests_ini', NULL); +mariadb> CALL sys.statement_performance_analyzer('save', 'mydb.tmp_digests_ini', NULL); Query OK, 0 rows affected (0.00 sec) -mysql> DO SLEEP(60); +mariadb> DO SLEEP(60); Query OK, 0 rows affected (1 min 0.00 sec) -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.02 sec) -mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +mariadb> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5331,7 +5323,7 @@ mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_i ... -mysql> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +mariadb> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', 'with_runtimes_in_95th_percentile'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5344,13 +5336,13 @@ mysql> CALL sys.statement_performance_analyzer('delta', 'mydb.tmp_digests_ini', -- To create an overall report of the 95th percentile queries and the top 10 queries with full table scans: -mysql> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); +mariadb> CALL sys.statement_performance_analyzer('snapshot', NULL, NULL); Query OK, 0 rows affected (0.01 sec) -mysql> SET @sys.statement_performance_analyzer.limit = 10; +mariadb> SET @sys.statement_performance_analyzer.limit = 10; Query OK, 0 rows affected (0.00 sec) -mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile,with_full_table_scans'); +mariadb> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_in_95th_percentile,with_full_table_scans'); +-----------------------------------------+ | Next Output | +-----------------------------------------+ @@ -5373,7 +5365,7 @@ mysql> CALL sys.statement_performance_analyzer('overall', NULL, 'with_runtimes_i -- Use a custom view showing the top 10 query sorted by total execution time refreshing the view every minute using -- the watch command in Linux. -mysql> CREATE OR REPLACE VIEW mydb.my_statements AS +mariadb> CREATE OR REPLACE VIEW mydb.my_statements AS -> SELECT sys.format_statement(DIGEST_TEXT) AS query, -> SCHEMA_NAME AS db, -> COUNT_STAR AS exec_count, @@ -5387,10 +5379,10 @@ mysql> CREATE OR REPLACE VIEW mydb.my_statements AS -> ORDER BY SUM_TIMER_WAIT DESC; Query OK, 0 rows affected (0.01 sec) -mysql> CALL sys.statement_performance_analyzer('create_table', 'mydb.digests_prev', NULL); +mariadb> CALL sys.statement_performance_analyzer('create_table', 'mydb.digests_prev', NULL); Query OK, 0 rows affected (0.10 sec) -shell$ watch -n 60 "mysql sys --table -e \" +shell$ watch -n 60 "mariadb sys --table -e \" > SET @sys.statement_performance_analyzer.view = 'mydb.my_statements'; > SET @sys.statement_performance_analyzer.limit = 10; > CALL statement_performance_analyzer('snapshot', NULL, NULL); @@ -5398,7 +5390,7 @@ shell$ watch -n 60 "mysql sys --table -e \" > CALL statement_performance_analyzer('save', 'mydb.digests_prev', NULL); > \"" -Every 60.0s: mysql sys --table -e " ... Mon Dec 22 10:58:51 2014 +Every 60.0s: mariadb sys --table -e " ... Mon Dec 22 10:58:51 2014 +----------------------------------+ | Next Output | @@ -5433,24 +5425,24 @@ name, then 'TEMPORARY' will be returned. ##### Example ```SQL -mysql> CREATE DATABASE db1; +mariadb> CREATE DATABASE db1; Query OK, 1 row affected (0.07 sec) -mysql> use db1; +mariadb> use db1; Database changed -mysql> CREATE TABLE t1 (id INT PRIMARY KEY); +mariadb> CREATE TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.08 sec) -mysql> CREATE TABLE t2 (id INT PRIMARY KEY); +mariadb> CREATE TABLE t2 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.08 sec) -mysql> CREATE view v_t1 AS SELECT * FROM t1; +mariadb> CREATE view v_t1 AS SELECT * FROM t1; Query OK, 0 rows affected (0.00 sec) -mysql> CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); +mariadb> CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.00 sec) -mysql> CALL sys.table_exists('db1', 't1', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't1', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +------------+ @@ -5460,7 +5452,7 @@ Query OK, 0 rows affected (0.00 sec) +------------+ 1 row in set (0.00 sec) -mysql> CALL sys.table_exists('db1', 't2', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't2', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +------------+ @@ -5470,7 +5462,7 @@ Query OK, 0 rows affected (0.00 sec) +------------+ 1 row in set (0.01 sec) -mysql> CALL sys.table_exists('db1', 'v_t1', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 'v_t1', @exists); SELECT @exists; Query OK, 0 rows affected (0.00 sec) +---------+ @@ -5480,7 +5472,7 @@ Query OK, 0 rows affected (0.00 sec) +---------+ 1 row in set (0.00 sec) -mysql> CALL sys.table_exists('db1', 't3', @exists); SELECT @exists; +mariadb> CALL sys.table_exists('db1', 't3', @exists); SELECT @exists; Query OK, 0 rows affected (0.01 sec) +---------+ diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index 6f8c658135a..6f72064abd5 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2021 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2010-2014 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -19,52 +19,30 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for rsync-based state snapshot transfer - -RSYNC_REAL_PID=0 # rsync process id -STUNNEL_REAL_PID=0 # stunnel process id - -OS="$(uname)" -[ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH - -# Setting the path for lsof on CentOS -export PATH="/usr/sbin:/sbin:$PATH" +# This is a reference script for backup recovery state snapshot transfer. . $(dirname "$0")/wsrep_sst_common -MAGIC_FILE="$WSREP_SST_OPT_DATA/backup_sst_complete" -rm -rf "$MAGIC_FILE" +MAGIC_FILE="$DATA/backup_sst_complete" -WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} -# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mysqld innodb-log-group-home-dir '') -fi +wait_previous_sst -if [ -n "$WSREP_LOG_DIR" ]; then - # handle both relative and absolute paths - WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; mkdir -p "$WSREP_LOG_DIR"; cd $WSREP_LOG_DIR; pwd -P) -else - # default to datadir - WSREP_LOG_DIR=$(cd $WSREP_SST_OPT_DATA; pwd -P) -fi +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" if [ "$WSREP_SST_OPT_ROLE" = 'donor' ] then - [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" - RC=0 if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then - FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" - ERROR="$WSREP_SST_OPT_DATA/sst_error" + FLUSHED="$DATA/tables_flushed" + ERROR="$DATA/sst_error" [ -f "$FLUSHED" ] && rm -f "$FLUSHED" [ -f "$ERROR" ] && rm -f "$ERROR" - echo "flush tables" + echo 'flush tables' # Wait for : # (a) Tables to be flushed, AND @@ -77,19 +55,23 @@ then # Check whether ERROR file exists. if [ -f "$ERROR" ]; then # Flush tables operation failed. - rm -f "$ERROR" + rm "$ERROR" exit 255 fi sleep 0.2 done STATE=$(cat "$FLUSHED") - rm -f "$FLUSHED" - + rm "$FLUSHED" else # BYPASS wsrep_log_info "Bypassing state dump." + + # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id + # (separated by a space). + STATE="$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" + fi echo 'continue' # now server can resume updating data diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 6091669642b..95fc560609a 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2012-2015 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -15,13 +15,19 @@ # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a common command line parser to be sourced by other SST scripts +# This is a common command line parser and common functions to +# be sourced by other SST scripts. trap 'exit 32' HUP PIPE trap 'exit 3' INT QUIT TERM -# Setting the path for some utilities on CentOS -export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin" +OS="$(uname)" + +# Setting the paths for some utilities on CentOS +export PATH="${PATH:+$PATH:}/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" +if [ "$OS" != 'Darwin' ]; then + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/local/lib:/usr/lib:/lib:/opt/lib" +fi commandex() { @@ -34,11 +40,45 @@ commandex() fi } +with_bash_42=0 with_printf=1 if [ -z "$BASH_VERSION" ]; then [ -z "$(commandex printf)" ] && with_printf=0 +else + [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 -o \ + "${BASH_VERSINFO[0]}" -gt 4 ] && with_bash_42=1 fi +wsrep_log() +{ + local t + # echo everything to stderr so that it gets into common error log + # deliberately made to look different from the rest of the log + if [ "$OS" = 'Linux' ]; then + t=$(date '+%Y%m%d %H:%M:%S.%3N') + elif [ $with_bash_42 -ne 0 ]; then + printf -v t '%(%Y%m%d %H:%M:%S)T.000' + else + t=$(date '+%Y%m%d %H:%M:%S.000') + fi + echo "WSREP_SST: $* ($t)" >&2 +} + +wsrep_log_error() +{ + wsrep_log "[ERROR] $*" +} + +wsrep_log_warning() +{ + wsrep_log "[WARNING] $*" +} + +wsrep_log_info() +{ + wsrep_log "[INFO] $*" +} + trim_string() { if [ -n "$BASH_VERSION" ]; then @@ -825,42 +865,6 @@ readonly WSREP_SST_OPT_ADDR_PORT script_binary=$(dirname "$0") SCRIPTS_DIR=$(cd "$script_binary"; pwd) EXTRA_DIR="$SCRIPTS_DIR/../extra" -CLIENT_DIR="$SCRIPTS_DIR/../client" - -if [ -x "$CLIENT_DIR/mariadb" ]; then - MYSQL_CLIENT="$CLIENT_DIR/mariadb" -else - MYSQL_CLIENT=$(commandex 'mariadb') -fi - -if [ -x "$CLIENT_DIR/mariadb-dump" ]; then - MYSQLDUMP="$CLIENT_DIR/mariadb-dump" -else - MYSQLDUMP=$(commandex 'mariadb-dump') -fi - -wsrep_log() -{ - # echo everything to stderr so that it gets into common error log - # deliberately made to look different from the rest of the log - local readonly tst=$(date "+%Y%m%d %H:%M:%S.%N" | cut -b -21) - echo "WSREP_SST: $* ($tst)" >&2 -} - -wsrep_log_error() -{ - wsrep_log "[ERROR] $*" -} - -wsrep_log_warning() -{ - wsrep_log "[WARNING] $*" -} - -wsrep_log_info() -{ - wsrep_log "[INFO] $*" -} if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults" @@ -1122,7 +1126,7 @@ wsrep_check_program() local prog="$1" local cmd=$(commandex "$prog") if [ -z "$cmd" ]; then - echo "'$prog' not found in PATH" + wsrep_log_error "'$prog' not found in path" return 2 # no such file or directory fi } @@ -1241,22 +1245,56 @@ is_local_ip() check_sockets_utils() { + # The presence of any of these utilities is enough for us: lsof_available=0 sockstat_available=0 ss_available=0 - [ -n "$(commandex lsof)" ] && lsof_available=1 - [ -n "$(commandex sockstat)" ] && sockstat_available=1 - [ -n "$(commandex ss)" ] && ss_available=1 - - if [ $lsof_available -eq 0 -a \ - $sockstat_available -eq 0 -a \ - $ss_available -eq 0 ] - then - wsrep_log_error "Neither lsof, nor sockstat or ss tool was found in" \ - "the PATH. Make sure you have it installed." - exit 2 # ENOENT + socket_utility="$(commandex ss)" + if [ -n "$socket_utility" ]; then + socket_uname='ss' + ss_available=1 + ss_opts='-nlp' + # Let's check that ss has an option to skip headers: + if $socket_utility -h 2>&1 | grep -qw -F -- '-H'; then + ss_available=2 + ss_opts="${ss_opts}H" + fi + else + socket_utility="$(commandex sockstat)" + if [ -n "$socket_utility" ]; then + socket_uname='sockstat' + sockstat_available=1 + sockstat_opts='-p' + if [ "$OS" = 'FreeBSD' ]; then + # sockstat in FreeBSD is different from other systems, + # let's denote it with a different value: + sockstat_available=2 + sockstat_opts='-46lq -P tcp -p' + fi + else + socket_utility="$(commandex lsof)" + if [ -n "$socket_utility" ]; then + socket_uname='lsof' + lsof_available=1 + lsof_opts='-Pnl' + # Let's check that lsof has an option to bypass blocking: + if $socket_utility -h 2>&1 | grep -qw -F -- '-b'; then + lsof_available=2 + lsof_opts="$lsof_opts -b -w" + else + lsof_opts="$lsof_opts -S 10" + fi + else + wsrep_log_error "Neither lsof, nor sockstat, nor ss tool" \ + "were found in the path. Make sure you have" \ + "at least one of them installed." + exit 2 # ENOENT + fi + fi fi + wsrep_log_info "'$socket_uname' is selected as a socket" \ + "information utility." } # @@ -1277,23 +1315,33 @@ check_port() [ $pid -le 0 ] && pid='[0-9]+' - local rc=1 + local rc=2 # ENOENT - if [ $lsof_available -ne 0 ]; then - lsof -Pnl -i ":$port" 2>/dev/null | \ - grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*\\(LISTEN\\)" && rc=0 + if [ $ss_available -ne 0 ]; then + $socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ + grep -q -E "[[:space:]]users:[[:space:]]?\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 elif [ $sockstat_available -ne 0 ]; then - local opts='-p' - if [ "$OS" = 'FreeBSD' ]; then - # sockstat on FreeBSD requires the "-s" option - # to display the connection state: - opts='-sp' + if [ $sockstat_available -gt 1 ]; then + # The sockstat command on FreeBSD does not return + # the connection state without special option, but + # it supports filtering by connection state: + local out + out=$($socket_utility $sockstat_opts "$port" 2>/dev/null) || rc=16 # EBUSY + # On FreeBSD, the sockstat utility may exit without + # any output due to locking issues in certain versions; + # let's return a special exit code in such cases: + if [ $rc -eq 16 -o -z "$out" ]; then + return 16 # EBUSY + fi + echo "$out" | \ + grep -q -E "^[^[:space:]]+[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]]|\$)" && rc=0 + else + $socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -q -E "^[^[:space:]]+[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]].+)?[[:space:]]LISTEN([[:space:]]|\$)" && rc=0 fi - sockstat "$opts" "$port" 2>/dev/null | \ - grep -q -E "[[:space:]]+($utils)[^[:space:]]*[[:space:]]+$pid[[:space:]].*[[:space:]]LISTEN" && rc=0 - elif [ $ss_available -ne 0 ]; then - ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -q -E "users:\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 + elif [ $lsof_available -ne 0 ]; then + $socket_utility $lsof_opts -i ":$port" 2>/dev/null | \ + grep -q -E "^($utils)[^[:space:]]*[[:space:]]+$pid([[:space:]].+)?[[:space:]]\\(LISTEN\\)([[:space:]]|\$)" && rc=0 else wsrep_log_error "Unknown sockets utility" exit 2 # ENOENT @@ -1564,7 +1612,7 @@ get_proc() if [ -z "$nproc" ]; then set +e if [ "$OS" = 'Linux' ]; then - nproc=$(grep -cw -E '^processor' /proc/cpuinfo 2>/dev/null) + nproc=$(grep -cw -E '^processor' /proc/cpuinfo 2>/dev/null || :) elif [ "$OS" = 'Darwin' -o "$OS" = 'FreeBSD' ]; then nproc=$(sysctl -n hw.ncpu) fi @@ -1754,11 +1802,129 @@ simple_cleanup() if [ $estatus -ne 0 ]; then wsrep_log_error "Cleanup after exit with status: $estatus" fi - if [ -n "${SST_PID:-}" ]; then + if [ -n "$SST_PID" ]; then [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" [ -f "$SST_PID" ] && rm -f "$SST_PID" || : fi exit $estatus } +create_data() +{ + OLD_PWD="$(pwd)" + + if [ -n "$DATA" -a "$DATA" != '.' ]; then + [ ! -d "$DATA" ] && mkdir -p "$DATA" + cd "$DATA" + fi + DATA_DIR="$(pwd)" + + cd "$OLD_PWD" +} + +create_dirs() +{ + local simplify=${1:-0} + + # if no command line argument and INNODB_DATA_HOME_DIR environment + # variable is not set, try to get it from the my.cnf: + if [ -z "$INNODB_DATA_HOME_DIR" ]; then + INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') + INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") + fi + + if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ + "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" + cd "$INNODB_DATA_HOME_DIR" + ib_home_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir="" + fi + + # if no command line argument and INNODB_LOG_GROUP_HOME is not set, + # then try to get it from the my.cnf: + if [ -z "$INNODB_LOG_GROUP_HOME" ]; then + INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') + INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") + fi + + if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ + "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" + cd "$INNODB_LOG_GROUP_HOME" + ib_log_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir="" + fi + + # if no command line argument and INNODB_UNDO_DIR is not set, + # then try to get it from the my.cnf: + if [ -z "$INNODB_UNDO_DIR" ]; then + INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') + INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") + fi + + if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ + "$INNODB_UNDO_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" + cd "$INNODB_UNDO_DIR" + ib_undo_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir="" + fi + + # if no command line argument then try to get it from the my.cnf: + if [ -z "$ARIA_LOG_DIR" ]; then + ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') + ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") + fi + + if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ + "$ARIA_LOG_DIR" != "$DATA_DIR" ] + then + # handle both relative and absolute paths: + cd "$DATA" + [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" + cd "$ARIA_LOG_DIR" + ar_log_dir="$(pwd)" + cd "$OLD_PWD" + [ $simplify -ne 0 -a "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" + fi +} + +wait_previous_sst() +{ + # give some time for previous SST to complete: + check_round=0 + while check_pid "$SST_PID" 1; do + wsrep_log_info "Previous SST is not completed, waiting for it to exit" + check_round=$(( check_round+1 )) + if [ $check_round -eq 30 ]; then + wsrep_log_error "previous SST script still running..." + exit 114 # EALREADY + fi + sleep 1 + done + + trap simple_cleanup EXIT + echo $$ > "$SST_PID" +} + +DATA="$WSREP_SST_OPT_DATA" + +wsrep_check_datadir +create_data + +SST_PID="$DATA/wsrep_sst.pid" + wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE started on $WSREP_SST_OPT_ROLE" diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index f66a13f17ca..73bcee75362 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2013 Percona Inc # # This program is free software; you can redistribute it and/or modify @@ -19,14 +19,28 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. +# This is a reference script for mariadb-backup-based state snapshot transfer. + # Documentation: # https://mariadb.com/kb/en/mariabackup-overview/ # Make sure to read that before proceeding! -OS="$(uname)" - . $(dirname "$0")/wsrep_sst_common -wsrep_check_datadir + +BACKUP_BIN=$(commandex 'mariadb-backup') +if [ -z "$BACKUP_BIN" ]; then + wsrep_log_error 'mariadb-backup binary not found in path' + exit 42 +fi + +BACKUP_PID="" + +INFO_FILE='mariadb_backup_galera_info' +DONOR_INFO_FILE='donor_galera_info' +IST_FILE='xtrabackup_ist' + +MAGIC_FILE="$DATA/$INFO_FILE" +DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" ealgo="" eformat="" @@ -35,7 +49,6 @@ ekeyfile="" encrypt=0 ssyslog="" ssystag="" -BACKUP_PID="" tcert="" tcap="" tpem="" @@ -64,10 +77,10 @@ tcmd="" payload=0 pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p'" pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE" -STATDIR="" uextra=0 disver="" +STATDIR="" tmpopts="" itmpdir="" xtmpdir="" @@ -93,22 +106,6 @@ readonly TOTAL_TAG='total' # For backup locks it is 1 sent by joiner sst_ver=1 -declare -a RC - -BACKUP_BIN=$(commandex 'mariadb-backup') -if [ -z "$BACKUP_BIN" ]; then - wsrep_log_error 'mariadb-backup binary not found in path' - exit 42 -fi - -DATA="$WSREP_SST_OPT_DATA" - -INFO_FILE='mariadb_backup_galera_info' -DONOR_INFO_FILE='donor_galera_info' -IST_FILE='xtrabackup_ist' -MAGIC_FILE="$DATA/$INFO_FILE" -DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" - INNOAPPLYLOG="$DATA/mariabackup.prepare.log" INNOMOVELOG="$DATA/mariabackup.move.log" INNOBACKUPLOG="$DATA/mariabackup.backup.log" @@ -686,16 +683,16 @@ cleanup_at_exit() fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then + if [ -n "$BACKUP_PID" ]; then + if ps -p $BACKUP_PID >/dev/null 2>&1; then + wsrep_log_error \ + "mariadb-backup process is still running. Killing..." + cleanup_pid $CHECK_PID + fi + fi wsrep_log_info "Removing the sst_in_progress file" wsrep_cleanup_progress_file else - if [ -n "$BACKUP_PID" ]; then - if check_pid "$BACKUP_PID" 1; then - wsrep_log_error \ - "mariadb-backup process is still running. Killing..." - cleanup_pid $CHECK_PID "$BACKUP_PID" - fi - fi [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi @@ -714,7 +711,7 @@ cleanup_at_exit() fi # Final cleanup - pgid=$(ps -o 'pgid=' $$ 2>/dev/null | grep -o -E '[0-9]+' || :) + local pgid=$(ps -o 'pgid=' $$ 2>/dev/null | grep -o -E '[0-9]+' || :) # This means no setsid done in mysqld. # We don't want to kill mysqld here otherwise. @@ -728,7 +725,7 @@ cleanup_at_exit() fi fi - if [ -n "${SST_PID:-}" ]; then + if [ -n "$SST_PID" ]; then [ -f "$SST_PID" ] && rm -f "$SST_PID" || : fi @@ -752,7 +749,7 @@ setup_ports() wait_for_listen() { for i in {1..150}; do - if check_port "" "$SST_PORT" 'socat|nc'; then + if check_port "" "$SST_PORT" 'socat|nc|netcat'; then break fi sleep 0.2 @@ -846,7 +843,13 @@ recv_joiner() done if [ $checkf -eq 1 ]; then - if [ ! -r "$MAGIC_FILE" ]; then + if [ -r "$MAGIC_FILE" ]; then + : + elif [ -r "$dir/xtrabackup_galera_info" ]; then + mv "$dir/xtrabackup_galera_info" "$MAGIC_FILE" + wsrep_log_info "the SST donor uses an old version" \ + "of mariabackup or xtrabackup" + else # this message should cause joiner to abort: wsrep_log_error "receiving process ended without creating" \ "magic file ($MAGIC_FILE)" @@ -905,23 +908,20 @@ monitor_process() local sst_stream_pid=$1 while :; do - if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then + if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then wsrep_log_error \ "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ "terminated unexpectedly." - kill -- -"$WSREP_SST_OPT_PARENT" + kill -- -$WSREP_SST_OPT_PARENT exit 32 fi - if ! ps -p "$sst_stream_pid" >/dev/null 2>&1; then + if ! ps -p $sst_stream_pid >/dev/null 2>&1; then break fi sleep 0.1 done } -[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" -[ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE" - read_cnf setup_ports @@ -937,15 +937,17 @@ if "$BACKUP_BIN" --help 2>/dev/null | grep -qw -F -- '--version-check'; then disver=' --no-version-check' fi -OLD_PWD="$(pwd)" +get_stream +get_transfer -if [ -n "$DATA" -a "$DATA" != '.' ]; then - [ ! -d "$DATA" ] && mkdir -p "$DATA" - cd "$DATA" -fi -DATA_DIR="$(pwd)" +findopt='-L' +[ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" -cd "$OLD_PWD" +wait_previous_sst + +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" +[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" +[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" if [ $ssyslog -eq 1 ]; then if [ -n "$(commandex logger)" ]; then @@ -1065,12 +1067,6 @@ send_magic() fi } -get_stream -get_transfer - -findopt='-L' -[ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" - if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then trap cleanup_at_exit EXIT @@ -1198,9 +1194,6 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then exit 22 fi - # mariadb-backup implicitly writes PID to fixed location in $xtmpdir - BACKUP_PID="$xtmpdir/xtrabackup_pid" - else # BYPASS FOR IST wsrep_log_info "Bypassing the SST for IST" @@ -1230,116 +1223,19 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then else # joiner + create_dirs 1 + [ -e "$SST_PROGRESS_FILE" ] && \ wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" [ -n "$SST_PROGRESS_FILE" ] && touch "$SST_PROGRESS_FILE" - # if no command line argument and INNODB_DATA_HOME_DIR environment - # variable is not set, try to get it from the my.cnf: - if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') - INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") - fi - - if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ - "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" - cd "$INNODB_DATA_HOME_DIR" - ib_home_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir="" - fi - - # if no command line argument and INNODB_LOG_GROUP_HOME is not set, - # then try to get it from the my.cnf: - if [ -z "$INNODB_LOG_GROUP_HOME" ]; then - INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') - INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") - fi - - if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ - "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" - cd "$INNODB_LOG_GROUP_HOME" - ib_log_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir="" - fi - - # if no command line argument and INNODB_UNDO_DIR is not set, - # then try to get it from the my.cnf: - if [ -z "$INNODB_UNDO_DIR" ]; then - INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') - INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") - fi - - if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ - "$INNODB_UNDO_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" - cd "$INNODB_UNDO_DIR" - ib_undo_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir="" - fi - - # if no command line argument then try to get it from the my.cnf: - if [ -z "$ARIA_LOG_DIR" ]; then - ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') - ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") - fi - - if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ - "$ARIA_LOG_DIR" != "$DATA_DIR" ] - then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" - cd "$ARIA_LOG_DIR" - ar_log_dir="$(pwd)" - cd "$OLD_PWD" - [ "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" - fi - if [ -n "$backup_threads" ]; then impts="--parallel=$backup_threads${impts:+ }$impts" fi - SST_PID="$DATA/wsrep_sst.pid" - - # give some time for previous SST to complete: - check_round=0 - while check_pid "$SST_PID" 0; do - wsrep_log_info "previous SST is not completed, waiting for it to exit" - check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "previous SST script still running." - exit 114 # EALREADY - fi - sleep 1 - done - - trap simple_cleanup EXIT - echo $$ > "$SST_PID" - stagemsg='Joiner-Recv' MODULE="${WSREP_SST_OPT_MODULE:-xtrabackup_sst}" - - [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" - - # May need mariadb_backup_checkpoints later on - [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" - [ -f "$DATA/mariadb_backup_galera_info" ] && rm -f "$DATA/mariadb_backup_galera_info" - ADDR="$WSREP_SST_OPT_HOST" if [ "${tmode#VERIFY}" != "$tmode" ]; then @@ -1370,6 +1266,7 @@ else # joiner STATDIR="$(mktemp -d)" MAGIC_FILE="$STATDIR/$INFO_FILE" + DONOR_MAGIC_FILE="$STATDIR/$DONOR_INFO_FILE" recv_joiner "$STATDIR" "$stagemsg-gtid" $stimeout 1 1 @@ -1400,7 +1297,7 @@ else # joiner fi mkdir -p "$DATA/.sst" (recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) & - jpid=$! + BACKUP_PID=$! wsrep_log_info "Proceeding with SST" get_binlog @@ -1443,12 +1340,67 @@ else # joiner "$DATA" -mindepth 1 -prune -regex "$cpat" \ -o -exec rm -rf {} >&2 \+ + # Deleting legacy files from old versions: + [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" + [ -f "$DATA/xtrabackup_pid" ] && rm -f "$DATA/xtrabackup_pid" + [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" + [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" + [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" + [ -f "$DATA/xtrabackup_binlog_info" ] && rm -f "$DATA/xtrabackup_binlog_info" + [ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb" + + # Deleting files from previous SST: + [ -f "$DATA/mariadb_backup_checkpoints" ] && rm -f "$DATA/mariadb_backup_checkpoints" + [ -f "$DATA/mariadb_backup_info" ] && rm -f "$DATA/mariadb_backup_info" + [ -f "$DATA/mariadb_backup_slave_info" ] && rm -f "$DATA/mariadb_backup_slave_info" + [ -f "$DATA/mariadb_backup_binlog_info" ] && rm -f "$DATA/mariadb_backup_binlog_info" + [ -f "$DATA/mariadb_backup_binlog_pos_innodb" ] && rm -f "$DATA/mariadb_backup_binlog_pos_innodb" + TDATA="$DATA" DATA="$DATA/.sst" MAGIC_FILE="$DATA/$INFO_FILE" wsrep_log_info "Waiting for SST streaming to complete!" - monitor_process $jpid + monitor_process $BACKUP_PID + BACKUP_PID="" + + # It is possible that the old version of the galera + # information file will be transferred second time: + if [ ! -f "$DATA/$INFO_FILE" -a \ + -f "$DATA/xtrabackup_galera_info" ] + then + mv "$DATA/xtrabackup_galera_info" "$DATA/$INFO_FILE" + fi + + # Correcting the name of the common information file + # if the donor has an old version: + if [ ! -f "$DATA/mariadb_backup_info" -a \ + -f "$DATA/xtrabackup_info" ] + then + mv "$DATA/xtrabackup_info" "$DATA/mariadb_backup_info" + wsrep_log_info "general information file with a legacy" \ + "name has been renamed" + fi + + # Correcting the name for the file with the binlog position + # for the master if the donor has an old version: + if [ ! -f "$DATA/mariadb_backup_slave_info" -a \ + -f "$DATA/xtrabackup_slave_info" ] + then + mv "$DATA/xtrabackup_slave_info" "$DATA/mariadb_backup_slave_info" + wsrep_log_info "binlog position file with a legacy" \ + "name has been renamed" + fi + + # An old version of the donor may send a checkpoints + # list file under an outdated name: + if [ ! -f "$DATA/mariadb_backup_checkpoints" -a \ + -f "$DATA/xtrabackup_checkpoints" ] + then + mv "$DATA/xtrabackup_checkpoints" "$DATA/mariadb_backup_checkpoints" + wsrep_log_info "list of checkpoints with a legacy" \ + "name has been renamed" + fi if [ ! -s "$DATA/mariadb_backup_checkpoints" ]; then wsrep_log_error "mariadb_backup_checkpoints missing," \ @@ -1509,6 +1461,16 @@ else # joiner fi fi + # An old version of the donor may send a binary logs + # list file under an outdated name: + if [ ! -f "$DATA/mariadb_backup_binlog_info" -a \ + -f "$DATA/xtrabackup_binlog_info" ] + then + mv "$DATA/xtrabackup_binlog_info" "$DATA/mariadb_backup_binlog_info" + wsrep_log_info "list of binary logs with a legacy" \ + "name has been renamed" + fi + wsrep_log_info "Preparing the backup at $DATA" setup_commands timeit 'mariadb-backup prepare stage' "$INNOAPPLY" @@ -1556,6 +1518,7 @@ else # joiner fi MAGIC_FILE="$TDATA/$INFO_FILE" + DONOR_MAGIC_FILE="$TDATA/$DONOR_INFO_FILE" wsrep_log_info "Moving the backup to $TDATA" timeit 'mariadb-backup move stage' "$INNOMOVE" @@ -1580,7 +1543,8 @@ else # joiner fi if [ ! -r "$MAGIC_FILE" ]; then - wsrep_log_error "SST magic file '$MAGIC_FILE' not found/readable" + wsrep_log_error "Internal error: SST magic file '$MAGIC_FILE'" \ + "not found or not readable" exit 2 fi diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 97a05c8c33f..43c26aef1d5 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -3,7 +3,7 @@ set -ue # Copyright (C) 2009-2015 Codership Oy -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 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 @@ -19,10 +19,26 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for mysqldump-based state snapshot tansfer +# This is a reference script for mariadb-dump-based state snapshot tansfer. . $(dirname "$0")/wsrep_sst_common +CLIENT_DIR="$SCRIPTS_DIR/../client" + +if [ -x "$CLIENT_DIR/mariadb" ]; then + MYSQL_CLIENT="$CLIENT_DIR/mariadb" +else + MYSQL_CLIENT=$(commandex 'mariadb') +fi + +if [ -x "$CLIENT_DIR/mariadb-dump" ]; then + MYSQLDUMP="$CLIENT_DIR/mariadb-dump" +else + MYSQLDUMP=$(commandex 'mariadb-dump') +fi + +wait_previous_sst + EINVAL=22 if test -z "$WSREP_SST_OPT_HOST"; then wsrep_log_error "HOST cannot be nil"; exit $EINVAL; fi @@ -35,7 +51,8 @@ if is_local_ip "$WSREP_SST_OPT_HOST_UNESCAPED" && \ [ "$WSREP_SST_OPT_PORT" = "$WSREP_SST_OPT_LPORT" ] then wsrep_log_error \ - "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT' matches source address." + "destination address '$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT'" \ + "matches source address." exit $EINVAL fi diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 7639f0bbda8..b8f4c1bc62e 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -2,7 +2,7 @@ set -ue -# Copyright (C) 2017-2022 MariaDB +# Copyright (C) 2017-2024 MariaDB # Copyright (C) 2010-2022 Codership Oy # # This program is free software; you can redistribute it and/or modify @@ -19,18 +19,24 @@ set -ue # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # MA 02110-1335 USA. -# This is a reference script for rsync-based state snapshot transfer +# This is a reference script for rsync-based state snapshot transfer. + +. $(dirname "$0")/wsrep_sst_common + +wsrep_check_programs rsync RSYNC_REAL_PID=0 # rsync process id STUNNEL_REAL_PID=0 # stunnel process id -OS="$(uname)" -[ "$OS" = 'Darwin' ] && export -n LD_LIBRARY_PATH +MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}" -. $(dirname "$0")/wsrep_sst_common -wsrep_check_datadir +RSYNC_PID="$DATA/$MODULE.pid" +RSYNC_CONF="$DATA/$MODULE.conf" -wsrep_check_programs rsync +STUNNEL_CONF="$DATA/stunnel.conf" +STUNNEL_PID="$DATA/stunnel.pid" + +MAGIC_FILE="$DATA/rsync_sst_complete" cleanup_joiner() { @@ -95,50 +101,62 @@ check_pid_and_port() local utils='rsync|stunnel' - if ! check_port $pid "$port" "$utils"; then - local port_info - local busy=0 + local port_info + local final - if [ $lsof_available -ne 0 ]; then - port_info=$(lsof -Pnl -i ":$port" 2>/dev/null | grep -F '(LISTEN)') - echo "$port_info" | \ - grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port[[:space:]]" && busy=1 - else - local filter='([^[:space:]]+[[:space:]]+){4}[^[:space:]]+' - if [ $sockstat_available -ne 0 ]; then - local opts='-p' - if [ "$OS" = 'FreeBSD' ]; then - # sockstat on FreeBSD requires the "-s" option - # to display the connection state: - opts='-sp' - # in addition, sockstat produces an additional column: - filter='([^[:space:]]+[[:space:]]+){5}[^[:space:]]+' - fi - port_info=$(sockstat "$opts" "$port" 2>/dev/null | \ - grep -E '[[:space:]]LISTEN' | grep -o -E "$filter") + if ! check_port $pid "$port" "$utils"; then + if [ $ss_available -ne 0 -o $sockstat_available -ne 0 ]; then + if [ $ss_available -ne 0 ]; then + port_info=$($socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ + grep -E '[[:space:]]users:[[:space:]]?(' | \ + grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+" || :) else - port_info=$(ss -nlpH "( sport = :$port )" 2>/dev/null | \ - grep -F 'users:(' | grep -o -E "$filter") + if [ $sockstat_available -gt 1 ]; then + # The sockstat command on FreeBSD does not return + # the connection state without special option, but + # it supports filtering by connection state. + # Additionally, the sockstat utility on FreeBSD + # produces an one extra column: + port_info=$($socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -o -E "([^[:space:]]+[[:space:]]+){5}[^[:space:]]+" || :) + else + port_info=$($socket_utility $sockstat_opts "$port" 2>/dev/null | \ + grep -E '[[:space:]]LISTEN([[:space:]]|$)' | \ + grep -o -E "([^[:space:]]+[[:space:]]+){4}[^[:space:]]+" || :) + fi fi - echo "$port_info" | \ - grep -q -E "[[:space:]]\\[?(\\*|[[:xdigit:]]*(:[[:xdigit:]]*)+)(\\](%[^:]+)?)?:$port\$" && busy=1 + final='$' + else + port_info=$($socket_utility $lsof_opts -i ":$port" 2>/dev/null | \ + grep -w -F '(LISTEN)' || :) + final='[[:space:]]' + fi + + local busy=0 + if [ -n "$port_info" ]; then + local address='(\*|[0-9a-fA-F]*(:[0-9a-fA-F]*){1,7}|[0-9]+(\.[0-9]+){3})' + local filter="[[:space:]]($address|\\[$address\\])(%[^:]+)?:$port$final" + echo "$port_info" | grep -q -E "$filter" && busy=1 fi if [ $busy -eq 0 ]; then - if ! echo "$port_info" | grep -qw -F "[$addr]:$port" && \ - ! echo "$port_info" | grep -qw -F -- "$addr:$port" - then - if ! ps -p $pid >/dev/null 2>&1; then - wsrep_log_error \ - "rsync or stunnel daemon (PID: $pid)" \ - "terminated unexpectedly." - exit 16 # EBUSY - fi - return 1 + if ! ps -p $pid >/dev/null 2>&1; then + wsrep_log_error \ + "the rsync or stunnel daemon (PID: $pid)" \ + "terminated unexpectedly." + exit 16 # EBUSY fi + return 1 fi - if ! check_port $pid "$port" "$utils"; then + local rc=0 + check_port $pid "$port" "$utils" || rc=$? + if [ $rc -eq 16 ]; then + # We will ignore the return code EBUSY, which indicates + # a failed attempt to run the utility for retrieving + # socket information (on some systems): + return 1 + elif [ $rc -ne 0 ]; then wsrep_log_error "rsync or stunnel daemon port '$port'" \ "has been taken by another program" exit 16 # EBUSY @@ -148,13 +166,6 @@ check_pid_and_port() check_pid "$pid_file" && [ $CHECK_PID -eq $pid ] } -DATA="$WSREP_SST_OPT_DATA" - -STUNNEL_CONF="$DATA/stunnel.conf" -STUNNEL_PID="$DATA/stunnel.pid" - -MAGIC_FILE="$DATA/rsync_sst_complete" - get_binlog if [ -n "$WSREP_SST_OPT_BINLOG" ]; then @@ -162,16 +173,6 @@ if [ -n "$WSREP_SST_OPT_BINLOG" ]; then binlog_base=$(basename "$WSREP_SST_OPT_BINLOG") fi -OLD_PWD="$(pwd)" - -if [ -n "$DATA" -a "$DATA" != '.' ]; then - [ ! -d "$DATA" ] && mkdir -p "$DATA" - cd "$DATA" -fi -DATA_DIR="$(pwd)" - -cd "$OLD_PWD" - BINLOG_TAR_FILE="$DATA_DIR/wsrep_sst_binlog.tar" ar_log_dir="$DATA_DIR" @@ -179,77 +180,6 @@ ib_log_dir="$DATA_DIR" ib_home_dir="$DATA_DIR" ib_undo_dir="$DATA_DIR" -# if no command line argument and INNODB_LOG_GROUP_HOME is not set, -# then try to get it from the my.cnf: -if [ -z "$INNODB_LOG_GROUP_HOME" ]; then - INNODB_LOG_GROUP_HOME=$(parse_cnf '--mysqld' 'innodb-log-group-home-dir') - INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") -fi - -if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ - "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" - cd "$INNODB_LOG_GROUP_HOME" - ib_log_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument and INNODB_DATA_HOME_DIR environment -# variable is not set, try to get it from the my.cnf: -if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf '--mysqld' 'innodb-data-home-dir') - INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") -fi - -if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ - "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" - cd "$INNODB_DATA_HOME_DIR" - ib_home_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument and INNODB_UNDO_DIR is not set, -# then try to get it from the my.cnf: -if [ -z "$INNODB_UNDO_DIR" ]; then - INNODB_UNDO_DIR=$(parse_cnf '--mysqld' 'innodb-undo-directory') - INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") -fi - -if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ - "$INNODB_UNDO_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" - cd "$INNODB_UNDO_DIR" - ib_undo_dir="$(pwd)" - cd "$OLD_PWD" -fi - -# if no command line argument then try to get it from the my.cnf: -if [ -z "$ARIA_LOG_DIR" ]; then - ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path') - ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR") -fi - -if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \ - "$ARIA_LOG_DIR" != "$DATA_DIR" ] -then - # handle both relative and absolute paths: - cd "$DATA" - [ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR" - cd "$ARIA_LOG_DIR" - ar_log_dir="$(pwd)" - cd "$OLD_PWD" -fi - encgroups='--mysqld|sst' check_server_ssl_config @@ -320,7 +250,7 @@ if [ "${SSLMODE#VERIFY}" != "$SSLMODE" ]; then elif [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then # check if the address is an ip-address (v4 or v6): if echo "$WSREP_SST_OPT_HOST_UNESCAPED" | \ - grep -q -E '^([0-9]+(\.[0-9]+){3}|[0-9a-fA-F]*(\:[0-9a-fA-F]*)+)$' + grep -q -E '^([0-9]+(\.[0-9]+){3}|[0-9a-fA-F]*(:[0-9a-fA-F]*){1,7})$' then CHECK_OPT="checkIP = $WSREP_SST_OPT_HOST_UNESCAPED" else @@ -347,22 +277,7 @@ fi readonly SECRET_TAG='secret' readonly BYPASS_TAG='bypass' -SST_PID="$DATA/wsrep_sst.pid" - -# give some time for previous SST to complete: -check_round=0 -while check_pid "$SST_PID" 0; do - wsrep_log_info "Previous SST is not completed, waiting for it to exit" - check_round=$(( check_round+1 )) - if [ $check_round -eq 20 ]; then - wsrep_log_error "previous SST script still running." - exit 114 # EALREADY - fi - sleep 1 -done - -trap simple_cleanup EXIT -echo $$ > "$SST_PID" +wait_previous_sst # give some time for stunnel from the previous SST to complete: check_round=0 @@ -370,26 +285,21 @@ while check_pid "$STUNNEL_PID" 1 "$STUNNEL_CONF"; do wsrep_log_info "Lingering stunnel daemon found at startup," \ "waiting for it to exit" check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "stunnel daemon still running." + if [ $check_round -eq 30 ]; then + wsrep_log_error "stunnel daemon still running..." exit 114 # EALREADY fi sleep 1 done -MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}" - -RSYNC_PID="$DATA/$MODULE.pid" -RSYNC_CONF="$DATA/$MODULE.conf" - # give some time for rsync from the previous SST to complete: check_round=0 while check_pid "$RSYNC_PID" 1 "$RSYNC_CONF"; do wsrep_log_info "Lingering rsync daemon found at startup," \ "waiting for it to exit" check_round=$(( check_round+1 )) - if [ $check_round -eq 10 ]; then - wsrep_log_error "rsync daemon still running." + if [ $check_round -eq 30 ]; then + wsrep_log_error "rsync daemon still running..." exit 114 # EALREADY fi sleep 1 @@ -598,66 +508,82 @@ FILTER="-f '- /lost+found' wsrep_log_info "Transfer of normal directories done" - # Transfer InnoDB data files - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /ibdata*' -f '+ /ib_lru_dump' \ - -f '- **' "$ib_home_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-data_dir" >&2 || RC=$? + if [ -d "$ib_home_dir" ]; then + + # Transfer InnoDB data files + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /ibdata*' -f '+ /ib_lru_dump' \ + -f '- **' "$ib_home_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-data_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_data_home_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB data files done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_data_home_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB data files done" + if [ -d "$ib_log_dir" ]; then - # second, we transfer the InnoDB log file - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /ib_logfile0' \ - -f '- **' "$ib_log_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$? + # second, we transfer the InnoDB log file + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /ib_logfile0' \ + -f '- **' "$ib_log_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB log files done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_log_group_home_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB log files done" + if [ "$ib_undo_dir" ]; then - # third, we transfer InnoDB undo logs - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /undo*' \ - -f '- **' "$ib_undo_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? + # third, we transfer InnoDB undo logs + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /undo*' \ + -f '- **' "$ib_undo_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_undo_dir returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of InnoDB undo logs done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync innodb_undo_dir returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of InnoDB undo logs done" + if [ "$ar_log_dir" ]; then - # fourth, we transfer Aria logs - rsync ${STUNNEL:+--rsh="$STUNNEL"} \ - --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \ - -f '- **' "$ar_log_dir/" \ - "rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$? + # fourth, we transfer Aria logs + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \ + -f '- **' "$ar_log_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync aria_log_dir_path returned code $RC:" + exit 255 # unknown error + fi + + wsrep_log_info "Transfer of Aria logs done" - if [ $RC -ne 0 ]; then - wsrep_log_error "rsync aria_log_dir_path returned code $RC:" - exit 255 # unknown error fi - wsrep_log_info "Transfer of Aria logs done" - # then, we parallelize the transfer of database directories, # use '.' so that path concatenation works: @@ -744,6 +670,8 @@ else # joiner check_sockets_utils + create_dirs + ADDR="$WSREP_SST_OPT_HOST" RSYNC_PORT="$WSREP_SST_OPT_PORT" RSYNC_ADDR="$WSREP_SST_OPT_HOST" @@ -866,19 +794,18 @@ EOF echo "ready $ADDR:$RSYNC_PORT/$MODULE" - MYSQLD_PID="$WSREP_SST_OPT_PARENT" - # wait for SST to complete by monitoring magic file while [ ! -r "$MAGIC_FILE" ] && check_pid "$TRANSFER_PID" && \ - ps -p $MYSQLD_PID >/dev/null 2>&1 + ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1 do sleep 1 done - if ! ps -p $MYSQLD_PID >/dev/null 2>&1; then + if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then wsrep_log_error \ - "Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly." - kill -- -$MYSQLD_PID + "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ + "terminated unexpectedly." + kill -- -$WSREP_SST_OPT_PARENT sleep 1 exit 32 fi diff --git a/sql-common/my_time.c b/sql-common/my_time.c index bc1c59f52f6..3d96695cd5c 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -961,7 +961,7 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length, { /* String given as one number; assume HHMMSS format */ date[0]= 0; - DBUG_ASSERT(value <= ((ulonglong) UINT_MAX32) * 10000ULL); + DBUG_ASSERT(value / 10000 <= ((ulonglong) UINT_MAX32)); date[1]= (ulong) (value/10000); date[2]= (ulong) (value/100 % 100); date[3]= (ulong) (value % 100); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 6ed2f1ae326..84442d6518a 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1465,7 +1465,7 @@ public: virtual int get_foreign_key_list(THD *thd, List *f_key_list) - virtual uint referenced_by_foreign_key() + bool referenced_by_foreign_key() const noexcept override */ bool can_switch_engines() override; /* diff --git a/sql/handler.h b/sql/handler.h index 3361a67c9a6..10061daf321 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4536,7 +4536,7 @@ public: @return The handler error code or zero for success. */ virtual int - get_foreign_key_list(const THD *thd, List *f_key_list) + get_foreign_key_list(THD *thd, List *f_key_list) { return 0; } /** Get the list of foreign keys referencing this table. @@ -4550,9 +4550,9 @@ public: @return The handler error code or zero for success. */ virtual int - get_parent_foreign_key_list(const THD *thd, List *f_key_list) + get_parent_foreign_key_list(THD *thd, List *f_key_list) { return 0; } - virtual uint referenced_by_foreign_key() { return 0;} + virtual bool referenced_by_foreign_key() const noexcept { return false;} virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} diff --git a/sql/item.cc b/sql/item.cc index 51943325720..f19e776882e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1293,7 +1293,7 @@ Item *Item::multiple_equality_transformer(THD *thd, uchar *arg) This flag will be removed at the end of the pushdown optimization by remove_immutable_flag_processor processor. */ - int new_flag= MARKER_IMMUTABLE; + int16 new_flag= MARKER_IMMUTABLE; this->walk(&Item::set_extraction_flag_processor, false, (void*)&new_flag); } diff --git a/sql/item_func.h b/sql/item_func.h index ae39c9df5d4..f480275b925 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -35,6 +35,8 @@ extern "C" /* Bug in BSDI include file */ #include +extern int st_append_json(String *s, + CHARSET_INFO *json_cs, const uchar *js, uint js_len); class Item_func :public Item_func_or_sum { void sync_with_sum_func_and_with_field(List &list); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 217a95f90aa..2dde672c0d8 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -4009,7 +4009,6 @@ static Native_func_registry func_array_geom[] = { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)}, { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)}, { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, - { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index f119ea638cb..50af58ecac6 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -101,7 +101,7 @@ static inline bool append_simple(String *s, const uchar *a, size_t a_len) Appends JSON string to the String object taking charsets in consideration. */ -static int st_append_json(String *s, +int st_append_json(String *s, CHARSET_INFO *json_cs, const uchar *js, uint js_len) { int str_len= js_len * s->charset()->mbmaxlen; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a555033fb50..9161155b3b8 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -63,7 +63,7 @@ C_MODE_END /* fmtlib include (https://fmt.dev/). */ #define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 -#include "fmt/format-inl.h" +#include "fmt/args.h" size_t username_char_length= USERNAME_CHAR_LENGTH; @@ -1566,75 +1566,42 @@ namespace fmt { */ String *Item_func_sformat::val_str(String *res) { - /* - A union that stores a numeric format arg value. - fmt::detail::make_arg does not accept temporaries, so all of its numeric - args are temporarily stored in the fmt_args array. - See: https://github.com/fmtlib/fmt/issues/3596 - */ - union Format_arg_store { - longlong val_int; - float val_float; - double val_double; - }; - DBUG_ASSERT(fixed()); - using ctx= fmt::format_context; - String *fmt_arg= NULL; - String *parg= NULL; - fmt::format_args::format_arg *vargs= NULL; - Format_arg_store *fmt_args= NULL; + using ArgStore= fmt::dynamic_format_arg_store; + String *fmt_arg= NULL; + String *parg= NULL; + ArgStore arg_store; null_value= true; if (!(fmt_arg= args[0]->val_str(res))) return NULL; - if (!(vargs= new fmt::format_args::format_arg[arg_count - 1])) - return NULL; - - if (!(fmt_args= new Format_arg_store[arg_count - 1])) - { - delete [] vargs; - return NULL; - } - /* Creates the array of arguments for vformat */ for (uint carg= 1; carg < arg_count; carg++) { switch (args[carg]->result_type()) { case INT_RESULT: - fmt_args[carg-1].val_int= args[carg]->val_int(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_int); + arg_store.push_back(args[carg]->val_int()); break; case DECIMAL_RESULT: // TODO case REAL_RESULT: if (args[carg]->field_type() == MYSQL_TYPE_FLOAT) - { - fmt_args[carg-1].val_float= (float)args[carg]->val_real(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_float); - } + arg_store.push_back((float)args[carg]->val_real()); else - { - fmt_args[carg-1].val_double= args[carg]->val_real(); - vargs[carg-1]= fmt::detail::make_arg(fmt_args[carg-1].val_double); - } + arg_store.push_back(args[carg]->val_real()); break; case STRING_RESULT: if (!(parg= args[carg]->val_str(&val_arg[carg-1]))) { - delete [] vargs; - delete [] fmt_args; return NULL; } - vargs[carg-1]= fmt::detail::make_arg(*parg); + arg_store.push_back(*parg); break; case TIME_RESULT: // TODO case ROW_RESULT: // TODO default: DBUG_ASSERT(0); - delete [] vargs; - delete [] fmt_args; return NULL; } } @@ -1643,8 +1610,7 @@ String *Item_func_sformat::val_str(String *res) /* Create the string output */ try { - auto text = fmt::vformat(fmt_arg->c_ptr_safe(), - fmt::format_args(vargs, arg_count-1)); + auto text = fmt::vformat(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()); @@ -1657,8 +1623,6 @@ String *Item_func_sformat::val_str(String *res) ER_THD(thd, WARN_SFORMAT_ERROR), ex.what()); null_value= true; } - delete [] vargs; - delete [] fmt_args; return null_value ? NULL : res; } diff --git a/sql/json_table.cc b/sql/json_table.cc index bb061cb1540..4ec7337897f 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -370,6 +370,8 @@ int ha_json_table::rnd_init(bool scan) static void store_json_in_field(Field *f, const json_engine_t *je) { + String res_tmp("", 0, je->s.cs); + switch (je->value_type) { case JSON_VALUE_NULL: @@ -390,7 +392,8 @@ static void store_json_in_field(Field *f, const json_engine_t *je) default: break; }; - f->store((const char *) je->value, (uint32) je->value_len, je->s.cs); + st_append_json(&res_tmp, je->s.cs, je->value, je->value_len); + f->store((const char *) res_tmp.ptr(), (uint32) res_tmp.length(), je->s.cs); } @@ -1038,8 +1041,7 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, return 1; case Json_table_column::RESPONSE_DEFAULT: f->set_notnull(); - f->store(m_default.str, - m_default.length, jc->m_defaults_cs); + m_default->save_in_field(f, TRUE); break; } return 0; @@ -1049,7 +1051,11 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, int Json_table_column::On_response::print(const char *name, String *str) const { LEX_CSTRING resp; - const LEX_CSTRING *ds= NULL; + + char valbuf[512]; + String val(valbuf, sizeof(valbuf), str->charset()); + String *ds= NULL; + if (m_response == Json_table_column::RESPONSE_NOT_SPECIFIED) return 0; @@ -1064,7 +1070,7 @@ int Json_table_column::On_response::print(const char *name, String *str) const case Json_table_column::RESPONSE_DEFAULT: { lex_string_set3(&resp, STRING_WITH_LEN("DEFAULT")); - ds= &m_default; + ds= m_default->val_str(&val); break; } default: @@ -1073,9 +1079,14 @@ int Json_table_column::On_response::print(const char *name, String *str) const } return (str->append(' ') || str->append(resp) || - (ds && (str->append(STRING_WITH_LEN(" '")) || - str->append_for_single_quote(ds->str, ds->length) || - str->append('\''))) || + (ds && + (str->append(' ') || + (m_default->result_type()==STRING_RESULT && str->append('\''))|| + + str->append_for_single_quote(ds) || + + (m_default->result_type()==STRING_RESULT && str->append('\''))))|| + str->append(STRING_WITH_LEN(" ON ")) || str->append(name, strlen(name))); } diff --git a/sql/json_table.h b/sql/json_table.h index 74c2bfc217d..84f0a099d6e 100644 --- a/sql/json_table.h +++ b/sql/json_table.h @@ -140,7 +140,7 @@ public: { public: Json_table_column::enum_on_response m_response; - LEX_CSTRING m_default; + Item *m_default; int respond(Json_table_column *jc, Field *f, uint error_num); int print(const char *name, String *str) const; bool specified() const { return m_response != RESPONSE_NOT_SPECIFIED; } @@ -154,7 +154,6 @@ public: Create_field *m_field; Json_table_nested_path *m_nest; CHARSET_INFO *m_explicit_cs; - CHARSET_INFO *m_defaults_cs; void set(enum_type ctype) { @@ -263,9 +262,6 @@ public: /* SQL Parser: current column in JSON_TABLE (...) syntax */ Json_table_column *m_cur_json_table_column; - /* SQL Parser: charset of the current text literal */ - CHARSET_INFO *m_text_literal_cs; - private: /* Context to be used for resolving the first argument. */ Name_resolution_context *m_context; diff --git a/sql/log.cc b/sql/log.cc index 6a7e2417169..0092a9a843f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3942,7 +3942,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name, if (!gtid_index) sql_print_information("Could not create GTID index for binlog " "file '%s'. Accesses to this binlog file will " - "fallback to slower sequential scan."); + "fallback to slower sequential scan.", + log_file_name); } else gtid_index= nullptr; @@ -4476,6 +4477,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, mark_xids_active(current_binlog_id, 1); do_checkpoint_request(current_binlog_id); + /* Flush all engine logs to force checkpoint responses to come through. */ + ha_flush_logs(); + /* Now wait for all checkpoint requests and pending unlog() to complete. */ mysql_mutex_lock(&LOCK_xid_list); for (;;) diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 9b179836651..db479f70595 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -4925,13 +4925,15 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) #ifdef WITH_WSREP if (WSREP(thd)) { - WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d " + WSREP_WARN("BF applier thread=%lu failed to open_and_lock_tables for " + "%s, fatal: %d " "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)", - thd->get_stmt_da()->sql_errno(), - thd->is_fatal_error, - thd->wsrep_cs().mode(), - thd->wsrep_trx().state(), - (long long) wsrep_thd_trx_seqno(thd)); + thd_get_thread_id(thd), + thd->get_stmt_da()->message(), + thd->is_fatal_error, + thd->wsrep_cs().mode(), + thd->wsrep_trx().state(), + wsrep_thd_trx_seqno(thd)); } #endif /* WITH_WSREP */ if (thd->is_error() && diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc index 96a46559ebd..7895c797e6d 100644 --- a/sql/mf_iocache_encr.cc +++ b/sql/mf_iocache_encr.cc @@ -177,8 +177,8 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count) DBUG_RETURN(info->error= -1); } crypt_data->counter= 0; - - IF_DBUG(crypt_data->block_length= 0,); + crypt_data->block_length= 0; + crypt_data->last_block_length= 0; } do diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8c250d6e5a5..1524ff38eb3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -209,7 +209,7 @@ typedef fp_except fp_except_t; inline void setup_fpu() { -#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) +#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT) && defined(FP_X_INV) /* We can't handle floating point exceptions with threads, so disable this on freebsd Don't fall for overflow, underflow,divide-by-zero or loss of precision. @@ -222,7 +222,7 @@ inline void setup_fpu() fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | FP_X_IMP)); #endif /* FP_X_DNML */ -#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */ +#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT && FP_X_INV */ #ifdef HAVE_FEDISABLEEXCEPT fedisableexcept(FE_ALL_EXCEPT); @@ -6505,7 +6505,9 @@ void handle_connections_sockets() &length); if (mysql_socket_getfd(new_sock) != INVALID_SOCKET) handle_accepted_socket(new_sock, sock); - else if (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN) + else if (socket_errno == SOCKET_EAGAIN || socket_errno == SOCKET_EWOULDBLOCK) + break; + else if (socket_errno != SOCKET_EINTR) { /* accept(2) failed on the listening port. diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 22ae84aa353..0a26951b47e 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -183,7 +183,8 @@ extern "C" my_bool wsrep_thd_is_BF(const THD *thd, my_bool sync) extern "C" my_bool wsrep_thd_is_SR(const THD *thd) { - return thd && thd->wsrep_cs().transaction().is_streaming(); + return thd && thd->wsrep_cs().transaction().is_streaming() && + thd->wsrep_cs().transaction().state() == wsrep::transaction::s_executing; } extern "C" void wsrep_handle_SR_rollback(THD *bf_thd, diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc index ce7617f7e1e..53802d8f426 100644 --- a/sql/session_tracker.cc +++ b/sql/session_tracker.cc @@ -438,6 +438,7 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) SHOW_VAR show; CHARSET_INFO *charset; size_t val_length, length; + mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_plugin); if (!*node->test_load) { @@ -454,13 +455,12 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) show.name= svar->name.str; show.value= (char *) svar; - mysql_mutex_lock(&LOCK_global_system_variables); const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL, &charset, val_buf, &val_length); - mysql_mutex_unlock(&LOCK_global_system_variables); if (is_plugin) mysql_mutex_unlock(&LOCK_plugin); + mysql_mutex_unlock(&LOCK_global_system_variables); length= net_length_size(svar->name.length) + svar->name.length + diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 656b72b933b..96020c68b2b 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -25,6 +25,10 @@ #include "my_stacktrace.h" #include +#ifdef WITH_WSREP +#include "wsrep_server_state.h" +#endif /* WITH_WSREP */ + #ifdef _WIN32 #include #include @@ -222,6 +226,10 @@ extern "C" sig_handler handle_fatal_signal(int sig) "the equation.\n\n"); } +#ifdef WITH_WSREP + Wsrep_server_state::handle_fatal_signal(); +#endif /* WITH_WSREP */ + #ifdef HAVE_STACKTRACE thd= current_thd; diff --git a/sql/slave.cc b/sql/slave.cc index 91616028a79..784c8774ddf 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1075,6 +1075,8 @@ terminate_slave_thread(THD *thd, mysql_mutex_unlock(&thd->LOCK_thd_kill); mysql_mutex_unlock(&thd->LOCK_thd_data); + DEBUG_SYNC(current_thd, "after_thd_awake_kill"); + struct timespec abstime; set_timespec(abstime,2); error= mysql_cond_timedwait(term_cond, term_lock, &abstime); @@ -3516,13 +3518,26 @@ sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi) sql_delay, (long)ev->when, rli->mi->clock_diff_with_master, (long)now, (ulonglong)sql_delay_end, (long)nap_time)); - - if (sql_delay_end > now) + /* if using debug_sync for sql_delay, only delay once per event group */ + if (DBUG_IF("sql_delay_by_debug_sync") + ? type == GTID_EVENT : sql_delay_end > now) { DBUG_PRINT("info", ("delaying replication event %lu secs", nap_time)); rli->start_sql_delay(sql_delay_end); mysql_mutex_unlock(&rli->data_lock); + +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sql_delay_by_debug_sync", { + DBUG_ASSERT(!debug_sync_set_action( + thd, STRING_WITH_LEN( + "now SIGNAL at_sql_delay WAIT_FOR continue_sql_thread"))); + + // Skip the actual sleep if using DEBUG_SYNC to coordinate SQL_DELAY + DBUG_RETURN(0); + };); +#endif + DBUG_RETURN(slave_sleep(thd, nap_time, sql_slave_killed, rgi)); } } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 93efc5806cc..92d9134223b 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10421,12 +10421,15 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table, int result= 0; int error; TABLE *table= grant_table.table(); + DBUG_ENTER("handle_grant_table"); + if (!table) + DBUG_RETURN(0); + Field *host_field= table->field[0]; Field *user_field= table->field[which_table == USER_TABLE || which_table == PROXIES_PRIV_TABLE ? 1 : 2]; uchar user_key[MAX_KEY_LENGTH]; uint key_prefix_length; - DBUG_ENTER("handle_grant_table"); if (which_table == ROLES_MAPPING_TABLE) { diff --git a/sql/sql_class.h b/sql/sql_class.h index 410dddd9d3a..f2b33e9422b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -780,6 +780,7 @@ typedef struct system_variables ulong net_wait_timeout; ulong net_write_timeout; ulong optimizer_extra_pruning_depth; + ulonglong optimizer_join_limit_pref_ratio; ulong optimizer_prune_level; ulong optimizer_search_depth; ulong optimizer_selectivity_sampling_limit; @@ -3867,7 +3868,7 @@ public: ulonglong tmp_tables_size; ulonglong bytes_sent_old; ulonglong affected_rows; /* Number of changed rows */ - ulonglong max_tmp_space_used; + ulonglong max_tmp_space_used= 0; Opt_trace_context opt_trace; pthread_t real_id; /* For debugging */ @@ -4675,6 +4676,7 @@ public: is_slave_error= 0; if (killed == KILL_BAD_DATA) reset_killed(); + my_errno= 0; DBUG_VOID_RETURN; } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 555aff33d3a..e1c513143c9 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1393,7 +1393,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) THD *thd; if (!(thd= connect->create_thd(NULL))) { - connect->close_and_delete(); + connect->close_and_delete(0); return; } @@ -1468,7 +1468,7 @@ end_thread: if (!(connect->create_thd(thd))) { /* Out of resources. Free thread to get more resources */ - connect->close_and_delete(); + connect->close_and_delete(0); break; } delete connect; @@ -1497,9 +1497,11 @@ end_thread: Close connection without error and delete the connect object This and close_with_error are only called if we didn't manage to create a new thd object. + + Note: err can be 0 if unknown/not inportant */ -void CONNECT::close_and_delete() +void CONNECT::close_and_delete(uint err) { DBUG_ENTER("close_and_delete"); @@ -1513,7 +1515,11 @@ void CONNECT::close_and_delete() vio_type= VIO_CLOSED; --*scheduler->connection_count; - statistic_increment(connection_errors_internal, &LOCK_status); + + if (err == ER_CON_COUNT_ERROR) + statistic_increment(connection_errors_max_connection, &LOCK_status); + else + statistic_increment(connection_errors_internal, &LOCK_status); statistic_increment(aborted_connects,&LOCK_status); delete this; @@ -1537,7 +1543,7 @@ void CONNECT::close_with_error(uint sql_errno, delete thd; set_current_thd(0); } - close_and_delete(); + close_and_delete(close_error); } diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 60841217eca..345d5d4fe92 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -61,7 +61,7 @@ public: count--; DBUG_ASSERT(vio_type == VIO_CLOSED); } - void close_and_delete(); + void close_and_delete(uint err); void close_with_error(uint sql_errno, const char *message, uint close_error); THD *create_thd(THD *thd); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f87776e13f1..4960e0a29a8 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -500,6 +500,12 @@ bool Sql_cmd_delete::delete_from_single_table(THD *thd) if (thd->binlog_for_noop_dml(transactional_table)) DBUG_RETURN(1); + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd, 0); DBUG_RETURN(0); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 61ac5030355..660dbbbbe68 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3595,7 +3595,6 @@ pthread_handler_t handle_delayed_insert(void *arg) DBUG_LEAVE; } my_thread_end(); - pthread_exit(0); return 0; } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 01b675f868e..99a7db5911e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3794,6 +3794,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type) } else if (saved_fake_select_lex) saved_fake_select_lex->print_limit(thd, str, query_type); + + print_lock_from_the_last_select(str); } @@ -10818,6 +10820,22 @@ bool SELECT_LEX_UNIT::set_lock_to_the_last_select(Lex_select_lock l) return FALSE; } + +void SELECT_LEX_UNIT::print_lock_from_the_last_select(String *str) +{ + SELECT_LEX *sel= first_select(); + while (sel->next_select()) + sel= sel->next_select(); + if(sel->braces) + return; // braces processed in st_select_lex::print + + // lock type + sel->print_lock_type(str); + + return; +} + + /** Generate unique name for generated derived table for this SELECT */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ea504d82104..8e37e7c8ec4 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -900,6 +900,7 @@ public: bool check_parameters(SELECT_LEX *main_select); bool set_lock_to_the_last_select(Lex_select_lock l); + void print_lock_from_the_last_select(String *str); bool can_be_merged(); @@ -1362,6 +1363,7 @@ public: bool setup_ref_array(THD *thd, uint order_group_num); uint get_cardinality_of_ref_ptrs_slice(uint order_group_num_arg); void print(THD *thd, String *str, enum_query_type query_type); + void print_lock_type(String *str); void print_item_list(THD *thd, String *str, enum_query_type query_type); void print_set_clause(THD *thd, String *str, enum_query_type query_type); void print_on_duplicate_key_clause(THD *thd, String *str, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c6a6ede4530..91744a4c2c8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4556,30 +4556,39 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) #ifdef WITH_WSREP if (wsrep && !first_table->view) { - bool is_innodb= first_table->table->file->partition_ht()->db_type == DB_TYPE_INNODB; - - // For consistency check inserted table needs to be InnoDB - if (!is_innodb && thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK) + const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type; + // For InnoDB we don't need to worry about anything here: + if (db_type != DB_TYPE_INNODB) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - HA_ERR_UNSUPPORTED, - "Galera cluster does support consistency check only" - " for InnoDB tables."); - thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; - } - - // For !InnoDB we start TOI if it is not yet started and hope for the best - if (!is_innodb && !wsrep_toi) - { - const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type; - - /* Currently we support TOI for MyISAM only. */ - if (db_type == DB_TYPE_MYISAM && - wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) - WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + // For consistency check inserted table needs to be InnoDB + if (thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + "Galera cluster does support consistency check only" + " for InnoDB tables."); + thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK; + } + /* Only TOI allowed to !InnoDB tables */ + if (wsrep_OSU_method_get(thd) != WSREP_OSU_TOI) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine"); + break; + } + // For !InnoDB we start TOI if it is not yet started and hope for the best + if (!wsrep_toi) + { + /* Currently we support TOI for MyISAM only. */ + if ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) || + (db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))) + { + WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL); + } + } } } #endif /* WITH_WSREP */ + /* Only the INSERT table should be merged. Other will be handled by select. @@ -9218,8 +9227,27 @@ static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { #ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } + bool wsrep_high_priority= false; -#endif +#endif /* WITH_WSREP */ uint error= kill_one_thread(thd, id, state, type #ifdef WITH_WSREP , wsrep_high_priority @@ -9251,6 +9279,26 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state) { uint error; ha_rows rows; +#ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } +#endif /* WITH_WSREP */ switch (error= kill_threads_for_user(thd, user, state, &rows)) { case 0: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 49f0aa587cc..2ec6b7f25d3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -269,12 +269,14 @@ static COND *make_cond_for_table_from_pred(THD *thd, Item *root_cond, bool is_top_and_level); static Item* part_of_refkey(TABLE *form,Field *field); -static bool test_if_cheaper_ordering(const JOIN_TAB *tab, +static bool test_if_cheaper_ordering(bool in_join_optimizer, + const JOIN_TAB *tab, ORDER *order, TABLE *table, key_map usable_keys, int key, ha_rows select_limit, int *new_key, int *new_key_direction, ha_rows *new_select_limit, + double *new_read_time, uint *new_used_key_parts= NULL, uint *saved_best_key_parts= NULL); static int test_if_order_by_key(JOIN *, ORDER *, TABLE *, uint, uint *); @@ -368,6 +370,18 @@ static double prev_record_reads(const POSITION *positions, uint idx, table_map found_ref, double record_count, double *same_keys); +static +bool join_limit_shortcut_is_applicable(const JOIN *join); +POSITION *join_limit_shortcut_finalize_plan(JOIN *join, double *cost); + +static +bool find_indexes_matching_order(JOIN *join, TABLE *table, ORDER *order, + key_map *usable_keys); +static +void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, + Item_field *item_field, + key_map *col_keys); + #ifndef DBUG_OFF /* @@ -6028,6 +6042,7 @@ make_join_statistics(JOIN *join, List &tables_list, join->sort_by_table= get_sort_by_table(join->order, join->group_list, join->select_lex->leaf_tables, join->const_table_map); + join->limit_shortcut_applicable= join_limit_shortcut_is_applicable(join); /* Update info on indexes that can be used for search lookups as reading const tables may has added new sargable predicates. @@ -7160,12 +7175,13 @@ Item_equal::add_key_fields(JOIN *join, KEY_FIELD **key_fields, } -static uint +static inline uint max_part_bit(key_part_map bits) { - uint found; - for (found=0; bits & 1 ; found++,bits>>=1) ; - return found; + if (bits == 0) + return 0; + /* find first zero bit by reverting all bits and find first bit */ + return my_find_first_bit(~(ulonglong) bits); } @@ -8458,6 +8474,30 @@ double hash_join_fanout(JOIN *join, JOIN_TAB *tab, table_map remaining_tables, } +#ifndef DBUG_OFF + +static char dbug_join_prefix_buf[256]; + +const char* dbug_print_join_prefix(const POSITION *join_positions, + uint idx, + JOIN_TAB *s) +{ + char *buf= dbug_join_prefix_buf; + String str(buf, sizeof(dbug_join_prefix_buf), &my_charset_bin); + str.length(0); + for (uint i=0; i!=idx; i++) + { + str.append(join_positions[i].table->table->alias); + str.append(','); + } + str.append(s->table->alias); + if (str.c_ptr_safe() == buf) + return buf; + else + return "Couldn't fit into buffer"; +} +#endif + /** Find the best access path for an extension of a partial execution plan and add this path to the plan. @@ -8481,6 +8521,14 @@ double hash_join_fanout(JOIN *join, JOIN_TAB *tab, table_map remaining_tables, @param pos OUT Table access plan @param loose_scan_pos OUT Table plan that uses loosescan, or set cost to DBL_MAX if not possible. + @detail + Use this to print the current join prefix: + + dbug_print_join_prefix(join_positions, idx, s) + + Use this as breakpoint condition to stop at join prefix "t1,t2,t3": + + $_streq(dbug_print_join_prefix(join_positions, idx, s), "t1,t2,t3") @return None @@ -8594,6 +8642,7 @@ best_access_path(JOIN *join, if (s->keyuse) { /* Use key if possible */ KEYUSE *keyuse, *start_key= 0; + const char *cause= NULL; uint max_key_part=0; enum join_type type= JT_UNKNOWN; double cur_cost, copy_cost, cached_prev_record_reads= 0.0; @@ -8604,7 +8653,6 @@ best_access_path(JOIN *join, for (keyuse=s->keyuse ; keyuse->table == table ;) { KEY *keyinfo; - const char *cause= NULL; ulong key_flags; uint key_parts; key_part_map found_part= 0; @@ -8612,6 +8660,7 @@ best_access_path(JOIN *join, key_part_map notnull_part=0; table_map found_ref= 0; uint key= keyuse->key; + uint max_const_parts; bool ft_key= (keyuse->keypart == FT_KEYPART); /* Bitmap of keyparts where the ref access is over 'keypart=const': */ key_part_map const_part= 0; @@ -8738,6 +8787,8 @@ best_access_path(JOIN *join, rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables Json_writer_object trace_access_idx(thd); + max_const_parts= max_part_bit(const_part); + /* full text keys require special treatment */ @@ -8884,9 +8935,7 @@ best_access_path(JOIN *join, in ReuseRangeEstimateForRef-3. */ if (table->opt_range_keys.is_set(key) && - (const_part & - (((key_part_map)1 << table->opt_range[key].key_parts)-1)) == - (((key_part_map)1 << table->opt_range[key].key_parts)-1) && + table->opt_range[key].key_parts <= max_const_parts && table->opt_range[key].ranges == 1 && records > (double) table->opt_range[key].rows) { @@ -8934,6 +8983,8 @@ best_access_path(JOIN *join, double extra_cost= 0; max_key_part= max_part_bit(found_part); + bool all_used_equalities_are_const= (max_key_part == + max_const_parts); /* ReuseRangeEstimateForRef-3: We're now considering a ref[or_null] access via @@ -8948,7 +8999,7 @@ best_access_path(JOIN *join, create quick select over another index), so we can't compare them to (**). We'll make indirect judgements instead. The sufficient conditions for re-use are: - (C1) All e_i in (**) are constants, i.e. found_ref==FALSE. (if + (C1) All e_i in (**) are constants (if this is not satisfied we have no way to know which ranges will be actually scanned by 'ref' until we execute the join) @@ -8973,7 +9024,8 @@ best_access_path(JOIN *join, (C3) "range optimizer used (have ref_or_null?2:1) intervals" */ - if (table->opt_range_keys.is_set(key) && !found_ref && //(C1) + if (table->opt_range_keys.is_set(key) && + all_used_equalities_are_const && // (C1) table->opt_range[key].key_parts == max_key_part && //(C2) (table->opt_range[key].ranges == 1 + MY_TEST(ref_or_null_part))) //(C3) @@ -9019,7 +9071,7 @@ best_access_path(JOIN *join, This is the case when we have only one const range and it consist of more parts than what we used for REF. */ - if (!found_ref && + if (all_used_equalities_are_const && table->opt_range[key].key_parts > max_key_part && table->opt_range[key].ranges <= (uint) (1 + MY_TEST(ref_or_null_part))) @@ -9031,7 +9083,7 @@ best_access_path(JOIN *join, } } rows= (double) table->opt_range[key].rows; - if (!found_ref && // (1) + if (all_used_equalities_are_const && // (1) records < rows) // (3) { trace_access_idx.add("used_range_estimates", @@ -9099,16 +9151,17 @@ best_access_path(JOIN *join, applied to first table->quick_key_parts[key] key parts. */ if (table->opt_range_keys.is_set(key) && - table->opt_range[key].key_parts <= max_key_part && - const_part & - ((key_part_map)1 << table->opt_range[key].key_parts) && + table->opt_range[key].key_parts <= max_const_parts && table->opt_range[key].ranges == (1 + MY_TEST(ref_or_null_part & const_part)) && records > (double) table->opt_range[key].rows) { - trace_access_idx.add("used_range_estimates", true); - records= (double) table->opt_range[key].rows; + // psergey-merge-sept: remove: if (table->opt_range[key].key_parts <= max_const_parts) + { + trace_access_idx.add("used_range_estimates", true); + records= (double) table->opt_range[key].rows; + } } } @@ -9237,6 +9290,7 @@ best_access_path(JOIN *join, add("cost", cur_cost); } + /* The COST_EPS is here to ensure we use the first key if there are two 'identical keys' that could be used. @@ -9999,6 +10053,7 @@ choose_plan(JOIN *join, table_map join_tables, TABLE_LIST *emb_sjm_nest) qsort2_cmp jtab_sort_func; DBUG_ENTER("choose_plan"); + join->limit_optimization_mode= false; join->cur_embedding_map= 0; join->extra_heuristic_pruning= false; join->prune_level= join->thd->variables.optimizer_prune_level; @@ -10073,8 +10128,46 @@ choose_plan(JOIN *join, table_map join_tables, TABLE_LIST *emb_sjm_nest) join->extra_heuristic_pruning= true; } + double limit_cost= DBL_MAX; + double limit_record_count; + POSITION *limit_plan= NULL; + + /* First, build a join plan that can short-cut ORDER BY...LIMIT */ + if (join->limit_shortcut_applicable && !join->emb_sjm_nest) + { + bool res; + Json_writer_object wrapper(join->thd); + Json_writer_array trace(join->thd, "join_limit_shortcut_plan_search"); + join->limit_optimization_mode= true; + res= greedy_search(join, join_tables, search_depth, + use_cond_selectivity); + join->limit_optimization_mode= false; + + if (res) + DBUG_RETURN(TRUE); + DBUG_ASSERT(join->best_read != DBL_MAX); + + /* + We've built a join order. Adjust its cost based on ORDER BY...LIMIT + short-cutting. + */ + limit_plan= join_limit_shortcut_finalize_plan(join, &limit_cost); + limit_record_count= join->join_record_count; + } + + /* The main call to search for the query plan: */ if (greedy_search(join, join_tables, search_depth, use_cond_selectivity)) DBUG_RETURN(TRUE); + + DBUG_ASSERT(join->best_read != DBL_MAX); + if (limit_plan && limit_cost < join->best_read) + { + /* Plan that uses ORDER BY ... LIMIT shortcutting is better. */ + memcpy((uchar*)join->best_positions, (uchar*)limit_plan, + sizeof(POSITION)*join->table_count); + join->best_read= limit_cost; + join->join_record_count= limit_record_count; + } } join->emb_sjm_nest= 0; @@ -11367,6 +11460,315 @@ get_costs_for_tables(JOIN *join, table_map remaining_tables, uint idx, DBUG_RETURN(found_eq_ref); } + +/* + @brief + Check if it is potentally possible to short-cut the JOIN execution due to + ORDER BY ... LIMIT clause + + @detail + It is possible when the join has "ORDER BY ... LIMIT n" clause, and the + sort+limit operation is done right after the join operation (there's no + grouping or DISTINCT in between). + Then we can potentially build a join plan that enumerates rows in the + ORDER BY order and so will be able to terminate as soon as it has produced + #limit rows. + + Note that it is not a requirement that sort_by_table has an index that + matches ORDER BY. If it doesn't have one, the optimizer will pass + sort_by_table to filesort. Reading from sort_by_table won't use + short-cutting but the rest of the join will. +*/ + +static +bool join_limit_shortcut_is_applicable(const JOIN *join) +{ + /* + Any post-join operation like GROUP BY or DISTINCT or window functions + means we cannot short-cut join execution + */ + if (!join->thd->variables.optimizer_join_limit_pref_ratio || + !join->order || + join->select_limit == HA_POS_ERROR || + join->group_list || + join->select_distinct || + join->select_options & SELECT_BIG_RESULT || + join->rollup.state != ROLLUP::STATE_NONE || + join->select_lex->have_window_funcs() || + join->select_lex->with_sum_func) + { + return false; + } + + /* + Cannot do short-cutting if + (1) ORDER BY refers to more than one table or + (2) the table it refers to cannot be first table in the join order + */ + if (!join->sort_by_table || // (1) + join->sort_by_table->reginfo.join_tab->dependent) // (2) + return false; + + Json_writer_object wrapper(join->thd); + Json_writer_object trace(join->thd, "join_limit_shortcut_is_applicable"); + trace.add("applicable", 1); + /* It looks like we can short-cut limit due to join */ + return true; +} + + +/* + @brief + Check if we could use an index-based access method to produce rows + in the order for ORDER BY ... LIMIT. + + @detail + This should do what test_if_skip_sort_order() does. We can't use that + function directly, because: + + 1. We're at the join optimization stage and have not done query plan + fix-ups done in get_best_combination() and co. + + 2. The code in test_if_skip_sort_order() does modify query plan structures, + for example it may change the table's quick select. This is done even if + it's called with no_changes=true parameter. + + @param access_method_changed OUT Whether the function changed the access + method to get rows in desired order. + @param new_access_cost OUT if access method changed: its cost. + + @return + true - Can skip sorting + false - Cannot skip sorting +*/ + +bool test_if_skip_sort_order_early(JOIN *join, + bool *access_method_changed, + double *new_access_cost) +{ + const POSITION *pos= &join->best_positions[join->const_tables]; + TABLE *table= pos->table->table; + key_map usable_keys= table->keys_in_use_for_order_by; + + *access_method_changed= false; + + // Step #1: Find indexes that produce the required ordering. + if (find_indexes_matching_order(join, table, join->order, &usable_keys)) + { + return false; // Cannot skip sorting + } + + // Step #2: Check if the index we're using produces the needed ordering + uint ref_key; + if (pos->key) + { + // Mirror the (wrong) logic in test_if_skip_sort_order: + if (pos->spl_plan || pos->type == JT_REF_OR_NULL) + return false; // Use filesort + + ref_key= pos->key->key; + } + else + { + if (pos->table->quick) + { + if (pos->table->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE) + ref_key= pos->table->quick->index; + else + ref_key= MAX_KEY; + } + else + ref_key= MAX_KEY; + } + + if (ref_key != MAX_KEY && usable_keys.is_set(ref_key)) + { + return true; // we're using an index that produces the reqired ordering. + } + + /* + Step #3: check if we can switch to using an index that would produce the + ordering. + (But don't actually switch, this will be done by test_if_skip_sort_order) + */ + int best_key= -1; + uint UNINIT_VAR(best_key_parts); + uint saved_best_key_parts= 0; + int best_key_direction= 0; + JOIN_TAB *tab= pos->table; + ha_rows new_limit; + double new_read_time; + if (test_if_cheaper_ordering(/*in_join_optimizer */TRUE, + tab, join->order, table, usable_keys, + ref_key, join->select_limit, + &best_key, &best_key_direction, + &new_limit, &new_read_time, + &best_key_parts, + &saved_best_key_parts)) + { + // Ok found a way to skip sorting + *access_method_changed= true; + *new_access_cost= new_read_time; + return true; + } + + return false; +} + + +/* + Compute the cost of join assuming we only need fraction of the output. +*/ + +double recompute_join_cost_with_limit(const JOIN *join, bool skip_sorting, + double *first_table_cost, + double fraction) +{ + POSITION *pos= join->best_positions + join->const_tables; + /* + Generally, we assume that producing X% of output takes X% of the cost. + */ + double partial_join_cost= join->best_read * fraction; + + if (skip_sorting) + { + /* + First table produces rows in required order. Two options: + + A. first_table_cost=NULL means we use whatever access method the join + optimizer has picked. Its cost was included in join->best_read and + we've already took a fraction of it. + + B. first_table_cost!=NULL means we will need to switch to another access + method, we have the cost to read rows to produce #LIMIT rows in join + output. + */ + if (first_table_cost) + { + /* + Subtract the remainder of the first table's cost we had in + join->best_read: + */ + partial_join_cost -= pos->read_time*fraction; + partial_join_cost -= pos->records_read*fraction * WHERE_COST_THD(join->thd); + + /* Add the cost of the new access method we've got: */ + partial_join_cost= COST_ADD(partial_join_cost, *first_table_cost); + } + } + else + { + DBUG_ASSERT(!first_table_cost); + /* + Cannot skip sorting. We read the first table entirely, then sort it. + + partial_join_cost includes pos->read_time*fraction. Add to it + pos->read_time*(1-fraction) so we have the cost to read the entire first + table. Do the same for costs of checking the WHERE. + */ + double extra_first_table_cost= pos->read_time * (1.0 - fraction); + double extra_first_table_where= pos->records_read * (1.0 - fraction) * + WHERE_COST_THD(join->thd); + + partial_join_cost= COST_ADD(partial_join_cost, + COST_ADD(extra_first_table_cost, + extra_first_table_where)); + } + return partial_join_cost; +} + + +/* + @brief + Finalize building the join order which allows to short-cut the join + execution. + + @detail + This is called after we have produced a join order that allows short- + cutting. + Here, we decide if it is cheaper to use this one or the original join + order. +*/ + +POSITION *join_limit_shortcut_finalize_plan(JOIN *join, double *cost) +{ + Json_writer_object wrapper(join->thd); + Json_writer_object trace(join->thd, "join_limit_shortcut_choice"); + + double fraction= join->select_limit / join->join_record_count; + trace.add("limit_fraction", fraction); + + /* Check which fraction of join output we need */ + if (fraction >= 1.0) + { + trace.add("skip_adjustment", "no short-cutting"); + return NULL; + } + + /* + Check if the first table's access method produces the required ordering. + Possible options: + 1. Yes: we can just take a fraction of the execution cost. + 2A No: change the access method to one that does produce the required + ordering, update the costs. + 2B No: Need to pass the first table to filesort(). + */ + bool skip_sorting; + bool access_method_changed; + double new_access_cost; + { + Json_writer_array tmp(join->thd, "test_if_skip_sort_order_early"); + skip_sorting= test_if_skip_sort_order_early(join, + &access_method_changed, + &new_access_cost); + } + trace.add("can_skip_filesort", skip_sorting); + + double cost_with_shortcut= + recompute_join_cost_with_limit(join, skip_sorting, + access_method_changed ? + &new_access_cost : (double*)0, + fraction); + double risk_ratio= + (double)join->thd->variables.optimizer_join_limit_pref_ratio; + trace.add("full_join_cost", join->best_read); + trace.add("risk_ratio", risk_ratio); + trace.add("shortcut_join_cost", cost_with_shortcut); + cost_with_shortcut *= risk_ratio; + trace.add("shortcut_cost_with_risk", cost_with_shortcut); + if (cost_with_shortcut < join->best_read) + { + trace.add("use_shortcut_cost", true); + POSITION *pos= (POSITION*)memdup_root(join->thd->mem_root, + join->best_positions, + sizeof(POSITION)* + (join->table_count + 1)); + *cost= cost_with_shortcut; + return pos; + } + trace.add("use_shortcut_cost", false); + return NULL; +} + + +/* + @brief + If we're in Limit Optimization Mode, allow only join->sort_by_table as + the first table in the join order +*/ + +static +bool join_limit_shortcut_limits_tables(const JOIN *join, uint idx, table_map *map) +{ + if (join->limit_optimization_mode && idx == join->const_tables) + { + *map= join->sort_by_table->map; + return true; + } + return false; +} + + /** Find a good, possibly optimal, query execution plan (QEP) by a possibly exhaustive search. @@ -11547,6 +11949,9 @@ best_extension_by_limited_search(JOIN *join, */ allowed_tables= remaining_tables; allowed_current_tables= join->get_allowed_nj_tables(idx) & remaining_tables; + table_map sort_table; + if (join_limit_shortcut_limits_tables(join, idx, &sort_table)) + allowed_current_tables= sort_table; } DBUG_ASSERT(allowed_tables & remaining_tables); @@ -16003,13 +16408,6 @@ void JOIN_TAB::cleanup() delete filesort->select; delete filesort; filesort= NULL; - /* Skip non-existing derived tables/views result tables */ - if (table && - (table->s->tmp_table != INTERNAL_TMP_TABLE || table->is_created())) - { - table->file->ha_end_keyread(); - table->file->ha_index_or_rnd_end(); - } if (table) { table->file->ha_end_keyread(); @@ -16018,8 +16416,7 @@ void JOIN_TAB::cleanup() else table->file->ha_index_or_rnd_end(); preread_init_done= FALSE; - if (table->pos_in_table_list && - table->pos_in_table_list->jtbm_subselect) + if (table->pos_in_table_list && table->pos_in_table_list->jtbm_subselect) { if (table->pos_in_table_list->jtbm_subselect->is_jtbm_const_tab) { @@ -26418,6 +26815,7 @@ find_field_in_item_list (Field *field, void *data) that belong to 'table' and are equal to 'item_field'. */ +static void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, Item_field *item_field, key_map *col_keys) @@ -26562,6 +26960,59 @@ static void prepare_for_reverse_ordered_access(JOIN_TAB *tab) } +/* + @brief + Given a table and order, find indexes that produce rows in the order + + @param usable_keys IN Bitmap of keys we can use + OUT Bitmap of indexes that produce rows in order. + + @return + false Some indexes were found + true No indexes found +*/ + +static +bool find_indexes_matching_order(JOIN *join, TABLE *table, ORDER *order, + key_map *usable_keys) +{ + /* Find indexes that cover all ORDER/GROUP BY fields */ + for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) + { + Item *item= (*tmp_order->item)->real_item(); + if (item->type() != Item::FIELD_ITEM) + { + usable_keys->clear_all(); + return true; /* No suitable keys */ + } + + /* + Take multiple-equalities into account. Suppose we have + ORDER BY col1, col10 + and there are + multiple-equal(col1, col2, col3), + multiple-equal(col10, col11). + + Then, + - when item=col1, we find the set of indexes that cover one of {col1, + col2, col3} + - when item=col10, we find the set of indexes that cover one of {col10, + col11} + + And we compute an intersection of these sets to find set of indexes that + cover all ORDER BY components. + */ + key_map col_keys; + compute_part_of_sort_key_for_equals(join, table, (Item_field*)item, + &col_keys); + usable_keys->intersect(col_keys); + if (usable_keys->is_clear_all()) + return true; // No usable keys + } + return false; + +} + /** Test if we can skip the ORDER BY by using an index. @@ -26623,41 +27074,17 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, been taken into account. */ usable_keys= *map; - - /* Find indexes that cover all ORDER/GROUP BY fields */ - for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) + + // Step #1: Find indexes that produce the required ordering. + if (find_indexes_matching_order(tab->join, table, order, &usable_keys)) { - Item *item= (*tmp_order->item)->real_item(); - if (item->type() != Item::FIELD_ITEM) - { - usable_keys.clear_all(); - DBUG_RETURN(0); - } - - /* - Take multiple-equalities into account. Suppose we have - ORDER BY col1, col10 - and there are - multiple-equal(col1, col2, col3), - multiple-equal(col10, col11). - - Then, - - when item=col1, we find the set of indexes that cover one of {col1, - col2, col3} - - when item=col10, we find the set of indexes that cover one of {col10, - col11} - - And we compute an intersection of these sets to find set of indexes that - cover all ORDER BY components. - */ - key_map col_keys; - compute_part_of_sort_key_for_equals(tab->join, table, (Item_field*)item, - &col_keys); - usable_keys.intersect(col_keys); - if (usable_keys.is_clear_all()) - goto use_filesort; // No usable keys + DBUG_RETURN(false); // Cannot skip sorting } + /* + Step #2: Analyze the current access method. Note the used index as ref_key + and #used keyparts in ref_key_parts. + */ ref_key= -1; /* Test if constant range in WHERE */ if (tab->ref.key >= 0 && tab->ref.key_parts) @@ -26701,6 +27128,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, } } + /* + Step #3: Check if index ref_key that we're using produces the required + ordering or if there is another index new_ref_key such that + - ref_key is a prefix of new_ref_key (so, access method can be reused) + - new_ref_key produces the required ordering + */ if (ref_key >= 0 && ref_key != MAX_KEY) { /* Current access method uses index ref_key with ref_key_parts parts */ @@ -26820,17 +27253,24 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, &used_key_parts))) goto check_reverse_order; } + + /* + Step #4: Go through all indexes that produce required ordering (in + usable_keys) and check if any of them is cheaper than ref_key + */ { uint UNINIT_VAR(best_key_parts); uint saved_best_key_parts= 0; int best_key_direction= 0; JOIN *join= tab->join; ha_rows table_records= table->stat_records(); + double new_read_time_dummy; - test_if_cheaper_ordering(tab, order, table, usable_keys, + test_if_cheaper_ordering(FALSE, tab, order, table, usable_keys, ref_key, select_limit, &best_key, &best_key_direction, - &select_limit, &best_key_parts, + &select_limit, &new_read_time_dummy, + &best_key_parts, &saved_best_key_parts); /* @@ -31346,6 +31786,18 @@ void st_select_lex::print_on_duplicate_key_clause(THD *thd, String *str, } } + +void st_select_lex::print_lock_type(String *str) +{ + if (select_lock == select_lock_type::IN_SHARE_MODE) + str->append(STRING_WITH_LEN(" lock in share mode")); + else if (select_lock == select_lock_type::FOR_UPDATE) + str->append(STRING_WITH_LEN(" for update")); + if (unlikely(skip_locked)) + str->append(STRING_WITH_LEN(" skip locked")); +} + + void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) { DBUG_ASSERT(thd); @@ -31617,12 +32069,9 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) print_limit(thd, str, query_type); // lock type - if (select_lock == select_lock_type::IN_SHARE_MODE) - str->append(STRING_WITH_LEN(" lock in share mode")); - else if (select_lock == select_lock_type::FOR_UPDATE) - str->append(STRING_WITH_LEN(" for update")); - if (unlikely(skip_locked)) - str->append(STRING_WITH_LEN(" skip locked")); + if (braces) /* no braces processed in + SELECT_LEX_UNIT::print_lock_from_the_last_select */ + print_lock_type(str); if ((sel_type == INSERT_CMD || sel_type == REPLACE_CMD) && thd->lex->update_list.elements) @@ -32077,11 +32526,13 @@ static bool get_range_limit_read_cost(const POSITION *pos, */ static bool -test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, +test_if_cheaper_ordering(bool in_join_optimizer, + const JOIN_TAB *tab, ORDER *order, TABLE *table, key_map usable_keys, int ref_key, ha_rows select_limit_arg, int *new_key, int *new_key_direction, - ha_rows *new_select_limit, uint *new_used_key_parts, + ha_rows *new_select_limit, double *new_read_time, + uint *new_used_key_parts, uint *saved_best_key_parts) { DBUG_ENTER("test_if_cheaper_ordering"); @@ -32155,7 +32606,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, if (join) // True if SELECT { - uint nr= (uint) (tab - join->join_tab); + uint nr= join->const_tables; fanout= 1.0; if (nr != join->table_count - 1) // If not last table fanout= (join->join_record_count / position->records_out); @@ -32182,12 +32633,27 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, Calculate the selectivity of the ref_key for REF_ACCESS. For RANGE_ACCESS we use table->opt_range_condition_rows. */ - if (ref_key >= 0 && ref_key != MAX_KEY && tab->type == JT_REF) + if (in_join_optimizer) + { + if (ref_key >= 0 && ref_key != MAX_KEY && + join->best_positions[join->const_tables].type == JT_REF) + { + refkey_rows_estimate= + (ha_rows)join->best_positions[join->const_tables].records_read; + set_if_bigger(refkey_rows_estimate, 1); + } + } + else if (ref_key >= 0 && ref_key != MAX_KEY && tab->type == JT_REF) { /* If ref access uses keypart=const for all its key parts, and quick select uses the same # of key parts, then they are equivalent. Reuse #rows estimate from quick select as it is more precise. + + Note: we could just have used + join->best_positions[join->const_tables].records_read + here. That number was computed in best_access_path() and it already + includes adjustments based on table->opt_range[ref_key].rows. */ if (tab->ref.const_ref_part_map == make_prev_keypart_map(tab->ref.key_parts) && @@ -32424,6 +32890,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table, *new_key= best_key; *new_key_direction= best_key_direction; *new_select_limit= has_limit ? best_select_limit : table_records; + *new_read_time= read_time; DBUG_RETURN(TRUE); } @@ -32522,10 +32989,11 @@ uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select, table->opt_range_condition_rows= table->stat_records(); int key, direction; - if (test_if_cheaper_ordering(NULL, order, table, + double new_cost; + if (test_if_cheaper_ordering(FALSE, NULL, order, table, table->keys_in_use_for_order_by, -1, limit, - &key, &direction, &limit) && + &key, &direction, &limit, &new_cost) && !is_key_used(table, key, table->write_set)) { *need_sort= FALSE; diff --git a/sql/sql_select.h b/sql/sql_select.h index 1f914172380..81d6992721a 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1295,6 +1295,20 @@ public: passing 1st non-const table to filesort(). NULL means no such table exists. */ TABLE *sort_by_table; + + /* + If true, there is ORDER BY x LIMIT n clause and for certain join orders, it + is possible to short-cut the join execution, i.e. stop it as soon as n + output rows were produced. See join_limit_shortcut_is_applicable(). + */ + bool limit_shortcut_applicable; + + /* + Used during join optimization: if true, we're building a join order that + will short-cut join execution as soon as #LIMIT rows are produced. + */ + bool limit_optimization_mode; + /* Number of tables in the join. (In MySQL, it is named 'tables' and is also the number of elements in diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d4490d925fa..fbf18d856cb 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -10058,7 +10058,7 @@ ST_FIELD_INFO stat_fields_info[]= Column("NON_UNIQUE", SLonglong(1),NOT_NULL, "Non_unique", OPEN_FRM_ONLY), Column("INDEX_SCHEMA", Name(), NOT_NULL, OPEN_FRM_ONLY), Column("INDEX_NAME", Name(), NOT_NULL, "Key_name", OPEN_FRM_ONLY), - Column("SEQ_IN_INDEX", SLonglong(2),NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), + Column("SEQ_IN_INDEX", ULong(2), NOT_NULL, "Seq_in_index",OPEN_FRM_ONLY), Column("COLUMN_NAME", Name(), NOT_NULL, "Column_name", OPEN_FRM_ONLY), Column("COLLATION", Varchar(1), NULLABLE, "Collation", OPEN_FULL_TABLE), Column("CARDINALITY", SLonglong(), NULLABLE, "Cardinality", OPEN_FULL_TABLE), diff --git a/sql/sql_table.cc b/sql/sql_table.cc index be2a17423f0..83f024ecece 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3940,6 +3940,33 @@ bool Column_definition::prepare_blob_field(THD *thd) { DBUG_ENTER("Column_definition::prepare_blob_field"); + if (real_field_type() == FIELD_TYPE_STRING && length > 1024) + { + DBUG_ASSERT(charset->mbmaxlen > 4); + /* + Convert long CHAR columns to VARCHAR. + CHAR has an octet length limit of 1024 bytes. + The code in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string + relies on this limit. If octet length of a CHAR column is greater + than 1024, then it cannot write its metadata to binlog properly. + In case of the filename character set with mbmaxlen=5, + the maximum possible character length is 1024/5=204 characters. + Upgrade to VARCHAR if octet length is greater than 1024. + */ + char warn_buff[MYSQL_ERRMSG_SIZE]; + if (thd->is_strict_mode()) + { + my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), field_name.str, + static_cast(1024 / charset->mbmaxlen)); + DBUG_RETURN(1); + } + set_handler(&type_handler_varchar); + my_snprintf(warn_buff, sizeof(warn_buff), ER_THD(thd, ER_AUTO_CONVERT), + field_name.str, "CHAR", "VARCHAR"); + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, + warn_buff); + } + if (length > MAX_FIELD_VARCHARLENGTH && !(flags & BLOB_FLAG)) { /* Convert long VARCHAR columns to TEXT or BLOB */ @@ -9254,18 +9281,20 @@ static Create_field *get_field_by_old_name(Alter_info *alter_info, enum fk_column_change_type { FK_COLUMN_NO_CHANGE, FK_COLUMN_DATA_CHANGE, - FK_COLUMN_RENAMED, FK_COLUMN_DROPPED + FK_COLUMN_RENAMED, FK_COLUMN_DROPPED, FK_COLUMN_NOT_NULL }; /** Check that ALTER TABLE's changes on columns of a foreign key are allowed. @param[in] thd Thread context. + @param[in] table table to be altered @param[in] alter_info Alter_info describing changes to be done by ALTER TABLE. - @param[in] fk_columns List of columns of the foreign key to check. + @param[in] fk Foreign key information. @param[out] bad_column_name Name of field on which ALTER TABLE tries to do prohibited operation. + @param[in] referenced Check the referenced fields @note This function takes into account value of @@foreign_key_checks setting. @@ -9276,17 +9305,27 @@ enum fk_column_change_type change in foreign key column. @retval FK_COLUMN_RENAMED Foreign key column is renamed. @retval FK_COLUMN_DROPPED Foreign key column is dropped. + @retval FK_COLUMN_NOT_NULL Foreign key column cannot be null + if ON...SET NULL or ON UPDATE + CASCADE conflicts with NOT NULL */ static enum fk_column_change_type -fk_check_column_changes(THD *thd, Alter_info *alter_info, - List &fk_columns, - const char **bad_column_name) +fk_check_column_changes(THD *thd, const TABLE *table, + Alter_info *alter_info, + FOREIGN_KEY_INFO *fk, + const char **bad_column_name, + bool referenced=false) { + List &fk_columns= referenced + ? fk->referenced_fields + : fk->foreign_fields; List_iterator_fast column_it(fk_columns); LEX_CSTRING *column; + int n_col= 0; *bad_column_name= NULL; + enum fk_column_change_type result= FK_COLUMN_NO_CHANGE; while ((column= column_it++)) { @@ -9304,8 +9343,8 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, SE that foreign keys should be updated to use new name of column like it happens in case of in-place algorithm. */ - *bad_column_name= column->str; - return FK_COLUMN_RENAMED; + result= FK_COLUMN_RENAMED; + goto func_exit; } /* @@ -9318,17 +9357,55 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, new_field->flags&= ~AUTO_INCREMENT_FLAG; const bool equal_result= old_field->is_equal(*new_field); new_field->flags= flags; + const bool old_field_not_null= old_field->flags & NOT_NULL_FLAG; + const bool new_field_not_null= new_field->flags & NOT_NULL_FLAG; - if ((equal_result == IS_EQUAL_NO) || - ((new_field->flags & NOT_NULL_FLAG) && - !(old_field->flags & NOT_NULL_FLAG))) + if ((equal_result == IS_EQUAL_NO)) { /* Column in a FK has changed significantly and it may break referential intergrity. */ - *bad_column_name= column->str; - return FK_COLUMN_DATA_CHANGE; + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + + if (old_field_not_null != new_field_not_null) + { + if (referenced && !new_field_not_null) + { + /* + Don't allow referenced column to change from + NOT NULL to NULL when foreign key relation is + ON UPDATE CASCADE and the referencing column + is declared as NOT NULL + */ + if (fk->update_method == FK_OPTION_CASCADE && + !fk->is_nullable(false, n_col)) + { + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + } + else if (!referenced && new_field_not_null) + { + /* + Don't allow the foreign column to change + from NULL to NOT NULL when foreign key type is + 1) UPDATE SET NULL + 2) DELETE SET NULL + 3) UPDATE CASCADE and referenced column is declared as NULL + */ + if (fk->update_method == FK_OPTION_SET_NULL || + fk->delete_method == FK_OPTION_SET_NULL || + (fk->update_method == FK_OPTION_CASCADE && + fk->referenced_key_name && + fk->is_nullable(true, n_col))) + { + result= FK_COLUMN_NOT_NULL; + goto func_exit; + } + } } } else @@ -9342,12 +9419,15 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, field being dropped since it is easy to break referential integrity in this case. */ - *bad_column_name= column->str; - return FK_COLUMN_DROPPED; + result= FK_COLUMN_DROPPED; + goto func_exit; } + n_col++; } - return FK_COLUMN_NO_CHANGE; +func_exit: + *bad_column_name= column->str; + return result; } @@ -9436,9 +9516,8 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->referenced_fields, - &bad_column_name); + changes= fk_check_column_changes(thd, table, alter_info, f_key, + &bad_column_name, true); switch(changes) { @@ -9472,6 +9551,9 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, f_key->foreign_id->str, buff.c_ptr()); DBUG_RETURN(true); } + /* FK_COLUMN_NOT_NULL error happens only when changing + the foreign key column from NULL to NOT NULL */ + case FK_COLUMN_NOT_NULL: default: DBUG_ASSERT(0); } @@ -9509,8 +9591,7 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->foreign_fields, + changes= fk_check_column_changes(thd, table, alter_info, f_key, &bad_column_name); switch(changes) @@ -9532,6 +9613,10 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), bad_column_name, f_key->foreign_id->str); DBUG_RETURN(true); + case FK_COLUMN_NOT_NULL: + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), bad_column_name, + f_key->foreign_id->str); + DBUG_RETURN(true); default: DBUG_ASSERT(0); } @@ -10075,7 +10160,7 @@ bool online_alter_check_autoinc(const THD *thd, const Alter_info *alter_info, } static -const char *online_alter_check_supported(const THD *thd, +const char *online_alter_check_supported(THD *thd, const Alter_info *alter_info, const TABLE *table, const TABLE *new_table, bool *online) diff --git a/sql/sql_type.cc b/sql/sql_type.cc index be9a4133219..9f2ab865621 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -9426,6 +9426,7 @@ Type_handler_timestamp_common::Item_val_native_with_conversion(THD *thd, Datetime dt(thd, item, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)); return !dt.is_valid_datetime() || + dt.check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE) || TIME_to_native(thd, dt.get_mysql_time(), to, item->datetime_precision(thd)); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 2b55fb75bed..26dad7946da 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -469,6 +469,12 @@ bool Sql_cmd_update::update_single_table(THD *thd) if (thd->binlog_for_noop_dml(transactional_table)) DBUG_RETURN(1); + if (!thd->lex->current_select->leaf_tables_saved) + { + thd->lex->current_select->save_leaf_tables(thd); + thd->lex->current_select->leaf_tables_saved= true; + } + my_ok(thd); // No matching records DBUG_RETURN(0); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1dfed65c776..957f5f13307 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1347,7 +1347,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TEXT_STRING NCHAR_STRING json_text_literal - json_text_literal_or_num %type opt_table_alias_clause @@ -1552,6 +1551,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); simple_target_specification condition_number opt_versioning_interval_start + json_default_literal set_expr_misc %type opt_vers_auto_part @@ -11526,40 +11526,13 @@ table_ref: json_text_literal: TEXT_STRING - { - Lex->json_table->m_text_literal_cs= NULL; - } | NCHAR_STRING - { - Lex->json_table->m_text_literal_cs= national_charset_info; - } | UNDERSCORE_CHARSET TEXT_STRING { - Lex->json_table->m_text_literal_cs= $1; $$= $2; } ; -json_text_literal_or_num: - json_text_literal - | NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | LONG_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | DECIMAL_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | FLOAT_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - ; - join_table_list: derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } ; @@ -11668,6 +11641,12 @@ json_opt_on_empty_or_error: | json_on_empty_response json_on_error_response ; +json_default_literal: + literal + | signed_literal + ; + + json_on_response: ERROR_SYM { @@ -11677,12 +11656,10 @@ json_on_response: { $$.m_response= Json_table_column::RESPONSE_NULL; } - | DEFAULT json_text_literal_or_num + | DEFAULT json_default_literal { $$.m_response= Json_table_column::RESPONSE_DEFAULT; $$.m_default= $2; - Lex->json_table->m_cur_json_table_column->m_defaults_cs= - thd->variables.collation_connection; } ; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 11a5d520b8c..10b2c66b0bc 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2177,15 +2177,6 @@ struct gtid_binlog_state_data { rpl_gtid *list; uint32 list_len; }; bool Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) { - String str, *res; - struct gtid_binlog_state_data *data; - rpl_gtid *list; - uint32 list_len; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!(res= var->value->val_str(&str))) - return true; if (thd->in_active_multi_stmt_transaction()) { my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0)); @@ -2201,6 +2192,31 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) my_error(ER_BINLOG_MUST_BE_EMPTY, MYF(0)); return true; } + return false; +} + + +bool +Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) +{ + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!var->value) + { + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); + return true; + } + + bool result; + String str, *res; + struct gtid_binlog_state_data *data; + rpl_gtid *list; + uint32 list_len; + + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!(res= var->value->val_str(&str))) + return true; if (res->length() == 0) { list= NULL; @@ -2222,31 +2238,13 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) data->list= list; data->list_len= list_len; var->save_result.ptr= data; - return false; -} - - -bool -Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) -{ - bool res; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!var->value) - { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); - return true; - } - - struct gtid_binlog_state_data *data= - (struct gtid_binlog_state_data *)var->save_result.ptr; + mysql_mutex_unlock(&LOCK_global_system_variables); - res= (reset_master(thd, data->list, data->list_len, 0) != 0); + result= (reset_master(thd, data->list, data->list_len, 0) != 0); mysql_mutex_lock(&LOCK_global_system_variables); my_free(data->list); my_free(data); - return res; + return result; } @@ -2905,6 +2903,20 @@ static Sys_var_ulong Sys_optimizer_selectivity_sampling_limit( VALID_RANGE(SELECTIVITY_SAMPLING_THRESHOLD, UINT_MAX), DEFAULT(SELECTIVITY_SAMPLING_LIMIT), BLOCK_SIZE(1)); +static Sys_var_ulonglong Sys_optimizer_join_limit_pref_ratio( + "optimizer_join_limit_pref_ratio", + "For queries with JOIN and ORDER BY LIMIT : make the optimizer " + "consider a join order that allows to short-cut execution after " + "producing #LIMIT matches if that promises N times speedup. " + "(A conservative setting here would be is a high value, like 100 so " + "the short-cutting plan is used if it promises a speedup of 100x or " + "more). Short-cutting plans are inherently risky so the default is 0 " + "which means do not consider this optimization", + SESSION_VAR(optimizer_join_limit_pref_ratio), + CMD_LINE(REQUIRED_ARG), + VALID_RANGE(0, UINT_MAX), + DEFAULT(0), BLOCK_SIZE(1)); + static Sys_var_ulong Sys_optimizer_use_condition_selectivity( "optimizer_use_condition_selectivity", "Controls selectivity of which conditions the optimizer takes into " @@ -4214,7 +4226,8 @@ static Sys_var_on_access_global Sys_threadpool_mode( "thread_pool_mode", - "Chose implementation of the threadpool", + "Chose implementation of the threadpool. Use 'windows' unless you have a " + "workload with a lot of concurrent connections and minimal contention", READ_ONLY GLOBAL_VAR(threadpool_mode), CMD_LINE(REQUIRED_ARG), threadpool_mode_names, DEFAULT(TP_MODE_WINDOWS) ); diff --git a/sql/table.cc b/sql/table.cc index a50403da941..b5d96aa725e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -296,17 +296,6 @@ const char *fn_frm_ext(const char *name) TABLE_CATEGORY get_table_category(const Lex_ident_db &db, const Lex_ident_table &name) { -#ifdef WITH_WSREP - if (db.str && db.streq(MYSQL_SCHEMA_NAME)) - { - if (name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_STREAMING_TABLE)}) || - name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}) || - name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_MEMBERS_TABLE)})) - { - return TABLE_CATEGORY_INFORMATION; - } - } -#endif /* WITH_WSREP */ if (is_infoschema_db(&db)) return TABLE_CATEGORY_INFORMATION; @@ -329,6 +318,20 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db, return TABLE_CATEGORY_MYSQL; } +#ifdef WITH_WSREP + if (db.streq(WSREP_LEX_SCHEMA)) + { + if(name.streq(WSREP_LEX_STREAMING)) + return TABLE_CATEGORY_INFORMATION; + if (name.streq(WSREP_LEX_CLUSTER)) + return TABLE_CATEGORY_INFORMATION; + if (name.streq(WSREP_LEX_MEMBERS)) + return TABLE_CATEGORY_INFORMATION; + if (name.streq(WSREP_LEX_ALLOWLIST)) + return TABLE_CATEGORY_INFORMATION; + } +#endif /* WITH_WSREP */ + return TABLE_CATEGORY_USER; } diff --git a/sql/table.h b/sql/table.h index 525a67879bf..4107493aa76 100644 --- a/sql/table.h +++ b/sql/table.h @@ -36,6 +36,7 @@ #include "sql_i_s.h" #include "sql_type.h" /* vers_kind_t */ #include "privilege.h" /* privilege_t */ +#include "my_bit.h" /* Buffer for unix timestamp in microseconds: @@ -2012,6 +2013,70 @@ typedef struct st_foreign_key_info LEX_CSTRING *referenced_key_name; List foreign_fields; List referenced_fields; +private: + unsigned char *fields_nullable= nullptr; + + /** + Get the number of fields exist in foreign key relationship + */ + unsigned get_n_fields() const noexcept + { + unsigned n_fields= foreign_fields.elements; + if (n_fields == 0) + n_fields= referenced_fields.elements; + return n_fields; + } + + /** + Assign nullable field for referenced and foreign fields + based on number of fields. This nullable fields + should be allocated by engine for passing the + foreign key information + @param thd thread to allocate the memory + @param num_fields number of fields + */ + void assign_nullable(THD *thd, unsigned num_fields) noexcept + { + fields_nullable= + (unsigned char *)thd_calloc(thd, + my_bits_in_bytes(2 * num_fields)); + } + +public: + /** + Set nullable bit for the field in the given field + @param referenced set null bit for referenced column + @param field field number + @param n_fields number of fields + */ + void set_nullable(THD *thd, bool referenced, + unsigned field, unsigned n_fields) noexcept + { + if (!fields_nullable) + assign_nullable(thd, n_fields); + DBUG_ASSERT(fields_nullable); + DBUG_ASSERT(field < n_fields); + size_t bit= size_t{field} + referenced * n_fields; + fields_nullable[bit / 8]|= (unsigned char)(1 << (bit % 8)); + } + + /** + Check whether the given field_no in foreign key field or + referenced key field + @param referenced check referenced field nullable value + @param field field number + @return true if the field is nullable or false if it is not + */ + bool is_nullable(bool referenced, unsigned field) const noexcept + { + if (!fields_nullable) + return false; + unsigned n_field= get_n_fields(); + DBUG_ASSERT(field < n_field); + size_t bit= size_t{field} + referenced * n_field; + return fields_nullable[bit / 8] & (1 << (bit % 8)); + } + } FOREIGN_KEY_INFO; LEX_CSTRING *fk_option_name(enum_fk_option opt); diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 22730550d1b..0e45c6757f1 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -304,7 +304,7 @@ static THD *threadpool_add_connection(CONNECT *connect, TP_connection *c) if (!mysys_var ||!(thd= connect->create_thd(NULL))) { /* Out of memory? */ - connect->close_and_delete(); + connect->close_and_delete(0); if (mysys_var) my_thread_end(); return NULL; @@ -497,7 +497,7 @@ static void tp_add_connection(CONNECT *connect) if (c) pool->add(c); else - connect->close_and_delete(); + connect->close_and_delete(0); } int tp_get_idle_thread_count() diff --git a/sql/uniques.cc b/sql/uniques.cc index 8d05efe46a7..a47403dfd76 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -90,8 +90,10 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, if (min_dupl_count_arg) full_size+= sizeof(element_count); with_counters= MY_TEST(min_dupl_count_arg); - init_tree(&tree, (max_in_memory_size / 16), 0, size, comp_func, - NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC)); + + init_tree(&tree, MY_MIN(max_in_memory_size / 16, UINT_MAX32), + 0, size, comp_func, NULL, comp_func_fixed_arg, + MYF(MY_THREAD_SPECIFIC)); /* If the following fail's the next add will also fail */ my_init_dynamic_array(PSI_INSTRUMENT_ME, &file_ptrs, sizeof(Merge_chunk), 16, 16, MYF(MY_THREAD_SPECIFIC)); diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index eee9dc02319..2dc6f47d06b 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -82,7 +82,9 @@ wsrep_get_apply_format(THD* thd) return thd->wsrep_rgi->rli->relay_log.description_event_for_exec; } -void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst) +void wsrep_store_error(const THD* const thd, + wsrep::mutable_buffer& dst, + bool const include_msg) { Diagnostics_area::Sql_condition_iterator it= thd->get_stmt_da()->sql_conditions(); @@ -100,8 +102,16 @@ void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst) uint const err_code= cond->get_sql_errno(); const char* const err_str= cond->get_message_text(); - slider+= my_snprintf(slider, buf_end - slider, " %s, Error_code: %d;", - err_str, err_code); + if (include_msg) + { + slider+= snprintf(slider, buf_end - slider, " %s, Error_code: %d;", + err_str, err_code); + } + else + { + slider+= snprintf(slider, buf_end - slider, " Error_code: %d;", + err_code); + } } if (slider != dst.data()) diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h index fefca306a70..e633b1b9bf2 100644 --- a/sql/wsrep_applier.h +++ b/sql/wsrep_applier.h @@ -35,7 +35,21 @@ int wsrep_apply_events(THD* thd, #define WSREP_ERR_FAILED 6 // Operation failed for some internal reason #define WSREP_ERR_ABORTED 7 // Operation was aborted externally -void wsrep_store_error(const THD* thd, wsrep::mutable_buffer& buf); +/* Loops over THD diagnostic area and concatenates all error messages + * and error codes to a single continuous buffer to create a unique + * but consistent failure signature which provider can use for voting + * between the nodes in the cluster. + * + * @param thd THD context + * @param dst buffer to store the signature + * @param include_msg whether to use MySQL error message in addition to + * MySQL error code. Note that in the case of a TOI + * operation the message may be not consistent between + * the nodes e.g. due to a different client locale setting + * and should be omitted */ +void wsrep_store_error(const THD* thd, + wsrep::mutable_buffer& buf, + bool include_msg); class Format_description_log_event; void wsrep_set_apply_format(THD*, Format_description_log_event*); diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 8c301267059..49fbde865b4 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -124,14 +124,15 @@ static void wsrep_setup_uk_and_fk_checks(THD* thd) static int apply_events(THD* thd, Relay_log_info* rli, const wsrep::const_buffer& data, - wsrep::mutable_buffer& err) + wsrep::mutable_buffer& err, + bool const include_msg) { int const ret= wsrep_apply_events(thd, rli, data.data(), data.size()); if (ret || wsrep_thd_has_ignored_error(thd)) { if (ret) { - wsrep_store_error(thd, err); + wsrep_store_error(thd, err, include_msg); } wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size()); } @@ -392,6 +393,18 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle, wsrep_thd_transaction_state_str(m_thd), m_thd->killed); +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_rollback_mdl_release", + { + const char act[]= + "now " + "SIGNAL sync.wsrep_rollback_mdl_release_reached " + "WAIT_FOR signal.wsrep_rollback_mdl_release"; + DBUG_ASSERT(!debug_sync_set_action(m_thd, + STRING_WITH_LEN(act))); + };); +#endif + m_thd->release_transactional_locks(); free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC)); @@ -428,7 +441,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, #endif thd->set_time(); - int ret= apply_events(thd, m_rli, data, err); + int ret= apply_events(thd, m_rli, data, err, false); wsrep_thd_set_ignored_error(thd, false); trans_commit(thd); @@ -596,7 +609,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, #endif /* ENABLED_DEBUG_SYNC */ wsrep_setup_uk_and_fk_checks(thd); - int ret= apply_events(thd, m_rli, data, err); + int ret= apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) @@ -765,7 +778,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, ws_meta, thd->wsrep_sr().fragments()); } - ret= ret || apply_events(thd, m_rli, data, err); + ret= ret || apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) { diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 7b7548e1752..7440d292bad 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -270,8 +270,8 @@ static char provider_vendor[256]= { 0, }; * Wsrep status variables. LOCK_status must be locked When modifying * these variables, */ +std::atomic wsrep_ready(false); my_bool wsrep_connected = FALSE; -my_bool wsrep_ready = FALSE; const char* wsrep_cluster_state_uuid= cluster_uuid_str; long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED; const char* wsrep_cluster_status = "Disconnected"; @@ -577,10 +577,7 @@ void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid, */ my_bool wsrep_ready_get (void) { - if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); - my_bool ret= wsrep_ready; - mysql_mutex_unlock (&LOCK_wsrep_ready); - return ret; + return wsrep_ready; } int wsrep_show_ready(THD *thd, SHOW_VAR *var, void *buff, @@ -2905,7 +2902,10 @@ static void wsrep_TOI_end(THD *thd) { if (thd->is_error() && !wsrep_must_ignore_error(thd)) { - wsrep_store_error(thd, err); + /* use only error code, for the message can be inconsistent + * between the nodes due to differing lc_message settings + * in client session and server applier thread */ + wsrep_store_error(thd, err, false); } int const ret= client_state.leave_toi_local(err); @@ -3211,8 +3211,13 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, mysql_mutex_lock(&granted_thd->LOCK_thd_kill); mysql_mutex_lock(&granted_thd->LOCK_thd_data); - if (wsrep_thd_is_toi(granted_thd) || - wsrep_thd_is_applying(granted_thd)) + if (granted_thd->wsrep_aborter != 0) + { + DBUG_ASSERT(granted_thd->wsrep_aborter == request_thd->thread_id); + WSREP_DEBUG("BF thread waiting for a victim to release locks"); + } + else if (wsrep_thd_is_toi(granted_thd) || + wsrep_thd_is_applying(granted_thd)) { if (wsrep_thd_is_aborting(granted_thd)) { @@ -3302,6 +3307,7 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, } mysql_mutex_unlock(&granted_thd->LOCK_thd_data); mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); + DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } else { @@ -3907,6 +3913,10 @@ bool wsrep_consistency_check(THD *thd) // Wait until wsrep has reached ready state void wsrep_wait_ready(THD *thd) { + // First check not locking the mutex. + if (wsrep_ready) + return; + mysql_mutex_lock(&LOCK_wsrep_ready); while(!wsrep_ready) { diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 14ea07f4ea6..183dc65b007 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -147,7 +147,6 @@ extern const char *wsrep_SR_store_types[]; // MySQL status variables extern my_bool wsrep_connected; -extern my_bool wsrep_ready; extern const char* wsrep_cluster_state_uuid; extern long long wsrep_cluster_conf_id; extern const char* wsrep_cluster_status; diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 05eb1eeb7fa..e7b3a8580c3 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2022 Codership Oy +/* Copyright (C) 2015-2023 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 @@ -35,6 +35,18 @@ #include #include +#define WSREP_SCHEMA "mysql" +#define WSREP_STREAMING_TABLE "wsrep_streaming_log" +#define WSREP_CLUSTER_TABLE "wsrep_cluster" +#define WSREP_MEMBERS_TABLE "wsrep_cluster_members" +#define WSREP_ALLOWLIST_TABLE "wsrep_allowlist" + +LEX_CSTRING WSREP_LEX_SCHEMA= {STRING_WITH_LEN(WSREP_SCHEMA)}; +LEX_CSTRING WSREP_LEX_STREAMING= {STRING_WITH_LEN(WSREP_STREAMING_TABLE)}; +LEX_CSTRING WSREP_LEX_CLUSTER= {STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}; +LEX_CSTRING WSREP_LEX_MEMBERS= {STRING_WITH_LEN(WSREP_MEMBERS_TABLE)}; +LEX_CSTRING WSREP_LEX_ALLOWLIST= {STRING_WITH_LEN(WSREP_ALLOWLIST_TABLE)}; + const char* wsrep_sr_table_name_full= WSREP_SCHEMA "/" WSREP_STREAMING_TABLE; static const std::string wsrep_schema_str= WSREP_SCHEMA; diff --git a/sql/wsrep_schema.h b/sql/wsrep_schema.h index 81816bbc243..c9004d076bd 100644 --- a/sql/wsrep_schema.h +++ b/sql/wsrep_schema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2019 Codership Oy +/* Copyright (C) 2015-2023 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 @@ -33,12 +33,6 @@ struct TABLE_LIST; struct st_mysql_lex_string; typedef struct st_mysql_lex_string LEX_STRING; -#define WSREP_SCHEMA "mysql" -#define WSREP_STREAMING_TABLE "wsrep_streaming_log" -#define WSREP_CLUSTER_TABLE "wsrep_cluster" -#define WSREP_MEMBERS_TABLE "wsrep_cluster_members" -#define WSREP_ALLOWLIST_TABLE "wsrep_allowlist" - /** Name of the table in `wsrep_schema_str` used for storing streaming replication data. In an InnoDB full format, e.g. "database/tablename". */ extern const char* wsrep_sr_table_name_full; @@ -169,4 +163,10 @@ class Wsrep_schema extern Wsrep_schema* wsrep_schema; +extern LEX_CSTRING WSREP_LEX_SCHEMA; +extern LEX_CSTRING WSREP_LEX_STREAMING; +extern LEX_CSTRING WSREP_LEX_CLUSTER; +extern LEX_CSTRING WSREP_LEX_MEMBERS; +extern LEX_CSTRING WSREP_LEX_ALLOWLIST; + #endif /* !WSREP_SCHEMA_H */ diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 71252c94399..5717c5af997 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -166,9 +166,16 @@ void Wsrep_server_service::bootstrap() wsrep_set_SE_checkpoint(wsrep::gtid::undefined(), wsrep_gtid_server.undefined()); } +static std::atomic suppress_logging{false}; +void wsrep_suppress_error_logging() { suppress_logging= true; } + void Wsrep_server_service::log_message(enum wsrep::log::level level, - const char* message) + const char *message) { + if (suppress_logging.load(std::memory_order_relaxed)) + { + return; + } switch (level) { case wsrep::log::debug: diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h index 3a7da229cd4..9a1e148b55f 100644 --- a/sql/wsrep_server_service.h +++ b/sql/wsrep_server_service.h @@ -99,4 +99,8 @@ class Wsrep_storage_service; Wsrep_storage_service* wsrep_create_storage_service(THD *orig_thd, const char *ctx); +/** + Suppress all error logging from wsrep/Galera library. + */ +void wsrep_suppress_error_logging(); #endif /* WSREP_SERVER_SERVICE */ diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index f80320fe216..7bfe0d6c081 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -21,6 +21,8 @@ #include "wsrep_binlog.h" /* init/deinit group commit */ #include "wsrep_plugin.h" /* make/destroy sysvar helpers */ +#include "my_stacktrace.h" /* my_safe_printf_stderr() */ + mysql_mutex_t LOCK_wsrep_server_state; mysql_cond_t COND_wsrep_server_state; @@ -154,3 +156,23 @@ void Wsrep_server_state::deinit_provider_services() m_provider_services= wsrep::provider::services(); } +void Wsrep_server_state::handle_fatal_signal() +{ + if (m_instance && m_instance->is_provider_loaded()) + { + /* Galera background threads are still running and the logging may be + relatively verbose in case of networking error. Silence all wsrep + logging before shutting down networking to avoid garbling signal + handler output. */ + my_safe_printf_stderr("WSREP: Suppressing further logging\n"); + wsrep_suppress_error_logging(); + + /* Shut down all communication with other nodes to fail silently. */ + my_safe_printf_stderr("WSREP: Shutting down network communications\n"); + if (m_instance->provider().set_node_isolation( + wsrep::provider::node_isolation::isolated)) { + my_safe_printf_stderr("WSREP: Galera library does not support node isolation\n"); + } + my_safe_printf_stderr("\n"); + } +} diff --git a/sql/wsrep_server_state.h b/sql/wsrep_server_state.h index d169e5b219d..91e9c34b764 100644 --- a/sql/wsrep_server_state.h +++ b/sql/wsrep_server_state.h @@ -74,6 +74,8 @@ public: return m_provider_services; } + static void handle_fatal_signal(); + private: Wsrep_server_state(const std::string& name, const std::string& incoming_address, diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index cbd901237aa..7097853e61b 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -657,8 +657,8 @@ static void* sst_joiner_thread (void* a) if (!tmp || strlen(tmp) < (magic_len + 2) || strncasecmp (tmp, magic, magic_len)) { - WSREP_ERROR("Failed to read '%s ' from: %s\n\tRead: '%s'", - magic, arg->cmd, tmp); + WSREP_ERROR("Failed to read '%s ' (got '%s') from: %s", + magic, tmp, arg->cmd); proc.wait(); if (proc.error()) err= proc.error(); } @@ -670,8 +670,8 @@ static void* sst_joiner_thread (void* a) else { err= proc.error(); - WSREP_ERROR("Failed to execute: %s : %d (%s)", - arg->cmd, err, strerror(err)); + WSREP_ERROR("Failed to execute (%M): %s", + err, arg->cmd); } /* @@ -2160,7 +2160,8 @@ wait_signal: else { WSREP_WARN("Received unknown signal: '%s'", out); - err = -EINVAL; + /* since it is the end of the loop, we must set error code */ + err=-EINVAL; proc.wait(); } } diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index 4e831489b71..93065847c5c 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -47,6 +47,7 @@ SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}") IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + SET(PCRE_INCLUDES "${PCRE_INCLUDE_DIRS}") add_subdirectory(columnstore) IF(TARGET columnstore) diff --git a/storage/connect/mysql-test/connect/t/bson_udf.test b/storage/connect/mysql-test/connect/t/bson_udf.test index 155b8514522..4570265362b 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf.test +++ b/storage/connect/mysql-test/connect/t/bson_udf.test @@ -19,7 +19,10 @@ SELECT BsonValue(9223372036854775807); SELECT BsonValue(NULL); SELECT BsonValue(TRUE); SELECT BsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT BsonValue(); +--enable_cursor_protocol SELECT BsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Bson_Make_Array(); diff --git a/storage/connect/mysql-test/connect/t/json_udf.test b/storage/connect/mysql-test/connect/t/json_udf.test index 3e5ebede92c..9d85c359740 100644 --- a/storage/connect/mysql-test/connect/t/json_udf.test +++ b/storage/connect/mysql-test/connect/t/json_udf.test @@ -19,7 +19,10 @@ SELECT JsonValue(9223372036854775807); SELECT JsonValue(NULL); SELECT JsonValue(TRUE); SELECT JsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT JsonValue(); +--enable_cursor_protocol SELECT JsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Json_Make_Array(); @@ -60,7 +63,10 @@ SELECT Json_Make_Object(56, 3.1416, 'foo', NULL); SELECT Json_Make_Object(56 qty, 3.1416 price, 'foo' truc, NULL garanty); SELECT Json_Make_Object(); SELECT Json_Make_Object(Json_Make_Array(56, 3.1416, 'foo'), NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT Json_Make_Array(Json_Make_Object(56 "qty", 3.1416 "price", 'foo') ,NULL); +--enable_cursor_protocol SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty', NULL); --error ER_CANT_INITIALIZE_UDF SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty'); diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 037a465af13..05799cb3d87 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -93,7 +93,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) char sep, q; int rc, mxr; bool hdr; - char *p, *colname[MAXCOL], dechar, buf[8]; + char *p, *colname[MAXCOL], dechar, buf[16]; int i, imax, hmax, n, nerr, phase, blank, digit, dec, type; int ncol = sizeof(buftyp) / sizeof(int); int num_read = 0, num_max = 10000000; // Statistics diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 587d0ef3059..af2a8b69d5f 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -333,7 +333,7 @@ static int read_meta_file(File meta_file, ha_rows *rows) /* check crashed bit and magic number */ if ((meta_buffer[0] != (uchar)TINA_CHECK_HEADER) || ((bool)(*ptr)== TRUE)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE); mysql_file_sync(meta_file, MYF(MY_WME)); @@ -974,7 +974,7 @@ int ha_tina::open(const char *name, int mode, uint open_options) if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR)) { free_share(share); - DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno); } local_data_file_version= share->data_file_version; diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 44e9db84be4..76b7f249674 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -195,15 +195,13 @@ bool btr_root_fseg_validate(ulint offset, const buf_block_t &block, return false; } -/** Report a decryption failure. */ -ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index) +/** Report a read failure if it is a decryption failure. +@param err error code +@param index the index that is being accessed */ +ATTRIBUTE_COLD void btr_read_failed(dberr_t err, const dict_index_t &index) { - ib_push_warning(static_cast(nullptr), DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - index.table->name.m_name); - index.table->file_unreadable= true; + if (err == DB_DECRYPTION_FAILED) + innodb_decryption_failed(nullptr, index.table); } /** Get an index page and declare its latching order level. @@ -242,8 +240,8 @@ buf_block_t *btr_block_get(const dict_index_t &index, else if (!buf_page_make_young_if_needed(&block->page) && first) *first= true; } - else if (*err == DB_DECRYPTION_FAILED) - btr_decryption_failed(index); + else + btr_read_failed(*err, index); return block; } @@ -304,8 +302,8 @@ btr_root_block_get( else buf_page_make_young_if_needed(&block->page); } - else if (*err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index); + else + btr_read_failed(*err, *index); return block; } @@ -1126,7 +1124,7 @@ void btr_drop_temporary_table(const dict_table_t &table) { if (buf_block_t *block= buf_page_get_gen({SRV_TMP_SPACE_ID, index->page}, 0, RW_X_LATCH, nullptr, BUF_GET, - &mtr, nullptr, nullptr)) + &mtr, nullptr)) { btr_free_but_not_root(block, MTR_LOG_NO_REDO); mtr.set_log_mode(MTR_LOG_NO_REDO); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 461976497f5..53ed85f4bda 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -926,24 +926,21 @@ static inline page_cur_mode_t btr_cur_nonleaf_mode(page_cur_mode_t mode) MY_ATTRIBUTE((nonnull,warn_unused_result)) /** Acquire a latch on the previous page without violating the latching order. -@param block index page -@param page_id page identifier with valid space identifier -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param rw_latch the latch on block (RW_S_LATCH or RW_X_LATCH) -@param mtr mini-transaction +@param page_id page identifier with valid space identifier @param err error code +@param mtr mini-transaction @retval 0 if an error occurred @retval 1 if the page could be latched in the wrong order @retval -1 if the latch on block was temporarily released */ -static int btr_latch_prev(buf_block_t *block, page_id_t page_id, - ulint zip_size, - rw_lock_type_t rw_latch, mtr_t *mtr, dberr_t *err) +static int btr_latch_prev(rw_lock_type_t rw_latch, + page_id_t page_id, dberr_t *err, mtr_t *mtr) { ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); - ut_ad(page_id.space() == block->page.id().space()); - const auto prev_savepoint= mtr->get_savepoint(); - ut_ad(block == mtr->at_savepoint(prev_savepoint - 1)); + buf_block_t *block= mtr->at_savepoint(mtr->get_savepoint() - 1); + + ut_ad(page_id.space() == block->page.id().space()); const page_t *const page= block->page.frame; page_id.set_page_no(btr_page_get_prev(page)); @@ -959,68 +956,78 @@ static int btr_latch_prev(buf_block_t *block, page_id_t page_id, buffer-fixes on both blocks will prevent eviction. */ retry: - /* Pass no_wait pointer to ensure that we don't wait on the current page - latch while holding the next page latch to avoid latch ordering violation. */ - bool no_wait= false; int ret= 1; - - buf_block_t *prev= buf_page_get_gen(page_id, zip_size, RW_NO_LATCH, nullptr, - BUF_GET, mtr, err, &no_wait); + buf_block_t *prev= buf_pool.page_fix(page_id, err, buf_pool_t::FIX_NOWAIT); if (UNIV_UNLIKELY(!prev)) - { - /* Check if we had to return because we couldn't wait on latch. */ - if (no_wait) - goto ordered_latch; return 0; + if (prev == reinterpret_cast(-1)) + { + /* The block existed in buf_pool.page_hash, but not in a state that is + safe to access without waiting for some pending operation, such as + buf_page_t::read_complete() or buf_pool_t::unzip(). + + Retry while temporarily releasing the successor block->page.lock + (but retaining a buffer-fix so that the block cannot be evicted. */ + + if (rw_latch == RW_S_LATCH) + block->page.lock.s_unlock(); + else + block->page.lock.x_unlock(); + + prev= buf_pool.page_fix(page_id, err, buf_pool_t::FIX_WAIT_READ); + + if (!prev) + { + ut_ad(*err != DB_SUCCESS); + if (rw_latch == RW_S_LATCH) + block->page.lock.s_lock(); + else + block->page.lock.x_lock(); + return 0; + } + else if (rw_latch == RW_S_LATCH) + goto wait_for_s; + else + goto wait_for_x; } static_assert(MTR_MEMO_PAGE_S_FIX == mtr_memo_type_t(BTR_SEARCH_LEAF), ""); static_assert(MTR_MEMO_PAGE_X_FIX == mtr_memo_type_t(BTR_MODIFY_LEAF), ""); if (rw_latch == RW_S_LATCH - ? prev->page.lock.s_lock_try() : prev->page.lock.x_lock_try()) - { - mtr->lock_register(prev_savepoint, mtr_memo_type_t(rw_latch)); - if (UNIV_UNLIKELY(prev->page.id() != page_id)) - { - fail: - /* the page was just read and found to be corrupted */ - mtr->rollback_to_savepoint(prev_savepoint); - return 0; - } - } + ? prev->page.lock.s_lock_try() + : prev->page.lock.x_lock_try()) + mtr->memo_push(prev, mtr_memo_type_t(rw_latch)); else { - ut_ad(mtr->at_savepoint(mtr->get_savepoint() - 1)->page.id() == page_id); - mtr->release_last_page(); -ordered_latch: if (rw_latch == RW_S_LATCH) + { block->page.lock.s_unlock(); - else - block->page.lock.x_unlock(); - - prev= buf_page_get_gen(page_id, zip_size, rw_latch, prev, - BUF_GET, mtr, err); - if (rw_latch == RW_S_LATCH) + wait_for_s: + prev->page.lock.s_lock(); block->page.lock.s_lock(); + } else + { + block->page.lock.x_unlock(); + wait_for_x: + prev->page.lock.x_lock(); block->page.lock.x_lock(); + } + ut_ad(block == mtr->at_savepoint(mtr->get_savepoint() - 1)); + mtr->memo_push(prev, mtr_memo_type_t(rw_latch)); const page_id_t prev_page_id= page_id; page_id.set_page_no(btr_page_get_prev(page)); + ret= -1; if (UNIV_UNLIKELY(page_id != prev_page_id)) { mtr->release_last_page(); if (page_id.page_no() == FIL_NULL) - return -1; + return ret; goto retry; } - - if (UNIV_UNLIKELY(!prev)) - goto fail; - - ret= -1; } const page_t *const p= prev->page.frame; @@ -1047,11 +1054,11 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, btr_intention_t lock_intention; bool detected_same_key_root= false; - mem_heap_t* heap = NULL; - rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets = offsets_; - rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; - rec_offs* offsets2 = offsets2_; + mem_heap_t *heap= nullptr; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; + rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets2= offsets2_; rec_offs_init(offsets_); rec_offs_init(offsets2_); @@ -1189,8 +1196,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, buf_page_get_gen(page_id, zip_size, rw_latch, guess, BUF_GET, mtr, &err); if (!block) { - if (err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index()); + btr_read_failed(err, *index()); goto func_exit; } @@ -1208,7 +1214,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, ut_a(page_zip_validate(page_zip, block->page.frame, index())); #endif /* UNIV_ZIP_DEBUG */ - const uint32_t page_level= btr_page_get_level(block->page.frame); + uint32_t page_level= btr_page_get_level(block->page.frame); if (height == ULINT_UNDEFINED) { @@ -1216,6 +1222,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, #ifdef BTR_CUR_ADAPT info->root_guess= block; #endif + reached_root: height= page_level; tree_height= height + 1; @@ -1225,35 +1232,53 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, We may have to reacquire the page latch in a different mode. */ switch (rw_latch) { case RW_S_LATCH: - if ((latch_mode & ~12) != RW_S_LATCH) + if (!(latch_mode & BTR_SEARCH_LEAF)) { + rw_latch= RW_X_LATCH; ut_ad(rw_lock_type_t(latch_mode & ~12) == RW_X_LATCH); - goto relatch_x; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_X_FIX); + if (!block->page.lock.s_x_upgrade_try()) + { + block->page.lock.s_unlock(); + block->page.lock.x_lock(); + /* Dropping the index tree (and freeing the root page) + should be impossible while we hold index()->lock. */ + ut_ad(!block->page.is_freed()); + page_level= btr_page_get_level(block->page.frame); + if (UNIV_UNLIKELY(page_level != 0)) + { + /* btr_root_raise_and_insert() was executed meanwhile */ + ut_ad(mtr->memo_contains_flagged(&index()->lock, + MTR_MEMO_S_LOCK)); + block->page.lock.x_u_downgrade(); + block->page.lock.u_s_downgrade(); + rw_latch= RW_S_LATCH; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_S_FIX); + goto reached_root; + } + } } - else - { - if (!latch_by_caller) - /* Release the tree s-latch */ - mtr->rollback_to_savepoint(savepoint, savepoint + 1); - goto reached_latched_leaf; - } - /* fall through */ + if (rw_latch != RW_S_LATCH) + break; + if (!latch_by_caller) + /* Release the tree s-latch */ + mtr->rollback_to_savepoint(savepoint, savepoint + 1); + goto reached_latched_leaf; case RW_SX_LATCH: - ut_ad(rw_latch == RW_S_LATCH || - latch_mode == BTR_MODIFY_ROOT_AND_LEAF); - relatch_x: - mtr->rollback_to_savepoint(block_savepoint); - height= ULINT_UNDEFINED; + ut_ad(latch_mode == BTR_MODIFY_ROOT_AND_LEAF); + static_assert(int{BTR_MODIFY_ROOT_AND_LEAF} == int{RW_SX_LATCH}, ""); rw_latch= RW_X_LATCH; - goto search_loop; + mtr->lock_register(block_savepoint, MTR_MEMO_PAGE_X_FIX); + block->page.lock.u_x_upgrade(); + break; case RW_X_LATCH: if (latch_mode == BTR_MODIFY_TREE) goto reached_index_root_and_leaf; - goto reached_root_and_leaf; + break; case RW_NO_LATCH: ut_ad(0); } - goto reached_leaf; + goto reached_root_and_leaf; } } else if (UNIV_UNLIKELY(height != page_level)) @@ -1277,7 +1302,6 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, if (!height) { - reached_leaf: /* We reached the leaf level. */ ut_ad(block == mtr->at_savepoint(block_savepoint)); @@ -1307,7 +1331,7 @@ dberr_t btr_cur_t::search_leaf(const dtuple_t *tuple, page_cur_mode_t mode, /* latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err)) + !btr_latch_prev(rw_latch, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1333,7 +1357,7 @@ release_tree: ut_ad(rw_latch == RW_X_LATCH); /* x-latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err)) + !btr_latch_prev(rw_latch, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1480,7 +1504,7 @@ release_tree: ut_ad(rw_latch == RW_S_LATCH); if (!not_first_access) - buf_read_ahead_linear(page_id, zip_size); + buf_read_ahead_linear(page_id); if (page_has_prev(block->page.frame) && page_rec_is_first(page_cur.rec, block->page.frame)) @@ -1489,7 +1513,7 @@ release_tree: /* Latch the previous page if the node pointer is the leftmost of the current page. */ - int ret= btr_latch_prev(block, page_id, zip_size, rw_latch, mtr, &err); + int ret= btr_latch_prev(rw_latch, page_id, &err, mtr); if (!ret) goto func_exit; ut_ad(block_savepoint + 2 == mtr->get_savepoint()); @@ -1515,7 +1539,7 @@ release_tree: case BTR_SEARCH_LEAF: rw_latch= rw_lock_type_t(latch_mode); if (!not_first_access) - buf_read_ahead_linear(page_id, zip_size); + buf_read_ahead_linear(page_id); break; case BTR_MODIFY_TREE: ut_ad(rw_latch == RW_X_LATCH); @@ -1644,8 +1668,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple, if (!block) { - if (err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index()); + btr_read_failed(err, *index()); goto func_exit; } @@ -1666,8 +1689,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple, #endif /* UNIV_ZIP_DEBUG */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, page_id, block->zip_size(), - RW_X_LATCH, mtr, &err)) + !btr_latch_prev(RW_X_LATCH, page_id, &err, mtr)) goto func_exit; if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), @@ -1754,8 +1776,7 @@ search_loop: else if (!(block= buf_page_get_gen(page_id, zip_size, rw_latch, block, BUF_GET, mtr, &err))) { - if (err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index); + btr_read_failed(err, *index); goto func_exit; } else @@ -1880,7 +1901,6 @@ index_locked: page_cur.index = index; uint32_t page= index->page; - const auto zip_size= index->table->space->zip_size(); for (ulint height= ULINT_UNDEFINED;;) { @@ -1931,8 +1951,7 @@ index_locked: { /* x-latch also siblings from left to right */ if (page_has_prev(block->page.frame) && - !btr_latch_prev(block, block->page.id(), zip_size, RW_X_LATCH, - mtr, &err)) + !btr_latch_prev(RW_X_LATCH, block->page.id(), &err, mtr)) break; if (page_has_next(block->page.frame) && !btr_block_get(*index, btr_page_get_next(block->page.frame), @@ -1986,8 +2005,7 @@ index_locked: if (latch_mode != BTR_MODIFY_TREE) { if (!height && first && first_access) - buf_read_ahead_linear(page_id_t(block->page.id().space(), page), - block->page.zip_size()); + buf_read_ahead_linear(page_id_t(block->page.id().space(), page)); } else if (btr_cur_need_opposite_intention(block->page, index->is_clust(), lock_intention, @@ -2012,7 +2030,8 @@ index_locked: { if (!btr_cur_will_modify_tree(index, block->page.frame, lock_intention, page_cur.rec, - node_ptr_max_size, zip_size, mtr)) + node_ptr_max_size, + index->table->space->zip_size(), mtr)) { ut_ad(n_blocks); /* release buffer-fixes on pages that will not be modified @@ -6408,7 +6427,7 @@ btr_copy_blob_prefix( return copied_len; } if (!buf_page_make_young_if_needed(&block->page)) { - buf_read_ahead_linear(id, 0); + buf_read_ahead_linear(id); } page = buf_block_get_frame(block); @@ -6487,7 +6506,7 @@ btr_copy_zblob_prefix( bpage is protected by the B-tree page latch that is being held on the clustered index record, or, in row_merge_copy_blobs(), by an exclusive table lock. */ - bpage = buf_page_get_zip(id, zip_size); + bpage = buf_page_get_zip(id); if (UNIV_UNLIKELY(!bpage)) { ib::error() << "Cannot load compressed BLOB " << id; diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 10005e5b501..b879ef12534 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -533,8 +533,7 @@ btr_pcur_move_to_next_page( const auto s = mtr->get_savepoint(); mtr->rollback_to_savepoint(s - 2, s - 1); if (first_access) { - buf_read_ahead_linear(next_block->page.id(), - next_block->zip_size()); + buf_read_ahead_linear(next_block->page.id()); } return DB_SUCCESS; } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index d2ce1ac68ed..eed5025494b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2349,13 +2349,10 @@ be implemented at a higher level. In other words, all possible accesses to a given page through this function must be protected by the same set of mutexes or latches. @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size in bytes @return pointer to the block, s-latched */ TRANSACTIONAL_TARGET -buf_page_t* buf_page_get_zip(const page_id_t page_id, ulint zip_size) +buf_page_t* buf_page_get_zip(const page_id_t page_id) { - ut_ad(zip_size); - ut_ad(ut_is_2pow(zip_size)); ha_handler_stats *const stats= mariadb_stats; buf_inc_get(stats); @@ -2456,7 +2453,7 @@ lookup: return bpage; must_read_page: - switch (dberr_t err= buf_read_page(page_id, zip_size, chain)) { + switch (dberr_t err= buf_read_page(page_id, chain)) { case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); @@ -2491,8 +2488,8 @@ buf_block_init_low( /********************************************************************//** Decompress a block. -@return TRUE if successful */ -ibool +@return true if successful */ +bool buf_zip_decompress( /*===============*/ buf_block_t* block, /*!< in/out: block */ @@ -2536,7 +2533,7 @@ func_exit: if (space) { space->release(); } - return(TRUE); + return true; } ib::error() << "Unable to decompress " @@ -2570,10 +2567,101 @@ err_exit: space->release(); } - return(FALSE); + return false; } -buf_block_t* buf_pool_t::page_fix(const page_id_t id) +ATTRIBUTE_COLD +buf_block_t *buf_pool_t::unzip(buf_page_t *b, buf_pool_t::hash_chain &chain) +{ + buf_block_t *block= buf_LRU_get_free_block(have_no_mutex); + buf_block_init_low(block); + page_hash_latch &hash_lock= page_hash.lock_get(chain); + wait_for_unfix: + mysql_mutex_lock(&mutex); + hash_lock.lock(); + + /* b->lock implies !b->can_relocate() */ + ut_ad(b->lock.have_x()); + ut_ad(b == page_hash.get(b->id(), chain)); + + /* Wait for b->unfix() in any other threads. */ + uint32_t state= b->state(); + ut_ad(buf_page_t::buf_fix_count(state)); + ut_ad(!buf_page_t::is_freed(state)); + + switch (state) { + case buf_page_t::UNFIXED + 1: + case buf_page_t::REINIT + 1: + break; + default: + ut_ad(state < buf_page_t::READ_FIX); + + if (state < buf_page_t::UNFIXED + 1) + { + ut_ad(state > buf_page_t::FREED); + b->lock.x_unlock(); + hash_lock.unlock(); + buf_LRU_block_free_non_file_page(block); + mysql_mutex_unlock(&mutex); + b->unfix(); + return nullptr; + } + + mysql_mutex_unlock(&mutex); + hash_lock.unlock(); + std::this_thread::sleep_for(std::chrono::microseconds(100)); + goto wait_for_unfix; + } + + /* Ensure that another buf_page_get_low() or buf_page_t::page_fix() + will wait for block->page.lock.x_unlock(). buf_relocate() will + copy the state from b to block and replace b with block in page_hash. */ + b->set_state(buf_page_t::READ_FIX); + + mysql_mutex_lock(&flush_list_mutex); + buf_relocate(b, &block->page); + + /* X-latch the block for the duration of the decompression. */ + block->page.lock.x_lock(); + + buf_flush_relocate_on_flush_list(b, &block->page); + mysql_mutex_unlock(&flush_list_mutex); + + /* Insert at the front of unzip_LRU list */ + buf_unzip_LRU_add_block(block, false); + + mysql_mutex_unlock(&mutex); + hash_lock.unlock(); + +#if defined SUX_LOCK_GENERIC || defined UNIV_DEBUG + b->lock.x_unlock(); + b->lock.free(); +#endif + ut_free(b); + + n_pend_unzip++; + const bool ok{buf_zip_decompress(block, false)}; + n_pend_unzip--; + + if (UNIV_UNLIKELY(!ok)) + { + mysql_mutex_lock(&mutex); + block->page.read_unfix(state); + block->page.lock.x_unlock(); + if (!buf_LRU_free_page(&block->page, true)) + ut_ad(0); + mysql_mutex_unlock(&mutex); + return nullptr; + } + else + block->page.read_unfix(state); + + return block; +} + +buf_block_t *buf_pool_t::page_fix(const page_id_t id, + dberr_t *err, + buf_pool_t::page_fix_conflicts c) { ha_handler_stats *const stats= mariadb_stats; buf_inc_get(stats); @@ -2585,35 +2673,87 @@ buf_block_t* buf_pool_t::page_fix(const page_id_t id) buf_page_t *b= page_hash.get(id, chain); if (b) { - uint32_t state= b->fix(); - hash_lock.unlock_shared(); + uint32_t state= b->fix() + 1; ut_ad(!b->in_zip_hash); - ut_ad(b->frame); - ut_ad(state >= buf_page_t::FREED); + hash_lock.unlock_shared(); + + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) + { + ut_ad(state > buf_page_t::FREED); + if (c == FIX_ALSO_FREED && b->id() == id) + { + ut_ad(state == buf_page_t::FREED + 1); + return reinterpret_cast(b); + } + /* The page was marked as freed or corrupted. */ + b->unfix(); + corrupted: + if (err) + *err= DB_CORRUPTION; + return nullptr; + } + if (state >= buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) { + if (c == FIX_NOWAIT) + { + would_block: + b->unfix(); + return reinterpret_cast(-1); + } + + if (UNIV_LIKELY(b->frame != nullptr)); + else if (state < buf_page_t::READ_FIX) + goto unzip; + else + { + wait_for_unzip: + b->unfix(); + std::this_thread::sleep_for(std::chrono::microseconds(100)); + continue; + } b->lock.s_lock(); state= b->state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); + b->lock.s_unlock(); } - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) + + if (UNIV_UNLIKELY(!b->frame)) { - /* The page was marked as freed or corrupted. */ - b->unfix(); - b= nullptr; + unzip: + if (b->lock.x_lock_try()); + else if (c == FIX_NOWAIT) + goto would_block; + else + goto wait_for_unzip; + + buf_block_t *block= unzip(b, chain); + if (!block) + goto corrupted; + + b= &block->page; + state= b->state(); + b->lock.x_unlock(); } + return reinterpret_cast(b); } hash_lock.unlock_shared(); - switch (buf_read_page(id, 0, chain)) { + + if (c == FIX_NOWAIT) + return reinterpret_cast(-1); + + switch (dberr_t local_err= buf_read_page(id, chain)) { default: + if (err) + *err= local_err; return nullptr; case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); - buf_read_ahead_random(id, 0); + buf_read_ahead_random(id); } } } @@ -2621,27 +2761,24 @@ buf_block_t* buf_pool_t::page_fix(const page_id_t id) /** 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 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, or BUF_PEEK_IF_IN_POOL @param[in] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ TRANSACTIONAL_TARGET buf_block_t* buf_page_get_gen( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err, - bool* no_wait) + dberr_t* err) { ulint retries = 0; @@ -2660,12 +2797,7 @@ buf_page_get_gen( || log_sys.get_lsn() == recv_sys.lsn + SIZE_OF_FILE_CHECKPOINT || ibuf_upgrade_was_needed : !recv_recovery_is_on() || recv_sys.after_apply); - ut_ad(!mtr || mtr->is_active()); - ut_ad(mtr || mode == BUF_PEEK_IF_IN_POOL); - ut_ad((rw_latch == RW_S_LATCH) - || (rw_latch == RW_X_LATCH) - || (rw_latch == RW_SX_LATCH) - || (rw_latch == RW_NO_LATCH)); + ut_ad(mtr->is_active()); if (err) { *err = DB_SUCCESS; @@ -2747,11 +2879,11 @@ loop: corrupted, or if an encrypted page with a valid checksum cannot be decypted. */ - switch (dberr_t local_err = buf_read_page(page_id, zip_size, chain)) { + switch (dberr_t local_err = buf_read_page(page_id, chain)) { case DB_SUCCESS: case DB_SUCCESS_LOCKED_REC: mariadb_increment_pages_read(stats); - buf_read_ahead_random(page_id, zip_size); + buf_read_ahead_random(page_id); break; default: if (mode != BUF_GET_POSSIBLY_FREED @@ -2795,18 +2927,7 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - if (!no_wait) { - block->page.lock.s_lock(); - } else if (!block->page.lock.s_lock_try()) { - ut_ad(rw_latch == RW_NO_LATCH); - /* We should not wait trying to acquire S latch for - current page while holding latch for the next page. - It would violate the latching order resulting in - possible deadlock. Caller must handle the failure. */ - block->page.unfix(); - *no_wait= true; - return nullptr; - } + block->page.lock.s_lock(); state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); @@ -2836,18 +2957,6 @@ ignore_unfixed: } ut_ad(id == page_id); } else if (mode != BUF_PEEK_IF_IN_POOL) { - } else if (!mtr) { - ut_ad(!block->page.oldest_modification()); - mysql_mutex_lock(&buf_pool.mutex); - block->unfix(); - -free_unfixed_block: - if (!buf_LRU_free_page(&block->page, true)) { - ut_ad(0); - } - - mysql_mutex_unlock(&buf_pool.mutex); - return nullptr; } else if (UNIV_UNLIKELY(!block->page.frame)) { /* The BUF_PEEK_IF_IN_POOL mode is mainly used for dropping an adaptive hash index. There cannot be an @@ -2858,120 +2967,35 @@ free_unfixed_block: ut_ad(mode == BUF_GET_IF_IN_POOL || mode == BUF_PEEK_IF_IN_POOL || block->zip_size() == zip_size); - if (UNIV_UNLIKELY(!block->page.frame)) { - if (!block->page.lock.x_lock_try()) { -wait_for_unzip: - /* The page is being read or written, or - another thread is executing buf_zip_decompress() - in buf_page_get_gen() on it. */ - block->page.unfix(); - std::this_thread::sleep_for( - std::chrono::microseconds(100)); - goto loop; - } - - buf_block_t *new_block = buf_LRU_get_free_block(have_no_mutex); - buf_block_init_low(new_block); - -wait_for_unfix: - mysql_mutex_lock(&buf_pool.mutex); - page_hash_latch& hash_lock=buf_pool.page_hash.lock_get(chain); - - /* It does not make sense to use - transactional_lock_guard here, because buf_relocate() - would likely make a memory transaction too large. */ - hash_lock.lock(); - - /* block->page.lock implies !block->page.can_relocate() */ - ut_ad(&block->page == buf_pool.page_hash.get(page_id, chain)); - - /* Wait for any other threads to release their buffer-fix - on the compressed-only block descriptor. */ - state = block->page.state(); - - switch (state) { - case buf_page_t::UNFIXED + 1: - case buf_page_t::REINIT + 1: - break; - default: - ut_ad(state < buf_page_t::READ_FIX); - - if (state < buf_page_t::UNFIXED + 1) { - ut_ad(state > buf_page_t::FREED); - block->page.lock.x_unlock(); - hash_lock.unlock(); - buf_LRU_block_free_non_file_page(new_block); - mysql_mutex_unlock(&buf_pool.mutex); - goto ignore_block; - } - - mysql_mutex_unlock(&buf_pool.mutex); - hash_lock.unlock(); - std::this_thread::sleep_for( - std::chrono::microseconds(100)); - goto wait_for_unfix; - } - - /* Ensure that another buf_page_get_gen() will wait for - new_block->page.lock.x_unlock(). */ - block->page.set_state(buf_page_t::READ_FIX); - - /* Move the compressed page from block->page to new_block, - and uncompress it. */ - - mysql_mutex_lock(&buf_pool.flush_list_mutex); - buf_relocate(&block->page, &new_block->page); - - /* X-latch the block for the duration of the decompression. */ - new_block->page.lock.x_lock(); - ut_d(block->page.lock.x_unlock()); - - buf_flush_relocate_on_flush_list(&block->page, - &new_block->page); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - - /* Insert at the front of unzip_LRU list */ - buf_unzip_LRU_add_block(new_block, FALSE); - - mysql_mutex_unlock(&buf_pool.mutex); - hash_lock.unlock(); - -#if defined SUX_LOCK_GENERIC || defined UNIV_DEBUG - block->page.lock.free(); -#endif - ut_free(reinterpret_cast(block)); - block = new_block; - - buf_pool.n_pend_unzip++; - - /* Decompress the page while not holding - buf_pool.mutex. */ - const auto ok = buf_zip_decompress(block, false); - --buf_pool.n_pend_unzip; - if (!ok) { - if (err) { - *err = DB_PAGE_CORRUPTED; - } - mysql_mutex_lock(&buf_pool.mutex); - } - state = block->page.read_unfix(state); - block->page.lock.x_unlock(); - - if (!ok) { - goto free_unfixed_block; - } - } - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { goto ignore_block; } ut_ad((~buf_page_t::LRU_MASK) & state); ut_ad(state > buf_page_t::WRITE_FIX || state < buf_page_t::READ_FIX); + if (UNIV_UNLIKELY(!block->page.frame)) { + if (!block->page.lock.x_lock_try()) { +wait_for_unzip: + /* The page is being read or written, or + another thread is executing buf_pool.unzip() on it. */ + block->page.unfix(); + std::this_thread::sleep_for( + std::chrono::microseconds(100)); + goto loop; + } + + block = buf_pool.unzip(&block->page, chain); + + if (!block) { + goto ignore_unfixed; + } + + block->page.lock.x_unlock(); + } + #ifdef UNIV_DEBUG if (!(++buf_dbg_counter % 5771)) buf_pool.validate(); #endif /* UNIV_DEBUG */ - ut_ad(block->page.frame); /* The state = block->page.state() may be stale at this point, and in fact, at any point of time if we consider its @@ -3174,22 +3198,47 @@ retry: if (!mtr->have_x_latch(reinterpret_cast(*bpage))) { - const bool got= bpage->lock.x_lock_try(); - if (!got) + /* Buffer-fix the block to prevent the block being concurrently freed + after we release the buffer pool mutex. It should work fine with + concurrent load of the page (free on disk) to buffer pool due to + possible read ahead. After we find a zero filled page during load, we + call buf_pool_t::corrupted_evict, where we try to wait for all buffer + fixes to go away only after resetting the page ID and releasing the + page latch. */ + auto state= bpage->fix(); + DBUG_EXECUTE_IF("ib_buf_create_intermittent_wait", { + static bool need_to_wait = false; + need_to_wait = !need_to_wait; + /* Simulate try lock failure in every alternate call. */ + if (need_to_wait) { + goto must_wait; + } + }); + + if (!bpage->lock.x_lock_try()) + { +#ifndef DBUG_OFF + must_wait: +#endif mysql_mutex_unlock(&buf_pool.mutex); + bpage->lock.x_lock(); const page_id_t id{bpage->id()}; if (UNIV_UNLIKELY(id != page_id)) { ut_ad(id.is_corrupted()); + ut_ad(bpage->is_freed()); + bpage->unfix(); bpage->lock.x_unlock(); goto retry; } mysql_mutex_lock(&buf_pool.mutex); + state= bpage->state(); + ut_ad(!bpage->is_io_fixed(state)); + ut_ad(bpage->buf_fix_count(state)); } - auto state= bpage->fix(); ut_ad(state >= buf_page_t::FREED); ut_ad(state < buf_page_t::READ_FIX); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index f982ffee54c..6e608642da7 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1764,7 +1764,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept static_assert(CPU_LEVEL1_DCACHE_LINESIZE >= 64, "efficiency"); static_assert(CPU_LEVEL1_DCACHE_LINESIZE <= 4096, "compatibility"); byte* c= my_assume_aligned - (is_pmem() ? buf + offset : checkpoint_buf); + (is_mmap() ? buf + offset : checkpoint_buf); memset_aligned(c, 0, CPU_LEVEL1_DCACHE_LINESIZE); mach_write_to_8(my_assume_aligned<8>(c), next_checkpoint_lsn); mach_write_to_8(my_assume_aligned<8>(c + 8), end_lsn); @@ -1773,8 +1773,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept lsn_t resizing; #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) { + ut_ad(!is_opened()); resizing= resize_lsn.load(std::memory_order_relaxed); if (resizing > 1 && resizing <= next_checkpoint_lsn) @@ -1788,12 +1789,12 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept else #endif { + ut_ad(!is_mmap()); ut_ad(!checkpoint_pending); checkpoint_pending= true; latch.wr_unlock(); log_write_and_flush_prepare(); resizing= resize_lsn.load(std::memory_order_relaxed); - /* FIXME: issue an asynchronous write */ ut_ad(ut_is_2pow(write_size)); ut_ad(write_size >= 512); ut_ad(write_size <= 4096); @@ -1836,9 +1837,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resizing > 1 && resizing <= checkpoint_lsn) { - ut_ad(is_pmem() == !resize_flush_buf); + ut_ad(is_mmap() == !resize_flush_buf); - if (!is_pmem()) + if (!is_mmap()) { if (!log_write_through) ut_a(resize_log.flush()); @@ -1847,13 +1848,17 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resize_rename()) { - /* Resizing failed. Discard the log_sys.resize_log. */ + /* Resizing failed. Discard the ib_logfile101. */ #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) + { + ut_ad(!is_opened()); my_munmap(resize_buf, resize_target); + } else #endif { + ut_ad(!is_mmap()); ut_free_dodump(resize_buf, buf_size); ut_free_dodump(resize_flush_buf, buf_size); #ifdef _WIN32 @@ -1871,8 +1876,9 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept { /* Adopt the resized log. */ #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) { + ut_ad(!is_opened()); my_munmap(buf, file_size); buf= resize_buf; set_buf_free(START_OFFSET + (get_lsn() - resizing)); @@ -1880,6 +1886,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept else #endif { + ut_ad(!is_mmap()); IF_WIN(,log.close()); std::swap(log, resize_log); ut_free_dodump(buf, buf_size); @@ -2683,12 +2690,12 @@ ATTRIBUTE_COLD void buf_flush_page_cleaner_init() /** Flush the buffer pool on shutdown. */ ATTRIBUTE_COLD void buf_flush_buffer_pool() { - ut_ad(!os_aio_pending_reads()); ut_ad(!buf_page_cleaner_is_active); ut_ad(!buf_flush_sync_lsn); service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, "Waiting to flush the buffer pool"); + os_aio_wait_until_no_pending_reads(false); mysql_mutex_lock(&buf_pool.flush_list_mutex); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 84b04beae34..1398861db4a 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -202,8 +202,8 @@ Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by an i/o-handler thread. @param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0, - bitwise-ORed with 1 in recovery +@param[in] zip_size 0 or ROW_FORMAT=COMPRESSED page size + bitwise-ORed with 1 to allocate an uncompressed frame @param[in,out] chain buf_pool.page_hash cell for page_id @param[in,out] space tablespace @param[in,out] block preallocated buffer block @@ -303,10 +303,9 @@ pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! @param[in] page_id page id of a page which the current thread wants to access -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @return number of page read requests issued */ TRANSACTIONAL_TARGET -ulint buf_read_ahead_random(const page_id_t page_id, ulint zip_size) +ulint buf_read_ahead_random(const page_id_t page_id) { if (!srv_random_read_ahead || page_id.space() >= SRV_TMP_SPACE_ID) /* Disable the read-ahead for temporary tablespace */ @@ -353,6 +352,7 @@ read_ahead: /* Read all the suitable blocks within the area */ buf_block_t *block= nullptr; + unsigned zip_size{space->zip_size()}; if (UNIV_LIKELY(!zip_size)) { allocate_block: @@ -400,33 +400,25 @@ read_ahead: return count; } -/** High-level function which reads a page from a file to buf_pool -if it is not already there. Sets the io_fix and an exclusive lock -on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. -@param page_id page id -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param chain buf_pool.page_hash cell for page_id -@retval DB_SUCCESS if the page was read and is not corrupted, -@retval DB_SUCCESS_LOCKED_REC if the page was not read -@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted, -@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ -dberr_t buf_read_page(const page_id_t page_id, ulint zip_size, +dberr_t buf_read_page(const page_id_t page_id, buf_pool_t::hash_chain &chain) { fil_space_t *space= fil_space_t::get(page_id.space()); - if (!space) + if (UNIV_UNLIKELY(!space)) { - ib::info() << "trying to read page " << page_id - << " in nonexisting or being-dropped tablespace"; + sql_print_information("InnoDB: trying to read page " + "[page id: space=" UINT32PF + ", page number=" UINT32PF "]" + " in nonexisting or being-dropped tablespace", + page_id.space(), page_id.page_no()); return DB_TABLESPACE_DELETED; } /* Our caller should already have ensured that the page does not exist in buf_pool.page_hash. */ buf_block_t *block= nullptr; + unsigned zip_size= space->zip_size(); + if (UNIV_LIKELY(!zip_size)) { allocate_block: @@ -435,7 +427,7 @@ dberr_t buf_read_page(const page_id_t page_id, ulint zip_size, block= buf_LRU_get_free_block(have_mutex); mysql_mutex_unlock(&buf_pool.mutex); } - else if (recv_recovery_is_on()) + else { zip_size|= 1; goto allocate_block; @@ -511,10 +503,9 @@ NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! @param[in] page_id page id; see NOTE 3 above -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @return number of page read requests issued */ TRANSACTIONAL_TARGET -ulint buf_read_ahead_linear(const page_id_t page_id, ulint zip_size) +ulint buf_read_ahead_linear(const page_id_t page_id) { /* check if readahead is disabled. Disable the read ahead logic for temporary tablespace */ @@ -553,6 +544,11 @@ fail: return 0; } + if (trx_sys_hdr_page(page_id)) + /* If it is an ibuf bitmap page or trx sys hdr, we do no + read-ahead, as that could break the ibuf page access order */ + goto fail; + /* How many out of order accessed pages can we ignore when working out the access pattern for linear readahead */ ulint count= std::min(buf_pool_t::READ_AHEAD_PAGES - @@ -647,6 +643,7 @@ failed: /* If we got this far, read-ahead can be sensible: do it */ buf_block_t *block= nullptr; + unsigned zip_size{space->zip_size()}; if (UNIV_LIKELY(!zip_size)) { allocate_block: diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 0f6c2f7ea10..ac599c11433 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1594,104 +1594,6 @@ dict_create_add_foreign_field_to_dictionary( table_name, foreign->id, trx)); } -/********************************************************************//** -Construct foreign key constraint defintion from data dictionary information. -*/ -static -char* -dict_foreign_def_get( -/*=================*/ - dict_foreign_t* foreign,/*!< in: foreign */ - trx_t* trx) /*!< in: trx */ -{ - char* fk_def = (char *)mem_heap_alloc(foreign->heap, 4*1024); - const char* tbname; - char tablebuf[MAX_TABLE_NAME_LEN + 1] = ""; - unsigned i; - char* bufend; - - tbname = dict_remove_db_name(foreign->id); - bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN, - tbname, strlen(tbname), trx->mysql_thd); - tablebuf[bufend - tablebuf] = '\0'; - - sprintf(fk_def, - (char *)"CONSTRAINT %s FOREIGN KEY (", (char *)tablebuf); - - for(i = 0; i < foreign->n_fields; i++) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->foreign_col_names[i], - strlen(foreign->foreign_col_names[i]), - trx->mysql_thd); - strcat(fk_def, buf); - if (i < static_cast(foreign->n_fields-1)) { - strcat(fk_def, (char *)","); - } - } - - strcat(fk_def,(char *)") REFERENCES "); - - bufend = innobase_convert_name(tablebuf, MAX_TABLE_NAME_LEN, - foreign->referenced_table_name, - strlen(foreign->referenced_table_name), - trx->mysql_thd); - tablebuf[bufend - tablebuf] = '\0'; - - strcat(fk_def, tablebuf); - strcat(fk_def, " ("); - - for(i = 0; i < foreign->n_fields; i++) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - bufend = innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->referenced_col_names[i], - strlen(foreign->referenced_col_names[i]), - trx->mysql_thd); - buf[bufend - buf] = '\0'; - strcat(fk_def, buf); - if (i < (uint)foreign->n_fields-1) { - strcat(fk_def, (char *)","); - } - } - strcat(fk_def, (char *)")"); - - return fk_def; -} - -/********************************************************************//** -Convert foreign key column names from data dictionary to SQL-layer. -*/ -static -void -dict_foreign_def_get_fields( -/*========================*/ - dict_foreign_t* foreign,/*!< in: foreign */ - trx_t* trx, /*!< in: trx */ - char** field, /*!< out: foreign column */ - char** field2, /*!< out: referenced column */ - ulint col_no) /*!< in: column number */ -{ - char* bufend; - char* fieldbuf = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1); - char* fieldbuf2 = (char *)mem_heap_alloc(foreign->heap, MAX_TABLE_NAME_LEN+1); - - bufend = innobase_convert_name(fieldbuf, MAX_TABLE_NAME_LEN, - foreign->foreign_col_names[col_no], - strlen(foreign->foreign_col_names[col_no]), - trx->mysql_thd); - - fieldbuf[bufend - fieldbuf] = '\0'; - - bufend = innobase_convert_name(fieldbuf2, MAX_TABLE_NAME_LEN, - foreign->referenced_col_names[col_no], - strlen(foreign->referenced_col_names[col_no]), - trx->mysql_thd); - - fieldbuf2[bufend - fieldbuf2] = '\0'; - *field = fieldbuf; - *field2 = fieldbuf2; -} - /********************************************************************//** Add a foreign key definition to the data dictionary tables. @return error code or DB_SUCCESS */ @@ -1733,29 +1635,8 @@ dict_create_add_foreign_to_dictionary( , name, foreign->id, trx); if (error != DB_SUCCESS) { - - if (error == DB_DUPLICATE_KEY) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - char tablename[MAX_TABLE_NAME_LEN + 1] = ""; - char* fk_def; - - innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - name, strlen(name), trx->mysql_thd); - - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->id, strlen(foreign->id), trx->mysql_thd); - - fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx); - - ib_push_warning(trx, error, - "Create or Alter table %s with foreign key constraint" - " failed. Foreign key constraint %s" - " already exists on data dictionary." - " Foreign key constraint names need to be unique in database." - " Error in foreign key definition: %s.", - tablename, buf, fk_def); - } - +err_exit: + innodb_fk_error(trx, error, name, *foreign); DBUG_RETURN(error); } @@ -1764,27 +1645,7 @@ dict_create_add_foreign_to_dictionary( i, name, foreign, trx); if (error != DB_SUCCESS) { - char buf[MAX_TABLE_NAME_LEN + 1] = ""; - char tablename[MAX_TABLE_NAME_LEN + 1] = ""; - char* field=NULL; - char* field2=NULL; - char* fk_def; - - innobase_convert_name(tablename, MAX_TABLE_NAME_LEN, - name, strlen(name), trx->mysql_thd); - innobase_convert_name(buf, MAX_TABLE_NAME_LEN, - foreign->id, strlen(foreign->id), trx->mysql_thd); - fk_def = dict_foreign_def_get((dict_foreign_t*)foreign, trx); - dict_foreign_def_get_fields((dict_foreign_t*)foreign, trx, &field, &field2, i); - - ib_push_warning(trx, error, - "Create or Alter table %s with foreign key constraint" - " failed. Error adding foreign key constraint name %s" - " fields %s or %s to the dictionary." - " Error in foreign key definition: %s.", - tablename, buf, i+1, fk_def); - - DBUG_RETURN(error); + goto err_exit; } } @@ -1845,8 +1706,8 @@ dict_foreigns_has_s_base_col( foreign = *it; ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0) { continue; @@ -1892,8 +1753,10 @@ dict_create_add_foreigns_to_dictionary( } for (auto fk : local_fk_set) - if (dberr_t error= - dict_create_add_foreign_to_dictionary(table->name.m_name, fk, trx)) + if (!fk->check_fk_constraint_valid()) + return DB_CANNOT_ADD_CONSTRAINT; + else if (dberr_t error= dict_create_add_foreign_to_dictionary + (table->name.m_name, fk, trx)) return error; return DB_SUCCESS; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index ee06ea9b9c0..77097d8bd96 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -195,21 +195,6 @@ dict_tables_have_same_db( return(FALSE); } -/********************************************************************//** -Return the end of table name where we have removed dbname and '/'. -@return table name */ -const char* -dict_remove_db_name( -/*================*/ - const char* name) /*!< in: table name in the form - dbname '/' tablename */ -{ - const char* s = strchr(name, '/'); - ut_a(s); - - return(s + 1); -} - /** Decrement the count of open handles */ void dict_table_close(dict_table_t *table) { @@ -964,7 +949,7 @@ void dict_sys_t::create() } -void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) +void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ulonglong now= my_hrtime_coarse().val, old= 0; if (latch_ex_wait_start.compare_exchange_strong @@ -990,17 +975,17 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) } #ifdef UNIV_PFS_RWLOCK -ATTRIBUTE_NOINLINE void dict_sys_t::unlock() +ATTRIBUTE_NOINLINE void dict_sys_t::unlock() noexcept { latch.wr_unlock(); } -ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) +ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) noexcept { latch.rd_lock(file, line); } -ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() +ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() noexcept { latch.rd_unlock(); } @@ -2944,8 +2929,8 @@ dict_foreign_add_to_cache( for_in_cache->n_fields, for_in_cache->referenced_index, check_charsets, for_in_cache->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL)); + & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL)); if (index == NULL && !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) { @@ -3814,15 +3799,10 @@ dict_index_calc_min_rec_len( return(sum); } -/**********************************************************************//** -Outputs info on a foreign key of a table in a format suitable for -CREATE TABLE. */ std::string -dict_print_info_on_foreign_key_in_create_format( -/*============================================*/ - trx_t* trx, /*!< in: transaction */ - dict_foreign_t* foreign, /*!< in: foreign key constraint */ - ibool add_newline) /*!< in: whether to add a newline */ +dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, + const dict_foreign_t *foreign, + bool add_newline) { const char* stripped_id; ulint i; @@ -3888,27 +3868,27 @@ dict_print_info_on_foreign_key_in_create_format( str.append(")"); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type & foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } @@ -3971,27 +3951,27 @@ dict_print_info_on_foreign_keys( str.append(")"); - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type == foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type == foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 8ba1bf42aed..d9df7c85790 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1614,17 +1614,18 @@ inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id, m_last= nullptr; const size_t len= strlen(path); - const size_t new_len= type == FILE_RENAME ? 1 + strlen(new_path) : 0; + const size_t new_len= new_path ? 1 + strlen(new_path) : 0; ut_ad(len > 0); byte *const log_ptr= m_log.open(1 + 3/*length*/ + 5/*space_id*/ + 1/*page_no=0*/); + *log_ptr= type; byte *end= log_ptr + 1; end= mlog_encode_varint(end, space_id); *end++= 0; - if (UNIV_LIKELY(end + len + new_len >= &log_ptr[16])) + const byte *const final_end= end + len + new_len; + if (UNIV_LIKELY(final_end >= &log_ptr[16])) { - *log_ptr= type; - size_t total_len= len + new_len + end - log_ptr - 15; + size_t total_len= final_end - log_ptr - 15; if (total_len >= MIN_3BYTE) total_len+= 2; else if (total_len >= MIN_2BYTE) @@ -1635,13 +1636,13 @@ inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id, } else { - *log_ptr= static_cast(type | (end + len + new_len - &log_ptr[1])); + *log_ptr= static_cast(*log_ptr | (final_end - &log_ptr[1])); ut_ad(*log_ptr & 15); } m_log.close(end); - if (type == FILE_RENAME) + if (new_path) { ut_ad(strchr(new_path, '/')); m_log.push(reinterpret_cast(path), uint32_t(len + 1)); diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index af5fd1305fc..06be3ba691e 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -40,6 +40,9 @@ Created 11/29/1995 Heikki Tuuri #include "dict0mem.h" #include "fsp0types.h" #include "log.h" +#ifndef DBUG_OFF +# include "trx0purge.h" +#endif /** Returns the first extent descriptor for a segment. We think of the extent lists of the segment catenated in the order @@ -3585,6 +3588,8 @@ dberr_t fsp_tablespace_validate(fil_space_t *space) void fsp_system_tablespace_truncate() { + ut_ad(!purge_sys.enabled()); + ut_ad(!srv_undo_sources); uint32_t last_used_extent= 0; fil_space_t *space= fil_system.sys_space; mtr_t mtr; diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 7d4c7730499..d084db25996 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -647,7 +647,7 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, search_loop: auto buf_mode= BUF_GET; - ulint rw_latch= RW_NO_LATCH; + rw_lock_type_t rw_latch= RW_NO_LATCH; if (height) { @@ -658,7 +658,7 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, rw_latch= upper_rw_latch; } else if (latch_mode <= BTR_MODIFY_LEAF) - rw_latch= latch_mode; + rw_latch= rw_lock_type_t(latch_mode); dberr_t err; auto block_savepoint= mtr->get_savepoint(); @@ -669,8 +669,7 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, if (err) { err_exit: - if (err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index); + btr_read_failed(err, *index); mtr->rollback_to_savepoint(savepoint); } func_exit: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c8ef77c3dba..dd620d72e18 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1609,10 +1609,9 @@ innobase_start_trx_and_assign_read_view( @return false */ static bool innobase_flush_logs(handlerton*) { - if (!srv_read_only_mode && srv_flush_log_at_trx_commit) - /* Write any outstanding redo log. Durably if - innodb_flush_log_at_trx_commit=1. */ - log_buffer_flush_to_disk(srv_flush_log_at_trx_commit == 1); + if (!srv_read_only_mode) + /* Write and flush any outstanding redo log. */ + log_buffer_flush_to_disk(true); return false; } @@ -3341,7 +3340,7 @@ innobase_invalidate_query_cache( void innobase_quote_identifier( FILE* file, - trx_t* trx, + const trx_t* trx, const char* id) { const int q = trx != NULL && trx->mysql_thd != NULL @@ -3371,7 +3370,7 @@ innobase_quote_identifier( std::string innobase_quote_identifier( /*======================*/ - trx_t* trx, + const trx_t* trx, const char* id) { std::string quoted_identifier; @@ -4294,12 +4293,6 @@ innobase_end(handlerton*, ha_panic_function) } } - /* Do system tablespace truncation during slow shutdown */ - if (!srv_fast_shutdown && !high_level_read_only - && srv_operation == SRV_OPERATION_NORMAL) { - fsp_system_tablespace_truncate(); - } - innodb_shutdown(); mysql_mutex_destroy(&log_requests.mutex); } @@ -10116,8 +10109,8 @@ wsrep_append_key( static bool referenced_by_foreign_key2( /*=======================*/ - dict_table_t* table, - dict_index_t* index) + const dict_table_t* table, + const dict_index_t* index) noexcept { ut_ad(table != NULL); ut_ad(index != NULL); @@ -12598,13 +12591,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type |= foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type |= foreign->DELETE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type |= foreign->DELETE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -12619,13 +12612,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -15412,7 +15405,7 @@ static FOREIGN_KEY_INFO* get_foreign_key_info( /*=================*/ - const THD* thd, /*!< in: user thread handle */ + THD* thd, /*!< in: user thread handle */ dict_foreign_t* foreign)/*!< in: foreign key constraint */ { FOREIGN_KEY_INFO f_key_info; @@ -15471,28 +15464,43 @@ get_foreign_key_info( name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.foreign_fields.push_back(name); + + if (dict_index_t* fidx = foreign->foreign_index) { + if (fidx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, false, i, + foreign->n_fields); + } + } ptr = foreign->referenced_col_names[i]; name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.referenced_fields.push_back(name); + + if (dict_index_t* ref_idx = foreign->referenced_index) { + if (ref_idx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, true, i, + foreign->n_fields); + } + } + } while (++i < foreign->n_fields); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { f_key_info.delete_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + } else if (foreign->type & foreign->DELETE_SET_NULL) { f_key_info.delete_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + } else if (foreign->type & foreign->DELETE_NO_ACTION) { f_key_info.delete_method = FK_OPTION_NO_ACTION; } else { f_key_info.delete_method = FK_OPTION_RESTRICT; } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { f_key_info.update_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + } else if (foreign->type & foreign->UPDATE_SET_NULL) { f_key_info.update_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + } else if (foreign->type & foreign->UPDATE_NO_ACTION) { f_key_info.update_method = FK_OPTION_NO_ACTION; } else { f_key_info.update_method = FK_OPTION_RESTRICT; @@ -15545,7 +15553,7 @@ Gets the list of foreign keys in this table. int ha_innobase::get_foreign_key_list( /*==============================*/ - const THD* thd, /*!< in: user thread handle */ + THD* thd, /*!< in: user thread handle */ List* f_key_list) /*!< out: foreign key list */ { update_thd(ha_thd()); @@ -15583,7 +15591,7 @@ Gets the set of foreign keys where this table is the referenced table. int ha_innobase::get_parent_foreign_key_list( /*=====================================*/ - const THD* thd, /*!< in: user thread handle */ + THD* thd, /*!< in: user thread handle */ List* f_key_list) /*!< out: foreign key list */ { update_thd(ha_thd()); @@ -15633,14 +15641,12 @@ bool ha_innobase::can_switch_engines() m_prebuilt->table->referenced_set.empty()); } -/*******************************************************************//** -Checks if a table is referenced by a foreign key. The MySQL manual states that -a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a +/** Checks if a table is referenced by a foreign key. The MySQL manual states +that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update. -@return > 0 if referenced by a FOREIGN KEY */ - -uint ha_innobase::referenced_by_foreign_key() +@return whether the table is referenced by a FOREIGN KEY */ +bool ha_innobase::referenced_by_foreign_key() const noexcept { dict_sys.freeze(SRW_LOCK_CALL); const bool empty= m_prebuilt->table->referenced_set.empty(); @@ -16156,10 +16162,10 @@ ha_innobase::external_lock( } DBUG_RETURN(0); - } else { - DEBUG_SYNC_C("ha_innobase_end_statement"); } + DEBUG_SYNC_C("ha_innobase_end_statement"); + /* MySQL is releasing a table lock */ trx->n_mysql_tables_in_use--; @@ -16186,14 +16192,6 @@ ha_innobase::external_lock( } } - if (!trx_is_started(trx) - && lock_type != F_UNLCK - && (m_prebuilt->select_lock_type != LOCK_NONE - || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { - - trx->will_lock = true; - } - DBUG_RETURN(0); } @@ -18561,7 +18559,10 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, if (high_level_read_only) ib_senderrf(thd, IB_LOG_LEVEL_ERROR, ER_READ_ONLY_MODE); - else if (!log_sys.is_pmem() && + else if ( +#ifdef HAVE_PMEM + !log_sys.is_mmap() && +#endif *static_cast(save) < log_sys.buf_size) my_printf_error(ER_WRONG_ARGUMENTS, "innodb_log_file_size must be at least" @@ -18602,7 +18603,7 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, mysql_mutex_unlock(&buf_pool.flush_list_mutex); if (start > log_sys.get_lsn()) { - ut_ad(!log_sys.is_pmem()); + ut_ad(!log_sys.is_mmap()); /* The server is almost idle. Write dummy FILE_CHECKPOINT records to ensure that the log resizing will complete. */ log_sys.latch.wr_lock(SRW_LOCK_CALL); @@ -19429,6 +19430,19 @@ static MYSQL_SYSVAR_UINT(log_buffer_size, log_sys.buf_size, "Redo log buffer size in bytes", NULL, NULL, 16U << 20, 2U << 20, log_sys.buf_size_max, 4096); +#ifdef HAVE_INNODB_MMAP + static constexpr const char *innodb_log_file_mmap_description= + "Whether ib_logfile0" +# ifdef HAVE_PMEM + " resides in persistent memory or" +# endif + " should initially be memory-mapped"; +static MYSQL_SYSVAR_BOOL(log_file_mmap, log_sys.log_mmap, + PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, + innodb_log_file_mmap_description, + nullptr, nullptr, log_sys.log_mmap_default); +#endif + #if defined __linux__ || defined _WIN32 static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered, PLUGIN_VAR_OPCMDARG, @@ -19891,6 +19905,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(deadlock_report), MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(log_buffer_size), +#ifdef HAVE_INNODB_MMAP + MYSQL_SYSVAR(log_file_mmap), +#endif #if defined __linux__ || defined _WIN32 MYSQL_SYSVAR(log_file_buffering), #endif @@ -21103,64 +21120,46 @@ static void innodb_remember_check_sysvar_funcs() check_sysvar_int = MYSQL_SYSVAR_NAME(flush_log_at_timeout).check; } -static const size_t MAX_BUF_SIZE = 4 * 1024; - -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -void -ib_push_warning( - trx_t* trx, /*!< in: trx */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...) +/** Report that a table cannot be decrypted. +@param thd connection context +@param table table that cannot be decrypted +@retval DB_DECRYPTION_FAILED (always) */ +ATTRIBUTE_COLD +dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table) { - if (trx && trx->mysql_thd) { - THD *thd = (THD *)trx->mysql_thd; - va_list args; - char *buf; - - va_start(args, format); - buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME)); - buf[MAX_BUF_SIZE - 1] = 0; - vsnprintf(buf, MAX_BUF_SIZE - 1, format, args); - - push_warning_printf( - thd, Sql_condition::WARN_LEVEL_WARN, - uint(convert_error_code_to_mysql(error, 0, thd)), buf); - my_free(buf); - va_end(args); - } + table->file_unreadable= true; + if (!thd) + thd= current_thd; + const int dblen= int(table->name.dblen()); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_DECRYPTION_FAILED, + "Table %`.*s.%`s in tablespace " UINT32PF + " (file %s) cannot be decrypted.", + dblen, table->name.m_name, + table->name.m_name + dblen + 1, + uint32_t(table->space_id), + UT_LIST_GET_FIRST(table->space->chain)->name); + return DB_DECRYPTION_FAILED; } -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -void -ib_push_warning( - void* ithd, /*!< in: thd */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...) +/** Report a foreign key error. +@param error error to report +@param name table name +@param foreign constraint */ +ATTRIBUTE_COLD +void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name, + const dict_foreign_t& foreign) { - va_list args; - THD *thd = (THD *)ithd; - char *buf; - - if (ithd == NULL) { - thd = current_thd; - } - - if (thd) { - va_start(args, format); - buf = (char *)my_malloc(PSI_INSTRUMENT_ME, MAX_BUF_SIZE, MYF(MY_WME)); - buf[MAX_BUF_SIZE - 1] = 0; - vsnprintf(buf, MAX_BUF_SIZE - 1, format, args); - - push_warning_printf( - thd, Sql_condition::WARN_LEVEL_WARN, - uint(convert_error_code_to_mysql(error, 0, thd)), buf); - my_free(buf); - va_end(args); - } + const int dblen= int(table_name_t(const_cast(name)).dblen()); + std::string fk= dict_print_info_on_foreign_key_in_create_format + (trx, &foreign, false); + push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN, + convert_error_code_to_mysql(err, 0, nullptr), + "CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s", + dblen, name, name + dblen + 1, + err == DB_DUPLICATE_KEY + ? ": duplicate name" : "", + int(fk.length()), fk.data()); } /** Helper function to push warnings from InnoDB internals to SQL-layer. diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 295d7d997a7..727bec8af3a 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -210,16 +210,16 @@ public: char* get_foreign_key_create_info() override; - int get_foreign_key_list(const THD *thd, + int get_foreign_key_list(THD *thd, List *f_key_list) override; int get_parent_foreign_key_list( - const THD* thd, + THD* thd, List* f_key_list) override; bool can_switch_engines() override; - uint referenced_by_foreign_key() override; + bool referenced_by_foreign_key() const noexcept override; void free_foreign_key_create_info(char* str) override { my_free(str); } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index c92d65f7f7c..06d49f669ac 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2948,8 +2948,8 @@ innobase_check_fk_option( return(true); } - if (foreign->type & (DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_DELETE_SET_NULL)) { + if (foreign->type & (foreign->UPDATE_SET_NULL + | foreign->DELETE_SET_NULL)) { for (ulint j = 0; j < foreign->n_fields; j++) { if ((dict_index_get_nth_col( @@ -2984,13 +2984,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type = DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type = foreign->DELETE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type = foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type = foreign->DELETE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -3000,13 +3000,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -3157,8 +3157,8 @@ innobase_check_fk_stored( { ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0 || s_cols == NULL) { return(false); @@ -4410,103 +4410,157 @@ innobase_dropping_foreign( return(false); } -/** Determines if an InnoDB FOREIGN KEY constraint depends on a -column that is being dropped or modified to NOT NULL. +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the nullability changes of a column. +Enforce the following rules: + +i) Don't allow the referencing column from NULL TO NOT NULL when + 1) Foreign key constraint type is ON UPDATE SET NULL + 2) Foreign key constraint type is ON DELETE SET NULL + 3) Foreign key constraint type is UPDATE CASCADE and referenced + column declared as NULL + +ii) Don't allow the referenced column from NOT NULL to NULL when +foreign key constraint type is UPDATE CASCADE and referencing column +declared as NOT NULL + @param user_table InnoDB table as it is before the ALTER operation -@param col_name Name of the column being altered @param drop_fk constraints being dropped @param n_drop_fk number of constraints that are being dropped -@param drop true=drop column, false=set NOT NULL +@param col_name modified column name +@param new_field_flags Modified field flags @retval true Not allowed (will call my_error()) @retval false Allowed */ -MY_ATTRIBUTE((pure, nonnull(1,4), warn_unused_result)) static -bool -innobase_check_foreigns_low( - const dict_table_t* user_table, - dict_foreign_t** drop_fk, - ulint n_drop_fk, - const char* col_name, - bool drop) +bool check_foreigns_nullability(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name, uint32_t new_field_flags) { - dict_foreign_t* foreign; - ut_ad(dict_sys.locked()); + ut_ad(dict_sys.locked()); - /* Check if any FOREIGN KEY constraints are defined on this - column. */ + /* Changing from NULL to NOT NULL. So check referenced set */ + if (new_field_flags & NOT_NULL_FLAG) + { + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin(); - it != user_table->foreign_set.end(); - ++it) { + if (foreign->on_update_cascade_null(col_name)) + goto non_null_error; - foreign = *it; + if (foreign->type & (foreign->DELETE_SET_NULL | + foreign->UPDATE_SET_NULL)) + { + if (foreign->foreign_index + && foreign->col_fk_exists(col_name) != UINT_MAX) + { +non_null_error: + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), col_name, fid); + return true; + } + } + } + } + else + { + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (foreign->on_update_cascade_not_null(col_name)) + { + char display_name[FN_REFLEN]; + const int dblen= int(table_name_t(const_cast(foreign-> + foreign_table_name)).dblen()); + char tbl_name[MAX_TABLE_NAME_LEN]; + uint errors; + ulint tbl_name_len= strlen(foreign->foreign_table_name) - dblen + 1; + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + innobase_convert_to_system_charset(tbl_name, + strchr(foreign->foreign_table_name, + '/') + 1, + MAX_TABLE_NAME_LEN, &errors); + if (errors) + { + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + } - if (!drop && !(foreign->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { - continue; - } + my_snprintf(display_name, FN_REFLEN - 1, "%.*s.%s", + dblen, foreign->foreign_table_name, tbl_name); - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + display_name[FN_REFLEN - 1]= '\0'; + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_CANNOT_CHANGE_CHILD, MYF(0), col_name, + fid, display_name); + return true; + } + } + } - for (unsigned f = 0; f < foreign->n_fields; f++) { - if (!strcmp(foreign->foreign_col_names[f], - col_name)) { - my_error(drop - ? ER_FK_COLUMN_CANNOT_DROP - : ER_FK_COLUMN_NOT_NULL, MYF(0), - col_name, foreign->id); - return(true); - } - } - } + return false; +} - if (!drop) { - /* SET NULL clauses on foreign key constraints of - child tables affect the child tables, not the parent table. - The column can be NOT NULL in the parent table. */ - return(false); - } +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the column when it is being dropped. +@param user_table InnoDB table as it is before the ALTER operation +@param drop_fk constraints being dropped +@param n_drop_fk number of constraints that are being dropped +@param col_name column name to be dropped +@retval true Not allowed (will call my_error()) +@retval false Allowed +*/ +static +bool check_foreign_drop_col(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name) +{ + ut_ad(dict_sys.locked()); - /* Check if any FOREIGN KEY constraints in other tables are - referring to the column that is being dropped. */ - for (dict_foreign_set::const_iterator it - = user_table->referenced_set.begin(); - it != user_table->referenced_set.end(); - ++it) { + /* Check if any FOREIGN KEY constraints are defined on this column. */ + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - foreign = *it; + for (unsigned f = 0; f < foreign->n_fields; f++) + if (!strcmp(foreign->foreign_col_names[f], col_name)) + { + my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), + col_name, foreign->id); + return true; + } + } - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + /* Check if any FOREIGN KEY constraints in other tables are + referring to the column that is being dropped. */ + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (unsigned f = 0; f < foreign->n_fields; f++) { - char display_name[FN_REFLEN]; - - if (strcmp(foreign->referenced_col_names[f], - col_name)) { - continue; - } - - char* buf_end = innobase_convert_name( - display_name, (sizeof display_name) - 1, - foreign->foreign_table_name, - strlen(foreign->foreign_table_name), - NULL); - *buf_end = '\0'; - my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, - MYF(0), col_name, foreign->id, - display_name); - - return(true); - } - } - - return(false); + for (unsigned f = 0; f < foreign->n_fields; f++) + { + char display_name[FN_REFLEN]; + if (strcmp(foreign->referenced_col_names[f], col_name)) + continue; + char* buf_end = innobase_convert_name( + display_name, (sizeof display_name) - 1, + foreign->foreign_table_name, + strlen(foreign->foreign_table_name), NULL); + *buf_end = '\0'; + my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, + MYF(0), col_name, foreign->id, display_name); + return true; + } + } + return false; } /** Determines if an InnoDB FOREIGN KEY constraint depends on a @@ -4541,16 +4595,25 @@ innobase_check_foreigns( return field.field == *fp; }); - if (it == end || (it->flags & NOT_NULL_FLAG)) { - if (innobase_check_foreigns_low( - user_table, drop_fk, n_drop_fk, - (*fp)->field_name.str, it == end)) { - return(true); + if (it == end) { + if (check_foreign_drop_col( + user_table, drop_fk, n_drop_fk, + (*fp)->field_name.str)) { + return true; + } + } else if ((it->flags & NOT_NULL_FLAG) + != ((*fp)->flags & NOT_NULL_FLAG)) { + + if (check_foreigns_nullability(user_table, drop_fk, + n_drop_fk, + (*fp)->field_name.str, + it->flags)) { + return true; } } } - return(false); + return false; } /** Convert a default value for ADD COLUMN. @@ -9965,8 +10028,8 @@ innobase_update_foreign_try( fk->foreign_col_names, fk->n_fields, fk->referenced_index, TRUE, fk->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL), + & (fk->DELETE_SET_NULL + | fk->UPDATE_SET_NULL), NULL, NULL, NULL); if (!fk->foreign_index) { my_error(ER_FK_INCORRECT_OPTION, @@ -10608,6 +10671,16 @@ commit_try_norebuild( dict_index_t* index; const char *op = "rename index to add"; ulint num_fts_index = 0; + const bool statistics_drop = statistics_exist + && ((HA_OPTION_NO_STATS_PERSISTENT | + HA_OPTION_STATS_PERSISTENT) + & (old_table->s->db_create_options + ^ altered_table->s->db_create_options)) + && ((altered_table->s->db_create_options + & HA_OPTION_NO_STATS_PERSISTENT) + || (!(altered_table->s->db_create_options + & HA_OPTION_STATS_PERSISTENT) + && !srv_stats_persistent)); /* We altered the table in place. Mark the indexes as committed. */ for (ulint i = 0; i < ctx->num_to_add_index; i++) { @@ -10630,7 +10703,8 @@ commit_try_norebuild( } char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; - if (ctx->num_to_drop_index) { + + if (statistics_exist && (statistics_drop || ctx->num_to_drop_index)) { dict_fs2utf8(ctx->old_table->name.m_name, db, sizeof db, table, sizeof table); } @@ -10665,7 +10739,7 @@ commit_try_norebuild( goto handle_error; } - if (!statistics_exist) { + if (!statistics_exist || statistics_drop) { continue; } @@ -10681,6 +10755,25 @@ commit_try_norebuild( } if (!statistics_exist) { + } else if (statistics_drop) { + error = dict_stats_delete_from_table_stats(db, table, trx); + switch (error) { + case DB_SUCCESS: + case DB_STATS_DO_NOT_EXIST: + break; + default: + goto handle_error; + } + error = dict_stats_delete_from_index_stats(db, table, trx); + switch (error) { + case DB_STATS_DO_NOT_EXIST: + error = DB_SUCCESS; + /* fall through */ + case DB_SUCCESS: + break; + default: + goto handle_error; + } } else if (const size_t size = ha_alter_info->rename_keys.size()) { char tmp_name[5]; char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 35a567d7bee..999509ac337 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -83,8 +83,10 @@ btr_root_adjust_on_import( bool btr_root_fseg_validate(ulint offset, const buf_block_t &block, const fil_space_t &space); -/** Report a decryption failure. */ -ATTRIBUTE_COLD void btr_decryption_failed(const dict_index_t &index); +/** Report a read failure if it is a decryption failure. +@param err error code +@param index the index that is being accessed */ +ATTRIBUTE_COLD void btr_read_failed(dberr_t err, const dict_index_t &index); /** Get an index page and declare its latching order level. @param[in] index index tree diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index f2736b9b218..8316c02de95 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -191,33 +191,29 @@ be implemented at a higher level. In other words, all possible accesses to a given page through this function must be protected by the same set of mutexes or latches. @param page_id page identifier -@param zip_size ROW_FORMAT=COMPRESSED page size in bytes @return pointer to the block, s-latched */ -buf_page_t *buf_page_get_zip(const page_id_t page_id, ulint zip_size); +buf_page_t *buf_page_get_zip(const page_id_t page_id); /** Get access to a database page. Buffered redo log may be applied. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 -@param[in] rw_latch RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH +@param[in] rw_latch latch mode @param[in] guess guessed block or NULL @param[in] mode BUF_GET, BUF_GET_IF_IN_POOL, or BUF_PEEK_IF_IN_POOL @param[in,out] mtr mini-transaction @param[out] err DB_SUCCESS or error code -@param[in,out] no_wait If not NULL on input, then we must not -wait for current page latch. On output, the value is set to true if we had to -return because we could not wait on page latch. -@return pointer to the block or NULL */ +@return pointer to the block +@retval nullptr if the block is corrupted or unavailable */ buf_block_t* buf_page_get_gen( const page_id_t page_id, ulint zip_size, - ulint rw_latch, + rw_lock_type_t rw_latch, buf_block_t* guess, ulint mode, mtr_t* mtr, - dberr_t* err = nullptr, - bool* no_wait = nullptr); + dberr_t* err = nullptr); /** Initialize a page in the buffer pool. The page is usually not read from a file even if it cannot be found in the buffer buf_pool. This is one @@ -357,8 +353,8 @@ void buf_page_print(const byte* read_buf, ulint zip_size = 0) ATTRIBUTE_COLD __attribute__((nonnull)); /********************************************************************//** Decompress a block. -@return TRUE if successful */ -ibool +@return true if successful */ +bool buf_zip_decompress( /*===============*/ buf_block_t* block, /*!< in/out: block */ @@ -627,30 +623,42 @@ public: public: const page_id_t &id() const { return id_; } uint32_t state() const { return zip.fix; } - uint32_t buf_fix_count() const - { - uint32_t f= state(); - ut_ad(f >= FREED); - return f < UNFIXED ? (f - FREED) : (~LRU_MASK & f); - } + static uint32_t buf_fix_count(uint32_t s) + { ut_ad(s >= FREED); return s < UNFIXED ? (s - FREED) : (~LRU_MASK & s); } + + uint32_t buf_fix_count() const { return buf_fix_count(state()); } + /** Check if a file block is io-fixed. + @param s state() + @return whether s corresponds to an io-fixed block */ + static bool is_io_fixed(uint32_t s) + { ut_ad(s >= FREED); return s >= READ_FIX; } + /** Check if a file block is read-fixed. + @param s state() + @return whether s corresponds to a read-fixed block */ + static bool is_read_fixed(uint32_t s) + { return is_io_fixed(s) && s < WRITE_FIX; } + /** Check if a file block is write-fixed. + @param s state() + @return whether s corresponds to a write-fixed block */ + static bool is_write_fixed(uint32_t s) + { ut_ad(s >= FREED); return s >= WRITE_FIX; } + /** @return whether this block is read or write fixed; read_complete() or write_complete() will always release the io-fix before releasing U-lock or X-lock */ - bool is_io_fixed() const - { const auto s= state(); ut_ad(s >= FREED); return s >= READ_FIX; } + bool is_io_fixed() const { return is_io_fixed(state()); } /** @return whether this block is write fixed; write_complete() will always release the write-fix before releasing U-lock */ - bool is_write_fixed() const { return state() >= WRITE_FIX; } - /** @return whether this block is read fixed; this should never hold - when a thread is holding the block lock in any mode */ - bool is_read_fixed() const { return is_io_fixed() && !is_write_fixed(); } + bool is_write_fixed() const { return is_write_fixed(state()); } + /** @return whether this block is read fixed */ + bool is_read_fixed() const { return is_read_fixed(state()); } /** @return if this belongs to buf_pool.unzip_LRU */ bool belongs_to_unzip_LRU() const { return UNIV_LIKELY_NULL(zip.data) && frame; } - bool is_freed() const - { const auto s= state(); ut_ad(s >= FREED); return s < UNFIXED; } + static bool is_freed(uint32_t s) { ut_ad(s >= FREED); return s < UNFIXED; } + bool is_freed() const { return is_freed(state()); } bool is_reinit() const { return !(~state() & REINIT); } void set_reinit(uint32_t prev_state) @@ -1358,11 +1366,43 @@ public: } public: + /** page_fix() mode of operation */ + enum page_fix_conflicts{ + /** Fetch if in the buffer pool, also blocks marked as free */ + FIX_ALSO_FREED= -1, + /** Fetch, waiting for page read completion */ + FIX_WAIT_READ, + /** Fetch, but avoid any waits for */ + FIX_NOWAIT + }; + /** Look up and buffer-fix a page. + Note: If the page is read-fixed (being read into the buffer pool), + we would have to wait for the page latch before determining if the page + is accessible (it could be corrupted and have been evicted again). + If the caller is holding other page latches so that waiting for this + page latch could lead to lock order inversion (latching order violation), + the mode c=FIX_WAIT_READ must not be used. @param id page identifier + @param err error code (will only be assigned when returning nullptr) + @param c how to handle conflicts @return undo log page, buffer-fixed + @retval -1 if c=FIX_NOWAIT and buffer-fixing would require waiting @retval nullptr if the undo page was corrupted or freed */ - buf_block_t *page_fix(const page_id_t id); + buf_block_t *page_fix(const page_id_t id, dberr_t *err, + page_fix_conflicts c); + + buf_block_t *page_fix(const page_id_t id) + { return page_fix(id, nullptr, FIX_WAIT_READ); } + + + /** 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() + @return the decompressed block, x-latched and read-fixed + @retval nullptr if the decompression failed (b->unfix() will be invoked) */ + ATTRIBUTE_COLD __attribute__((nonnull, warn_unused_result)) + buf_block_t *unzip(buf_page_t *b, hash_chain &chain); /** @return whether the buffer pool contains a page @param page_id page identifier @@ -1572,8 +1612,8 @@ public: /** 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; - Atomic_counter - n_pend_unzip; /*!< number of pending decompressions */ + /** number of pending unzip() */ + Atomic_counter n_pend_unzip; time_t last_printout_time; /*!< when buf_print_io was last time diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 46d08243596..68a4269e59c 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -28,20 +28,17 @@ Created 11/5/1995 Heikki Tuuri #include "buf0buf.h" -/** High-level function which reads a page asynchronously from a file to the -buffer buf_pool if it is not already there. Sets the io_fix flag and sets -an exclusive lock on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. +/** Read a page synchronously from a file. buf_page_t::read_complete() +will be invoked on read completion. @param page_id page id -@param zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param chain buf_pool.page_hash cell for page_id -@retval DB_SUCCESS if the page was read and is not corrupted, +@retval DB_SUCCESS if the page was read and is not corrupted @retval DB_SUCCESS_LOCKED_REC if the page was not read @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted, @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ -dberr_t buf_read_page(const page_id_t page_id, ulint zip_size, +dberr_t buf_read_page(const page_id_t page_id, buf_pool_t::hash_chain &chain); /** High-level function which reads a page asynchronously from a file to the @@ -63,9 +60,8 @@ pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! @param[in] page_id page id of a page which the current thread wants to access -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @return number of page read requests issued */ -ulint buf_read_ahead_random(const page_id_t page_id, ulint zip_size); +ulint buf_read_ahead_random(const page_id_t page_id); /** Applies linear read-ahead if in the buf_pool the page is a border page of a linear read-ahead area and all the pages in the area have been accessed. @@ -87,9 +83,8 @@ NOTE 2: the calling thread may own latches on pages: to avoid deadlocks this function must be written such that it cannot end up waiting for these latches! @param[in] page_id page id; see NOTE 3 above -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @return number of page read requests issued */ -ulint buf_read_ahead_linear(const page_id_t page_id, ulint zip_size); +ulint buf_read_ahead_linear(const page_id_t page_id); /** Schedule a page for recovery. @param space tablespace diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 106e991c59e..c78538a2bc6 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -102,15 +102,9 @@ dict_table_is_partition(const dict_table_t* table) return (strstr(table->name.m_name, "#p#") || strstr(table->name.m_name, "#P#")); } -/********************************************************************//** -Return the end of table name where we have removed dbname and '/'. -@return table name */ -const char* -dict_remove_db_name( -/*================*/ - const char* name) /*!< in: table name in the form - dbname '/' tablename */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); + +#define dict_remove_db_name(name) \ + (table_name_t{const_cast(name)}.dbend() + 1) /** Operation to perform when opening a table */ enum dict_table_op_t { @@ -566,15 +560,15 @@ dict_print_info_on_foreign_keys( trx_t* trx, /*!< in: transaction */ dict_table_t* table); /*!< in: table */ -/**********************************************************************//** -Outputs info on a foreign key of a table in a format suitable for -CREATE TABLE. */ +/** Output info on a foreign key of a table in a format suitable for +CREATE TABLE. +@param trx transaction +@param foreign constraint +@param add_newline whether to add a newline */ std::string -dict_print_info_on_foreign_key_in_create_format( -/*============================================*/ - trx_t* trx, /*!< in: transaction */ - dict_foreign_t* foreign, /*!< in: foreign key constraint */ - ibool add_newline); /*!< in: whether to add a newline */ +dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, + const dict_foreign_t *foreign, + bool add_newline); /*********************************************************************//** Tries to find an index whose first fields are the columns in the array, @@ -1477,24 +1471,24 @@ public: #ifdef UNIV_DEBUG /** @return whether the current thread is holding the latch */ - bool frozen() const { return latch.have_any(); } + bool frozen() const noexcept { return latch.have_any(); } /** @return whether the current thread is holding a shared latch */ - bool frozen_not_locked() const { return latch.have_rd(); } + bool frozen_not_locked() const noexcept { return latch.have_rd(); } /** @return whether the current thread holds the exclusive latch */ - bool locked() const { return latch.have_wr(); } + bool locked() const noexcept { return latch.have_wr(); } #endif private: /** Acquire the exclusive latch */ ATTRIBUTE_NOINLINE - void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)); + void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; public: /** @return the my_hrtime_coarse().val of the oldest lock_wait() start, assuming that requests are served on a FIFO basis */ - ulonglong oldest_wait() const + ulonglong oldest_wait() const noexcept { return latch_ex_wait_start.load(std::memory_order_relaxed); } /** Exclusively lock the dictionary cache. */ - void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) + void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { if (!latch.wr_lock_try()) lock_wait(SRW_LOCK_ARGS(file, line)); @@ -1502,18 +1496,18 @@ public: #ifdef UNIV_PFS_RWLOCK /** Unlock the data dictionary cache. */ - ATTRIBUTE_NOINLINE void unlock(); + ATTRIBUTE_NOINLINE void unlock() noexcept; /** Acquire a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line) noexcept; /** Release a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void unfreeze(); + ATTRIBUTE_NOINLINE void unfreeze() noexcept; #else /** Unlock the data dictionary cache. */ - void unlock() { latch.wr_unlock(); } + void unlock() noexcept { latch.wr_unlock(); } /** Acquire a shared lock on the dictionary cache. */ - void freeze() { latch.rd_lock(); } + void freeze() noexcept { latch.rd_lock(); } /** Release a shared lock on the dictionary cache. */ - void unfreeze() { latch.rd_unlock(); } + void unfreeze() noexcept { latch.rd_unlock(); } #endif /** Estimate the used memory occupied by the data dictionary diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 1acf92d8811..d2f241f3d73 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1461,59 +1461,160 @@ typedef std::set, /** Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D). Most fields will be initialized to 0, NULL or FALSE in dict_mem_foreign_create(). */ -struct dict_foreign_t{ - mem_heap_t* heap; /*!< this object is allocated from - this memory heap */ - char* id; /*!< id of the constraint as a - null-terminated string */ - unsigned n_fields:10; /*!< number of indexes' first fields - for which the foreign key - constraint is defined: we allow the - indexes to contain more fields than - mentioned in the constraint, as long - as the first fields are as mentioned */ - unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE - or DICT_FOREIGN_ON_DELETE_SET_NULL */ - char* foreign_table_name;/*!< foreign table name */ - char* foreign_table_name_lookup; - /*!< foreign table name used for dict lookup */ - dict_table_t* foreign_table; /*!< table where the foreign key is */ - const char** foreign_col_names;/*!< names of the columns in the - foreign key */ - char* referenced_table_name;/*!< referenced table name */ - char* referenced_table_name_lookup; - /*!< referenced table name for dict lookup*/ - dict_table_t* referenced_table;/*!< table where the referenced key - is */ - const char** referenced_col_names;/*!< names of the referenced - columns in the referenced table */ - dict_index_t* foreign_index; /*!< foreign index; we require that - both tables contain explicitly defined - indexes for the constraint: InnoDB - does not generate new indexes - implicitly */ - dict_index_t* referenced_index;/*!< referenced index */ +struct dict_foreign_t +{ + /* Object is allocated from this memory heap */ + mem_heap_t *heap; + /* id of the constraint as a null terminated string */ + char *id; + /* number of indexes first fields for which the foreign key + constraint is defined: We allow the indexes to contain more + fields than mentioned in the constraint, as long as the first + fields are as mentioned */ + unsigned n_fields:10; + /* 0 or DELETE_CASCADE OR DELETE_SET_NULL */ + unsigned type:6; + /* foreign table name */ + char *foreign_table_name; + /* Foreign table name used for dict lookup */ + char *foreign_table_name_lookup; + /* table where the foreign key is */ + dict_table_t *foreign_table; + /* names of the columns in the foreign key */ + const char **foreign_col_names; + /* referenced table name */ + char *referenced_table_name; + /* referenced table name for dict lookup */ + char *referenced_table_name_lookup; + /* Table where the referenced key is */ + dict_table_t *referenced_table; + /* Names of the referenced columns in the referenced table */ + const char **referenced_col_names; + /* foreign index; we require that both tables contain explicitly + defined indexes for the constraint: InnoDB does not generate + new indexes implicitly */ + dict_index_t *foreign_index; + /* referenced index */ + dict_index_t *referenced_index; + /* set of virtual columns affected by foreign key constraint */ + dict_vcol_set *v_cols; + /** Check whether the fulltext index gets affected by + foreign key constraint */ + bool affects_fulltext() const; + /** Set the foreign_table_name_lookup pointer based on the value of + lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup + will point to foreign_table_name. If 2, then another string is + allocated from the heap and set to lower case. */ + void foreign_table_name_lookup_set(); + /** Set the referenced_table_name_lookup pointer based on the value of + lower_case_table_names. If that is 0 or 1, referenced_table_name_lookup + will point to referenced_table_name. If 2, then another string is + allocated from the heap and set to lower case. */ + void referenced_table_name_lookup_set(); - dict_vcol_set* v_cols; /*!< set of virtual columns affected - by foreign key constraint. */ + /** The flags for ON_UPDATE and ON_DELETE can be ORed; + the default is that a foreign key constraint is enforced, + therefore RESTRICT just means no flag */ + static constexpr unsigned DELETE_CASCADE= 1U; + static constexpr unsigned DELETE_SET_NULL= 2U; + static constexpr unsigned UPDATE_CASCADE= 4U; + static constexpr unsigned UPDATE_SET_NULL= 8U; + static constexpr unsigned DELETE_NO_ACTION= 16U; + static constexpr unsigned UPDATE_NO_ACTION= 32U; +private: + /** Check whether the name exists in given column names + @retval offset or UINT_MAX if name not found */ + unsigned col_exists(const char *name, const char **names) const noexcept + { + for (unsigned i= 0; i < n_fields; i++) + { + if (!strcmp(names[i], name)) + return i; + } + return UINT_MAX; + } - /** Check whether the fulltext index gets affected by - foreign key constraint */ - bool affects_fulltext() const; +public: + /** Check whether the name exists in the foreign key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_fk_exists(const char *name) const noexcept + { + return col_exists(name, foreign_col_names); + } - /**********************************************************************//** - Sets the foreign_table_name_lookup pointer based on the value of - lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup - will point to foreign_table_name. If 2, then another string is - allocated from the heap and set to lower case. */ - void foreign_table_name_lookup_set(); + /** Check whether the name exists in the referenced + key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_ref_exists(const char *name) const noexcept + { + return col_exists(name, referenced_col_names); + } - /**********************************************************************//** - Sets the referenced_table_name_lookup pointer based on the value of - lower_case_table_names. If that is 0 or 1, referenced_table_name_lookup - will point to referenced_table_name. If 2, then another string is - allocated from the heap and set to lower case. */ - void referenced_table_name_lookup_set(); + /** Check whether the foreign key constraint depends on + the nullability of the referenced column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_not_null(const char *name) const noexcept + { + if (!foreign_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_ref_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return foreign_index->fields[offset].col->prtype & DATA_NOT_NULL; + } + + /** Check whether the foreign key constraint depends on + the nullability of the foreign column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_null(const char *name) const noexcept + { + if (!referenced_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_fk_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return !(referenced_index->fields[offset].col->prtype & DATA_NOT_NULL); + } + + /** This is called during CREATE TABLE statement + to check the foreign key nullability constraint + @return true if foreign key constraint is valid + or else false */ + bool check_fk_constraint_valid() + { + if (!type || type & (DELETE_CASCADE | DELETE_NO_ACTION | + UPDATE_NO_ACTION)) + return true; + + if (!referenced_index) + return true; + + for (unsigned i= 0; i < n_fields; i++) + { + dict_col_t *col = foreign_index->fields[i].col; + if (col->prtype & DATA_NOT_NULL) + { + /* Foreign type is ON DELETE SET NULL + or ON UPDATE SET NULL */ + if (type & (DELETE_SET_NULL | UPDATE_SET_NULL)) + return false; + + dict_col_t *ref_col= referenced_index->fields[i].col; + /* Referenced index respective fields shouldn't be NULL */ + if (!(ref_col->prtype & DATA_NOT_NULL)) + return false; + } + } + return true; + } }; std::ostream& @@ -1674,17 +1775,6 @@ struct dict_foreign_set_free { const dict_foreign_set& m_foreign_set; }; -/** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that -a foreign key constraint is enforced, therefore RESTRICT just means no flag */ -/* @{ */ -#define DICT_FOREIGN_ON_DELETE_CASCADE 1U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_DELETE_SET_NULL 2U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_UPDATE_CASCADE 4U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16U /*!< ON DELETE NO ACTION */ -#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32U /*!< ON UPDATE NO ACTION */ -/* @} */ - /** Display an identifier. @param[in,out] s output stream @param[in] id_name SQL identifier (other than table name) diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 6c93bf00cf5..ea5fe2059fb 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -494,9 +494,6 @@ public: /** Close each file. Only invoked on fil_system.temp_space. */ void close(); - /** Note that operations on the tablespace must stop. */ - inline void set_stopping(); - /** Drop the tablespace and wait for any pending operations to cease @param id tablespace identifier @param detached_handle pointer to file to be closed later, or nullptr @@ -555,32 +552,14 @@ public: /** Clear the NEEDS_FSYNC flag */ void clear_flush() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - __asm__ __volatile__("lock btrl $28, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 28); -#else n_pending.fetch_and(~NEEDS_FSYNC, std::memory_order_release); -#endif } private: /** Clear the CLOSING flag */ void clear_closing() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(CLOSING == 1U << 29, "compatibility"); - __asm__ __volatile__("lock btrl $29, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(CLOSING == 1U << 29, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 29); -#else n_pending.fetch_and(~CLOSING, std::memory_order_relaxed); -#endif } /** @return pending operations (and flags) */ @@ -1534,21 +1513,6 @@ inline void fil_space_t::reacquire() #endif /* SAFE_MUTEX */ } -/** Note that operations on the tablespace must stop. */ -inline void fil_space_t::set_stopping() -{ - mysql_mutex_assert_owner(&fil_system.mutex); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&n_pending), 30); -#else - n_pending.fetch_or(STOPPING_WRITES, std::memory_order_relaxed); -#endif -} - /** Flush pending writes from the file system cache to the file. */ template inline void fil_space_t::flush() { diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 7f9c209ca6a..b09dcfc9bab 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -37,6 +37,9 @@ simple headers. /* Forward declarations */ class THD; class Field; +struct dict_table_t; +struct dict_foreign_t; +struct table_name_t; // JAN: TODO missing features: #undef MYSQL_FT_INIT_EXT @@ -83,7 +86,7 @@ innobase_invalidate_query_cache( void innobase_quote_identifier( FILE* file, - trx_t* trx, + const trx_t* trx, const char* id); /** Quote an standard SQL identifier like tablespace, index or column name. @@ -93,7 +96,7 @@ Return the string as an std:string object. @return a std::string with id properly quoted. */ std::string innobase_quote_identifier( - trx_t* trx, + const trx_t* trx, const char* id); /*****************************************************************//** @@ -382,23 +385,20 @@ innobase_convert_to_filename_charset( const char* from, /* in: identifier to convert */ ulint len); /* in: length of 'to', in bytes */ -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -void -ib_push_warning( - trx_t* trx, /*!< in: trx */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...); +/** Report that a table cannot be decrypted. +@param thd connection context +@param table table that cannot be decrypted +@retval DB_DECRYPTION_FAILED (always) */ +ATTRIBUTE_COLD +dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table); -/********************************************************************//** -Helper function to push warnings from InnoDB internals to SQL-layer. */ -void -ib_push_warning( - void* ithd, /*!< in: thd */ - dberr_t error, /*!< in: error code to push as warning */ - const char *format,/*!< in: warning message */ - ...); +/** Report a foreign key error. +@param error error to report +@param name table name +@param foreign constraint */ +ATTRIBUTE_COLD +void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name, + const dict_foreign_t& foreign); /********************************************************************//** Helper function to push warnings from InnoDB internals to SQL-layer. */ diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index cab44dd9a8e..3d553cfa518 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -781,28 +781,28 @@ public: ATTRIBUTE_NOINLINE void rd_unlock(); #else /** Acquire exclusive lock_sys.latch */ - void wr_lock() + void wr_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.wr_lock(); } /** Release exclusive lock_sys.latch */ - void wr_unlock() { latch.wr_unlock(); } + void wr_unlock() noexcept { latch.wr_unlock(); } /** Acquire shared lock_sys.latch */ - void rd_lock() + void rd_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.rd_lock(); } /** Release shared lock_sys.latch */ - void rd_unlock() { latch.rd_unlock(); } + void rd_unlock() noexcept { latch.rd_unlock(); } #endif /** Try to acquire exclusive lock_sys.latch @return whether the latch was acquired */ - bool wr_lock_try() { return latch.wr_lock_try(); } + bool wr_lock_try() noexcept { return latch.wr_lock_try(); } /** Try to acquire shared lock_sys.latch @return whether the latch was acquired */ - bool rd_lock_try() { return latch.rd_lock_try(); } + bool rd_lock_try() noexcept { return latch.rd_lock_try(); } /** Assert that wr_lock() has been invoked by this thread */ void assert_locked() const { ut_ad(latch.have_wr()); } diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 21723c2610c..9d8705d8760 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -118,15 +118,14 @@ public: @return file size in bytes @retval 0 if not readable */ os_offset_t open(bool read_only) noexcept; + + /** @return whether a handle to the log is open */ bool is_opened() const noexcept { return m_file != OS_FILE_CLOSED; } dberr_t close() noexcept; dberr_t read(os_offset_t offset, span buf) noexcept; void write(os_offset_t offset, span buf) noexcept; bool flush() const noexcept { return os_file_flush(m_file); } -#ifdef HAVE_PMEM - byte *mmap(bool read_only, const struct stat &st) noexcept; -#endif }; /** Redo log buffer */ @@ -189,7 +188,7 @@ private: public: /** number of append_prepare_wait(); protected by lock_lsn() or lsn_lock */ size_t waits; - /** innodb_log_buffer_size (size of buf,flush_buf if !is_pmem(), in bytes) */ + /** innodb_log_buffer_size (size of buf,flush_buf if !is_mmap(), in bytes) */ unsigned buf_size; /** log file size in bytes, including the header */ lsn_t file_size; @@ -231,7 +230,7 @@ public: /** Last written LSN */ lsn_t write_lsn; - /** buffer for writing data to ib_logfile0, or nullptr if is_pmem() + /** Buffer for writing data to ib_logfile0, or nullptr if is_mmap(). In write_buf(), buf and flush_buf may be swapped */ byte *flush_buf; @@ -280,6 +279,19 @@ public: uint write_size; /** format of the redo log: e.g., FORMAT_10_8 */ uint32_t format; +#ifdef HAVE_INNODB_MMAP + /** whether the memory-mapped interface is enabled for the log */ + my_bool log_mmap; + /** the default value of log_mmap */ + static constexpr bool log_mmap_default= +# if defined __linux__ /* MAP_POPULATE would enable read-ahead */ + true || +# elif defined __FreeBSD__ /* MAP_PREFAULT_READ would enable read-ahead */ + true || +# else /* an unnecessary read-ahead of a large ib_logfile0 is a risk */ +# endif + false; +#endif #if defined __linux__ || defined _WIN32 /** whether file system caching is enabled for the log */ my_bool log_buffered; @@ -324,7 +336,7 @@ public: /** whether there is capacity in the log buffer */ bool buf_free_ok() const noexcept { - ut_ad(!is_pmem()); + ut_ad(!is_mmap()); return (buf_free.load(std::memory_order_relaxed) & ~buf_free_LOCK) < max_buf_free; } @@ -334,12 +346,14 @@ public: void set_buf_free(size_t f) noexcept { ut_ad(f < buf_free_LOCK); buf_free.store(f, std::memory_order_relaxed); } -#ifdef HAVE_PMEM - bool is_pmem() const noexcept { return !flush_buf; } +#ifdef HAVE_INNODB_MMAP + bool is_mmap() const noexcept { return !flush_buf; } #else - static constexpr bool is_pmem() { return false; } + static constexpr bool is_mmap() { return false; } #endif + /** @return whether a handle to the log is open; + is_mmap() && !is_opened() holds for PMEM */ bool is_opened() const noexcept { return log.is_opened(); } /** @return target write LSN to react on !buf_free_ok() */ @@ -383,33 +397,28 @@ public: @return whether an error occurred */ static bool resize_rename() noexcept; -#ifdef HAVE_PMEM /** @return pointer for writing to resize_buf - @retval nullptr if no PMEM based resizing is active */ + @retval nullptr if no is_mmap() based resizing is active */ inline byte *resize_buf_begin(lsn_t lsn) const noexcept; /** @return end of resize_buf */ inline const byte *resize_buf_end() const noexcept { return resize_buf + resize_target; } /** Initialise the redo log subsystem. */ - void create_low(); - /** Initialise the redo log subsystem. - @return whether the initialisation succeeded */ - bool create() { create_low(); return true; } + void create(); /** Attach a log file. @return whether the memory allocation succeeded */ bool attach(log_file_t file, os_offset_t size); -#else - /** Initialise the redo log subsystem. - @return whether the initialisation succeeded */ - bool create(); - /** Attach a log file. */ - void attach_low(log_file_t file, os_offset_t size); - bool attach(log_file_t file, os_offset_t size) - { attach_low(file, size); return true; } -#endif +#ifdef HAVE_INNODB_MMAP + /** Disable memory-mapped access (update log_mmap) */ + void clear_mmap(); + void close_file(bool really_close= true); +#else + static void clear_mmap() {} + void close_file(); +#endif #if defined __linux__ || defined _WIN32 /** Try to enable or disable file system caching (update log_buffered) */ void set_buffered(bool buffered); @@ -417,8 +426,6 @@ public: /** Try to enable or disable durable writes (update log_write_through) */ void set_write_through(bool write_through); - void close_file(); - /** Calculate the checkpoint safety margins. */ static void set_capacity(); @@ -456,8 +463,9 @@ public: #ifdef HAVE_PMEM /** Persist the log. - @param lsn desired new value of flushed_to_disk_lsn */ - inline void persist(lsn_t lsn) noexcept; + @param lsn desired new value of flushed_to_disk_lsn + @param holding_latch whether the caller is holding exclusive latch */ + void persist(lsn_t lsn, bool holding_latch) noexcept; #endif bool check_for_checkpoint() const @@ -497,11 +505,11 @@ private: public: /** Reserve space in the log buffer for appending data. @tparam spin whether to use the spin-only lock_lsn() - @tparam pmem log_sys.is_pmem() + @tparam mmap log_sys.is_mmap() @param size total length of the data to append(), in bytes @param ex whether log_sys.latch is exclusively locked @return the start LSN and the buffer position for append() */ - template + template std::pair append_prepare(size_t size, bool ex) noexcept; /** Append a string of bytes to the redo log. diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 9321a8b80d5..3c9fb5997b4 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -398,19 +398,18 @@ private: ATTRIBUTE_COLD void report_progress() const; public: /** Parse and register one log_t::FORMAT_10_8 mini-transaction, - handling log_sys.is_pmem() buffer wrap-around. + without handling any log_sys.is_mmap() buffer wrap-around. @tparam store whether to store the records @param if_exists if store: whether to check if the tablespace exists */ template static parse_mtr_result parse_mtr(bool if_exists) noexcept; - /** Parse and register one log_t::FORMAT_10_8 mini-transaction, - handling log_sys.is_pmem() buffer wrap-around. + handling log_sys.is_mmap() buffer wrap-around. @tparam store whether to store the records @param if_exists if store: whether to check if the tablespace exists */ template - static parse_mtr_result parse_pmem(bool if_exists) noexcept -#ifdef HAVE_PMEM + static parse_mtr_result parse_mmap(bool if_exists) noexcept +#ifdef HAVE_INNODB_MMAP ; #else { return parse_mtr(if_exists); } diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 27811872c58..d086cfebffc 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -687,7 +687,7 @@ private: ATTRIBUTE_NOINLINE void encrypt(); /** Commit the mini-transaction log. - @tparam pmem log_sys.is_pmem() + @tparam pmem log_sys.is_mmap() @param mtr mini-transaction @param lsns {start_lsn,flush_ahead} */ template @@ -699,11 +699,11 @@ private: /** Append the redo log records to the redo log buffer. @tparam spin whether to use the spin-only log_sys.lock_lsn() - @tparam pmem log_sys.is_pmem() + @tparam mmap log_sys.is_mmap() @param mtr mini-transaction @param len number of bytes to write @return {start_lsn,flush_ahead} */ - template static + template static std::pair finish_writer(mtr_t *mtr, size_t len); /** The applicable variant of commit_log() */ diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index 4881f2f1d35..ecd994dbbcb 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -39,15 +39,7 @@ protected: /** Start waiting for an exclusive lock. */ void write_lock_wait_start() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (lock)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&lock), 30); -#else lock.fetch_or(WRITER_WAITING, std::memory_order_relaxed); -#endif } /** Start waiting for an exclusive lock. @return current value of the lock word */ diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 10edc2ad0a0..79a3e7c42a7 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -43,10 +43,10 @@ class pthread_mutex_wrapper final /** whether the mutex is usable; set by init(); cleared by destroy() */ bool initialized{false}; public: - ~pthread_mutex_wrapper() { ut_ad(!initialized); } + ~pthread_mutex_wrapper() noexcept { ut_ad(!initialized); } #endif public: - void init() + void init() noexcept { ut_ad(!initialized); ut_d(initialized= true); @@ -55,31 +55,31 @@ public: else pthread_mutex_init(&lock, nullptr); } - void destroy() + void destroy() noexcept { ut_ad(initialized); ut_d(initialized=false); pthread_mutex_destroy(&lock); } # ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - void wr_lock() { ut_ad(initialized); pthread_mutex_lock(&lock); } + void wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } # else private: - void wr_wait(); + void wr_wait() noexcept; public: - inline void wr_lock(); + inline void wr_lock() noexcept; # endif - void wr_unlock() { ut_ad(initialized); pthread_mutex_unlock(&lock); } - bool wr_lock_try() + void wr_unlock() noexcept { ut_ad(initialized); pthread_mutex_unlock(&lock); } + bool wr_lock_try() noexcept { ut_ad(initialized); return !pthread_mutex_trylock(&lock); } }; # ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait(); +template<> void pthread_mutex_wrapper::wr_wait() noexcept; template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } # endif @@ -90,11 +90,13 @@ template class srw_mutex_impl final { friend ssux_lock_impl; - /** The lock word, containing HOLDER + 1 if the lock is being held, - plus the number of waiters */ + /** The lock word, containing HOLDER + WAITER if the lock is being held, + plus WAITER times the number of waiters */ std::atomic lock; /** Identifies that the lock is being held */ - static constexpr uint32_t HOLDER= 1U << 31; + static constexpr uint32_t HOLDER= 1; + /** Identifies a lock waiter */ + static constexpr uint32_t WAITER= 2; #ifdef SUX_LOCK_GENERIC public: @@ -106,22 +108,22 @@ private: #endif /** Wait until the mutex has been acquired */ - void wait_and_lock(); + void wait_and_lock() noexcept; /** Wait for lock!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wake up one wait() thread */ - void wake(); + void wake() noexcept; /** Wake up all wait() threads */ - inline void wake_all(); + inline void wake_all() noexcept; public: /** @return whether the mutex is being held or waited for */ - bool is_locked_or_waiting() const + bool is_locked_or_waiting() const noexcept { return lock.load(std::memory_order_acquire) != 0; } /** @return whether the mutex is being held by any thread */ - bool is_locked() const + bool is_locked() const noexcept { return (lock.load(std::memory_order_acquire) & HOLDER) != 0; } - void init() + void init() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -129,7 +131,7 @@ public: pthread_cond_init(&cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -139,19 +141,20 @@ public: } /** @return whether the mutex was acquired */ - bool wr_lock_try() + bool wr_lock_try() noexcept { uint32_t lk= 0; - return lock.compare_exchange_strong(lk, HOLDER + 1, + return lock.compare_exchange_strong(lk, HOLDER + WAITER, std::memory_order_acquire, std::memory_order_relaxed); } - void wr_lock() { if (!wr_lock_try()) wait_and_lock(); } - void wr_unlock() + void wr_lock() noexcept { if (!wr_lock_try()) wait_and_lock(); } + void wr_unlock() noexcept { - const uint32_t lk= lock.fetch_sub(HOLDER + 1, std::memory_order_release); - if (lk != HOLDER + 1) + const uint32_t lk= + lock.fetch_sub(HOLDER + WAITER, std::memory_order_release); + if (lk != HOLDER + WAITER) { DBUG_ASSERT(lk & HOLDER); wake(); @@ -193,16 +196,16 @@ class ssux_lock_impl static constexpr uint32_t WRITER= 1U << 31; /** Wait for readers!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wait for readers!=lk|WRITER */ - void wr_wait(uint32_t lk); + void wr_wait(uint32_t lk) noexcept; /** Wake up wait() on the last rd_unlock() */ - void wake(); + void wake() noexcept; /** Acquire a read lock */ - void rd_wait(); + void rd_wait() noexcept; public: - void init() + void init() noexcept { writer.init(); DBUG_ASSERT(is_vacant()); @@ -210,7 +213,7 @@ public: pthread_cond_init(&readers_cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(is_vacant()); writer.destroy(); @@ -219,17 +222,17 @@ public: #endif } /** @return whether any writer is waiting */ - bool is_waiting() const + bool is_waiting() const noexcept { return (readers.load(std::memory_order_relaxed) & WRITER) != 0; } #ifndef DBUG_OFF /** @return whether the lock is being held or waited for */ - bool is_vacant() const { return !is_locked_or_waiting(); } + bool is_vacant() const noexcept { return !is_locked_or_waiting(); } #endif /* !DBUG_OFF */ private: /** Try to acquire a shared latch. @return the lock word value if the latch was not acquired @retval 0 if the latch was acquired */ - uint32_t rd_lock_try_low() + uint32_t rd_lock_try_low() noexcept { uint32_t lk= 0; while (!readers.compare_exchange_weak(lk, lk + 1, @@ -241,11 +244,11 @@ private: } public: - bool rd_lock_try() { return rd_lock_try_low() == 0; } + bool rd_lock_try() noexcept { return rd_lock_try_low() == 0; } - bool u_lock_try() { return writer.wr_lock_try(); } + bool u_lock_try() noexcept { return writer.wr_lock_try(); } - bool wr_lock_try() + bool wr_lock_try() noexcept { if (!writer.wr_lock_try()) return false; @@ -258,19 +261,23 @@ public: return false; } - void rd_lock() { if (!rd_lock_try()) rd_wait(); } - void u_lock() + void rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } + void u_lock() noexcept { writer.wr_lock(); } - void wr_lock() + void wr_lock() noexcept { writer.wr_lock(); #if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 - /* On IA-32 and AMD64, this type of fetch_or() can only be implemented - as a loop around LOCK CMPXCHG. In this particular case, setting the - most significant bit using fetch_add() is equivalent, and is - translated into a simple LOCK XADD. */ + /* On IA-32 and AMD64, a fetch_XXX() that needs to return the + previous value of the word state can only be implemented + efficiently for fetch_add() or fetch_sub(), both of which + translate into a 80486 LOCK XADD instruction. Anything else would + translate into a loop around LOCK CMPXCHG. In this particular + case, we know that the bit was previously clear, and therefore + setting (actually toggling) the most significant bit using + fetch_add() or fetch_sub() is equivalent. */ static_assert(WRITER == 1U << 31, "compatibility"); if (uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire)) wr_wait(lk); @@ -280,23 +287,23 @@ public: #endif } - bool rd_u_upgrade_try() { return writer.wr_lock_try(); } + bool rd_u_upgrade_try() noexcept { return writer.wr_lock_try(); } - void u_wr_upgrade() + void u_wr_upgrade() noexcept { DBUG_ASSERT(writer.is_locked()); uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire); if (lk) wr_wait(lk); } - void wr_u_downgrade() + void wr_u_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); /* Note: Any pending rd_lock() will not be woken up until u_unlock() */ } - void u_rd_downgrade() + void u_rd_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); ut_d(uint32_t lk=) readers.fetch_add(1, std::memory_order_relaxed); @@ -304,18 +311,18 @@ public: u_unlock(); } - void rd_unlock() + void rd_unlock() noexcept { uint32_t lk= readers.fetch_sub(1, std::memory_order_release); ut_ad(~WRITER & lk); if (lk == WRITER + 1) wake(); } - void u_unlock() + void u_unlock() noexcept { writer.wr_unlock(); } - void wr_unlock() + void wr_unlock() noexcept { DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); @@ -331,10 +338,10 @@ public: bool is_locked_or_waiting() const noexcept { return is_locked() || writer.is_locked_or_waiting(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } }; #if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -351,20 +358,20 @@ class srw_lock_ rw_lock_t lk; # endif - void rd_wait(); - void wr_wait(); + void rd_wait() noexcept; + void wr_wait() noexcept; public: - void init() { IF_WIN(,my_rwlock_init(&lk, nullptr)); } - void destroy() { IF_WIN(,rwlock_destroy(&lk)); } - inline void rd_lock(); - inline void wr_lock(); - bool rd_lock_try() + void init() noexcept { IF_WIN(,my_rwlock_init(&lk, nullptr)); } + void destroy() noexcept { IF_WIN(,rwlock_destroy(&lk)); } + inline void rd_lock() noexcept; + inline void wr_lock() noexcept; + bool rd_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockShared(&lk), !rw_tryrdlock(&lk)); } - void rd_unlock() + void rd_unlock() noexcept { IF_WIN(ReleaseSRWLockShared(&lk), rw_unlock(&lk)); } - bool wr_lock_try() + bool wr_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockExclusive(&lk), !rw_trywrlock(&lk)); } - void wr_unlock() + void wr_unlock() noexcept { IF_WIN(ReleaseSRWLockExclusive(&lk), rw_unlock(&lk)); } #ifdef _WIN32 /** @return whether any lock may be held by any thread */ @@ -378,27 +385,27 @@ public: return is_locked(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } #endif }; -template<> void srw_lock_::rd_wait(); -template<> void srw_lock_::wr_wait(); +template<> void srw_lock_::rd_wait() noexcept; +template<> void srw_lock_::wr_wait() noexcept; template<> -inline void srw_lock_::rd_lock() +inline void srw_lock_::rd_lock() noexcept { IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } template<> -inline void srw_lock_::wr_lock() +inline void srw_lock_::wr_lock() noexcept { IF_WIN(AcquireSRWLockExclusive(&lk), rw_wrlock(&lk)); } template<> -inline void srw_lock_::rd_lock() { if (!rd_lock_try()) rd_wait(); } +inline void srw_lock_::rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } template<> -inline void srw_lock_::wr_lock() { if (!wr_lock_try()) wr_wait(); } +inline void srw_lock_::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } typedef srw_lock_ srw_lock_low; typedef srw_lock_ srw_spin_lock_low; @@ -424,17 +431,17 @@ class ssux_lock PSI_rwlock *pfs_psi; ssux_lock_impl lock; - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -443,56 +450,56 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void u_lock(const char *file, unsigned line) + void u_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_lock(file, line); else lock.u_lock(); } - void u_unlock() + void u_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.u_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - void u_wr_upgrade(const char *file, unsigned line) + void u_wr_upgrade(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_wr_upgrade(file, line); else lock.u_wr_upgrade(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool u_lock_try() { return lock.u_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - bool is_waiting() const { return lock.is_waiting(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool u_lock_try() noexcept { return lock.u_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + bool is_waiting() const noexcept { return lock.is_waiting(); } }; /** Slim reader-writer lock with PERFORMANCE_SCHEMA instrumentation */ @@ -506,15 +513,15 @@ class srw_lock_impl ssux_lock_impl lock; # endif - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -523,36 +530,36 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - void lock_shared() { return rd_lock(SRW_LOCK_CALL); } - void unlock_shared() { return rd_unlock(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + void lock_shared() noexcept { return rd_lock(SRW_LOCK_CALL); } + void unlock_shared() noexcept { return rd_unlock(); } #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ bool is_locked_or_waiting() const noexcept @@ -582,11 +589,11 @@ class srw_lock_debug : private srw_lock std::atomic*> readers; /** Register a read lock. */ - void readers_register(); + void readers_register() noexcept; public: - void SRW_LOCK_INIT(mysql_pfs_key_t key); - void destroy(); + void SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept; + void destroy() noexcept; #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ @@ -597,17 +604,17 @@ public: #endif /** Acquire an exclusive lock */ - void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether an exclusive lock was acquired */ - bool wr_lock_try(); + bool wr_lock_try() noexcept; /** Release after wr_lock() */ - void wr_unlock(); + void wr_unlock() noexcept; /** Acquire a shared lock */ - void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether a shared lock was acquired */ - bool rd_lock_try(); + bool rd_lock_try() noexcept; /** Release after rd_lock() */ - void rd_unlock(); + void rd_unlock() noexcept; /** @return whether this thread is between rd_lock() and rd_unlock() */ bool have_rd() const noexcept; /** @return whether this thread is between wr_lock() and wr_unlock() */ diff --git a/storage/innobase/include/transactional_lock_guard.h b/storage/innobase/include/transactional_lock_guard.h index 168a68977a7..40519f513b2 100644 --- a/storage/innobase/include/transactional_lock_guard.h +++ b/storage/innobase/include/transactional_lock_guard.h @@ -41,7 +41,7 @@ static inline bool xtest() { return false; } #else # if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # include # if defined __GNUC__ && !defined __INTEL_COMPILER @@ -52,7 +52,7 @@ bool transactional_lock_enabled(); # define TRANSACTIONAL_INLINE /* nothing */ # endif -TRANSACTIONAL_INLINE static inline bool xbegin() +TRANSACTIONAL_INLINE static inline bool xbegin() noexcept { return have_transactional_memory && _xbegin() == _XBEGIN_STARTED; } @@ -60,18 +60,18 @@ TRANSACTIONAL_INLINE static inline bool xbegin() # ifdef UNIV_DEBUG # ifdef __GNUC__ /** @return whether a memory transaction is active */ -bool xtest(); +bool xtest() noexcept; # else -static inline bool xtest() { return have_transactional_memory && _xtest(); } +static inline bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif # endif -TRANSACTIONAL_INLINE static inline void xabort() { _xabort(0); } +TRANSACTIONAL_INLINE static inline void xabort() noexcept { _xabort(0); } -TRANSACTIONAL_INLINE static inline void xend() { _xend(); } +TRANSACTIONAL_INLINE static inline void xend() noexcept { _xend(); } # elif defined __powerpc64__ || defined __s390__ extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # define TRANSACTIONAL_TARGET __attribute__((hot)) # define TRANSACTIONAL_INLINE __attribute__((hot,always_inline)) @@ -89,11 +89,11 @@ bool transactional_lock_enabled(); could be implemented here, we keep the implementation the same as ppc64. */ -TRANSACTIONAL_TARGET bool xbegin(); -TRANSACTIONAL_TARGET void xabort(); -TRANSACTIONAL_TARGET void xend(); +TRANSACTIONAL_TARGET bool xbegin() noexcept; +TRANSACTIONAL_TARGET void xabort() noexcept; +TRANSACTIONAL_TARGET void xend() noexcept; # ifdef UNIV_DEBUG -bool xtest(); +bool xtest() noexcept; # endif # endif @@ -105,7 +105,7 @@ class transactional_lock_guard mutex &m; public: - TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -117,8 +117,8 @@ public: #endif m.lock(); } - transactional_lock_guard(const transactional_lock_guard &)= delete; - TRANSACTIONAL_INLINE ~transactional_lock_guard() + transactional_lock_guard(const transactional_lock_guard &) noexcept= delete; + TRANSACTIONAL_INLINE ~transactional_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else @@ -144,7 +144,7 @@ class transactional_shared_lock_guard #endif public: - TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -160,9 +160,9 @@ public: #endif m.lock_shared(); } - transactional_shared_lock_guard(const transactional_shared_lock_guard &)= + transactional_shared_lock_guard(const transactional_shared_lock_guard &) noexcept= delete; - TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() + TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index e0051b2a1d0..1d77291b69d 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -85,26 +85,12 @@ private: /** Set the SKIP bit */ void ref_set_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandset(reinterpret_cast(&ref), 0); -#else ref.fetch_or(SKIP, std::memory_order_relaxed); -#endif } /** Clear a bit in ref */ void ref_reset_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset(reinterpret_cast(&ref), 0); -#else ref.fetch_and(~SKIP, std::memory_order_relaxed); -#endif } public: diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 3d4abb81e1d..14ee53ff3e1 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -346,15 +346,7 @@ struct trx_lock_t /** Flag the lock owner as a victim in Galera conflict resolution. */ void set_wsrep_victim() { -# if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - /* There is no 8-bit version of the 80386 BTS instruction. - Technically, this is the wrong addressing mode (16-bit), but - there are other data members stored after the byte. */ - __asm__ __volatile__("lock btsw $1, %0" - : "+m" (was_chosen_as_deadlock_victim)); -# else was_chosen_as_deadlock_victim.fetch_or(2); -# endif } #else /* defined(UNIV_DEBUG) || !defined(DBUG_OFF) */ @@ -1085,15 +1077,7 @@ public: void reset_skip_lock_inheritance() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__("lock btrl $31, %0" : : "m"(skip_lock_inheritance_and_n_ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset( - reinterpret_cast(&skip_lock_inheritance_and_n_ref), - 31); -#else skip_lock_inheritance_and_n_ref.fetch_and(~1U << 31); -#endif } /** @return whether the table has lock on diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 8ef01bc0353..7e1312e3f7e 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -169,6 +169,9 @@ using the call command. */ #define UNIV_INLINE static inline #define UNIV_WORD_SIZE SIZEOF_SIZE_T +#if SIZEOF_SIZE_T == 8 +# define HAVE_INNODB_MMAP +#endif /** The following alignment is used in memory allocations in memory heap management to ensure correct alignment for doubles etc. */ @@ -198,7 +201,7 @@ and 2 bits for flags. This limits the uncompressed page size to 16k. /* Define the Min, Max, Default page sizes. */ /** Minimum Page Size Shift (power of 2) */ #define UNIV_PAGE_SIZE_SHIFT_MIN 12U -/** log2 of largest page size (1<<16 == 64436 bytes). */ +/** log2 of largest page size (1<<16 == 65536 bytes). */ /** Maximum Page Size Shift (power of 2) */ #define UNIV_PAGE_SIZE_SHIFT_MAX 16U /** log2 of default page size (1<<14 == 16384 bytes). */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 27eb62841a6..7ae7fcfed69 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -496,15 +496,13 @@ void lock_sys_t::close() #ifdef WITH_WSREP # ifdef UNIV_DEBUG -/** Check if both conflicting lock transaction and other transaction -requesting record lock are brute force (BF). If they are check is -this BF-BF wait correct and if not report BF wait and assert. +/** Check if this BF-BF wait is correct and if not report and abort. @param lock other waiting lock @param trx transaction requesting conflicting lock */ -static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, - const unsigned type_mode = LOCK_NONE) +static void wsrep_assert_valid_bf_bf_wait(const lock_t *lock, const trx_t *trx, + const unsigned type_mode) { ut_ad(!lock->is_table()); lock_sys.assert_locked(*lock); @@ -514,12 +512,8 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, not acquire THD::LOCK_thd_data mutex below to avoid latching order violation. */ - if (!trx->is_wsrep() || !lock_trx->is_wsrep()) - return; - if (UNIV_LIKELY(!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) - || UNIV_LIKELY(!wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE))) - return; - + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, FALSE)); + ut_ad(wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE)); ut_ad(trx->state == TRX_STATE_ACTIVE); switch (lock_trx->state) { @@ -536,16 +530,6 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, ut_ad("invalid state" == 0); } - /* If BF - BF order is honored, i.e. trx already holding - record lock should be ordered before this new lock request - we can keep trx waiting for the lock. If conflicting - transaction is already aborting or rolling back for replaying - we can also let new transaction waiting. */ - if (wsrep_thd_order_before(lock_trx->mysql_thd, trx->mysql_thd) - || wsrep_thd_is_aborting(lock_trx->mysql_thd)) { - return; - } - if (type_mode != LOCK_NONE) ib::error() << " Requested lock " << ((type_mode & LOCK_TABLE) ? "on table " : " on record ") @@ -573,8 +557,81 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, /* BF-BF wait is a bug */ ut_error; } + +void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx); # endif /* UNIV_DEBUG */ +/** Check if a high priority (BF) trx has to wait for the current +lock holder based on Wsrep transaction state relations. + +This code resembles the one in `wsrep_handle_mdl_conflict()`, but +it's specific to the storage engine and it doesn't perform any +BF aborts by itself. +The decision whether to BF abort a victim may depend on other conditions +like lock compatibility between InnoDB transactions. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF trx has to wait for the lock to be removed +*/ +static bool wsrep_BF_has_to_wait(const lock_t *lock, const trx_t *trx, + bool report_bf_bf_wait, + const unsigned type_mode = LOCK_NONE) +{ + THD *request_thd= trx->mysql_thd; + THD *granted_thd= lock->trx->mysql_thd; + + ut_ad(wsrep_thd_is_BF(request_thd, false)); + ut_ad(lock->trx->is_wsrep()); + + /* Granted is aborting, let it complete. */ + if (wsrep_thd_is_aborting(granted_thd)) + return true; + + /* Granted is not BF, may BF abort it. */ + if (!wsrep_thd_is_BF(granted_thd, false)) + return false; + + /* Applying SR cannot BF abort other high priority (BF). */ + if (wsrep_thd_is_SR(request_thd)) + return true; + + /* Requester is truly BF and granted is applying SR in progress. */ + if (wsrep_thd_is_SR(granted_thd)) + return false; + +#ifdef UNIV_DEBUG + if (report_bf_bf_wait) + wsrep_report_error(lock, trx); + /* We very well can let BF to wait normally as other + BF will be replayed in case of conflict. For debug + builds we will do additional sanity checks to catch + unsupported BF wait if any. */ + ut_d(wsrep_assert_valid_bf_bf_wait(lock, trx, type_mode)); +#endif + return true; +} + +/** Determine whether BF abort on the lock holder is needed. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF abort is needed +*/ +static bool wsrep_will_BF_abort(const lock_t *lock, const trx_t *trx) +{ + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, false)); + + /* Don't BF abort system transactions. */ + if (!lock->trx->is_wsrep()) + return false; + + /* BF trx will wait for the lock, but it doesn't have to according + to Wsrep rules, meaning it must BF abort the lock holder. */ + return lock_has_to_wait(trx->lock.wait_lock, lock) && + !wsrep_BF_has_to_wait(lock, trx, true); +} + /** check if lock timeout was for priority thread, as a side effect trigger lock monitor @param trx transaction owning the lock @@ -648,19 +705,9 @@ bool lock_rec_has_to_wait_wsrep(const trx_t *trx, return false; } - if (wsrep_thd_order_before(trx->mysql_thd, trx2->mysql_thd)) - { - /* If two high priority threads have lock conflict, we look at the - order of these transactions and honor the earlier transaction. */ - - return false; - } - - /* We very well can let bf to wait normally as other - BF will be replayed in case of conflict. For debug - builds we will do additional sanity checks to catch - unsupported bf wait if any. */ - ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx, type_mode)); + /* If two high priority threads have lock conflict, we check if + new lock request has to wait for the transaction holding the lock. */ + return wsrep_BF_has_to_wait(lock2, trx, false, type_mode); } return true; @@ -997,14 +1044,13 @@ void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx) lock_rec_print(stderr, bf_trx->lock.wait_lock, mtr); WSREP_ERROR("victim holding lock: "); lock_rec_print(stderr, victim_lock, mtr); - wsrep_assert_no_bf_bf_wait(victim_lock, bf_trx); } #endif /* WITH_DEBUG */ /** Kill the holders of conflicting locks. @param trx brute-force applier transaction running in the current thread */ ATTRIBUTE_COLD ATTRIBUTE_NOINLINE -static void lock_wait_wsrep(trx_t *trx) +static void wsrep_handle_lock_conflict(trx_t *trx) { DBUG_ASSERT(wsrep_on(trx->mysql_thd)); if (!wsrep_thd_is_BF(trx->mysql_thd, false)) @@ -1030,8 +1076,8 @@ func_exit: for (lock_t *lock= UT_LIST_GET_FIRST(table->locks); lock; lock= UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) { - /* Victim trx needs to be different from BF trx and it has to have a - THD so that we can kill it. Victim might not have THD in two cases: + /* Victim trx has to have a THD so that we can kill it. + Victim might not have THD in two cases: (1) An incomplete transaction that was recovered from undo logs on server startup (and not yet rolled back). @@ -1039,8 +1085,8 @@ func_exit: (2) Transaction that is in XA PREPARE state and whose client connection was disconnected. - Neither of these can complete before lock_wait_wsrep() releases - lock_sys.latch. + Neither of these can complete before wsrep_handle_lock_conflict() + releases lock_sys.latch. (1) trx_t::commit_in_memory() is clearing both trx_t::state and trx_t::is_recovered before it invokes @@ -1051,24 +1097,9 @@ func_exit: (2) If is in XA PREPARE state, it would eventually be rolled back and the lock conflict would be resolved when an XA COMMIT or XA ROLLBACK statement is executed in some other connection. - - If victim has also BF status, but has earlier seqno, we have to wait. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } @@ -1090,21 +1121,8 @@ func_exit: record-locks instead of table locks. See details from comment above. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } while ((lock= lock_rec_get_next(heap_no, lock))); @@ -2015,7 +2033,7 @@ dberr_t lock_wait(que_thr_t *thr) ut_ad(!trx->dict_operation_lock_mode); - IF_WSREP(if (trx->is_wsrep()) lock_wait_wsrep(trx),); + IF_WSREP(if (trx->is_wsrep()) wsrep_handle_lock_conflict(trx),); const auto type_mode= wait_lock->type_mode; #ifdef HAVE_REPLICATION diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index a5446ffa502..88997b1073f 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -45,6 +45,7 @@ Created 12/9/1995 Heikki Tuuri #include "buf0dump.h" #include "log0sync.h" #include "log.h" +#include "tpool.h" /* General philosophy of InnoDB redo-logs: @@ -85,11 +86,7 @@ void log_t::set_capacity() log_sys.max_checkpoint_age = margin; } -#ifdef HAVE_PMEM -void log_t::create_low() -#else -bool log_t::create() -#endif +void log_t::create() { ut_ad(this == &log_sys); ut_ad(!is_initialised()); @@ -100,35 +97,10 @@ bool log_t::create() need_checkpoint.store(true, std::memory_order_relaxed); write_lsn= FIRST_LSN; -#ifndef HAVE_PMEM - buf= static_cast(ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME)); - if (!buf) - { - alloc_fail: - sql_print_error("InnoDB: Cannot allocate memory;" - " too large innodb_log_buffer_size?"); - return false; - } - flush_buf= static_cast(ut_malloc_dontdump(buf_size, - PSI_INSTRUMENT_ME)); - if (!flush_buf) - { - ut_free_dodump(buf, buf_size); - buf= nullptr; - goto alloc_fail; - } - - TRASH_ALLOC(buf, buf_size); - TRASH_ALLOC(flush_buf, buf_size); - checkpoint_buf= static_cast(aligned_malloc(4096, 4096)); - memset_aligned<4096>(checkpoint_buf, 0, 4096); - max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; -#else ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); max_buf_free= 1; -#endif latch.SRW_LOCK_INIT(log_latch_key); lsn_lock.init(); @@ -143,9 +115,6 @@ bool log_t::create() set_buf_free(0); ut_ad(is_initialised()); -#ifndef HAVE_PMEM - return true; -#endif } dberr_t log_file_t::close() noexcept @@ -163,36 +132,144 @@ __attribute__((warn_unused_result)) dberr_t log_file_t::read(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - return os_file_read(IORequestRead, m_file, buf.data(), offset, buf.size(), - nullptr); + byte *data= buf.data(); + size_t size= buf.size(); + ut_ad(size); + ssize_t s; + + for (;;) + { + s= IF_WIN(tpool::pread(m_file, data, size, offset), + pread(m_file, data, size, offset)); + if (UNIV_UNLIKELY(s <= 0)) + break; + size-= size_t(s); + if (!size) + return DB_SUCCESS; + offset+= s; + data+= s; + ut_a(size < buf.size()); + } + + sql_print_error("InnoDB: pread(\"ib_logfile0\") returned %zd," + " operating system error %u", + s, unsigned(IF_WIN(GetLastError(), errno))); + return DB_IO_ERROR; } void log_file_t::write(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); - if (dberr_t err= os_file_write_func(IORequestWrite, "ib_logfile0", m_file, - buf.data(), offset, buf.size())) - ib::fatal() << "write(\"ib_logfile0\") returned " << err - << ". Operating system error number " - << IF_WIN(GetLastError(), errno) << "."; + const byte *data= buf.data(); + size_t size= buf.size(); + ut_ad(size); + ssize_t s; + + for (;;) + { + s= IF_WIN(tpool::pwrite(m_file, data, size, offset), + pwrite(m_file, data, size, offset)); + if (UNIV_UNLIKELY(s <= 0)) + break; + size-= size_t(s); + if (!size) + return; + offset+= s; + data+= s; + ut_a(size < buf.size()); + } + + sql_print_error("[FATAL] InnoDB: pwrite(\"ib_logfile0\") returned %zd," + " operating system error %u", + s, unsigned(IF_WIN(GetLastError(), errno))); + abort(); } -#ifdef HAVE_PMEM -# include "cache.h" +#ifdef HAVE_INNODB_MMAP +# ifdef HAVE_PMEM +# include "cache.h" +# endif /** Attempt to memory map a file. @param file log file handle @param size file size @return pointer to memory mapping @retval MAP_FAILED if the memory cannot be mapped */ -static void *log_mmap(os_file_t file, os_offset_t size) +static void *log_mmap(os_file_t file, +# ifdef HAVE_PMEM + bool &is_pmem, /*!< whether the file is on pmem */ +# endif + os_offset_t size) { - void *ptr= - my_mmap(0, size_t(size), - srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE, - MAP_SHARED_VALIDATE | MAP_SYNC, file, 0); -#ifdef __linux__ - if (ptr == MAP_FAILED) + if (my_system_page_size > 4096) + return MAP_FAILED; +# ifndef HAVE_PMEM + if (!log_sys.log_mmap) + /* If support for persistent memory (Linux: mount -o dax) is enabled, + we always attempt to open a MAP_SYNC memory mapping to ib_logfile0. + This mapping will be read-only during crash recovery, and read-write + during normal operation. + + A regular read-only memory mapping may be attempted if + innodb_log_file_mmap=ON. This may benefit mariadb-backup + and crash recovery. */ + return MAP_FAILED; +# endif + + /* For now, InnoDB does not support memory-mapped writes to + a regular log file. + + If PMEM is supported, the initially attempted memory mapping may + be read-write, but the fallback will be read-only. + + The mapping will always be read-only if innodb_read_only=ON or + if mariadb-backup is running in any other mode than --prepare --export. */ + const bool read_only= + srv_read_only_mode || srv_operation >= SRV_OPERATION_BACKUP; + +# ifdef _WIN32 + void *ptr= MAP_FAILED; + if (!read_only); + else if (HANDLE h= + CreateFileMappingA(file, nullptr, PAGE_READONLY, + DWORD(size >> 32), DWORD(size), nullptr)) + { + if (h != INVALID_HANDLE_VALUE) + { + ptr= MapViewOfFileEx(h, FILE_MAP_READ, 0, 0, size, nullptr); + CloseHandle(h); + if (!ptr) + ptr= MAP_FAILED; + } + } +# else + int flags= +# ifdef HAVE_PMEM + MAP_SHARED_VALIDATE | MAP_SYNC, +# else + MAP_SHARED, +# endif + prot= PROT_READ; + + if (!read_only) +# ifdef HAVE_PMEM + prot= PROT_READ | PROT_WRITE; +# else + return MAP_FAILED; +# endif + + void *ptr= my_mmap(0, size_t(size), prot, flags, file, 0); + +# ifdef HAVE_PMEM + is_pmem= ptr != MAP_FAILED; +# endif + + if (ptr != MAP_FAILED) + return ptr; + +# ifdef HAVE_PMEM +# ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ + if (srv_operation < SRV_OPERATION_BACKUP) { struct stat st; if (!fstat(file, &st)) @@ -202,46 +279,82 @@ static void *log_mmap(os_file_t file, os_offset_t size) if (!stat("/dev/shm", &st)) { MSAN_STAT_WORKAROUND(&st); - if (st.st_dev == st_dev) - ptr= my_mmap(0, size_t(size), - srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE, - MAP_SHARED, file, 0); + is_pmem= st.st_dev == st_dev; + if (!is_pmem) + return ptr; /* MAP_FAILED */ } } } -#endif /* __linux__ */ +# endif /* __linux__ */ + if (read_only && log_sys.log_mmap) + ptr= my_mmap(0, size_t(size), PROT_READ, MAP_SHARED, file, 0); +# endif /* HAVE_PMEM */ +# endif return ptr; } #endif -#ifdef HAVE_PMEM -bool log_t::attach(log_file_t file, os_offset_t size) +#if defined __linux__ || defined _WIN32 +/** Display a message about opening the log */ +ATTRIBUTE_COLD static void log_file_message() +{ + sql_print_information("InnoDB: %s (block size=%u bytes)", +# ifdef HAVE_INNODB_MMAP + log_sys.log_mmap + ? (log_sys.log_buffered + ? "Memory-mapped log" + : "Memory-mapped unbuffered log") + : +# endif + log_sys.log_buffered + ? "Buffered log writes" + : "File system buffers for log disabled", + log_sys.write_size); +} #else -void log_t::attach_low(log_file_t file, os_offset_t size) +static inline void log_file_message() {} #endif + +bool log_t::attach(log_file_t file, os_offset_t size) { log= file; ut_ad(!size || size >= START_OFFSET + SIZE_OF_FILE_CHECKPOINT); file_size= size; -#ifdef HAVE_PMEM ut_ad(!buf); ut_ad(!flush_buf); - if (size && !(size_t(size) & 4095) && srv_operation != SRV_OPERATION_BACKUP) +#ifdef HAVE_INNODB_MMAP + if (size) { - void *ptr= log_mmap(log.m_file, size); +# ifdef HAVE_PMEM + bool is_pmem; + void *ptr= ::log_mmap(log.m_file, is_pmem, size); +# else + void *ptr= ::log_mmap(log.m_file, size); +# endif if (ptr != MAP_FAILED) { - log.close(); - mprotect(ptr, size_t(size), PROT_READ); +# ifdef HAVE_PMEM + if (is_pmem) + { + log.close(); + log_buffered= false; + log_maybe_unbuffered= true; + IF_WIN(,mprotect(ptr, size_t(size), PROT_READ)); + } +# endif buf= static_cast(ptr); max_buf_free= 1; - log_maybe_unbuffered= true; - log_buffered= false; mtr_t::finisher_update(); - return true; +# ifdef HAVE_PMEM + if (is_pmem) + return true; +# endif + goto func_exit; } } + log_mmap= false; +#endif buf= static_cast(ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME)); if (!buf) { @@ -255,33 +368,34 @@ void log_t::attach_low(log_file_t file, os_offset_t size) PSI_INSTRUMENT_ME)); if (!flush_buf) { + alloc_fail2: ut_free_dodump(buf, buf_size); buf= nullptr; goto alloc_fail; } - TRASH_ALLOC(buf, buf_size); - TRASH_ALLOC(flush_buf, buf_size); - max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; -#endif - -#if defined __linux__ || defined _WIN32 - sql_print_information("InnoDB: %s (block size=%u bytes)", - log_buffered - ? "Buffered log writes" - : "File system buffers for log disabled", - write_size); -#endif - - mtr_t::finisher_update(); -#ifdef HAVE_PMEM ut_ad(ut_is_2pow(write_size)); ut_ad(write_size >= 512); ut_ad(write_size <= 4096); checkpoint_buf= static_cast(aligned_malloc(write_size, write_size)); + if (!checkpoint_buf) + { + ut_free_dodump(flush_buf, buf_size); + flush_buf= nullptr; + goto alloc_fail2; + } + + TRASH_ALLOC(buf, buf_size); + TRASH_ALLOC(flush_buf, buf_size); + max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; + mtr_t::finisher_update(); memset_aligned<512>(checkpoint_buf, 0, write_size); - return true; + +#ifdef HAVE_INNODB_MMAP + func_exit: #endif + log_file_message(); + return true; } /** Write a log file header. @@ -324,66 +438,83 @@ void log_t::create(lsn_t lsn) noexcept last_checkpoint_lsn= 0; -#ifdef HAVE_PMEM - if (is_pmem()) - { - mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); - memset_aligned<4096>(buf, 0, 4096); - set_buf_free(START_OFFSET); - } - else -#endif - { - set_buf_free(0); - memset_aligned<4096>(flush_buf, 0, buf_size); - memset_aligned<4096>(buf, 0, buf_size); - } - - log_sys.header_write(buf, lsn, is_encrypted()); DBUG_PRINT("ib_log", ("write header " LSN_PF, lsn)); #ifdef HAVE_PMEM - if (is_pmem()) + if (is_mmap()) + { + ut_ad(!is_opened()); + mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); + memset_aligned<4096>(buf, 0, 4096); + log_sys.header_write(buf, lsn, is_encrypted()); + set_buf_free(START_OFFSET); pmem_persist(buf, 512); + } else #endif { + ut_ad(!is_mmap()); + set_buf_free(0); + memset_aligned<4096>(flush_buf, 0, buf_size); + memset_aligned<4096>(buf, 0, buf_size); + log_sys.header_write(buf, lsn, is_encrypted()); log.write(0, {buf, 4096}); memset_aligned<512>(buf, 0, 512); } } -void log_t::close_file() +ATTRIBUTE_COLD static void log_close_failed(dberr_t err) { -#ifdef HAVE_PMEM - if (is_pmem()) + ib::fatal() << "closing ib_logfile0 failed: " << err; +} + +#ifdef HAVE_INNODB_MMAP +void log_t::close_file(bool really_close) +#else +void log_t::close_file() +#endif +{ +#ifdef HAVE_INNODB_MMAP + if (is_mmap()) { - ut_ad(!is_opened()); ut_ad(!checkpoint_buf); + ut_ad(!flush_buf); if (buf) { my_munmap(buf, file_size); buf= nullptr; } - return; + } + else +#endif + { + ut_ad(!buf == !flush_buf); + ut_ad(!buf == !checkpoint_buf); + if (buf) + { + ut_free_dodump(buf, buf_size); + buf= nullptr; + ut_free_dodump(flush_buf, buf_size); + flush_buf= nullptr; + } + aligned_free(checkpoint_buf); + checkpoint_buf= nullptr; } - ut_free_dodump(buf, buf_size); - buf= nullptr; - ut_free_dodump(flush_buf, buf_size); - flush_buf= nullptr; - aligned_free(checkpoint_buf); - checkpoint_buf= nullptr; +#ifdef HAVE_INNODB_MMAP + if (really_close) #endif - if (is_opened()) - if (const dberr_t err= log.close()) - ib::fatal() << "closing ib_logfile0 failed: " << err; + if (is_opened()) + if (const dberr_t err= log.close()) + log_close_failed(err); } /** Acquire all latches that protect the log. */ static void log_resize_acquire() { - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (!log_sys.is_mmap()) +#endif { while (flush_lock.acquire(log_sys.get_lsn() + 1, nullptr) != group_commit_lock::ACQUIRED); @@ -399,7 +530,9 @@ void log_resize_release() { log_sys.latch.wr_unlock(); - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (!log_sys.is_mmap()) +#endif { lsn_t lsn1= write_lock.release(write_lock.value()); lsn_t lsn2= flush_lock.release(flush_lock.value()); @@ -412,13 +545,17 @@ void log_resize_release() /** Try to enable or disable file system caching (update log_buffered) */ void log_t::set_buffered(bool buffered) { - if (!log_maybe_unbuffered || is_pmem() || high_level_read_only) + if (!log_maybe_unbuffered || +#ifdef HAVE_PMEM + is_mmap() || +#endif + high_level_read_only) return; log_resize_acquire(); if (!resize_in_progress() && is_opened() && bool(log_buffered) != buffered) { - os_file_close_func(log.m_file); - log.m_file= OS_FILE_CLOSED; + if (const dberr_t err= log.close()) + log_close_failed(err); std::string path{get_log_file_path()}; log_buffered= buffered; bool success; @@ -426,11 +563,7 @@ void log_t::set_buffered(bool buffered) OS_FILE_OPEN, OS_FILE_NORMAL, OS_LOG_FILE, false, &success); ut_a(log.m_file != OS_FILE_CLOSED); - sql_print_information("InnoDB: %s (block size=%u bytes)", - log_buffered - ? "Buffered log writes" - : "File system buffers for log disabled", - write_size); + log_file_message(); } log_resize_release(); } @@ -439,7 +572,7 @@ void log_t::set_buffered(bool buffered) /** Try to enable or disable durable writes (update log_write_through) */ void log_t::set_write_through(bool write_through) { - if (is_pmem() || high_level_read_only) + if (is_mmap() || high_level_read_only) return; log_resize_acquire(); if (!resize_in_progress() && is_opened() && @@ -474,6 +607,9 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept resize_start_status status= RESIZE_NO_CHANGE; lsn_t start_lsn{0}; +#ifdef HAVE_PMEM + bool is_pmem{false}; +#endif if (resize_in_progress()) status= RESIZE_IN_PROGRESS; @@ -499,10 +635,15 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept void *ptr= nullptr, *ptr2= nullptr; success= os_file_set_size(path.c_str(), resize_log.m_file, size); if (!success); -#ifdef HAVE_PMEM - else if (is_pmem()) +#ifdef HAVE_INNODB_MMAP + else if (is_mmap()) { - ptr= log_mmap(resize_log.m_file, size); + ptr= ::log_mmap(resize_log.m_file, +#ifdef HAVE_PMEM + is_pmem, +#endif + size); + if (ptr == MAP_FAILED) goto alloc_fail; } @@ -542,12 +683,12 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept resize_flush_buf= static_cast(ptr2); start_lsn= get_lsn(); - if (is_pmem()) - resize_log.close(); - else + if (!is_mmap()) start_lsn= first_lsn + (~lsn_t{write_size - 1} & (lsn_t{write_size - 1} + start_lsn - first_lsn)); + else if (!is_opened()) + resize_log.close(); } resize_lsn.store(start_lsn, std::memory_order_relaxed); status= success ? RESIZE_STARTED : RESIZE_FAILED; @@ -576,14 +717,13 @@ void log_t::resize_abort() noexcept if (resize_in_progress() > 1) { - if (!is_pmem()) + if (!is_mmap()) { - resize_log.close(); ut_free_dodump(resize_buf, buf_size); ut_free_dodump(resize_flush_buf, buf_size); resize_flush_buf= nullptr; } -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP else { ut_ad(!resize_log.is_opened()); @@ -592,6 +732,8 @@ void log_t::resize_abort() noexcept my_munmap(resize_buf, resize_target); } #endif + if (resize_log.is_opened()) + resize_log.close(); resize_buf= nullptr; resize_target= 0; resize_lsn.store(0, std::memory_order_relaxed); @@ -754,33 +896,33 @@ static size_t log_pad(lsn_t lsn, size_t pad, byte *begin, byte *extra) #endif #ifdef HAVE_PMEM -/** Persist the log. -@param lsn desired new value of flushed_to_disk_lsn */ -inline void log_t::persist(lsn_t lsn) noexcept +void log_t::persist(lsn_t lsn, bool holding_latch) noexcept { - ut_ad(is_pmem()); + ut_ad(!is_opened()); ut_ad(!write_lock.is_owner()); ut_ad(!flush_lock.is_owner()); +#ifdef LOG_LATCH_DEBUG + ut_ad(holding_latch == latch_have_wr()); +#endif lsn_t old= flushed_to_disk_lsn.load(std::memory_order_relaxed); if (old >= lsn) return; - const lsn_t resizing{resize_in_progress()}; - if (UNIV_UNLIKELY(resizing)) + const bool latching{!holding_latch && resize_in_progress()}; + if (UNIV_UNLIKELY(latching)) latch.rd_lock(SRW_LOCK_CALL); const size_t start(calc_lsn_offset(old)); const size_t end(calc_lsn_offset(lsn)); if (UNIV_UNLIKELY(end < start)) { - pmem_persist(log_sys.buf + start, log_sys.file_size - start); - pmem_persist(log_sys.buf + log_sys.START_OFFSET, - end - log_sys.START_OFFSET); + pmem_persist(buf + start, file_size - start); + pmem_persist(buf + START_OFFSET, end - START_OFFSET); } else - pmem_persist(log_sys.buf + start, end - start); + pmem_persist(buf + start, end - start); old= flushed_to_disk_lsn.load(std::memory_order_relaxed); @@ -795,7 +937,7 @@ inline void log_t::persist(lsn_t lsn) noexcept DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE();); } - if (UNIV_UNLIKELY(resizing)) + if (UNIV_UNLIKELY(latching)) latch.rd_unlock(); } #endif @@ -811,13 +953,13 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept ut_ad(length <= resize_target); int64_t d= int64_t(write_lsn - resize_in_progress()); - if (UNIV_UNLIKELY(d <= 0)) + if (UNIV_UNLIKELY(d < 0)) { d&= ~int64_t(block_size_1); if (int64_t(d + length) <= 0) return; - length+= d; - b-= d; + length+= ssize_t(d); + b-= ssize_t(d); d= 0; } lsn_t offset= START_OFFSET + (lsn_t(d) & ~lsn_t{block_size_1}) % @@ -841,7 +983,7 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept template inline lsn_t log_t::write_buf() noexcept { ut_ad(latch_have_wr()); - ut_ad(!is_pmem()); + ut_ad(!is_mmap()); ut_ad(!srv_read_only_mode); const lsn_t lsn{get_lsn(std::memory_order_relaxed)}; @@ -964,7 +1106,7 @@ bool log_t::flush(lsn_t lsn) noexcept */ static lsn_t log_flush(lsn_t lsn) { - ut_ad(!log_sys.is_pmem()); + ut_ad(!log_sys.is_mmap()); ut_a(log_sys.flush(lsn)); DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE();); return flush_lock.release(lsn); @@ -987,21 +1129,27 @@ void log_write_up_to(lsn_t lsn, bool durable, ut_ad(lsn <= log_sys.get_lsn()); #ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { - ut_ad(!callback); if (durable) - log_sys.persist(lsn); + log_sys.persist(lsn, false); + else + ut_ad(!callback); return; } #endif + ut_ad(!log_sys.is_mmap()); repeat: if (durable) { if (flush_lock.acquire(lsn, callback) != group_commit_lock::ACQUIRED) return; - flush_lock.set_pending(log_sys.get_lsn()); + /* Promise to other concurrent flush_lock.acquire() that we + will durable at least up to the current LSN. The LSN may still + advance until we acquire log_sys.latch below. */ + lsn= log_sys.get_lsn(); + flush_lock.set_pending(lsn); } lsn_t pending_write_lsn= 0, pending_flush_lsn= 0; @@ -1038,8 +1186,10 @@ void log_buffer_flush_to_disk(bool durable) /** Prepare to invoke log_write_and_flush(), before acquiring log_sys.latch. */ ATTRIBUTE_COLD void log_write_and_flush_prepare() { - if (log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (log_sys.is_mmap()) return; +#endif while (flush_lock.acquire(log_sys.get_lsn() + 1, nullptr) != group_commit_lock::ACQUIRED); @@ -1047,20 +1197,56 @@ ATTRIBUTE_COLD void log_write_and_flush_prepare() group_commit_lock::ACQUIRED); } +#ifdef HAVE_INNODB_MMAP +void log_t::clear_mmap() +{ + if (!is_mmap() || +#ifdef HAVE_PMEM + !is_opened() || +#endif + high_level_read_only) + return; + log_resize_acquire(); + ut_ad(!resize_in_progress()); + ut_ad(write_lsn == get_lsn()); + ut_ad(write_lsn == get_flushed_lsn(std::memory_order_relaxed)); + + if (buf) /* this may be invoked while creating a new database */ + { + alignas(16) byte log_block[4096]; + const size_t bs{write_size}; + const size_t bf{buf_free.load(std::memory_order_relaxed)}; + { + byte *const b= buf; + memcpy_aligned<16>(log_block, b + (bf & ~(bs - 1)), bs); + } + + close_file(false); + log_mmap= false; + ut_a(attach(log, file_size)); + ut_ad(!is_mmap()); + + set_buf_free(bf & (bs - 1)); + memcpy_aligned<16>(log_sys.buf, log_block, bs); + } + log_resize_release(); +} +#endif + /** Durably write the log up to log_sys.get_lsn(). */ ATTRIBUTE_COLD void log_write_and_flush() { ut_ad(!srv_read_only_mode); - if (!log_sys.is_pmem()) +#ifdef HAVE_PMEM + if (log_sys.is_mmap()) + log_sys.persist(log_sys.get_lsn(), true); + else +#endif { const lsn_t lsn{log_sys.write_buf()}; write_lock.release(lsn); log_flush(lsn); } -#ifdef HAVE_PMEM - else - log_sys.persist(log_sys.get_lsn()); -#endif } /****************************************************************//** @@ -1329,18 +1515,9 @@ void log_t::close() if (!is_initialised()) return; close_file(); -#ifndef HAVE_PMEM - ut_free_dodump(buf, buf_size); - buf= nullptr; - ut_free_dodump(flush_buf, buf_size); - flush_buf= nullptr; - aligned_free(checkpoint_buf); - checkpoint_buf= nullptr; -#else ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); -#endif latch.destroy(); lsn_lock.destroy(); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e3a6dced764..f559d9e85b4 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1389,6 +1389,7 @@ void recv_sys_t::debug_free() pages_it= pages.end(); mysql_mutex_unlock(&mutex); + log_sys.clear_mmap(); } @@ -1541,7 +1542,7 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() byte *buf= const_cast(field_ref_zero); - if (source_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) + if (source_offset < (log_sys.is_mmap() ? log_sys.file_size : 4096)) memcpy_aligned<512>(buf, &log_sys.buf[source_offset & ~511], 512); else if (dberr_t err= recv_sys.read(source_offset & ~511, {buf, 512})) @@ -1580,7 +1581,7 @@ static dberr_t recv_log_recover_10_5(lsn_t lsn_offset) { byte *buf= const_cast(field_ref_zero); - if (lsn_offset < (log_sys.is_pmem() ? log_sys.file_size : 4096)) + if (lsn_offset < (log_sys.is_mmap() ? log_sys.file_size : 4096)) memcpy_aligned<512>(buf, &log_sys.buf[lsn_offset & ~511], 512); else { @@ -1681,7 +1682,7 @@ dberr_t recv_sys_t::find_checkpoint() log_sys.next_checkpoint_lsn= 0; lsn= 0; buf= my_assume_aligned<4096>(log_sys.buf); - if (!log_sys.is_pmem()) + if (!log_sys.is_mmap()) if (dberr_t err= log_sys.log.read(0, {buf, log_sys.START_OFFSET})) return err; /* Check the header page checksum. There was no @@ -2119,7 +2120,7 @@ static void store_freed_or_init_rec(page_id_t page_id, bool freed) /** Wrapper for log_sys.buf[] between recv_sys.offset and recv_sys.len */ struct recv_buf { - bool is_pmem() const noexcept { return log_sys.is_pmem(); } + bool is_mmap() const noexcept { return log_sys.is_mmap(); } const byte *ptr; @@ -2210,11 +2211,11 @@ struct recv_buf } }; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP /** Ring buffer wrapper for log_sys.buf[]; recv_sys.len == log_sys.file_size */ struct recv_ring : public recv_buf { - static constexpr bool is_pmem() { return true; } + static constexpr bool is_mmap() { return true; } constexpr recv_ring(const byte *ptr) : recv_buf(ptr) {} @@ -2507,7 +2508,7 @@ restart: ut_d(const source el{l}); lsn+= l - begin; offset= l.ptr - log_sys.buf; - if (!l.is_pmem()); + if (!l.is_mmap()); else if (offset == log_sys.file_size) offset= log_sys.START_OFFSET; else @@ -2760,7 +2761,7 @@ restart: last_offset) : file_name_t::initial_flags; if (it == recv_spaces.end()) - ut_ad(!file_checkpoint || space_id == TRX_SYS_SPACE || + ut_ad(!store || space_id == TRX_SYS_SPACE || srv_is_undo_tablespace(space_id)); else if (!it->second.space) { @@ -3024,12 +3025,12 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse_mtr(bool if_exists) noexcept template recv_sys_t::parse_mtr_result recv_sys_t::parse_mtr(bool) noexcept; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP template -recv_sys_t::parse_mtr_result recv_sys_t::parse_pmem(bool if_exists) noexcept +recv_sys_t::parse_mtr_result recv_sys_t::parse_mmap(bool if_exists) noexcept { recv_sys_t::parse_mtr_result r{parse_mtr(if_exists)}; - if (UNIV_LIKELY(r != PREMATURE_EOF) || !log_sys.is_pmem()) + if (UNIV_LIKELY(r != PREMATURE_EOF) || !log_sys.is_mmap()) return r; ut_ad(recv_sys.len == log_sys.file_size); ut_ad(recv_sys.offset >= log_sys.START_OFFSET); @@ -3040,6 +3041,10 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse_pmem(bool if_exists) noexcept : &log_sys.buf[recv_sys.offset]}; return recv_sys.parse(s, if_exists); } + +/** for mariadb-backup; @see xtrabackup_copy_mmap_logfile() */ +template +recv_sys_t::parse_mtr_result recv_sys_t::parse_mmap(bool) noexcept; #endif /** Apply the hashed log records to the page, if the page lsn is less than the @@ -3943,7 +3948,7 @@ void recv_sys_t::apply(bool last_batch) log_sort_flush_list(); #ifdef HAVE_PMEM - if (last_batch && log_sys.is_pmem()) + if (last_batch && log_sys.is_mmap() && !log_sys.is_opened()) mprotect(log_sys.buf, len, PROT_READ | PROT_WRITE); #endif @@ -3971,15 +3976,13 @@ static bool recv_scan_log(bool last_phase) bool store{recv_sys.file_checkpoint != 0}; size_t buf_size= log_sys.buf_size; -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { recv_sys.offset= size_t(log_sys.calc_lsn_offset(recv_sys.lsn)); buf_size= size_t(log_sys.file_size); recv_sys.len= size_t(log_sys.file_size); } else -#endif { recv_sys.offset= size_t(recv_sys.lsn - log_sys.get_first_lsn()) & block_size_1; @@ -4041,7 +4044,7 @@ static bool recv_scan_log(bool last_phase) for (;;) { const byte& b{log_sys.buf[recv_sys.offset]}; - r= recv_sys.parse_pmem(false); + r= recv_sys.parse_mmap(false); switch (r) { case recv_sys_t::PREMATURE_EOF: goto read_more; @@ -4071,7 +4074,7 @@ static bool recv_scan_log(bool last_phase) else { ut_ad(recv_sys.file_checkpoint != 0); - switch ((r= recv_sys.parse_pmem(false))) { + switch ((r= recv_sys.parse_mmap(false))) { case recv_sys_t::PREMATURE_EOF: goto read_more; case recv_sys_t::GOT_EOF: @@ -4093,11 +4096,11 @@ static bool recv_scan_log(bool last_phase) if (!store) skip_the_rest: - while ((r= recv_sys.parse_pmem(false)) == recv_sys_t::OK); + while ((r= recv_sys.parse_mmap(false)) == recv_sys_t::OK); else { uint16_t count= 0; - while ((r= recv_sys.parse_pmem(last_phase)) == recv_sys_t::OK) + while ((r= recv_sys.parse_mmap(last_phase)) == recv_sys_t::OK) if (!++count && recv_sys.report(time(nullptr))) { const size_t n= recv_sys.pages.size(); @@ -4136,10 +4139,9 @@ static bool recv_scan_log(bool last_phase) } read_more: -#ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) break; -#endif + if (recv_sys.is_corrupt_log()) break; @@ -4484,13 +4486,13 @@ inline void log_t::set_recovered() noexcept ut_ad(get_flushed_lsn() == get_lsn()); ut_ad(recv_sys.lsn == get_lsn()); size_t offset{recv_sys.offset}; - if (!is_pmem()) + if (!is_mmap()) { const size_t bs{log_sys.write_size}, bs_1{bs - 1}; memmove_aligned<512>(buf, buf + (offset & ~bs_1), bs); offset&= bs_1; } -#ifdef HAVE_PMEM +#ifndef _WIN32 else mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE); #endif diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index db75f973eab..dd2415d895c 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -42,6 +42,7 @@ Created 11/26/1995 Heikki Tuuri #ifdef HAVE_PMEM void (*mtr_t::commit_logger)(mtr_t *, std::pair); #endif + std::pair (*mtr_t::finisher)(mtr_t *, size_t); unsigned mtr_t::spin_wait_delay; @@ -49,7 +50,7 @@ void mtr_t::finisher_update() { ut_ad(log_sys.latch_have_wr()); #ifdef HAVE_PMEM - if (log_sys.is_pmem()) + if (log_sys.is_mmap()) { commit_logger= mtr_t::commit_log; finisher= spin_wait_delay @@ -350,11 +351,11 @@ inline lsn_t log_t::get_write_target() const return write_lsn + max_buf_free / 2; } -template +template void mtr_t::commit_log(mtr_t *mtr, std::pair lsns) { size_t modified= 0; - const lsn_t write_lsn= pmem ? 0 : log_sys.get_write_target(); + const lsn_t write_lsn= mmap ? 0 : log_sys.get_write_target(); if (mtr->m_made_dirty) { @@ -474,7 +475,7 @@ void mtr_t::commit_log(mtr_t *mtr, std::pair lsns) if (UNIV_UNLIKELY(lsns.second != PAGE_FLUSH_NO)) buf_flush_ahead(mtr->m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); - if (!pmem && UNIV_UNLIKELY(write_lsn != 0)) + if (!mmap && UNIV_UNLIKELY(write_lsn != 0)) log_write_up_to(write_lsn, false); } @@ -1013,7 +1014,7 @@ ATTRIBUTE_COLD size_t log_t::append_prepare_wait(size_t b, bool ex, lsn_t lsn) else latch.rd_unlock(); - log_write_up_to(lsn, is_pmem()); + log_write_up_to(lsn, is_mmap()); if (ex) latch.wr_lock(SRW_LOCK_CALL); @@ -1029,16 +1030,16 @@ ATTRIBUTE_COLD size_t log_t::append_prepare_wait(size_t b, bool ex, lsn_t lsn) /** Reserve space in the log buffer for appending data. @tparam spin whether to use the spin-only lock_lsn() -@tparam pmem log_sys.is_pmem() +@tparam mmap log_sys.is_mmap() @param size total length of the data to append(), in bytes @param ex whether log_sys.latch is exclusively locked @return the start LSN and the buffer position for append() */ -template +template inline std::pair log_t::append_prepare(size_t size, bool ex) noexcept { ut_ad(ex ? latch_have_wr() : latch_have_rd()); - ut_ad(pmem == is_pmem()); + ut_ad(mmap == is_mmap()); if (!spin) lsn_lock.wr_lock(); size_t b{spin ? lock_lsn() : buf_free.load(std::memory_order_relaxed)}; @@ -1046,7 +1047,7 @@ std::pair log_t::append_prepare(size_t size, bool ex) noexcept lsn_t l{lsn.load(std::memory_order_relaxed)}, end_lsn{l + size}; - if (UNIV_UNLIKELY(pmem + if (UNIV_UNLIKELY(mmap ? (end_lsn - get_flushed_lsn(std::memory_order_relaxed)) > capacity() : b + size >= buf_size)) @@ -1059,7 +1060,7 @@ std::pair log_t::append_prepare(size_t size, bool ex) noexcept } size_t new_buf_free= b + size; - if (pmem && new_buf_free >= file_size) + if (mmap && new_buf_free >= file_size) new_buf_free-= size_t(capacity()); lsn.store(end_lsn, std::memory_order_relaxed); @@ -1215,23 +1216,47 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, end-= len; size_t s; -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP if (!resize_flush_buf) { - ut_ad(is_pmem()); + ut_ad(is_mmap()); + lsn_lock.wr_lock(); const size_t resize_capacity{resize_target - START_OFFSET}; - const lsn_t resizing{resize_in_progress()}; - if (UNIV_UNLIKELY(lsn < resizing)) { - size_t l= resizing - lsn; - if (l >= len) - return; - end+= l - len; - len-= l; - lsn+= l; + const lsn_t resizing{resize_in_progress()}; + /* For memory-mapped log, log_t::resize_start() would never + set log_sys.resize_lsn to less than log_sys.lsn. It cannot + execute concurrently with this thread, because we are holding + log_sys.latch and it would hold an exclusive log_sys.latch. */ + if (UNIV_UNLIKELY(lsn < resizing)) + { + /* This function may execute in multiple concurrent threads + that hold a shared log_sys.latch. Before we got lsn_lock, + another thread could have executed resize_lsn.store(lsn) below + with a larger lsn than ours. + + append_prepare() guarantees that the concurrent writes + cannot overlap, that is, our entire log must be discarded. + Besides, incomplete mini-transactions cannot be parsed anyway. */ + ut_ad(resizing >= lsn + len); + goto mmap_done; + } + + s= START_OFFSET; + + if (UNIV_UNLIKELY(lsn - resizing + len >= resize_capacity)) + { + resize_lsn.store(lsn, std::memory_order_relaxed); + lsn= 0; + } + else + { + lsn-= resizing; + s+= lsn; + } } - lsn-= resizing; - s= START_OFFSET + lsn % resize_capacity; + + ut_ad(s + len <= resize_target); if (UNIV_UNLIKELY(end < &buf[START_OFFSET])) { @@ -1241,59 +1266,22 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, ut_ad(end + capacity() + len >= &buf[file_size]); size_t l= size_t(buf - (end - START_OFFSET)); - if (UNIV_LIKELY(s + len <= resize_target)) - { - /* The destination buffer (log_sys.resize_buf) did not wrap around */ - memcpy(resize_buf + s, end + capacity(), l); - memcpy(resize_buf + s + l, &buf[START_OFFSET], len - l); - goto pmem_nowrap; - } - else - { - /* Both log_sys.buf and log_sys.resize_buf wrapped around */ - const size_t rl= resize_target - s; - if (l <= rl) - { - /* log_sys.buf wraps around first */ - memcpy(resize_buf + s, end + capacity(), l); - memcpy(resize_buf + s + l, &buf[START_OFFSET], rl - l); - memcpy(resize_buf + START_OFFSET, &buf[START_OFFSET + rl - l], - len - l); - } - else - { - /* log_sys.resize_buf wraps around first */ - memcpy(resize_buf + s, end + capacity(), rl); - memcpy(resize_buf + START_OFFSET, end + capacity() + rl, l - rl); - memcpy(resize_buf + START_OFFSET + (l - rl), - &buf[START_OFFSET], len - l); - } - goto pmem_wrap; - } + memcpy(resize_buf + s, end + capacity(), l); + memcpy(resize_buf + s + l, &buf[START_OFFSET], len - l); } else { ut_ad(end + len <= &buf[file_size]); - - if (UNIV_LIKELY(s + len <= resize_target)) - { - memcpy(resize_buf + s, end, len); - pmem_nowrap: - s+= len - seq; - } - else - { - /* The log_sys.resize_buf wrapped around */ - memcpy(resize_buf + s, end, resize_target - s); - memcpy(resize_buf + START_OFFSET, end + (resize_target - s), - len - (resize_target - s)); - pmem_wrap: - s+= len - seq; - if (s >= resize_target) - s-= resize_capacity; - resize_lsn.fetch_add(resize_capacity); /* Move the target ahead. */ - } + memcpy(resize_buf + s, end, len); } + s+= len - seq; + + /* Always set the sequence bit. If the resized log were to wrap around, + we will advance resize_lsn. */ + ut_ad(resize_buf[s] <= 1); + resize_buf[s]= 1; + mmap_done: + lsn_lock.wr_unlock(); } else #endif @@ -1303,12 +1291,11 @@ inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len, ut_ad(s + len <= buf_size); memcpy(resize_buf + s, end, len); s+= len - seq; + /* Always set the sequence bit. If the resized log were to wrap around, + we will advance resize_lsn. */ + ut_ad(resize_buf[s] <= 1); + resize_buf[s]= 1; } - - /* Always set the sequence bit. If the resized log were to wrap around, - we will advance resize_lsn. */ - ut_ad(resize_buf[s] <= 1); - resize_buf[s]= 1; } } @@ -1316,12 +1303,12 @@ inline void log_t::append(byte *&d, const void *s, size_t size) noexcept { ut_ad(log_sys.latch_have_any()); ut_ad(d + size <= log_sys.buf + - (log_sys.is_pmem() ? log_sys.file_size : log_sys.buf_size)); + (log_sys.is_mmap() ? log_sys.file_size : log_sys.buf_size)); memcpy(d, s, size); d+= size; } -template +template std::pair mtr_t::finish_writer(mtr_t *mtr, size_t len) { @@ -1332,16 +1319,14 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) const size_t size{mtr->m_commit_lsn ? 5U + 8U : 5U}; std::pair start= - log_sys.append_prepare(len, mtr->m_latch_ex); + log_sys.append_prepare(len, mtr->m_latch_ex); - if (!pmem) + if (!mmap) { mtr->m_log.for_each_block([&start](const mtr_buf_t::block_t *b) { log_sys.append(start.second, b->begin(), b->used()); return true; }); -#ifdef HAVE_PMEM write_trailer: -#endif *start.second++= log_sys.get_sequence_bit(start.first + len - size); if (mtr->m_commit_lsn) { @@ -1352,7 +1337,6 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) mach_write_to_4(start.second, mtr->m_crc); start.second+= 4; } -#ifdef HAVE_PMEM else { if (UNIV_LIKELY(start.second + len <= &log_sys.buf[log_sys.file_size])) @@ -1400,9 +1384,6 @@ mtr_t::finish_writer(mtr_t *mtr, size_t len) ((size >= size_left) ? log_sys.START_OFFSET : log_sys.file_size) + (size - size_left); } -#else - static_assert(!pmem, ""); -#endif log_sys.resize_write(start.first, start.second, len, size); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 22c6e34ca59..0b6dba6769b 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1107,13 +1107,11 @@ static ATTRIBUTE_COLD void os_file_log_buffered() log_sys.log_maybe_unbuffered= false; log_sys.log_buffered= true; } -# endif /** @return whether the log file may work with unbuffered I/O. */ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) { MSAN_STAT_WORKAROUND(&st); -# ifdef __linux__ char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"]; if (snprintf(b, sizeof b, "/sys/dev/block/%u:%u/queue/physical_block_size", major(st.st_dev), minor(st.st_dev)) >= @@ -1145,13 +1143,11 @@ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) if (s > 4096 || s < 64 || !ut_is_2pow(s)) return false; log_sys.set_block_size(uint32_t(s)); -# else - constexpr unsigned long s= 4096; -# endif return !(st.st_size & (s - 1)); } -#endif +# endif /* __linux__ */ +#endif /* O_DIRECT */ /** NOTE! Use the corresponding macro os_file_create(), not directly this function! @@ -1206,7 +1202,9 @@ os_file_create_func( ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL); #ifdef O_DIRECT +# ifdef __linux__ struct stat st; +# endif ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE || type == OS_DATA_FILE_NO_O_DIRECT); int direct_flag = 0; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 34785dd6cdd..733807c36d9 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2178,38 +2178,43 @@ updated then its state must be set to BUF_PAGE_NOT_USED. @retval DB_SUCCESS or error code. */ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW { - /* If we already had an old page with matching number - in the buffer pool, evict it now, because - we no longer evict the pages on DISCARD TABLESPACE. */ - buf_page_get_gen(block->page.id(), get_zip_size(), RW_NO_LATCH, - nullptr, BUF_PEEK_IF_IN_POOL, - nullptr, nullptr, nullptr); + /* If we already had an old page with matching number in the buffer + pool, evict it now, because we no longer evict the pages on + DISCARD TABLESPACE. */ + if (buf_block_t *b= buf_pool.page_fix(block->page.id(), nullptr, + buf_pool_t::FIX_ALSO_FREED)) + { + ut_ad(!b->page.oldest_modification()); + mysql_mutex_lock(&buf_pool.mutex); + b->unfix(); - uint16_t page_type; + if (!buf_LRU_free_page(&b->page, true)) + ut_ad(0); - if (dberr_t err = update_page(block, page_type)) { - return err; - } + mysql_mutex_unlock(&buf_pool.mutex); + } - const bool full_crc32 = fil_space_t::full_crc32(get_space_flags()); - byte* frame = get_frame(block); - memset_aligned<8>(frame + FIL_PAGE_LSN, 0, 8); + uint16_t page_type; - if (!block->page.zip.data) { - buf_flush_init_for_writing( - NULL, block->page.frame, NULL, full_crc32); - } else if (fil_page_type_is_index(page_type)) { - buf_flush_init_for_writing( - NULL, block->page.zip.data, &block->page.zip, - full_crc32); - } else { - /* Calculate and update the checksum of non-index - pages for ROW_FORMAT=COMPRESSED tables. */ - buf_flush_update_zip_checksum( - block->page.zip.data, block->zip_size()); - } + if (dberr_t err= update_page(block, page_type)) + return err; - return DB_SUCCESS; + const bool full_crc32= fil_space_t::full_crc32(get_space_flags()); + byte *frame= get_frame(block); + memset_aligned<8>(frame + FIL_PAGE_LSN, 0, 8); + + if (!block->page.zip.data) + buf_flush_init_for_writing(nullptr, block->page.frame, nullptr, + full_crc32); + else if (fil_page_type_is_index(page_type)) + buf_flush_init_for_writing(nullptr, block->page.zip.data, &block->page.zip, + full_crc32); + else + /* Calculate and update the checksum of non-index + pages for ROW_FORMAT=COMPRESSED tables. */ + buf_flush_update_zip_checksum(block->page.zip.data, block->zip_size()); + + return DB_SUCCESS; } static void reload_fts_table(row_prebuilt_t *prebuilt, @@ -3325,7 +3330,9 @@ static dict_table_t *build_fts_hidden_table( new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t); } - new_index->search_info= old_index->search_info; +#ifdef BTR_CUR_HASH_ADAPT + new_index->search_info= btr_search_info_create(new_index->heap); +#endif /* BTR_CUR_HASH_ADAPT */ UT_LIST_ADD_LAST(new_index->table->indexes, new_index); old_index= UT_LIST_GET_NEXT(indexes, old_index); if (UT_LIST_GET_LEN(new_table->indexes) diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 09e30db0d64..04d6a8d3c96 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -909,10 +909,10 @@ row_ins_foreign_fill_virtual( return DB_OUT_OF_MEMORY; } ut_ad(!node->is_delete - || (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)); - ut_ad(foreign->type & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_CASCADE)); + || (foreign->type & foreign->DELETE_SET_NULL)); + ut_ad(foreign->type & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL + | foreign->UPDATE_CASCADE)); for (uint16_t i = 0; i < n_v_fld; i++) { @@ -1028,8 +1028,8 @@ row_ins_foreign_check_on_constraint( node = static_cast(thr->run_node); if (node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_DELETE_CASCADE - | DICT_FOREIGN_ON_DELETE_SET_NULL))) { + & (foreign->DELETE_CASCADE + | foreign->DELETE_SET_NULL))) { row_ins_foreign_report_err("Trying to delete", thr, foreign, @@ -1039,8 +1039,8 @@ row_ins_foreign_check_on_constraint( } if (!node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_UPDATE_CASCADE - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + & (foreign->UPDATE_CASCADE + | foreign->UPDATE_SET_NULL))) { /* This is an UPDATE */ @@ -1063,7 +1063,7 @@ row_ins_foreign_check_on_constraint( cascade->foreign = foreign; if (node->is_delete - && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) { + && (foreign->type & foreign->DELETE_CASCADE)) { cascade->is_delete = PLAIN_DELETE; } else { cascade->is_delete = NO_DELETE; @@ -1211,8 +1211,8 @@ row_ins_foreign_check_on_constraint( } if (node->is_delete - ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) - : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) { + ? (foreign->type & foreign->DELETE_SET_NULL) + : (foreign->type & foreign->UPDATE_SET_NULL)) { /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -1257,12 +1257,12 @@ row_ins_foreign_check_on_constraint( } } else if (table->fts && cascade->is_delete == PLAIN_DELETE && foreign->affects_fulltext()) { - /* DICT_FOREIGN_ON_DELETE_CASCADE case */ + /* dict_foreign_t::DELETE_CASCADE case */ fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL); } if (!node->is_delete - && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) { + && (foreign->type & foreign->UPDATE_CASCADE)) { /* Build the appropriate update vector which sets changing foreign->n_fields first fields in rec to new values */ @@ -3052,7 +3052,8 @@ row_ins_sec_index_entry_low( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - btr_decryption_failed(*index); + innodb_decryption_failed(thr_get_trx(thr)->mysql_thd, + index->table); } goto func_exit; } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 15607fbb737..71d8e951bcd 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2157,38 +2157,6 @@ corrupted_rec: mem_heap_empty(row_heap); if (!mtr_started) { - goto scan_next; - } - - if (clust_index->lock.is_waiting()) { - /* There are waiters on the clustered - index tree lock, likely the purge - thread. Store and restore the cursor - position, and yield so that scanning a - large table will not starve other - threads. */ - - /* Store the cursor position on the last user - record on the page. */ - if (!btr_pcur_move_to_prev_on_page(&pcur)) { - goto corrupted_index; - } - /* Leaf pages must never be empty, unless - this is the only page in the index tree. */ - if (!btr_pcur_is_on_user_rec(&pcur) - && btr_pcur_get_block(&pcur)->page.id() - .page_no() != clust_index->page) { - goto corrupted_index; - } - - btr_pcur_store_position(&pcur, &mtr); - mtr.commit(); - mtr_started = false; - - /* Give the waiters a chance to proceed. */ - std::this_thread::yield(); -scan_next: - ut_ad(!mtr_started); ut_ad(!mtr.is_active()); mtr.start(); mtr_started = true; @@ -2201,7 +2169,7 @@ scan_next: corrupted_index: err = DB_CORRUPTION; goto func_exit; - } + } /* Move to the successor of the original record. */ if (!btr_pcur_move_to_next_user_rec( @@ -2236,14 +2204,14 @@ end_of_index: buf_page_make_young_if_needed(&block->page); + const auto s = mtr.get_savepoint(); + mtr.rollback_to_savepoint(s - 2, s - 1); + page_cur_set_before_first(block, cur); if (!page_cur_move_to_next(cur) || page_cur_is_after_last(cur)) { goto corrupted_rec; } - - const auto s = mtr.get_savepoint(); - mtr.rollback_to_savepoint(s - 2, s - 1); } } else { mem_heap_empty(row_heap); @@ -4762,13 +4730,9 @@ row_merge_build_indexes( /* Do not continue if we can't encrypt table pages */ if (!old_table->is_readable() || !new_table->is_readable()) { - error = DB_DECRYPTION_FAILED; - ib_push_warning(trx->mysql_thd, DB_DECRYPTION_FAILED, - "Table %s is encrypted but encryption service or" - " used key_id is not available. " - " Can't continue reading table.", - !old_table->is_readable() ? old_table->name.m_name : - new_table->name.m_name); + error = innodb_decryption_failed(trx->mysql_thd, + !old_table->is_readable() + ? old_table : new_table); goto func_exit; } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index c242cb9b36d..bf1718f6cfa 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1185,51 +1185,26 @@ row_lock_table(row_prebuilt_t* prebuilt) return(err); } -/** Determine is tablespace encrypted but decryption failed, is table corrupted -or is tablespace .ibd file missing. -@param[in] table Table -@param[in] trx Transaction -@param[in] push_warning true if we should push warning to user +/** Report an error for a failure to access a table. +@param table unreadable table +@param trx transaction @retval DB_DECRYPTION_FAILED table is encrypted but decryption failed @retval DB_CORRUPTION table is corrupted @retval DB_TABLESPACE_NOT_FOUND tablespace .ibd file not found */ -static -dberr_t -row_mysql_get_table_status( - const dict_table_t* table, - trx_t* trx, - bool push_warning = true) +ATTRIBUTE_COLD +static dberr_t row_mysql_get_table_error(trx_t *trx, dict_table_t *table) { - dberr_t err; - if (const fil_space_t* space = table->space) { - if (space->crypt_data && space->crypt_data->is_encrypted()) { - // maybe we cannot access the table due to failing - // to decrypt - if (push_warning) { - ib_push_warning(trx, DB_DECRYPTION_FAILED, - "Table %s is encrypted." - "However key management plugin or used key_id is not found or" - " used encryption algorithm or method does not match.", - table->name.m_name); - } + if (const fil_space_t *space= table->space) + { + if (space->crypt_data && space->crypt_data->is_encrypted()) + return innodb_decryption_failed(trx->mysql_thd, table); + return DB_CORRUPTION; + } - err = DB_DECRYPTION_FAILED; - } else { - if (push_warning) { - ib_push_warning(trx, DB_CORRUPTION, - "Table %s in tablespace %lu corrupted.", - table->name.m_name, table->space); - } - - err = DB_CORRUPTION; - } - } else { - ib::error() << ".ibd file is missing for table " - << table->name; - err = DB_TABLESPACE_NOT_FOUND; - } - - return(err); + const int dblen= int(table->name.dblen()); + sql_print_error("InnoDB .ibd file is missing for table %`.*s.%`s", + dblen, table->name.m_name, table->name.m_name + dblen + 1); + return DB_TABLESPACE_NOT_FOUND; } /** Does an insert for MySQL. @@ -1265,7 +1240,7 @@ row_insert_for_mysql( return(DB_TABLESPACE_DELETED); } else if (!table->is_readable()) { - return row_mysql_get_table_status(table, trx, true); + return row_mysql_get_table_error(trx, table); } else if (high_level_read_only) { return(DB_READ_ONLY); } else if (UNIV_UNLIKELY(table->corrupted) @@ -1622,7 +1597,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt) ut_ad(table->stat_initialized); if (!table->is_readable()) { - return(row_mysql_get_table_status(table, trx, true)); + return row_mysql_get_table_error(trx, table); } if (high_level_read_only) { diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index ee6360655cd..c7fa06e38c0 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1014,7 +1014,7 @@ static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr) mem_heap_t* heap = NULL; /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3]; rec_offs_init(offsets_); rec_offs* offsets = rec_get_offsets( rec, index, offsets_, index->n_core_fields, diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 970dce3c90d..4442f6f43ba 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4844,7 +4844,8 @@ page_corrupted: if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - btr_decryption_failed(*index); + innodb_decryption_failed(trx->mysql_thd, + index->table); } rec = NULL; goto page_read_error; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a051867a1bd..84110fdc048 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1585,5 +1585,8 @@ void srv_purge_shutdown() } purge_sys.coordinator_shutdown(); srv_shutdown_purge_tasks(); + if (!srv_fast_shutdown && !high_level_read_only && srv_was_started && + !opt_bootstrap && srv_operation == SRV_OPERATION_NORMAL) + fsp_system_tablespace_truncate(); } } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 6f491d76290..78730b20d85 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1094,7 +1094,8 @@ same_size: log_sys.latch.wr_unlock(); - log_write_up_to(flushed_lsn, false); + if (latest_format) + log_write_up_to(flushed_lsn, false); ut_ad(flushed_lsn == log_sys.get_lsn()); ut_ad(!os_aio_pending_reads()); @@ -1350,10 +1351,7 @@ dberr_t srv_start(bool create_new_db) } #endif /* UNIV_DEBUG */ - if (!log_sys.create()) { - return srv_init_abort(DB_ERROR); - } - + log_sys.create(); recv_sys.create(); lock_sys.create(srv_lock_table_size); @@ -1923,13 +1921,13 @@ skip_monitors: if (srv_print_verbose_log) { sql_print_information("InnoDB: " "log sequence number " LSN_PF -#ifdef HAVE_PMEM +#ifdef HAVE_INNODB_MMAP "%s" #endif "; transaction id " TRX_ID_FMT, recv_sys.lsn, -#ifdef HAVE_PMEM - log_sys.is_pmem() +#ifdef HAVE_INNODB_MMAP + log_sys.is_mmap() ? " (memory-mapped)" : "", #endif trx_sys.get_max_trx_id()); diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 5db6e627590..28b586de5df 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -25,7 +25,7 @@ this program; if not, write to the Free Software Foundation, Inc., #elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { int regs[4]; __cpuid(regs, 0); @@ -39,7 +39,7 @@ bool transactional_lock_enabled() #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { if (__get_cpuid_max(0, nullptr) < 7) return false; @@ -52,7 +52,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG TRANSACTIONAL_TARGET -bool xtest() { return have_transactional_memory && _xtest(); } +bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif #elif defined __powerpc64__ || defined __s390__ # include @@ -60,21 +60,21 @@ bool xtest() { return have_transactional_memory && _xtest(); } # include __attribute__((target("htm"),hot)) -bool xbegin() +bool xbegin() noexcept { return have_transactional_memory && __TM_simple_begin() == _HTM_TBEGIN_STARTED; } __attribute__((target("htm"),hot)) -void xabort() { __TM_abort(); } +void xabort() noexcept { __TM_abort(); } __attribute__((target("htm"),hot)) -void xend() { __TM_end(); } +void xend() noexcept { __TM_end(); } bool have_transactional_memory; static sigjmp_buf ill_jmp; -static void ill_handler(int sig) +static void ill_handler(int sig) noexcept { siglongjmp(ill_jmp, sig); } @@ -83,7 +83,7 @@ static void ill_handler(int sig) and a 1 instruction store can succeed. */ __attribute__((noinline)) -static void test_tm(bool *r) +static void test_tm(bool *r) noexcept { if (__TM_simple_begin() == _HTM_TBEGIN_STARTED) { @@ -91,7 +91,7 @@ static void test_tm(bool *r) __TM_end(); } } -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { bool r= false; sigset_t oset; @@ -115,7 +115,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG __attribute__((target("htm"),hot)) -bool xtest() +bool xtest() noexcept { # ifdef __s390x__ return have_transactional_memory && @@ -129,13 +129,13 @@ bool xtest() #endif /** @return the parameter for srw_pause() */ -static inline unsigned srw_pause_delay() +static inline unsigned srw_pause_delay() noexcept { return my_cpu_relax_multiplier / 4 * srv_spin_wait_delay; } /** Pause the CPU for some time, with no memory accesses. */ -static inline void srw_pause(unsigned delay) +static inline void srw_pause(unsigned delay) noexcept { HMT_low(); while (delay--) @@ -144,7 +144,7 @@ static inline void srw_pause(unsigned delay) } #ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait() +template<> void pthread_mutex_wrapper::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -160,13 +160,13 @@ template<> void pthread_mutex_wrapper::wr_wait() #endif #ifdef SUX_LOCK_GENERIC -template void ssux_lock_impl::init(); -template void ssux_lock_impl::init(); -template void ssux_lock_impl::destroy(); -template void ssux_lock_impl::destroy(); +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::destroy() noexcept; +template void ssux_lock_impl::destroy() noexcept; template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&mutex); while (lock.load(std::memory_order_relaxed) == lk) @@ -175,7 +175,7 @@ inline void srw_mutex_impl::wait(uint32_t lk) } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&writer.mutex); while (readers.load(std::memory_order_relaxed) == lk) @@ -184,21 +184,21 @@ inline void ssux_lock_impl::wait(uint32_t lk) } template -void srw_mutex_impl::wake() +void srw_mutex_impl::wake() noexcept { pthread_mutex_lock(&mutex); pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); } template -inline void srw_mutex_impl::wake_all() +inline void srw_mutex_impl::wake_all() noexcept { pthread_mutex_lock(&mutex); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); } template -void ssux_lock_impl::wake() +void ssux_lock_impl::wake() noexcept { pthread_mutex_lock(&writer.mutex); pthread_cond_signal(&readers_cond); @@ -210,18 +210,18 @@ static_assert(4 == sizeof(rw_lock), "ABI"); # include template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&lock, &lk, 4, INFINITE); } template -void srw_mutex_impl::wake() { WakeByAddressSingle(&lock); } +void srw_mutex_impl::wake() noexcept { WakeByAddressSingle(&lock); } template -inline void srw_mutex_impl::wake_all() { WakeByAddressAll(&lock); } +inline void srw_mutex_impl::wake_all() noexcept { WakeByAddressAll(&lock); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&readers, &lk, 4, INFINITE); } template -void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } +void ssux_lock_impl::wake() noexcept { WakeByAddressSingle(&readers); } # else # ifdef __linux__ # include @@ -249,64 +249,30 @@ void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } # endif template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&lock, WAIT, lk); } template -void srw_mutex_impl::wake() { SRW_FUTEX(&lock, WAKE, 1); } +void srw_mutex_impl::wake() noexcept { SRW_FUTEX(&lock, WAKE, 1); } template -void srw_mutex_impl::wake_all() { SRW_FUTEX(&lock, WAKE, INT_MAX); } +void srw_mutex_impl::wake_all() noexcept { SRW_FUTEX(&lock, WAKE, INT_MAX); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&readers, WAIT, lk); } template -void ssux_lock_impl::wake() { SRW_FUTEX(&readers, WAKE, 1); } +void ssux_lock_impl::wake() noexcept { SRW_FUTEX(&readers, WAKE, 1); } # endif #endif -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); - -/* - -Unfortunately, compilers targeting IA-32 or AMD64 currently cannot -translate the following single-bit operations into Intel 80386 instructions: - - m.fetch_or(1<(&mem), bit)) \ - goto label; -# define IF_NOT_FETCH_OR_GOTO(mem, bit, label) \ - if (!_interlockedbittestandset(reinterpret_cast(&mem), bit))\ - goto label; -#endif +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; template -void srw_mutex_impl::wait_and_lock() +void srw_mutex_impl::wait_and_lock() noexcept { - uint32_t lk= 1 + lock.fetch_add(1, std::memory_order_relaxed); + uint32_t lk= WAITER + lock.fetch_add(WAITER, std::memory_order_relaxed); if (spinloop) { @@ -318,10 +284,16 @@ void srw_mutex_impl::wait_and_lock() lk= lock.load(std::memory_order_relaxed); if (!(lk & HOLDER)) { -#ifdef IF_NOT_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_NOT_FETCH_OR_GOTO(*this, 31, acquired); - lk|= HOLDER; +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 + lk |= HOLDER; +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (!_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (!(lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER)) +# endif + goto acquired; #else if (!((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER)) goto acquired; @@ -339,16 +311,22 @@ void srw_mutex_impl::wait_and_lock() if (lk & HOLDER) { wait(lk); -#ifdef IF_FETCH_OR_GOTO +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 reload: #endif lk= lock.load(std::memory_order_relaxed); } else { -#ifdef IF_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_FETCH_OR_GOTO(*this, 31, reload); +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER) +# endif + goto reload; #else if ((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER) continue; @@ -361,11 +339,11 @@ acquired: } } -template void srw_mutex_impl::wait_and_lock(); -template void srw_mutex_impl::wait_and_lock(); +template void srw_mutex_impl::wait_and_lock() noexcept; +template void srw_mutex_impl::wait_and_lock() noexcept; template -void ssux_lock_impl::wr_wait(uint32_t lk) +void ssux_lock_impl::wr_wait(uint32_t lk) noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(lk); @@ -396,11 +374,11 @@ void ssux_lock_impl::wr_wait(uint32_t lk) while (lk != WRITER); } -template void ssux_lock_impl::wr_wait(uint32_t); -template void ssux_lock_impl::wr_wait(uint32_t); +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; template -void ssux_lock_impl::rd_wait() +void ssux_lock_impl::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -416,7 +394,8 @@ void ssux_lock_impl::rd_wait() /* Subscribe to writer.wake() or write.wake_all() calls by concurrently executing rd_wait() or writer.wr_unlock(). */ - uint32_t wl= 1 + writer.lock.fetch_add(1, std::memory_order_acquire); + uint32_t wl= writer.WAITER + + writer.lock.fetch_add(writer.WAITER, std::memory_order_acquire); for (;;) { @@ -440,21 +419,21 @@ void ssux_lock_impl::rd_wait() } /* Unsubscribe writer.wake() and writer.wake_all(). */ - wl= writer.lock.fetch_sub(1, std::memory_order_release); + wl= writer.lock.fetch_sub(writer.WAITER, std::memory_order_release); ut_ad(wl); /* Wake any other threads that may be blocked in writer.wait(). All other waiters than this rd_wait() would end up acquiring writer.lock and waking up other threads on unlock(). */ - if (wl > 1) + if (wl > writer.WAITER) writer.wake_all(); } -template void ssux_lock_impl::rd_wait(); -template void ssux_lock_impl::rd_wait(); +template void ssux_lock_impl::rd_wait() noexcept; +template void ssux_lock_impl::rd_wait() noexcept; #if defined _WIN32 || defined SUX_LOCK_GENERIC -template<> void srw_lock_::rd_wait() +template<> void srw_lock_::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -468,7 +447,7 @@ template<> void srw_lock_::rd_wait() IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } -template<> void srw_lock_::wr_wait() +template<> void srw_lock_::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -484,13 +463,13 @@ template<> void srw_lock_::wr_wait() #endif #ifdef UNIV_PFS_RWLOCK -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; template -void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) +void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -507,7 +486,7 @@ void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) } template -void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) +void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -546,7 +525,7 @@ void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_rd_lock(const char *file, unsigned line) +void ssux_lock::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -562,7 +541,7 @@ void ssux_lock::psi_rd_lock(const char *file, unsigned line) lock.rd_lock(); } -void ssux_lock::psi_u_lock(const char *file, unsigned line) +void ssux_lock::psi_u_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; if (PSI_rwlock_locker *locker= PSI_RWLOCK_CALL(start_rwlock_wrwait) @@ -575,7 +554,7 @@ void ssux_lock::psi_u_lock(const char *file, unsigned line) lock.u_lock(); } -void ssux_lock::psi_wr_lock(const char *file, unsigned line) +void ssux_lock::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -615,7 +594,7 @@ void ssux_lock::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) +void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; DBUG_ASSERT(lock.writer.is_locked()); @@ -637,14 +616,14 @@ void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) lock.u_wr_upgrade(); } #else /* UNIV_PFS_RWLOCK */ -template void ssux_lock_impl::rd_lock(); -template void ssux_lock_impl::rd_unlock(); -template void ssux_lock_impl::u_unlock(); -template void ssux_lock_impl::wr_unlock(); +template void ssux_lock_impl::rd_lock() noexcept; +template void ssux_lock_impl::rd_unlock() noexcept; +template void ssux_lock_impl::u_unlock() noexcept; +template void ssux_lock_impl::wr_unlock() noexcept; #endif /* UNIV_PFS_RWLOCK */ #ifdef UNIV_DEBUG -void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) +void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept { srw_lock::SRW_LOCK_INIT(key); readers_lock.init(); @@ -652,7 +631,7 @@ void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) ut_ad(!have_any()); } -void srw_lock_debug::destroy() +void srw_lock_debug::destroy() noexcept { ut_ad(!writer); if (auto r= readers.load(std::memory_order_relaxed)) @@ -665,7 +644,7 @@ void srw_lock_debug::destroy() srw_lock::destroy(); } -bool srw_lock_debug::wr_lock_try() +bool srw_lock_debug::wr_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::wr_lock_try()) @@ -675,7 +654,7 @@ bool srw_lock_debug::wr_lock_try() return true; } -void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::wr_lock(SRW_LOCK_ARGS(file, line)); @@ -683,14 +662,14 @@ void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) writer.store(pthread_self(), std::memory_order_relaxed); } -void srw_lock_debug::wr_unlock() +void srw_lock_debug::wr_unlock() noexcept { ut_ad(have_wr()); writer.store(0, std::memory_order_relaxed); srw_lock::wr_unlock(); } -void srw_lock_debug::readers_register() +void srw_lock_debug::readers_register() noexcept { readers_lock.wr_lock(); auto r= readers.load(std::memory_order_relaxed); @@ -703,7 +682,7 @@ void srw_lock_debug::readers_register() readers_lock.wr_unlock(); } -bool srw_lock_debug::rd_lock_try() +bool srw_lock_debug::rd_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::rd_lock_try()) @@ -712,14 +691,14 @@ bool srw_lock_debug::rd_lock_try() return true; } -void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::rd_lock(SRW_LOCK_ARGS(file, line)); readers_register(); } -void srw_lock_debug::rd_unlock() +void srw_lock_debug::rd_unlock() noexcept { const pthread_t self= pthread_self(); ut_ad(writer != self); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 3b7149528e6..f53e76f9f72 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -491,16 +491,18 @@ loop: if (undo->hdr_page_no == hdr_addr.page) goto found_cached; ut_ad("inconsistent undo logs" == 0); - if (false) - found_cached: - UT_LIST_REMOVE(rseg.undo_cached, undo); + found_cached: static_assert(FIL_NULL == 0xffffffff, ""); if (UNIV_UNLIKELY(mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT + rseg_hdr->page.frame))) trx_rseg_format_upgrade(rseg_hdr, &mtr); - mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + - undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); - ut_free(undo); + if (UNIV_LIKELY(undo != nullptr)) + { + UT_LIST_REMOVE(rseg.undo_cached, undo); + mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + + undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); + ut_free(undo); + } mtr.write<8,mtr_t::MAYBE_NOP>(*rseg_hdr, TRX_RSEG + TRX_RSEG_MAX_TRX_ID + rseg_hdr->page.frame, trx_sys.get_max_trx_id() - 1); @@ -776,13 +778,16 @@ buf_block_t *purge_sys_t::get_page(page_id_t id) { ut_ad(!recv_sys.recovery_on); - buf_block_t*& undo_page= pages[id]; + buf_block_t *&h= pages[id]; + buf_block_t *undo_page= h; if (!undo_page) { undo_page= buf_pool.page_fix(id); // batch_cleanup() will unfix() if (!undo_page) pages.erase(id); + else + h= undo_page; } return undo_page; diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index ccd7b2146fb..466183b1580 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1266,20 +1266,20 @@ static void trx_flush_log_if_needed(lsn_t lsn, trx_t *trx) const bool flush= (!my_disable_sync && (srv_flush_log_at_trx_commit & 1)); + if (!log_sys.is_mmap()) + { + completion_callback cb; - completion_callback cb; - if (!log_sys.is_pmem() && - (cb.m_param= thd_increment_pending_ops(trx->mysql_thd))) - { - cb.m_callback = (void (*)(void *)) thd_decrement_pending_ops; - log_write_up_to(lsn, flush, &cb); - } - else - { - trx->op_info= "flushing log"; - log_write_up_to(lsn, flush); - trx->op_info= ""; + if ((cb.m_param= thd_increment_pending_ops(trx->mysql_thd))) + { + cb.m_callback= (void (*)(void *)) thd_decrement_pending_ops; + log_write_up_to(lsn, flush, &cb); + return; + } } + trx->op_info= "flushing log"; + log_write_up_to(lsn, flush); + trx->op_info= ""; } /** Process tables that were modified by the committing transaction. */ diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 93d68036755..264a021e3b1 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -185,7 +185,7 @@ trx_undo_get_prev_rec_from_prev_page(buf_block_t *&block, uint16_t rec, return nullptr; if (!buf_page_make_young_if_needed(&block->page)) - buf_read_ahead_linear(block->page.id(), 0); + buf_read_ahead_linear(block->page.id()); return trx_undo_page_get_last_rec(block, page_no, offset); } @@ -242,7 +242,7 @@ trx_undo_get_prev_rec(buf_block_t *&block, uint16_t rec, uint32_t page_no, static trx_undo_rec_t* trx_undo_get_next_rec_from_next_page(const buf_block_t *&block, uint32_t page_no, uint16_t offset, - ulint mode, mtr_t *mtr) + rw_lock_type_t mode, mtr_t *mtr) { if (page_no == block->page.id().page_no() && mach_read_from_2(block->page.frame + offset + TRX_UNDO_NEXT_LOG)) @@ -272,7 +272,8 @@ trx_undo_get_next_rec_from_next_page(const buf_block_t *&block, @retval nullptr if none */ static trx_undo_rec_t* trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, - uint16_t offset, ulint mode, const buf_block_t*& block, + uint16_t offset, rw_lock_type_t mode, + const buf_block_t *&block, mtr_t *mtr, dberr_t *err) { buf_block_t *b= buf_page_get_gen(page_id_t{space.id, page_no}, 0, mode, @@ -282,7 +283,7 @@ trx_undo_get_first_rec(const fil_space_t &space, uint32_t page_no, return nullptr; if (!buf_page_make_young_if_needed(&b->page)) - buf_read_ahead_linear(b->page.id(), 0); + buf_read_ahead_linear(b->page.id()); if (trx_undo_rec_t *rec= trx_undo_page_get_first_rec(b, page_no, offset)) return rec; diff --git a/storage/maria/aria_s3_copy.cc b/storage/maria/aria_s3_copy.cc index 79338ddc661..606b83cefc9 100644 --- a/storage/maria/aria_s3_copy.cc +++ b/storage/maria/aria_s3_copy.cc @@ -43,7 +43,10 @@ static const char *opt_database; static const char *opt_s3_bucket="MariaDB"; static my_bool opt_compression, opt_verbose, opt_force, opt_s3_debug; static my_bool opt_s3_use_http; +static my_bool opt_s3_ssl_no_verify; +static my_bool opt_s3_no_content_type; static ulong opt_operation= OP_IMPOSSIBLE, opt_protocol_version= 1; +static ulong opt_provider= 0; static ulong opt_block_size; static ulong opt_s3_port; static char **default_argv=0; @@ -75,6 +78,13 @@ static struct my_option my_long_options[] = {"s3_use_http", 'P', "If true, force use of HTTP protocol", (char**) &opt_s3_use_http, (char**) &opt_s3_use_http, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_ssl_no_verify", 's', "If true, verification of the S3 endpoint SSL " + "certificate is disabled", + (char**) &opt_s3_ssl_no_verify, (char**) &opt_s3_ssl_no_verify, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_no_content_type", 'n', "If true, disables the Content-Type header", + (char**) &opt_s3_no_content_type, (char**) &opt_s3_no_content_type, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'c', "Use compression", &opt_compression, &opt_compression, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"op", 'o', "Operation to execute. One of 'from_s3', 'to_s3' or " @@ -94,6 +104,10 @@ static struct my_option my_long_options[] = "Note: \"Legacy\", \"Original\" and \"Amazon\" are deprecated.", &opt_protocol_version, &opt_protocol_version, &s3_protocol_typelib, GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"s3_provider", 'R', "Enable S3 provider specific compatibility tweaks " + "\"Default\", \"Amazon\", or \"Huawei\".", + &opt_provider, &opt_provider, &s3_provider_typelib, + GET_ENUM, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force copy even if target exists", &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Write more information", &opt_verbose, &opt_verbose, @@ -216,6 +230,19 @@ int main(int argc, char** argv) ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size); + /* Provider specific overrides */ + switch (opt_provider) + { + case 0: /* Default */ + break; + case 1: /* Amazon */ + opt_protocol_version = 5; + break; + case 2: /* Huawei */ + opt_s3_no_content_type = 1; + break; + } + if (opt_protocol_version > 2) { uint8_t protocol_version; @@ -241,6 +268,11 @@ int main(int argc, char** argv) if (opt_s3_use_http) ms3_set_option(global_s3_client, MS3_OPT_USE_HTTP, NULL); + if (opt_s3_ssl_no_verify) + ms3_set_option(global_s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL); + + if (opt_s3_no_content_type) + ms3_set_option(global_s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL); for (; *argv ; argv++) { diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 83f688b7c45..b22d160ae9c 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -78,7 +78,7 @@ #define DEFAULT_AWS_HOST_NAME "s3.amazonaws.com" static PAGECACHE s3_pagecache; -static ulong s3_block_size, s3_protocol_version; +static ulong s3_block_size, s3_protocol_version, s3_provider; static ulong s3_pagecache_division_limit, s3_pagecache_age_threshold; static ulong s3_pagecache_file_hash_size; static ulonglong s3_pagecache_buffer_size; @@ -86,6 +86,8 @@ static char *s3_bucket, *s3_access_key=0, *s3_secret_key=0, *s3_region; static char *s3_host_name; static int s3_port; static my_bool s3_use_http; +static my_bool s3_ssl_no_verify; +static my_bool s3_no_content_type; static char *s3_tmp_access_key=0, *s3_tmp_secret_key=0; static my_bool s3_debug= 0, s3_slave_ignore_updates= 0; static my_bool s3_replicate_alter_as_create_select= 0; @@ -222,6 +224,10 @@ static MYSQL_SYSVAR_BOOL(use_http, s3_use_http, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "If true, force use of HTTP protocol", NULL /*check*/, NULL /*update*/, 0 /*default*/); +static MYSQL_SYSVAR_BOOL(ssl_no_verify, s3_ssl_no_verify, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "If true, SSL certificate verifiction for the S3 endpoint is disabled", + NULL, NULL, 0); static MYSQL_SYSVAR_STR(access_key, s3_tmp_access_key, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC, "AWS access key", @@ -234,6 +240,15 @@ static MYSQL_SYSVAR_STR(region, s3_region, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "AWS region", 0, 0, ""); +static MYSQL_SYSVAR_BOOL(no_content_type, s3_no_content_type, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "If true, disables the Content-Type header, required for some providers", + NULL, NULL, 0); +static MYSQL_SYSVAR_ENUM(provider, s3_provider, + PLUGIN_VAR_RQCMDARG, + "Enable S3 provider specific compatibility tweaks " + "\"Default\", \"Amazon\", or \"Huawei\". ", + NULL, NULL, 0, &s3_provider_typelib); ha_create_table_option s3_table_option_list[]= { @@ -320,6 +335,9 @@ static my_bool s3_info_init(S3_INFO *info) lex_string_set(&info->host_name, s3_host_name); info->port= s3_port; info->use_http= s3_use_http; + info->ssl_no_verify= s3_ssl_no_verify; + info->no_content_type = s3_no_content_type; + info->provider= s3_provider; lex_string_set(&info->access_key, s3_access_key); lex_string_set(&info->secret_key, s3_secret_key); lex_string_set(&info->region, s3_region); @@ -1121,12 +1139,15 @@ static struct st_mysql_sys_var* system_variables[]= { MYSQL_SYSVAR(host_name), MYSQL_SYSVAR(port), MYSQL_SYSVAR(use_http), + MYSQL_SYSVAR(ssl_no_verify), MYSQL_SYSVAR(bucket), MYSQL_SYSVAR(access_key), MYSQL_SYSVAR(secret_key), MYSQL_SYSVAR(region), MYSQL_SYSVAR(slave_ignore_updates), MYSQL_SYSVAR(replicate_alter_as_create_select), + MYSQL_SYSVAR(no_content_type), + MYSQL_SYSVAR(provider), NULL }; diff --git a/storage/maria/libmarias3 b/storage/maria/libmarias3 index a81724ab07b..0d5babbe46f 160000 --- a/storage/maria/libmarias3 +++ b/storage/maria/libmarias3 @@ -1 +1 @@ -Subproject commit a81724ab07bd28e16bf431419c24b6362d5894fc +Subproject commit 0d5babbe46f17147ed51efd1f05a0001017a2aad diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 7d871a2e68a..6931c51cbd9 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -6414,7 +6414,7 @@ my_bool translog_write_record(LSN *lsn, struct st_translog_parts parts; LEX_CUSTRING *part; int rc; - uint short_trid= trn->short_id; + SHORT_TRANSACTION_ID short_trid= trn->short_id; DBUG_ENTER("translog_write_record"); DBUG_PRINT("enter", ("type: %u (%s) ShortTrID: %u rec_len: %lu", (uint) type, log_record_type_descriptor[type].name, diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c index d85dc8a0b40..b8918c48d4b 100644 --- a/storage/maria/s3_func.c +++ b/storage/maria/s3_func.c @@ -43,6 +43,9 @@ static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "P TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"", protocol_types, NULL}; +static const char *providers[]= {"Default", "Amazon", "Huawei", NullS}; +TYPELIB s3_provider_typelib = {array_elements(providers)-1,"",providers, NULL}; + /****************************************************************************** Allocations handler for libmarias3 To be removed when we do the init allocation in mysqld.cc @@ -154,6 +157,20 @@ ms3_st *s3_open_connection(S3_INFO *s3) errno, ms3_error(errno)); my_errno= HA_ERR_NO_SUCH_TABLE; } + + /* Provider specific overrides */ + switch (s3->provider) + { + case 0: /* Default */ + break; + case 1: /* Amazon */ + s3->protocol_version = 5; + break; + case 2: /* Huawei */ + s3->no_content_type = 1; + break; + } + if (s3->protocol_version > 2) { uint8_t protocol_version; @@ -177,6 +194,12 @@ ms3_st *s3_open_connection(S3_INFO *s3) if (s3->use_http) ms3_set_option(s3_client, MS3_OPT_USE_HTTP, NULL); + if (s3->ssl_no_verify) + ms3_set_option(s3_client, MS3_OPT_DISABLE_SSL_VERIFY, NULL); + + if (s3->no_content_type) + ms3_set_option(s3_client, MS3_OPT_NO_CONTENT_TYPE, NULL); + return s3_client; } diff --git a/storage/maria/s3_func.h b/storage/maria/s3_func.h index f73a95dea24..9c0831b158d 100644 --- a/storage/maria/s3_func.h +++ b/storage/maria/s3_func.h @@ -38,6 +38,7 @@ extern struct s3_func { } s3f; extern TYPELIB s3_protocol_typelib; +extern TYPELIB s3_provider_typelib; /* Store information about a s3 connection */ @@ -47,6 +48,8 @@ struct s3_info LEX_CSTRING access_key, secret_key, region, bucket, host_name; int port; // 0 means 'Use default' my_bool use_http; + my_bool ssl_no_verify; + my_bool no_content_type; /* Will be set by caller or by ma_open() */ LEX_CSTRING database, table; @@ -63,6 +66,8 @@ struct s3_info /* Protocol for the list bucket API call. 1 for Amazon, 2 for some others */ uint8_t protocol_version; + + uint8_t provider; }; diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index 4553fd432b0..399201a2ef6 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -421,14 +421,6 @@ set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga") if(NOT EXISTS "${MRN_TEST_SUITE_DIR}") set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga") endif() -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result" - NEWLINE_STYLE LF) -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result" - NEWLINE_STYLE LF) configure_file( "${PROJECT_SOURCE_DIR}/data/install.sql.in" diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index f1be6475b1b..25e34a16cc9 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -16673,7 +16673,7 @@ bool ha_mroonga::can_switch_engines() DBUG_RETURN(res); } -int ha_mroonga::wrapper_get_foreign_key_list(const THD *thd, +int ha_mroonga::wrapper_get_foreign_key_list(THD *thd, List *f_key_list) { MRN_DBUG_ENTER_METHOD(); @@ -16687,7 +16687,7 @@ int ha_mroonga::wrapper_get_foreign_key_list(const THD *thd, } #ifdef MRN_SUPPORT_FOREIGN_KEYS -int ha_mroonga::storage_get_foreign_key_list(const THD *thd, +int ha_mroonga::storage_get_foreign_key_list(THD *thd, List *f_key_list) { int error; @@ -16797,7 +16797,7 @@ int ha_mroonga::storage_get_foreign_key_list(THD *thd, } #endif -int ha_mroonga::get_foreign_key_list(const THD *thd, +int ha_mroonga::get_foreign_key_list(THD *thd, List *f_key_list) { MRN_DBUG_ENTER_METHOD(); @@ -16811,7 +16811,7 @@ int ha_mroonga::get_foreign_key_list(const THD *thd, DBUG_RETURN(res); } -int ha_mroonga::wrapper_get_parent_foreign_key_list(const THD *thd, +int ha_mroonga::wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list) { MRN_DBUG_ENTER_METHOD(); @@ -16824,7 +16824,7 @@ int ha_mroonga::wrapper_get_parent_foreign_key_list(const THD *thd, DBUG_RETURN(res); } -int ha_mroonga::storage_get_parent_foreign_key_list(const THD *thd, +int ha_mroonga::storage_get_parent_foreign_key_list(THD *thd, List *f_key_list) { MRN_DBUG_ENTER_METHOD(); @@ -16832,7 +16832,7 @@ int ha_mroonga::storage_get_parent_foreign_key_list(const THD *thd, DBUG_RETURN(res); } -int ha_mroonga::get_parent_foreign_key_list(const THD *thd, +int ha_mroonga::get_parent_foreign_key_list(THD *thd, List *f_key_list) { MRN_DBUG_ENTER_METHOD(); @@ -16846,10 +16846,10 @@ int ha_mroonga::get_parent_foreign_key_list(const THD *thd, DBUG_RETURN(res); } -uint ha_mroonga::wrapper_referenced_by_foreign_key() +inline bool ha_mroonga::wrapper_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); res = wrap_handler->referenced_by_foreign_key(); @@ -16858,17 +16858,17 @@ uint ha_mroonga::wrapper_referenced_by_foreign_key() DBUG_RETURN(res); } -uint ha_mroonga::storage_referenced_by_foreign_key() +inline bool ha_mroonga::storage_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res = handler::referenced_by_foreign_key(); + bool res = handler::referenced_by_foreign_key(); DBUG_RETURN(res); } -uint ha_mroonga::referenced_by_foreign_key() +bool ha_mroonga::referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; if (share->wrapper_mode) { res = wrapper_referenced_by_foreign_key(); diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index ea34394f8cb..9fe04a07527 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -618,9 +618,9 @@ protected: char *get_tablespace_name(THD *thd, char *name, uint name_len); #endif bool can_switch_engines() mrn_override; - int get_foreign_key_list(const THD *thd, List *f_key_list) mrn_override; - int get_parent_foreign_key_list(const THD *thd, List *f_key_list) mrn_override; - uint referenced_by_foreign_key() mrn_override; + int get_foreign_key_list(THD *thd, List *f_key_list) mrn_override; + int get_parent_foreign_key_list(THD *thd, List *f_key_list) mrn_override; + bool referenced_by_foreign_key() const noexcept mrn_override; void init_table_handle_for_HANDLER() mrn_override; void free_foreign_key_create_info(char* str) mrn_override; #ifdef MRN_HAVE_HA_REBIND_PSI @@ -1270,12 +1270,12 @@ private: #endif bool wrapper_can_switch_engines(); bool storage_can_switch_engines(); - int wrapper_get_foreign_key_list(const THD *thd, List *f_key_list); - int storage_get_foreign_key_list(const THD *thd, List *f_key_list); - int wrapper_get_parent_foreign_key_list(const THD *thd, List *f_key_list); - int storage_get_parent_foreign_key_list(const THD *thd, List *f_key_list); - uint wrapper_referenced_by_foreign_key(); - uint storage_referenced_by_foreign_key(); + int wrapper_get_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_foreign_key_list(THD *thd, List *f_key_list); + int wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_parent_foreign_key_list(THD *thd, List *f_key_list); + bool wrapper_referenced_by_foreign_key() const noexcept; + bool storage_referenced_by_foreign_key() const noexcept; void wrapper_init_table_handle_for_HANDLER(); void storage_init_table_handle_for_HANDLER(); void wrapper_free_foreign_key_create_info(char* str); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result new file mode 100644 index 00000000000..ef47d228da4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_TYPE +Mroonga STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in deleted file mode 100644 index f1020453183..00000000000 --- a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in +++ /dev/null @@ -1,4 +0,0 @@ -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE -from information_schema.plugins where plugin_name = "Mroonga"; -PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE -Mroonga @MRN_PLUGIN_VERSION@ STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result similarity index 66% rename from storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in rename to storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result index 26ff300a759..146f70e1df0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result @@ -1,3 +1,3 @@ show variables like 'mroonga_version'; Variable_name Value -mroonga_version @MRN_VERSION@ +mroonga_version # diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test index ec9e3c9d4b9..1cd840a9690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test index e3b7df72cf9..b1276755a40 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test @@ -33,7 +33,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR'; SHOW CREATE TABLE tags; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test index 964426b44bf..dbad49d67d2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test @@ -35,7 +35,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test index 0f92c024b7c..1f83d5d2df7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags'; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test index 0516186ba17..8377e9c5690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test index acfcd6fefd2..b3c2013be64 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test index 54fb986a24f..19879bc57f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test @@ -34,7 +34,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test index 8a63885a8e7..d68fb7c7362 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -34,7 +34,10 @@ CREATE TABLE memos ( ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test index 8efaad2a4ce..00a09f952ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -37,6 +37,8 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; @@ -47,6 +49,7 @@ ALTER TABLE memos DISABLE KEYS; ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test index 83ce2ca786e..8237f2d83fb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test @@ -35,9 +35,12 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test index 424e51adaaa..27071e82c1d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test @@ -35,10 +35,13 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test index c23f35eef9a..11e524482be 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test @@ -39,7 +39,10 @@ CREATE TABLE bugs ( INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT *, MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test index 9e128a005bb..710b922d9da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -40,7 +40,10 @@ INSERT INTO bugs (id, priority) VALUES (1, 10); INSERT INTO bugs (id, priority) VALUES (2, 3); INSERT INTO bugs (id, priority) VALUES (3, -2); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT * FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test index be26045ab89..5c94e43e2c8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test index c3a5b787bc1..965401e19b1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test index 6bafebd8b9c..c3e4280390d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test @@ -29,7 +29,10 @@ CREATE TABLE bugs ( tags TEXT COMMENT 'flags "COLUMN_VECTOR"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test index 3baa576a9ea..3dd9bd81a08 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test @@ -30,7 +30,10 @@ CREATE TABLE bugs ( tags TEXT FLAGS='COLUMN_VECTOR' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test index 28f0f214935..aa2270d4926 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'groonga_type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test index a664287289b..6b1bd629337 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test index bd4b268b081..4b308c196eb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test index ade4099a8d5..d1d4654460a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( COLLATE=utf8_bin COMMENT='default_tokenizer "TokenDelimit"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test index 4997dbf75f7..b2bc719d683 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test @@ -29,7 +29,10 @@ CREATE TABLE diaries ( INDEX (content) COMMENT 'normalizer "NormalizerAuto"' ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test index f7add5dbd60..5b2dcf00001 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test index 2fc98e6103e..4f40cca47c0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test index aaf60b02dc4..a4c844ba435 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE memos ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test index dc0996d279c..a9de0b1101d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test index ee1da6d09c3..30a21540c62 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test index 37405696697..e9ab751dc0b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 100; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test index 9322876badb..64a75843bfc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 200; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test index 283efbd3a48..a0e27ea5618 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test index 4b873f50cf0..ea9820ac6a6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test index fc3590f36ff..24cba6110fa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test index bcba6e75736..756c26bbfc2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test index e40a703b0a5..db2ee2b2203 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test @@ -31,9 +31,12 @@ CREATE TABLE diaries ( INSERT INTO diaries VALUES('It is Groonga'); INSERT INTO diaries VALUES('It is Mroonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('select', 'table', 'diaries', 'filter', 'title @ "Groonga"'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test index 169bb0d1306..35033f2b7cf 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test @@ -30,7 +30,10 @@ CREATE TABLE diaries ( FULLTEXT KEY (title) ) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test index 3958782a4bc..8f9013bc87b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', keyword) AS highlighted FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test index 98643876058..bac040e69b3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test index 83e5966d39e..a774f361fe3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'mroonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test index aa2eee53b53..108f28ce952 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘'); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test index bb9199f012f..bcaec1fe4da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘', "NormalizerAuto"); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test index a92e651cfd4..69297ed3152 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', keyword) as snippet FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test index 54953ebea59..a968c7b924e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') as snippet; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test index 2d65b763aac..2fc986a27ee 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -16,7 +16,7 @@ --source ../../include/mroonga/have_mroonga.inc -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +select PLUGIN_NAME, PLUGIN_TYPE from information_schema.plugins where plugin_name = "Mroonga"; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test index d9795eabdb6..848d800b5ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -17,6 +17,7 @@ --source ../../include/mroonga/have_mroonga.inc # show variables like 'groonga%'; +--replace_column 2 # show variables like 'mroonga_version'; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test index 21e80a74fd6..ac828ddb1ac 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test index 81a7775c4a2..f348d5ae19b 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test index 5898e3772c6..f06f6cfe94e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test index a2d7a4dbb04..89877a35af0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test index e6dd9908002..c609df9d03d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -27,7 +27,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test index 45c758173d4..920fa63a46c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test index 64732efd8ec..55e31124c18 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test index 3fb0caeadf8..e6b56bae1e0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE memos ( ) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c index 380e65531a1..40eb2b51bb5 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c @@ -69,13 +69,15 @@ command_object_remove(grn_ctx *ctx, grn_obj **args, grn_user_data *user_data) { - grn_obj *db; grn_obj *name; grn_bool force; grn_obj *target; grn_bool failed_to_open; - db = grn_ctx_db(ctx); + if (!grn_ctx_db(ctx)) { + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "invalid db assigned"); + return NULL; + } name = grn_plugin_proc_get_var(ctx, user_data, "name", -1); force = grn_plugin_proc_get_var_bool(ctx, user_data, "force", -1, GRN_FALSE); diff --git a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c index 0501007471f..58764944d4f 100644 --- a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c +++ b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c @@ -91,8 +91,7 @@ selector_index_column_df_ratio_between(grn_ctx *ctx, df_ratio = (double)n_match_documents / (double)n_documents; { void *key; - int key_size; - key_size = grn_table_cursor_get_key(ctx, cursor, &key); + grn_table_cursor_get_key(ctx, cursor, &key); } if (min <= df_ratio && df_ratio <= max) { posting.rid = term_id; diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c index 5d5deec69c1..09d3803eddb 100644 --- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c +++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c @@ -196,7 +196,6 @@ load_synonyms(grn_ctx *ctx) const char *path; grn_file_reader *file_reader; int number_of_lines; - grn_encoding encoding; grn_obj line, key, value; grn_getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE", @@ -234,7 +233,7 @@ load_synonyms(grn_ctx *ctx) } number_of_lines++; if (number_of_lines == 1) { - encoding = guess_encoding(ctx, &line_value, &line_length); + guess_encoding(ctx, &line_value, &line_length); } GRN_BULK_REWIND(&key); GRN_BULK_REWIND(&value); diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c index 7f64f3c17d9..411000f7dbf 100644 --- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c +++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c @@ -653,7 +653,7 @@ learner_init(grn_ctx *ctx, grn_suggest_learner *learner, static void learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) { - grn_id events_id, event_types_id; + grn_id events_id; grn_obj *seqs, *events, *post_item, *items, *pairs; learner->seqs = seqs = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAIN(learner->seq)); @@ -665,7 +665,7 @@ learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) learner->events_type = grn_obj_column(ctx, events, CONST_STR_LEN("type")); learner->events_time = grn_obj_column(ctx, events, CONST_STR_LEN("time")); - event_types_id = grn_obj_get_range(ctx, learner->events_type); + grn_obj_get_range(ctx, learner->events_type); learner->event_types = grn_obj_column(ctx, events, CONST_STR_LEN("time")); post_item = learner->post_item; diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index e6876dccfe6..1c5848d19d9 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -57,8 +57,7 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf) void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - aligned_free(ptr); + aligned_free(ptr); } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index a02e2478d27..217a2ea7beb 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -23,21 +23,23 @@ #include #include #include +#include "aligned.h" +#include "assume_aligned.h" bool pfs_initialized= false; void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf flags) { - void *ptr= malloc(size); + size= MY_ALIGN(size, CPU_LEVEL1_DCACHE_LINESIZE); + void *ptr= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); if (ptr && (flags & MY_ZEROFILL)) - memset(ptr, 0, size); + memset_aligned(ptr, 0, size); return ptr; } void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - free(ptr); + aligned_free(ptr); } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) diff --git a/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc b/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc index 48ef6f816bd..098aa0fbf45 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc @@ -1,3 +1,8 @@ +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) +{ + --skip Test temporarily disabled for ps-protocol and cursor-protocol +} + let $prior_set_lwt = `select concat('set @prior_lock_wait_timeout = @@', '$engine', '_lock_wait_timeout;')`; let $prior_set_dld = `select concat('set @prior_deadlock_detect = @@', diff --git a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc index 27d73e8d815..9adb285de3c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc @@ -1432,10 +1432,12 @@ INSERT INTO t1(c1,c2) VALUES (4,14), (4,15), (4,16), (4,17), (4,18), (4,19), (4,20),(5,5); ANALYZE TABLE t1; +--disable_cursor_protocol EXPLAIN SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; FLUSH STATUS; SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test index aeadf5381b0..64d38a5e571 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test @@ -35,9 +35,11 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1; --echo ## --echo ## 2PC + durability + single thread --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; @@ -63,9 +65,11 @@ set debug_dbug='-d,rocksdb_enable_delay_commits'; --echo ## --echo ## 2PC + durability + group commit --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -90,9 +94,11 @@ set debug_dbug='-d,rocksdb_disable_delay_commits'; SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=0; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits @@ -106,9 +112,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo # 2PC enabled, MyRocks durability disabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -132,9 +140,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_flush_log_at_trx_commit=1; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -148,9 +158,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC disabled, MyRocks durability enabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select variable_value - @b1 as Binlog_commits diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test index 99e28f3b55e..280c59a6a1d 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test @@ -67,7 +67,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After engine prepare @@ -83,7 +85,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After binlog @@ -99,7 +103,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After everything @@ -115,7 +121,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; drop table t; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test index b64af16411b..83ef7c0ff29 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test @@ -99,10 +99,12 @@ while ($i > 0) # smallest value in the sequence for thread 'thr' that is greater than # the pk in the previous row. let $file = `SELECT CONCAT(@@datadir, "test_export.txt")`; +--disable_cursor_protocol --disable_query_log --echo SELECT * FROM t1 ORDER BY pk INTO OUTFILE ; eval SELECT * FROM t1 ORDER BY pk INTO OUTFILE "$file"; --enable_query_log +--enable_cursor_protocol let ROCKSDB_OUTFILE = $file; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test index dc2a0da506d..41909a584ff 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test @@ -29,7 +29,9 @@ while ($i <= 10000) { ## HA_READ_PREFIX_LAST_OR_PREV # BF len 21 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -47,7 +49,9 @@ explain select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol # MariaDB: no support for optimizer_force_index_for_range: #set @tmp_force_index_for_range=@@optimizer_force_index_for_range; #set optimizer_force_index_for_range=on; @@ -56,34 +60,46 @@ select case when variable_value-@c > 0 then 'true' else 'false' end from informa #set global optimizer_force_index_for_range=@tmp_force_index_for_range; # BF len 13 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; ## HA_READ_PREFIX_LAST_OR_PREV (no end range) # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 and time >= 0 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo ## HA_READ_PREFIX_LAST --echo # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 12 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -125,7 +141,9 @@ explain select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; --echo # The following MUST show TRUE: diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test index 76ec6ca101f..0139b7e442e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test @@ -4,6 +4,8 @@ # This test inserts 20,000 rows into t1, then selecting one by one from stored procedure. # If the select does not return any row, it is wrong. +--disable_ps_protocol +--disable_cursor_protocol CREATE TABLE t1 ( `id1` int unsigned NOT NULL DEFAULT '0', `id2` int unsigned NOT NULL DEFAULT '0', @@ -49,4 +51,5 @@ CALL select_test(); DROP PROCEDURE select_test; drop table t1; - +--enable_cursor_protocol +--enable_ps_protocol diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test index 09d9d734f9e..e159cab2f0c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test @@ -21,12 +21,16 @@ while ($t <= 2) { set session rocksdb_bulk_load=0; # bloom filter should be useful on insert (calling GetForUpdate) +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r1 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; # cf2 has no bloo filter in the bottommost level +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r2 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test index 1dcb176e4fa..6dcea5ccc4e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test @@ -21,8 +21,10 @@ column_name="a"; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -35,8 +37,10 @@ SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -111,8 +115,10 @@ while ($i<100) # Cardinality of key c should be 1 for c, 10 for b, 100 for a and the other fields. SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t2; +--disable_cursor_protocol --echo cardinality of the columns after 'a' must be equal to the cardinality of column 'a' SELECT CARDINALITY INTO @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND COLUMN_NAME='a'; +--enable_cursor_protocol SELECT COLUMN_NAME, CARDINALITY = @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND SEQ_IN_INDEX > 3; drop table t1, t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test index b9a17e426ea..de614645352 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test @@ -96,7 +96,11 @@ let $extra_col_opts = NOT NULL; set @col_opt_not_nullsave_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol +--disable_ps_protocol --source type_date_time.inc +--enable_ps_protocol +--enable_cursor_protocol SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12'); @@ -123,9 +127,13 @@ SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12'); --let $col_default = '2012' --source col_not_null.inc +--disable_cursor_protocol +--disable_ps_protocol --let $col_type = YEAR(2) --let $col_default = '12' --source col_not_null.inc +--enable_ps_protocol +--enable_cursor_protocol set time_zone= @col_opt_not_nullsave_time_zone; @@ -157,8 +165,10 @@ set time_zone= @col_opt_not_nullsave_time_zone; --echo # Floating point columns (FLOAT, DOUBLE) --echo ######################## +--disable_ps_protocol --source type_float.inc - +--enable_ps_protocol + --let $col_type = FLOAT --let $col_default = 1.1 --source col_not_null.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test index 10518e3130d..369d2d8c17d 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test @@ -92,7 +92,11 @@ let $extra_col_opts = NULL; set @col_opt_nullsave_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol +--disable_ps_protocol --source type_date_time.inc +--enable_ps_protocol +--enable_cursor_protocol --let $col_type = DATE --let $col_default = '2012-12-21' @@ -114,9 +118,13 @@ set time_zone='UTC'; --let $col_default = '2012' --source col_null.inc +--disable_cursor_protocol +--disable_ps_protocol --let $col_type = YEAR(2) --let $col_default = '12' --source col_null.inc +--enable_ps_protocol +--enable_cursor_protocol set time_zone=@col_opt_nullsave_time_zone; @@ -147,8 +155,10 @@ set time_zone=@col_opt_nullsave_time_zone; --echo # Floating point columns (FLOAT, DOUBLE) --echo ######################## +--disable_ps_protocol --source type_float.inc - +--enable_ps_protocol + --let $col_type = FLOAT --let $col_default = 1.1 --source col_null.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test b/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test index a9b30a4273a..d8461a26645 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test @@ -1,3 +1,7 @@ let $engine=rocksdb; +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} --source include/deadlock_stats.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc index 1a044384a45..dd9a19a29cb 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc @@ -29,7 +29,9 @@ let $max = 50000; let $table = t1; --source drop_table3_repopulate_table.inc +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_compact_read_bytes'; +--enable_cursor_protocol if ($truncate_table) { truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test index 22b5d69780d..21ee4b9b3ba 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test @@ -8,6 +8,8 @@ DROP TABLE IF EXISTS t1; --enable_warnings +--disable_cursor_protocol + FLUSH STATUS; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(100), b INT, INDEX b(b)) ENGINE=rocksdb; @@ -49,5 +51,7 @@ FLUSH STATUS; SELECT * FROM t1 WHERE id < 8 ORDER BY id; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol + # Cleanup DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc index 17baf5b6c57..ba88c603568 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc @@ -111,7 +111,9 @@ commit; connection con1; update test set value = value + 10; connection con2; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; +--enable_cursor_protocol select * from test; send delete from test where value = 20; connection con1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test index ccef7182c11..cde1d4ef1fc 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test @@ -21,8 +21,10 @@ while ($i < 30) { inc $j; } + --disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='Sort_merge_passes'; eval SELECT a, b, c FROM ti_nk ORDER BY a,b,c INTO OUTFILE '$datadir/select.out'; + --enable_cursor_protocol --remove_file $datadir/select.out select case when variable_value-@s = 0 then 'true' else 'false' end as skip_merge_sort from information_schema.global_status where variable_name='Sort_merge_passes'; inc $i; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test index ee41324a34d..26bea857ed3 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test @@ -72,8 +72,10 @@ AND VALUE > 0; SELECT COUNT(*) from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @a from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol # Single statement writes do show up in per-table stats INSERT INTO t2 VALUES (5), (6), (7), (8); @@ -83,8 +85,10 @@ WHERE TABLE_NAME = 't2' AND STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @b from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol SELECT CASE WHEN @b - @a > 0 THEN 'true' ELSE 'false' END; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test index 8fa43e15827..ffad670a0bf 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test @@ -22,7 +22,9 @@ set global rocksdb_force_flush_memtable_now = 1; SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%'; # BF used (4+8+8+8) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -48,7 +50,9 @@ SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%pre # Satisfies can_use_bloom_filter (4+8+8+8), but can't use because the old SST # files have old prefix extractor +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -67,7 +71,9 @@ set global rocksdb_force_flush_memtable_now = 1; # BF used w/ new prefix extractor (4+8+8+8) (still increments once because it # needs to check the new SST file, but doesnt increment for SST file with old # extractor) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -81,7 +87,9 @@ set global rocksdb_force_flush_memtable_now = 1; # should have 3 sst files, one with old prefix extractor and two with new SELECT COUNT(*) FROM information_schema.rocksdb_index_file_map WHERE COLUMN_FAMILY != 1; +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -89,7 +97,9 @@ SET @@global.rocksdb_update_cf_options = ''; set global rocksdb_compact_cf='cf1'; # Select the updated, make sure bloom filter is checked now +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=30 AND id3=30; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test index 3a1025a3623..dfd119a0a8c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test @@ -18,8 +18,10 @@ CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=Rock INSERT INTO t1 VALUES (1,1); # Read-only, long-running transaction. SingleDelete/Put shouldn't increase much. +--disable_cursor_protocol select variable_value into @p from information_schema.global_status where variable_name='rocksdb_number_sst_entry_put'; select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; +--enable_cursor_protocol #-- replace_result $uuid uuid START TRANSACTION WITH CONSISTENT SNAPSHOT; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test index 43d010f7daa..636fb73fd88 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test @@ -11,6 +11,7 @@ set @@global.query_cache_size=1024*1024; --enable_connect_log +--disable_cursor_protocol create table t1 (pk int primary key, c char(8)) engine=RocksDB; insert into t1 values (1,'new'),(2,'new'); @@ -35,6 +36,7 @@ show status like 'Qcache_not_cached'; show global status like 'Qcache_hits'; drop table t1; +--enable_cursor_protocol # # Cleanup diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test index ebcc741fc17..ec99aa98278 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test @@ -1,6 +1,7 @@ source include/have_rocksdb.inc; create table t1 (a int primary key) engine=rocksdb; +--disable_cursor_protocol -- echo Verify rocksdb_rows_inserted select variable_value into @old_rows_inserted from information_schema.global_status where variable_name = 'rocksdb_rows_inserted'; insert into t1 values(1); @@ -51,6 +52,7 @@ select variable_value into @old_system_rows_deleted from information_schema.glob delete from t1; select variable_value into @new_system_rows_deleted from information_schema.global_status where variable_name = 'rocksdb_system_rows_deleted'; select @new_system_rows_deleted - @old_system_rows_deleted; +--enable_cursor_protocol drop table t1; use test; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/select.test b/storage/rocksdb/mysql-test/rocksdb/t/select.test index 3d9bdc7b4b8..fc6cd7c5d10 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/select.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/select.test @@ -68,6 +68,7 @@ SELECT * FROM t2 WHERE a>0 PROCEDURE ANALYSE(); # SELECT INTO let $datadir = `SELECT @@datadir`; +--disable_cursor_protocol --replace_result $datadir eval SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a @@ -94,6 +95,7 @@ SELECT t1.*, t2.* FROM t1, t2 ORDER BY t2.b, t1.a, t2.a, t1.b, t1.pk, t2.pk LIMI SELECT MIN(a), MAX(a) FROM t1 INTO @min, @max; SELECT @min, @max; +--enable_cursor_protocol # Joins diff --git a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test index 55854710c31..5fc52a5142c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test @@ -81,9 +81,11 @@ flush tables; select create_time is not null, update_time is not null, check_time from information_schema.tables where table_schema=database() and table_name='t1'; +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(3); insert into t1 values (2); @@ -109,9 +111,11 @@ where table_schema=database() and table_name='t1'; insert into t1 values (5,5); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol --echo # Then, an in-place ALTER TABLE: select sleep(2); @@ -126,9 +130,11 @@ where table_schema=database() and table_name='t1'; --echo # Check TRUNCATE TABLE insert into t1 values (10,10); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(2); truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test index 5a9d17e0255..9de2a899eda 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test @@ -3,8 +3,10 @@ # only SingleDelete increases CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t1 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -21,8 +23,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # both SingleDelete and Delete increases CREATE TABLE t2 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t2 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -38,8 +42,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only Delete increases CREATE TABLE t3 (id INT, value int, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t3 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -55,8 +61,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only SingleDelete increases CREATE TABLE t4 (id INT, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t4 VALUES (1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -72,8 +80,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # only SingleDelete increases CREATE TABLE t5 (id1 INT, id2 INT, PRIMARY KEY (id1, id2), INDEX(id2)) ENGINE=RocksDB; INSERT INTO t5 VALUES (1, 1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test index 38bfb2eef8f..d8f17a7cbb9 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test @@ -516,7 +516,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -537,7 +539,9 @@ INSERT INTO t1 values (1); INSERT INTO t1 values (2); INSERT INTO t1 values (3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test index 7a7609f456e..a452e932bb5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test @@ -24,7 +24,9 @@ set global rocksdb_force_flush_memtable_now=1; --sorted_result SELECT * FROM t1; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; @@ -78,7 +80,9 @@ INSERT INTO t1 values (7); set global rocksdb_debug_ttl_rec_ts = 0; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -87,7 +91,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=0; # should return everything +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -96,7 +102,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=1; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -125,7 +133,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; @@ -301,27 +311,35 @@ set global rocksdb_compact_cf='default'; # this connection the records have 'expired' already so they are filtered out # even though they have not yet been removed by compaction +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; --echo # Switching to connection 1 connection con1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; UPDATE t1 set a = a + 1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; COMMIT; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result # <= filtered out here because time has passed. SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test index fb439e109e7..49d097b1056 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test @@ -582,7 +582,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -604,7 +606,9 @@ INSERT INTO t1 values (1, 1); INSERT INTO t1 values (2, 2); INSERT INTO t1 values (3, 3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test index f6042cc517e..0e83a0f003e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test @@ -29,7 +29,9 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY); --sorted_result SELECT * FROM t1 FORCE INDEX (kb); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_debug_ttl_ignore_pk = 1; set global rocksdb_compact_cf='default'; set global rocksdb_debug_ttl_ignore_pk = 0; @@ -145,7 +147,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test index d231236bd92..f5134b841aa 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test @@ -45,8 +45,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --let $file1=$MYSQLTEST_VARDIR/tmp/filesort_order --let $file2=$MYSQLTEST_VARDIR/tmp/sk_order --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c1)) INTO OUTFILE '$file1' from t order by c1 --eval select hex(weight_string(c1)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c1 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 @@ -54,8 +56,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --remove_file $file2 --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c2)) INTO OUTFILE '$file1' from t order by c2 --eval select hex(weight_string(c2)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c2 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc b/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc index 18ed7436b62..12f9159e049 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc @@ -8,6 +8,7 @@ DROP TABLE IF EXISTS t1; --enable_warnings set @save_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol eval CREATE TABLE t1 ( d DATE $extra_col_opts, dt DATETIME $extra_col_opts, @@ -18,6 +19,7 @@ eval CREATE TABLE t1 ( y2 YEAR(2) $extra_col_opts, pk DATETIME PRIMARY KEY ) ENGINE=rocksdb; +--enable_cursor_protocol SHOW COLUMNS IN t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc index ff58b73a91b..27adda9ba35 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc @@ -56,6 +56,8 @@ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10,pk) VALUES (-9999 --sorted_result --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 +#Enable after fix MDEV-34624 +--disable_cursor_protocol --sorted_result query_vertical SELECT @@ -116,6 +118,7 @@ eval ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) $extra_col_opts; # Error occurs on MySQL but not on MariaDB: # --error ER_TOO_BIG_SCALE eval ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) $extra_col_opts; +--enable_cursor_protocol DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test b/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test index e9718ff74ae..30df91c3105 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test @@ -1,6 +1,11 @@ --source include/have_rocksdb.inc --source include/have_debug_sync.inc +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} + # For GitHub issue#167 -- Unique key check doesn't work connect (con1, localhost, root,,); diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 51e214f848e..e3364b94501 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -21,7 +21,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -1108,7 +1107,6 @@ int ha_spider::reset() int ha_spider::extra( enum ha_extra_function operation ) { - int error_num; DBUG_ENTER("ha_spider::extra"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider operation=%d", (int) operation)); @@ -1154,23 +1152,7 @@ int ha_spider::extra( case HA_EXTRA_INSERT_WITH_UPDATE: wide_handler->insert_with_update = TRUE; break; - case HA_EXTRA_ATTACH_CHILDREN: - DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; - case HA_EXTRA_ADD_CHILDREN_LIST: - DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; -#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF) -#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: -#endif -#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF - case HA_EXTRA_USE_CMP_REF: -#endif DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN")); if (table_share->primary_key != MAX_KEY) { @@ -1198,7 +1180,6 @@ int ha_spider::extra( } } break; -#endif default: break; } @@ -1268,24 +1249,160 @@ int ha_spider::index_end() DBUG_ENTER("ha_spider::index_end"); DBUG_PRINT("info",("spider this=%p", this)); active_index = MAX_KEY; -/* -#ifdef INFO_KIND_FORCE_LIMIT_BEGIN - info_limit = 9223372036854775807LL; -#endif - if ( - (error_num = drop_tmp_tables()) || - (error_num = check_and_end_bulk_update( - SPD_BU_START_BY_INDEX_OR_RND_INIT)) || - (error_num = spider_trx_check_link_idx_failed(this)) - ) - DBUG_RETURN(check_error_mode(error_num)); -*/ if ((error_num = drop_tmp_tables())) DBUG_RETURN(check_error_mode(error_num)); result_list.use_union = FALSE; DBUG_RETURN(0); } +static int spider_maybe_ping(ha_spider *spider, int link_idx, int error_num) +{ + if ( + spider->share->monitoring_kind[link_idx] && + spider->need_mons[link_idx] + ) { + error_num = spider_ping_table_mon_from_table( + spider->wide_handler->trx, + spider->wide_handler->trx->thd, + spider->share, + link_idx, + (uint32) spider->share->monitoring_sid[link_idx], + spider->share->table_name, + spider->share->table_name_length, + spider->conn_link_idx[link_idx], + NULL, + 0, + spider->share->monitoring_kind[link_idx], + spider->share->monitoring_limit[link_idx], + spider->share->monitoring_flag[link_idx], + TRUE + ); + } + return spider->check_error_mode_eof(error_num); +} + +static int spider_maybe_ping_1(ha_spider *spider, + int link_idx, int error_num) +{ + if ( + spider->share->monitoring_kind[link_idx] && + spider->need_mons[link_idx] + ) { + error_num = spider_ping_table_mon_from_table( + spider->wide_handler->trx, + spider->wide_handler->trx->thd, + spider->share, + link_idx, + (uint32) spider->share->monitoring_sid[link_idx], + spider->share->table_name, + spider->share->table_name_length, + spider->conn_link_idx[link_idx], + NULL, + 0, + spider->share->monitoring_kind[link_idx], + spider->share->monitoring_limit[link_idx], + spider->share->monitoring_flag[link_idx], + TRUE + ); + } + return error_num; +} + +static void spider_prep_loop(ha_spider *spider, int *roop_start, int *roop_end, int *link_ok) +{ + int lock_mode = spider_conn_lock_mode(spider); + if (lock_mode) + { + /* "for update" or "lock in share mode" */ + *link_ok = spider_conn_link_idx_next(spider->share->link_statuses, + spider->conn_link_idx, -1, spider->share->link_count, + SPIDER_LINK_STATUS_OK); + *roop_start = spider_conn_link_idx_next(spider->share->link_statuses, + spider->conn_link_idx, -1, spider->share->link_count, + SPIDER_LINK_STATUS_RECOVERY); + *roop_end = spider->share->link_count; + } else { + *link_ok = spider->search_link_idx; + *roop_start = spider->search_link_idx; + *roop_end = spider->search_link_idx + 1; + } +} + +/* Returns true if the caller should return *error_num */ +static bool spider_start_bg(ha_spider* spider, int roop_count, int roop_start, int link_ok, int *error_num) +{ + if ((*error_num = spider_check_and_init_casual_read( + spider->wide_handler->trx->thd, spider, + roop_count))) + return true; + if ((*error_num = spider_bg_conn_search(spider, roop_count, roop_start, + TRUE, FALSE, (roop_count != link_ok)))) + { + if ( + *error_num != HA_ERR_END_OF_FILE + ) { + *error_num= spider_maybe_ping(spider, roop_count, *error_num); + return true; + } + *error_num= spider->check_error_mode_eof(*error_num); + return true; + } + return false; +} + +/* Updates error_num. Returning true if the caller should return. */ +static bool spider_send_query(ha_spider *spider, TABLE *table, int link_idx, int link_ok, int *error_num) +{ + ulong sql_type; + SPIDER_CONN *conn = spider->conns[link_idx]; + sql_type = SPIDER_SQL_TYPE_SELECT_SQL; + spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; + if ((*error_num = dbton_hdl->set_sql_for_exec(sql_type, link_idx))) + { + return true; + } + DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); + if ((*error_num = spider_db_set_names(spider, conn, + link_idx))) + { + spider_unlock_after_query(conn, 0); + *error_num= spider_maybe_ping(spider, link_idx, *error_num); + return true; + } + spider_conn_set_timeout_from_share(conn, link_idx, + spider->wide_handler->trx->thd, spider->share); + if (dbton_hdl->execute_sql( + sql_type, + conn, + spider->result_list.quick_mode, + &spider->need_mons[link_idx]) + ) { + *error_num= spider_unlock_after_query_1(conn); + *error_num= (spider_maybe_ping(spider, link_idx, *error_num)); + return true; + } + spider->connection_ids[link_idx] = conn->connection_id; + if (link_idx == link_ok) + { + if ((*error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) + { + if ( + *error_num != HA_ERR_END_OF_FILE + ) { + *error_num= spider_maybe_ping(spider, link_idx, *error_num); + return true; + } + *error_num= spider->check_error_mode_eof(*error_num); + return true; + } + spider->result_link_idx = link_ok; + } else { + spider_db_discard_result(spider, link_idx, conn); + spider_unlock_after_query(conn, 0); + } + return false; +} int ha_spider::index_read_map_internal( uchar *buf, @@ -1293,9 +1410,8 @@ int ha_spider::index_read_map_internal( key_part_map keypart_map, enum ha_rkey_function find_flag ) { - int error_num, roop_count; + int error_num; key_range start_key; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_read_map_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -1323,6 +1439,7 @@ int ha_spider::index_read_map_internal( start_key.key = key; start_key.keypart_map = keypart_map; start_key.flag = find_flag; + /* Query construction */ if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL))) DBUG_RETURN(error_num); if ((error_num = spider_set_conn_bg_param(this))) @@ -1398,23 +1515,8 @@ int ha_spider::index_read_map_internal( } } - int roop_start, roop_end, lock_mode, link_ok; - lock_mode = spider_conn_lock_mode(this); - if (lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -1422,162 +1524,11 @@ int ha_spider::index_read_map_internal( ) { if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { - ulong sql_type; - conn= conns[roop_count]; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } } } if (buf && (error_num = spider_db_fetch(buf, this, table))) @@ -1641,7 +1592,6 @@ int ha_spider::index_read_last_map_internal( ) { int error_num; key_range start_key; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_read_last_map_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -1734,23 +1684,8 @@ int ha_spider::index_read_last_map_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -1758,162 +1693,11 @@ int ha_spider::index_read_last_map_internal( ) { if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { - ulong sql_type; - conn= conns[roop_count]; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } } } if (buf && (error_num = spider_db_fetch(buf, this, table))) @@ -2028,7 +1812,6 @@ int ha_spider::index_first_internal( uchar *buf ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_first_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2116,187 +1899,20 @@ int ha_spider::index_first_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { - ulong sql_type; - conn= conns[roop_count]; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); } } } @@ -2358,7 +1974,6 @@ int ha_spider::index_last_internal( uchar *buf ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::index_last_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2446,187 +2061,20 @@ int ha_spider::index_last_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { - ulong sql_type; - conn= conns[roop_count]; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); } } } @@ -2725,7 +2173,6 @@ int ha_spider::read_range_first_internal( bool sorted ) { int error_num; - SPIDER_CONN *conn; backup_error_status(); DBUG_ENTER("ha_spider::read_range_first_internal"); DBUG_PRINT("info",("spider this=%p", this)); @@ -2822,23 +2269,8 @@ int ha_spider::read_range_first_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -2846,162 +2278,11 @@ int ha_spider::read_range_first_internal( ) { if (result_list.bgs_phase > 0) { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } } else { - ulong sql_type; - conn= conns[roop_count]; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } } } if (buf && (error_num = spider_db_fetch(buf, this, table))) @@ -3348,23 +2629,8 @@ int ha_spider::multi_range_read_next_first( } } - int roop_start, roop_end, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -3380,76 +2646,27 @@ int ha_spider::multi_range_read_next_first( TRUE, FALSE, (roop_count != link_ok)); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } else { ulong sql_type; conn= conns[roop_count]; sql_type= SPIDER_SQL_TYPE_SELECT_SQL; spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + spider_unlock_after_query(conn, 0); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } if (!error_num) { @@ -3461,72 +2678,26 @@ int ha_spider::multi_range_read_next_first( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } if (!error_num) { connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - error_num = spider_db_store_result(this, roop_count, table); + error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -3960,24 +3131,8 @@ int ha_spider::multi_range_read_next_first( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } - + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -3993,26 +3148,9 @@ int ha_spider::multi_range_read_next_first( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } @@ -4021,51 +3159,19 @@ int ha_spider::multi_range_read_next_first( conn= conns[roop_count]; sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL; spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + spider_unlock_after_query(conn, 0); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } if ( @@ -4083,32 +3189,8 @@ int ha_spider::multi_range_read_next_first( -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } spider_db_discard_multiple_result(this, roop_count, conn); @@ -4121,72 +3203,26 @@ int ha_spider::multi_range_read_next_first( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -4336,7 +3372,7 @@ int ha_spider::multi_range_read_next_next( range_id_t *range_info ) { - int error_num, roop_count; + int error_num; SPIDER_CONN *conn; int range_res; backup_error_status(); @@ -4433,23 +3469,8 @@ int ha_spider::multi_range_read_next_next( } } - int roop_start, roop_end, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -4465,76 +3486,27 @@ int ha_spider::multi_range_read_next_next( TRUE, FALSE, (roop_count != link_ok)); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } else { ulong sql_type; conn= conns[roop_count]; sql_type= SPIDER_SQL_TYPE_SELECT_SQL; spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + spider_unlock_after_query(conn, 0); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } if (!error_num) { @@ -4546,72 +3518,26 @@ int ha_spider::multi_range_read_next_next( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } } if (!error_num) { connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - error_num = spider_db_store_result(this, roop_count, table); + error_num = spider_unlock_after_query_2(conn, this, roop_count, table); if ( error_num && - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -5039,23 +3965,8 @@ int ha_spider::multi_range_read_next_next( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, @@ -5071,26 +3982,9 @@ int ha_spider::multi_range_read_next_next( TRUE, FALSE, (roop_count != link_ok)))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } break; } @@ -5099,51 +3993,19 @@ int ha_spider::multi_range_read_next_next( conn= conns[roop_count]; sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL; spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mons[roop_count]); if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + spider_unlock_after_query(conn, 0); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } if ( @@ -5161,32 +4023,8 @@ int ha_spider::multi_range_read_next_next( -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } spider_db_discard_multiple_result(this, roop_count, conn); @@ -5199,72 +4037,26 @@ int ha_spider::multi_range_read_next_next( result_list.quick_mode, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); break; } connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(this, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) { if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] + error_num != HA_ERR_END_OF_FILE ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); } break; } result_link_idx = link_ok; } else { spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -5605,187 +4397,20 @@ int ha_spider::rnd_next_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { - SPIDER_CONN *conn = conns[roop_count]; - ulong sql_type; - sql_type= SPIDER_SQL_TYPE_SELECT_SQL; - spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = - dbton_hdl->set_sql_for_exec(sql_type, roop_count))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, - roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - sql_type, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); } } rnd_scan_and_first = FALSE; @@ -6202,184 +4827,20 @@ int ha_spider::ft_read_internal( } } - int roop_start, roop_end, roop_count, tmp_lock_mode, link_ok; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } + int roop_start, roop_end, roop_count, link_ok; + spider_prep_loop(this, &roop_start, &roop_end, &link_ok); for (roop_count = roop_start; roop_count < roop_end; roop_count = spider_conn_link_idx_next(share->link_statuses, conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - if (result_list.bgs_phase > 0) - { - if ((error_num = spider_check_and_init_casual_read( - wide_handler->trx->thd, this, - roop_count))) - DBUG_RETURN(error_num); - if ((error_num = spider_bg_conn_search(this, roop_count, roop_start, - TRUE, FALSE, (roop_count != link_ok)))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - } else { - uint dbton_id = share->sql_dbton_ids[roop_count]; - spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; - SPIDER_CONN *conn = conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if ((error_num = dbton_hdl->set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL, roop_count))) - { - DBUG_RETURN(error_num); - } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(this, conn, roop_count))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - spider_conn_set_timeout_from_share(conn, roop_count, - wide_handler->trx->thd, share); - if (dbton_hdl->execute_sql( - SPIDER_SQL_TYPE_SELECT_SQL, - conn, - result_list.quick_mode, - &need_mons[roop_count]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (roop_count == link_ok) - { - if ((error_num = spider_db_store_result(this, roop_count, table))) - { - if ( - error_num != HA_ERR_END_OF_FILE && - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode_eof(error_num)); - } - result_link_idx = link_ok; - } else { - spider_db_discard_result(this, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } + if (result_list.bgs_phase > 0) + { + if (spider_start_bg(this, roop_count, roop_start, link_ok, &error_num)) + DBUG_RETURN(error_num); + } else { + if (spider_send_query(this, table, roop_count, link_ok, &error_num)) + DBUG_RETURN(error_num); } } } @@ -6447,9 +4908,7 @@ int ha_spider::info( DBUG_ENTER("ha_spider::info"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider flag=%x", flag)); -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = FALSE; -#endif wide_handler->sql_command = thd_sql_command(thd); if (flag & HA_STATUS_AUTO) { @@ -6458,9 +4917,7 @@ int ha_spider::info( share->lgtm_tblhnd_share->auto_increment_value; else { stats.auto_increment_value = 1; -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = TRUE; -#endif } } if ( @@ -6584,27 +5041,7 @@ int ha_spider::info( flag | (share->sts_init ? 0 : HA_STATUS_AUTO))) ) { pthread_mutex_unlock(&share->sts_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->sts_init) { if ( @@ -6715,9 +5152,7 @@ int ha_spider::info( } if (flag & HA_STATUS_AUTO) { -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT auto_inc_temporary = FALSE; -#endif if (share->wide_share && table->next_number_field) { ulonglong first_value, nb_reserved_values; @@ -6859,27 +5294,7 @@ ha_rows ha_spider::records_in_range( share->crd_init ? 2 : 1))) { pthread_mutex_unlock(&share->crd_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->crd_init) { if ( @@ -7153,27 +5568,7 @@ int ha_spider::check_crd() share->crd_init ? 2 : 1))) { pthread_mutex_unlock(&share->crd_mutex); - if ( - share->monitoring_kind[search_link_idx] && - need_mons[search_link_idx] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - search_link_idx, - (uint32) share->monitoring_sid[search_link_idx], - share->table_name, - share->table_name_length, - conn_link_idx[search_link_idx], - NULL, - 0, - share->monitoring_kind[search_link_idx], - share->monitoring_limit[search_link_idx], - share->monitoring_flag[search_link_idx], - TRUE - ); - } + error_num= spider_maybe_ping_1(this, search_link_idx, error_num); if (!share->crd_init) { if ( @@ -7550,7 +5945,6 @@ bool ha_spider::need_info_for_auto_inc() )); } -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool ha_spider::can_use_for_auto_inc_init() { DBUG_ENTER("ha_spider::can_use_for_auto_inc_init"); @@ -7562,7 +5956,6 @@ bool ha_spider::can_use_for_auto_inc_init() !auto_inc_temporary )); } -#endif int ha_spider::update_auto_increment() { @@ -7890,19 +6283,11 @@ int ha_spider::end_bulk_update( DBUG_RETURN(0); } -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int ha_spider::bulk_update_row( const uchar *old_data, const uchar *new_data, ha_rows *dup_key_found ) -#else -int ha_spider::bulk_update_row( - const uchar *old_data, - uchar *new_data, - ha_rows *dup_key_found -) -#endif { DBUG_ENTER("ha_spider::bulk_update_row"); DBUG_PRINT("info",("spider this=%p", this)); @@ -7910,17 +6295,10 @@ int ha_spider::bulk_update_row( DBUG_RETURN(update_row(old_data, new_data)); } -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int ha_spider::update_row( const uchar *old_data, const uchar *new_data ) -#else -int ha_spider::update_row( - const uchar *old_data, - uchar *new_data -) -#endif { int error_num; THD *thd = ha_thd(); @@ -8629,6 +7007,8 @@ void ha_spider::update_create_info( DBUG_PRINT("info",("spider this=%p", this)); if (wide_handler && wide_handler->sql_command == SQLCOM_ALTER_TABLE) { + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &store_error_num))) + DBUG_VOID_RETURN; SPIDER_TRX *trx = wide_handler->trx; THD *thd = trx->thd; if (trx->query_id != thd->query_id) @@ -9737,7 +8117,7 @@ bool ha_spider::is_sole_projection_field( int ha_spider::drop_tmp_tables() { - int error_num = 0, tmp_error_num, need_mon; + int error_num = 0, need_mon; DBUG_ENTER("ha_spider::drop_tmp_tables"); DBUG_PRINT("info",("spider this=%p", this)); if (result_list.tmp_tables_created) @@ -9766,51 +8146,19 @@ int ha_spider::drop_tmp_tables() uint dbton_id = share->sql_dbton_ids[roop_count]; spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; SPIDER_CONN *conn = conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_TMP_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_set_names(this, conn, roop_count))) + spider_lock_before_query(conn, &need_mon); + /* todo: double check the logic here w.r.t. tmp_error_num vs error_num */ + if ((error_num = spider_db_set_names(this, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - tmp_error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - error_num = tmp_error_num; + spider_unlock_after_query(conn, 0); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } - if (!tmp_error_num) + if (!error_num) { spider_conn_set_timeout_from_share(conn, roop_count, wide_handler->trx->thd, share); @@ -9820,40 +8168,10 @@ int ha_spider::drop_tmp_tables() -1, &need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - tmp_error_num = spider_db_errorno(conn); - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - tmp_error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - error_num = tmp_error_num; + error_num= spider_unlock_after_query_1(conn); + error_num= spider_maybe_ping_1(this, roop_count, error_num); } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } spider_clear_bit(result_list.tmp_table_created, roop_count); @@ -11864,6 +10182,8 @@ int ha_spider::append_lock_tables_list() DBUG_PRINT("info",("spider lock_table_type=%u", wide_handler->lock_table_type)); + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) + DBUG_RETURN(error_num); if ((error_num= spider_check_trx_and_get_conn(wide_handler->trx->thd, this))) { DBUG_RETURN(error_num); @@ -11958,28 +10278,7 @@ int ha_spider::lock_tables() conns[roop_count], roop_count))) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } reset_first_link_idx(); } @@ -11989,29 +10288,8 @@ int ha_spider::lock_tables() conns[roop_count]->db_conn->have_lock_table_list() && (error_num = spider_db_lock_tables(this, roop_count)) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } conns[roop_count]->table_lock = 0; - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } if (conns[roop_count]->table_lock == 2) conns[roop_count]->table_lock = 1; @@ -12025,28 +10303,7 @@ int ha_spider::lock_tables() conns[roop_count]->disable_reconnect = FALSE; if ((error_num = spider_db_unlock_tables(this, roop_count))) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - wide_handler->trx, - wide_handler->trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } } } @@ -12096,28 +10353,7 @@ int ha_spider::dml_init() conns[roop_count], roop_count))) ) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - trx, - trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } reset_first_link_idx(); if ( @@ -12134,28 +10370,7 @@ int ha_spider::dml_init() if ((error_num = spider_check_and_set_trx_isolation( conns[roop_count], &need_mons[roop_count]))) { - if ( - share->monitoring_kind[roop_count] && - need_mons[roop_count] - ) { - error_num = spider_ping_table_mon_from_table( - trx, - trx->thd, - share, - roop_count, - (uint32) share->monitoring_sid[roop_count], - share->table_name, - share->table_name_length, - conn_link_idx[roop_count], - NULL, - 0, - share->monitoring_kind[roop_count], - share->monitoring_limit[roop_count], - share->monitoring_flag[roop_count], - TRUE - ); - } - DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num)); } } conns[roop_count]->semi_trx_isolation = -1; diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 93b6e2c204b..f467020b13f 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -121,9 +121,7 @@ public: bool pre_bitmap_checked; bool bulk_insert; bool info_auto_called; -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool auto_inc_temporary; -#endif int bulk_size= 0; int direct_dup_insert; int store_error_num; @@ -353,9 +351,7 @@ public: uint max_supported_key_part_length() const override; uint8 table_cache_type() override; bool need_info_for_auto_inc() override; -#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT bool can_use_for_auto_inc_init() override; -#endif int update_auto_increment(); void get_auto_increment( ulonglong offset, @@ -376,7 +372,6 @@ public: bool start_bulk_update() override; int exec_bulk_update(ha_rows *dup_key_found) override; int end_bulk_update() override; -#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA int bulk_update_row( const uchar *old_data, const uchar *new_data, @@ -386,17 +381,6 @@ public: const uchar *old_data, const uchar *new_data ) override; -#else - int bulk_update_row( - const uchar *old_data, - uchar *new_data, - ha_rows *dup_key_found - ); - int update_row( - const uchar *old_data, - uchar *new_data - ); -#endif bool check_direct_update_sql_part( st_select_lex *select_lex, longlong select_limit, diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result new file mode 100644 index 00000000000..5abf5438683 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result @@ -0,0 +1,26 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +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. +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. +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check error Partition p0 returned error +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check error Unknown - internal error 1227 during operation +drop table t1, t2; +drop server srv; +drop user spider@localhost; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result new file mode 100644 index 00000000000..13c132557b3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result @@ -0,0 +1,22 @@ +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'); +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",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. +INSERT INTO t2 SELECT * FROM t3; +ERROR 21S01: Column count doesn't match value count at row 1 +SELECT * FROM t3; +ERROR HY000: Unable to connect to foreign data source: localhost +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +DROP TABLE t1,t2,t3; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test new file mode 100644 index 00000000000..dd465b52db1 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test @@ -0,0 +1,24 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +CHECK TABLE t2; +drop table t1, t2; +drop server srv; +drop user spider@localhost; + +--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_34636.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test new file mode 100644 index 00000000000..08a699b9370 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test @@ -0,0 +1,29 @@ +--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'); + +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t2 SELECT * FROM t3; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +SELECT * FROM t3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +# Cleanup +DROP TABLE t1,t2,t3; + +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/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc index 6a6033a619d..ee008424ab5 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc @@ -43,9 +43,11 @@ INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7 --enable_ps_protocol --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -58,9 +60,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc index a599292bfb5..c45f47a4f12 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc @@ -56,9 +56,11 @@ INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7 --enable_ps_protocol --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -74,9 +76,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index ff289c220c1..dc73519dc37 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -271,7 +270,6 @@ int spider_free_conn_alloc( conn->db_conn = NULL; } spider_conn_done(conn); - DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name); pthread_mutex_destroy(&conn->mta_conn_mutex); conn->default_database.free(); DBUG_RETURN(0); @@ -1469,10 +1467,6 @@ void spider_conn_clear_queue( ) { DBUG_ENTER("spider_conn_clear_queue"); DBUG_PRINT("info", ("spider conn=%p", conn)); -/* - conn->queued_connect = FALSE; - conn->queued_ping = FALSE; -*/ conn->queued_trx_isolation = FALSE; conn->queued_semi_trx_isolation = FALSE; conn->queued_autocommit = FALSE; @@ -2536,7 +2530,6 @@ void *spider_bg_conn_action( ) { ulong sql_type; sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if (spider->use_fields) { if ((error_num = dbton_handler->set_sql_for_exec(sql_type, @@ -2555,17 +2548,12 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); + /* todo: is it ok if the following statement is not locked? */ sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); if (!result_list->bgs_error) { - conn->need_mon = &spider->need_mons[conn->link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); if (!(result_list->bgs_error = spider_db_set_names(spider, conn, conn->link_idx))) { @@ -2634,15 +2622,7 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } else { spider->connection_ids[conn->link_idx] = conn->connection_id; @@ -2717,26 +2697,14 @@ void *spider_bg_conn_action( { DBUG_PRINT("info",("spider bg exec sql start")); spider = (ha_spider*) conn->bg_target; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[conn->link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); *conn->bg_error_num = spider_db_query_with_set_names( conn->bg_sql_type, spider, conn, conn->link_idx ); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); conn->bg_exec_sql = FALSE; continue; } @@ -3285,32 +3253,6 @@ void *spider_bg_crd_action( share->conn_keys[spider.search_link_idx], trx, &spider, FALSE, FALSE, &error_num); conns[spider.search_link_idx]->error_mode = 0; -/* - if ( - error_num && - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } if (spider.search_link_idx != -1 && conns[spider.search_link_idx]) @@ -3321,31 +3263,6 @@ void *spider_bg_crd_action( share->bg_crd_sync, 2)) { -/* - if ( - share->monitoring_kind[spider.search_link_idx] && - need_mons[spider.search_link_idx] - ) { - lex_start(thd); - error_num = spider_ping_table_mon_from_table( - trx, - thd, - share, - spider.search_link_idx, - (uint32) share->monitoring_sid[spider.search_link_idx], - share->table_name, - share->table_name_length, - spider.conn_link_idx[spider.search_link_idx], - NULL, - 0, - share->monitoring_kind[spider.search_link_idx], - share->monitoring_limit[spider.search_link_idx], - share->monitoring_flag[spider.search_link_idx], - TRUE - ); - lex_end(thd->lex); - } -*/ spider.search_link_idx = -1; } } @@ -3650,17 +3567,11 @@ void *spider_bg_mon_action( share->monitoring_bg_interval[link_idx] * 1000); pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx], &share->bg_mon_mutexes[link_idx], &abstime); -/* - my_sleep((ulong) share->monitoring_bg_interval[link_idx]); -*/ } DBUG_PRINT("info",("spider bg mon roop start")); if (share->bg_mon_kill) { DBUG_PRINT("info",("spider bg mon kill start")); -/* - pthread_mutex_lock(&share->bg_mon_mutexes[link_idx]); -*/ pthread_cond_signal(&share->bg_mon_conds[link_idx]); pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]); spider_free_trx(trx, TRUE); @@ -4060,3 +3971,42 @@ void spider_free_ipport_conn(void *info) } DBUG_VOID_RETURN; } + +void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon) +{ + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); + conn->need_mon = need_mon; + DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = TRUE; + conn->mta_conn_mutex_unlock_later = TRUE; +} + +int spider_unlock_after_query(SPIDER_CONN *conn, int ret) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + pthread_mutex_unlock(&conn->mta_conn_mutex); + return ret; +} + +int spider_unlock_after_query_1(SPIDER_CONN *conn) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + return spider_db_errorno(conn); +} + +int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table) +{ + DBUG_ASSERT(conn->mta_conn_mutex_lock_already); + DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); + conn->mta_conn_mutex_lock_already = FALSE; + conn->mta_conn_mutex_unlock_later = FALSE; + return spider_db_store_result(spider, link_idx, table); +} diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index 4afa85a18b1..1152bd808f5 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -24,6 +24,8 @@ #define SPIDER_SIMPLE_RECORDS 3 #define SPIDER_SIMPLE_CHECKSUM_TABLE 4 +struct TABLE; + /* The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to check for self-reference. @@ -437,3 +439,11 @@ SPIDER_CONN* spider_get_conn_from_idle_connection int *error_num ); void spider_free_ipport_conn(void *info); + +void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon); + +int spider_unlock_after_query(SPIDER_CONN *conn, int ret); + +int spider_unlock_after_query_1(SPIDER_CONN *conn); + +int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table); diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 518a7c590de..de246b09784 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index b1ec856e3fb..21d44f7510b 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -101,8 +100,6 @@ int spider_db_connect( } } - if (thd) - { conn->connect_timeout = spider_param_connect_timeout(thd, share->connect_timeouts[link_idx]); conn->net_read_timeout = spider_param_net_read_timeout(thd, @@ -114,16 +111,6 @@ int spider_db_connect( connect_retry_count = 0; else connect_retry_count = spider_param_connect_retry_count(thd); - } else { - conn->connect_timeout = spider_param_connect_timeout(NULL, - share->connect_timeouts[link_idx]); - conn->net_read_timeout = spider_param_net_read_timeout(NULL, - share->net_read_timeouts[link_idx]); - conn->net_write_timeout = spider_param_net_write_timeout(NULL, - share->net_write_timeouts[link_idx]); - connect_retry_interval = spider_param_connect_retry_interval(NULL); - connect_retry_count = spider_param_connect_retry_count(NULL); - } DBUG_PRINT("info",("spider connect_timeout=%u", conn->connect_timeout)); DBUG_PRINT("info",("spider net_read_timeout=%u", conn->net_read_timeout)); DBUG_PRINT("info",("spider net_write_timeout=%u", conn->net_write_timeout)); @@ -179,7 +166,6 @@ int spider_db_ping_internal( int error_num; DBUG_ENTER("spider_db_ping_internal"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if (conn->server_lost || conn->queued_connect) { if ((error_num = spider_db_connect(share, conn, all_link_idx))) @@ -567,7 +553,6 @@ int spider_db_before_query( spider_bg_conn_break(conn, NULL); conn->in_before_query = TRUE; pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ((error_num = spider_db_conn_queue_action(conn))) { conn->in_before_query = FALSE; @@ -673,7 +658,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -695,7 +679,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -708,7 +691,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY); @@ -734,7 +716,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -756,7 +737,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -764,7 +744,6 @@ int spider_db_errorno( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(0); @@ -788,7 +767,6 @@ int spider_db_set_names_internal( ) { DBUG_ENTER("spider_db_set_names_internal"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); DBUG_ASSERT(conn->mta_conn_mutex_lock_already); DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); if ( @@ -929,20 +907,10 @@ int spider_db_query_for_bulk_update( SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_db_query_for_bulk_update"); - pthread_mutex_assert_owner(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[link_idx] && spider->need_mons[link_idx] @@ -976,11 +944,7 @@ int spider_db_query_for_bulk_update( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -1025,12 +989,7 @@ int spider_db_query_for_bulk_update( } if (error_num > 0 && !conn->db_conn->is_dup_entry_error(error_num)) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[link_idx] && spider->need_mons[link_idx] @@ -1054,13 +1013,7 @@ int spider_db_query_for_bulk_update( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_unlock_after_query(conn, 0)); } size_t spider_db_real_escape_string( @@ -3071,7 +3024,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); @@ -3088,7 +3040,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3118,7 +3069,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3161,7 +3111,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_OUT_OF_MEM); @@ -3202,7 +3151,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(error_num); @@ -3227,7 +3175,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -3235,7 +3182,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } current->record_num = current->result->num_rows(); @@ -3275,7 +3221,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } else { @@ -3300,7 +3245,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -3312,7 +3256,6 @@ int spider_db_store_result( if (!conn->mta_conn_mutex_unlock_later) { DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); } } @@ -4120,44 +4063,32 @@ int spider_db_seek_next( link_idx = link_idx_holder->link_idx; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, link_idx))) { DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (fields->is_first_link_ok_chain(link_idx_chain)) { if ((error_num = spider_db_store_result_for_reuse_cursor( spider, link_idx, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( spider->need_mons[link_idx] ) { @@ -4174,11 +4105,7 @@ int spider_db_seek_next( result_list->quick_mode, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( spider->need_mons[link_idx] ) { @@ -4188,14 +4115,9 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } spider->connection_ids[link_idx] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (fields->is_first_link_ok_chain(link_idx_chain)) { - if ((error_num = spider_db_store_result(spider, link_idx, - table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4210,8 +4132,7 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, link_idx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -4226,44 +4147,32 @@ int spider_db_seek_next( sql_type= SPIDER_SQL_TYPE_SELECT_SQL; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (roop_count == link_ok) { if ((error_num = spider_db_store_result_for_reuse_cursor( spider, link_idx, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4296,11 +4205,7 @@ int spider_db_seek_next( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4326,14 +4231,9 @@ int spider_db_seek_next( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, - table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4363,8 +4263,7 @@ int spider_db_seek_next( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -4476,43 +4375,31 @@ int spider_db_seek_last( sql_type= SPIDER_SQL_TYPE_SELECT_SQL; conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); if (conn->db_conn->limit_mode() == 1) { + pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); conn->db_conn->set_limit(result_list->limit_num); if (roop_count == link_ok) { if ((error_num = spider_db_store_result_for_reuse_cursor( spider, roop_count, table))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); DBUG_RETURN(error_num); } } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->bg_conn_mutex); } else { - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4545,11 +4432,7 @@ int spider_db_seek_last( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4574,13 +4457,9 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4609,8 +4488,7 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } @@ -4669,27 +4547,15 @@ int spider_db_seek_last( sql_type= SPIDER_SQL_TYPE_SELECT_SQL; conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4722,11 +4588,7 @@ int spider_db_seek_last( result_list->quick_mode, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -4751,13 +4613,9 @@ int spider_db_seek_last( DBUG_RETURN(error_num); } spider->connection_ids[roop_count] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (roop_count == link_ok) { - if ((error_num = spider_db_store_result(spider, roop_count, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, roop_count, table))) { if ( error_num != HA_ERR_END_OF_FILE && @@ -4786,8 +4644,7 @@ int spider_db_seek_last( spider->result_link_idx = link_ok; } else { spider_db_discard_result(spider, roop_count, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } DBUG_RETURN(spider_db_fetch(buf, spider, table)); @@ -5422,29 +5279,17 @@ int spider_db_bulk_insert( sql_type = SPIDER_SQL_TYPE_INSERT_SQL; conn = spider->conns[roop_count2]; dbton_handler = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count2))) { spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[roop_count2]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count2]); if ((error_num = spider_db_set_names(spider, conn, roop_count2))) { spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count2] && spider->need_mons[roop_count2] @@ -5480,12 +5325,7 @@ int spider_db_bulk_insert( { conn->db_conn->set_dup_key_idx(spider, roop_count2); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -5512,17 +5352,12 @@ int spider_db_bulk_insert( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (!insert_info && copy_info) { insert_info = conn->db_conn->inserted_info(dbton_handler, copy_info); } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (first_insert_link_idx == -1) { first_insert_link_idx = roop_count2; @@ -5531,14 +5366,7 @@ int spider_db_bulk_insert( } conn = first_insert_conn; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[first_insert_link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later= TRUE; + spider_lock_before_query(conn, &spider->need_mons[first_insert_link_idx]); spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); if (table->next_number_field && ( @@ -5557,13 +5385,7 @@ int spider_db_bulk_insert( else if ((error_num = dbton_handler-> show_last_insert_id(first_insert_link_idx, last_insert_id))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } table->next_number_field->set_notnull(); if ( @@ -5572,21 +5394,10 @@ int spider_db_bulk_insert( (error_num = table->next_number_field->store( last_insert_id, TRUE)) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); spider->store_last_insert_id = 0; } if ( @@ -5706,7 +5517,6 @@ int spider_db_bulk_update_size_limit( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, &dup_key_found))) { @@ -5790,7 +5600,6 @@ int spider_db_bulk_update_end( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -5829,7 +5638,6 @@ int spider_db_bulk_update_end( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -5902,27 +5710,15 @@ int spider_db_update( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; conn->ignore_dup_key = spider->wide_handler->ignore_dup_key; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_UPDATE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -5955,11 +5751,7 @@ int spider_db_update( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -5996,13 +5788,7 @@ int spider_db_update( if ((error_num = dbton_hdl->append_insert_for_recovery( SPIDER_SQL_TYPE_INSERT_SQL, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } spider_conn_set_timeout_from_share(conn, roop_count, spider->wide_handler->trx->thd, @@ -6013,11 +5799,7 @@ int spider_db_update( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6045,12 +5827,7 @@ int spider_db_update( DBUG_RETURN(error_num); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); result_list->update_sqls[roop_count].length(0); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -6137,26 +5914,14 @@ int spider_db_direct_update( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_UPDATE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6193,11 +5958,7 @@ int spider_db_direct_update( (error_num != HA_ERR_FOUND_DUPP_KEY || !spider->wide_handler->ignore_dup_key) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( error_num != ER_DUP_ENTRY && error_num != ER_DUP_KEY && @@ -6232,12 +5993,7 @@ int spider_db_direct_update( DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); counted = TRUE; } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); DBUG_RETURN(0); @@ -6291,35 +6047,18 @@ int spider_db_delete( ) { conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_query_with_set_names( SPIDER_SQL_TYPE_DELETE_SQL, spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); result_list->update_sqls[roop_count].length(0); } if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL))) @@ -6395,26 +6134,14 @@ int spider_db_direct_delete( conn = spider->conns[roop_count]; sql_type = SPIDER_SQL_TYPE_DELETE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6447,11 +6174,7 @@ int spider_db_direct_delete( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6475,18 +6198,13 @@ int spider_db_direct_delete( } DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (!counted) { *delete_rows = spider->conns[roop_count]->db_conn->affected_rows(); DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } int error_num2 = 0; { @@ -6519,19 +6237,12 @@ int spider_db_delete_all_rows( uint dbton_id = share->sql_dbton_ids[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id]; conn = spider->conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { DBUG_RETURN(error_num); } - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[roop_count]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[roop_count]); spider_conn_set_timeout_from_share(conn, roop_count, spider->wide_handler->trx->thd, share); @@ -6553,12 +6264,7 @@ int spider_db_delete_all_rows( /* retry */ if ((error_num = spider_db_ping(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6584,12 +6290,7 @@ int spider_db_delete_all_rows( } if ((error_num = spider_db_set_names(spider, conn, roop_count))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6622,11 +6323,7 @@ int spider_db_delete_all_rows( -1, &spider->need_mons[roop_count]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6651,12 +6348,7 @@ int spider_db_delete_all_rows( DBUG_RETURN(error_num); } } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if ( share->monitoring_kind[roop_count] && spider->need_mons[roop_count] @@ -6681,12 +6373,7 @@ int spider_db_delete_all_rows( DBUG_RETURN(error_num); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL))) DBUG_RETURN(error_num); @@ -8444,14 +8131,7 @@ int spider_db_udf_direct_sql( sql_command_backup = c_thd->lex->sql_command; c_thd->lex->sql_command = SQLCOM_INSERT; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ( !(error_num = spider_db_udf_direct_sql_set_names(direct_sql, trx, conn)) && !(error_num = spider_db_udf_direct_sql_select_db(direct_sql, conn)) @@ -8672,12 +8352,7 @@ int spider_db_udf_direct_sql( } while (status == 0); } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (need_trx_end && insert_start) { if (error_num) @@ -8710,7 +8385,6 @@ int spider_db_udf_direct_sql_select_db( if ( spider_dbton[conn->dbton_id].db_util->database_has_default_value() ) { - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ( !conn->default_database.length() || conn->default_database.length() != @@ -8753,7 +8427,6 @@ int spider_db_udf_direct_sql_set_names( int error_num, need_mon = 0; DBUG_ENTER("spider_db_udf_direct_sql_set_names"); pthread_mutex_assert_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name); if ( !conn->access_charset || trx->udf_access_charset->cset != conn->access_charset->cset @@ -8838,22 +8511,10 @@ int spider_db_udf_ping_table( spider.conn_link_idx = &tmp_conn_link_idx; spider.db_request_phase = &db_request_phase; spider.db_request_id = &db_request_id; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_ping(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); if (error_num == ER_CON_COUNT_ERROR) @@ -8865,12 +8526,7 @@ int spider_db_udf_ping_table( share->server_names[0]); DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (!ping_only) { int init_sql_alloc_size = @@ -8913,22 +8569,10 @@ int spider_db_udf_ping_table( my_afree(sql_buf); DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_set_names(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); DBUG_PRINT("info",("spider error_num=%d", error_num)); @@ -8943,24 +8587,15 @@ int spider_db_udf_ping_table( -1, &need_mon) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num = spider_unlock_after_query_1(conn); table_mon_list->last_mon_result = error_num; pthread_mutex_unlock(&table_mon_list->monitor_mutex); DBUG_PRINT("info",("spider error_num=%d", error_num)); my_afree(sql_buf); DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + spider_unlock_after_query(conn, 0); spider_db_discard_result(&spider, 0, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); } table_mon_list->last_mon_result = 0; @@ -9179,37 +8814,18 @@ int spider_db_udf_ping_table_mon_next( DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &need_mon); if ((error_num = spider_db_ping(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); my_afree(sql_buf); - DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); + DBUG_RETURN(spider_unlock_after_query(conn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE)); } if ((error_num = spider_db_set_names(&spider, conn, 0))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } spider_conn_set_timeout_from_share(conn, 0, thd, share); if (spider_db_query( @@ -9219,12 +8835,8 @@ int spider_db_udf_ping_table_mon_next( -1, &need_mon) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; my_afree(sql_buf); - DBUG_RETURN(spider_db_errorno(conn)); + DBUG_RETURN(spider_unlock_after_query_1(conn)); } st_spider_db_request_key request_key; request_key.spider_thread_id = trx.spider_thread_id; @@ -9234,32 +8846,22 @@ int spider_db_udf_ping_table_mon_next( request_key.next = NULL; if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); my_afree(sql_buf); - DBUG_RETURN(error_num); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } - else if ((error_num = spider_db_errorno(conn))) + else if ((error_num = spider_unlock_after_query_1(conn))) { my_afree(sql_buf); DBUG_RETURN(error_num); } + spider_unlock_after_query(conn, 0); my_error(HA_ERR_OUT_OF_MEM, MYF(0)); my_afree(sql_buf); DBUG_RETURN(HA_ERR_OUT_OF_MEM); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); my_afree(sql_buf); error_num = res->fetch_table_mon_status(mon_table_result->result_status); res->free_result(); @@ -9337,22 +8939,10 @@ int spider_db_udf_copy_tables( spider_conn_clear_queue_at_commit(tmp_conn); if (!tmp_conn->trx_start) { - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - tmp_conn->need_mon = &tmp_spider->need_mons[0]; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &tmp_spider->need_mons[0]); if (spider_db_ping(tmp_spider, tmp_conn, 0)) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; @@ -9363,20 +8953,10 @@ int spider_db_udf_copy_tables( (error_num = spider_db_start_transaction(tmp_conn, tmp_spider->need_mons)) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_start_transaction; } - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } } else { @@ -9396,22 +8976,10 @@ int spider_db_udf_copy_tables( { tmp_spider = &spider[roop_count]; tmp_conn = tmp_spider->conns[0]; - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - tmp_conn->need_mon = &tmp_spider->need_mons[0]; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &tmp_spider->need_mons[0]); if (spider_db_ping(tmp_spider, tmp_conn, 0)) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), tmp_spider->share->server_names[0]); error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; @@ -9424,23 +8992,13 @@ int spider_db_udf_copy_tables( (error_num = spider_db_lock_tables(tmp_spider, 0)) ) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); tmp_conn->table_lock = 0; if (error_num == HA_ERR_OUT_OF_MEM) my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); goto error_lock_tables; } - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); tmp_conn->table_lock = 1; } } @@ -9448,24 +9006,13 @@ int spider_db_udf_copy_tables( tmp_conn = src_tbl_conn->conn; spider_conn_set_timeout_from_share(tmp_conn, 0, copy_tables->trx->thd, src_tbl_conn->share); - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - tmp_conn->need_mon = &src_tbl_conn->need_mon; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &src_tbl_conn->need_mon); if (select_ct->exec_query( tmp_conn, -1, &src_tbl_conn->need_mon) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(tmp_conn); + error_num= spider_unlock_after_query_1(tmp_conn); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); @@ -9493,12 +9040,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } for (dst_tbl_conn = dst_tbl_conn->next; dst_tbl_conn; @@ -9512,12 +9054,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } } @@ -9542,12 +9079,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } if ( @@ -9561,13 +9093,7 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); - error_num = ER_OUT_OF_RESOURCES; + error_num= spider_unlock_after_query(tmp_conn, ER_OUT_OF_RESOURCES); goto error_db_query; } error_num = 0; @@ -9577,22 +9103,12 @@ int spider_db_udf_copy_tables( my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); goto error_db_query; } result->free_result(); delete result; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn; dst_tbl_conn = dst_tbl_conn->next) { @@ -9611,12 +9127,7 @@ int spider_db_udf_copy_tables( } if (error_num) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); @@ -9624,32 +9135,12 @@ int spider_db_udf_copy_tables( } error_num = HA_ERR_END_OF_FILE; end_of_file = TRUE; - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } if (!error_num && roop_count) { -/* - dst_tbl_conn = copy_tables->table_conn[1]; - spider_db_copy_table *source_ct = dst_tbl_conn->copy_table; - for (dst_tbl_conn = dst_tbl_conn->next; dst_tbl_conn; - dst_tbl_conn = dst_tbl_conn->next) - { - insert_ct = dst_tbl_conn->copy_table; - if (insert_ct->copy_insert_values(source_ct)) - { - my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); - error_num = ER_OUT_OF_RESOURCES; - goto error_db_query; - } - } -*/ if (copy_tables->bg_mode) { for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn; @@ -9668,14 +9159,7 @@ int spider_db_udf_copy_tables( { tmp_conn = dst_tbl_conn->conn; insert_ct = dst_tbl_conn->copy_table; - pthread_mutex_assert_not_owner(&tmp_conn->mta_conn_mutex); - pthread_mutex_lock(&tmp_conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - tmp_conn->need_mon = &dst_tbl_conn->need_mon; - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = TRUE; - tmp_conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(tmp_conn, &dst_tbl_conn->need_mon); spider_conn_set_timeout_from_share(tmp_conn, 0, copy_tables->trx->thd, dst_tbl_conn->share); if (insert_ct->exec_query( @@ -9683,22 +9167,13 @@ int spider_db_udf_copy_tables( -1, &dst_tbl_conn->need_mon) ) { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(tmp_conn); + error_num= spider_unlock_after_query_1(tmp_conn); if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM) my_message(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM, ER_SPIDER_REMOTE_SERVER_GONE_AWAY_STR, MYF(0)); goto error_db_query; } else { - DBUG_ASSERT(tmp_conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(tmp_conn->mta_conn_mutex_unlock_later); - tmp_conn->mta_conn_mutex_lock_already = FALSE; - tmp_conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&tmp_conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&tmp_conn->mta_conn_mutex); + spider_unlock_after_query(tmp_conn, 0); } } } diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc index 466e2eadf0c..0531f8a8ed9 100644 --- a/storage/spider/spd_db_include.cc +++ b/storage/spider/spd_db_include.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 59517190914..6726f55d1df 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -2007,9 +2006,7 @@ int spider_db_mbase::connect( connect_retry_count--; my_sleep((ulong) connect_retry_interval); } else { -#ifdef SPIDER_NET_HAS_THD db_conn->net.thd = NULL; -#endif if (connect_mutex) pthread_mutex_unlock(&spider_open_conn_mutex); break; @@ -2475,39 +2472,24 @@ int spider_db_mbase::select_db( DBUG_RETURN(mysql_select_db(db_conn, dbname)); } +static int spider_db_query_with_lock(SPIDER_CONN *conn, const char *query, + uint len, int *need_mon) +{ + int error_num= 0; + spider_lock_before_query(conn, need_mon); + if (spider_db_query(conn, query, len, -1, need_mon)) + error_num= spider_db_errorno(conn); + return spider_unlock_after_query(conn, error_num); +} + int spider_db_mbase::consistent_snapshot( int *need_mon ) { DBUG_ENTER("spider_db_mbase::consistent_snapshot"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_START_CONSISTENT_SNAPSHOT_STR, - SPIDER_SQL_START_CONSISTENT_SNAPSHOT_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_START_CONSISTENT_SNAPSHOT_STR, + SPIDER_SQL_START_CONSISTENT_SNAPSHOT_LEN, need_mon)); } bool spider_db_mbase::trx_start_in_bulk_sql() @@ -2542,82 +2524,38 @@ int spider_db_mbase::commit( ) { DBUG_ENTER("spider_db_mbase::commit"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_COMMIT_STR, - SPIDER_SQL_COMMIT_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, SPIDER_SQL_COMMIT_STR, + SPIDER_SQL_COMMIT_LEN, need_mon)); } int spider_db_mbase::rollback( int *need_mon ) { - bool is_error; - int error_num; + bool is_error, save_in_before_query; + int error_num= 0; DBUG_ENTER("spider_db_mbase::rollback"); DBUG_PRINT("info",("spider this=%p", this)); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ROLLBACK_STR, - SPIDER_SQL_ROLLBACK_LEN, - -1, - need_mon) - ) { - is_error = conn->thd->is_error(); - error_num = spider_db_errorno(conn); - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !is_error - ) + spider_lock_before_query(conn, need_mon); + save_in_before_query= conn->in_before_query; + /* + We do not execute the before queries to avoid unnecessary + failures in rollback + */ + conn->in_before_query= TRUE; + error_num= spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, + SPIDER_SQL_ROLLBACK_LEN, -1, need_mon); + conn->in_before_query= save_in_before_query; + if (error_num) + { + is_error= conn->thd->is_error(); + error_num= spider_db_errorno(conn); + if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && !is_error) + { conn->thd->clear_error(); - else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); + error_num= 0; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_db_mbase::xa_start( @@ -2650,34 +2588,8 @@ int spider_db_mbase::xa_end( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_END_STR, SPIDER_SQL_XA_END_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_prepare( @@ -2693,34 +2605,8 @@ int spider_db_mbase::xa_prepare( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_PREPARE_STR, SPIDER_SQL_XA_PREPARE_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_commit( @@ -2736,34 +2622,8 @@ int spider_db_mbase::xa_commit( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_COMMIT_STR, SPIDER_SQL_XA_COMMIT_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } int spider_db_mbase::xa_rollback( @@ -2779,34 +2639,8 @@ int spider_db_mbase::xa_rollback( sql_str.length(0); sql_str.q_append(SPIDER_SQL_XA_ROLLBACK_STR, SPIDER_SQL_XA_ROLLBACK_LEN); spider_db_append_xid_str(&sql_str, xid); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock(conn, sql_str.ptr(), + sql_str.length(), need_mon)); } bool spider_db_mbase::set_trx_isolation_in_bulk_sql() @@ -2825,121 +2659,21 @@ int spider_db_mbase::set_trx_isolation( switch (trx_isolation) { case ISO_READ_UNCOMMITTED: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_READ_UNCOMMITTED_STR, - SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_READ_UNCOMMITTED_STR, + SPIDER_SQL_ISO_READ_UNCOMMITTED_LEN, need_mon)); case ISO_READ_COMMITTED: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_READ_COMMITTED_STR, - SPIDER_SQL_ISO_READ_COMMITTED_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_READ_COMMITTED_STR, + SPIDER_SQL_ISO_READ_COMMITTED_LEN, need_mon)); case ISO_REPEATABLE_READ: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_REPEATABLE_READ_STR, - SPIDER_SQL_ISO_REPEATABLE_READ_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_REPEATABLE_READ_STR, + SPIDER_SQL_ISO_REPEATABLE_READ_LEN, need_mon)); case ISO_SERIALIZABLE: - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_ISO_SERIALIZABLE_STR, - SPIDER_SQL_ISO_SERIALIZABLE_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - break; + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_ISO_SERIALIZABLE_STR, + SPIDER_SQL_ISO_SERIALIZABLE_LEN, need_mon)); default: DBUG_RETURN(HA_ERR_UNSUPPORTED); } @@ -2960,64 +2694,12 @@ int spider_db_mbase::set_autocommit( DBUG_ENTER("spider_db_mbase::set_autocommit"); DBUG_PRINT("info",("spider this=%p", this)); if (autocommit) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_ON_STR, - SPIDER_SQL_AUTOCOMMIT_ON_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_AUTOCOMMIT_OFF_STR, - SPIDER_SQL_AUTOCOMMIT_OFF_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_AUTOCOMMIT_ON_STR, + SPIDER_SQL_AUTOCOMMIT_ON_LEN, need_mon)); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_AUTOCOMMIT_OFF_STR, + SPIDER_SQL_AUTOCOMMIT_OFF_LEN, need_mon)); } bool spider_db_mbase::set_sql_log_off_in_bulk_sql() @@ -3034,64 +2716,12 @@ int spider_db_mbase::set_sql_log_off( DBUG_ENTER("spider_db_mbase::set_sql_log_off"); DBUG_PRINT("info",("spider this=%p", this)); if (sql_log_off) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_SQL_LOG_ON_STR, - SPIDER_SQL_SQL_LOG_ON_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_SQL_LOG_OFF_STR, - SPIDER_SQL_SQL_LOG_OFF_LEN, - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_SQL_LOG_ON_STR, + SPIDER_SQL_SQL_LOG_ON_LEN, need_mon)); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_SQL_LOG_OFF_STR, + SPIDER_SQL_SQL_LOG_OFF_LEN, need_mon)); } bool spider_db_mbase::set_wait_timeout_in_bulk_sql() @@ -3119,34 +2749,8 @@ int spider_db_mbase::set_wait_timeout( DBUG_RETURN(HA_ERR_OUT_OF_MEM); sql_str.q_append(SPIDER_SQL_WAIT_TIMEOUT_STR, SPIDER_SQL_WAIT_TIMEOUT_LEN); sql_str.q_append(timeout_str, timeout_str_length); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } bool spider_db_mbase::set_sql_mode_in_bulk_sql() @@ -3184,34 +2788,8 @@ int spider_db_mbase::set_sql_mode( } } sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } bool spider_db_mbase::set_time_zone_in_bulk_sql() @@ -3238,34 +2816,8 @@ int spider_db_mbase::set_time_zone( sql_str.q_append(SPIDER_SQL_TIME_ZONE_STR, SPIDER_SQL_TIME_ZONE_LEN); sql_str.q_append(tz_str->ptr(), tz_str->length()); sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - need_mon) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, sql_str.ptr(), sql_str.length(), need_mon)); } int spider_db_mbase::exec_simple_sql_with_result( @@ -3277,18 +2829,10 @@ int spider_db_mbase::exec_simple_sql_with_result( int *need_mon, SPIDER_DB_RESULT **res ) { - int error_num; + int error_num= 0; DBUG_ENTER("spider_db_mbase::exec_simple_sql_with_result"); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, - share); + spider_lock_before_query(conn, need_mon); + spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, share); if ( (error_num = spider_db_set_names_internal(trx, share, conn, all_link_idx, need_mon)) || @@ -3302,92 +2846,39 @@ int spider_db_mbase::exec_simple_sql_with_result( (error_num = spider_db_errorno(conn)) ) ) { - if ( - error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && - !conn->disable_reconnect - ) { - /* retry */ - if ((error_num = spider_db_ping_internal(share, conn, - all_link_idx, need_mon))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } - if ((error_num = spider_db_set_names_internal(trx, share, conn, - all_link_idx, need_mon))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, - share); - if (spider_db_query( - conn, - sql, - sql_length, - -1, - need_mon) + if ( + error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && + !conn->disable_reconnect ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); - } - } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); + if ((error_num = spider_db_ping_internal(share, conn, + all_link_idx, need_mon))) + goto unlock; + if ((error_num= spider_db_set_names_internal(trx, share, conn, + all_link_idx, need_mon))) + goto unlock; + spider_conn_set_timeout_from_share(conn, all_link_idx, trx->thd, + share); + if (spider_db_query( + conn, + sql, + sql_length, + -1, + need_mon) + ) { + error_num= spider_db_errorno(conn); + goto unlock; + } + } else + goto unlock; } - } - if (!(*res = store_result(NULL, NULL, &error_num))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - if (error_num) + if (!(*res = store_result(NULL, NULL, &error_num))) { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); + if (error_num || (error_num= spider_db_errorno(conn)) || + (error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE)) + goto unlock; } - else if ((error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_db_mbase::show_master_status( @@ -3440,10 +2931,6 @@ int spider_db_mbase::show_master_status( spider_store_binlog_pos_gtid(table, NULL, 0, conn->access_charset); } } -/* - res->free_result(); - delete res; -*/ if (error_num) { DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); @@ -3509,10 +2996,6 @@ int spider_db_mbase::select_binlog_gtid_pos( { spider_store_binlog_pos_gtid(table, gtid_pos, strlen(gtid_pos), conn->access_charset); } -/* - res->free_result(); - delete res; -*/ if (error_num) { DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); @@ -4021,70 +3504,15 @@ int spider_db_mysql_util::append_column_value( ptr = tmp_str.get_str(); } else if (field->type() == MYSQL_TYPE_GEOMETRY) { -/* - uint mlength = SIZEOF_STORED_DOUBLE, lcnt; - uchar *dest = (uchar *) buf; - const uchar *source; - for (lcnt = 0; lcnt < 4; lcnt++) - { - mlength = SIZEOF_STORED_DOUBLE; - source = new_ptr + mlength + SIZEOF_STORED_DOUBLE * lcnt; - while (mlength--) - *dest++ = *--source; - } - tmp_str.length(SIZEOF_STORED_DOUBLE * lcnt); -*/ #ifdef DBUG_TRACE double xmin, xmax, ymin, ymax; -/* - float8store(buf,xmin); - float8store(buf+8,xmax); - float8store(buf+16,ymin); - float8store(buf+24,ymax); - memcpy(&xmin,new_ptr,sizeof(xmin)); - memcpy(&xmax,new_ptr + 8,sizeof(xmax)); - memcpy(&ymin,new_ptr + 16,sizeof(ymin)); - memcpy(&ymax,new_ptr + 24,sizeof(ymax)); - float8get(xmin, buf); - float8get(xmax, buf + 8); - float8get(ymin, buf + 16); - float8get(ymax, buf + 24); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - DBUG_PRINT("info", ("spider geo is %.14g %.14g %.14g %.14g", - xmin, xmax, ymin, ymax)); -*/ float8get(xmin, new_ptr); float8get(xmax, new_ptr + 8); float8get(ymin, new_ptr + 16); float8get(ymax, new_ptr + 24); DBUG_PRINT("info", ("spider geo is %f %f %f %f", xmin, xmax, ymin, ymax)); -/* - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 4); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 5); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 6); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 7); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 8); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 9); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 10); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 11); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); - float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 12); - float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 13); - float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 14); - float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 15); - DBUG_PRINT("info", ("spider geo is %f %f %f %f", - xmin, xmax, ymin, ymax)); -*/ #endif -/* - tmp_str.set((char *) new_ptr, SIZEOF_STORED_DOUBLE * 4, - &my_charset_bin); -*/ tmp_str.length(0); tmp_str.q_append((char *) SPIDER_SQL_LINESTRING_HEAD_STR, SPIDER_SQL_LINESTRING_HEAD_LEN); @@ -4113,27 +3541,6 @@ int spider_db_mysql_util::append_column_value( DBUG_PRINT("info", ("spider field->type() is %d", field->type())); DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length())); -/* - if ( - field->type() == MYSQL_TYPE_BIT || - (field->type() >= MYSQL_TYPE_TINY_BLOB && - field->type() <= MYSQL_TYPE_BLOB) - ) { - uchar *hex_ptr = (uchar *) ptr->ptr(), *end_ptr; - char *str_ptr; - DBUG_PRINT("info", ("spider HEX")); - if (str->reserve(SPIDER_SQL_HEX_LEN + ptr->length() * 2)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - str->q_append(SPIDER_SQL_HEX_STR, SPIDER_SQL_HEX_LEN); - str_ptr = (char *) str->ptr() + str->length(); - for (end_ptr = hex_ptr + ptr->length(); hex_ptr < end_ptr; hex_ptr++) - { - *str_ptr++ = spider_dig_upper[(*hex_ptr) >> 4]; - *str_ptr++ = spider_dig_upper[(*hex_ptr) & 0x0F]; - } - str->length(str->length() + ptr->length() * 2); - } else -*/ if (field->result_type() == STRING_RESULT) { DBUG_PRINT("info", ("spider STRING_RESULT")); @@ -7981,111 +7388,65 @@ int spider_mbase_share::discover_table_structure( sql_str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN); SPIDER_CONN *conn; - int need_mon; + int need_mon_deref; + int *need_mon= &need_mon_deref; if (!(conn= spider_get_conn(spider_share, 0, spider_share->conn_keys[roop_count], trx, NULL, FALSE, FALSE, &error_num))) { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, need_mon); if (!conn->disable_reconnect) { ha_spider tmp_spider; SPIDER_WIDE_HANDLER wide_handler; - int need_mon = 0; - uint tmp_conn_link_idx = 0; - tmp_spider.wide_handler = &wide_handler; - wide_handler.trx = trx; - tmp_spider.share = spider_share; - tmp_spider.need_mons = &need_mon; - tmp_spider.conn_link_idx = &tmp_conn_link_idx; - if ((error_num = spider_db_ping(&tmp_spider, conn, 0))) + int need_mon= 0; + uint tmp_conn_link_idx= 0; + tmp_spider.wide_handler= &wide_handler; + wide_handler.trx= trx; + tmp_spider.share= spider_share; + tmp_spider.need_mons= &need_mon; + tmp_spider.conn_link_idx= &tmp_conn_link_idx; + if ((error_num= spider_db_ping(&tmp_spider, conn, 0))) { - DBUG_PRINT("info",("spider spider_db_ping error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } } spider_conn_set_timeout_from_share(conn, roop_count, trx->thd, - spider_share); - if ( - (error_num = spider_db_set_names_internal(trx, spider_share, conn, - roop_count, &need_mon)) || - ( - spider_db_query( - conn, - sql_str.ptr(), - sql_str.length(), - -1, - &need_mon) && - (error_num = spider_db_errorno(conn)) - ) - ) { - DBUG_PRINT("info",("spider spider_get_trx error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_share); + if ((error_num= spider_db_set_names_internal(trx, spider_share, conn, + roop_count, need_mon)) || + (spider_db_query(conn, sql_str.ptr(), sql_str.length(), -1, + need_mon) && + (error_num= spider_db_errorno(conn)))) + { + spider_unlock_after_query(conn, 0); continue; } st_spider_db_request_key request_key; - request_key.spider_thread_id = trx->spider_thread_id; - request_key.query_id = trx->thd->query_id; - request_key.handler = NULL; - request_key.request_id = 1; - request_key.next = NULL; - spider_db_result *res; + request_key.spider_thread_id= trx->spider_thread_id; + request_key.query_id= trx->thd->query_id; request_key.handler= NULL; + request_key.request_id= 1; request_key.next= NULL; + spider_db_result * res; /* get column list */ - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) + if (!(res= conn->db_conn->store_result(NULL, &request_key, + &error_num))) { + if (error_num || (error_num= spider_db_errorno(conn))) { - DBUG_PRINT("info",("spider column store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - /* no record */ - DBUG_PRINT("info",("spider column no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - if ((error_num = res->fetch_columns_for_discover_table_structure(str, - spider_share->access_charset))) - { - DBUG_PRINT("info",("spider column fetch error")); + if ((error_num= + res->fetch_columns_for_discover_table_structure( + str, spider_share->access_charset))) { + DBUG_PRINT("info", ("spider column fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); /* Use ErrConvString as db_names_str and table_names_str are not necessarily 0-terminated. @@ -8099,70 +7460,41 @@ int spider_mbase_share::discover_table_structure( table_names_str[roop_count].length(), Lex_ident_table::charset_info()).ptr()); error_num = ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM; + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; if (conn->db_conn->next_result()) { - DBUG_PRINT("info",("spider single result error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } /* get index list */ - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) - { - if (error_num || (error_num = spider_db_errorno(conn))) + if (!(res= conn->db_conn->store_result(NULL, &request_key, + &error_num))) { + if (error_num || (error_num= spider_db_errorno(conn))) { - DBUG_PRINT("info",("spider index store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - /* no record */ - DBUG_PRINT("info",("spider index no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } - if ((error_num = res->fetch_index_for_discover_table_structure(str, - spider_share->access_charset))) - { - DBUG_PRINT("info",("spider index fetch error")); + if ((error_num= + res->fetch_index_for_discover_table_structure( + str, spider_share->access_charset))) { + DBUG_PRINT("info", ("spider index fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; - if (conn->db_conn->next_result()) - { - DBUG_PRINT("info",("spider dual result error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + if (conn->db_conn->next_result()) { + DBUG_PRINT("info", ("spider dual result error")); + spider_unlock_after_query(conn, 0); continue; } /* get table info */ @@ -8171,48 +7503,30 @@ int spider_mbase_share::discover_table_structure( if (error_num || (error_num = spider_db_errorno(conn))) { DBUG_PRINT("info",("spider table store error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } /* no record */ DBUG_PRINT("info",("spider table no record error")); - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } if ((error_num = res->fetch_table_for_discover_table_structure(str, - spider_share, spider_share->access_charset))) + spider_share, spider_share->access_charset))) { DBUG_PRINT("info",("spider table fetch error")); res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); continue; } res->free_result(); delete res; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); if (!error_num) + { + spider_unlock_after_query(conn, 0); break; + } } DBUG_RETURN(error_num); } @@ -13201,35 +12515,6 @@ int spider_db_mbase::reset_lock_wait_timeout() DBUG_RETURN(0); } -/** FIXME: refactor more functions to use spider_setup_for_query() and -spider_teardown_after_query(). */ -void spider_setup_for_query(ha_spider *spider, SPIDER_CONN *conn, int link_idx) -{ - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon= &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already= TRUE; - conn->mta_conn_mutex_unlock_later= TRUE; - conn->disable_connect_retry= TRUE; -} - -int spider_teardown_after_query(SPIDER_CONN *conn, int error_num, bool clear) -{ - conn->disable_connect_retry= FALSE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already= FALSE; - conn->mta_conn_mutex_unlock_later= FALSE; - if (clear) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - return error_num; -} /** Executes show table status query and stores results in share->stat */ @@ -13248,7 +12533,8 @@ int spider_mbase_handler::show_table_status( DBUG_ENTER("spider_mbase_handler::show_table_status"); DBUG_PRINT("info",("spider sts_mode=%d", sts_mode)); - spider_setup_for_query(spider, conn, link_idx); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); + conn->disable_connect_retry = TRUE; spider_conn_set_timeout_from_share( conn, link_idx, spider->wide_handler->trx->thd, share); @@ -13269,15 +12555,15 @@ int spider_mbase_handler::show_table_status( { /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; if ((error_num = spider_db_set_names(spider, conn, link_idx))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); if ((error_num = spider_set_lock_wait_timeout(1, conn, &spider->need_mons[link_idx]))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; if (spider_db_query( conn, mysql_share->show_table_status[pos].ptr(), @@ -13285,45 +12571,39 @@ int spider_mbase_handler::show_table_status( -1, &spider->need_mons[link_idx]) ) { - spider_teardown_after_query(conn, 0, false); - DBUG_RETURN(spider_db_errorno(conn)); + goto unlock; } } else - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; } - st_spider_db_request_key request_key = { - spider->wide_handler->trx->spider_thread_id, - spider->wide_handler->trx->thd->query_id, spider, 1, NULL}; + error_num= 0; + st_spider_db_request_key request_key; + request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; + request_key.query_id = spider->wide_handler->trx->thd->query_id; + request_key.handler = spider; + request_key.request_id = 1; + request_key.next = NULL; if (spider_param_dry_access()) - DBUG_RETURN(spider_teardown_after_query(conn, 0, true)); + goto unlock; if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - if (sts_mode == 1) /* get from status table */ + if (error_num || (error_num = spider_db_errorno(conn))) + goto unlock; + else if (sts_mode == 1) { - if (error_num) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); - spider_teardown_after_query(conn, 0, false); - if ((error_num = spider_db_errorno(conn))) - DBUG_RETURN(error_num); - else - { - my_printf_error( - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); - DBUG_RETURN(ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM); - } + my_printf_error( + ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, + ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), + mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); + error_num= ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM; + goto unlock; } else /* get from information schema */ { - spider_teardown_after_query(conn, error_num, false); - if (error_num || (error_num= spider_db_errorno(conn))) - DBUG_RETURN(error_num); - else - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE; + goto unlock; } } - spider_teardown_after_query(conn, 0, true); /* Fetches query results into share->stat. */ error_num = res->fetch_table_status(sts_mode, share->stat); auto_increment_value = share->stat.auto_increment_value; @@ -13350,7 +12630,7 @@ int spider_mbase_handler::show_table_status( default: break; } - DBUG_RETURN(error_num); + goto unlock; } if ((error_num = ((spider_db_mbase *) conn->db_conn)->fetch_and_print_warnings(NULL))) { @@ -13364,11 +12644,11 @@ int spider_mbase_handler::show_table_status( mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); } - DBUG_RETURN(error_num); + goto unlock; } if ((error_num = ((spider_db_mbase *) conn->db_conn)->reset_lock_wait_timeout())) - DBUG_RETURN(error_num); + goto unlock; if (share->static_records_for_status != -1) share->stat.records = (ha_rows) share->static_records_for_status; if (share->static_mean_rec_length != -1) @@ -13377,9 +12657,11 @@ int spider_mbase_handler::show_table_status( { share->lgtm_tblhnd_share->auto_increment_value = auto_increment_value; DBUG_PRINT("info",("spider auto_increment_value=%llu", - share->lgtm_tblhnd_share->auto_increment_value)); + share->lgtm_tblhnd_share->auto_increment_value)); } - DBUG_RETURN(0); +unlock: + conn->disable_connect_retry = FALSE; + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::crd_mode_exchange( @@ -13405,7 +12687,7 @@ int spider_mbase_handler::show_index( (crd_mode == 1 ? 0 : 1); DBUG_ENTER("spider_mbase_handler::show_index"); DBUG_PRINT("info",("spider crd_mode=%d", crd_mode)); - spider_setup_for_query(spider, conn, link_idx); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); if ((error_num = spider_db_set_names(spider, conn, link_idx)) || @@ -13417,22 +12699,22 @@ int spider_mbase_handler::show_index( mysql_share->show_index[pos].length(), -1, &spider->need_mons[link_idx]) && - (error_num = spider_db_errorno(conn)))) + (error_num = spider_db_errorno(conn)))) { if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM && !conn->disable_reconnect) { /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; if ((error_num = spider_db_set_names(spider, conn, link_idx))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); if ((error_num = spider_set_lock_wait_timeout(1, conn, &spider->need_mons[link_idx]))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; if (spider_db_query( conn, mysql_share->show_index[pos].ptr(), @@ -13440,20 +12722,25 @@ int spider_mbase_handler::show_index( -1, &spider->need_mons[link_idx])) { - spider_teardown_after_query(conn, 0, false); - DBUG_RETURN(spider_db_errorno(conn)); + error_num= spider_db_errorno(conn); + goto unlock; } } else - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); + goto unlock; + } + error_num= 0; + st_spider_db_request_key request_key; + request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; + request_key.query_id = spider->wide_handler->trx->thd->query_id; + request_key.handler = spider; + request_key.request_id = 1; + request_key.next = NULL; + if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) + { + if (error_num || (error_num = spider_db_errorno(conn))) + goto unlock; + /* no record is ok */ } - st_spider_db_request_key request_key = { - spider->wide_handler->trx->spider_thread_id, - spider->wide_handler->trx->thd->query_id, spider, 1, NULL}; - /* no record is ok */ - if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)) && - (error_num || (error_num = spider_db_errorno(conn)))) - DBUG_RETURN(spider_teardown_after_query(conn, error_num, true)); - spider_teardown_after_query(conn, 0, true); if (res) error_num = res->fetch_table_cardinality( crd_mode, table, share->cardinality, share->cardinality_upd, @@ -13474,30 +12761,35 @@ int spider_mbase_handler::show_index( res->free_result(); delete res; } - switch (error_num) + if (error_num) { - case ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM: - my_printf_error( - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, - ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); - break; - case ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM: - my_printf_error( - ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM, - ER_SPIDER_INVALID_REMOTE_TABLE_INFO_STR, MYF(0), - mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), - mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); - break; - default: - break; + switch (error_num) + { + case ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM: + my_printf_error( + ER_SPIDER_REMOTE_TABLE_NOT_FOUND_NUM, + ER_SPIDER_REMOTE_TABLE_NOT_FOUND_STR, MYF(0), + mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); + break; + case ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM: + my_printf_error( + ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM, + ER_SPIDER_INVALID_REMOTE_TABLE_INFO_STR, MYF(0), + mysql_share->db_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe(), + mysql_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr_safe()); + break; + default: + break; + } + goto unlock; } if (!error_num) error_num = ((spider_db_mbase *) conn->db_conn)->reset_lock_wait_timeout(); else ((spider_db_mbase *) conn->db_conn)->reset_lock_wait_timeout(); - DBUG_RETURN(error_num); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::simple_action( @@ -13549,15 +12841,8 @@ int spider_mbase_handler::simple_action( default: DBUG_ASSERT(0); DBUG_RETURN(0); - } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + } + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -13579,27 +12864,9 @@ int spider_mbase_handler::simple_action( ) { /* retry */ if ((error_num = spider_db_ping(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 1", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 2", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -13610,24 +12877,14 @@ int spider_mbase_handler::simple_action( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_PRINT("info", ("spider error_num=%d 3", error_num)); - DBUG_RETURN(spider_db_errorno(conn)); + error_num= spider_db_errorno(conn); + goto unlock; } } else { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 4", error_num)); - DBUG_RETURN(error_num); + goto unlock; } } + error_num= 0; st_spider_db_request_key request_key; request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id; request_key.query_id = spider->wide_handler->trx->thd->query_id; @@ -13636,33 +12893,15 @@ int spider_mbase_handler::simple_action( request_key.next = NULL; if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (error_num) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_PRINT("info", ("spider error_num=%d 5", error_num)); - DBUG_RETURN(error_num); - } + goto unlock; else if ((error_num = spider_db_errorno(conn))) - { - DBUG_PRINT("info", ("spider error_num=%d 6", error_num)); - DBUG_RETURN(error_num); - } else { - DBUG_PRINT("info", ("spider error_num=%d 7", - ER_QUERY_ON_FOREIGN_DATA_SOURCE)); - DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE); + goto unlock; + else { + error_num= ER_QUERY_ON_FOREIGN_DATA_SOURCE; + goto unlock; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); switch (simple_action) { case SPIDER_SIMPLE_RECORDS: @@ -13679,12 +12918,8 @@ int spider_mbase_handler::simple_action( } res->free_result(); delete res; - if (error_num) - { - DBUG_PRINT("info", ("spider error_num=%d 7", error_num)); - DBUG_RETURN(error_num); - } - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::show_records( @@ -13739,14 +12974,7 @@ ha_rows spider_mbase_handler::explain_select( DBUG_RETURN(HA_POS_ERROR); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); @@ -13771,25 +12999,15 @@ ha_rows spider_mbase_handler::explain_select( { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } if ((error_num = spider_db_set_names(spider, conn, link_idx))) { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, @@ -13804,24 +13022,14 @@ ha_rows spider_mbase_handler::explain_select( error_num = spider_db_errorno(conn); if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } else { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } st_spider_db_request_key request_key; @@ -13836,30 +13044,13 @@ ha_rows spider_mbase_handler::explain_select( { if (spider->check_error_mode(error_num)) my_errno = error_num; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } else { - my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; + goto unlock; } } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); error_num = res->fetch_table_records( 2, rows @@ -13869,8 +13060,10 @@ ha_rows spider_mbase_handler::explain_select( if (error_num) { my_errno = error_num; - DBUG_RETURN(HA_POS_ERROR); + rows= HA_POS_ERROR; } +unlock: + spider_unlock_after_query(conn, 0); DBUG_RETURN(rows); } @@ -13888,24 +13081,9 @@ int spider_mbase_handler::lock_tables( } if (str->length()) { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); @@ -13915,19 +13093,9 @@ int spider_mbase_handler::lock_tables( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + ) + DBUG_RETURN(spider_unlock_after_query_1(conn)); + spider_unlock_after_query(conn, 0); } if (!conn->table_locked) { @@ -13959,33 +13127,9 @@ int spider_mbase_handler::unlock_tables( spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, spider->share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - DBUG_RETURN(spider_db_errorno(conn)); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + DBUG_RETURN(spider_db_query_with_lock( + conn, str->ptr(), str->length(), + &spider->need_mons[link_idx])); } } DBUG_RETURN(0); @@ -14005,24 +13149,9 @@ int spider_mbase_handler::disable_keys( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14032,21 +13161,10 @@ int spider_mbase_handler::disable_keys( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + ) error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::enable_keys( @@ -14063,24 +13181,9 @@ int spider_mbase_handler::enable_keys( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14090,21 +13193,10 @@ int spider_mbase_handler::enable_keys( str->length(), -1, &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; + ) error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::check_table( @@ -14122,24 +13214,9 @@ int spider_mbase_handler::check_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14150,20 +13227,10 @@ int spider_mbase_handler::check_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::repair_table( @@ -14181,24 +13248,9 @@ int spider_mbase_handler::repair_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14209,20 +13261,10 @@ int spider_mbase_handler::repair_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::analyze_table( @@ -14239,48 +13281,18 @@ int spider_mbase_handler::analyze_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } - spider_conn_set_timeout_from_share(conn, link_idx, - spider->wide_handler->trx->thd, - share); - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + spider_lock_before_query(conn, &spider->need_mons[link_idx]); + error_num = spider_db_set_names(spider, conn, link_idx); + if (!error_num) + { + spider_conn_set_timeout_from_share(conn, link_idx, + spider->wide_handler->trx->thd, + share); + if (spider_db_query(conn, str->ptr(), str->length(), -1, + &spider->need_mons[link_idx])) + error_num = spider_db_errorno(conn); + } + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::optimize_table( @@ -14297,24 +13309,9 @@ int spider_mbase_handler::optimize_table( { DBUG_RETURN(error_num); } - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) - { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(error_num); - } + goto unlock; spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); @@ -14325,20 +13322,10 @@ int spider_mbase_handler::optimize_table( -1, &spider->need_mons[link_idx]) ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); +unlock: + DBUG_RETURN(spider_unlock_after_query(conn, error_num)); } int spider_mbase_handler::flush_tables( @@ -14359,77 +13346,23 @@ int spider_mbase_handler::flush_tables( spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - str->ptr(), - str->length(), - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, str->ptr(), str->length(), &spider->need_mons[link_idx])); } int spider_mbase_handler::flush_logs( SPIDER_CONN *conn, int link_idx ) { - int error_num; SPIDER_SHARE *share = spider->share; DBUG_ENTER("spider_mbase_handler::flush_logs"); DBUG_PRINT("info",("spider this=%p", this)); spider_conn_set_timeout_from_share(conn, link_idx, spider->wide_handler->trx->thd, share); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (spider_db_query( - conn, - SPIDER_SQL_FLUSH_LOGS_STR, - SPIDER_SQL_FLUSH_LOGS_LEN, - -1, - &spider->need_mons[link_idx]) - ) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); - DBUG_RETURN(error_num); - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - DBUG_RETURN(0); + DBUG_RETURN(spider_db_query_with_lock( + conn, SPIDER_SQL_FLUSH_LOGS_STR, + SPIDER_SQL_FLUSH_LOGS_LEN, &spider->need_mons[link_idx])); } int spider_mbase_handler::sync_from_clone_source( diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index ba7ef98dc41..352cba6f536 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -490,7 +489,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( DBUG_RETURN(conn); error: - DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name); error_too_many_ipport_count: spider_conn_done(conn); error_conn_init: diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h deleted file mode 100644 index ccdc7009f9a..00000000000 --- a/storage/spider/spd_environ.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2008-2020 Kentoku Shiba - Copyright (C) 2017-2020 MariaDB corp - - 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */ - -/* - Define functionality offered by MySQL or MariaDB -*/ - -#ifndef SPD_ENVIRON_INCLUDED - -#define SPIDER_NET_HAS_THD -#define HANDLER_HAS_TOP_TABLE_FIELDS -#define PARTITION_HAS_GET_PART_SPEC -#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN -#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT -#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA -#endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 6236a7b974a..2a38c03cca8 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" @@ -1181,27 +1180,15 @@ static int spider_send_query( } } else { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain))) DBUG_RETURN(error_num); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &spider->need_mons[link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &spider->need_mons[link_idx]); if ((error_num = spider_db_set_names(spider, conn, link_idx))) if ((error_num = spider_db_set_names(spider, conn, link_idx))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); if ((error_num = spider->check_error_mode_eof(error_num)) == @@ -1219,11 +1206,7 @@ static int spider_send_query( spider->result_list.quick_mode, &spider->need_mons[link_idx])) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - error_num = spider_db_errorno(conn); + error_num= spider_unlock_after_query_1(conn); if (spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); if ((error_num = spider->check_error_mode_eof(error_num)) == @@ -1235,13 +1218,9 @@ static int spider_send_query( DBUG_RETURN(error_num); } spider->connection_ids[link_idx] = conn->connection_id; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; if (fields->is_first_link_ok_chain(link_idx_chain)) { - if ((error_num = spider_db_store_result(spider, link_idx, table))) + if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table))) { if (error_num != HA_ERR_END_OF_FILE && spider->need_mons[link_idx]) error_num = fields->ping_table_mon_from_table(link_idx_chain); @@ -1258,8 +1237,7 @@ static int spider_send_query( } else { spider_db_discard_result(spider, link_idx, conn); - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); } } } diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc index 8ae88102e81..4aaa017cb02 100644 --- a/storage/spider/spd_i_s.cc +++ b/storage/spider/spd_i_s.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 3a6a714cca9..c9b00d33da0 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -87,8 +87,6 @@ #define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON -#define SPIDER_Item_args_arg_count_IS_PROTECTED - #define SPIDER_Item_func_conv_charset_conv_charset collation.collation #define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT @@ -454,11 +452,6 @@ enum spider_malloc_id { #define SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_TMP_ERROR_NUM \ if (thd && conn->error_mode) {SPIDER_RESTORE_DASTATUS; tmp_error_num = 0;} -#define SPIDER_SET_FILE_POS(A) \ - {(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;} -#define SPIDER_CLEAR_FILE_POS(A) \ - {DBUG_PRINT("info", ("spider thd=%p func_name=%s file_name=%s line_no=%lu", (A)->thd, (A)->func_name ? (A)->func_name : "NULL", (A)->file_name ? (A)->file_name : "NULL", (A)->line_no)); (A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;} - class ha_spider; typedef struct st_spider_share SPIDER_SHARE; typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST; @@ -480,14 +473,6 @@ typedef struct st_spider_thread volatile SPIDER_SHARE *queue_last; } SPIDER_THREAD; -typedef struct st_spider_file_pos -{ - THD *thd; - const char *func_name; - const char *file_name; - ulong line_no; -} SPIDER_FILE_POS; - typedef struct st_spider_link_for_hash { ha_spider *spider; @@ -616,7 +601,6 @@ typedef struct st_spider_conn pthread_mutex_t mta_conn_mutex; volatile bool mta_conn_mutex_lock_already; volatile bool mta_conn_mutex_unlock_later; - SPIDER_FILE_POS mta_conn_mutex_file_pos; uint join_trx; int trx_isolation; bool semi_trx_isolation_chk; diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc index 245ecd6c600..0a591bedb4e 100644 --- a/storage/spider/spd_malloc.cc +++ b/storage/spider/spd_malloc.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index ca8f7ea8670..b52cb504551 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -37,7 +37,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 2597150d7aa..a2b432a300f 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 5cbae605ca5..df04f40fc80 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -16,7 +16,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 5890f4aac6e..208a7877d23 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "my_getopt.h" @@ -5998,22 +5997,10 @@ int spider_open_all_tables( } conn->error_mode &= spider_param_error_read_mode(thd, 0); conn->error_mode &= spider_param_error_write_mode(thd, 0); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - conn->need_mon = &mon_val; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; + spider_lock_before_query(conn, &mon_val); if ((error_num = spider_db_before_query(conn, &mon_val))) { - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); spider_sys_index_end(table_tables); spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); @@ -6021,12 +6008,7 @@ int spider_open_all_tables( free_root(&mem_root, MYF(0)); DBUG_RETURN(error_num); } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); + spider_unlock_after_query(conn, 0); if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2) { diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 37d955c71b6..4da38110631 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -17,7 +17,6 @@ #define MYSQL_SERVER 1 #include #include "mysql_version.h" -#include "spd_environ.h" #include "sql_priv.h" #include "probes_mysql.h" #include "sql_class.h" diff --git a/storage/spider/spd_udf.cc b/storage/spider/spd_udf.cc index 13a9b41f7e2..511f0d0083a 100644 --- a/storage/spider/spd_udf.cc +++ b/storage/spider/spd_udf.cc @@ -15,7 +15,6 @@ #define MYSQL_SERVER 1 #include -#include "spd_environ.h" #include "mysql.h" #include "spd_udf.h" diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 17f3bdab14f..3b747de7b31 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -777,7 +777,10 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, return (~(ulonglong) 0); } - return (negative ? -((longlong) i) : (longlong) i); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) i != LONGLONG_MIN ? + -((longlong) i) : + (longlong) i; noconv: err[0]= EDOM; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 26d973b3b83..12aea194df4 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -602,7 +602,10 @@ bs: return (~(ulonglong) 0); } - return (negative ? -((longlong) res) : (longlong) res); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) res != LONGLONG_MIN ? + -((longlong) res) : + (longlong) res; } @@ -1053,6 +1056,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; @@ -2522,6 +2527,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 74baef080eb..6c4ccea0b21 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -241,8 +241,10 @@ end4: *endptr= (char*) s; if (negative) { - if (li >= MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc index 4167b8cdd1a..cf1e7dca4c9 100644 --- a/tpool/aio_simulated.cc +++ b/tpool/aio_simulated.cc @@ -73,7 +73,7 @@ static WinIoInit win_io_init; SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset) + unsigned long long offset) { OVERLAPPED ov{}; ULARGE_INTEGER uli; @@ -95,8 +95,8 @@ SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, return -1; } -SSIZE_T pwrite(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset) +SSIZE_T pwrite(const native_file_handle &h, const void *buf, size_t count, + unsigned long long offset) { OVERLAPPED ov{}; ULARGE_INTEGER uli; diff --git a/tpool/tpool.h b/tpool/tpool.h index 76a8fe38431..a8ed6a2267b 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -308,10 +308,10 @@ create_thread_pool_win(int min_threads= DEFAULT_MIN_POOL_THREADS, opened with FILE_FLAG_OVERLAPPED, and bound to completion port. */ -SSIZE_T pwrite(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset); +SSIZE_T pwrite(const native_file_handle &h, const void *buf, size_t count, + unsigned long long offset); SSIZE_T pread(const native_file_handle &h, void *buf, size_t count, - unsigned long long offset); + unsigned long long offset); HANDLE win_get_syncio_event(); #endif } // namespace tpool diff --git a/unittest/mysys/stacktrace-t.c b/unittest/mysys/stacktrace-t.c index d8408f80d76..c8b699ca696 100644 --- a/unittest/mysys/stacktrace-t.c +++ b/unittest/mysys/stacktrace-t.c @@ -30,7 +30,7 @@ void test_my_safe_print_str() memcpy(b_bss, "LEGAL", 6); #ifdef HAVE_STACKTRACE -#ifndef __SANITIZE_ADDRESS__ +# if !defined __SANITIZE_ADDRESS__ && !__has_feature(memory_sanitizer) fprintf(stderr, "\n===== stack =====\n"); my_safe_print_str(b_stack, 65535); fprintf(stderr, "\n===== heap =====\n"); @@ -40,15 +40,15 @@ void test_my_safe_print_str() fprintf(stderr, "\n===== data =====\n"); my_safe_print_str("LEGAL", 65535); fprintf(stderr, "\n===== Above is a junk, but it is expected. =====\n"); -#endif /*__SANITIZE_ADDRESS__*/ +# endif fprintf(stderr, "\n===== Nornal length test =====\n"); my_safe_print_str("LEGAL", 5); fprintf(stderr, "\n===== NULL =====\n"); my_safe_print_str(0, 5); -#ifndef __SANITIZE_ADDRESS__ +# ifndef __SANITIZE_ADDRESS__ fprintf(stderr, "\n===== (const char*) 1 =====\n"); my_safe_print_str((const char*)1, 5); -#endif /*__SANITIZE_ADDRESS__*/ +# endif /*__SANITIZE_ADDRESS__*/ #endif /*HAVE_STACKTRACE*/ free(b_heap); diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index 08bb018340c..0f995987a82 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -190,6 +190,7 @@ int main(int args, char **argv) pthread_t request_thr[N_THREADS]; int i; + my_mutex_init(); my_thread_global_init(); mysql_mutex_init(0, &apc_counters_mutex, MY_MUTEX_INIT_FAST); diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 8e76c814a44..35243d96a0b 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -364,16 +364,22 @@ new_VioSSLFd(const char *key_file, const char *cert_file, const char *ca_file, /* Set the ciphers that can be used - NOTE: SSL_CTX_set_cipher_list will return 0 if + NOTE: SSL_CTX_set_ciphersuites/SSL_CTX_set_cipher_list will return 0 if none of the provided ciphers could be selected */ - if (cipher && - SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher) == 0 && - SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0) + if (cipher) { - *error= SSL_INITERR_CIPHERS; - DBUG_PRINT("error", ("%s", sslGetErrString(*error))); - goto err2; + int cipher_result= 0; + + cipher_result|= SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher); + cipher_result|= SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher); + + if (cipher_result == 0) + { + *error= SSL_INITERR_CIPHERS; + DBUG_PRINT("error", ("%s", sslGetErrString(*error))); + goto err2; + } } /* Load certs from the trusted ca */ diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 53449b51d92..f6ef25d5b46 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -53,7 +53,7 @@ add_component(Backup DESCRIPTION "Installs backup utilities(mariabackup and mbstream)") #Miscellaneous hidden components, part of server / or client programs -foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine plugin-hashicorp-key-management) +foreach(comp connect-engine connect-engine-jdbc ClientPlugins aws-key-management rocksdb-engine) add_component(${comp} GROUP MySQLServer HIDDEN) endforeach() diff --git a/win/packaging/ComponentsIgnore.cmake b/win/packaging/ComponentsIgnore.cmake index 729c7f74cb8..5f037e365af 100644 --- a/win/packaging/ComponentsIgnore.cmake +++ b/win/packaging/ComponentsIgnore.cmake @@ -1,2 +1,2 @@ # Components ignored in both ZIP and WIX generators -set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded) +set(COMPONENTS_IGNORE Debuginfo Server_Scripts SqlBench Test Embedded hashicorp-key-management plugin-hashicorp-key-management) diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index 681a4250e65..f745eeb060b 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_12.6_32_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_12.8_32_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})