diff --git a/.clang-format b/.clang-format index 7ce45951173..3633507cb13 100644 --- a/.clang-format +++ b/.clang-format @@ -70,7 +70,6 @@ IndentPPDirectives: None IndentWidth: 2 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: true -Language: Cpp MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 0defa2d41f1..5b02a8aaa24 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -267,6 +267,12 @@ if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then fi fi +if test `$CC -v 2>&1 | head -1 | sed 's/ .*$//'` = 'clang' ; then + dbug_cflags="$dbug_cflags -Wframe-larger-than=16384 -fno-inline" + c_warnings="$c_warnings -Wframe-larger-than=16384" + cxx_warnings="$cxx_warnings -Wframe-larger-than=16384" +fi + # If ccache (a compiler cache which reduces build time) # (http://samba.org/ccache) is installed, use it. diff --git a/CMakeLists.txt b/CMakeLists.txt index ba1f422f602..1a555aa27fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() @@ -188,7 +188,7 @@ ENDIF() OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) IF (WITHOUT_SERVER) - SET (SKIP_COMPONENTS "Server|IniFiles|SuportFiles|Readme") + SET (SKIP_COMPONENTS "Server|IniFiles|SupportFiles|Readme") ELSE() SET (SKIP_COMPONENTS "N-O-N-E") ENDIF() @@ -200,8 +200,9 @@ OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system librar # Can be switched on only for debug build. # OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" OFF) -IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND WITH_PROTECT_STATEMENT_MEMROOT) - ADD_DEFINITIONS(-DPROTECT_STATEMENT_MEMROOT) +IF (WITH_PROTECT_STATEMENT_MEMROOT) + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT") ENDIF() INCLUDE(check_compiler_flag) @@ -265,8 +266,6 @@ IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO) ENDIF() -INCLUDE(wsrep) - OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON) IF(WITH_DBUG_TRACE) FOREACH(LANG C CXX) @@ -277,7 +276,12 @@ ENDIF() # Always enable debug sync for debug builds. SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") - + +IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10") + # Enable extra checks when using a recent enough version of GNU libstdc++ + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS") +ENDIF() + OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) IF (ENABLE_GCOV) MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG) @@ -338,6 +342,8 @@ ELSEIF(TRASH_FREED_MEMORY MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND AND SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTRASH_FREED_MEMORY") ENDIF() +INCLUDE(wsrep) + # Set commonly used variables IF(WIN32) SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}") diff --git a/README.md b/README.md index d632eed4b39..e123e5b64c9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Code status: * [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com -## MariaDB: The open source relational database +## MariaDB: The innovative open source database MariaDB was designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance. @@ -33,28 +33,23 @@ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/ https://mariadb.com/kb/en/new-and-old-releases/ +Getting the code, building it and testing it +--------------------------------------------------------------- + +Refer to the following guide: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/ which outlines how to correctly build the source code and run the MariaDB testing framework. + Help ----- More help is available from the Maria Discuss mailing list -https://launchpad.net/~maria-discuss, MariaDB's Zulip +https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/ and MariaDB's Zulip instance, https://mariadb.zulipchat.com/ -Live QA for beginner contributors ----- -MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip. -From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, -anyone can ask any questions they’d like, and a live developer will be available to assist. - -New contributors can ask questions any time, but we will provide immediate feedback during that interval. - Licensing --------- *************************************************************************** -NOTE: - MariaDB is specifically available only under version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 4dfce2478cd..a8e80bc8b5b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -18,7 +18,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ${PCRE_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/mysys_ssl - ${ZLIB_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/strings diff --git a/client/client_priv.h b/client/client_priv.h index 597c074c9c2..eba8a841099 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2022, MariaDB + Copyright (c) 2009, 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 @@ -38,75 +38,34 @@ enum options_client { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_PAGER, OPT_TEE, - OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, - OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, - OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, - OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_AUTO_REHASH, - OPT_LINE_NUMBERS, OPT_COLUMN_NAMES, OPT_CONNECT_TIMEOUT, - OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH, - OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL, + OPT_OPTIMIZE, + OPT_TABLES, + OPT_MASTER_DATA, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, - OPT_SSL_CIPHER, OPT_TLS_VERSION, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, - OPT_DELETE_MASTER_LOGS, OPT_COMPACT, - OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL, - OPT_FRM, OPT_SKIP_OPTIMIZATION, - OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, - OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG, - OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, - OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, - OPT_FLUSH_TABLES, - OPT_TRIGGERS, - OPT_MYSQL_ONLY_PRINT, - OPT_MYSQL_LOCK_DIRECTORY, - OPT_USE_THREADS, - OPT_IMPORT_USE_THREADS, - OPT_MYSQL_NUMBER_OF_QUERY, + OPT_SSL_CIPHER, OPT_LOCAL_INFILE, + OPT_COMPACT, + OPT_MYSQL_PROTOCOL, + OPT_SKIP_OPTIMIZATION, + OPT_COMPATIBLE, OPT_DELIMITER, + OPT_SERVER_ARG, + OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_IGNORE_DATABASE, - OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA, - OPT_MYSQLDUMP_SLAVE_APPLY, + OPT_IGNORE_TABLE, OPT_MYSQLDUMP_SLAVE_DATA, - OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, -#ifdef WHEN_FLASHBACK_REVIEW_READY - OPT_REVIEW, - OPT_REVIEW_DBNAME, OPT_REVIEW_TABLENAME, -#endif - OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING, - OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM, - OPT_SLAP_AUTO_GENERATE_ADD_AUTO, - OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY, - OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES, - OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, - OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM, - OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM, - OPT_SLAP_PRE_QUERY, - OPT_SLAP_POST_QUERY, - OPT_SLAP_PRE_SYSTEM, - OPT_SLAP_POST_SYSTEM, - OPT_SLAP_COMMIT, - OPT_SLAP_DETACH, - OPT_SLAP_NO_DROP, - OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID, - OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, - OPT_AUTO_VERTICAL_OUTPUT, - OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, - OPT_WRITE_BINLOG, OPT_DUMP_DATE, - OPT_INIT_COMMAND, + OPT_SLAP_CSV, + OPT_BASE64_OUTPUT_MODE, + OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, + OPT_WRITE_BINLOG, OPT_PLUGIN_DIR, OPT_DEFAULT_AUTH, - OPT_ABORT_SOURCE_ON_ERROR, OPT_REWRITE_DB, - OPT_REPORT_PROGRESS, - OPT_SKIP_ANNOTATE_ROWS_EVENTS, OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, OPT_CHECK_IF_UPGRADE_NEEDED, OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, - OPT_SHUTDOWN_WAIT_FOR_SLAVES, - OPT_COPY_S3_TABLES, - OPT_PRINT_TABLE_METADATA, - OPT_ASOF_TIMESTAMP, + OPT_STOP_POSITION, + OPT_SERVER_ID, OPT_IGNORE_DOMAIN_IDS, OPT_DO_DOMAIN_IDS, OPT_IGNORE_SERVER_IDS, diff --git a/client/mysql.cc b/client/mysql.cc index 5beff40d982..05f17616715 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2022, MariaDB Corporation. + Copyright (c) 2009, 2024, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -226,7 +226,7 @@ typedef struct st_status ulong query_start_line; char *file_name; LINE_BUFFER *line_buff; - bool batch,add_to_history; + bool batch, add_to_history, sandbox; } STATUS; @@ -244,7 +244,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, - opt_secure_auth= 0, + opt_secure_auth= 0, default_pager_set= 0, opt_sigint_ignore= 0, auto_vertical_output= 0, show_query_cost= 0, show_warnings= 0, executing_query= 0, @@ -324,7 +324,8 @@ static int com_quit(String *str,char*), com_rehash(String *str, char*), com_tee(String *str, char*), com_notee(String *str, char*), com_charset(String *str,char*), com_prompt(String *str, char*), com_delimiter(String *str, char*), - com_warnings(String *str, char*), com_nowarnings(String *str, char*); + com_warnings(String *str, char*), com_nowarnings(String *str, char*), + com_sandbox(String *str, char*); static int com_query_cost(String *str, char*); #ifdef USE_POPEN @@ -373,11 +374,12 @@ typedef struct { static COMMANDS commands[] = { { "?", '?', com_help, 1, "Synonym for `help'." }, + { "charset", 'C', com_charset, 1, + "Switch to another charset. Might be needed for processing binlog with multi-byte charsets." }, { "clear", 'c', com_clear, 0, "Clear the current input statement."}, { "connect",'r', com_connect,1, "Reconnect to the server. Optional arguments are db and host." }, - { "delimiter", 'd', com_delimiter, 1, - "Set statement delimiter." }, + { "delimiter", 'd', com_delimiter, 1, "Set statement delimiter." }, #ifdef USE_POPEN { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, #endif @@ -390,6 +392,8 @@ static COMMANDS commands[] = { { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, #endif { "notee", 't', com_notee, 0, "Don't write into outfile." }, + { "nowarning", 'w', com_nowarnings, 0, + "Don't show warnings after every statement." }, #ifdef USE_POPEN { "pager", 'P', com_pager, 1, "Set PAGER [to_pager]. Print the query results via PAGER." }, @@ -400,6 +404,8 @@ static COMMANDS commands[] = { { "costs", 'Q', com_query_cost, 0, "Toggle showing query costs after each query" }, { "rehash", '#', com_rehash, 0, "Rebuild completion hash." }, + { "sandbox", '-', com_sandbox, 0, + "Disallow commands that access the file system (except \\P without an argument and \\e)." }, { "source", '.', com_source, 1, "Execute an SQL script file. Takes a file name as an argument."}, { "status", 's', com_status, 0, "Get status information from the server."}, @@ -410,12 +416,8 @@ static COMMANDS commands[] = { "Set outfile [to_outfile]. Append everything into given outfile." }, { "use", 'u', com_use, 1, "Use another database. Takes database name as argument." }, - { "charset", 'C', com_charset, 1, - "Switch to another charset. Might be needed for processing binlog with multi-byte charsets." }, { "warnings", 'W', com_warnings, 0, "Show warnings after every statement." }, - { "nowarning", 'w', com_nowarnings, 0, - "Don't show warnings after every statement." }, /* Get bash-like expansion for some commands */ { "create table", 0, 0, 0, ""}, { "create database", 0, 0, 0, ""}, @@ -1652,35 +1654,47 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0}, {"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"abort-source-on-error", OPT_ABORT_SOURCE_ON_ERROR, + {"abort-source-on-error", 0, "Abort 'source filename' operations in case of errors", &batch_abort_on_error, &batch_abort_on_error, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-rehash", OPT_AUTO_REHASH, + {"auto-rehash", 0, "Enable automatic rehashing. One doesn't need to use 'rehash' to get table " - "and field completion, but startup and reconnecting may take a longer time. " - "Disable with --disable-auto-rehash.", - &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, - 0, 0}, + "and field completion, but startup and reconnecting may take a longer time.", + &opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"no-auto-rehash", 'A', "No automatic rehashing. One has to use 'rehash' to get table and field " "completion. This gives a quicker start of mysql and disables rehashing " "on reconnect.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT, + {"auto-vertical-output", 0, "Automatically switch to vertical output mode if the result is wider " - "than the terminal width.", - &auto_vertical_output, &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0, - 0, 0, 0, 0, 0}, + "than the terminal width.", &auto_vertical_output, &auto_vertical_output, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"batch", 'B', "Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"binary-mode", 0, + "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 " + "\\C 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' command). Also, in binary mode, occurrences of '\\r\\n' and " + "ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is " + "translated to '\\n' and '\\0' is disallowed in user input.", + &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"column-type-info", OPT_COLUMN_TYPES, "Display column type information.", + {"column-names", 0, "Write column names in results.", + &column_names, &column_names, 0, GET_BOOL, + NO_ARG, 1, 0, 0, 0, 0, 0}, + {"skip-column-names", 'N', "Don't write column names in results.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"column-type-info", 0, "Display column type information.", &column_types_flag, &column_types_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'c', "Preserve comments. Send comments to the server." @@ -1690,6 +1704,16 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use compression in server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect-expired-password", 0, + "Notify the server that this client is prepared to handle expired " + "password sandbox mode even if --batch was specified.", + &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect_timeout", 0, "Number of seconds before connection timeout.", + &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, + 0, 0, 3600*12, 0, 0, 0}, + {"database", 'D', "Database to use.", ¤t_db, + ¤t_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1697,70 +1721,64 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log.", &default_dbug_option, &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"database", 'D', "Database to use.", ¤t_db, - ¤t_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-auth", 0, "Default authentication client-side plugin to use.", + &opt_default_auth, &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str, &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, + "Obsolete option. Exists only for MySQL compatibility.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"vertical", 'E', "Print the output of a query (rows) vertically.", - &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, - 0}, - {"force", 'f', "Continue even if we get an SQL error. Sets abort-source-on-error to 0", - &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, + {"force", 'f', + "Continue even if we get an SQL error. Sets abort-source-on-error to 0", + &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"host", 'h', "Connect to host.", ¤t_host, + ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"html", 'H', "Produce HTML output.", &opt_html, &opt_html, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"ignore-spaces", 'i', "Ignore space after function names.", + &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"init-command", 0, + "SQL Command to execute when connecting to MariaDB server. Will " + "automatically be re-executed when reconnecting.", &opt_init_command, + &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"line-numbers", 0, "Write line numbers for errors.", + &line_numbers, &line_numbers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"local-infile", OPT_LOCAL_INFILE, "Enable LOAD DATA LOCAL INFILE.", + &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"max-allowed-packet", 0, + "The maximum packet length to send to or receive from server.", + &opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG, + REQUIRED_ARG, 16*1024LL*1024LL, 4096, 2*1024LL*1024LL*1024LL, 0, 1024, 0}, + {"max-join-size", 0, + "Automatic limit for rows in a join when using --safe-updates.", + &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, + 1, ULONG_MAX, 0, 1, 0}, {"named-commands", 'G', "Enable named commands. Named commands mean this program's internal " "commands; see mysql> help . When enabled, the named commands can be " "used from any line of the query, otherwise only from the first line, " "before an enter. Disable with --disable-named-commands. This option " "is disabled by default.", - &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"ignore-spaces", 'i', "Ignore space after function names.", - &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, - {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MariaDB server. Will " - "automatically be re-executed when reconnecting.", - &opt_init_command, &opt_init_command, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", - &opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, + &named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"net-buffer-length", 0, + "The buffer size for TCP/IP and socket communication.", + &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, + REQUIRED_ARG, 16384, 1024, 512*1024ULL*1024ULL, MALLOC_OVERHEAD, 1024, 0}, {"no-beep", 'b', "Turn off beep on error.", &opt_nobeep, &opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"host", 'h', "Connect to host.", ¤t_host, - ¤t_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"html", 'H', "Produce HTML output.", &opt_html, &opt_html, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.", - &line_numbers, &line_numbers, 0, GET_BOOL, - NO_ARG, 1, 0, 0, 0, 0, 0}, - {"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, - {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered, - &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"column-names", OPT_COLUMN_NAMES, "Write column names in results.", - &column_names, &column_names, 0, GET_BOOL, - NO_ARG, 1, 0, 0, 0, 0, 0}, - {"skip-column-names", 'N', - "Don't write column names in results.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).", - &opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, {"one-database", 'o', "Ignore statements except those that occur while the default " "database is the one named at the command line.", @@ -1781,19 +1799,20 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin-dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, + &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 "/etc/services, " #endif - "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", - &opt_mysql_port, - &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"progress-reports", OPT_REPORT_PROGRESS, + "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port, + &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"progress-reports", 0, "Get progress reports for long running commands (like ALTER TABLE)", &opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"prompt", OPT_PROMPT, "Set the command line prompt to this value.", + {"prompt", 0, "Set the command line prompt to this value.", ¤t_prompt, ¤t_prompt, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", @@ -1804,11 +1823,29 @@ 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}, {"raw", 'r', "Write fields without conversion. Used with --batch.", - &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, - 0, 0, 0}, - {"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable " - "with --disable-reconnect. This option is enabled by default.", + &opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"reconnect", 0, "Reconnect if the connection is lost.", &opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.", + &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", + &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sandbox", 0, "Disallow commands that access the file system (except \\P without an argument and \\e).", + &status.sandbox, &status.sandbox, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"secure-auth", 0, "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", &opt_secure_auth, + &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"select-limit", 0, + "Automatic limit for SELECT when using --safe-updates.", &select_limit, + &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ULONG_MAX, 0, 1, 0}, + {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"show-query-costs", 0, "Show query cost after every statement.", + &show_query_cost, &show_query_cost, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"show-warnings", 0, "Show warnings after every statement.", + &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sigint-ignore", 0, "Ignore SIGINT (CTRL-C).", &opt_sigint_ignore, + &opt_sigint_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"silent", 's', "Be more silent. Print results with a tab as separator, " "each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"socket", 'S', "The socket file to use for connection.", @@ -1822,77 +1859,22 @@ static struct my_option my_long_options[] = "Does not work in batch mode. Disable with --disable-tee. " "This option is disabled by default.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"unbuffered", 'n', "Flush buffer after each query.", &unbuffered, + &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", ¤t_user, ¤t_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.", - &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, - {"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.", - &safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, {"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"vertical", 'E', "Print the output of a query (rows) vertically.", + &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, - "Number of seconds before connection timeout.", - &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, - 0, 0, 3600*12, 0, 0, 0}, - {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, - "The maximum packet length to send to or receive from server.", - &opt_max_allowed_packet, &opt_max_allowed_packet, 0, - GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096, - (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"net_buffer_length", OPT_NET_BUFFER_LENGTH, - "The buffer size for TCP/IP and socket communication.", - &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, - REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"select_limit", OPT_SELECT_LIMIT, - "Automatic limit for SELECT when using --safe-updates.", - &select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, - 1, ULONG_MAX, 0, 1, 0}, - {"max_join_size", OPT_MAX_JOIN_SIZE, - "Automatic limit for rows in a join when using --safe-updates.", - &max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, - 1, ULONG_MAX, 0, 1, 0}, - {"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it" - " uses old (pre-4.1.1) protocol.", &opt_secure_auth, - &opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.", - &show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"show-query-costs", OPT_SHOW_WARNINGS, - "Show query cost after every statement.", - &show_query_cost, &show_query_cost, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", - &opt_plugin_dir, &opt_plugin_dir, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, - "Default authentication client-side plugin to use.", - &opt_default_auth, &opt_default_auth, 0, - GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"binary-mode", 0, - "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 " - "\\C 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' command). Also, in binary mode, occurrences of '\\r\\n' and " - "ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is " - "translated to '\\n' and '\\0' is disallowed in user input.", - &opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"connect-expired-password", 0, - "Notify the server that this client is prepared to handle expired " - "password sandbox mode even if --batch was specified.", - &opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, + {"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -2944,9 +2926,7 @@ static void initialize_readline () array of matches, or NULL if there aren't any. */ -static char **new_mysql_completion(const char *text, - int start __attribute__((unused)), - int end __attribute__((unused))) +static char **new_mysql_completion(const char *text, int, int) { if (!status.batch && !quick) #if defined(USE_NEW_READLINE_INTERFACE) @@ -3269,8 +3249,7 @@ static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *las } -static int com_server_help(String *buffer __attribute__((unused)), - char *line __attribute__((unused)), char *help_arg) +static int com_server_help(String *buffer, char *, char *help_arg) { MYSQL_ROW cur; const char *server_cmd; @@ -3372,18 +3351,16 @@ err: return error; } -static int -com_help(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_help(String *buffer, char *line) { int i, j; char * help_arg= strchr(line,' '), buff[32], *end; if (help_arg) { - while (my_isspace(charset_info,*help_arg)) + while (my_isspace(charset_info, *help_arg)) help_arg++; if (*help_arg) - return com_server_help(buffer,line,help_arg); + return com_server_help(buffer, line, help_arg); } put_info("\nGeneral information about MariaDB can be found at\n" @@ -3406,9 +3383,7 @@ com_help(String *buffer __attribute__((unused)), } - /* ARGSUSED */ -static int -com_clear(String *buffer,char *line __attribute__((unused))) +static int com_clear(String *buffer,char *) { #ifdef HAVE_READLINE if (status.add_to_history) @@ -3433,9 +3408,7 @@ static void adjust_console_codepage(const char *name __attribute__((unused))) } - /* ARGSUSED */ -static int -com_charset(String *buffer __attribute__((unused)), char *line) +static int com_charset(String *, char *line) { char buff[256], *param; CHARSET_INFO * new_cs; @@ -3468,8 +3441,7 @@ com_charset(String *buffer __attribute__((unused)), char *line) */ -static int -com_go(String *buffer,char *line __attribute__((unused))) +static int com_go(String *buffer, char *) { char buff[200]; /* about 110 chars used so far */ char time_buff[53+3+1]; /* time max + space & parens + NUL */ @@ -4054,9 +4026,7 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to } - -static void -print_table_data_html(MYSQL_RES *result) +static void print_table_data_html(MYSQL_RES *result) { MYSQL_ROW cur; MYSQL_FIELD *field; @@ -4379,15 +4349,15 @@ print_tab_data(MYSQL_RES *result) } } -static int -com_tee(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_tee(String *, char *line) { char file_name[FN_REFLEN], *end, *param; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); if (status.batch) return 0; - while (my_isspace(charset_info,*line)) + while (my_isspace(charset_info, *line)) line++; if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default { @@ -4424,9 +4394,7 @@ com_tee(String *buffer __attribute__((unused)), } -static int -com_notee(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_notee(String *, char *) { if (opt_outfile) end_tee(); @@ -4439,9 +4407,7 @@ com_notee(String *buffer __attribute__((unused)), */ #ifdef USE_POPEN -static int -com_pager(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_pager(String *, char *line) { char pager_name[FN_REFLEN], *end, *param; @@ -4469,6 +4435,8 @@ com_pager(String *buffer __attribute__((unused)), } else { + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); end= strmake_buf(pager_name, param); while (end > pager_name && (my_isspace(charset_info,end[-1]) || my_iscntrl(charset_info,end[-1]))) @@ -4483,9 +4451,7 @@ com_pager(String *buffer __attribute__((unused)), } -static int -com_nopager(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_nopager(String *, char *) { strmov(pager, "stdout"); opt_nopager=1; @@ -4497,7 +4463,7 @@ com_nopager(String *buffer __attribute__((unused)), #ifdef USE_POPEN static int -com_edit(String *buffer,char *line __attribute__((unused))) +com_edit(String *buffer,char *) { char filename[FN_REFLEN],buff[160]; int fd,tmp,error; @@ -4544,17 +4510,15 @@ err: /* If arg is given, exit without errors. This happens on command 'quit' */ -static int -com_quit(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_quit(String *, char *) { status.exit_status=0; return 1; } static int -com_rehash(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +com_rehash(String *, + char *) { #ifdef HAVE_READLINE build_completion_hash(1, 0); @@ -4564,12 +4528,13 @@ com_rehash(String *buffer __attribute__((unused)), #ifdef USE_POPEN -static int -com_shell(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_shell(String *, char *line) { char *shell_cmd; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); + /* Skip space from line begin */ while (my_isspace(charset_info, *line)) line++; @@ -4592,8 +4557,7 @@ com_shell(String *buffer __attribute__((unused)), #endif -static int -com_print(String *buffer,char *line __attribute__((unused))) +static int com_print(String *buffer,char *) { tee_puts("--------------", stdout); (void) tee_fputs(buffer->c_ptr(), stdout); @@ -4603,9 +4567,8 @@ com_print(String *buffer,char *line __attribute__((unused))) return 0; /* If empty buffer */ } - /* ARGSUSED */ -static int -com_connect(String *buffer, char *line) + +static int com_connect(String *buffer, char *line) { char *tmp, buff[256]; my_bool save_rehash= opt_rehash; @@ -4658,8 +4621,7 @@ com_connect(String *buffer, char *line) } -static int com_source(String *buffer __attribute__((unused)), - char *line) +static int com_source(String *, char *line) { char source_name[FN_REFLEN], *end, *param; LINE_BUFFER *line_buff; @@ -4668,6 +4630,9 @@ static int com_source(String *buffer __attribute__((unused)), FILE *sql_file; my_bool save_ignore_errors; + if (status.sandbox) + return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0); + /* Skip space from file name */ while (my_isspace(charset_info,*line)) line++; @@ -4702,6 +4667,7 @@ static int com_source(String *buffer __attribute__((unused)), bfill((char*) &status,sizeof(status),(char) 0); status.batch=old_status.batch; // Run in batch mode + status.sandbox=old_status.sandbox; status.line_buff=line_buff; status.file_name=source_name; glob_buffer.length(0); // Empty command buffer @@ -4723,9 +4689,7 @@ static int com_source(String *buffer __attribute__((unused)), } - /* ARGSUSED */ -static int -com_delimiter(String *buffer __attribute__((unused)), char *line) +static int com_delimiter(String *, char *line) { char buff[256], *tmp; @@ -4752,9 +4716,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line) return 0; } - /* ARGSUSED */ -static int -com_use(String *buffer __attribute__((unused)), char *line) +static int com_use(String *, char *line) { char *tmp, buff[FN_REFLEN + 1]; int select_db; @@ -4827,18 +4789,21 @@ com_use(String *buffer __attribute__((unused)), char *line) return 0; } -static int -com_warnings(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_sandbox(String *, char *) +{ + status.sandbox= 1; + put_info("Sandbox mode.", INFO_INFO); + return 0; +} + +static int com_warnings(String *, char *) { show_warnings = 1; put_info("Show warnings enabled.",INFO_INFO); return 0; } -static int -com_nowarnings(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_nowarnings(String *, char *) { show_warnings = 0; put_info("Show warnings disabled.",INFO_INFO); @@ -5102,10 +5067,7 @@ sql_connect(char *host,char *database,char *user,char *password,uint silent) } - -static int -com_status(String *buffer __attribute__((unused)), - char *line __attribute__((unused))) +static int com_status(String *, char *) { const char *status_str; char buff[40]; @@ -5230,8 +5192,7 @@ select_limit, max_join_size); return 0; } -static const char * -server_version_string(MYSQL *con) +static const char * server_version_string(MYSQL *con) { /* Only one thread calls this, so no synchronization is needed */ if (server_version == NULL) @@ -5356,8 +5317,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) } -static int -put_error(MYSQL *con) +static int put_error(MYSQL *con) { return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con), mysql_sqlstate(con)); @@ -5423,7 +5383,7 @@ void tee_putc(int c, FILE *file) len("4294967296 days, 23 hours, 59 minutes, 60.000 seconds") -> 53 */ -static void nice_time(double sec,char *buff,bool part_second) +static void nice_time(double sec, char *buff, bool part_second) { ulong tmp; if (sec >= 3600.0*24) @@ -5704,8 +5664,7 @@ static void init_username() } } -static int com_prompt(String *buffer __attribute__((unused)), - char *line) +static int com_prompt(String *, char *line) { char *ptr=strchr(line, ' '); prompt_counter = 0; diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 1f4bd6fc7b0..3f60d169edc 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1,6 +1,6 @@ /* Copyright (c) 2006, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB + Copyright (c) 2010, 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 @@ -86,10 +86,10 @@ static struct my_option my_long_options[]= {"basedir", 'b', "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"compress", OPT_COMPRESS, + {"compress", 0, "Not used by mysql_upgrade. Only for backward compatibility.", ¬_used, ¬_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"datadir", 'd', @@ -102,12 +102,12 @@ static struct my_option my_long_options[]= {"debug", '#', "Output debug log.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Not used by mysql_upgrade. Only for backward compatibility.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default_auth", OPT_DEFAULT_AUTH, diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 061ef114bf1..f8053b5e88f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB + Copyright (c) 2010, 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 @@ -124,10 +124,10 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', @@ -141,7 +141,7 @@ static struct my_option my_long_options[] = {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, @@ -195,21 +195,21 @@ static struct my_option my_long_options[] = NO_ARG, 0, 0, 0, 0, 0, 0}, {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout, + {"connect_timeout", 0, "", &opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0, 3600*12, 0, 1, 0}, - {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout, + {"shutdown_timeout", 0, "", &opt_shutdown_timeout, &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG, SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0}, - {"wait_for_all_slaves", OPT_SHUTDOWN_WAIT_FOR_SLAVES, + {"wait_for_all_slaves", 0, "Defers shutdown until after all binlogged events have been sent to " "all connected slaves", &opt_shutdown_wait_for_slaves, &opt_shutdown_wait_for_slaves, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1351,7 +1351,9 @@ static void usage(void) refresh Flush all tables and close and open logfiles\n\ shutdown Take server down\n\ status Gives a short status message from the server\n\ + start-all-slaves Start all slaves\n\ start-slave Start slave\n\ + stop-all-slaves Stop all slaves\n\ stop-slave Stop slave\n\ variables Prints variables available\n\ version Get version info from server"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 09e01f7bff5..2f1cb0e1976 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 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 @@ -1441,7 +1441,7 @@ static struct my_option my_options[] = like this: SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`; */ - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"database", 'd', "List entries for just this database (local log only).", @@ -1451,13 +1451,13 @@ static struct my_option my_options[] = {"debug", '#', "Output debug log.", ¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", 0, "Check memory and open file usage at exit .", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1493,7 +1493,7 @@ static struct my_option my_options[] = 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugindir, &opt_plugindir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -1519,14 +1519,14 @@ static struct my_option my_options[] = &result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef WHEN_FLASHBACK_REVIEW_READY - {"review", opt_flashback_review, "Print review sql in output file.", + {"review", 0, "Print review sql in output file.", &opt_flashback_review, &opt_flashback_review, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"review-dbname", opt_flashback_flashback_review_dbname, + {"review-dbname", 0, "Writing flashback original row data into this db", &flashback_review_dbname, &flashback_review_dbname, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"review-tablename", opt_flashback_flashback_review_tablename, + {"review-tablename", 0, "Writing flashback original row data into this table", &flashback_review_tablename, &flashback_review_tablename, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1576,7 +1576,7 @@ static struct my_option my_options[] = "Alias for --do-server-ids.", &server_id_str, &server_id_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"set-charset", OPT_SET_CHARSET, + {"set-charset", 0, "Add 'SET NAMES character_set' to the output.", &charset, &charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"short-form", 's', "Just show regular queries: no extra info, no " @@ -1659,7 +1659,7 @@ that may lead to an endless loop.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"open_files_limit", OPT_OPEN_FILES_LIMIT, + {"open_files_limit", 0, "Used to reserve file descriptors for use by this program.", &open_files_limit, &open_files_limit, 0, GET_ULONG, REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0}, @@ -1685,12 +1685,12 @@ that may lead to an endless loop.", "Updates to a database with a different name than the original. \ Example: rewrite-db='from->to'.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-annotate-row-events", OPT_SKIP_ANNOTATE_ROWS_EVENTS, + {"skip-annotate-row-events", 0, "Don't print Annotate_rows events stored in the binary log.", (uchar**) &opt_skip_annotate_row_events, (uchar**) &opt_skip_annotate_row_events, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"print-table-metadata", OPT_PRINT_TABLE_METADATA, + {"print-table-metadata", 0, "Print metadata stored in Table_map_log_event", &opt_print_table_metadata, &opt_print_table_metadata, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -2115,11 +2115,6 @@ get_one_option(const struct my_option *opt, const char *argument, die(1); } break; -#ifdef WHEN_FLASHBACK_REVIEW_READY - case opt_flashback_review: - opt_flashback_review= 1; - break; -#endif case OPT_START_DATETIME: start_datetime= convert_str_to_timestamp(start_datetime_str); break; @@ -3243,7 +3238,8 @@ int main(int argc, char** argv) { if (!opt_version) { - usage(); + error("Please provide the log file(s). Run with '--help' for usage " + "instructions."); retval= ERROR_STOP; } goto err; diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 66ec8eab78c..ea134f4f742 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2012, MariaDB + Copyright (c) 2010, 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 @@ -82,11 +82,11 @@ static struct my_option my_long_options[] = "Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.", &opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-repair", OPT_AUTO_REPAIR, + {"auto-repair", 0, "If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.", &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, @@ -97,7 +97,7 @@ static struct my_option my_long_options[] = {"check-upgrade", 'g', "Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"compress", OPT_COMPRESS, "Use compression in server/client protocol.", + {"compress", 0, "Use compression in server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"databases", 'B', @@ -111,16 +111,16 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -140,7 +140,7 @@ static struct my_option my_long_options[] = "If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.", &opt_extended, &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"flush", OPT_FLUSH_TABLES, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check", + {"flush", 0, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check", &opt_flush_tables, &opt_flush_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, @@ -150,7 +150,7 @@ static struct my_option my_long_options[] = {"medium-check", 'm', "Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"write-binlog", OPT_WRITE_BINLOG, + {"write-binlog", 0, "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog " "when commands should not be sent to replication slaves.", &opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG, @@ -168,7 +168,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -199,7 +199,7 @@ static struct my_option my_long_options[] = #include {"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"use-frm", OPT_FRM, + {"use-frm", 0, "When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.", &opt_frm, &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -889,6 +889,7 @@ static int disable_binlog() return run_query("SET SQL_LOG_BIN=0", 0); } + static int handle_request_for_tables(char *tables, size_t length, my_bool view, my_bool dont_quote) { @@ -1020,7 +1021,10 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen) insert_dynamic(arr, (uchar*) buf); } -static void print_result() +/* Ok as mysqlcheck is not multi threaded */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + +static void __attribute__((noinline)) print_result() { MYSQL_RES *res; MYSQL_ROW row; @@ -1111,6 +1115,7 @@ static void print_result() mysql_free_result(res); DBUG_VOID_RETURN; } +PRAGMA_REENABLE_CHECK_STACK_FRAME static int dbConnect(char *host, char *user, char *passwd) diff --git a/client/mysqldump.c b/client/mysqldump.c index e9ab7785531..820767f0a6d 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2020, MariaDB Corporation. + Copyright (c) 2010, 2024, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -166,7 +166,6 @@ static my_bool server_supports_switching_charsets= TRUE; static ulong opt_compatible_mode= 0; #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 -#define MYSQL_OPT_MAX_STATEMENT_TIME 0 #define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2 static uint opt_mysql_port= 0, opt_master_data; @@ -250,41 +249,36 @@ static struct my_option my_long_options[] = { {"all-databases", 'A', "Dump all the databases. This will be same as --databases with all databases selected.", - &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, + &opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"all-tablespaces", 'Y', "Dump all the tablespaces.", - &opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, + &opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-tablespaces", 'y', "Do not dump any tablespace information.", - &opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"add-drop-database", OPT_DROP_DATABASE, "Add a DROP DATABASE before each create.", + &opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"add-drop-database", 0, "Add a DROP DATABASE before each create.", &opt_drop_database, &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.", - &opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, - 0}, + {"add-drop-table", 0, "Add a DROP TABLE before each create.", + &opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"add-drop-trigger", 0, "Add a DROP TRIGGER before each create.", &opt_drop_trigger, &opt_drop_trigger, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"add-locks", OPT_LOCKS, "Add locks around INSERT statements.", - &opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, - 0}, - {"allow-keywords", OPT_KEYWORDS, + {"add-locks", 0, "Add locks around INSERT statements.", + &opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"allow-keywords", 0, "Allow creation of column names that are keywords.", &opt_keywords, &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"apply-slave-statements", OPT_MYSQLDUMP_SLAVE_APPLY, + {"apply-slave-statements", 0, "Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.", - &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"as-of", OPT_ASOF_TIMESTAMP, + &opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"as-of", 0, "Dump system versioned table(s) as of specified timestamp. " "Argument is interpreted according to the --tz-utc setting. " "Table structures are always dumped as of current timestamp.", - &opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"character-sets-dir", OPT_CHARSETS_DIR, + &opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"character-sets-dir", 0, "Directory for character set files.", (char **)&charsets_dir, (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'i', "Write additional information.", @@ -309,21 +303,18 @@ static struct my_option my_long_options[] = &opt_complete_insert, &opt_complete_insert, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", - &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, - 0, 0, 0}, - {"copy_s3_tables", OPT_COPY_S3_TABLES, + &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"copy_s3_tables", 0, "If 'no' S3 tables will be ignored, otherwise S3 tables will be copied as " " Aria tables and then altered to S3", &opt_copy_s3_tables, &opt_copy_s3_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"create-options", 'a', "Include all MariaDB specific create options.", - &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1, - 0, 0, 0, 0, 0}, + &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"databases", 'B', "Dump several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names. 'USE db_name;' will be included in the output.", - &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0, - 0, 0, 0, 0}, + &opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -331,19 +322,17 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log.", (char *)&default_dbug_option, (char *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", - &debug_info_flag, &debug_info_flag, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, + &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.", - &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"delete-master-logs", OPT_DELETE_MASTER_LOGS, + {"delayed-insert", 0, "Insert rows with INSERT DELAYED.", + &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"delete-master-logs", 0, "Delete logs on master after backup. This automatically enables --master-data.", &opt_delete_master_logs, &opt_delete_master_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -351,9 +340,8 @@ static struct my_option my_long_options[] = "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER " "TABLE tb_name ENABLE KEYS */; will be put in the output.", &opt_disable_keys, &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.", - &opt_dump_date, &opt_dump_date, 0, - GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"dump-date", 0, "Put a dump date to the end of the output.", + &opt_dump_date, &opt_dump_date, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"dump-history", 'H', "Dump system-versioned tables with history (only for " "timestamp based versioning)", &opt_dump_history, &opt_dump_history, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -370,24 +358,23 @@ static struct my_option my_long_options[] = "Option automatically turns --lock-tables off.", &opt_slave_data, &opt_slave_data, 0, GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0}, - {"events", 'E', "Dump events.", - &opt_events, &opt_events, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, + {"events", 'E', "Dump events.", &opt_events, &opt_events, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, {"extended-insert", 'e', "Use multiple-row INSERT syntax that include several VALUES lists.", &extended_insert, &extended_insert, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"fields-terminated-by", OPT_FTB, + {"fields-terminated-by", 0, "Fields in the output file are terminated by the given string.", &fields_terminated, &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-enclosed-by", OPT_ENC, + {"fields-enclosed-by", 0, "Fields in the output file are enclosed by the given character.", &enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0}, - {"fields-optionally-enclosed-by", OPT_O_ENC, + {"fields-optionally-enclosed-by", 0, "Fields in the output file are optionally enclosed by the given character.", &opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0}, - {"fields-escaped-by", OPT_ESC, + {"fields-escaped-by", 0, "Fields in the output file are escaped by the given character.", &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"flush-logs", 'F', "Flush logs file in server before starting dump. " @@ -399,29 +386,26 @@ static struct my_option my_long_options[] = "to the moment all tables are locked. So if you want your dump and " "the log flush to happen at the same exact moment you should use " "--lock-all-tables or --master-data with --flush-logs.", - &flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement " + &flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"flush-privileges", 0, "Emit a FLUSH PRIVILEGES statement " "after dumping the mysql database. This option should be used any " "time the dump contains the mysql database and any other database " "that depends on the data in the mysql database for proper restore. ", &flush_privileges, &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Continue even if we get an SQL error.", - &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, + &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"gtid", 0, "Used together with --master-data=1 or --dump-slave=1." "When enabled, the output from those options will set the GTID position " "instead of the binlog file and offset; the file/offset will appear only as " "a comment. When disabled, the GTID position will still appear in the " "output, but only commented.", - &opt_use_gtid, &opt_use_gtid, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, + &opt_use_gtid, &opt_use_gtid, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"header", 0, "Used together with --tab. When enabled, adds header with column names to the top of output txt files.", &opt_header, &opt_header, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, " + {"hex-blob", 0, "Dump binary strings (BINARY, " "VARBINARY, BLOB) in hexadecimal format.", &opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", ¤t_host, @@ -443,15 +427,13 @@ static struct my_option my_long_options[] = "be specified with both database and table names, e.g., " "--ignore-table=database.table.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"include-master-host-port", OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT, + {"include-master-host-port", 0, "Adds 'MASTER_HOST=, MASTER_PORT=' to 'CHANGE MASTER TO..' " "in dump produced with --dump-slave.", &opt_include_master_host_port, - &opt_include_master_host_port, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.", - &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, - {"lines-terminated-by", OPT_LTB, + &opt_include_master_host_port, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"insert-ignore", 0, "Insert rows with INSERT IGNORE.", + &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"lines-terminated-by", 0, "Lines in the output file are terminated by the given string.", &lines_terminated, &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -462,7 +444,7 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"lock-tables", 'l', "Lock all tables for read.", &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.", + {"log-error", 0, "Append warnings and errors to given file.", &log_error_file, &log_error_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"log-queries", 0, "When restoring the dump, the server will, if logging turned on, log the queries to the general and slow query log.", @@ -479,30 +461,28 @@ static struct my_option my_long_options[] = "Option automatically turns --lock-tables off.", &opt_master_data, &opt_master_data, 0, GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0}, - {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, + {"max_allowed_packet", 0, "The maximum packet length to send to or receive from server.", &opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0}, - {"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME, + {"max-statement-time", 0, "Max statement execution time. If unset, overrides server default with 0.", &opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"net_buffer_length", OPT_NET_BUFFER_LENGTH, + {"net_buffer_length", 0, "The buffer size for TCP/IP and socket communication.", &opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L, MALLOC_OVERHEAD-1024, 1024, 0}, - {"no-autocommit", OPT_AUTOCOMMIT, + {"no-autocommit", 0, "Wrap tables with autocommit/commit statements.", - &opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, + &opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-create-db", 'n', "Suppress the CREATE DATABASE ... IF EXISTS statement that normally is " "output for each dumped database if --all-databases or --databases is " "given.", - &opt_create_db, &opt_create_db, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + &opt_create_db, &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-create-info", 't', "Don't write table creation info.", &opt_no_create_info, &opt_no_create_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -516,7 +496,7 @@ static struct my_option my_long_options[] = {"opt", OPT_OPTIMIZE, "Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"order-by-primary", OPT_ORDER_BY_PRIMARY, + {"order-by-primary", 0, "Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.", &opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"order-by-size", 0, @@ -541,27 +521,24 @@ static struct my_option my_long_options[] = {"quote-names",'Q', "Quote table and column names with backticks (`).", &opt_quoted, &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.", - &opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, + {"replace", 0, "Use REPLACE INTO instead of INSERT INTO.", &opt_replace_into, + &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"result-file", 'r', "Direct output to a given file. This option should be used in systems " "(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) " "to separate text lines. This option ensures that only a single newline " "is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"routines", 'R', "Dump stored routines (functions and procedures).", - &opt_routines, &opt_routines, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, - {"set-charset", OPT_SET_CHARSET, - "Add 'SET NAMES default_character_set' to the output.", - &opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, - 0, 0, 0, 0, 0}, + &opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"set-charset", 0, + "Add 'SET NAMES default_character_set' to the output.", &opt_set_charset, + &opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, /* Note that the combination --single-transaction --master-data will give bullet-proof binlog position only if server >=4.1.3. That's the old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug. */ - {"single-transaction", OPT_TRANSACTION, + {"single-transaction", 0, "Creates a consistent snapshot by dumping all tables in a single " "transaction. Works ONLY for tables stored in storage engines which " "support multiversioning (currently only InnoDB does); the dump is NOT " @@ -580,7 +557,7 @@ static struct my_option my_long_options[] = &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include - {"system", 256, "Dump system tables as portable SQL", + {"system", 0, "Dump system tables as portable SQL", &opt_system, &opt_system, &opt_system_types, GET_SET, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tab",'T', "Create tab-separated textfile for each table to given path. (Create .sql " @@ -589,17 +566,16 @@ static struct my_option my_long_options[] = &path, &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table.", + {"triggers", 0, "Dump triggers for each dumped table.", &opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"tz-utc", OPT_TZ_UTC, + {"tz-utc", 0, "Set connection time zone to UTC before commencing the dump and add " "SET TIME_ZONE=´+00:00´ to the top of the dump file.", &opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE - {"user", 'u', "User for login if not current user.", - ¤t_user, ¤t_user, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, + {"user", 'u', "User for login if not current user.", ¤t_user, + ¤t_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif {"verbose", 'v', "Print info about the various stages.", &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -609,11 +585,10 @@ static struct my_option my_long_options[] = &where, &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, - "Default authentication client-side plugin to use.", + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} @@ -763,56 +738,57 @@ static void write_header(FILE *sql_file, const char *db_name) fputs(">\n", sql_file); check_io(sql_file); } - else if (!opt_compact) + else { - print_comment(sql_file, 0, - "-- MariaDB dump %s-%s, for %s (%s)\n--\n", - VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, - MACHINE_TYPE); - print_comment(sql_file, 0, "-- Host: %s ", - fix_for_comment(current_host ? current_host : "localhost")); - print_comment(sql_file, 0, "Database: %s\n", - fix_for_comment(db_name ? db_name : "")); - print_comment(sql_file, 0, - "-- ------------------------------------------------------\n" - ); - print_comment(sql_file, 0, "-- Server version\t%s\n", - mysql_get_server_info(&mysql_connection)); - - if (!opt_logging) - fprintf(sql_file, -"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL LOG_SLOW_QUERY=0 */;"); - - if (opt_set_charset) - fprintf(sql_file, -"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" -"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" -"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" -"\n/*!40101 SET NAMES %s */;\n",default_charset); - - if (opt_tz_utc) + fprintf(sql_file, "/*!999999\\- enable the sandbox mode */ \n"); + if (!opt_compact) { - fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n"); - fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n"); - } + print_comment(sql_file, 0, "-- MariaDB dump %s-%s, for %s (%s)\n--\n", + VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); + print_comment(sql_file, 0, "-- Host: %s ", + fix_for_comment(current_host ? current_host : "localhost")); + print_comment(sql_file, 0, "Database: %s\n", + fix_for_comment(db_name ? db_name : "")); + print_comment(sql_file, 0, + "-- ------------------------------------------------------\n" + ); + print_comment(sql_file, 0, "-- Server version\t%s\n", + mysql_get_server_info(&mysql_connection)); - if (!path) - { - if (!opt_no_create_info) + if (!opt_logging) + fprintf(sql_file, + "\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL LOG_SLOW_QUERY=0 */;"); + + if (opt_set_charset) + fprintf(sql_file, + "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" + "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" + "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" + "\n/*!40101 SET NAMES %s */;\n",default_charset); + + if (opt_tz_utc) { - /* We don't need unique checks as the table is created just before */ - fprintf(md_result_file,"\ -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); + fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n"); + fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n"); } - fprintf(md_result_file,"\ -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\ -"); + + if (!path) + { + if (!opt_no_create_info) + { + /* We don't need unique checks as the table is created just before */ + fprintf(md_result_file, + "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"); + } + fprintf(md_result_file, + "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n"); + } + fprintf(sql_file, + "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n" + "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n", + path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",", + compatible_mode_normal_str); } - fprintf(sql_file, - "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n" - "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n", - path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",", - compatible_mode_normal_str); check_io(sql_file); } } /* write_header */ @@ -3116,8 +3092,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (opt_header) dynstr_set_checked(&select_field_names_for_header, ""); } - insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : - delayed ? " DELAYED " : opt_ignore ? " IGNORE " : ""); + + insert_option= ((delayed && opt_ignore) ? "DELAYED IGNORE " : + delayed ? "DELAYED " : opt_ignore ? "IGNORE " : ""); verbose_msg("-- Retrieving table structure for table %s...\n", table); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 433b2841146..fc96b767780 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2011, 2022, MariaDB + Copyright (c) 2011, 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 @@ -70,10 +70,10 @@ static char **argv_to_free; static struct my_option my_long_options[] = { - {"character-sets-dir", OPT_CHARSETS_DIR, + {"character-sets-dir", 0, "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"columns", 'c', @@ -85,31 +85,31 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delete", 'd', "First delete all rows from table.", &opt_delete, &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-terminated-by", OPT_FTB, + {"fields-terminated-by", 0, "Fields in the input file are terminated by the given string.", &fields_terminated, &fields_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-enclosed-by", OPT_ENC, + {"fields-enclosed-by", 0, "Fields in the import file are enclosed by the given character.", &enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-optionally-enclosed-by", OPT_O_ENC, + {"fields-optionally-enclosed-by", 0, "Fields in the input file are optionally enclosed by the given character.", &opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"fields-escaped-by", OPT_ESC, + {"fields-escaped-by", 0, "Fields in the input file are escaped by the given character.", &escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -126,10 +126,10 @@ static struct my_option my_long_options[] = "Disable foreign key checks while importing the data.", &ignore_foreign_keys, &ignore_foreign_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", + {"ignore-lines", 0, "Ignore first n lines of data infile.", &opt_ignore_lines, &opt_ignore_lines, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"lines-terminated-by", OPT_LTB, + {"lines-terminated-by", 0, "Lines in the input file are terminated by the given string.", &lines_terminated, &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -138,7 +138,7 @@ static struct my_option my_long_options[] = {"lock-tables", 'l', "Lock all tables for write (this disables threads).", &lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"low-priority", OPT_LOW_PRIORITY, + {"low-priority", 0, "Use LOW_PRIORITY when updating the table.", &opt_low_priority, &opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', @@ -148,7 +148,7 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -170,7 +170,7 @@ static struct my_option my_long_options[] = &opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include - {"use-threads", OPT_USE_THREADS, + {"use-threads", 0, "Load files in parallel. The argument is the number " "of threads to use for loading data.", &opt_use_threads, &opt_use_threads, 0, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index bedc4b33cdb..cb7f44751b1 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2019, MariaDB + Copyright (c) 2010, 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 @@ -191,10 +191,10 @@ static struct my_option my_long_options[] = {"character-sets-dir", 'c', "Directory for character set files.", (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", OPT_DEFAULT_CHARSET, + {"default-character-set", 0, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"count", OPT_COUNT, + {"count", 0, "Show number of rows per table (may be slow for non-MyISAM tables).", &opt_count, &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -203,13 +203,13 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", + {"debug-info", 0, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -226,7 +226,7 @@ static struct my_option my_long_options[] = "Password to use when connecting to server. If password is not given, it's " "solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " diff --git a/client/mysqlslap.c b/client/mysqlslap.c index c31460ee571..3847bbc44c6 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2022, MariaDB + Copyright (c) 2010, 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 @@ -535,50 +535,45 @@ static struct my_option my_long_options[] = "Generate SQL where not supplied by file or command line.", &auto_generate_sql, &auto_generate_sql, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO, + {"auto-generate-sql-add-autoincrement", 0, "Add an AUTO_INCREMENT column to auto-generated tables.", - &auto_generate_sql_autoincrement, - &auto_generate_sql_autoincrement, + &auto_generate_sql_autoincrement, &auto_generate_sql_autoincrement, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES, + {"auto-generate-sql-execute-number", 0, "Set this number to generate a set number of queries to run.", &auto_actual_queries, &auto_actual_queries, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY, + {"auto-generate-sql-guid-primary", 0, "Add GUID based primary keys to auto-generated tables.", - &auto_generate_sql_guid_primary, - &auto_generate_sql_guid_primary, + &auto_generate_sql_guid_primary, &auto_generate_sql_guid_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, + {"auto-generate-sql-load-type", 0, "Specify test load type: mixed, update, write, key, or read; default is mixed.", (char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-secondary-indexes", - OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, + {"auto-generate-sql-secondary-indexes", 0, "Number of secondary indexes to add to auto-generated tables.", &auto_generate_sql_secondary_indexes, &auto_generate_sql_secondary_indexes, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"auto-generate-sql-unique-query-number", - OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM, + {"auto-generate-sql-unique-query-number", 0, "Number of unique queries to generate for automatic tests.", &auto_generate_sql_unique_query_number, &auto_generate_sql_unique_query_number, 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0}, - {"auto-generate-sql-unique-write-number", - OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM, + {"auto-generate-sql-unique-write-number", 0, "Number of unique queries to generate for auto-generate-sql-write-number.", &auto_generate_sql_unique_write_number, &auto_generate_sql_unique_write_number, 0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0}, - {"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM, + {"auto-generate-sql-write-number", 0, "Number of row inserts to perform for each thread (default is 100).", &auto_generate_sql_number, &auto_generate_sql_number, 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", (char **)&charsets_dir, (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.", + {"commit", 0, "Commit records every X number of statements.", &commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", @@ -587,10 +582,10 @@ static struct my_option my_long_options[] = {"concurrency", 'c', "Number of clients to simulate for query to run.", (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.", + {"create", 0, "File or string to use create tables.", &create_string, &create_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.", + {"create-schema", 0, "Schema to run tests in.", (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"csv", OPT_SLAP_CSV, @@ -604,12 +599,12 @@ static struct my_option my_long_options[] = (char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", + {"debug-check", 0, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_DEFAULT_AUTH, + {"default_auth", 0, "Default authentication client-side plugin to use.", &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -617,7 +612,7 @@ static struct my_option my_long_options[] = "Delimiter to use in SQL statements supplied in file or command line.", (char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"detach", OPT_SLAP_DETACH, + {"detach", 0, "Detach (close and reopen) connections after X number of requests.", &detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -629,14 +624,14 @@ static struct my_option my_long_options[] = GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"init-command", OPT_INIT_COMMAND, + {"init-command", 0, "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"iterations", 'i', "Number of times to run the tests.", &iterations, &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, - {"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.", + {"no-drop", 0, "Do not drop the schema after the test.", &opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"number-char-cols", 'x', "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.", @@ -646,11 +641,11 @@ static struct my_option my_long_options[] = "Number of INT columns to create in table if specifying --auto-generate-sql.", (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, + {"number-of-queries", 0, "Limit each client to this number of queries (this is not exact).", &num_of_query, &num_of_query, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"only-print", OPT_MYSQL_ONLY_PRINT, + {"only-print", 0, "Do not connect to the databases, but instead print out what would have " "been done.", &opt_only_print, &opt_only_print, 0, GET_BOOL, NO_ARG, @@ -662,25 +657,25 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, - {"post-query", OPT_SLAP_POST_QUERY, + {"post-query", 0, "Query to run or file containing query to execute after tests have completed.", &user_supplied_post_statements, &user_supplied_post_statements, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"post-system", OPT_SLAP_POST_SYSTEM, + {"post-system", 0, "system() string to execute after tests have completed.", &post_system, &post_system, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"pre-query", OPT_SLAP_PRE_QUERY, + {"pre-query", 0, "Query to run or file containing query to execute before running tests.", &user_supplied_pre_statements, &user_supplied_pre_statements, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"pre-system", OPT_SLAP_PRE_SYSTEM, + {"pre-system", 0, "system() string to execute before running tests.", &pre_system, &pre_system, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1642,6 +1637,9 @@ drop_primary_key_list(void) return 0; } + +PRAGMA_DISABLE_CHECK_STACK_FRAME + static int create_schema(MYSQL *mysql, const char *db, statement *stmt, option_string *engine_stmt) @@ -1737,6 +1735,7 @@ limit_not_met: DBUG_RETURN(0); } +PRAGMA_REENABLE_CHECK_STACK_FRAME static int drop_schema(MYSQL *mysql, const char *db) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 26916db608f..977175c02de 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -78,7 +78,7 @@ static my_bool non_blocking_api_enabled= 0; #define MAX_DELIMITER_LENGTH 16 #define DEFAULT_MAX_CONN 64 -#define DIE_BUFF_SIZE 256*1024 +#define DIE_BUFF_SIZE 15*1024 #define RESULT_STRING_INIT_MEM 2048 #define RESULT_STRING_INCREMENT_MEM 2048 @@ -397,7 +397,7 @@ enum enum_commands { Q_IF, Q_DISABLE_PARSING, Q_ENABLE_PARSING, Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, - Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, + Q_WRITE_FILE, Q_WRITE_LINE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, @@ -500,6 +500,7 @@ const char *command_names[]= "remove_file", "file_exists", "write_file", + "write_line", "copy_file", "perl", "die", @@ -1534,7 +1535,6 @@ void free_used_memory() void ha_pre_shutdown(); #endif - ATTRIBUTE_NORETURN static void cleanup_and_exit(int exit_code, bool called_from_die) { @@ -4369,6 +4369,49 @@ void do_write_file(struct st_command *command) do_write_file_command(command, FALSE); } +/** + Write a line to the start of the file. + Truncates existing file, creates new one if it doesn't exist. + + Usage + write_line ; + + Example + --write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + + @note Both the file and the line parameters are evaluated + (can be variables). + + @note This is a better alternative to + exec echo > file, as it doesn't depend on shell, + and can better handle sporadic file access errors caused + by antivirus or backup software on Windows. +*/ +void do_write_line(struct st_command *command) +{ + DYNAMIC_STRING ds_line; + DYNAMIC_STRING ds_filename; + + struct command_arg write_line_args[] = { + { "line", ARG_STRING, FALSE, &ds_line, "line to add" }, + { "filename", ARG_STRING, TRUE, &ds_filename, "File to write to" }, + }; + DBUG_ENTER("do_write_line"); + + check_command_args(command, + command->first_argument, + write_line_args, + sizeof(write_line_args)/sizeof(struct command_arg), + ' '); + + if (bad_path(ds_filename.str)) + DBUG_VOID_RETURN; + dynstr_append_mem(&ds_line, "\n", 1); + str_to_file2(ds_filename.str, ds_line.str, ds_line.length, FALSE); + dynstr_free(&ds_filename); + dynstr_free(&ds_line); + DBUG_VOID_RETURN; +} /* SYNOPSIS @@ -5286,7 +5329,11 @@ void do_shutdown_server(struct st_command *command) */ if (timeout && mysql_shutdown(mysql, SHUTDOWN_DEFAULT)) - die("mysql_shutdown failed"); + { + handle_error(command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); + DBUG_VOID_RETURN; + } if (!timeout || wait_until_dead(pid, timeout)) { @@ -7489,7 +7536,7 @@ void str_to_file2(const char *fname, char *str, size_t size, my_bool append) die("Could not open '%s' for writing, errno: %d", buff, errno); if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR) die("Could not find end of file '%s', errno: %d", buff, errno); - if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP))) + if (size > 0 && my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP))) die("write failed, errno: %d", errno); my_close(fd, MYF(0)); } @@ -8284,7 +8331,7 @@ static int match_expected_error(struct st_command *command, SYNOPSIS handle_error() - q - query context + command - command err_errno - error number err_error - error message err_sqlstate - sql state @@ -10286,6 +10333,7 @@ int main(int argc, char **argv) break; case Q_FILE_EXIST: do_file_exist(command); break; case Q_WRITE_FILE: do_write_file(command); break; + case Q_WRITE_LINE: do_write_line(command); break; case Q_APPEND_FILE: do_append_file(command); break; case Q_DIFF_FILES: do_diff_files(command); break; case Q_SEND_QUIT: do_send_quit(command); break; diff --git a/cmake/FindPMEM.cmake b/cmake/FindPMEM.cmake deleted file mode 100644 index 024436444d2..00000000000 --- a/cmake/FindPMEM.cmake +++ /dev/null @@ -1,18 +0,0 @@ -if(PMEM_LIBRARIES) - set(PMEM_FOUND TRUE) - return() -endif() -if(DEFINED PMEM_LIBRARIES) - set(PMEM_FOUND FALSE) - return() -endif() - -find_path(PMEM_INCLUDE_DIRS NAMES libpmem.h) -find_library(PMEM_LIBRARIES NAMES pmem) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - PMEM DEFAULT_MSG - PMEM_LIBRARIES PMEM_INCLUDE_DIRS) - -mark_as_advanced(PMEM_INCLUDE_DIRS PMEM_LIBRARIES) diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 74853c36a74..3263c08ec44 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -379,5 +379,11 @@ FUNCTION (MAYBE_DISABLE_IPO target) INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO OFF INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL OFF) + IF(CMAKE_CONFIGURATION_TYPES) + FOREACH(cfg ${CMAKE_CONFIGURATION_TYPES}) + STRING(TOUPPER "${cfg}" cfg_upper) + SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_${cfg_upper} OFF) + ENDFOREACH() + ENDIF() ENDIF() ENDFUNCTION() diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index a9b103345cd..b4f56597775 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -40,6 +40,13 @@ SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC) MESSAGE("== Configuring MariaDB Connector/C") ADD_SUBDIRECTORY(libmariadb) +IF(MSVC AND TARGET mariadb_obj AND TARGET mariadbclient) + # With MSVC, do not produce LTCG-compiled static client libraries. + # They are not usable by end-users, being tied to exact compiler version + MAYBE_DISABLE_IPO(mariadb_obj) + MAYBE_DISABLE_IPO(mariadbclient) +ENDIF() + IF(UNIX) INSTALL(CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}) diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 752f882d4a8..f42db939bd3 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -44,21 +44,21 @@ MACRO(BUNDLE_PCRE2) SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${file} ${file_d}) SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${file}) ENDFOREACH() + FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINSIZEREL") - STRING(REPLACE "/WX" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") - SET(pcre2_flags${v} "${pcre2_flags${v}} -std=c99 ") + SET(pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") IF(MSVC) + STRING(REPLACE "/WX" "" pcre2_flags${v} "${pcre2_flags${v}}") # Suppress a warning - STRING(APPEND pcre2_flags${v} " /wd4244 " ) - # Disable asan support - STRING(REPLACE "-fsanitize=address" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}") + STRING(APPEND pcre2_flags${v} " /wd4244 /wd4267 " ) ENDIF() ENDFOREACH() + ExternalProject_Add( pcre2 PREFIX "${dir}" - URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.zip" - URL_MD5 fe90992fbfb03f854bd9f344074f49eb + URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.zip" + URL_MD5 b58f050f2fdd6f2ca5774a2975377a85 INSTALL_COMMAND "" CMAKE_ARGS "-DCMAKE_WARN_DEPRECATED=FALSE" diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index e8ba59f2873..43b9db15712 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -46,7 +46,7 @@ MACRO(MYSQL_ADD_PLUGIN) ${CMAKE_SOURCE_DIR}/sql ${PCRE_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} - ${ZLIB_INCLUDE_DIR}) + ${ZLIB_INCLUDE_DIRS}) LIST(GET ARG_UNPARSED_ARGUMENTS 0 plugin) SET(SOURCES ${ARG_UNPARSED_ARGUMENTS}) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 15620735767..b4fdc3ba905 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -60,6 +60,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(HAVE_EncryptAes128Ctr ON CACHE INTERNAL "wolfssl does support AES-CTR") SET(HAVE_EncryptAes128Gcm OFF CACHE INTERNAL "wolfssl does not support AES-GCM") SET(HAVE_X509_check_host ON CACHE INTERNAL "wolfssl does support X509_check_host") + SET(HAVE_des ON CACHE INTERNAL "wolfssl does support DES API") CHANGE_SSL_SETTINGS("bundled") ADD_SUBDIRECTORY(extra/wolfssl) MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") @@ -158,6 +159,8 @@ MACRO (MYSQL_CHECK_SSL) HAVE_EncryptAes128Gcm) CHECK_SYMBOL_EXISTS(X509_check_host "openssl/x509v3.h" HAVE_X509_check_host) + CHECK_SYMBOL_EXISTS(DES_set_key_unchecked "openssl/des.h" + HAVE_des) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_DEFINITIONS) diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index 9e085189e4f..a933194cd33 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -14,9 +14,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA MACRO (MYSQL_USE_BUNDLED_ZLIB) - SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib) + SET(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib) SET(BUILD_BUNDLED_ZLIB 1) - SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library") + SET(ZLIB_LIBRARIES zlib CACHE INTERNAL "Bundled zlib library") + # temporarily define ZLIB_LIBRARY and ZLIB_INCLUDE_DIR for libmariadb + SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES}) + SET(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS}) SET(ZLIB_FOUND TRUE) SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib") ADD_SUBDIRECTORY(zlib) @@ -29,7 +32,7 @@ ENDMACRO() # If this is set,we use bundled zlib # If this is not set,search for system zlib. # if system zlib is not found, use bundled copy -# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES +# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIRS # are set after this macro has run MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) @@ -37,10 +40,14 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) IF(WITH_ZLIB STREQUAL "bundled") MYSQL_USE_BUNDLED_ZLIB() ELSE() - INCLUDE(FindZLIB) + FIND_PACKAGE(PkgConfig QUIET) + IF(PKG_CONFIG_FOUND AND (COMMAND PKG_GET_VARIABLE) AND (NOT WIN32)) + PKG_GET_VARIABLE(ZLIB_ROOT zlib prefix) + ENDIF() + FIND_PACKAGE(ZLIB) IF(ZLIB_FOUND) INCLUDE(CheckFunctionExists) - SET(CMAKE_REQUIRED_LIBRARIES z) + SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32) CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND) CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND) @@ -48,7 +55,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND) SET(WITH_ZLIB "system" CACHE STRING "Which zlib to use (possible values are 'bundled' or 'system')") - SET(ZLIB_SOURCES "") ELSE() SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable") MESSAGE(STATUS "system zlib found but not usable") diff --git a/config.h.cmake b/config.h.cmake index b1f69431374..49783ce6b50 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -499,6 +499,7 @@ #cmakedefine HAVE_COMPRESS 1 #cmakedefine HAVE_EncryptAes128Ctr 1 #cmakedefine HAVE_EncryptAes128Gcm 1 +#cmakedefine HAVE_des 1 /* Stuff that always need to be defined (compile breaks without it) diff --git a/configure.cmake b/configure.cmake index c2706b50502..5aefb67386a 100644 --- a/configure.cmake +++ b/configure.cmake @@ -60,15 +60,6 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND (NOT MSVC)) ENDIF() ENDIF() -# workaround for old gcc on x86, gcc atomic ops only work under -march=i686 -IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND - CMAKE_C_COMPILER_VERSION VERSION_LESS "4.4.0") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686") - # query_response_time.cc causes "error: unable to find a register to spill" - SET(PLUGIN_QUERY_RESPONSE_TIME NO CACHE BOOL "Disabled, gcc is too old") -ENDIF() - # use runtime atomic-support detection in aarch64 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") MY_CHECK_AND_SET_COMPILER_FLAG("-moutline-atomics") @@ -984,3 +975,8 @@ IF(have_C__Werror) ) SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS}) ENDIF() + +IF(CMAKE_C_COMPILER_ID MATCHES "Intel") + MY_CHECK_AND_SET_COMPILER_FLAG("-no-ansi-alias") + MY_CHECK_AND_SET_COMPILER_FLAG("-fp-model precise") +ENDIF() diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index faf443f8628..0e1b771b6cc 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -51,12 +51,6 @@ replace_uring_with_aio() -e '/-DWITH_URING=ON/d' -i debian/rules } -disable_pmem() -{ - sed '/libpmem-dev/d' -i debian/control - sed '/-DWITH_PMEM=ON/d' -i debian/rules -} - disable_libfmt() { # 7.0+ required @@ -96,10 +90,6 @@ in "buster") disable_libfmt replace_uring_with_aio - if [ ! "$architecture" = amd64 ] - then - disable_pmem - fi ;& "bullseye") add_lsb_base_depends @@ -107,10 +97,6 @@ in "bookworm") # mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools # so no removal is necessary. - if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]] - then - disable_pmem - fi if [[ ! "$architecture" =~ amd64|arm64|armel|armhf|i386|mips64el|mipsel|ppc64el|s390x ]] then replace_uring_with_aio @@ -129,10 +115,6 @@ in add_lsb_base_depends ;& "lunar"|"mantic") - if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]] - then - disable_pmem - fi if [[ ! "$architecture" =~ amd64|arm64|armhf|ppc64el|s390x ]] then replace_uring_with_aio diff --git a/debian/control b/debian/control index 2f0264b68e5..d4606b24118 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: MariaDB Developers Build-Depends: bison, cmake, cracklib-runtime , - debhelper (>= 10), + debhelper (>= 11), dh-exec, flex [amd64], gdb , @@ -34,7 +34,6 @@ Build-Depends: bison, libnuma-dev [linux-any], libpam0g-dev, libpcre2-dev, - libpmem-dev [amd64 arm64 ppc64el riscv64], libsnappy-dev, libssl-dev, libssl-dev:native, diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install index c015d59ae9b..48120822f81 100644 --- a/debian/libmariadb-dev.install +++ b/debian/libmariadb-dev.install @@ -20,7 +20,6 @@ usr/include/mariadb/mysql.h usr/include/mariadb/mysql/ usr/include/mariadb/mysql/client_plugin.h usr/include/mariadb/mysql/plugin_auth.h -usr/include/mariadb/mysql/plugin_auth_common.h usr/include/mariadb/mysql_com.h usr/include/mariadb/mysql_version.h usr/include/mariadb/mysqld_error.h diff --git a/debian/mariadb-server.install b/debian/mariadb-server.install index 0b9ca8fb41a..e5f4e79f610 100644 --- a/debian/mariadb-server.install +++ b/debian/mariadb-server.install @@ -8,6 +8,10 @@ etc/logrotate.d/mariadb etc/security/user_map.conf lib/*/security/pam_user_map.so lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf +lib/systemd/system/mariadb-extra@.socket +lib/systemd/system/mariadb.service +lib/systemd/system/mariadb@.service +lib/systemd/system/mariadb@.socket lib/systemd/system/mysql.service lib/systemd/system/mysqld.service support-files/rpm/enable_encryption.preset etc/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset diff --git a/debian/mariadb-server.postinst b/debian/mariadb-server.postinst index 59d6735fb63..298f551fdcf 100644 --- a/debian/mariadb-server.postinst +++ b/debian/mariadb-server.postinst @@ -285,28 +285,5 @@ esac db_stop # in case invoke fails -# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mariadb. -# Thus MariaDB server is started via init.d script, which in turn redirects to -# systemctl. If we upgrade from MySQL mysql.service may be masked, which also -# means init.d script is disabled. Unmask mysql service explicitly. -# Check first that the command exists, to avoid emitting any warning messages. -if [ -x "$(command -v deb-systemd-helper)" ] -then - deb-systemd-helper unmask mysql.service > /dev/null -fi - #DEBHELPER# -# Modified dh_systemd_start snippet that's not added automatically -if [ -d /run/systemd/system ] -then - systemctl --system daemon-reload >/dev/null || true - deb-systemd-invoke start mariadb.service >/dev/null || true - # Modified dh_installinit snippet to only run with sysvinit -elif [ -x "/etc/init.d/mariadb" ] -then - if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] - then - invoke-rc.d mariadb start || exit $? - fi -fi diff --git a/debian/mariadb-server.postrm b/debian/mariadb-server.postrm index 4b62a8910fa..841be00b6c6 100644 --- a/debian/mariadb-server.postrm +++ b/debian/mariadb-server.postrm @@ -12,50 +12,7 @@ fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } -MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" - -# Try to stop the server in a sane way. If it does not success let the admin -# do it himself. No database directories should be removed while the server -# is running! Another mariadbd in e.g. a different chroot is fine for us. -stop_server() { - # Return immediately if there are no mysqld processes running - # as there is no point in trying to shutdown in that case. - if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null - then - return - fi - - set +e - invoke-rc.d mariadb stop - invoke-rc.d mysql stop # Backwards compatibility - errno=$? - set -e - - # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 ] && [ "$errno" != 100 ] - then - echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 - echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 - echo "Stop it yourself and try again!" 1>&2 - db_stop - exit 1 - fi -} - - -case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - if [ -n "$($MYADMIN ping 2>/dev/null)" ] - then - stop_server - sleep 2 - fi - ;; - *) - echo "postrm called with unknown argument '$1'" 1>&2 - exit 1 - ;; -esac +#DEBHELPER# # # - Purge logs and data only if they are ours (#307473) diff --git a/debian/mariadb-server.prerm b/debian/mariadb-server.prerm deleted file mode 100644 index e46f1d7817a..00000000000 --- a/debian/mariadb-server.prerm +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -e - -#DEBHELPER# - -# Modified dh_systemd_start snippet that's not added automatically -if [ -d /run/systemd/system ] -then - deb-systemd-invoke stop mariadb.service >/dev/null - # Modified dh_installinit snippet to only run with sysvinit -elif [ -x "/etc/init.d/mariadb" ] -then - invoke-rc.d mariadb stop || exit $? -fi diff --git a/debian/not-installed b/debian/not-installed index 1cbeeade721..da34fd0d8c0 100644 --- a/debian/not-installed +++ b/debian/not-installed @@ -5,11 +5,7 @@ etc/mysql/mariadb.conf.d/enable_encryption.preset # Debian packaging uses files etc/mysql/mariadb.conf.d/mysql-clients.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/ etc/mysql/mariadb.conf.d/server.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/ lib/systemd/system/mariadb-extra.socket # Installed by rules file -lib/systemd/system/mariadb-extra@.socket # Installed by rules file -lib/systemd/system/mariadb.service # Installed by rules file lib/systemd/system/mariadb.socket # Installed by rules file -lib/systemd/system/mariadb@.service # Installed by rules file -lib/systemd/system/mariadb@.socket # Installed by rules file usr/bin/mariadb-embedded # Shipping the embedded server in distro packaging does not make sense usr/bin/mysql_config # Debian packaging has mysql_config as symlink to mariadb_config usr/bin/mysql_embedded # Symlink to mariadb-embedded which is intentionally not included diff --git a/debian/rules b/debian/rules index 3a5b7392b4b..d010a880f13 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS))) endif BUILDDIR := builddir -DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//') +DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/') DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/') DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/') RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead? @@ -51,12 +51,6 @@ ifeq (32,$(DEB_HOST_ARCH_BITS)) CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO endif -# Only attempt to build with PMEM on archs that have package libpmem-dev available -# See https://packages.debian.org/search?searchon=names&keywords=libpmem-dev -ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el riscv64)) - CMAKEFLAGS += -DWITH_PMEM=ON -endif - # Add support for verbose builds MAKEFLAGS += VERBOSE=1 @@ -132,16 +126,6 @@ override_dh_auto_install: dh_testdir dh_testroot -ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS))) - # Copy systemd files to a location available for dh_installinit - cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server.mariadb.service - cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server.mariadb.socket - cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server.mariadb-extra.socket - cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server.mariadb@.service - cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server.mariadb@.socket - cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server.mariadb-extra@.socket -endif - # Run 'make install' without output since it is uninteresting and # silencing it helps to make overall build log shorter and more readable @echo "Running $(MAKE) install DESTDIR=$(TMP) ..." @@ -184,8 +168,8 @@ endif # Move test plugins that are only needed by the client to the libmariadb path mv -v $(TMP)/usr/lib/mysql/plugin/qa_auth_client.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/ -override_dh_systemd_enable: - dh_systemd_enable --name=mariadb +override_dh_installsystemd: + dh_systemd_enable --name=mariadb mariadb.service dh_systemd_enable --no-enable --name=mariadb mariadb.socket dh_systemd_enable --no-enable --name=mariadb-extra mariadb-extra.socket dh_systemd_enable --no-enable --name=mariadb@ mariadb.socket @@ -195,7 +179,7 @@ override_dh_systemd_enable: # Start MariaDB at sequence number 19 before 20 where apache, proftpd etc gets # started which might depend on a running database server. override_dh_installinit-arch: - dh_installinit --name=mariadb --no-start -- defaults 19 21 + dh_installinit --name=mariadb -- defaults 19 21 dh_systemd_start --restart-after-upgrade # Use custom server version string variable diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 34a83d19e32..0bcbb4f5f6a 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIRS}) # Default install component for the files is Server here SET(MYSQL_INSTALL_COMPONENT Server) diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 51b65b274ee..fbc415ce0d4 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -50,10 +50,6 @@ ADD_DEFINITIONS(-UMYSQL_SERVER) ADD_DEFINITIONS(-DPCRE_STATIC=1) ADD_DEFINITIONS(${SSL_DEFINES}) -IF(PMEM_FOUND) - ADD_COMPILE_FLAGS(xtrabackup.cc COMPILE_FLAGS "-DHAVE_PMEM") -ENDIF() - MYSQL_ADD_EXECUTABLE(mariadb-backup xtrabackup.cc innobackupex.cc diff --git a/extra/mariabackup/aria_backup_client.cc b/extra/mariabackup/aria_backup_client.cc index 1ea1486d7cb..25468148fe4 100644 --- a/extra/mariabackup/aria_backup_client.cc +++ b/extra/mariabackup/aria_backup_client.cc @@ -752,7 +752,7 @@ repeat: goto exit; } DBUG_ASSERT(file_offset <= static_cast(stat_info.st_size)); - to_copy_size = static_cast(stat_info.st_size) - file_offset; + to_copy_size = static_cast(stat_info.st_size - file_offset); to_copy_size = to_copy_size >= TRANSLOG_PAGE_SIZE ? (align_down(to_copy_size, TRANSLOG_PAGE_SIZE) - TRANSLOG_PAGE_SIZE) : 0; } diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 70fa09559ae..e60f6455e1e 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1356,7 +1356,7 @@ out: lsn_t server_lsn_after_lock; extern void backup_wait_for_lsn(lsn_t lsn); -/** Release resources after backup_start() */ +/** Release resources after backup_files() */ void backup_release() { if (opt_lock_ddl_per_table) { @@ -1372,7 +1372,7 @@ void backup_release() static const char *default_buffer_pool_file = "ib_buffer_pool"; -/** Finish after backup_start() and backup_release() */ +/** Finish after backup_files() and backup_release() */ bool backup_finish(ds_ctxt *ds_data) { /* Copy buffer pool dump or LRU dump */ diff --git a/extra/mariabackup/backup_copy.h b/extra/mariabackup/backup_copy.h index b8fc2535c7a..869bfff19a3 100644 --- a/extra/mariabackup/backup_copy.h +++ b/extra/mariabackup/backup_copy.h @@ -31,9 +31,9 @@ equal_paths(const char *first, const char *second); /** Start --backup */ bool backup_files(ds_ctxt *ds_data, const char *from); -/** Release resources after backup_start() */ +/** Release resources after backup_files() */ void backup_release(); -/** Finish after backup_start() and backup_release() */ +/** Finish after backup_files() and backup_release() */ bool backup_finish(ds_ctxt *ds_data); bool apply_log_finish(); diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 8e5f4c2c56c..aad6f5766b0 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -67,7 +67,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include "backup_debug.h" char *tool_name; -char tool_args[2048]; +char tool_args[8192]; ulong mysql_server_version; @@ -1939,9 +1939,11 @@ char *make_argv(char *buf, size_t len, int argc, char **argv) if (strncmp(*argv, "--password", strlen("--password")) == 0) { arg = "--password=..."; } - left-= snprintf(buf + len - left, left, + uint l= snprintf(buf + len - left, left, "%s%c", arg, argc > 1 ? ' ' : 0); ++argv; --argc; + if (l < left) + left-= l; } return buf; diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index d71ceaac7f4..ab0c51400dd 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -72,7 +72,16 @@ static std::string get_encryption_plugin_from_cnf() plugin_load = line + 12; // remote \n at the end of string plugin_load.resize(plugin_load.size() - 1); - break; + } + + if (strncmp(line, "innodb_encrypt_tables=", 22) == 0) + { + if (!strncmp(line + 22, "ON", 2) || + !strncmp(line + 22, "1", 1)) + srv_encrypt_tables= 1; + else if (!strncmp(line + 22, "FORCE", 5) || + !strncmp(line + 22, "2", 1)) + srv_encrypt_tables= 2; } } fclose(f); @@ -163,6 +172,17 @@ void encryption_plugin_backup_init(MYSQL *mysql) mysql_free_result(result); } + result = xb_mysql_query(mysql, "select @@innodb_encrypt_tables", true, true); + row = mysql_fetch_row(result); + if (!row); + else if (const char *r= row[0]) + { + if (!strcmp(r, "ON")) srv_encrypt_tables= 1; + else if (!strcmp(r, "FORCE")) srv_encrypt_tables= 2; + oss << "innodb_encrypt_tables=" << r << std::endl; + } + + mysql_free_result(result); encryption_plugin_config = oss.str(); argc = 0; diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 08936d122b2..be871e4a65f 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -236,6 +236,9 @@ xb_fil_cur_open( return(XB_FIL_CUR_SUCCESS); } +/* Stack usage 131224 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static bool page_is_corrupted(const byte *page, ulint page_no, const xb_fil_cur_t *cursor, const fil_space_t *space) @@ -339,6 +342,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no, return buf_page_is_corrupted(true, page, space->flags); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** Reads and verifies the next block of pages from the source file. Positions the cursor after the last read non-corrupted page. diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 453a283a25b..db31553999a 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB Originally Created 3/3/2009 Yasufumi Kinoshita Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko, Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz. -(c) 2017, 2022, MariaDB Corporation. +(c) 2017, 2024, MariaDB Corporation. Portions written by Marko Mäkelä. This program is free software; you can redistribute it and/or modify @@ -379,8 +379,8 @@ static my_bool opt_check_privileges; extern const char *innodb_checksum_algorithm_names[]; extern TYPELIB innodb_checksum_algorithm_typelib; -extern const char *innodb_flush_method_names[]; extern TYPELIB innodb_flush_method_typelib; +extern TYPELIB innodb_doublewrite_typelib; /** Ignored option */ static ulong innodb_flush_method; @@ -1858,8 +1858,8 @@ struct my_option xb_server_options[] = &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer during --prepare.", - (G_PTR*) &srv_use_doublewrite_buf, - (G_PTR*) &srv_use_doublewrite_buf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (G_PTR*) &buf_dblwr.use, (G_PTR*) &buf_dblwr.use, + &innodb_doublewrite_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_io_capacity", OPT_INNODB_IO_CAPACITY, "Number of IOPs the server can do. Tunes the background IO rate", (G_PTR*) &srv_io_capacity, (G_PTR*) &srv_io_capacity, @@ -1891,8 +1891,8 @@ struct my_option xb_server_options[] = {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE, "Redo log buffer size in bytes.", (G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0, - IF_WIN(GET_ULL,GET_ULONG), REQUIRED_ARG, 2U << 20, - 2U << 20, SIZE_T_MAX, 0, 4096, 0}, + GET_UINT, REQUIRED_ARG, 2U << 20, + 2U << 20, log_sys.buf_size_max, 0, 4096, 0}, #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", @@ -1988,7 +1988,7 @@ struct my_option xb_server_options[] = &aria_log_dir_path, &aria_log_dir_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file " + {"open_files_limit", 0, "the maximum number of file " "descriptors to reserve with setrlimit().", (G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0}, diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl index 66596ad9e1d..8970ff4c340 160000 --- a/extra/wolfssl/wolfssl +++ b/extra/wolfssl/wolfssl @@ -1 +1 @@ -Subproject commit 66596ad9e1d7efa8479656872cf09c9c1870a02e +Subproject commit 8970ff4c34034dbb3594943d11f8c9d4c5512bd5 diff --git a/include/my_attribute.h b/include/my_attribute.h index c8e980702b6..25d21d5e787 100644 --- a/include/my_attribute.h +++ b/include/my_attribute.h @@ -70,5 +70,19 @@ # endif /* GNUC >= 3.1 */ #endif +/* Define pragmas to disable warnings for stack frame checking */ +#if defined(__clang__) +#define PRAGMA_DISABLE_CHECK_STACK_FRAME \ +_Pragma("clang diagnostic push") \ +_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"") + +#define PRAGMA_REENABLE_CHECK_STACK_FRAME \ +_Pragma("clang diagnostic pop") + +#else +#define PRAGMA_DISABLE_CHECK_STACK_FRAME +#define PRAGMA_REENABLE_CHECK_STACK_FRAME #endif + +#endif /* _my_attribute_h */ diff --git a/include/my_sys.h b/include/my_sys.h index 72e26afe93d..8ce95519977 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -154,7 +154,7 @@ char *guess_malloc_library(); void sf_report_leaked_memory(my_thread_id id); int sf_sanity(); extern my_thread_id (*sf_malloc_dbug_id)(void); -#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X) +#define SAFEMALLOC_REPORT_MEMORY(X) if (!sf_leaking_memory) sf_report_leaked_memory(X) #else #define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0) #endif @@ -663,6 +663,7 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, myf MyFlags); extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); +extern void (*my_sleep_for_space)(unsigned int seconds); /* implemented in my_memmem.c */ extern void *my_memmem(const void *haystack, size_t haystacklen, diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index 63d1a42c1bd..be3fedd923d 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -19,13 +19,12 @@ #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) - {"ssl", OPT_SSL_SSL, + {"ssl", 0, "Enable SSL for connection (automatically enabled with other flags).", &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ssl-ca", OPT_SSL_CA, "CA file in PEM format (check OpenSSL docs, implies --ssl).", - &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, + &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ssl-capath", OPT_SSL_CAPATH, "CA directory (check OpenSSL docs, implies --ssl).", &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, @@ -46,13 +45,12 @@ "Certificate revocation list path (implies --ssl).", &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tls-version", OPT_TLS_VERSION, - "TLS protocol version for secure connection.", + {"tls-version", 0, "TLS protocol version for secure connection.", &opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifdef MYSQL_CLIENT - {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, + {"ssl-verify-server-cert", 0, "Verify server's \"Common Name\" in its cert against hostname used " "when connecting. This option is disabled by default.", &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert, diff --git a/libmariadb b/libmariadb index e714a674827..923a0092e35 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit e714a674827fbb8373dd71da634dd04736d7b5a6 +Subproject commit 923a0092e3508b9567b0d695e72eb4d58bf15c8f diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index c22aee4e5ad..dc24d8730c7 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -25,7 +25,7 @@ ${CMAKE_SOURCE_DIR}/tpool ${CMAKE_BINARY_DIR}/sql ${PCRE_INCLUDE_DIRS} ${LIBFMT_INCLUDE_DIR} -${ZLIB_INCLUDE_DIR} +${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${SSL_INTERNAL_INCLUDE_DIRS} ) @@ -184,7 +184,7 @@ ENDIF() SET(LIBS dbug strings mysys mysys_ssl pcre2-8 vio - ${ZLIB_LIBRARY} ${SSL_LIBRARIES} + ${ZLIB_LIBRARIES} ${SSL_LIBRARIES} ${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${EMBEDDED_PLUGIN_LIBS} sql_embedded diff --git a/mysql-test/collections/buildbot_suites.bat b/mysql-test/collections/buildbot_suites.bat index d4a6e665840..13ea5ddb949 100644 --- a/mysql-test/collections/buildbot_suites.bat +++ b/mysql-test/collections/buildbot_suites.bat @@ -1,5 +1,5 @@ if "%MTR_PARALLEL%"=="" set MTR_PARALLEL=%NUMBER_OF_PROCESSORS% -perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^ +perl mysql-test-run.pl --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^ vcol,gcol,perfschema,^ main,^ innodb,^ diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index db3ce429bac..152b2f32072 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -112,8 +112,7 @@ sub print_gcov_for_diff { $acc.=sprintf '%9s:%5s:%s', '', $lnum, $' if /^ /; ++$printme, $acc.=sprintf '%9s:%5s:%s', gcov_prefix($fcov->{$lnum}), $lnum, $' if /^\+/; die "$_^^^ dying", unless /^[- +]/; - ++$lnum; - --$cnt; + ++$lnum, --$cnt unless /^-/; } print $acc if $printme; close PIPE or die "command '$cmd' failed: $!: $?"; diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index c696613dab3..132fdcff7bd 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -613,13 +613,17 @@ call p_verify_status_increment(2, 0, 2, 0); drop table t2; set sql_mode=no_engine_substitution; create temporary table t2 (a int); -call p_verify_status_increment(1, 0, 0, 0); +# One commit for the create temporary table, and two for committing the +# read of the stored procedure from Aria table (creating temporary table +# clears the sp cache). +call p_verify_status_increment(3, 0, 2, 0); set sql_mode=default; --echo # 19. A function changes temp-trans-table. --echo # select f1(); ---echo # Two commits because a binary log record is written -call p_verify_status_increment(2, 0, 1, 0); +--echo # Two commits because a binary log record is written, and another two +--echo # as the function f1() is reloaded after creating temporary table. +call p_verify_status_increment(4, 0, 3, 0); commit; call p_verify_status_increment(2, 0, 1, 0); @@ -672,9 +676,11 @@ call p_verify_status_increment(2, 0, 1, 0); --echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction --echo # drop temporary table t2; -call p_verify_status_increment(1, 0, 1, 0); +# Dropping temporary table clears SP caches, so get another two commit +# increments from loading the p_verify_status_increment procedure. +call p_verify_status_increment(3, 0, 2, 0); commit; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(1, 0, 0, 0); --echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit --echo # @@ -721,7 +727,9 @@ call p_verify_status_increment(1, 0, 1, 0); create table t2 (a int); call p_verify_status_increment(0, 0, 0, 0); do (select f1() from t1 where a=2); -call p_verify_status_increment(2, 2, 2, 2); +# Again extra 2 commit increments from re-loading function f1 after +# dropping temporary table. +call p_verify_status_increment(4, 2, 4, 2); commit; call p_verify_status_increment(2, 2, 2, 2); diff --git a/mysql-test/include/crash_mysqld.inc b/mysql-test/include/crash_mysqld.inc index 4190d24d801..89bc8ced416 100644 --- a/mysql-test/include/crash_mysqld.inc +++ b/mysql-test/include/crash_mysqld.inc @@ -4,7 +4,7 @@ --source include/not_embedded.inc # Write file to make mysql-test-run.pl expect crash and restart ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Setup the mysqld to crash at shutdown SET debug_dbug="d,crash_shutdown"; diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 89d0d779627..06a4ff15086 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -71,7 +71,7 @@ loose-performance-schema-hosts-size=100 loose-performance-schema-users-size=100 loose-performance-schema-max-mutex-instances=5000 loose-performance-schema-max-rwlock-instances=5000 -loose-performance-schema-max-cond-instances=1000 +loose-performance-schema-max-cond-instances=1500 loose-performance-schema-max-file-instances=10000 loose-performance-schema-max-socket-instances=1000 loose-performance-schema-max-table-instances=500 @@ -91,7 +91,7 @@ loose-performance-schema-events-statements-history-size=10 loose-performance-schema-events-statements-history-long-size=1000 loose-performance-schema-events-transactions-history-size=10 loose-performance-schema-events-transactions-history-long-size=1000 -loose-performance-schema-max-thread-instances=200 +loose-performance-schema-max-thread-instances=400 loose-performance-schema-session-connect-attrs-size=2048 loose-performance-schema-max-metadata-locks=10000 diff --git a/mysql-test/include/expect_crash.inc b/mysql-test/include/expect_crash.inc index b4bd9828a08..56abc88ae24 100644 --- a/mysql-test/include/expect_crash.inc +++ b/mysql-test/include/expect_crash.inc @@ -2,4 +2,4 @@ --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect # There should be a debug crash after using this .inc file ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc index 48b5bc631db..12708bfcc5f 100644 --- a/mysql-test/include/galera_cluster.inc +++ b/mysql-test/include/galera_cluster.inc @@ -13,10 +13,8 @@ if (!$galera_cluster_size) } --source include/galera_init.inc ---source include/have_innodb.inc --source include/galera_wait_ready.inc - --let $_galera_node= $galera_cluster_size while ($_galera_node != 1) diff --git a/mysql-test/include/have_innodb.combinations b/mysql-test/include/have_innodb.combinations deleted file mode 100644 index f1131c448f3..00000000000 --- a/mysql-test/include/have_innodb.combinations +++ /dev/null @@ -1,39 +0,0 @@ -[innodb_plugin] -ignore-builtin-innodb -plugin-load-add=$HA_INNODB_SO -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual -innodb-metrics - -[innodb] -innodb -innodb-cmpmem -innodb-cmp-per-index -innodb-trx -innodb-locks -innodb-lock-waits -innodb-metrics -innodb-buffer-pool-stats -innodb-buffer-page -innodb-buffer-page-lru -innodb-sys-columns -innodb-sys-fields -innodb-sys-foreign -innodb-sys-foreign-cols -innodb-sys-indexes -innodb-sys-tables -innodb-sys-virtual diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 8c9cdb54363..1e853d186b1 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -3,6 +3,11 @@ # will be skipped unless innodb is enabled # --disable_query_log +if (`select version() like '%debug%'`) +{ +SET STATEMENT sql_log_bin=0 FOR +call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations"); +} if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like 'MSAN%'`) { SET STATEMENT sql_log_bin=0 FOR diff --git a/mysql-test/include/have_innodb.opt b/mysql-test/include/have_innodb.opt new file mode 100644 index 00000000000..0a6d4d9c819 --- /dev/null +++ b/mysql-test/include/have_innodb.opt @@ -0,0 +1,17 @@ +--innodb +--innodb-cmpmem +--innodb-cmp-per-index +--innodb-trx +--innodb-locks +--innodb-lock-waits +--innodb-metrics +--innodb-buffer-pool-stats +--innodb-buffer-page +--innodb-buffer-page-lru +--innodb-sys-columns +--innodb-sys-fields +--innodb-sys-foreign +--innodb-sys-foreign-cols +--innodb-sys-indexes +--innodb-sys-tables +--innodb-sys-virtual diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc index 7eb8b4372cf..33ff58b93ab 100644 --- a/mysql-test/include/have_wsrep_enabled.inc +++ b/mysql-test/include/have_wsrep_enabled.inc @@ -1,8 +1,6 @@ # To be used in a test which requires wsrep plugin to be ACTIVE and enabled # (i.e. wsrep_on=ON). It includes have_wsrep.inc. ---source include/have_innodb.inc - if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_on' AND VARIABLE_VALUE='ON'`) { --skip Test requires wsrep_on=ON diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc index 883b0820589..d41e1f1ec9f 100644 --- a/mysql-test/include/innodb_rollback_on_timeout.inc +++ b/mysql-test/include/innodb_rollback_on_timeout.inc @@ -1,4 +1,3 @@ ---source include/have_innodb.inc # # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" diff --git a/mysql-test/include/kill_and_restart_mysqld.inc b/mysql-test/include/kill_and_restart_mysqld.inc index b67fb7350b4..50b28bcd494 100644 --- a/mysql-test/include/kill_and_restart_mysqld.inc +++ b/mysql-test/include/kill_and_restart_mysqld.inc @@ -7,7 +7,7 @@ if (!$restart_parameters) --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --echo # Kill and $restart_parameters ---exec echo "$restart_parameters" > $_expect_file_name +--write_line "$restart_parameters" $_expect_file_name --shutdown_server 0 --source include/wait_until_disconnected.inc --enable_reconnect diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc index aba672d8a89..887e21f5f79 100644 --- a/mysql-test/include/kill_galera.inc +++ b/mysql-test/include/kill_galera.inc @@ -3,7 +3,7 @@ # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name # Kill the connected server --disable_reconnect diff --git a/mysql-test/include/kill_mysqld.inc b/mysql-test/include/kill_mysqld.inc index 01ee7f82bdc..a41af2d74a6 100644 --- a/mysql-test/include/kill_mysqld.inc +++ b/mysql-test/include/kill_mysqld.inc @@ -2,6 +2,6 @@ --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --echo # Kill the server ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name --shutdown_server 0 --source include/wait_until_disconnected.inc diff --git a/mysql-test/include/rpl_change_topology.inc b/mysql-test/include/rpl_change_topology.inc index b63700b059b..ddaf90a9cf0 100644 --- a/mysql-test/include/rpl_change_topology.inc +++ b/mysql-test/include/rpl_change_topology.inc @@ -96,10 +96,11 @@ # Remove whitespace from $rpl_topology --let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')` +--source include/slow_environ.inc + --let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology] --source include/begin_include_file.inc - if ($rpl_debug) { --echo ---- Check input ---- @@ -235,11 +236,11 @@ if (!$rpl_skip_change_master) } if ($rpl_master_log_file) { - eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1, MASTER_USE_GTID=NO; + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1$_timeout_adjustment, MASTER_USE_GTID=NO; } if (!$rpl_master_log_file) { - eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1; + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1$_timeout_adjustment; } } if ($_rpl_master == '') diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc index 932fc9da7ef..0479dbbd8ac 100644 --- a/mysql-test/include/rpl_start_server.inc +++ b/mysql-test/include/rpl_start_server.inc @@ -49,7 +49,7 @@ if ($rpl_server_parameters) --source include/rpl_connection.inc # Write file to make mysql-test-run.pl start up the server again ---exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect if (!$rpl_server_error) { diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc index 470e86a139d..1e4a64cca25 100644 --- a/mysql-test/include/rpl_stop_server.inc +++ b/mysql-test/include/rpl_stop_server.inc @@ -44,7 +44,7 @@ if ($rpl_debug) # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect # Send shutdown to the connected server and give # it 60 seconds (of mysqltest's default) to die before zapping it diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc index 1c23b356c4d..ab3c95fce3c 100644 --- a/mysql-test/include/search_pattern_in_file.inc +++ b/mysql-test/include/search_pattern_in_file.inc @@ -36,7 +36,7 @@ # let SEARCH_FILE= $error_log; # # Stop the server # let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; -# --exec echo "wait" > $restart_file +# --write_line wait $restart_file # --shutdown_server # --source include/wait_until_disconnected.inc # diff --git a/mysql-test/include/shutdown_mysqld.inc b/mysql-test/include/shutdown_mysqld.inc index fc2972560c3..1684d81970a 100644 --- a/mysql-test/include/shutdown_mysqld.inc +++ b/mysql-test/include/shutdown_mysqld.inc @@ -24,18 +24,15 @@ if ($rpl_inited) # Write file to make mysql-test-run.pl expect the "crash", but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name # Avoid warnings from connection threads that does not have time to exit --disable_query_log set @@global.log_warnings=0; --enable_query_log ---let $server_shutdown_timeout= 60 -if ($VALGRIND_TEST) -{ - --let $server_shutdown_timeout= 300 -} +--source include/slow_environ.inc +--let $server_shutdown_timeout= 60$_timeout_adjustment if ($shutdown_timeout) { diff --git a/mysql-test/include/slow_environ.inc b/mysql-test/include/slow_environ.inc new file mode 100644 index 00000000000..761147fd288 --- /dev/null +++ b/mysql-test/include/slow_environ.inc @@ -0,0 +1,9 @@ +if (!$slow_environ_check) +{ + let $_timeout_adjustment=; + if (`select $VALGRIND_TEST + count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like '%SAN%'`) + { + let $_timeout_adjustment=0; + } + let $slow_environ_check=1; +} diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc index 6e448cb2efd..91b06997d6e 100644 --- a/mysql-test/include/start_mysqld.inc +++ b/mysql-test/include/start_mysqld.inc @@ -21,7 +21,7 @@ if ($restart_bindir) if ($restart_parameters) { - --exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name + --write_line "$restart_cmd: $restart_parameters" $_expect_file_name if (!$restart_noprint) { --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -34,7 +34,7 @@ if ($restart_parameters) } if (!$restart_parameters) { - --exec echo "$restart_cmd" > $_expect_file_name + --write_line "$restart_cmd" $_expect_file_name if ($restart_noprint < 2) { --exec echo "# $restart_cmd" diff --git a/mysql-test/include/stop_slave_io.inc b/mysql-test/include/stop_slave_io.inc index ddc83782311..a9d97f2f8a1 100644 --- a/mysql-test/include/stop_slave_io.inc +++ b/mysql-test/include/stop_slave_io.inc @@ -34,8 +34,17 @@ if (!$rpl_debug) --disable_query_log } - +let $_enable_warnings=0; +if ($rpl_allow_error) { + if ($ENABLED_WARNINGS) { + let $_enable_warnings=1; + disable_warnings; + } +} STOP SLAVE IO_THREAD; +if ($_enable_warnings) { + enable_warnings; +} --source include/wait_for_slave_io_to_stop.inc diff --git a/mysql-test/include/sync_slave_sql_with_io.inc b/mysql-test/include/sync_slave_sql_with_io.inc index 9efede9a61f..c16d28edbb9 100644 --- a/mysql-test/include/sync_slave_sql_with_io.inc +++ b/mysql-test/include/sync_slave_sql_with_io.inc @@ -25,11 +25,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 300; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1500; - } + source include/slow_environ.inc; + let $_slave_timeout= 300$_timeout_adjustment; } --let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) diff --git a/mysql-test/include/sync_with_master_gtid.inc b/mysql-test/include/sync_with_master_gtid.inc index 777711b979c..0ca2c90784e 100644 --- a/mysql-test/include/sync_with_master_gtid.inc +++ b/mysql-test/include/sync_with_master_gtid.inc @@ -33,11 +33,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 120; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1200; - } + source include/slow_environ.inc; + let $_slave_timeout= 120$_timeout_adjustment; } --let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)` diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index ed81c55963f..6802cd41203 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -49,11 +49,8 @@ let $_slave_timeout= $slave_timeout; if (!$_slave_timeout) { - let $_slave_timeout= 300; - if ($VALGRIND_TEST) - { - let $_slave_timeout= 1500; - } + source include/slow_environ.inc; + let $_slave_timeout= 300$_timeout_adjustment; } let $_slave_param_comparison= $slave_param_comparison; diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm index b068698e340..2ab8a3520c8 100644 --- a/mysql-test/lib/My/Debugger.pm +++ b/mysql-test/lib/My/Debugger.pm @@ -263,6 +263,7 @@ sub pre_setup() { $::opt_suite_timeout= 24 * 60; # in minutes $::opt_shutdown_timeout= ($interactive ? 24 * 60 : 3) * 60; # in seconds $::opt_start_timeout= $::opt_shutdown_timeout; # in seconds + $::opt_debug_sync_timeout= 3000; # in seconds } } diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 2b32ef87b81..f33875e14aa 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -23,7 +23,7 @@ use File::Path; use Carp; use base qw(Exporter); -our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX +our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC native_path posix_path mixed_path check_socket_path_length process_alive open_for_append); @@ -70,6 +70,14 @@ BEGIN { } } +BEGIN { + if ($^O eq "darwin") { + eval 'sub IS_MAC { 1 }'; + } + else { + eval 'sub IS_MAC { 0 }'; + } +} # # native_path diff --git a/mysql-test/main/commit_1innodb.result b/mysql-test/main/commit_1innodb.result index d090844cb74..973be9fde0d 100644 --- a/mysql-test/main/commit_1innodb.result +++ b/mysql-test/main/commit_1innodb.result @@ -634,7 +634,7 @@ SUCCESS drop table t2; set sql_mode=no_engine_substitution; create temporary table t2 (a int); -call p_verify_status_increment(1, 0, 0, 0); +call p_verify_status_increment(3, 0, 2, 0); SUCCESS set sql_mode=default; @@ -643,8 +643,9 @@ set sql_mode=default; select f1(); f1() 2 -# Two commits because a binary log record is written -call p_verify_status_increment(2, 0, 1, 0); +# Two commits because a binary log record is written, and another two +# as the function f1() is reloaded after creating temporary table. +call p_verify_status_increment(4, 0, 3, 0); SUCCESS commit; @@ -715,11 +716,11 @@ SUCCESS # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction # drop temporary table t2; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(3, 0, 2, 0); SUCCESS commit; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(1, 0, 0, 0); SUCCESS # 26. Verify that SET AUTOCOMMIT issues an implicit commit @@ -801,7 +802,7 @@ call p_verify_status_increment(0, 0, 0, 0); SUCCESS do (select f1() from t1 where a=2); -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 2, 4, 2); SUCCESS commit; diff --git a/mysql-test/main/constraints.result b/mysql-test/main/constraints.result index 143c22321ab..d2a19040083 100644 --- a/mysql-test/main/constraints.result +++ b/mysql-test/main/constraints.result @@ -235,3 +235,16 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop procedure sp; drop table t1; +# +# MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT +# This test case was added by reviewer's request. +# +PREPARE stmt FROM 'CREATE TABLE t1 (a INT)'; +EXECUTE stmt; +DROP TABLE t1; +EXECUTE stmt; +EXECUTE stmt; +ERROR 42S01: Table 't1' already exists +# Clean up +DROP TABLE t1; +DEALLOCATE PREPARE stmt; diff --git a/mysql-test/main/constraints.test b/mysql-test/main/constraints.test index 5c673f9be81..83f3394d6f6 100644 --- a/mysql-test/main/constraints.test +++ b/mysql-test/main/constraints.test @@ -189,3 +189,18 @@ call sp; show create table t1; drop procedure sp; drop table t1; + +--echo # +--echo # MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT +--echo # This test case was added by reviewer's request. +--echo # +PREPARE stmt FROM 'CREATE TABLE t1 (a INT)'; +EXECUTE stmt; +DROP TABLE t1; +EXECUTE stmt; +--error ER_TABLE_EXISTS_ERROR +EXECUTE stmt; + +--echo # Clean up +DROP TABLE t1; +DEALLOCATE PREPARE stmt; diff --git a/mysql-test/main/crash_commit_before.test b/mysql-test/main/crash_commit_before.test index 93b96de6e53..30b59ce4480 100644 --- a/mysql-test/main/crash_commit_before.test +++ b/mysql-test/main/crash_commit_before.test @@ -17,7 +17,7 @@ insert into t1 values(9); SET GLOBAL debug_dbug="d,crash_commit_before"; # Write file to make mysql-test-run.pl expect crash and restart ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Run the crashing query --error 2013 diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index d6c68fdd917..9db7d5ca844 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -1803,7 +1803,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `color` char(32) GENERATED ALWAYS AS (column_get(`dynamic_cols`,1 as char charset latin1)) STORED, - `cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) STORED, + `cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 collate latin1_swedish_ci ),2,'ttt'),`i` as char charset latin1)) STORED, `item_name` varchar(32) NOT NULL, `i` int(11) DEFAULT NULL, `dynamic_cols` blob DEFAULT NULL, diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result index f588374a26f..bc4ef5ca644 100644 --- a/mysql-test/main/ddl_i18n_koi8r.result +++ b/mysql-test/main/ddl_i18n_koi8r.result @@ -719,6 +719,7 @@ ca cb utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1723,6 +1725,7 @@ koi8r_general_ci utf8mb3_general_ci koi8r_general_ci koi8r_general_ci utf8mb3_ge DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1805,6 +1808,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2491,6 +2495,7 @@ COLLATION( ' END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8mb3_unicode_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2558,6 +2563,7 @@ DELIMITER ; ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result index cb57bc5e9df..9561c914302 100644 --- a/mysql-test/main/ddl_i18n_utf8.result +++ b/mysql-test/main/ddl_i18n_utf8.result @@ -719,6 +719,7 @@ ca cb utf8mb3_general_ci utf8mb3_general_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1723,6 +1725,7 @@ utf8mb3_general_ci utf8mb3_general_ci koi8r_general_ci utf8mb3_general_ci utf8mb DELETE FROM mysqltest2.log| ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -1805,6 +1808,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ; ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2491,6 +2495,7 @@ COLLATION( 'текст') AS c4, END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 utf8mb3 utf8mb3_general_ci utf8mb3_unicode_ci ---> Dump of mysqltest1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; @@ -2558,6 +2563,7 @@ DELIMITER ; ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql ---> Dump of mysqltest2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */; diff --git a/mysql-test/main/delete_innodb.result b/mysql-test/main/delete_innodb.result index 662c0c558ea..c171e8d0fe0 100644 --- a/mysql-test/main/delete_innodb.result +++ b/mysql-test/main/delete_innodb.result @@ -69,4 +69,518 @@ c1 5 6 DROP TABLE t1, t2; +# +# MDEV-33533: multi-delete using rowid filter +# +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +create index i_n_name on nation(n_name); +analyze table +nation, lineitem, customer, orders, part, supplier, partsupp, region +persistent for all; +Table Op Msg_type Msg_text +dbt3_s001.nation analyze status Engine-independent statistics collected +dbt3_s001.nation analyze status OK +dbt3_s001.lineitem analyze status Engine-independent statistics collected +dbt3_s001.lineitem analyze status OK +dbt3_s001.customer analyze status Engine-independent statistics collected +dbt3_s001.customer analyze status OK +dbt3_s001.orders analyze status Engine-independent statistics collected +dbt3_s001.orders analyze status OK +dbt3_s001.part analyze status Engine-independent statistics collected +dbt3_s001.part analyze status OK +dbt3_s001.supplier analyze status Engine-independent statistics collected +dbt3_s001.supplier analyze status OK +dbt3_s001.partsupp analyze status Engine-independent statistics collected +dbt3_s001.partsupp analyze status OK +dbt3_s001.region analyze status Engine-independent statistics collected +dbt3_s001.region analyze status OK +explain +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE nation ref PRIMARY,i_n_name i_n_name 26 const 1 Using where; Using index +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter +explain format=json +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "cost": "COST_REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "nation", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_n_name"], + "key": "i_n_name", + "key_length": "26", + "used_key_parts": ["n_name"], + "ref": ["const"], + "loops": 1, + "rows": 1, + "cost": "COST_REPLACED", + "filtered": 100, + "attached_condition": "nation.n_name = 'PERU'", + "using_index": true + } + }, + { + "table": { + "table_name": "customer", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_c_nationkey"], + "key": "i_c_nationkey", + "key_length": "5", + "used_key_parts": ["c_nationkey"], + "ref": ["dbt3_s001.nation.n_nationkey"], + "loops": 1, + "rows": 6, + "cost": "COST_REPLACED", + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "orders", + "access_type": "ref", + "possible_keys": ["i_o_orderdate", "i_o_custkey"], + "key": "i_o_custkey", + "key_length": "5", + "used_key_parts": ["o_custkey"], + "ref": ["dbt3_s001.customer.c_custkey"], + "rowid_filter": { + "range": { + "key": "i_o_orderdate", + "used_key_parts": ["o_orderDATE"] + }, + "rows": 119, + "selectivity_pct": 7.933333333 + }, + "loops": 6, + "rows": 15, + "cost": "COST_REPLACED", + "filtered": 7.933333397, + "attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'" + } + } + ] + } +} +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +create table t as +select orders.* from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +explain +delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE nation ref PRIMARY,i_n_name i_n_name 26 const 1 Using where; Using index +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter +explain format=json +delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "cost": "COST_REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "nation", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_n_name"], + "key": "i_n_name", + "key_length": "26", + "used_key_parts": ["n_name"], + "ref": ["const"], + "loops": 1, + "rows": 1, + "cost": "COST_REPLACED", + "filtered": 100, + "attached_condition": "nation.n_name = 'PERU'", + "using_index": true + } + }, + { + "table": { + "table_name": "customer", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_c_nationkey"], + "key": "i_c_nationkey", + "key_length": "5", + "used_key_parts": ["c_nationkey"], + "ref": ["dbt3_s001.nation.n_nationkey"], + "loops": 1, + "rows": 6, + "cost": "COST_REPLACED", + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "orders", + "access_type": "ref", + "possible_keys": ["i_o_orderdate", "i_o_custkey"], + "key": "i_o_custkey", + "key_length": "5", + "used_key_parts": ["o_custkey"], + "ref": ["dbt3_s001.customer.c_custkey"], + "rowid_filter": { + "range": { + "key": "i_o_orderdate", + "used_key_parts": ["o_orderDATE"] + }, + "rows": 119, + "selectivity_pct": 7.933333333 + }, + "loops": 6, + "rows": 15, + "cost": "COST_REPLACED", + "filtered": 7.933333397, + "attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'" + } + } + ] + } +} +delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +insert into orders select * from t; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +prepare stmt from " +delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +"; +execute stmt; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +insert into orders select * from t; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +execute stmt; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +insert into orders select * from t; +select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and +c_nationkey = n_nationkey and +n_name='PERU'; +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +deallocate prepare stmt; +drop table t; +explain +select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY nation ref PRIMARY,i_n_name i_n_name 26 const 1 Using where; Using index +1 PRIMARY customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 PRIMARY orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter +explain format=json +select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "cost": "COST_REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "nation", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_n_name"], + "key": "i_n_name", + "key_length": "26", + "used_key_parts": ["n_name"], + "ref": ["const"], + "loops": 1, + "rows": 1, + "cost": "COST_REPLACED", + "filtered": 100, + "attached_condition": "nation.n_name = 'PERU'", + "using_index": true + } + }, + { + "table": { + "table_name": "customer", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_c_nationkey"], + "key": "i_c_nationkey", + "key_length": "5", + "used_key_parts": ["c_nationkey"], + "ref": ["dbt3_s001.nation.n_nationkey"], + "loops": 1, + "rows": 6, + "cost": "COST_REPLACED", + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "orders", + "access_type": "ref", + "possible_keys": ["i_o_orderdate", "i_o_custkey"], + "key": "i_o_custkey", + "key_length": "5", + "used_key_parts": ["o_custkey"], + "ref": ["dbt3_s001.customer.c_custkey"], + "rowid_filter": { + "range": { + "key": "i_o_orderdate", + "used_key_parts": ["o_orderDATE"] + }, + "rows": 119, + "selectivity_pct": 7.933333333 + }, + "loops": 6, + "rows": 15, + "cost": "COST_REPLACED", + "filtered": 7.933333397, + "attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'" + } + } + ] + } +} +select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +create table t as +select * from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +explain +delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY nation ref PRIMARY,i_n_name i_n_name 26 const 1 Using where; Using index +1 PRIMARY customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 PRIMARY orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter +explain format=json +delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "cost": "COST_REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "nation", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_n_name"], + "key": "i_n_name", + "key_length": "26", + "used_key_parts": ["n_name"], + "ref": ["const"], + "loops": 1, + "rows": 1, + "cost": "COST_REPLACED", + "filtered": 100, + "attached_condition": "nation.n_name = 'PERU'", + "using_index": true + } + }, + { + "table": { + "table_name": "customer", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_c_nationkey"], + "key": "i_c_nationkey", + "key_length": "5", + "used_key_parts": ["c_nationkey"], + "ref": ["dbt3_s001.nation.n_nationkey"], + "loops": 1, + "rows": 6, + "cost": "COST_REPLACED", + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "orders", + "access_type": "ref", + "possible_keys": ["i_o_orderdate", "i_o_custkey"], + "key": "i_o_custkey", + "key_length": "5", + "used_key_parts": ["o_custkey"], + "ref": ["dbt3_s001.customer.c_custkey"], + "rowid_filter": { + "range": { + "key": "i_o_orderdate", + "used_key_parts": ["o_orderDATE"] + }, + "rows": 119, + "selectivity_pct": 7.933333333 + }, + "loops": 6, + "rows": 15, + "cost": "COST_REPLACED", + "filtered": 7.933333397, + "attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'" + } + } + ] + } +} +delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +o_orderkey o_totalprice +insert into orders select * from t; +select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey in (select c_custkey from customer +where c_nationkey in (select n_nationkey from nation +where n_name='PERU')); +o_orderkey o_totalprice +1729 12137.76 +2880 145761.99 +3142 16030.15 +5095 184583.99 +5121 150334.57 +5382 138423.03 +644 201268.06 +737 12984.85 +drop table t; +DROP DATABASE dbt3_s001; +set default_storage_engine=@save_default_storage_engine; +# +# Additional tests of first table and rowid filter +# +CREATE DATABASE dbt3_s001; +use dbt3_s001; +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; +CREATE INDEX i_l_quantity ON lineitem(l_quantity); +CREATE INDEX i_o_totalprice ON orders(o_totalprice); +ANALYZE TABLE lineitem, orders; +Table Op Msg_type Msg_text +dbt3_s001.lineitem analyze status Engine-independent statistics collected +dbt3_s001.lineitem analyze status OK +dbt3_s001.orders analyze status Engine-independent statistics collected +dbt3_s001.orders analyze status OK +set optimizer_use_condition_selectivity=2; +create table second(s_receiptDATE date, filler char(100), key(s_receiptDATE)) ; +insert into second select date_add(l_receiptDATE, interval 1 day), 'helllo' from lineitem ; +select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); +count(*) +114 +# lineitem should be first and with "Using rowid filter" +explain delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_quantity|i_l_shipdate 9|4 NULL 349 (8%) Using where; Using rowid filter +1 SIMPLE second ref s_receiptDATE s_receiptDATE 4 func 1 Using where; Using index +delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); +# Should be 0 +select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); +count(*) +0 +drop database dbt3_s001; +set default_storage_engine=@save_default_storage_engine; End of 11.1 tests diff --git a/mysql-test/main/delete_innodb.test b/mysql-test/main/delete_innodb.test index e29cf3fa922..86c32732ad9 100644 --- a/mysql-test/main/delete_innodb.test +++ b/mysql-test/main/delete_innodb.test @@ -49,4 +49,175 @@ analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1; select * from t1; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-33533: multi-delete using rowid filter +--echo # + +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; + +CREATE DATABASE dbt3_s001; + +use dbt3_s001; + +--disable_query_log +--disable_result_log +--disable_warnings +--source include/dbt3_s001.inc +--enable_warnings +--enable_result_log +--enable_query_log + +create index i_n_name on nation(n_name); +analyze table + nation, lineitem, customer, orders, part, supplier, partsupp, region +persistent for all; + +let $c1= + o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey = c_custkey and + c_nationkey = n_nationkey and + n_name='PERU'; + +eval +explain +select o_orderkey, o_totalprice from orders, customer, nation where $c1; +--source include/explain-no-costs.inc +eval +explain format=json +select o_orderkey, o_totalprice from orders, customer, nation where $c1; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; +eval +create table t as +select orders.* from orders, customer, nation where $c1; + +eval +explain +delete from orders using orders, customer, nation where $c1; +--source include/explain-no-costs.inc +eval +explain format=json +delete from orders using orders, customer, nation where $c1; +eval +delete from orders using orders, customer, nation where $c1; +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; + +insert into orders select * from t; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; + +eval +prepare stmt from " +delete from orders using orders, customer, nation where $c1; +"; + +execute stmt; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; +insert into orders select * from t; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; + +execute stmt; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; +insert into orders select * from t; +--sorted_result +eval +select o_orderkey, o_totalprice from orders, customer, nation where $c1; + +deallocate prepare stmt; + +drop table t; + +let $c1= + o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey in (select c_custkey from customer + where c_nationkey in (select n_nationkey from nation + where n_name='PERU')); + +eval +explain +select o_orderkey, o_totalprice from orders where $c1; +--source include/explain-no-costs.inc +eval +explain format=json +select o_orderkey, o_totalprice from orders where $c1; +--sorted_result +eval +select o_orderkey, o_totalprice from orders where $c1; +eval +create table t as +select * from orders where $c1; + +eval +explain +delete from orders where $c1; +--source include/explain-no-costs.inc +eval +explain format=json +delete from orders where $c1; +eval +delete from orders where $c1; +eval +select o_orderkey, o_totalprice from orders where $c1; + +insert into orders select * from t; +--sorted_result +eval +select o_orderkey, o_totalprice from orders where $c1; +drop table t; + +DROP DATABASE dbt3_s001; + +set default_storage_engine=@save_default_storage_engine; + +--echo # +--echo # Additional tests of first table and rowid filter +--echo # + +CREATE DATABASE dbt3_s001; + +use dbt3_s001; + +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; + +--disable_query_log +--disable_result_log +--disable_warnings +--source include/dbt3_s001.inc +--enable_warnings +--enable_result_log +--enable_query_log + +CREATE INDEX i_l_quantity ON lineitem(l_quantity); +CREATE INDEX i_o_totalprice ON orders(o_totalprice); +ANALYZE TABLE lineitem, orders; +set optimizer_use_condition_selectivity=2; +create table second(s_receiptDATE date, filler char(100), key(s_receiptDATE)) ; +insert into second select date_add(l_receiptDATE, interval 1 day), 'helllo' from lineitem ; + +select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); + +--echo # lineitem should be first and with "Using rowid filter" +explain delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); + +delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); + +--echo # Should be 0 +select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day); + +drop database dbt3_s001; +set default_storage_engine=@save_default_storage_engine; + + --echo End of 11.1 tests diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 2fbb6da2d03..90b980bb4e0 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -906,5 +906,61 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM (SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq); a DROP TABLE t1, t2, t3; +# +# MDEV-23878: Wrong result with semi-join and splittable derived table +# +CREATE TABLE t1 ( +groupId int, +id int unsigned, +PRIMARY KEY (groupId, id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES +(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10), +(8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19); +set statement in_predicate_conversion_threshold=2 for SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +cnt +6 +set statement in_predicate_conversion_threshold=2 for EXPLAIN SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 19 +1 PRIMARY ref key0 key0 8 test.t1.groupId,test.t1.id 1 +1 PRIMARY eq_ref distinct_key distinct_key 4 test.t1.id 1 Using where +5 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +3 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 8 test.t1.groupId,test.t1.id 1 +3 LATERAL DERIVED eq_ref distinct_key distinct_key 4 test.t1.id 1 Using where +7 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +set statement optimizer_switch='split_materialized=off, loosescan=off' for +set statement in_predicate_conversion_threshold=2 for +SELECT COUNT(*) AS cnt FROM t1 +JOIN +( +SELECT groupId, id +FROM t1 +WHERE id IN (1,2,3,4,5,6) +GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); +cnt +6 +DROP TABLE t1; # End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test index acd7674786a..f0498834254 100644 --- a/mysql-test/main/derived_split_innodb.test +++ b/mysql-test/main/derived_split_innodb.test @@ -517,6 +517,48 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM DROP TABLE t1, t2, t3; +--echo # +--echo # MDEV-23878: Wrong result with semi-join and splittable derived table +--echo # + +CREATE TABLE t1 ( + groupId int, + id int unsigned, + PRIMARY KEY (groupId, id) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES + (8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10), + (8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19); + +let $query= +SELECT COUNT(*) AS cnt FROM t1 +JOIN +( + SELECT groupId, id + FROM t1 + WHERE id IN (1,2,3,4,5,6) + GROUP BY groupId, id +) AS t2 +USING (groupId, id) +WHERE id IN (1,2,3,4,5,6,7,8); + +let $tvc_conversion_threshold = + set statement in_predicate_conversion_threshold=2 for; + +eval $tvc_conversion_threshold $query; +eval $tvc_conversion_threshold EXPLAIN $query; + +let $no_split_materialized_loosescan= + set statement optimizer_switch='split_materialized=off, loosescan=off' for; + +# Correct result with split materializied optimization disabled +eval $no_split_materialized_loosescan + $tvc_conversion_threshold + $query; + +DROP TABLE t1; + --echo # End of 10.4 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result index 88cec1c50f0..64ce60b4e45 100644 --- a/mysql-test/main/dyncol.result +++ b/mysql-test/main/dyncol.result @@ -150,7 +150,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select hex(column_create(1,'afaf' AS char charset utf8mb3 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex` +Note 1003 select hex(column_create(1,'afaf' AS char charset utf8mb3 collate utf8mb3_general_ci ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex` select hex(column_create(1, 0.0 AS decimal)); hex(column_create(1, 0.0 AS decimal)) 000100010004 @@ -354,7 +354,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset utf8mb3) AS `ex` +Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 collate utf8mb3_general_ci ),1 as char charset utf8mb3) AS `ex` select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) as ex; ex 1212 @@ -414,7 +414,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset binary) AS `ex` +Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 collate utf8mb3_general_ci ),1 as char charset binary) AS `ex` # # column get real # @@ -1882,7 +1882,7 @@ drop table t1; create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char); 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 column_get(column_add(column_create(1,'blue' AS char charset utf8mb3 ),2,'ttt'),1 as char charset utf8mb3) AS `Name_exp_1` utf8mb3 utf8mb3_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select column_get(column_add(column_create(1,'blue' AS char charset utf8mb3 collate utf8mb3_general_ci ),2,'ttt'),1 as char charset utf8mb3) AS `Name_exp_1` utf8mb3 utf8mb3_general_ci select * from v1; Name_exp_1 blue @@ -1949,3 +1949,23 @@ ex # # End of 10.4 tests # +# +# Start of 10.5 tests +# +# +# Start of 10.5 tests +# +# +# MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol +# +SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex; +ex +0001000100035361 +SELECT hex(column_add(column_create( +1, 'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin), +2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex; +ex +00020001000302001353612162 +# +# Start of 10.5 tests +# diff --git a/mysql-test/main/dyncol.test b/mysql-test/main/dyncol.test index 8b3164217d1..1343025d5c5 100644 --- a/mysql-test/main/dyncol.test +++ b/mysql-test/main/dyncol.test @@ -1000,3 +1000,24 @@ SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL)) as ex; --echo # --echo # End of 10.4 tests --echo # + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol +--echo # + +SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex; +SELECT hex(column_add(column_create( + 1, 'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin), + 2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex; + +--echo # +--echo # Start of 10.5 tests +--echo # diff --git a/mysql-test/main/empty_server_name-8224.test b/mysql-test/main/empty_server_name-8224.test index 5c5140be2e0..31760713bc8 100644 --- a/mysql-test/main/empty_server_name-8224.test +++ b/mysql-test/main/empty_server_name-8224.test @@ -3,10 +3,10 @@ # --source include/not_embedded.inc create server '' foreign data wrapper w2 options (host '127.0.0.1'); ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- enable_reconnect -- source include/wait_until_connected_again.inc diff --git a/mysql-test/main/empty_string_literal.result b/mysql-test/main/empty_string_literal.result index 71b0869cb2a..447bad8a75a 100644 --- a/mysql-test/main/empty_string_literal.result +++ b/mysql-test/main/empty_string_literal.result @@ -208,12 +208,13 @@ t1 CREATE TABLE `t1` ( KEY `a` (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; +set sql_mode= default; # # MDEV-33460 select '123' 'x'; unexpected result # SELECT ''; -NULL -NULL + + SELECT '' 'b' 'c'; bc bc diff --git a/mysql-test/main/empty_string_literal.test b/mysql-test/main/empty_string_literal.test index 3320841fb42..e3ae009445b 100644 --- a/mysql-test/main/empty_string_literal.test +++ b/mysql-test/main/empty_string_literal.test @@ -25,12 +25,15 @@ flush tables; update t1 set a = 2; show create table t1; drop table t1; +set sql_mode= default; --echo # --echo # MDEV-33460 select '123' 'x'; unexpected result --echo # +--disable_view_protocol SELECT ''; +--enable_view_protocol SELECT '' 'b' 'c'; SELECT '' '' 'c'; SELECT 'a' '' 'c'; diff --git a/mysql-test/main/func_encrypt_nossl.result b/mysql-test/main/func_encrypt_nossl.result index b28d4811433..7afc9fa6923 100644 --- a/mysql-test/main/func_encrypt_nossl.result +++ b/mysql-test/main/func_encrypt_nossl.result @@ -3,56 +3,56 @@ des_encrypt("test", 'akeystr') NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 1); des_encrypt("test", 1) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 9); des_encrypt("test", 9) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", 100); des_encrypt("test", 100) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt("test", NULL); des_encrypt("test", NULL) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_encrypt(NULL, NULL); des_encrypt(NULL, NULL) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt("test", 'anotherkeystr'); des_decrypt("test", 'anotherkeystr') NULL Warnings: Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(1, 1); des_decrypt(1, 1) NULL Warnings: Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("test", 'thekey')); des_decrypt(des_encrypt("test", 'thekey')) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello")); hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello")) NULL NULL @@ -60,22 +60,22 @@ Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",4)); des_decrypt(des_encrypt("hello",4)) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",'test'),'test'); des_decrypt(des_encrypt("hello",'test'),'test') NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password')); hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password')) NULL NULL NULL @@ -83,28 +83,28 @@ Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_encrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working -Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello"),'default_password'); des_decrypt(des_encrypt("hello"),'default_password') NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select des_decrypt(des_encrypt("hello",4),'password4'); des_decrypt(des_encrypt("hello",4),'password4') NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working SET @a=des_decrypt(des_encrypt("hello")); Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working flush des_key_file; select @a = des_decrypt(des_encrypt("hello")); @a = des_decrypt(des_encrypt("hello")) @@ -121,11 +121,11 @@ NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working select hex(des_decrypt(des_encrypt("hello","hidden"))); hex(des_decrypt(des_encrypt("hello","hidden"))) NULL Warnings: Note 1287 'des_encrypt' is deprecated and will be removed in a future release Note 1287 'des_decrypt' is deprecated and will be removed in a future release -Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index bf965a9f5ce..e6c08dab45c 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -4313,5 +4313,30 @@ ERROR HY000: Illegal parameter data types bigint unsigned and row for operation SELECT @@max_allowed_packet=ROW(1,1); ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '=' # +# MDEV-21034 GREATEST() and LEAST() malfunction for NULL +# +SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL); +c1 +SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL); +c1 +CREATE TABLE t0 (c0 INT); +INSERT INTO t0 VALUES (1); +SELECT * FROM t0 WHERE GREATEST(c0, NULL); +c0 +SELECT * FROM t0 WHERE LEAST(c0, NULL); +c0 +DROP TABLE t0; +SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL); +c1 +SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL); +c1 +CREATE TABLE t0 (c0 DOUBLE); +INSERT INTO t0 VALUES (1); +SELECT * FROM t0 WHERE GREATEST(c0, NULL); +c0 +SELECT * FROM t0 WHERE LEAST(c0, NULL); +c0 +DROP TABLE t0; +# # End of 10.5 tests # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 508cdcfb668..2ebfb3cfdf1 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -1115,6 +1115,29 @@ SELECT 0x20+ROW(1,1); --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION SELECT @@max_allowed_packet=ROW(1,1); +--echo # +--echo # MDEV-21034 GREATEST() and LEAST() malfunction for NULL +--echo # + +SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL); +SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL); + +CREATE TABLE t0 (c0 INT); +INSERT INTO t0 VALUES (1); +SELECT * FROM t0 WHERE GREATEST(c0, NULL); +SELECT * FROM t0 WHERE LEAST(c0, NULL); +DROP TABLE t0; + +SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL); +SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL); + +CREATE TABLE t0 (c0 DOUBLE); +INSERT INTO t0 VALUES (1); +SELECT * FROM t0 WHERE GREATEST(c0, NULL); +SELECT * FROM t0 WHERE LEAST(c0, NULL); +DROP TABLE t0; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result index b3865babca2..1ddb5257314 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -971,6 +971,84 @@ c1 9223372036854775808 drop table `a`; # +# MDEV-18319 BIGINT UNSIGNED Performance issue +# +CREATE OR REPLACE TABLE t1 ( +id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY +); +FOR i IN 0..255 +DO +INSERT INTO t1 VALUES (); +END FOR +$$ +SELECT MIN(id), MAX(id), COUNT(*) FROM t1; +MIN(id) MAX(id) COUNT(*) +1 256 256 +EXPLAIN SELECT id FROM t1 WHERE id IN (1,2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index +EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775806, 9223372036854775807); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index +EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775807, 9223372036854775808); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index +DROP TABLE t1; +# +# MDEV-18898 SELECT using wrong index when using operator IN with mixed types +# +CREATE TEMPORARY TABLE t1 ( +id int(10) unsigned NOT NULL AUTO_INCREMENT, +name varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `name` (`name`) +); +FOR i IN 1..255 +DO +INSERT INTO t1 VALUES (i, MD5(i)); +END FOR +$$ +# +# Constants alone +# +ANALYZE SELECT id, name FROM t1 WHERE id = 1; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 NULL 100.00 NULL +ANALYZE SELECT id, name FROM t1 WHERE id = '2'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 NULL 100.00 NULL +# +# Two constants using IN +# +ANALYZE SELECT id, name FROM t1 WHERE id IN (1, 2); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', 2) /* Used a wrong index */; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id IN (1, '2') /* Used a wrong index */; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', '2'); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +# +# Two constants using OR +# +ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = 2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = '2'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = '2'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = 2; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition +DROP TABLE t1; +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_in.test b/mysql-test/main/func_in.test index e39932a2d50..b88b68f2724 100644 --- a/mysql-test/main/func_in.test +++ b/mysql-test/main/func_in.test @@ -742,6 +742,66 @@ SELECT c1 FROM a WHERE c1 IN ( 1, 9223372036854775807 ); SELECT c1 FROM a WHERE c1 IN ( 1, 9223372036854775808 ); drop table `a`; +--echo # +--echo # MDEV-18319 BIGINT UNSIGNED Performance issue +--echo # + +CREATE OR REPLACE TABLE t1 ( + id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY +); +DELIMITER $$; +FOR i IN 0..255 +DO + INSERT INTO t1 VALUES (); +END FOR +$$ +DELIMITER ;$$ +SELECT MIN(id), MAX(id), COUNT(*) FROM t1; +EXPLAIN SELECT id FROM t1 WHERE id IN (1,2); +EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775806, 9223372036854775807); +EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775807, 9223372036854775808); +DROP TABLE t1; + + +--echo # +--echo # MDEV-18898 SELECT using wrong index when using operator IN with mixed types +--echo # + +CREATE TEMPORARY TABLE t1 ( + id int(10) unsigned NOT NULL AUTO_INCREMENT, + name varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +); +DELIMITER $$; +FOR i IN 1..255 +DO + INSERT INTO t1 VALUES (i, MD5(i)); +END FOR +$$ +DELIMITER ;$$ +--echo # +--echo # Constants alone +--echo # +ANALYZE SELECT id, name FROM t1 WHERE id = 1; +ANALYZE SELECT id, name FROM t1 WHERE id = '2'; +--echo # +--echo # Two constants using IN +--echo # +ANALYZE SELECT id, name FROM t1 WHERE id IN (1, 2); +ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', 2) /* Used a wrong index */; +ANALYZE SELECT id, name FROM t1 WHERE id IN (1, '2') /* Used a wrong index */; +ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', '2'); +--echo # +--echo # Two constants using OR +--echo # +ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = 2; +ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = '2'; +ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = '2'; +ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = 2; +DROP TABLE t1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 4a192ea08c3..fec066a1177 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1690,6 +1690,33 @@ select json_arrayagg('ä'), json_objectagg(1, 'ä'); json_arrayagg('ä') json_objectagg(1, 'ä') ["ä"] {"1":"ä"} # +# MDEV-32287: JSON_EXTRACT not returning multiple values for same path +# +select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]'); +JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]') +[40, 40] +# +# MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json +# +CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL)); +INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" :0} ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }'); +ERROR 22001: Data too long for column 'id' at row 1 +DROP TABLE t; +# +# MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER" +# +SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x; +x +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5 +# +# MDEV-22141: JSON_REMOVE returns NULL on valid arguments +# +SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); +JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D') +{"A": {"B": 1}} +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index f0ddce6de18..050e54f2b21 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1120,6 +1120,38 @@ set names latin1; select json_arrayagg('ä'), json_objectagg(1, 'ä'); --enable_service_connection + +--echo # +--echo # MDEV-32287: JSON_EXTRACT not returning multiple values for same path +--echo # + +select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]'); + + +--echo # +--echo # MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json +--echo # + +CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL)); +--error ER_DATA_TOO_LONG +INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" :0} ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }'); + +DROP TABLE t; + +--echo # +--echo # MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER" +--echo # + +SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x; + + +--echo # +--echo # MDEV-22141: JSON_REMOVE returns NULL on valid arguments +--echo # + +SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_json_notembedded.result b/mysql-test/main/func_json_notembedded.result index 756d2e85f7c..ba4d38dd623 100644 --- a/mysql-test/main/func_json_notembedded.result +++ b/mysql-test/main/func_json_notembedded.result @@ -10,6 +10,8 @@ select length(@obj), length(@arr); length(@obj) length(@arr) 5000009 5000009 set max_statement_time=0.0001; +SET @old_debug= @@debug_dbug; +SET debug_dbug='+d,debug_max_statement_time exceeded'; select json_array_append(@arr, '$[0]', 1); ERROR 70100: Query execution was interrupted (max_statement_time exceeded) select json_array_insert(@arr, '$[0]', 1); @@ -34,6 +36,7 @@ select json_replace(@obj,'$.foo',1); ERROR 70100: Query execution was interrupted (max_statement_time exceeded) select json_set(@arr,'$[1000]',1); ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SET debug_dbug= @old_debug; disconnect u; connection default; set global max_allowed_packet=default; diff --git a/mysql-test/main/func_json_notembedded.test b/mysql-test/main/func_json_notembedded.test index 893b248301c..1e05571e16f 100644 --- a/mysql-test/main/func_json_notembedded.test +++ b/mysql-test/main/func_json_notembedded.test @@ -1,6 +1,7 @@ source include/have_profiling.inc; source include/not_embedded.inc; source include/no_valgrind_without_big.inc; +source include/have_debug.inc; set global max_allowed_packet=1073741824; connect u,localhost,root; @@ -16,6 +17,8 @@ select length(@obj), length(@arr); set max_statement_time=0.0001; disable_abort_on_error; +SET @old_debug= @@debug_dbug; +SET debug_dbug='+d,debug_max_statement_time exceeded'; select json_array_append(@arr, '$[0]', 1); select json_array_insert(@arr, '$[0]', 1); select json_insert(@obj, '$.meta', 1); @@ -29,6 +32,7 @@ select json_remove(@obj,'$.foo'); select json_replace(@obj,'$.foo',1); select json_set(@arr,'$[1000]',1); enable_abort_on_error; +SET debug_dbug= @old_debug; disconnect u; connection default; set global max_allowed_packet=default; diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 1c6c780e380..5422cae4ee7 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -3711,5 +3711,20 @@ SELECT CRC32(ExtractValue('', '/a/b')) AS f; f 0 # +# MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc| +# +SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1; +c1 +0 +SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1; +c1 +0 +SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; +c1 +0 +SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; +c1 +NULL +# # End of 10.5 tests # diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index d4e853938ad..b32a1a4634b 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -1980,6 +1980,16 @@ DROP TABLE t2, t1; SELECT CRC32(ExtractValue('', '/a/b')) AS f; +--echo # +--echo # MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc| +--echo # + +SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1; +SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1; +SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; +SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_regexp.result b/mysql-test/main/func_regexp.result index e0a4702c095..7a9e24f8262 100644 --- a/mysql-test/main/func_regexp.result +++ b/mysql-test/main/func_regexp.result @@ -178,4 +178,34 @@ select 'foo' regexp x from t1 order by x desc; 0 1 drop table t1; +# +# MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result +# +CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE); +INSERT INTO t0 VALUES (0, 1); +INSERT INTO t0 VALUES (0, ''); +SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0; +(c1 RLIKE c1) (c0 IS NULL) +1 0 +1 0 +SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a; +SUM(a.t) +0 +DROP TABLE t0; +# +# MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +# +CREATE TABLE t1 (c0 INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT ('' RLIKE '[') AS c1 FROM t1; +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +SELECT REGEXP_INSTR('','[') AS c1 FROM t1; +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +SELECT c0, '' RLIKE NULL AS c1, REGEXP_INSTR('', NULL) AS c2 +FROM t1 ORDER BY c0; +c0 c1 c2 +1 NULL NULL +2 NULL NULL +3 NULL NULL +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/func_regexp.test b/mysql-test/main/func_regexp.test index b9e2ef197d6..fb441bde4d2 100644 --- a/mysql-test/main/func_regexp.test +++ b/mysql-test/main/func_regexp.test @@ -121,4 +121,33 @@ select 'foo' regexp x from t1 order by x asc; select 'foo' regexp x from t1 order by x desc; drop table t1; +--echo # +--echo # MDEV-21076 NOT NULL and UNIQUE constraints cause SUM() to yield an incorrect result +--echo # + +CREATE TABLE t0(c0 INT NOT NULL, c1 CHAR UNIQUE); +INSERT INTO t0 VALUES (0, 1); +INSERT INTO t0 VALUES (0, ''); +SELECT (c1 RLIKE c1), (c0 IS NULL) FROM t0; +SELECT SUM(a.t) FROM (SELECT (c1 RLIKE c1) = (c0 IS NULL) as t FROM t0) as a; +DROP TABLE t0; + +--echo # +--echo # MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +--echo # + +CREATE TABLE t1 (c0 INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--error ER_REGEXP_ERROR +SELECT ('' RLIKE '[') AS c1 FROM t1; + +--error ER_REGEXP_ERROR +SELECT REGEXP_INSTR('','[') AS c1 FROM t1; + +SELECT c0, '' RLIKE NULL AS c1, REGEXP_INSTR('', NULL) AS c2 +FROM t1 ORDER BY c0; + +DROP TABLE t1; + --echo # End of 10.5 tests diff --git a/mysql-test/main/func_sformat.result b/mysql-test/main/func_sformat.result index 9e8a11677b5..11825604f1d 100644 --- a/mysql-test/main/func_sformat.result +++ b/mysql-test/main/func_sformat.result @@ -23,10 +23,8 @@ select sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); -sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) as x; +x 0 0 select sformat('{{{}}}', 0); sformat('{{{}}}', 0) @@ -78,10 +76,8 @@ select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, -106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120); -sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} - {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} - {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} +106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120) as x; +x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 @@ -97,10 +93,8 @@ select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} { '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', -'115', '116', '117', '118', '119', '120'); -sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} - {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} - {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} +'115', '116', '117', '118', '119', '120') as x; +x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 @@ -159,8 +153,8 @@ insert into t2 values (0.0025, 25, 'A', DATE('2020-06-29')), (0.0005, 5, 'B', DATE('2020-6-29')), (5.5555, -5, 'C', DATE('200629')), (-9, -9, 'D', DATE('20*06*29')); -select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) from t2; -sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) +select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) x from t2; +x p1 0.0025 p2 25 p3 A p4 2020-06-29 p1 0.0005 p2 5 p3 B p4 2020-06-29 p1 5.5555 p2 -5 p3 C p4 2020-06-29 @@ -279,14 +273,14 @@ sformat('{: f}; {: f}', 3.14, -3.14) select sformat('{:-f}; {:-f}', 3.14, -3.14); sformat('{:-f}; {:-f}', 3.14, -3.14) 3.140000; -3.140000 -select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7); -sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7) +select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7) x; +x The temperature is between -3 and 7 degrees celsius. -select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7); -sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7) +select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7) x; +x The temperature is between -3 and 7 degrees celsius. -select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7); -sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7) +select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7) x; +x The temperature is between -3 and +7 degrees celsius. select sformat('We have {:<8} chickens.', 49); sformat('We have {:<8} chickens.', 49) @@ -427,8 +421,8 @@ set names utf8; select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'); sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') =тест= -select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')); -hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')) +select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')) x; +x 003D0442043504410442003D create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') as x; show create table t1; diff --git a/mysql-test/main/func_sformat.test b/mysql-test/main/func_sformat.test index 65e4b639179..4744229e79a 100644 --- a/mysql-test/main/func_sformat.test +++ b/mysql-test/main/func_sformat.test @@ -14,14 +14,11 @@ select sformat(0); select sformat('C'); select sformat(-4.2); select sformat(5, 5, 5); -#enable after fix MDEV-27871 ---disable_view_protocol select sformat('{} {}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ---enable_view_protocol + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) as x; select sformat('{{{}}}', 0); select sformat('{{{}{{', 0); select sformat('{{{{{}{{', 'param1'); @@ -29,18 +26,13 @@ select sformat(' {{ {{ {} {{ ', 'param1'); select sformat(' {{ {} {}', 'param1', 'param2'); select sformat('A{}C{}E{}', 'B', 'D', 'F'); select sformat('{} {}', FALSE, TRUE); -#enable after fix MDEV-29601 ---disable_service_connection select sformat('Add € != {} != {}?', '$', '£'); select sformat('Check {} != {} != {}?', '€', '$', '£'); ---enable_service_connection select sformat('{}{}{}', 1, 2, 3); select sformat('Float {} Boolean {} Number {}', 3.14159, True, -50); select sformat('SUM {} + {} = {}', 2, 3, 2+3); select sformat('Numbers {} {} {}', 1, 1.11, 1.111); select sformat('what {} is {}?', 'time', 'it'); -#enable after fix MDEV-27871 ---disable_view_protocol select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} @@ -49,7 +41,7 @@ select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120); + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120) as x; select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} @@ -61,8 +53,7 @@ select sformat('{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} { '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100', '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', - '115', '116', '117', '118', '119', '120'); ---enable_view_protocol + '115', '116', '117', '118', '119', '120') as x; echo #; echo # Error Test Cases; @@ -92,10 +83,7 @@ insert into t2 values (0.0025, 25, 'A', DATE('2020-06-29')), (0.0005, 5, 'B', DATE('2020-6-29')), (5.5555, -5, 'C', DATE('200629')), (-9, -9, 'D', DATE('20*06*29')); -#enable after fix MDEV-27871 ---disable_view_protocol -select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) from t2; ---enable_view_protocol +select sformat('p1 {:.4f} p2 {} p3 {} p4 {}', param1, param2, param3, param4) x from t2; drop table t2; set names utf8; @@ -127,10 +115,7 @@ echo #; echo # Format Test Cases; echo #; select sformat('Num {:L}', 13800000000); -#enable after fix MDEV-29646 ---disable_view_protocol select sformat('Num [{:20}]', 42); ---enable_view_protocol select sformat('Number: {:*^{}}', 4, 5); select sformat('{:02} - {:02} - {:02}', 1, 2, 3); select sformat('Character {:c}', 104); @@ -141,10 +126,7 @@ select sformat('Float {:.2f}', 42.0); select sformat('Float {:f}', 42.0); select sformat('Number {:d}', 42); select sformat('Number {:{}}', 5, 5); -#enable after fix MDEV-29646 ---disable_view_protocol select sformat('Number [{:10}]', 9999); ---enable_view_protocol select sformat('Number {:.3}', 3.1416); select sformat('int: {0:d}; hex: {0:x}; oct: {0:o}', 42); select sformat('int: {0:d}; hex: {0:#x}; oct: {0:#o}', 42); @@ -155,16 +137,10 @@ select sformat('The binary version of {0} is {0:b}', 5); select sformat('{:+f}; {:+f}', 3.14, -3.14); select sformat('{: f}; {: f}', 3.14, -3.14); select sformat('{:-f}; {:-f}', 3.14, -3.14); -#enable after fix MDEV-27871 ---disable_view_protocol -select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7); -select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7); -select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7); ---enable_view_protocol -#check after fix MDEV-29646 ---disable_view_protocol +select sformat('The temperature is between {: } and {: } degrees celsius.', -3, 7) x; +select sformat('The temperature is between {:-} and {:-} degrees celsius.', -3, 7) x; +select sformat('The temperature is between {:+} and {:+} degrees celsius.', -3, 7) x; select sformat('We have {:<8} chickens.', 49); ---enable_view_protocol select sformat('Center alimgn [{:*^10}]', 'data'); select sformat('Center aling [{:^10}].', 'data'); select sformat('Right aling [{:>10}].', 'data'); @@ -175,20 +151,31 @@ select sformat('Change Order {1} {0}', 'second', 'first'); echo #; echo # Failed Format Test Cases; echo #; +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('Test {:c}', 'word'); select sformat('Test {one} {two} {three}', 1, 2, 3); select sformat('Number {:{<}', 8); select sformat('Number {:10000000000}', 5); select sformat('1={1} 2={2} 0={0}', 0, 1); +--replace_regex /invalid format specifier/precision not allowed for this argument type/ select sformat('Number {:.2d}', 42); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('You scored {:.0%}', 0.25); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('You scored {:%}', 0.25); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('The price is {:f} dollars.', 45); +--replace_regex /invalid format specifier/precision not allowed for this argument type/ select sformat('The price is {:.2f} dollars.', 45); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('We have {:E} chickens.', 5); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('We have {:e} chickens.', 5); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('The universe is {:,} years old.', 13800000000); +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('The universe is {:_} years old.', 13800000000); +--replace_regex /invalid format specifier/format specifier requires numeric argument/ select sformat('String {:-}', 'hello'); echo #; @@ -211,6 +198,7 @@ drop table t2; echo #; echo # Unsupported/disabled features; echo #; +--replace_regex /invalid format specifier/invalid type specifier/ select sformat('{:p}', '50'); echo #; @@ -219,10 +207,7 @@ echo #; select sformat('={}=', _ucs2 x'006100620063'); set names utf8; select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442'); -#enable after fix MDEV-27871 ---disable_view_protocol -select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')); ---enable_view_protocol +select hex(sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442')) x; create table t1 as select sformat(_ucs2 x'003D007B007D003D', _ucs2 x'0442043504410442') as x; show create table t1; drop table t1; @@ -233,6 +218,7 @@ echo # ps parameters; echo #; prepare s from 'select sformat("={:d}=", ?)'; execute s using 100; +--replace_regex /invalid format specifier/invalid type specifier/ execute s using 'abc'; echo #; diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 4fdcfe4dfea..c3acc114786 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6365,3 +6365,57 @@ NULL SELECT FROM_UNIXTIME(LEAST(3696610869, NULL)); FROM_UNIXTIME(LEAST(3696610869, NULL)) NULL +# +# Start of 10.5 tests +# +# +# MDEV-29149 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed +# +SET @@timestamp= UNIX_TIMESTAMP('2022-07-21 23:00:00'); +SELECT DATE_SUB('2022-07-21 00:00:00', INTERVAL 800 HOUR) AS expected_result; +expected_result +2022-06-17 16:00:00 +SELECT +IF(1,TIMEDIFF('38:59:59','839:00:00'),CAST('2022-12-12' AS DATE)) AS c1, +IF(1,TIMEDIFF('-839:00:00','-38:59:59'),CAST('2022-12-12' AS DATE)) AS c2; +c1 c2 +2022-06-17 16:00:00 2022-06-17 16:00:00 +Warnings: +Warning 1292 Truncated incorrect time value: '839:00:00' +Warning 1292 Truncated incorrect time value: '-839:00:00' +SELECT +IF(1,TIMEDIFF(385959,8390000),CAST('2022-12-12' AS DATE)) AS c1, +IF(1,TIMEDIFF(-8390000,-385959),CAST('2022-12-12' AS DATE)) AS c2; +c1 c2 +2022-06-17 16:00:00 2022-06-17 16:00:00 +Warnings: +Warning 1292 Truncated incorrect time value: '8390000' +Warning 1292 Truncated incorrect time value: '-8390000' +SELECT +TIMEDIFF('38:59:59','839:00:00') AS c1, +CAST(TIMEDIFF('38:59:59','839:00:00') AS TIME(6)) AS c2, +TIMEDIFF('839:00:00','38:59:59') AS c3, +CAST(TIMEDIFF('839:00:00','38:59:59') AS TIME(6)) AS c4; +c1 c2 c3 c4 +-800:00:00 -800:00:00.000000 800:00:00 800:00:00.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '839:00:00' +Warning 1292 Truncated incorrect time value: '839:00:00' +Warning 1292 Truncated incorrect time value: '839:00:00' +Warning 1292 Truncated incorrect time value: '839:00:00' +SELECT +TIMEDIFF(385959,8390000) AS c1, +CAST(TIMEDIFF(385959,8390000) AS TIME(6)) AS c2, +TIMEDIFF(8390000,385959) AS c3, +CAST(TIMEDIFF(8390000,385959) AS TIME(6)) AS c4; +c1 c2 c3 c4 +-800:00:00 -800:00:00.000000 800:00:00 800:00:00.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '8390000' +Warning 1292 Truncated incorrect time value: '8390000' +Warning 1292 Truncated incorrect time value: '8390000' +Warning 1292 Truncated incorrect time value: '8390000' +SET @@timestamp= DEFAULT; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index fb184ab4e16..caf6ec1c6cf 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -3218,3 +3218,42 @@ SELECT CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))); --echo # SELECT FROM_UNIXTIME(LEAST(3696610869, NULL)); + + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-29149 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed +--echo # + +SET @@timestamp= UNIX_TIMESTAMP('2022-07-21 23:00:00'); + +SELECT DATE_SUB('2022-07-21 00:00:00', INTERVAL 800 HOUR) AS expected_result; + +SELECT + IF(1,TIMEDIFF('38:59:59','839:00:00'),CAST('2022-12-12' AS DATE)) AS c1, + IF(1,TIMEDIFF('-839:00:00','-38:59:59'),CAST('2022-12-12' AS DATE)) AS c2; + +SELECT + IF(1,TIMEDIFF(385959,8390000),CAST('2022-12-12' AS DATE)) AS c1, + IF(1,TIMEDIFF(-8390000,-385959),CAST('2022-12-12' AS DATE)) AS c2; + +SELECT + TIMEDIFF('38:59:59','839:00:00') AS c1, + CAST(TIMEDIFF('38:59:59','839:00:00') AS TIME(6)) AS c2, + TIMEDIFF('839:00:00','38:59:59') AS c3, + CAST(TIMEDIFF('839:00:00','38:59:59') AS TIME(6)) AS c4; + +SELECT + TIMEDIFF(385959,8390000) AS c1, + CAST(TIMEDIFF(385959,8390000) AS TIME(6)) AS c2, + TIMEDIFF(8390000,385959) AS c3, + CAST(TIMEDIFF(8390000,385959) AS TIME(6)) AS c4; + +SET @@timestamp= DEFAULT; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/function_defaults.result b/mysql-test/main/function_defaults.result index c564d9470ab..5f5a4c878e6 100644 --- a/mysql-test/main/function_defaults.result +++ b/mysql-test/main/function_defaults.result @@ -3141,7 +3141,32 @@ set timestamp=unix_timestamp('2011-11-11 11-11-11'); update t1 set b=default, c=default(b) where a=1; select * from t1; a b c -1 2010-10-10 10:10:10 x +1 2010-10-10 10:10:10 2010-10-10 10:10:10 2 2010-10-10 10:10:10 x drop table t1; set timestamp=default; +# +# MDEV-33790: Incorrect DEFAULT expression evaluated in UPDATE +# +create table t1 ( +a int, +b timestamp default '2010-10-10 10:10:10' on update now(), +c varchar(100) default 'x'); +create table t2 (a int primary key); +insert t1 (a) values (1),(2); +insert t2 (a) values (1),(2); +select * from t1; +a b c +1 2010-10-10 10:10:10 x +2 2010-10-10 10:10:10 x +set timestamp=unix_timestamp('2011-11-11 11-11-11'); +update t1,t2 set b=default, c=default(b) where t1.a=1 and t1.a= t2.a; +select * from t1; +a b c +1 2010-10-10 10:10:10 2010-10-10 10:10:10 +2 2010-10-10 10:10:10 x +drop table t1, t2; +set timestamp=default; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/function_defaults.test b/mysql-test/main/function_defaults.test index dd3ba109b2a..59776118e56 100644 --- a/mysql-test/main/function_defaults.test +++ b/mysql-test/main/function_defaults.test @@ -67,3 +67,26 @@ update t1 set b=default, c=default(b) where a=1; select * from t1; drop table t1; set timestamp=default; + +--echo # +--echo # MDEV-33790: Incorrect DEFAULT expression evaluated in UPDATE +--echo # + +create table t1 ( + a int, + b timestamp default '2010-10-10 10:10:10' on update now(), + c varchar(100) default 'x'); +create table t2 (a int primary key); +insert t1 (a) values (1),(2); +insert t2 (a) values (1),(2); + +select * from t1; +set timestamp=unix_timestamp('2011-11-11 11-11-11'); +update t1,t2 set b=default, c=default(b) where t1.a=1 and t1.a= t2.a; +select * from t1; +drop table t1, t2; +set timestamp=default; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index d8d424897fb..8097c7a8ba8 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5072,37 +5072,37 @@ ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(PO # MDEV-20009 Add CAST(expr AS pluggable_type) # SELECT CAST(1 AS GEOMETRY); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)' SELECT CAST(1 AS GEOMETRYCOLLECTION); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)' SELECT CAST(1 AS POINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS point)' +ERROR HY000: Operator does not exist: 'CAST(expr AS point)' SELECT CAST(1 AS LINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)' SELECT CAST(1 AS POLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)' SELECT CAST(1 AS MULTIPOINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)' SELECT CAST(1 AS MULTILINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)' SELECT CAST(1 AS MULTIPOLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)' SELECT CONVERT(1, GEOMETRY); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)' SELECT CONVERT(1, GEOMETRYCOLLECTION); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)' SELECT CONVERT(1, POINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS point)' +ERROR HY000: Operator does not exist: 'CAST(expr AS point)' SELECT CONVERT(1, LINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)' SELECT CONVERT(1, POLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)' SELECT CONVERT(1, MULTIPOINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)' SELECT CONVERT(1, MULTILINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)' SELECT CONVERT(1, MULTIPOLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)' # # MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY # diff --git a/mysql-test/main/host_cache_size_functionality.test b/mysql-test/main/host_cache_size_functionality.test index 9ec26010ab6..f37b2ab8c9e 100644 --- a/mysql-test/main/host_cache_size_functionality.test +++ b/mysql-test/main/host_cache_size_functionality.test @@ -43,10 +43,10 @@ select @@global.Host_Cache_Size > 0; --echo # Restart server with Host_Cache_Size 1 let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --shutdown_server --source include/wait_until_disconnected.inc --- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--host_cache_size=1 " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- enable_reconnect -- source include/wait_until_connected_again.inc @@ -142,10 +142,10 @@ SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size; #--remove_file $MYSQL_TMP_DIR/bind_ip #let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; -#--exec echo "wait" > $restart_file +#--write_line wait $restart_file #--shutdown_server #--source include/wait_until_disconnected.inc -#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +#-- write_line "restart:--bind-address=$bind_ip " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect #-- enable_reconnect #-- source include/wait_until_connected_again.inc diff --git a/mysql-test/main/information_schema2.result b/mysql-test/main/information_schema2.result index e23e81b885c..fa4d71bf227 100644 --- a/mysql-test/main/information_schema2.result +++ b/mysql-test/main/information_schema2.result @@ -1,3 +1,6 @@ +# +# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +# select variable_name from information_schema.session_status where variable_name = (select variable_name from information_schema.session_status where variable_name = 'uptime'); variable_name @@ -6,6 +9,9 @@ select variable_name from information_schema.session_variables where variable_na (select variable_name from information_schema.session_variables where variable_name = 'basedir'); variable_name BASEDIR +# +# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows +# create table t1 (x int); create table t2 (x int); create table t3 (x int); @@ -18,3 +24,15 @@ t2 t3 t4 drop table t1, t2, t3, t4; +# End of 5.5 tests +# INFORMATION_SCHEMA.STATISTICS doesn't show if the index is disabled +create table t1 (a int, key(a)); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +a +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +a disabled +drop table t1; +# End of 10.5 tests diff --git a/mysql-test/main/information_schema2.test b/mysql-test/main/information_schema2.test index d2fa3da2b5f..50ceec2c5d3 100644 --- a/mysql-test/main/information_schema2.test +++ b/mysql-test/main/information_schema2.test @@ -1,15 +1,15 @@ -# -# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling -# +--echo # +--echo # MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling +--echo # select variable_name from information_schema.session_status where variable_name = (select variable_name from information_schema.session_status where variable_name = 'uptime'); select variable_name from information_schema.session_variables where variable_name = (select variable_name from information_schema.session_variables where variable_name = 'basedir'); -# -# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows -# +--echo # +--echo # MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows +--echo # create table t1 (x int); create table t2 (x int); create table t3 (x int); @@ -17,3 +17,14 @@ create table t4 AS select table_name from information_schema.TABLES where table_ delete from t4 where table_name not in (select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE'); select * from t4 order by table_name; drop table t1, t2, t3, t4; + +--echo # End of 5.5 tests + +--echo # INFORMATION_SCHEMA.STATISTICS doesn't show if the index is disabled +create table t1 (a int, key(a)); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +drop table t1; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/init_file_set_password-7656.test b/mysql-test/main/init_file_set_password-7656.test index 7bca34a0fcf..ac5baa3b04f 100644 --- a/mysql-test/main/init_file_set_password-7656.test +++ b/mysql-test/main/init_file_set_password-7656.test @@ -15,12 +15,12 @@ EOF --enable_reconnect ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--init-file=$MYSQLTEST_VARDIR/init.file " $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc select user,host,password,plugin,authentication_string from mysql.user where user='foo'; diff --git a/mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff b/mysql-test/main/innodb_ext_key,covering,on.rdiff similarity index 100% rename from mysql-test/main/innodb_ext_key,covering,innodb,on.rdiff rename to mysql-test/main/innodb_ext_key,covering,on.rdiff diff --git a/mysql-test/main/innodb_ext_key,off.rdiff b/mysql-test/main/innodb_ext_key,off.rdiff index ef11f9c05bc..8b24cc9a663 100644 --- a/mysql-test/main/innodb_ext_key,off.rdiff +++ b/mysql-test/main/innodb_ext_key,off.rdiff @@ -163,7 +163,7 @@ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 @@ -220,12 +220,12 @@ 5959 3 - show status like 'handler_read_next'; + show /*a*/ status like 'handler_read_next'; Variable_name Value -Handler_read_next 3 +Handler_read_next 9 @@ -177,7 +177,7 @@ select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; @@ -243,9 +243,9 @@ - show status like 'handler_read%'; + show /*b*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 21 @@ -199,7 +199,7 @@ select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; @@ -265,9 +265,9 @@ - show status like 'handler_read%'; + show /*c*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 6 diff --git a/mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff b/mysql-test/main/innodb_ext_key,on,unoptimized.rdiff similarity index 100% rename from mysql-test/main/innodb_ext_key,innodb,on,unoptimized.rdiff rename to mysql-test/main/innodb_ext_key,on,unoptimized.rdiff diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index d1f4c60f5b2..35c4e53f970 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -14,7 +14,7 @@ flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; count(*) 1 -show status like 'handler_read%'; +show /*1*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -35,7 +35,7 @@ select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; count(*) 1 -show status like 'handler_read%'; +show /*2*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -56,7 +56,7 @@ select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; count(*) 1 -show status like 'handler_read%'; +show /*3*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -79,7 +79,7 @@ l_orderkey l_linenumber 1088 3 1217 1 1221 3 -show status like 'handler_read%'; +show /*4*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -98,7 +98,7 @@ flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; min(l_orderkey) 130 -show status like 'handler_read%'; +show /*5*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -119,7 +119,7 @@ select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; min(l_orderkey) 1088 -show status like 'handler_read%'; +show /*6*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -140,7 +140,7 @@ select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; max(l_linenumber) 2 -show status like 'handler_read%'; +show /*7*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 1 @@ -166,7 +166,7 @@ or l_receiptdate='1992-07-01' and l_orderkey=5603; l_orderkey l_linenumber 130 2 5603 2 -show status like 'handler_read%'; +show /*8*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 @@ -193,7 +193,7 @@ l_orderkey l_linenumber 130 2 5603 2 5959 3 -show status like 'handler_read%'; +show /*9*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 2 @@ -218,7 +218,7 @@ l_orderkey l_linenumber 130 2 5603 2 5959 3 -show status like 'handler_read_next'; +show /*a*/ status like 'handler_read_next'; Variable_name Value Handler_read_next 3 explain @@ -240,7 +240,7 @@ max(l_orderkey) 5894 5859 5632 -show status like 'handler_read%'; +show /*b*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 21 @@ -262,7 +262,7 @@ where l_suppkey in (1,4) group by l_suppkey; max(l_orderkey) 5988 5984 -show status like 'handler_read%'; +show /*c*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 6 @@ -292,7 +292,7 @@ where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; o_orderkey p_partkey 5895 200 -show status like 'handler_read%'; +show /*d*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 3 @@ -458,7 +458,7 @@ select * from t1, t2 where t2.a=t1.a and t2.b < 2; a pk a b 0 0 0 0 1 1 1 1 -show status like 'handler_read%'; +show /*e*/ status like 'handler_read%'; Variable_name Value Handler_read_first 0 Handler_read_key 10 diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index c5ef5d6f63b..d24bb77e238 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -35,7 +35,7 @@ explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*1*/ status like 'handler_read%'; explain select count(*) from lineitem use index(primary) @@ -43,7 +43,7 @@ select count(*) from lineitem use index(primary) flush status; select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*2*/ status like 'handler_read%'; explain select count(*) from lineitem @@ -51,7 +51,7 @@ select count(*) from lineitem flush status; select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; -show status like 'handler_read%'; +show /*3*/ status like 'handler_read%'; explain select l_orderkey, l_linenumber from lineitem @@ -59,13 +59,13 @@ select l_orderkey, l_linenumber from lineitem flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -show status like 'handler_read%'; +show /*4*/ status like 'handler_read%'; explain select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; -show status like 'handler_read%'; +show /*5*/ status like 'handler_read%'; explain select min(l_orderkey) from lineitem @@ -73,7 +73,7 @@ select min(l_orderkey) from lineitem flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -show status like 'handler_read%'; +show /*6*/ status like 'handler_read%'; explain select max(l_linenumber) from lineitem @@ -81,7 +81,7 @@ select max(l_linenumber) from lineitem flush status; select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; -show status like 'handler_read%'; +show /*7*/ status like 'handler_read%'; explain select l_orderkey, l_linenumber @@ -93,7 +93,7 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey=130 or l_receiptdate='1992-07-01' and l_orderkey=5603; -show status like 'handler_read%'; +show /*8*/ status like 'handler_read%'; --replace_column 7 # explain @@ -106,7 +106,7 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -show status like 'handler_read%'; +show /*9*/ status like 'handler_read%'; --replace_column 7 # 9 # 10 Using explain @@ -117,7 +117,7 @@ flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -show status like 'handler_read_next'; +show /*a*/ status like 'handler_read_next'; --replace_column 9 # explain @@ -126,7 +126,7 @@ select max(l_orderkey) from lineitem flush status; select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; -show status like 'handler_read%'; +show /*b*/ status like 'handler_read%'; --replace_column 9 # explain @@ -135,7 +135,7 @@ select max(l_orderkey) from lineitem flush status; select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; -show status like 'handler_read%'; +show /*c*/ status like 'handler_read%'; create index i_p_retailprice on part(p_retailprice); @@ -152,7 +152,7 @@ select o_orderkey, p_partkey lineitem use index (i_l_partkey), orders where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; -show status like 'handler_read%'; +show /*d*/ status like 'handler_read%'; --enable_ps2_protocol --echo # @@ -329,7 +329,7 @@ explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; select * from t1, t2 where t2.a=t1.a and t2.b < 2; -show status like 'handler_read%'; +show /*e*/ status like 'handler_read%'; --enable_ps2_protocol drop table t1,t2; diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index 29618c6ddd4..463f571b096 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -973,7 +973,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); insert into t1 @@ -984,8 +983,6 @@ select * from t1; a 3 1 -3 -2 delete from t1; insert into t1 values (3), (1); insert into t1 @@ -996,6 +993,7 @@ select * from t1; a 3 1 +3 2 delete from t1; insert into t1 values (3), (1); @@ -1022,7 +1020,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); execute stmt; @@ -1030,7 +1027,6 @@ select * from t1; a 3 1 -2 delete from t1; insert into t1 values (3), (1); delete from t1 @@ -1040,6 +1036,8 @@ group by (select * from (select a from t1) dt where a = 1))); select * from t1; a +3 +1 deallocate prepare stmt; drop table t1,t2,t3; # diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 26a57dda173..0f29c375cce 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -6464,5 +6464,27 @@ b b d c c 10 NULL NULL NULL NULL DROP TABLE t1,t2,t3,t4; # +# MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries and constant tables +# +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +CREATE TABLE t2 (c int, d int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,10); +CREATE TABLE t3 (e int, key (e)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (2),(3); +# Must not crash, must use join buffer in subquery +EXPLAIN +SELECT * FROM t1 +WHERE a > b OR a IN ( +SELECT c FROM t2 WHERE EXISTS ( +SELECT * FROM t3 t3a JOIN t3 t3b WHERE t3a.e < d +) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +3 SUBQUERY t3a range e e 5 NULL 2 Using where; Using index +3 SUBQUERY t3b index NULL e 5 NULL 2 Using index; Using join buffer (flat, BNL join) +DROP TABLE t1,t2,t3; +# # End of 10.4 tests # diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index dddc0c1a316..cfbd5e2dc5f 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -4362,6 +4362,27 @@ eval $q2; DROP TABLE t1,t2,t3,t4; +--echo # +--echo # MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries and constant tables +--echo # +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; + +CREATE TABLE t2 (c int, d int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,10); + +CREATE TABLE t3 (e int, key (e)) ENGINE=MyISAM; +INSERT INTO t3 VALUES (2),(3); + +--echo # Must not crash, must use join buffer in subquery +EXPLAIN +SELECT * FROM t1 +WHERE a > b OR a IN ( + SELECT c FROM t2 WHERE EXISTS ( + SELECT * FROM t3 t3a JOIN t3 t3b WHERE t3a.e < d + ) +); +DROP TABLE t1,t2,t3; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/kill_processlist-6619.result b/mysql-test/main/kill_processlist-6619.result index 25831a1f63b..7dd42790cc7 100644 --- a/mysql-test/main/kill_processlist-6619.result +++ b/mysql-test/main/kill_processlist-6619.result @@ -1,8 +1,4 @@ -SET DEBUG_SYNC='dispatch_command_end SIGNAL ready WAIT_FOR go'; -select 1; connect con1,localhost,root,,; -SET DEBUG_SYNC='now wait_for ready'; -SET DEBUG_SYNC='now signal go'; SHOW PROCESSLIST; Id User Host db Command Time State Info Progress # root # test Sleep # # NULL 0.000 @@ -10,8 +6,6 @@ Id User Host db Command Time State Info Progress SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go'; SHOW PROCESSLIST; connection default; -1 -1 SET DEBUG_SYNC='now WAIT_FOR ready'; KILL QUERY con_id; SET DEBUG_SYNC='now SIGNAL go'; diff --git a/mysql-test/main/kill_processlist-6619.test b/mysql-test/main/kill_processlist-6619.test index 7330c79acd8..0f53034eaa8 100644 --- a/mysql-test/main/kill_processlist-6619.test +++ b/mysql-test/main/kill_processlist-6619.test @@ -4,23 +4,24 @@ --source include/not_embedded.inc --source include/have_debug_sync.inc -# This is to ensure that the following SHOW PROCESSLIST does not show the query -SET DEBUG_SYNC='dispatch_command_end SIGNAL ready WAIT_FOR go'; ---send select 1 +--disable_ps_protocol +# Ensure no lingering connections from an earlier test run, which can very +# rarely still be visible in SHOW PROCESSLIST here. +--let $wait_condition= SELECT COUNT(*) = 1 from information_schema.processlist +--source include/wait_condition.inc --connect (con1,localhost,root,,) -SET DEBUG_SYNC='now wait_for ready'; -SET DEBUG_SYNC='now signal go'; - --let $con_id = `SELECT CONNECTION_ID()` + +let $wait_condition=select command = 'sleep' from information_schema.processlist where id != $con_id; +source include/wait_condition.inc; + --replace_result Execute Query --replace_column 1 # 3 # 6 # 7 # SHOW PROCESSLIST; SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go'; send SHOW PROCESSLIST; --connection default ---reap - # We must wait for the SHOW PROCESSLIST query to have started before sending # the kill. Otherwise, the KILL may be lost since it is reset at the start of # query execution. @@ -34,9 +35,7 @@ reap; SET DEBUG_SYNC='reset'; # Wait until default connection has reset query string -let $wait_condition= - SELECT COUNT(*) = 1 from information_schema.processlist - WHERE info is NULL; +let $wait_condition=select command = 'sleep' from information_schema.processlist where id != $con_id; --source include/wait_condition.inc --replace_result Execute Query diff --git a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result new file mode 100644 index 00000000000..4992e7ed93b --- /dev/null +++ b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result @@ -0,0 +1,18 @@ +set global alter_algorithm=INPLACE; +RENAME TABLE mysql.time_zone TO mysql.time_zone_BACKUP; +RENAME TABLE mysql.time_zone_name TO mysql.time_zone_name_BACKUP; +RENAME TABLE mysql.time_zone_transition TO mysql.time_zone_transition_BACKUP; +RENAME TABLE mysql.time_zone_transition_type TO mysql.time_zone_transition_type_BACKUP; +CREATE TABLE mysql.time_zone LIKE mysql.time_zone_BACKUP; +CREATE TABLE mysql.time_zone_name LIKE mysql.time_zone_name_BACKUP; +CREATE TABLE mysql.time_zone_transition LIKE mysql.time_zone_transition_BACKUP; +CREATE TABLE mysql.time_zone_transition_type LIKE mysql.time_zone_transition_type_BACKUP; +DROP TABLE mysql.time_zone; +DROP TABLE mysql.time_zone_name; +DROP TABLE mysql.time_zone_transition; +DROP TABLE mysql.time_zone_transition_type; +RENAME TABLE mysql.time_zone_BACKUP TO mysql.time_zone; +RENAME TABLE mysql.time_zone_name_BACKUP TO mysql.time_zone_name; +RENAME TABLE mysql.time_zone_transition_BACKUP TO mysql.time_zone_transition; +RENAME TABLE mysql.time_zone_transition_type_BACKUP TO mysql.time_zone_transition_type; +set global alter_algorithm=DEFAULT; diff --git a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test new file mode 100644 index 00000000000..809f147fe04 --- /dev/null +++ b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test @@ -0,0 +1,40 @@ +--source include/not_embedded.inc + +# MDEV-33044 Loading time zones does not work with alter_algorithm INPLACE + +set global alter_algorithm=INPLACE; + +# Because loading timezones alters the mysql tables, +# this test will leave mysql in a different state than when it started. +# Furthermore, checksums on the various mysql.timezone_x tables will fail. + +# Therefore we: +# 1. Make "backups" of the existing tables by renaming them +# 2. Make dummy clones of the tables we just backed up +# 3. Load timezones with alterations made to the dummy clone tables +# 4. Drop the newly made tables with changes made to them +# 5. Restore the backed up tables so the checksums will pass + +RENAME TABLE mysql.time_zone TO mysql.time_zone_BACKUP; +RENAME TABLE mysql.time_zone_name TO mysql.time_zone_name_BACKUP; +RENAME TABLE mysql.time_zone_transition TO mysql.time_zone_transition_BACKUP; +RENAME TABLE mysql.time_zone_transition_type TO mysql.time_zone_transition_type_BACKUP; + +CREATE TABLE mysql.time_zone LIKE mysql.time_zone_BACKUP; +CREATE TABLE mysql.time_zone_name LIKE mysql.time_zone_name_BACKUP; +CREATE TABLE mysql.time_zone_transition LIKE mysql.time_zone_transition_BACKUP; +CREATE TABLE mysql.time_zone_transition_type LIKE mysql.time_zone_transition_type_BACKUP; + +--exec $MYSQL_TZINFO_TO_SQL std_data/zoneinfo | $MYSQL mysql + +DROP TABLE mysql.time_zone; +DROP TABLE mysql.time_zone_name; +DROP TABLE mysql.time_zone_transition; +DROP TABLE mysql.time_zone_transition_type; + +RENAME TABLE mysql.time_zone_BACKUP TO mysql.time_zone; +RENAME TABLE mysql.time_zone_name_BACKUP TO mysql.time_zone_name; +RENAME TABLE mysql.time_zone_transition_BACKUP TO mysql.time_zone_transition; +RENAME TABLE mysql.time_zone_transition_type_BACKUP TO mysql.time_zone_transition_type; + +set global alter_algorithm=DEFAULT; diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result index 321f5dff06d..69958811d68 100644 --- a/mysql-test/main/lock_sync.result +++ b/mysql-test/main/lock_sync.result @@ -26,28 +26,6 @@ ALWAYS connect con1, localhost, root,,; connect con2, localhost, root,,; connection default; -drop table if exists t0, t1, t2, t3, t4, t5; -drop view if exists v1, v2; -drop procedure if exists p1; -drop procedure if exists p2; -drop procedure if exists p3; -drop function if exists f1; -drop function if exists f2; -drop function if exists f3; -drop function if exists f4; -drop function if exists f5; -drop function if exists f6; -drop function if exists f7; -drop function if exists f8; -drop function if exists f9; -drop function if exists f10; -drop function if exists f11; -drop function if exists f12; -drop function if exists f13; -drop function if exists f14; -drop function if exists f15; -drop function if exists f16; -drop function if exists f17; create table t1 (i int primary key); insert into t1 values (1), (2), (3), (4), (5); create table t2 (j int primary key); diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test index 51247a51067..998c6529462 100644 --- a/mysql-test/main/lock_sync.test +++ b/mysql-test/main/lock_sync.test @@ -44,30 +44,6 @@ select @@global.concurrent_insert; connect (con1, localhost, root,,); connect (con2, localhost, root,,); connection default; ---disable_warnings -drop table if exists t0, t1, t2, t3, t4, t5; -drop view if exists v1, v2; -drop procedure if exists p1; -drop procedure if exists p2; -drop procedure if exists p3; -drop function if exists f1; -drop function if exists f2; -drop function if exists f3; -drop function if exists f4; -drop function if exists f5; -drop function if exists f6; -drop function if exists f7; -drop function if exists f8; -drop function if exists f9; -drop function if exists f10; -drop function if exists f11; -drop function if exists f12; -drop function if exists f13; -drop function if exists f14; -drop function if exists f15; -drop function if exists f16; -drop function if exists f17; ---enable_warnings create table t1 (i int primary key); insert into t1 values (1), (2), (3), (4), (5); create table t2 (j int primary key); @@ -1218,6 +1194,7 @@ COMMIT; --disconnect con1 --disconnect con2 --connection default +--source include/wait_until_count_sessions.inc DROP VIEW v1; DROP FUNCTION IF EXISTS f; DROP TABLE t1, t2; diff --git a/mysql-test/main/lock_view.result b/mysql-test/main/lock_view.result index 8137300f3e3..e4c666bff52 100644 --- a/mysql-test/main/lock_view.result +++ b/mysql-test/main/lock_view.result @@ -16,6 +16,7 @@ create definer=definer@localhost view mysqltest3.v3is as select schema_name from create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user; create definer=definer@localhost view mysqltest3.v3nt as select 1; create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1; +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; @@ -234,6 +235,7 @@ create view v1 as select * from (select * from t1) dt; lock table v1 read; disconnect con1; connection default; +/*!999999\- enable the sandbox mode */ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; /*!50001 CREATE VIEW `v1` AS SELECT diff --git a/mysql-test/main/log_errchk.test b/mysql-test/main/log_errchk.test index 1afc0e29f3a..c64f6e3c106 100644 --- a/mysql-test/main/log_errchk.test +++ b/mysql-test/main/log_errchk.test @@ -30,12 +30,12 @@ --echo # Case 2: Starting server with fifo file as general log file --echo # and slow query log file. # Restart server with fifo file as general log file. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc --enable_reconnect # Write file to make mysql-test-run.pl start up the server again ---exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc # Error 6 is reported, because the other end is closed diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index b8fbd40baed..03d40be897f 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -676,6 +676,59 @@ SELECT * FROM t1; a b c 3 2 2 DROP TABLE t1; +# MDEV-30046 wrong row targeted with "insert ... on duplicate" and +# "replace", leading to data corruption +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +replace into t values ('Hrecvx_0004mm-00',2); +select * from t; +s n +Hrecvx_0004ln-00 1 +Hrecvx_0004mm-00 2 +drop table t; +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +insert into t values ('Hrecvx_0004mm-00',2) +on duplicate key update n = values (n); +select * from t; +s n +Hrecvx_0004ln-00 1 +Hrecvx_0004mm-00 2 +drop table t; # +# MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key +# +create table t1 (a int, b text, unique (b)); +insert ignore t1 values (1, 'a'), (2, 'A'); +Warnings: +Warning 1062 Duplicate entry 'A' for key 'b' +select * from t1; +a b +1 a +update t1 set b='A' where a=1; +select * from t1; +a b +1 A +drop table t1; +create table t1 (a int, b blob, unique (b)); +insert t1 values (1, 'a'), (2, 'A'); +select * from t1; +a b +1 a +2 A +update t1 set b='A' where a=1; +ERROR 23000: Duplicate entry 'A' for key 'b' +drop table t1; +# +# MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +# +create table t1 (i int, unique key (i) using hash); +alter table t1 disable keys; +insert into t1 values (1),(2); +insert into t1 values (1); +ERROR 23000: Duplicate entry '1' for key 'i' +alter table t1 enable keys; +insert into t1 values (2); +ERROR 23000: Duplicate entry '2' for key 'i' +drop table t1; # End of 10.5 tests -# diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 01c3f736df8..8acb5e9e080 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -503,7 +503,6 @@ start transaction; alter table tmp alter column a set default 8; unlock tables; drop table t2; ---source include/have_innodb.inc --echo # --echo # MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table @@ -642,7 +641,6 @@ insert into t1 values (0); check table t1 extended; drop table t1; - --echo # --echo # MDEV-32837 long unique does not work like unique key when using replace --echo # @@ -655,6 +653,49 @@ REPLACE INTO t1 VALUES (3,2,2); SELECT * FROM t1; DROP TABLE t1; +--echo # MDEV-30046 wrong row targeted with "insert ... on duplicate" and +--echo # "replace", leading to data corruption +--source include/have_innodb.inc +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +replace into t values ('Hrecvx_0004mm-00',2); +select * from t; +drop table t; + +create table t (s blob, n int, unique (s)) engine=innodb; +insert into t values ('Hrecvx_0004ln-00',1), ('Hrecvx_0004mm-00',1); +insert into t values ('Hrecvx_0004mm-00',2) + on duplicate key update n = values (n); +select * from t; +drop table t; --echo # +--echo # MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key +--echo # +create table t1 (a int, b text, unique (b)); +insert ignore t1 values (1, 'a'), (2, 'A'); +select * from t1; +update t1 set b='A' where a=1; +select * from t1; +drop table t1; + +create table t1 (a int, b blob, unique (b)); +insert t1 values (1, 'a'), (2, 'A'); +select * from t1; +--error ER_DUP_ENTRY +update t1 set b='A' where a=1; +drop table t1; + +--echo # +--echo # MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +--echo # +create table t1 (i int, unique key (i) using hash); +alter table t1 disable keys; +insert into t1 values (1),(2); +--error ER_DUP_ENTRY +insert into t1 values (1); +alter table t1 enable keys; +--error ER_DUP_ENTRY +insert into t1 values (2); +drop table t1; + --echo # End of 10.5 tests ---echo # diff --git a/mysql-test/main/lowercase_fs_on.test b/mysql-test/main/lowercase_fs_on.test index 1d306826e27..9a7fc369207 100644 --- a/mysql-test/main/lowercase_fs_on.test +++ b/mysql-test/main/lowercase_fs_on.test @@ -16,7 +16,7 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err; --remove_file $SEARCH_FILE #Shutdown the server ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -30,7 +30,7 @@ let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is co --source include/search_pattern_in_file.inc #Restart the server ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc #Cleanup diff --git a/mysql-test/main/mdl_sync.result b/mysql-test/main/mdl_sync.result index 032b686bae5..bece98a675e 100644 --- a/mysql-test/main/mdl_sync.result +++ b/mysql-test/main/mdl_sync.result @@ -2431,6 +2431,9 @@ create table t1 (a int) engine=myisam; create table t2 (a int) stats_persistent=0, engine=innodb; insert into t1 values (1); insert into t2 values (1); +connect con1, localhost, root; +start transaction with consistent snapshot; +connection default; SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; update t1,t2 set t1.a=2,t2.a=3; connection con2; @@ -2462,6 +2465,7 @@ connection default; SET DEBUG_SYNC= 'RESET'; drop table t1,t2; disconnect con2; +disconnect con1; # # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null' # failed in open_ltable() diff --git a/mysql-test/main/mdl_sync.test b/mysql-test/main/mdl_sync.test index 27e2ff4393c..aa3bd60e64e 100644 --- a/mysql-test/main/mdl_sync.test +++ b/mysql-test/main/mdl_sync.test @@ -3115,6 +3115,12 @@ create table t2 (a int) stats_persistent=0, engine=innodb; insert into t1 values (1); insert into t2 values (1); +connect (con1, localhost, root); +# disable innodb purge thread, otherwise it might start purging t2, +# and will take an mdl, affecting metadata_lock_info output. +start transaction with consistent snapshot; +connection default; + SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; --send update t1,t2 set t1.a=2,t2.a=3 @@ -3160,6 +3166,7 @@ connection default; SET DEBUG_SYNC= 'RESET'; drop table t1,t2; disconnect con2; +disconnect con1; --echo # --echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null' diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result index 76114ae7c41..dbe9a32ab11 100644 --- a/mysql-test/main/myisam.result +++ b/mysql-test/main/myisam.result @@ -1,6 +1,5 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); -SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) diff --git a/mysql-test/main/myisam.test b/mysql-test/main/myisam.test index 1a20f97a54f..dbb54e710d5 100644 --- a/mysql-test/main/myisam.test +++ b/mysql-test/main/myisam.test @@ -7,9 +7,6 @@ call mtr.add_suppression("Can't find record in '.*'"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); -# Initialise -SET SQL_WARNINGS=1; - # # Test problem with CHECK TABLE; # diff --git a/mysql-test/main/myisam_crash_before_flush_keys.test b/mysql-test/main/myisam_crash_before_flush_keys.test index 791e43b0c9b..c48f2b42044 100644 --- a/mysql-test/main/myisam_crash_before_flush_keys.test +++ b/mysql-test/main/myisam_crash_before_flush_keys.test @@ -26,14 +26,14 @@ INSERT INTO t1 VALUES (1,2),(2,3),(3,4),(4,5),(5,6); SET SESSION debug_dbug="d,crash_before_flush_keys"; --echo # Write file to make mysql-test-run.pl expect crash ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --echo # Run the crashing query --error 2013 FLUSH TABLE t1; --echo # Write file to make mysql-test-run.pl start the server ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --echo # Turn on reconnect --enable_reconnect diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result index 1792f09d3ac..d430e47f097 100644 --- a/mysql-test/main/mysql.result +++ b/mysql-test/main/mysql.result @@ -552,6 +552,7 @@ Table Create Table a1\`b1 CREATE TABLE `a1\``b1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `a1\``b1` ( @@ -583,6 +584,7 @@ Table Create Table a1\"b1 CREATE TABLE "a1\""b1" ( "a" int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE "a1\""b1" ( @@ -607,11 +609,11 @@ set sql_mode=default; create table t1 (a text); select count(*) from t1; count(*) -43 +44 truncate table t1; select count(*) from t1; count(*) -43 +44 truncate table t1; select count(*) from t1; count(*) @@ -623,7 +625,7 @@ count(*) truncate table t1; select count(*) from t1; count(*) -43 +44 truncate table t1; select count(*) from t1; count(*) @@ -637,6 +639,31 @@ drop table t1; WARNING: option '--enable-cleartext-plugin' is obsolete. 1 1 +# End of 10.3 tests +# +# MDEV-21778 Disable system commands in mysql/mariadb client +# +ERROR at line 1: Not allowed in the sandbox mode +1 +ERROR at line 1: Not allowed in the sandbox mode +2 +ERROR at line 1: Not allowed in the sandbox mode +3 +1 +entering sandbox +system +tee +source +^^^ +2 +entering sandbox +system +tee +source +^^^ +3 +# End of 10.5 tests # # MDEV-30327 Client crashes in print_last_query_cost # +# End of 11.0 tests diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test index 5aa130f8a4c..9d16db80e70 100644 --- a/mysql-test/main/mysql.test +++ b/mysql-test/main/mysql.test @@ -610,6 +610,7 @@ EOF create database `aa``bb````cc`; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql drop database `aa``bb````cc`; +--remove_file $MYSQLTEST_VARDIR/tmp/backticks.sql # # MySQL Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT @@ -620,6 +621,7 @@ delimiter <<" as a; EOF --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql +--remove_file $MYSQLTEST_VARDIR/tmp/13639125.sql # # --skip-column-names and alignment @@ -702,7 +704,7 @@ select count(*) from t1; truncate table t1; --exec $MYSQL --disable-local-infile -e "/*q*/$ldli" select count(*) from t1; truncate table t1; drop table t1; - +--remove_file $MYSQLTEST_VARDIR/tmp/bug.sql --echo # --echo # MDEV-15538 '-N' Produce html output wrong @@ -716,6 +718,46 @@ drop table t1; --echo --exec $MYSQL test --enable-cleartext-plugin -e "select 1" +--echo # End of 10.3 tests + +--echo # +--echo # MDEV-21778 Disable system commands in mysql/mariadb client +--echo # + +--error 1 +--exec $MYSQL --sandbox -Ne "select 1; \! echo foo; select 0" 2>&1 +--error 1 +--exec $MYSQL --sandbox -Ne "select 2; \T echo foo; select 0" 2>&1 +--error 1 +--exec $MYSQL --sandbox -Ne "select 3; \. echo.foo; select 0" 2>&1 + +--write_file $MYSQL_TMP_DIR/mysql_in +select 'entering sandbox'; +\- +select 'system'; +\! echo foo +select 'tee'; +\T echo foo +select 'source'; +\. echo.foo +select '^^^'; +EOF + +write_line "select 1; +source $MYSQL_TMP_DIR/mysql_in; +select 2; +source $MYSQL_TMP_DIR/mysql_in; +sandbox; +select 3; +source $MYSQL_TMP_DIR/mysql_in;" $MYSQL_TMP_DIR/mysql_in2; + +--exec $MYSQL -fN <$MYSQL_TMP_DIR/mysql_in2 + +--remove_file $MYSQL_TMP_DIR/mysql_in +--remove_file $MYSQL_TMP_DIR/mysql_in2 + +--echo # End of 10.5 tests + --echo # --echo # MDEV-30327 Client crashes in print_last_query_cost --echo # @@ -725,3 +767,5 @@ drop table t1; --exec $MYSQL --show-query-costs --port=$MASTER_MYPORT -e "show tables in mysql like 'foo'" --enable_result_log --enable_query_log + +--echo # End of 11.0 tests diff --git a/mysql-test/main/mysql_client_test.test b/mysql-test/main/mysql_client_test.test index 0de459bd316..d620f4c7078 100644 --- a/mysql-test/main/mysql_client_test.test +++ b/mysql-test/main/mysql_client_test.test @@ -23,7 +23,7 @@ call mtr.add_suppression(" IP address .* could not be resolved"); # server or run mysql-test-run --debug mysql_client_test and check # var/log/mysql_client_test.trace ---exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 +--write_line "$MYSQL_CLIENT_TEST" $MYSQLTEST_VARDIR/log/mysql_client_test.out.log --exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 # End of 4.1 tests diff --git a/mysql-test/main/mysql_client_test_comp.test b/mysql-test/main/mysql_client_test_comp.test index 36a12b6691e..f37d82a20e5 100644 --- a/mysql-test/main/mysql_client_test_comp.test +++ b/mysql-test/main/mysql_client_test_comp.test @@ -12,7 +12,7 @@ SET @old_slow_query_log= @@global.slow_query_log; call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'"); call mtr.add_suppression(" IP address .* could not be resolved"); ---exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1 +--write_line "$MYSQL_CLIENT_TEST" $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log --exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1 # End of test diff --git a/mysql-test/main/mysql_client_test_nonblock.test b/mysql-test/main/mysql_client_test_nonblock.test index 73e7a6d378d..c4bc4304307 100644 --- a/mysql-test/main/mysql_client_test_nonblock.test +++ b/mysql-test/main/mysql_client_test_nonblock.test @@ -19,7 +19,7 @@ call mtr.add_suppression(" IP address .* could not be resolved"); # server or run mysql-test-run --debug mysql_client_test and check # var/log/mysql_client_test.trace ---exec echo "$MYSQL_CLIENT_TEST --non-blocking-api" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 +--write_line "$MYSQL_CLIENT_TEST --non-blocking-api" $MYSQLTEST_VARDIR/log/mysql_client_test.out.log --exec $MYSQL_CLIENT_TEST --non-blocking-api --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 # End of 4.1 tests diff --git a/mysql-test/main/mysql_install_db_win_admin.result b/mysql-test/main/mysql_install_db_win_admin.result index 06d3d677977..dd0e4e3b260 100644 --- a/mysql-test/main/mysql_install_db_win_admin.result +++ b/mysql-test/main/mysql_install_db_win_admin.result @@ -1,10 +1,4 @@ use mysql; -Running bootstrap -Creating my.ini file -Removing default user -Allowing remote access for user root -Setting root password -Creation of the database was successful # Kill the server # restart: --datadir=MYSQLTEST_VARDIR/tmp/ddir connect root,localhost,root,wrongpass,mysql; diff --git a/mysql-test/main/mysql_install_db_win_admin.test b/mysql-test/main/mysql_install_db_win_admin.test index a6b98f97058..28a2356c465 100644 --- a/mysql-test/main/mysql_install_db_win_admin.test +++ b/mysql-test/main/mysql_install_db_win_admin.test @@ -6,12 +6,15 @@ # and start server from this directory. let $ddir= $MYSQLTEST_VARDIR/tmp/ddir; use mysql; -exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R; +--disable_result_log +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo --verbose-bootstrap -R; +--enable_result_log --source include/kill_mysqld.inc let $restart_parameters=--datadir=$ddir; --source include/start_mysqld.inc # Check that connect with wrong password succeeds +# (because it can alternatively connect with GSSAPI as admin) connect (root,localhost,root,wrongpass,mysql); --source include/kill_mysqld.inc diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result index 97548768a2d..86ff8179b44 100644 --- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result @@ -18,6 +18,8 @@ execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_ execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +SET @old_alter_alg=@@SESSION.alter_algorithm; +SET session alter_algorithm='COPY'; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -52,6 +54,7 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone E execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SET session alter_algorithm=@old_alter_alg; # # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases # @@ -67,6 +70,8 @@ execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_ execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +SET @old_alter_alg=@@SESSION.alter_algorithm; +SET session alter_algorithm='COPY'; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -98,6 +103,7 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone E execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SET session alter_algorithm=@old_alter_alg; SELECT COUNT(*) FROM time_zone; COUNT(*) 2 @@ -123,6 +129,8 @@ execute immediate if(@wsrep_is_on, 'SET @save_wsrep_on=@@WSREP_ON, WSREP_ON=OFF' SET @save_sql_log_bin=@@SQL_LOG_BIN; SET SESSION SQL_LOG_BIN=0; SET @wsrep_cannot_replicate_tz=0; +SET @old_alter_alg=@@SESSION.alter_algorithm; +SET session alter_algorithm='COPY'; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -152,6 +160,7 @@ execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_t execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id'); SET SESSION SQL_LOG_BIN=@save_sql_log_bin; execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); +SET session alter_algorithm=@old_alter_alg; SELECT COUNT(*) FROM time_zone; COUNT(*) 2 @@ -505,6 +514,8 @@ execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_ execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition ENGINE=InnoDB', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'select ENGINE into @time_zone_transition_type_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''time_zone_transition_type''', 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, 'ALTER TABLE time_zone_transition_type ENGINE=InnoDB', 'do 0'); +SET @old_alter_alg=@@SESSION.alter_algorithm; +SET session alter_algorithm='COPY'; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -522,6 +533,7 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone E execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_name ENGINE=', @time_zone_name_engine), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); +SET session alter_algorithm=@old_alter_alg; DROP TABLE baseline; DROP TABLE time_zone; DROP TABLE time_zone_name; diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 2cf652655e0..410af54441c 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -1,3 +1,5 @@ +set pseudo_thread_id=5; +reset master; SET GLOBAL log_bin_compress=on; SET GLOBAL log_bin_compress_min_len=10; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)); @@ -15,21 +17,21 @@ FLUSH BINARY LOGS; /*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 -# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +# at +# server id 1 end_log_pos CRC32 XXX Start: xxx ROLLBACK/*!*/; -# at 256 -# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] -# at 285 -# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 -# at 329 -# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +# at +# server id 1 end_log_pos CRC32 XXX Gtid list [] +# at +# server id 1 end_log_pos CRC32 XXX Binlog checkpoint master-bin.000001 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-1 ddl /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=0*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; -# at 371 -# server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,26 +44,26 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 542 -# server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 584 -# server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 745 -# server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 787 -# at 861 -# server id 1 end_log_pos 861 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") -# server id 1 end_log_pos 917 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 917 -# server id 1 end_log_pos 985 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -74,23 +76,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 985 -# server id 1 end_log_pos 1058 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1058 -# server id 1 end_log_pos 1100 CRC32 XXX GTID 0-1-4 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1100 -# at 1176 -# server id 1 end_log_pos 1176 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) -# server id 1 end_log_pos 1232 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1232 -# server id 1 end_log_pos 1299 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -103,23 +105,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ # Number of rows: 1 -# at 1299 -# server id 1 end_log_pos 1372 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1372 -# server id 1 end_log_pos 1414 CRC32 XXX GTID 0-1-5 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1414 -# at 1492 -# server id 1 end_log_pos 1492 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") -# server id 1 end_log_pos 1548 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1548 -# server id 1 end_log_pos 1614 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -132,23 +134,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1614 -# server id 1 end_log_pos 1687 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1687 -# server id 1 end_log_pos 1729 CRC32 XXX GTID 0-1-6 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1729 -# at 1804 -# server id 1 end_log_pos 1804 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") -# server id 1 end_log_pos 1860 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1860 -# server id 1 end_log_pos 1927 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -161,23 +163,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1927 -# server id 1 end_log_pos 2000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2000 -# server id 1 end_log_pos 2042 CRC32 XXX GTID 0-1-7 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 2042 -# at 2096 -# server id 1 end_log_pos 2096 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t2 SELECT * FROM t1 -# server id 1 end_log_pos 2152 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2152 -# server id 1 end_log_pos 2243 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -223,23 +225,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2243 -# server id 1 end_log_pos 2316 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2316 -# server id 1 end_log_pos 2358 CRC32 XXX GTID 0-1-8 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 2358 -# at 2424 -# server id 1 end_log_pos 2424 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL -# server id 1 end_log_pos 2480 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2480 -# server id 1 end_log_pos 2579 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Update_compressed_rows: table id flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -304,23 +306,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 3 -# at 2579 -# server id 1 end_log_pos 2652 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2652 -# server id 1 end_log_pos 2694 CRC32 XXX GTID 0-1-9 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2694 -# at 2731 -# server id 1 end_log_pos 2731 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> DELETE FROM t1 -# server id 1 end_log_pos 2787 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 2787 -# server id 1 end_log_pos 2879 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Delete_compressed_rows: table id flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -366,23 +368,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2879 -# server id 1 end_log_pos 2952 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2952 -# server id 1 end_log_pos 2994 CRC32 XXX GTID 0-1-10 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2994 -# at 3031 -# server id 1 end_log_pos 3031 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> DELETE FROM t2 -# server id 1 end_log_pos 3087 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 3087 -# server id 1 end_log_pos 3172 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Delete_compressed_rows: table id flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -428,13 +430,13 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 3172 -# server id 1 end_log_pos 3245 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 3245 -# server id 1 end_log_pos 3293 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at +# server id 1 end_log_pos CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_row_compressed.test b/mysql-test/main/mysqlbinlog_row_compressed.test index 03868d3e6b3..b3a6add4efc 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.test +++ b/mysql-test/main/mysqlbinlog_row_compressed.test @@ -4,13 +4,14 @@ --source include/have_log_bin.inc --source include/have_binlog_format_row.inc ---source include/have_normal_zlib.inc # # # mysqlbinlog: compressed row event # # +set pseudo_thread_id=5; +reset master; SET GLOBAL log_bin_compress=on; SET GLOBAL log_bin_compress_min_len=10; @@ -30,7 +31,7 @@ DELETE FROM t2; FLUSH BINARY LOGS; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ /table id \d+/table id / /end_log_pos \d+/end_log_pos / /# at \d+/# at / --exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --echo diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index 69aa91a8903..f87954335a4 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -382,7 +382,7 @@ START TRANSACTION # server id 1 end_log_pos END_LOG_POS CRC32 XXX Annotate_rows: #Q> UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id #Q> SET t1.is_deleted = TRUE -#Q> WHERE t1.id = +#Q> WHERE t1.id = 1 # server id 1 end_log_pos END_LOG_POS CRC32 XXX Table_map: `test`.`t1` mapped to number TID # at POS # server id 1 end_log_pos END_LOG_POS CRC32 XXX Update_rows: table id TID flags: STMT_END_F diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index c0d26f3f9df..471cb4b72c6 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -15,21 +15,21 @@ FLUSH BINARY LOGS; /*!40019 SET @@session.max_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 -# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +# at +# server id 1 end_log_pos CRC32 XXX Start: xxx ROLLBACK/*!*/; -# at 256 -# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] -# at 285 -# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 -# at 329 -# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +# at +# server id 1 end_log_pos CRC32 XXX Gtid list [] +# at +# server id 1 end_log_pos CRC32 XXX Binlog checkpoint master-bin.000001 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-1 ddl /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=0*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; -# at 371 -# server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,136 +42,136 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 542 -# server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 584 -# server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 745 -# server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 787 -# server id 1 end_log_pos 915 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") /*!*/; -# at 915 -# server id 1 end_log_pos 988 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 988 -# server id 1 end_log_pos 1030 CRC32 XXX GTID 0-1-4 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1030 -# server id 1 end_log_pos 1158 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) /*!*/; -# at 1158 -# server id 1 end_log_pos 1231 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1231 -# server id 1 end_log_pos 1273 CRC32 XXX GTID 0-1-5 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1273 -# server id 1 end_log_pos 1403 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") /*!*/; -# at 1403 -# server id 1 end_log_pos 1476 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1476 -# server id 1 end_log_pos 1518 CRC32 XXX GTID 0-1-6 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1518 -# server id 1 end_log_pos 1645 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") /*!*/; -# at 1645 -# server id 1 end_log_pos 1718 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1718 -# server id 1 end_log_pos 1760 CRC32 XXX GTID 0-1-7 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 1760 -# server id 1 end_log_pos 1868 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t2 SELECT * FROM t1 /*!*/; -# at 1868 -# server id 1 end_log_pos 1941 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1941 -# server id 1 end_log_pos 1983 CRC32 XXX GTID 0-1-8 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 1983 -# server id 1 end_log_pos 2100 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL /*!*/; -# at 2100 -# server id 1 end_log_pos 2173 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2173 -# server id 1 end_log_pos 2215 CRC32 XXX GTID 0-1-9 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2215 -# server id 1 end_log_pos 2306 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; DELETE FROM t1 /*!*/; -# at 2306 -# server id 1 end_log_pos 2379 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2379 -# server id 1 end_log_pos 2421 CRC32 XXX GTID 0-1-10 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2421 -# server id 1 end_log_pos 2512 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; DELETE FROM t2 /*!*/; -# at 2512 -# server id 1 end_log_pos 2585 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2585 -# server id 1 end_log_pos 2633 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at +# server id 1 end_log_pos CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.test b/mysql-test/main/mysqlbinlog_stmt_compressed.test index 4a65124339d..5c3fb58c50c 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.test +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.test @@ -4,7 +4,6 @@ --source include/have_log_bin.inc --source include/have_binlog_format_statement.inc ---source include/have_normal_zlib.inc # # # mysqlbinlog: compressed query event @@ -29,7 +28,7 @@ DELETE FROM t2; FLUSH BINARY LOGS; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ /table id \d+/table id / /end_log_pos \d+/end_log_pos / /# at \d+/# at / --exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --echo diff --git a/mysql-test/main/mysqld_option_err.result b/mysql-test/main/mysqld_option_err.result index e2c7b0bd213..157edb58532 100644 --- a/mysql-test/main/mysqld_option_err.result +++ b/mysql-test/main/mysqld_option_err.result @@ -4,13 +4,16 @@ Test bad default storage engine. Test non-numeric value passed to number option. Test that bad value for plugin enum option is rejected correctly. Test to see if multiple unknown options will be displayed in the error output -unknown option '--nonexistentoption' -unknown option '--alsononexistent' -unknown variable 'nonexistentvariable=1' +FOUND 1 /unknown option '--nonexistentoption2'/ in mysqltest.log +FOUND 1 /unknown option '--alsononexistent'/ in mysqltest.log +FOUND 1 /unknown variable 'nonexistentvariable=1'/ in mysqltest.log Test to see if multiple ambiguous options and invalid arguments will be displayed in the error output -Error while setting value 'invalid_value' to 'sql_mode' -ambiguous option '--character' (character-set-client-handshake, character_sets_dir) -option '--bootstrap' cannot take an argument +FOUND 1 /Error while setting value 'invalid_value' to 'sql_mode'/ in mysqltest.log +FOUND 1 /ambiguous option '--character'/ in mysqltest.log +FOUND 1 /option '--bootstrap' cannot take an argument/ in mysqltest.log +FOUND 1 /Integer value out of range for uint64: '18446744073709551616' for binlog_cache_size/ in mysqltest.log +FOUND 1 /Unknown suffix 'y' used for variable 'bulk_insert_buffer_size' \(value '123y'\). Legal suffix characters are: K, M, G, T, P, E/ in mysqltest.log +FOUND 1 /Error while setting value '123y' to 'bulk_insert_buffer_size'/ in mysqltest.log Test that --help --verbose works Test that --not-known-option --help --verbose gives error Done. diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test index ad4df61b0f8..c2b943bafa1 100644 --- a/mysql-test/main/mysqld_option_err.test +++ b/mysql-test/main/mysqld_option_err.test @@ -25,7 +25,7 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --echo Test bad binlog format. ---error 1 +--error 13 --exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --log-bin --binlog-format=badformat >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 @@ -35,7 +35,7 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --echo Test non-numeric value passed to number option. ---error 1 +--error 9 --exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --min-examined-row-limit=notanumber >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 @@ -46,17 +46,35 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 7 --exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --plugin-dir=$MYSQLTEST_VARDIR/plugins --plugin-load=example=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +--let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log + --echo Test to see if multiple unknown options will be displayed in the error output -# Remove the noise to make the test robust ---replace_regex /^((?!nonexistent).)*$// /.*unknown/unknown/ --error 7 ---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption --alsononexistent --nonexistentvariable=1 2>&1 +--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption2 --alsononexistent --nonexistentvariable=1 >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 + +--let SEARCH_PATTERN=unknown option '--nonexistentoption2' +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=unknown option '--alsononexistent' +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=unknown variable 'nonexistentvariable=1' +--source include/search_pattern_in_file.inc --echo Test to see if multiple ambiguous options and invalid arguments will be displayed in the error output -# Remove the noise to make the test robust ---replace_regex /^((?!('sql_mode'|'--character'|'--bootstrap')).)*$// /.*Error while setting value/Error while setting value/ /.*ambiguous option/ambiguous option/ /.*option '--bootstrap'/option '--bootstrap'/ ---error 1 ---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --getopt-prefix-matching --sql-mode=invalid_value --character --bootstrap=partstoob 2>&1 +--error 9 +--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --getopt-prefix-matching --sql-mode=invalid_value --character --bootstrap=partstoob --binlog_cache_size=18446744073709551616 --bulk_insert_buffer_size=123y >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 + +--let SEARCH_PATTERN=Error while setting value 'invalid_value' to 'sql_mode' +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=ambiguous option '--character' +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=option '--bootstrap' cannot take an argument +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=Integer value out of range for uint64: '18446744073709551616' for binlog_cache_size +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=Unknown suffix 'y' used for variable 'bulk_insert_buffer_size' \(value '123y'\). Legal suffix characters are: K, M, G, T, P, E +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=Error while setting value '123y' to 'bulk_insert_buffer_size' +--source include/search_pattern_in_file.inc # # Test that an wrong option with --help --verbose gives an error diff --git a/mysql-test/main/mysqldump-compat-102.result b/mysql-test/main/mysqldump-compat-102.result index 86a2ebc47e0..d5ed54570e2 100644 --- a/mysql-test/main/mysqldump-compat-102.result +++ b/mysql-test/main/mysqldump-compat-102.result @@ -58,6 +58,7 @@ BEGIN log(0, 'Session ' || connection_id() || ' ' || current_user || ' started'); END; $$ +/*!999999\- enable the sandbox mode */ -- MariaDB dump DUMPVERSION Distrib DISTVERSION, for OS -- -- Host: localhost Database: db1_mdev17429 diff --git a/mysql-test/main/mysqldump-max.result b/mysql-test/main/mysqldump-max.result index 7dd1030eac1..e76193ac5bb 100644 --- a/mysql-test/main/mysqldump-max.result +++ b/mysql-test/main/mysqldump-max.result @@ -77,6 +77,7 @@ id name 3 first value 4 first value 5 first value +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -102,7 +103,7 @@ CREATE TABLE `t1` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t1` VALUES +INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -119,7 +120,7 @@ CREATE TABLE `t2` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t2` VALUES +INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -136,7 +137,7 @@ CREATE TABLE `t3` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t3` VALUES +INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -153,7 +154,7 @@ CREATE TABLE `t4` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t4` VALUES +INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -170,7 +171,7 @@ CREATE TABLE `t5` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t5` VALUES +INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -187,7 +188,7 @@ CREATE TABLE `t6` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; -INSERT IGNORE INTO `t6` VALUES +INSERT IGNORE INTO `t6` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -204,6 +205,7 @@ INSERT IGNORE INTO `t6` VALUES /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -229,7 +231,7 @@ CREATE TABLE `t1` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED INTO `t1` VALUES +INSERT DELAYED INTO `t1` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -246,7 +248,7 @@ CREATE TABLE `t2` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT DELAYED INTO `t2` VALUES +INSERT DELAYED INTO `t2` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -263,7 +265,7 @@ CREATE TABLE `t3` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; -INSERT DELAYED INTO `t3` VALUES +INSERT DELAYED INTO `t3` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -280,7 +282,7 @@ CREATE TABLE `t4` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; -INSERT DELAYED INTO `t4` VALUES +INSERT DELAYED INTO `t4` VALUES (1,'first value'), (2,'first value'), (3,'first value'), @@ -297,7 +299,7 @@ CREATE TABLE `t5` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; -INSERT DELAYED INTO `t5` VALUES +INSERT DELAYED INTO `t5` VALUES (1,'first value'), (2,'first value'), (3,'first value'), diff --git a/mysql-test/main/mysqldump-nl.result b/mysql-test/main/mysqldump-nl.result index 66902492934..1e9928308fc 100644 --- a/mysql-test/main/mysqldump-nl.result +++ b/mysql-test/main/mysqldump-nl.result @@ -12,6 +12,7 @@ create procedure sp() select * from `v1 1v`; flush tables; use test; +/*!999999\- enable the sandbox mode */ -- -- Current Database: `mysqltest1 @@ -134,6 +135,7 @@ test\` \! ls # test` +/*!999999\- enable the sandbox mode */ -- -- Current Database: `test``` diff --git a/mysql-test/main/mysqldump-no-binlog.result b/mysql-test/main/mysqldump-no-binlog.result index 223034d8401..669675ff21b 100644 --- a/mysql-test/main/mysqldump-no-binlog.result +++ b/mysql-test/main/mysqldump-no-binlog.result @@ -1 +1,2 @@ mariadb-dump: Error: Binlogging on server not active +/*!999999\- enable the sandbox mode */ diff --git a/mysql-test/main/mysqldump-order-by-size.result b/mysql-test/main/mysqldump-order-by-size.result index 361852905c0..3bd953b828d 100644 --- a/mysql-test/main/mysqldump-order-by-size.result +++ b/mysql-test/main/mysqldump-order-by-size.result @@ -21,6 +21,7 @@ test.t3 analyze status OK test.t4 analyze status Engine-independent statistics collected test.t4 analyze Warning Engine-independent statistics are not collected for column 'a' test.t4 analyze status OK +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t4` ( diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index 559f6f29f44..240a8499af1 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -41,6 +41,7 @@ CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; # # mysqldump of system tables with --system=all # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -632,6 +633,7 @@ UNLOCK TABLES; # # mysqldump of system tables with --system=all --replace # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1246,6 +1248,7 @@ UNLOCK TABLES; # # mysqldump of system tables with --system=all --insert-ignore # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1300,28 +1303,28 @@ USE mysql; LOCK TABLES `column_stats` WRITE; /*!40000 ALTER TABLE `column_stats` DISABLE KEYS */; -INSERT IGNORE INTO `column_stats` VALUES +INSERT IGNORE INTO `column_stats` VALUES ('mysql','tz','Time_zone_id','1','5',0.0000,4.0000,98.2500,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340966921, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.328244275, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"5\", \"size\": 0.002544529, \"ndv\": 1}]}'); /*!40000 ALTER TABLE `column_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `index_stats` WRITE; /*!40000 ALTER TABLE `index_stats` DISABLE KEYS */; -INSERT IGNORE INTO `index_stats` VALUES +INSERT IGNORE INTO `index_stats` VALUES ('mysql','tz','PRIMARY',1,98.2500); /*!40000 ALTER TABLE `index_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `table_stats` WRITE; /*!40000 ALTER TABLE `table_stats` DISABLE KEYS */; -INSERT IGNORE INTO `table_stats` VALUES +INSERT IGNORE INTO `table_stats` VALUES ('mysql','tz',393); /*!40000 ALTER TABLE `table_stats` ENABLE KEYS */; UNLOCK TABLES; LOCK TABLES `innodb_index_stats` WRITE; /*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */; -INSERT IGNORE INTO `innodb_index_stats` VALUES +INSERT IGNORE INTO `innodb_index_stats` VALUES ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',4,1,'Time_zone_id'), ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',393,1,'Time_zone_id,Transition_time'), ('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'), @@ -1331,7 +1334,7 @@ UNLOCK TABLES; LOCK TABLES `innodb_table_stats` WRITE; /*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */; -INSERT IGNORE INTO `innodb_table_stats` VALUES +INSERT IGNORE INTO `innodb_table_stats` VALUES ('mysql','tz','2019-12-31 21:00:00',393,1,0); /*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */; UNLOCK TABLES; @@ -1340,7 +1343,7 @@ USE mysql; LOCK TABLES `time_zone` WRITE; /*!40000 ALTER TABLE `time_zone` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone` VALUES +INSERT IGNORE INTO `time_zone` VALUES (1,'N'), (2,'N'), (3,'N'), @@ -1351,7 +1354,7 @@ UNLOCK TABLES; LOCK TABLES `time_zone_name` WRITE; /*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_name` VALUES +INSERT IGNORE INTO `time_zone_name` VALUES ('Europe/Moscow',3), ('Japan',5), ('leap/Europe/Moscow',4), @@ -1363,7 +1366,7 @@ UNLOCK TABLES; LOCK TABLES `time_zone_leap_second` WRITE; /*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_leap_second` VALUES +INSERT IGNORE INTO `time_zone_leap_second` VALUES (78796800,1), (94694401,2), (126230402,3), @@ -1391,7 +1394,7 @@ UNLOCK TABLES; LOCK TABLES `time_zone_transition` WRITE; /*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_transition` VALUES +INSERT IGNORE INTO `time_zone_transition` VALUES (1,-1693706400,0), (1,-1680483600,1), (1,-1663455600,2), @@ -1790,7 +1793,7 @@ UNLOCK TABLES; LOCK TABLES `time_zone_transition_type` WRITE; /*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */; -INSERT IGNORE INTO `time_zone_transition_type` VALUES +INSERT IGNORE INTO `time_zone_transition_type` VALUES (1,0,7200,1,'MEST'), (1,1,3600,0,'MET'), (1,2,7200,1,'MEST'), diff --git a/mysql-test/main/mysqldump-timing.result b/mysql-test/main/mysqldump-timing.result index 7fa11893274..5e2851b8f1c 100644 --- a/mysql-test/main/mysqldump-timing.result +++ b/mysql-test/main/mysqldump-timing.result @@ -7,6 +7,7 @@ CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (0); LOCK TABLE t1 WRITE; timeout without t1 contents expected +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -30,6 +31,7 @@ SET @save_max_statement_time=@@max_statement_time; SET GLOBAL max_statement_time=0.1; UNLOCK TABLES;; This would be a race condition otherwise, but default max_statement_time=0 makes it succeed +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump-utf8mb4.result b/mysql-test/main/mysqldump-utf8mb4.result index 904771302f8..7c5aea5fed8 100644 --- a/mysql-test/main/mysqldump-utf8mb4.result +++ b/mysql-test/main/mysqldump-utf8mb4.result @@ -32,6 +32,7 @@ Testing XML format output ---- Testing text format output ---- +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index ad8ff7ba6f0..d0ac3d51e93 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -31,6 +31,7 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(64, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -48,6 +49,7 @@ CREATE TABLE t1 (a double); INSERT IGNORE INTO t1 VALUES ('-9e999999'); Warnings: Warning 1264 Out of range value for column 'a' at row 1 +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -70,6 +72,7 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ("1.2345", 2.3456); ERROR 42S22: Unknown column '1.2345' in 'field list' SET SQL_MODE=@OLD_SQL_MODE; +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -83,6 +86,7 @@ INSERT INTO `t1` VALUES (1.23450,2.3456), (1.23450,2.3456), (1.23450,2.3456); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -96,6 +100,7 @@ INSERT INTO `t1` VALUES (1.23450,2.3456), (1.23450,2.3456), (1.23450,2.3456); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -136,6 +141,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -217,6 +223,7 @@ DROP TABLE t1; # CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r; INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -258,6 +265,7 @@ DROP TABLE t1; # CREATE TABLE t1 (a int) ENGINE=MYISAM; INSERT INTO t1 VALUES (1), (2); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -283,6 +291,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -313,6 +322,7 @@ DROP TABLE t1; # Bug#2592 mysqldump doesn't quote "tricky" names correctly # create table ```a` (i int); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE ```a` ( @@ -324,6 +334,7 @@ drop table ```a`; # Bug#2591 mysqldump quotes names inconsistently # create table t1(a int); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -357,6 +368,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -383,6 +395,7 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; set global sql_mode='ANSI_QUOTES'; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -416,6 +429,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -448,6 +462,7 @@ drop table t1; # create table t1(a int); insert into t1 values (1),(2),(3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -480,6 +495,7 @@ drop table t1; # # Bug#6101 create database problem # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -506,6 +522,7 @@ USE `test`; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; create database mysqldump_test_db character set latin2 collate latin2_bin; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -540,6 +557,7 @@ drop database mysqldump_test_db; # if it is explicitly set. CREATE TABLE t1 (a CHAR(10)); INSERT INTO t1 VALUES (_latin1 ''); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -582,6 +600,7 @@ UNLOCK TABLES; # If the future we can move this command into a separate test with # checking that "mysqldump" is compiled with "latin1" # +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -606,6 +625,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -630,6 +650,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -662,6 +683,7 @@ CREATE TABLE t1 (a int); CREATE TABLE t2 (a int); INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t2 VALUES (4),(5),(6); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -706,6 +728,7 @@ DROP TABLE t2; # CREATE TABLE t1 (`b` blob); INSERT INTO `t1` VALUES (0x602010000280100005E71A); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -747,6 +770,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (4),(5),(6); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -768,7 +792,7 @@ CREATE TABLE `t1` ( LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT IGNORE INTO `t1` VALUES +INSERT IGNORE INTO `t1` VALUES (1), (2), (3), @@ -787,6 +811,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -807,7 +832,7 @@ CREATE TABLE `t1` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t1` VALUES +INSERT DELAYED IGNORE INTO `t1` VALUES (1), (2), (3), @@ -1162,6 +1187,7 @@ F_cd00692c3bfe59267d5ecfac5310286c int, F_6faa8040da20ef399b63a72d0e4ab575 int, F_fe73f687e5bc5280214e0486b273a5f9 int); insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1531,6 +1557,7 @@ drop table t1; # CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1),(2),(3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1584,6 +1611,7 @@ CREATE TABLE t1 ( a INT ); CREATE TABLE t2 ( a INT ); INSERT INTO t1 VALUES (1), (2); INSERT INTO t2 VALUES (1), (2); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1619,6 +1647,7 @@ CREATE TABLE `t2` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1691,21 +1720,35 @@ create table t3(a varchar(30) primary key, b int not null); test_sequence ------ Testing with illegal table names ------ mariadb-dump: Couldn't find table: "\d-2-1.sql" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "\\t1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t\1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t\1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "t/1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T%1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T'1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_1" +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't find table: "T_" +/*!999999\- enable the sandbox mode */ test_sequence ------ Testing with illegal database names ------ mariadb-dump: Got error: 1049: "Unknown database 'mysqldump_test_d'" when selecting the database +/*!999999\- enable the sandbox mode */ mariadb-dump: Got error: 1049: "Unknown database 'mysqld\ump_test_db'" when selecting the database +/*!999999\- enable the sandbox mode */ drop table t1, t2, t3; drop database mysqldump_test_db; use test; @@ -1767,6 +1810,7 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1805,6 +1849,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1930,6 +1975,7 @@ create table t1(a int); create table t2(a int); create table t3(a int); mariadb-dump: Couldn't find table: "non_existing" +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -1979,6 +2025,7 @@ drop table t1, t2, t3; create table t1 (a int); mariadb-dump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `a` FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) mariadb-dump: Got error: 1064: "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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1" when retrieving data from server +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2020,6 +2067,7 @@ CREATE TABLE `t1` ( PRIMARY KEY (`a b`, `c"d`, `e``f`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; insert into t1 values (0815, 4711, 2006); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2050,6 +2098,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2105,6 +2154,7 @@ INSERT INTO t2 VALUES ('bingo'); INSERT INTO t2 VALUES ('waffle'); INSERT INTO t2 VALUES ('lemon'); create view v2 as select * from t2 where a like 'a%' with check option; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2204,6 +2254,7 @@ drop database db1; use test; create table t1(a int); create view v1 as select * from t1; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2274,6 +2325,7 @@ INSERT INTO t2 VALUES ('bingo'); INSERT INTO t2 VALUES ('waffle'); INSERT INTO t2 VALUES ('lemon'); create view v2 as select * from t2 where a like 'a%' with check option; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2344,6 +2396,7 @@ use test; # CREATE TABLE t1 (a char(10)); INSERT INTO t1 VALUES ('\''); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2391,6 +2444,7 @@ create view v1 as select * from v3 where b in (1, 2, 3, 4, 5, 6, 7); create view v2 as select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2543,6 +2597,7 @@ end if; end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci INSERT INTO t1 (a) VALUES (1),(2),(3),(22); update t1 set a = 4 where a=3; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2676,6 +2731,7 @@ DELIMITER ; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2825,6 +2881,7 @@ END // set sql_mode='ansi'; create procedure `a'b` () select 1; set sql_mode=''; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -2981,6 +3038,7 @@ d 2003-10-26 02:00:00 2003-10-26 02:00:00 set global time_zone='Europe/Moscow'; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3022,6 +3080,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3084,6 +3143,7 @@ a2 1 2 3 +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3164,6 +3224,7 @@ a b c 1 first value xxxx 2 second value tttt 3 third value vvv vvv +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3292,6 +3353,7 @@ BEGIN SET new.a = 0; END| SET SQL_MODE = @old_sql_mode; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3355,6 +3417,7 @@ DROP TABLE t1; # create table t1 (a binary(1), b blob); insert into t1 values ('',''); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3390,6 +3453,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3490,6 +3554,7 @@ insert into t values(5, 51); create view v1 as select qty, price, qty*price as value from t; create view v2 as select qty from v1; mysqldump { +/*!999999\- enable the sandbox mode */ /*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3505,6 +3570,7 @@ mysqldump { /*!50001 SET collation_connection = @saved_col_connection */; } mysqldump { +/*!999999\- enable the sandbox mode */ /*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -3550,6 +3616,7 @@ drop table t1; mysqldump { mariadb-dump: Got error: 1356: "View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" when using LOCK TABLES mariadb-dump: Couldn't execute 'SHOW FIELDS FROM `v1`': View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356) +/*!999999\- enable the sandbox mode */ -- failed on view `v1`: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1` @@ -3566,6 +3633,7 @@ insert into t1 values (1232131); insert into t1 values (4711); insert into t1 values (3231); insert into t1 values (0815); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3644,6 +3712,7 @@ create table basetable ( id serial, tag varchar(64) ); create database mysqldump_views; use mysqldump_views; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; @@ -3729,10 +3798,14 @@ grant all on test.* to mysqltest_1@localhost; create table t1(a int, b varchar(34)); reset master; mariadb-dump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +/*!999999\- enable the sandbox mode */ grant RELOAD on *.* to mysqltest_1@localhost; mariadb-dump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation (1227) +/*!999999\- enable the sandbox mode */ mariadb-dump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the BINLOG MONITOR privilege(s) for this operation (1227) +/*!999999\- enable the sandbox mode */ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; drop table t1; drop user mysqltest_1@localhost; @@ -3791,6 +3864,7 @@ use test; # # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA # +/*!999999\- enable the sandbox mode */ DROP TABLE IF EXISTS `TABLES`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -3855,6 +3929,7 @@ DROP TABLE t1; CREATE TABLE t2 (a INT) ENGINE=MyISAM; CREATE TABLE t3 (a INT) ENGINE=MyISAM; CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -3945,10 +4020,12 @@ connect user27293,localhost,user1,,mysqldump_test_db,$MASTER_MYPORT,$MASTER_MYS connection user27293; create procedure mysqldump_test_db.sp1() select 'hello'; mariadb-dump: user2 has insufficient privileges to SHOW CREATE PROCEDURE `sp1`! +/*!999999\- enable the sandbox mode */ -- insufficient privileges to SHOW CREATE PROCEDURE `sp1` -- does user2 have permissions on mysql.proc? +/*!999999\- enable the sandbox mode */ /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -3976,6 +4053,7 @@ drop database mysqldump_test_db; # CREATE TABLE t1 (c1 INT, c2 LONGBLOB); INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -4049,6 +4127,7 @@ use db42635; create table t1 (id int); create view db42635.v1 (c) as select * from db42635.t1; create view db42635.v2 (c) as select * from db42635.t1; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -4109,6 +4188,7 @@ drop database db42635; # SET NAMES utf8; CREATE TABLE `straße` ( f1 INT ); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4131,6 +4211,7 @@ UNLOCK TABLES; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4155,6 +4236,7 @@ UNLOCK TABLES; DROP TABLE `straße`; CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT ); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4178,6 +4260,7 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; mariadb-dump: Got error: 1146: "Table 'test.???????????????????????' doesn't exist" when using LOCK TABLES +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4194,6 +4277,7 @@ CREATE TABLE t1(a int, b int); INSERT INTO t1 VALUES (1,1); INSERT INTO t1 VALUES (2,3); INSERT INTO t1 VALUES (3,4), (4,5); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -4468,6 +4552,7 @@ insert into t1 values (1232131); insert into t1 values (4711); insert into t1 values (3231); insert into t1 values (0815); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -4600,6 +4685,7 @@ CREATE DATABASE test; create database `test-database`; use `test-database`; create table test (a int); +/*!999999\- enable the sandbox mode */ DROP TABLE IF EXISTS `test`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -4822,6 +4908,7 @@ CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN END | ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci; ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `test` ( @@ -5305,6 +5392,7 @@ USE test; # Also verify that a prefix of the mode's name is enough. # CREATE TABLE t1 (a INT); +/*!999999\- enable the sandbox mode */ /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -5541,6 +5629,7 @@ CREATE DATABASE `a\"'``b`; USE `a\"'``b`; CREATE PROCEDURE p1() BEGIN END; ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci; +/*!999999\- enable the sandbox mode */ /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = '' */ ; ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; @@ -5589,6 +5678,7 @@ CREATE VIEW nonunique_table_view_name AS SELECT 1; ################################################## # --compact --databases db1 db2 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; @@ -5657,6 +5747,7 @@ USE `db2`; ################################################## # --compact db2 +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nonunique_table_name` ( @@ -5679,6 +5770,7 @@ INSERT INTO `nonunique_table_view_name` VALUES ################################################## # --compact --delayed-insert --no-data-med=0 --databases db2 db1 +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */; @@ -5690,7 +5782,7 @@ CREATE TABLE `nonunique_table_name` ( UNIQUE KEY `i1` (`i1`) ) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT DELAYED INTO `nonunique_table_name` VALUES +INSERT DELAYED INTO `nonunique_table_name` VALUES (1), (2); /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -5712,7 +5804,7 @@ CREATE TABLE `basetable` ( `id` smallint(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT DELAYED INTO `basetable` VALUES +INSERT DELAYED INTO `basetable` VALUES (5), (6); /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -5813,6 +5905,7 @@ CREATE TABLE t1 (a int, b int); CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.b=NEW.a + 10; INSERT INTO t1 (a) VALUES (1),(2),(3); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -5861,6 +5954,7 @@ DROP TABLE t1; # # Without --replace and --insert-ignore # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -5956,6 +6050,7 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` ( # # With --replace # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -6061,6 +6156,7 @@ CREATE TABLE IF NOT EXISTS `transaction_registry` ( # # With --insert-ignore # +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -6185,6 +6281,7 @@ insert into t3 values(2); insert into t3(`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +` ) values(1,2,3); CREATE TABLE t4(ËÏÌÏÎËÁ1 INT); insert into t4 values(1); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -6225,6 +6322,7 @@ CREATE TABLE `t4` ( INSERT INTO `t4` VALUES (1); #Check side effect on --complete insert +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -6470,7 +6568,7 @@ j integer INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4); # Dump database 1 # Restore from database 1 to database 2 -ERROR 1100 (HY000) at line 45: Table 'seq_t_i' was not locked with LOCK TABLES +ERROR 1100 (HY000) at line 46: Table 'seq_t_i' was not locked with LOCK TABLES SETVAL(`seq_t_i`, 1, 0) 1 DROP DATABASE IF EXISTS test1; @@ -6591,10 +6689,8 @@ TABLE 1 SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log; TRUNCATE TABLE mysql.general_log; DROP DATABASE test1; -# # End of 10.3 tests # -# # MDEV-31092 mysqldump --force doesn't ignore error as it should # create function f1() returns int return 1; @@ -6605,6 +6701,7 @@ Warnings: Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. update mysql.event set body ='select not_a_value' where db='test' and name='e1'; create table t1 (i int); +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -6652,7 +6749,24 @@ drop function f1; drop function f2; drop event e1; drop table t1; -# # End of 10.4 tests # +# MDEV-33727 mariadb-dump trusts the server and does not validate the data +# +create table t1 (a int); +/*!999999\- enable the sandbox mode */ +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( +`a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +ERROR at line 9: Not allowed in the sandbox mode +drop table t1; +# End of 10.5 tests +# +# MDEV-16733 mysqldump --tab and --xml options are conflicting +# mariadb-dump: --xml can't be used with --tab. +# End of 10.11 tests diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 1d479dde723..0f513a7f799 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -2989,9 +2989,7 @@ TRUNCATE TABLE mysql.general_log; DROP DATABASE test1; --remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql ---echo # --echo # End of 10.3 tests ---echo # --echo # --echo # MDEV-31092 mysqldump --force doesn't ignore error as it should @@ -3010,13 +3008,34 @@ drop function f2; drop event e1; drop table t1; ---echo # --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33727 mariadb-dump trusts the server and does not validate the data --echo # -# -# MDEV-16733 mysqldump --tab and --xml options are conflicting -# +create table t1 (a int); +--exec $MYSQL_DUMP --compact --add-drop-table test > $MYSQLTEST_VARDIR/tmp/mdev33727.sql + +# first let's verify it can be loaded not only by mariadb client +--source $MYSQLTEST_VARDIR/tmp/mdev33727.sql + +# and now test the mariadb client sandbox protection +--append_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql +\! echo foo +EOF +--error 1 +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mdev33727.sql 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql +drop table t1; + +--echo # End of 10.5 tests + +--echo # +--echo # MDEV-16733 mysqldump --tab and --xml options are conflicting +--echo # --replace_result mariadb-dump.exe mariadb-dump --error 1 --exec $MYSQL_DUMP --xml --tab=$MYSQLTEST_VARDIR/tmp 2>&1 + +--echo # End of 10.11 tests diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result index be6c2998927..b022ce232ba 100644 --- a/mysql-test/main/openssl_1.result +++ b/mysql-test/main/openssl_1.result @@ -77,6 +77,7 @@ DROP TABLE thread_status; SET GLOBAL event_scheduler=0; CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -113,6 +114,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -149,6 +151,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/main/openssl_1.test b/mysql-test/main/openssl_1.test index 9232868bddd..24525287ea0 100644 --- a/mysql-test/main/openssl_1.test +++ b/mysql-test/main/openssl_1.test @@ -68,7 +68,7 @@ drop table t1; # Test that we can't open connection to server if we are using # a different cacert # ---exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql +--write_line "this query should not execute;" $MYSQLTEST_VARDIR/tmp/test.sql # Handle that openssl gives different error messages from YaSSL. --replace_regex /2026 TLS\/SSL error.*/2026 TLS\/SSL error: xxxx/ --error 1 diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index 12a5156eeb1..9a13b9bad21 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -338,6 +338,7 @@ FLUSH PRIVILEGES; # Executing 'mysqladmin' mysqld is alive # Executing 'mysqldump' +/*!999999\- enable the sandbox mode */ # Executing 'mysql_upgrade' # # Bug #59657: Move the client authentication_pam plugin into the diff --git a/mysql-test/main/plugin_loaderr.test b/mysql-test/main/plugin_loaderr.test index 85621ad047d..1623630bb81 100644 --- a/mysql-test/main/plugin_loaderr.test +++ b/mysql-test/main/plugin_loaderr.test @@ -13,14 +13,14 @@ FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb'; --echo # --echo # MDEV-6351 --plugin=force has no effect for built-in plugins --echo # ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc --error 1 --exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 --disable-log-error ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --disable_reconnect diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index ddcc4745c35..2e5b5dbbf15 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5975,6 +5975,19 @@ EXECUTE stmt USING DEFAULT; # Clean up DEALLOCATE PREPARE stmt; DROP TABLE t1, t2; +# MDEV-33218: Assertion `active_arena->is_stmt_prepare_or_first_stmt_execute() || active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed. in st_select_lex::fix_prepare_information +CREATE TABLE t1 AS SELECT 1 f; +PREPARE stmt FROM 'SHOW CREATE TABLE t1'; +DROP TABLE t1; +EXECUTE stmt; +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE VIEW t1 AS SELECT 1; +EXECUTE stmt; +View Create View character_set_client collation_connection +t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select 1 AS `1` latin1 latin1_swedish_ci +# Clean up +DEALLOCATE PREPARE stmt; +DROP VIEW t1; # # End of 10.4 tests # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index e8ec669b386..bf22385040c 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -5421,6 +5421,18 @@ EXECUTE stmt USING DEFAULT; DEALLOCATE PREPARE stmt; DROP TABLE t1, t2; +--echo # MDEV-33218: Assertion `active_arena->is_stmt_prepare_or_first_stmt_execute() || active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed. in st_select_lex::fix_prepare_information +CREATE TABLE t1 AS SELECT 1 f; +PREPARE stmt FROM 'SHOW CREATE TABLE t1'; +DROP TABLE t1; +--error ER_NO_SUCH_TABLE +EXECUTE stmt; +CREATE VIEW t1 AS SELECT 1; +EXECUTE stmt; +--echo # Clean up +DEALLOCATE PREPARE stmt; +DROP VIEW t1; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result index e73f219e1b0..1532890cbd1 100644 --- a/mysql-test/main/query_cache.result +++ b/mysql-test/main/query_cache.result @@ -2202,12 +2202,42 @@ Qcache_queries_in_cache 0 DROP FUNCTION foo; drop table t1; # +# MDEV-33861: main.query_cache fails with embedded after +# enabling WITH_PROTECT_STATEMENT_MEMROOT +# +create table t1 (s1 int); +create procedure f3 () begin +select * from t1; +end; +// +create procedure f4 () begin +select * from t1; +end; +// +Call f4(); +s1 +cAll f3(); +s1 +insert into t1 values (2); +caLl f3(); +s1 +2 +drop procedure f3; +drop procedure f4; +drop table t1; +# +# End of 10.4 tests +# +# # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression # SET @qc= @@query_cache_size; set global Query_cache_size=18446744073709547520; SET GLOBAL query_cache_size= @qc; # +# End of 10.5 tests +# +# # MDEV-22301 JSON_TABLE: Queries are not inserted into query cache. # create table t1 (a text); @@ -2233,6 +2263,7 @@ DROP TABLE t; restore defaults SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size=@save_query_cache_size; +# End of 10.6 tests # # MDEV-29028: Queries using RANDOM_BYTES get stored in query cache # @@ -2255,6 +2286,4 @@ improbable 0 drop table t1; set global query_cache_type= @qcache; -# # End of 10.10 tests -# diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index 08756b80697..feb9ecf526c 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -1807,6 +1807,40 @@ show status like "Qcache_queries_in_cache"; DROP FUNCTION foo; drop table t1; +--echo # +--echo # MDEV-33861: main.query_cache fails with embedded after +--echo # enabling WITH_PROTECT_STATEMENT_MEMROOT +--echo # + +create table t1 (s1 int); +--delimiter // +create procedure f3 () begin +select * from t1; +end; +// +create procedure f4 () begin +select * from t1; +end; +// +--delimiter ; + +Call f4(); + +cAll f3(); + +insert into t1 values (2); + +caLl f3(); + +drop procedure f3; +drop procedure f4; +drop table t1; + + +--echo # +--echo # End of 10.4 tests +--echo # + --echo # --echo # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression --echo # @@ -1816,6 +1850,10 @@ set global Query_cache_size=18446744073709547520; SET GLOBAL query_cache_size= @qc; --enable_warnings +--echo # +--echo # End of 10.5 tests +--echo # + --echo # --echo # MDEV-22301 JSON_TABLE: Queries are not inserted into query cache. --echo # @@ -1838,6 +1876,8 @@ DROP TABLE t; SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size=@save_query_cache_size; +--echo # End of 10.6 tests + --echo # --echo # MDEV-29028: Queries using RANDOM_BYTES get stored in query cache --echo # @@ -1866,7 +1906,6 @@ select random_bytes(1024) = random_bytes(1024) as improbable; drop table t1; set global query_cache_type= @qcache; ---echo # --echo # End of 10.10 tests ---echo # + --enable_ps2_protocol diff --git a/mysql-test/main/read_only_innodb.result b/mysql-test/main/read_only_innodb.result index cfc8f2ecb17..85aee64087f 100644 --- a/mysql-test/main/read_only_innodb.result +++ b/mysql-test/main/read_only_innodb.result @@ -70,7 +70,7 @@ UNLOCK TABLES; DROP TABLE t1; DROP USER test@localhost; disconnect con1; -echo End of 5.1 tests +# End of 5.1 tests # # Bug#33669: Transactional temporary tables do not work under --read-only # @@ -244,3 +244,26 @@ connection default; SET GLOBAL READ_ONLY = OFF; DROP USER bug33669@localhost; DROP DATABASE db1; +# End of 5.5 tests +# +# MDEV-33889 Read only server throws error when running a create temporary table as select statement +# +create table t1(a int) engine=innodb; +create user u1@localhost; +grant insert, select, update, delete, create temporary tables on test.* to u1@localhost; +insert into t1 values (1); +set global read_only=1; +connect u1,localhost,u1; +set default_tmp_storage_engine=innodb; +create temporary table tt1 (a int); +create temporary table tt2 like t1; +create temporary table tt3 as select * from t1; +select * from tt3; +a +1 +disconnect u1; +connection default; +drop table t1; +drop user u1@localhost; +set global read_only=0; +# End of 10.5 tests diff --git a/mysql-test/main/read_only_innodb.test b/mysql-test/main/read_only_innodb.test index e2c2979c393..59af952da8d 100644 --- a/mysql-test/main/read_only_innodb.test +++ b/mysql-test/main/read_only_innodb.test @@ -103,7 +103,7 @@ DROP USER test@localhost; disconnect con1; ---echo echo End of 5.1 tests +--echo # End of 5.1 tests --echo # --echo # Bug#33669: Transactional temporary tables do not work under --read-only @@ -250,3 +250,29 @@ SET GLOBAL READ_ONLY = OFF; DROP USER bug33669@localhost; DROP DATABASE db1; +--echo # End of 5.5 tests + +--echo # +--echo # MDEV-33889 Read only server throws error when running a create temporary table as select statement +--echo # +create table t1(a int) engine=innodb; +create user u1@localhost; +grant insert, select, update, delete, create temporary tables on test.* to u1@localhost; +insert into t1 values (1); +set global read_only=1; + +connect u1,localhost,u1; +set default_tmp_storage_engine=innodb; + +create temporary table tt1 (a int); +create temporary table tt2 like t1; +create temporary table tt3 as select * from t1; +select * from tt3; +disconnect u1; + +connection default; +drop table t1; +drop user u1@localhost; +set global read_only=0; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 276b57a106c..c73b9c0508a 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -3571,5 +3571,105 @@ pk c1 129 NULL 133 NULL DROP TABLE t1,t2; -set global innodb_stats_persistent= @stats.save; +# +# MDEV-31154: Fatal InnoDB error or assertion `!is_v' failure upon multi-update with indexed virtual column +# +# Test with auto generated Primary Key +# +SET @save_optimizer_switch= @@optimizer_switch; +SET optimizer_switch='rowid_filter=on'; +CREATE TABLE t0(a int); +INSERT INTO t0 SELECT seq FROM seq_1_to_20; +ANALYZE TABLE t0 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t0 analyze status Engine-independent statistics collected +test.t0 analyze status OK +CREATE TABLE t1 ( +a int, +b int as (a * 2) VIRTUAL, +f char(200), /* Filler */ +key (b), +key (a) +) engine=innodb; +INSERT INTO t1 (a, f) SELECT seq, seq FROM seq_1_to_1000; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# Test for type 'ref|filter' +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 ref|filter b,a b|a 5|5 test.t0.a 1 (2%) Using where; Using rowid filter +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +count(*) +10 +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 ref|filter b,a b|a 5|5 test.t0.a 1 (2%) Using where; Using rowid filter +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +count(*) +10 +# Test for type 'range|filter' +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range|filter b,a b|a 5|5 NULL 49 (10%) Using where; Using rowid filter +SELECT count(*) FROM t1 WHERE a<100 and b <100; +count(*) +49 +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range|filter b,a b|a 5|5 NULL 49 (10%) Using where; Using rowid filter +SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +count(*) +49 +# Test with Primary Key +# +DROP TABLE t1; +CREATE TABLE t1 ( +p int PRIMARY KEY AUTO_INCREMENT, +a int, +b int as (a * 2) VIRTUAL, +f char(200), /* Filler */ +key (b), +key (a) +) engine=innodb; +INSERT INTO t1 (a, f) SELECT seq, seq FROM seq_1_to_1000; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# Test for type 'ref|filter' +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 ref|filter b,a b|a 5|5 test.t0.a 1 (2%) Using where; Using rowid filter +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +count(*) +10 +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t0 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t1 ref|filter b,a b|a 5|5 test.t0.a 1 (2%) Using where; Using rowid filter +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +count(*) +10 +# Test for type 'range|filter' +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range|filter b,a b|a 5|5 NULL 49 (10%) Using where; Using rowid filter +SELECT count(*) FROM t1 WHERE a<100 and b <100; +count(*) +49 +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range|filter b,a b|a 5|5 NULL 49 (10%) Using where; Using rowid filter +SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +count(*) +49 +SET optimizer_switch=@save_optimizer_switch; +DROP TABLE t0, t1; # End of 10.4 tests +# End of 10.6 tests +set global innodb_stats_persistent= @stats.save; diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index 7e8e1e210fc..d5de649f566 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -1,6 +1,8 @@ --source include/no_valgrind_without_big.inc --source include/have_innodb.inc --source include/have_debug.inc +--source include/have_sequence.inc +--source include/innodb_stable_estimates.inc SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; @@ -696,6 +698,82 @@ eval $q; DROP TABLE t1,t2; -set global innodb_stats_persistent= @stats.save; +--echo # +--echo # MDEV-31154: Fatal InnoDB error or assertion `!is_v' failure upon multi-update with indexed virtual column +--echo # + +--echo # Test with auto generated Primary Key +--echo # + +SET @save_optimizer_switch= @@optimizer_switch; +SET optimizer_switch='rowid_filter=on'; + +CREATE TABLE t0(a int); +INSERT INTO t0 SELECT seq FROM seq_1_to_20; +ANALYZE TABLE t0 PERSISTENT FOR ALL; + +CREATE TABLE t1 ( + a int, + b int as (a * 2) VIRTUAL, + f char(200), /* Filler */ + key (b), + key (a) +) engine=innodb; + +INSERT INTO t1 (a, f) SELECT seq, seq FROM seq_1_to_1000; +ANALYZE TABLE t1 PERSISTENT FOR ALL; + +--echo # Test for type 'ref|filter' +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; + +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; + +--echo # Test for type 'range|filter' +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100; +SELECT count(*) FROM t1 WHERE a<100 and b <100; + +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; + +--echo # Test with Primary Key +--echo # + +DROP TABLE t1; +CREATE TABLE t1 ( + p int PRIMARY KEY AUTO_INCREMENT, + a int, + b int as (a * 2) VIRTUAL, + f char(200), /* Filler */ + key (b), + key (a) +) engine=innodb; + +INSERT INTO t1 (a, f) SELECT seq, seq FROM seq_1_to_1000; +ANALYZE TABLE t1 PERSISTENT FOR ALL; + +--echo # Test for type 'ref|filter' +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20; + +EXPLAIN SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; +SELECT count(*) from t0,t1 WHERE t0.a=t1.b AND t1.a<20 FOR UPDATE; + +--echo # Test for type 'range|filter' +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100; +SELECT count(*) FROM t1 WHERE a<100 and b <100; + +EXPLAIN SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; +SELECT count(*) FROM t1 WHERE a<100 and b <100 FOR UPDATE; + +SET optimizer_switch=@save_optimizer_switch; + +DROP TABLE t0, t1; --echo # End of 10.4 tests + +--echo # End of 10.6 tests + +set global innodb_stats_persistent= @stats.save; + diff --git a/mysql-test/main/rpl_mysqldump_slave.result b/mysql-test/main/rpl_mysqldump_slave.result index 190e3c26e80..8d6f099427e 100644 --- a/mysql-test/main/rpl_mysqldump_slave.result +++ b/mysql-test/main/rpl_mysqldump_slave.result @@ -7,14 +7,17 @@ connection slave; connection master; use test; connection slave; +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos=''; CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; +/*!999999\- enable the sandbox mode */ STOP ALL SLAVES; -- SET GLOBAL gtid_slave_pos=''; CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; START ALL SLAVES; +/*!999999\- enable the sandbox mode */ STOP ALL SLAVES; -- SET GLOBAL gtid_slave_pos=''; CHANGE MASTER '' TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; @@ -23,6 +26,7 @@ START ALL SLAVES; start slave; Warnings: Note 1254 Slave is already running +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos=''; CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; @@ -41,6 +45,7 @@ DROP TABLE t2; 1. --dump-slave=1 --gtid +/*!999999\- enable the sandbox mode */ SET GLOBAL gtid_slave_pos='0-1-1001'; CHANGE MASTER '' TO MASTER_USE_GTID=slave_pos; -- CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; @@ -48,12 +53,14 @@ CHANGE MASTER '' TO MASTER_USE_GTID=slave_pos; 1a. --dump-slave=1 +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-1-1001'; CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; 2. --dump-slave=2 --gtid +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-1-1001'; -- CHANGE MASTER '' TO MASTER_USE_GTID=slave_pos; -- CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; @@ -61,6 +68,7 @@ CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_S 2. --dump-slave=2 +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-1-1001'; -- CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_START; @@ -68,39 +76,46 @@ CHANGE MASTER '' TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=BINLOG_S 1. --master-data=1 --gtid +/*!999999\- enable the sandbox mode */ CHANGE MASTER TO MASTER_USE_GTID=slave_pos; SET GLOBAL gtid_slave_pos='0-2-1003'; -- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 1a. --master-data=1 +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-2-1003'; CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 2. --master-data=2 --gtid +/*!999999\- enable the sandbox mode */ -- CHANGE MASTER TO MASTER_USE_GTID=slave_pos; -- SET GLOBAL gtid_slave_pos='0-2-1003'; -- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 2a. --master-data=2 +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-2-1003'; -- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 3. --master-data --single-transaction --gtid +/*!999999\- enable the sandbox mode */ CHANGE MASTER TO MASTER_USE_GTID=slave_pos; SET GLOBAL gtid_slave_pos='0-2-1003'; -- CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 3a. --master-data --single-transaction +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-2-1003'; CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START; 4. --master-data=2 --dump-slave=2 --single-transaction --gtid (MDEV-4827) +/*!999999\- enable the sandbox mode */ -- MariaDB dump-- -- Host: localhost Database: test -- ------------------------------------------------------ @@ -156,6 +171,7 @@ CHANGE MASTER TO MASTER_LOG_FILE='slave-bin.000001', MASTER_LOG_POS=BINLOG_START 4a. --master-data=2 --dump-slave=2 --single-transaction (MDEV-4827) +/*!999999\- enable the sandbox mode */ -- MariaDB dump-- -- Host: localhost Database: test -- ------------------------------------------------------ @@ -215,6 +231,7 @@ include/stop_slave.inc change master to master_use_gtid=slave_pos; connection master; # Ensuring the binlog dump thread is killed on primary... +/*!999999\- enable the sandbox mode */ -- SET GLOBAL gtid_slave_pos='0-1-1005'; -- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000002', MASTER_LOG_POS=BINLOG_START; connection slave; diff --git a/mysql-test/main/shutdown.test b/mysql-test/main/shutdown.test index 71f2156a17f..b26a6d4b6f6 100644 --- a/mysql-test/main/shutdown.test +++ b/mysql-test/main/shutdown.test @@ -20,13 +20,13 @@ drop procedure try_shutdown; --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name --send shutdown --connection default --source include/wait_until_disconnected.inc ---exec echo "restart" > $_expect_file_name +--write_line restart $_expect_file_name --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/main/skip_grants.test b/mysql-test/main/skip_grants.test index 7b49d75e85a..999a716c911 100644 --- a/mysql-test/main/skip_grants.test +++ b/mysql-test/main/skip_grants.test @@ -175,12 +175,12 @@ drop user baz@baz; SELECT @@skip_grant_tables AS EXPECT_1; # Also check when the server starts without "--skip-grant-table" option ---let $restart_parameters = "--skip-skip-grant-tables" +--let $restart_parameters = --skip-skip-grant-tables --source include/restart_mysqld.inc SELECT @@skip_grant_tables AS EXPECT_0; # Need to restart the server to restore the "--skip-grant-tables" state ---let $restart_parameters = "--skip-grant-tables" +--let $restart_parameters = --skip-grant-tables --source include/restart_mysqld.inc --echo # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 155e497140a..91405e60f21 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -7172,15 +7172,14 @@ CREATE VIEW t1 AS SELECT 10 AS f1; CALL p1(1); ERROR HY000: The target table t1 of the INSERT is not insertable-into CREATE TEMPORARY TABLE t1 (f1 INT); -# t1 still refers to the view since it was inlined CALL p1(2); -ERROR HY000: The target table t1 of the INSERT is not insertable-into DROP VIEW t1; # t1 now refers to the temporary table CALL p1(3); # Check which values were inserted into the temp table. SELECT * FROM t1; f1 +2 3 DROP TEMPORARY TABLE t1; DROP PROCEDURE p1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 4deb1d05cb0..97626570519 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -8632,8 +8632,6 @@ CALL p1(1); CREATE TEMPORARY TABLE t1 (f1 INT); ---echo # t1 still refers to the view since it was inlined ---error ER_NON_INSERTABLE_TABLE CALL p1(2); DROP VIEW t1; diff --git a/mysql-test/main/ssl_and_innodb.test b/mysql-test/main/ssl_and_innodb.test index 4966f05b37b..2104eb5c8bf 100644 --- a/mysql-test/main/ssl_and_innodb.test +++ b/mysql-test/main/ssl_and_innodb.test @@ -1,5 +1,5 @@ -- source include/have_innodb.inc --- source include/have_ssl_crypto_functs.inc +-- source include/have_des.inc CREATE TABLE t1(a int) engine=innodb; INSERT INTO t1 VALUES (1); diff --git a/mysql-test/main/ssl_crl.result b/mysql-test/main/ssl_crl.result index d5603254ea5..58e3e07f746 100644 --- a/mysql-test/main/ssl_crl.result +++ b/mysql-test/main/ssl_crl.result @@ -2,4 +2,4 @@ Variable_name Value Ssl_version TLS_VERSION # try logging in with a certificate in the server's --ssl-crl : should fail -ERROR 2026 (HY000): TLS/SSL error: sslv3 alert certificate revoked +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert certificate revoked diff --git a/mysql-test/main/ssl_crl.test b/mysql-test/main/ssl_crl.test index 9b4758578a7..a09490f2b9b 100644 --- a/mysql-test/main/ssl_crl.test +++ b/mysql-test/main/ssl_crl.test @@ -7,7 +7,7 @@ --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-new-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" --echo # try logging in with a certificate in the server's --ssl-crl : should fail -# OpenSSL 1.1.1a correctly rejects the certificate, but the error message is different ---replace_regex /ERROR 2013 \(HY000\): Lost connection to server at '.*', system error: [0-9]+/ERROR 2026 (HY000): TLS\/SSL error: sslv3 alert certificate revoked/ +# OpenSSL 1.1.1a and later releases correctly rejects the certificate, but the error message is different +--replace_regex /(ERROR 2013 \(HY000\): Lost connection to server at '.*', system error: [0-9]+|ERROR 2026 \(HY000\): TLS\/SSL error: sslv3 alert certificate revoked)/ERROR 2026 (HY000): TLS\/SSL error: ssl\/tls alert certificate revoked/ --error 1 --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 diff --git a/mysql-test/main/ssl_timeout.result b/mysql-test/main/ssl_timeout.result index 208be527a6b..d94cfed8571 100644 --- a/mysql-test/main/ssl_timeout.result +++ b/mysql-test/main/ssl_timeout.result @@ -1,5 +1,5 @@ # connect with read timeout so SLEEP() should timeout -connect ssl_con,localhost,root,,,,,SSL read_timeout=5; +connect ssl_con,localhost,root,,,,,SSL read_timeout=5$_timeout_adjustment; # Check ssl turned on SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; have_ssl diff --git a/mysql-test/main/ssl_timeout.test b/mysql-test/main/ssl_timeout.test index 60b45178d81..d762ebc35a9 100644 --- a/mysql-test/main/ssl_timeout.test +++ b/mysql-test/main/ssl_timeout.test @@ -1,12 +1,11 @@ --source include/have_ssl_communication.inc -# Do not run this test with valgrind as may timeout ---source include/not_valgrind.inc +--source include/slow_environ.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc --echo # connect with read timeout so SLEEP() should timeout -connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); +connect (ssl_con,localhost,root,,,,,SSL read_timeout=5$_timeout_adjustment); --echo # Check ssl turned on SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index d10b3645f9c..85ac08632ff 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -3015,34 +3015,31 @@ where a >= any (select b from t2 group by (select c from t3 where c = 1)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t1`.`a`))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` group by (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) <= (`test`.`t1`.`a`))) select a from t1 where a >= any (select b from t2 group by (select c from t3 where c = 1)); a -3 -2 prepare stmt from "select a from t1 where a >= any (select b from t2 group by (select c from t3 where c = 1))"; execute stmt; a -3 -2 execute stmt; a -3 -2 deallocate prepare stmt; explain extended select a from t1 where a <= all (select b from t2 group by (select c from t3 where c = 1)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) < (`test`.`t1`.`a`))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` group by (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) < (`test`.`t1`.`a`))) select a from t1 where a <= all (select b from t2 group by (select c from t3 where c = 1)); a +3 1 2 explain extended select a from t1 @@ -3050,13 +3047,12 @@ where a >= any (select b from t2 group by 1 + (select c from t3 where c = 1)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= (`test`.`t1`.`a`))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`,(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` group by 1 + (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) <= (`test`.`t1`.`a`))) select a from t1 where a >= any (select b from t2 group by 1 + (select c from t3 where c = 1)); a -3 -2 drop table t1,t2,t3; # # MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of @@ -3076,8 +3072,10 @@ group by (select a from t1 where a = 1) in (select d from t4)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where (1,exists(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by ((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null))) limit 1)) select b from t2 where exists (select c from t3 group by (select a from t1 where a = 1) in (select d from t4)); @@ -3103,8 +3101,10 @@ any (select d from t4)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where (1,exists(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by (<(/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)>(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) >= `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null))))) limit 1)) select b from t2 where exists (select c from t3 group by (select a from t1 where a = 1) >= @@ -3119,8 +3119,10 @@ all (select d from t4)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1 +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where (1,exists(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by (<(/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)>(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) >= `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null))))) limit 1)) select b from t2 where exists (select c from t3 group by (select a from t1 where a = 1) < @@ -3132,15 +3134,17 @@ explain extended select b from t2 where b in (select c from t3 group by (select a from t1 where a = 1) in (select d from t4)); id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 50.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 test.t2.b 1 100.00 +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` semi join (`test`.`t3`) where `test`.`t3`.`c` = `test`.`t2`.`b` +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from (/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by ((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) join `test`.`t2` where ``.`c` = `test`.`t2`.`b` select b from t2 where b in (select c from t3 group by (select a from t1 where a = 1) in (select d from t4)); b -2 explain extended select b from t2 where b >= any (select c from t3 group by (select a from t1 where a = 1) in @@ -3148,30 +3152,33 @@ group by (select a from t1 where a = 1) in id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where 2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select min(`test`.`t3`.`c`) from `test`.`t3`) <= (`test`.`t2`.`b`))) +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by ((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) <= (`test`.`t2`.`b`))) select b from t2 where b >= any (select c from t3 group by (select a from t1 where a = 1) in (select d from t4)); b +explain extended select b from t2 +where b <= all (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 +4 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3` group by ((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1),(/* select#4 */ select `test`.`t4`.`d` from `test`.`t4` where trigcond(((/* select#3 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`a` = 1)) = `test`.`t4`.`d` or `test`.`t4`.`d` is null) having trigcond(`test`.`t4`.`d` is null)))) < (`test`.`t2`.`b`))) +select b from t2 +where b <= all (select c from t3 +group by (select a from t1 where a = 1) in +(select d from t4)); +b 3 2 -explain extended select b from t2 -where b <= all (select c from t3 -group by (select a from t1 where a = 1) in -(select d from t4)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 -Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where ((`test`.`t2`.`b`,(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3`) < (`test`.`t2`.`b`))) -select b from t2 -where b <= all (select c from t3 -group by (select a from t1 where a = 1) in -(select d from t4)); -b -2 drop table t1,t2,t3,t4; # End of 10.3 tests # @@ -3352,4 +3359,33 @@ a 2 DEALLOCATE PREPARE stmt; DROP TABLE t1,t2,t3; +# +# MDEV-33747: Optimization of (SELECT) IN (SELECT ...) executes subquery at prepare stage +# +create table t1 (a int, b int); +insert into t1 select seq, seq from seq_1_to_200; +create table t2 as select * from t1; +create table t3 as select * from t1; +analyze table t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +select @@expensive_subquery_limit < 200 as DEFAULTS_ARE_SUITABLE; +DEFAULTS_ARE_SUITABLE +1 +flush status; +explain select * from t1 where a<3 or (select max(a) from t2) in (select b from t3); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 200 Using where +3 SUBQUERY t3 ALL NULL NULL NULL NULL 200 Using where +2 SUBQUERY t2 ALL NULL NULL NULL NULL 200 +# Must show 0. If this shows 200, this means subquery was executed and you have a bug: +show status like 'Handler_read_rnd_next%'; +Variable_name Value +Handler_read_rnd_next 0 +drop table t1,t2,t3; # End of 10.4 tests diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index e4a5ab63b3e..239e9ed945d 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -2674,5 +2674,20 @@ DEALLOCATE PREPARE stmt; DROP TABLE t1,t2,t3; +--echo # +--echo # MDEV-33747: Optimization of (SELECT) IN (SELECT ...) executes subquery at prepare stage +--echo # +create table t1 (a int, b int); +insert into t1 select seq, seq from seq_1_to_200; +create table t2 as select * from t1; +create table t3 as select * from t1; +analyze table t1,t2,t3; +select @@expensive_subquery_limit < 200 as DEFAULTS_ARE_SUITABLE; +flush status; +explain select * from t1 where a<3 or (select max(a) from t2) in (select b from t3); +--echo # Must show 0. If this shows 200, this means subquery was executed and you have a bug: +show status like 'Handler_read_rnd_next%'; +drop table t1,t2,t3; + --echo # End of 10.4 tests diff --git a/mysql-test/main/subselect_elimination.result b/mysql-test/main/subselect_elimination.result new file mode 100644 index 00000000000..17400e490bc --- /dev/null +++ b/mysql-test/main/subselect_elimination.result @@ -0,0 +1,268 @@ +# +# MDEV-28621 group by optimization incorrectly removing subquery where +# subject buried in a function +# +CREATE TABLE t1 (i int) ; +INSERT INTO t1 VALUES (1),(2),(3); +SELECT 1 FROM t1 +WHERE i in +( SELECT a+1 +FROM +(SELECT (SELECT i FROM (SELECT 1 FROM t1) dt) AS a FROM t1) dt2 +GROUP BY a +); +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1; +create table t1 (a int, b int, c int); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2 as select * from t1; +create table t20 as select * from t1; +create table t21 as select * from t1; +create table t3 as select * from t1; +select a, a in +( +select +( +select max(c) from t20 where t20.a<=t2.a +) as SUBQ1 from t2 group by SUBQ1+1 +) as COL +from t1; +a COL +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +create view v2 as +select +a, b, +(select max(c) from t20 where t20.a<=t2.a) as SUBQ1, +(select max(c) from t21 where t21.a<=t2.a) as SUBQ2 +from t2; +# test partial elimination +explain +select +a, +a in (select a from v2 where a>3 and v2.SUBQ2>=0 group by v2.SUBQ1, v2.SUBQ2) +from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +5 DEPENDENT SUBQUERY t21 ALL NULL NULL NULL NULL 10 Using where +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +# test buried subselects in group by clause +select a, a in +( +select +( +select max(c) from t20 where t20.a<=t2.a +)*2 as SUBQ1 from t2 group by SUBQ1+1 +) as COL +from t1; +a COL +1 0 +2 1 +3 0 +4 1 +5 0 +6 1 +7 0 +8 1 +9 0 +10 1 +drop view v2; +drop table t1, t2, t20, t21, t3; +# Testcase from MDEV-32311 +SELECT ( +( WITH x ( x ) AS +(SELECT ( SELECT 'x' UNION SELECT 'x' ) FROM ( SELECT ( 'x' ) ) x) +SELECT x FROM x +WHERE x IN ( ( SELECT 'x' AND x GROUP BY x ) ) +) +) AS SUBQ; +SUBQ +x +# MDEV-32390: +CREATE TABLE t0 ( c43 DECIMAL ( 31 ) DEFAULT ( 45 ) ) ; +INSERT INTO t0 VALUES ( 13 ) , ( 29 ) ; +ALTER TABLE t0 ADD COLUMN c24 INT AFTER c43 ; +INSERT INTO t0 VALUES ( DEFAULT , DEFAULT ) , ( DEFAULT , DEFAULT ) ; +SELECT t1 . c22 AS c9 FROM ( SELECT ( SELECT + EXISTS ( SELECT -128 AS c29 ) << +LOCATE ( t0 . c43 , t0 . c24 <= t0 . c24 NOT BETWEEN 4642475734208631537 AND +-108 , NULLIF ( 57 , -8 ) SOUNDS LIKE TRIM( TRAILING FROM 6107036197732405580 ) +) - t0 . c43 AS c57 FROM t0 LIMIT 1 ) AS c22 FROM t0 ) AS t1 HAVING TRIM( CASE +t1 . c22 WHEN -16 THEN RAND ( ) % HEX ( t1 . c22 ) - SUBSTRING_INDEX ( t1 . c22, +':A9SEZxtjN,fKN*zR' , 'V*vhJb}&c%Op,[T[S,j`F9NDsK;\'8 4;m" +P,ce}1r"3ID1DN' ) >> NULLIF ( t1 . c22 , -95 ) ELSE -2 END IS TRUE +FROM t1 . c22 >= EXISTS ( SELECT t2 . c57 AS c59 FROM ( SELECT CASE c24 WHEN +-103 THEN 85 ELSE 22 END IS TRUE AS c57 FROM t0 ) AS t2 WHERE MOD ( 64 , 46 ) = +CONVERT ( 73 , BINARY ) % RAND ( ) IS NOT NULL = -65 GROUP BY c57 , c22 , c22 +WINDOW w0 AS ( PARTITION BY t2 . c57 ) ) & PI ( ) ) ; +c9 +DROP TABLE t0; +# MDEV-32309 +SELECT +( WITH x ( x ) AS +( +WITH x ( x ) AS ( SELECT 1 ) SELECT ( SELECT x ) FROM x +) +SELECT x FROM x WHERE x IN ( SELECT NULL GROUP BY x ) +) as col1 ; +col1 +NULL +# MDEV-32391 +CREATE TABLE t0 ( c15 INT , c33 INT ) engine=innodb; +INSERT INTO t0 ( c15 ) WITH t1 AS ( SELECT SQRT ( 123 ) NOT +REGEXP MOD ( 91 , -121 ) = ALL ( SELECT c15 AS c33 FROM t0 ) AS c49 FROM t0 ) +SELECT t1 . c49 IS UNKNOWN AS c59 FROM t1 CROSS JOIN t0 AS t2 +WHERE t1 . c49 = + EXISTS ( SELECT -5839312620871436105 AS c17 GROUP BY c49 ) +BETWEEN -109 AND CHAR_LENGTH ( 2694839150676403988 ) - - LOWER ( -13 ) ; +DROP TABLE t0; +# MDEV-28620 +CREATE TABLE t1 ( a int); +INSERT INTO t1 VALUES (1),(2); +SELECT EXISTS +( SELECT 1 FROM t1 GROUP BY 1 IN (SELECT a FROM t1) +ORDER BY a + (SELECT 1 FROM t1 WHERE (1,2) NOT IN (SELECT 1,0)) +) as SUBQ; +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1; +# MDEV-30842 Item_subselect::get_cache_parameters and UBSAN member +# access within null pointer +CREATE TABLE x (x INT) ENGINE=InnoDB; +INSERT INTO x (x) VALUES (0); +INSERT INTO x (x) VALUES (x IN (SELECT (SELECT x FROM (SELECT x FROM +(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT +(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN +(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x) +AS x) IN (SELECT 0 AS x) AS x FROM x)); +ERROR HY000: Table 'x' is specified twice, both as a target for 'INSERT' and as a separate source for data +DROP TABLE x; +# MDEV-28622: Item_subselect eliminated flag set but Item still +# evaluated/used. +CREATE TABLE t1 ( a int) ; +CREATE VIEW v1 (i) AS SELECT EXISTS(SELECT 1) FROM t1; +SELECT 1 FROM v1 WHERE i NOT IN (SELECT i = 0 FROM v1 WHERE i = -1 GROUP BY i); +1 +DROP TABLE t1; +DROP VIEW v1; +CREATE TABLE t(c1 INT); +SELECT 0 +WHERE 0 IN +( +SELECT 0 FROM +( +SELECT 0 IN +( +SELECT +( +SELECT c1 FROM t +) +) AS c +FROM t +) AS dt +WHERE c GROUP BY c +); +0 +DROP TABLE t; +create table t1 (a int, b int, c int); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2 as select * from t1; +create table t20 as select * from t1; +create table t3 as select * from t1; +create view v2 as +select +a, b, (select max(c) from t20 where t20.a<=t2.a) as SUBQ1 +from t2; +explain +select +a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +prepare s from ' +explain +select + a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1'; +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +prepare s from ' +explain +select + a, a in (select a from v2 where a>3 and SUBQ1+1 group by v2.SUBQ1) +from t1'; +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +execute s; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +create procedure p1() +begin +explain +select +a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1; +end// +create procedure p2() +begin +explain +select +a, a in (select a from v2 where a>3 and SUBQ1+1 group by v2.SUBQ1) +from t1; +end// +call p1(); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +call p1(); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +call p2(); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +call p2(); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 +2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary +4 DEPENDENT SUBQUERY t20 ALL NULL NULL NULL NULL 10 Using where +drop procedure p1; +drop procedure p2; +drop view v2; +drop table t1,t2,t3,t20; +# end of 10.4 tests diff --git a/mysql-test/main/subselect_elimination.test b/mysql-test/main/subselect_elimination.test new file mode 100644 index 00000000000..9d973477b28 --- /dev/null +++ b/mysql-test/main/subselect_elimination.test @@ -0,0 +1,242 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +--echo # +--echo # MDEV-28621 group by optimization incorrectly removing subquery where +--echo # subject buried in a function +--echo # + +CREATE TABLE t1 (i int) ; +INSERT INTO t1 VALUES (1),(2),(3); + +--error ER_SUBQUERY_NO_1_ROW +SELECT 1 FROM t1 +WHERE i in +( SELECT a+1 + FROM + (SELECT (SELECT i FROM (SELECT 1 FROM t1) dt) AS a FROM t1) dt2 + GROUP BY a +); + +DROP TABLE t1; + +create table t1 (a int, b int, c int); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2 as select * from t1; +create table t20 as select * from t1; +create table t21 as select * from t1; +create table t3 as select * from t1; +select a, a in +( + select + ( + select max(c) from t20 where t20.a<=t2.a + ) as SUBQ1 from t2 group by SUBQ1+1 +) as COL +from t1; + +create view v2 as +select + a, b, + (select max(c) from t20 where t20.a<=t2.a) as SUBQ1, + (select max(c) from t21 where t21.a<=t2.a) as SUBQ2 +from t2; + +--echo # test partial elimination + +explain +select + a, + a in (select a from v2 where a>3 and v2.SUBQ2>=0 group by v2.SUBQ1, v2.SUBQ2) +from t1; + +--echo # test buried subselects in group by clause + +select a, a in +( + select + ( + select max(c) from t20 where t20.a<=t2.a + )*2 as SUBQ1 from t2 group by SUBQ1+1 +) as COL +from t1; + +drop view v2; +drop table t1, t2, t20, t21, t3; + +--echo # Testcase from MDEV-32311 + +# some warning duplicated using ps-protocol +--disable_warnings +SELECT ( + ( WITH x ( x ) AS + (SELECT ( SELECT 'x' UNION SELECT 'x' ) FROM ( SELECT ( 'x' ) ) x) + SELECT x FROM x + WHERE x IN ( ( SELECT 'x' AND x GROUP BY x ) ) + ) +) AS SUBQ; +--enable_warnings + +--echo # MDEV-32390: + +CREATE TABLE t0 ( c43 DECIMAL ( 31 ) DEFAULT ( 45 ) ) ; +INSERT INTO t0 VALUES ( 13 ) , ( 29 ) ; +ALTER TABLE t0 ADD COLUMN c24 INT AFTER c43 ; +INSERT INTO t0 VALUES ( DEFAULT , DEFAULT ) , ( DEFAULT , DEFAULT ) ; +SELECT t1 . c22 AS c9 FROM ( SELECT ( SELECT + EXISTS ( SELECT -128 AS c29 ) << +LOCATE ( t0 . c43 , t0 . c24 <= t0 . c24 NOT BETWEEN 4642475734208631537 AND +-108 , NULLIF ( 57 , -8 ) SOUNDS LIKE TRIM( TRAILING FROM 6107036197732405580 ) +) - t0 . c43 AS c57 FROM t0 LIMIT 1 ) AS c22 FROM t0 ) AS t1 HAVING TRIM( CASE +t1 . c22 WHEN -16 THEN RAND ( ) % HEX ( t1 . c22 ) - SUBSTRING_INDEX ( t1 . c22, +':A9SEZxtjN,fKN*zR' , 'V*vhJb}&c%Op,[T[S,j`F9NDsK;\'8 4;m" +P,ce}1r"3ID1DN' ) >> NULLIF ( t1 . c22 , -95 ) ELSE -2 END IS TRUE +FROM t1 . c22 >= EXISTS ( SELECT t2 . c57 AS c59 FROM ( SELECT CASE c24 WHEN +-103 THEN 85 ELSE 22 END IS TRUE AS c57 FROM t0 ) AS t2 WHERE MOD ( 64 , 46 ) = +CONVERT ( 73 , BINARY ) % RAND ( ) IS NOT NULL = -65 GROUP BY c57 , c22 , c22 +WINDOW w0 AS ( PARTITION BY t2 . c57 ) ) & PI ( ) ) ; + +DROP TABLE t0; + +--echo # MDEV-32309 + +SELECT + ( WITH x ( x ) AS + ( + WITH x ( x ) AS ( SELECT 1 ) SELECT ( SELECT x ) FROM x + ) + SELECT x FROM x WHERE x IN ( SELECT NULL GROUP BY x ) +) as col1 ; + +--echo # MDEV-32391 + +CREATE TABLE t0 ( c15 INT , c33 INT ) engine=innodb; +INSERT INTO t0 ( c15 ) WITH t1 AS ( SELECT SQRT ( 123 ) NOT +REGEXP MOD ( 91 , -121 ) = ALL ( SELECT c15 AS c33 FROM t0 ) AS c49 FROM t0 ) +SELECT t1 . c49 IS UNKNOWN AS c59 FROM t1 CROSS JOIN t0 AS t2 +WHERE t1 . c49 = + EXISTS ( SELECT -5839312620871436105 AS c17 GROUP BY c49 ) +BETWEEN -109 AND CHAR_LENGTH ( 2694839150676403988 ) - - LOWER ( -13 ) ; +DROP TABLE t0; + +--echo # MDEV-28620 +CREATE TABLE t1 ( a int); +INSERT INTO t1 VALUES (1),(2); + +--error ER_SUBQUERY_NO_1_ROW +SELECT EXISTS +( SELECT 1 FROM t1 GROUP BY 1 IN (SELECT a FROM t1) + ORDER BY a + (SELECT 1 FROM t1 WHERE (1,2) NOT IN (SELECT 1,0)) +) as SUBQ; +DROP TABLE t1; + +--echo # MDEV-30842 Item_subselect::get_cache_parameters and UBSAN member +--echo # access within null pointer + +CREATE TABLE x (x INT) ENGINE=InnoDB; +INSERT INTO x (x) VALUES (0); +--error ER_UPDATE_TABLE_USED +INSERT INTO x (x) VALUES (x IN (SELECT (SELECT x FROM (SELECT x FROM +(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT +(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN +(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x) +AS x) IN (SELECT 0 AS x) AS x FROM x)); +DROP TABLE x; + +--echo # MDEV-28622: Item_subselect eliminated flag set but Item still +--echo # evaluated/used. + +CREATE TABLE t1 ( a int) ; +CREATE VIEW v1 (i) AS SELECT EXISTS(SELECT 1) FROM t1; + +SELECT 1 FROM v1 WHERE i NOT IN (SELECT i = 0 FROM v1 WHERE i = -1 GROUP BY i); +DROP TABLE t1; +DROP VIEW v1; + +CREATE TABLE t(c1 INT); + +SELECT 0 +WHERE 0 IN +( + SELECT 0 FROM + ( + SELECT 0 IN + ( + SELECT + ( + SELECT c1 FROM t + ) + ) AS c + FROM t + ) AS dt + WHERE c GROUP BY c +); + +DROP TABLE t; + +create table t1 (a int, b int, c int); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2 as select * from t1; +create table t20 as select * from t1; +create table t3 as select * from t1; + +create view v2 as +select + a, b, (select max(c) from t20 where t20.a<=t2.a) as SUBQ1 +from t2; + +explain +select + a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1; + +prepare s from ' +explain +select + a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1'; + +execute s; +execute s; +execute s; + +prepare s from ' +explain +select + a, a in (select a from v2 where a>3 and SUBQ1+1 group by v2.SUBQ1) +from t1'; + +execute s; +execute s; +execute s; + +delimiter //; + +create procedure p1() +begin +explain +select + a, a in (select a from v2 where a>3 group by v2.SUBQ1) +from t1; +end// + +create procedure p2() +begin +explain +select + a, a in (select a from v2 where a>3 and SUBQ1+1 group by v2.SUBQ1) +from t1; +end// + +delimiter ;// + +call p1(); +call p1(); +call p2(); +call p2(); +drop procedure p1; +drop procedure p2; + + +drop view v2; +drop table t1,t2,t3,t20; + +--echo # end of 10.4 tests diff --git a/mysql-test/main/temp_table.result b/mysql-test/main/temp_table.result index ac5d82bab44..9724c2c0173 100644 --- a/mysql-test/main/temp_table.result +++ b/mysql-test/main/temp_table.result @@ -618,6 +618,55 @@ tmp # in 11.2 and above here should be listed above used temporary tables DROP TEMPORARY TABLE t1, t2; # +# MDEV-33218: Assertion `active_arena->is_stmt_prepare_or_first_stmt_execute() || active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed. in st_select_lex::fix_prepare_information +# +CREATE VIEW v1 AS SELECT 5; +CREATE PROCEDURE sp() SELECT * FROM v1; +CREATE TEMPORARY TABLE v1 as SELECT 7; +# sp() accesses the temporary table v1 that hides the view with the same name +# Therefore expected output is the row (7) +CALL sp(); +7 +7 +DROP TEMPORARY TABLE v1; +# After the temporary table v1 has been dropped the next invocation of sp() +# accesses the view v1. So, expected output is the row (5) +CALL sp(); +5 +5 +# Clean up +DROP VIEW v1; +DROP PROCEDURE sp; +# Another use case is when a temporary table hides a view is dropped +# inside a stored routine being called. +CREATE VIEW t1 AS SELECT 1; +CREATE PROCEDURE p1() +BEGIN +DROP TEMPORARY TABLE t1; +END +| +CREATE FUNCTION f1() RETURNS INT +BEGIN +CALL p1(); +RETURN 1; +END +| +CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a; +PREPARE stmt FROM 'SELECT f1()'; +EXECUTE stmt; +f1() +1 +# The temporary table t1 has been dropped on first +# execution of the prepared statement 'stmt', +# next time this statement is run it results in issuing +# the error ER_BAD_TABLE_ERROR +EXECUTE stmt; +ERROR 42S02: Unknown table 'test.t1' +# Clean up +DROP VIEW t1; +DROP FUNCTION f1; +DROP PROCEDURE p1; +# # End of 10.4 tests # create function f1() returns int diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test index 11a667435d1..529ce4a6af6 100644 --- a/mysql-test/main/temp_table.test +++ b/mysql-test/main/temp_table.test @@ -669,6 +669,60 @@ SHOW TABLES; DROP TEMPORARY TABLE t1, t2; +--echo # +--echo # MDEV-33218: Assertion `active_arena->is_stmt_prepare_or_first_stmt_execute() || active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS' failed. in st_select_lex::fix_prepare_information +--echo # +CREATE VIEW v1 AS SELECT 5; +CREATE PROCEDURE sp() SELECT * FROM v1; +CREATE TEMPORARY TABLE v1 as SELECT 7; +--echo # sp() accesses the temporary table v1 that hides the view with the same name +--echo # Therefore expected output is the row (7) +CALL sp(); +DROP TEMPORARY TABLE v1; +--echo # After the temporary table v1 has been dropped the next invocation of sp() +--echo # accesses the view v1. So, expected output is the row (5) +CALL sp(); + +--echo # Clean up +DROP VIEW v1; +DROP PROCEDURE sp; + +--echo # Another use case is when a temporary table hides a view is dropped +--echo # inside a stored routine being called. + +CREATE VIEW t1 AS SELECT 1; + +--delimiter | +CREATE PROCEDURE p1() +BEGIN + DROP TEMPORARY TABLE t1; +END +| + +CREATE FUNCTION f1() RETURNS INT +BEGIN + CALL p1(); + RETURN 1; +END +| + +--delimiter ; + +CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a; +PREPARE stmt FROM 'SELECT f1()'; +EXECUTE stmt; +--echo # The temporary table t1 has been dropped on first +--echo # execution of the prepared statement 'stmt', +--echo # next time this statement is run it results in issuing +--echo # the error ER_BAD_TABLE_ERROR +--error ER_BAD_TABLE_ERROR +EXECUTE stmt; + +--echo # Clean up +DROP VIEW t1; +DROP FUNCTION f1; +DROP PROCEDURE p1; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result index b3ab5585d92..dd6fa2156ab 100644 --- a/mysql-test/main/trigger.result +++ b/mysql-test/main/trigger.result @@ -1,9 +1,3 @@ -drop table if exists t1, t2, t3, t4; -drop view if exists v1; -drop database if exists mysqltest; -drop function if exists f1; -drop function if exists f2; -drop procedure if exists p1; connect addconroot1, localhost, root,,; connect addconroot2, localhost, root,,; connect addconwithoutdb, localhost, root,,*NO-ONE*; diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index 466e9b8f3e5..f54a09bf7a4 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -7,15 +7,6 @@ # Basic triggers test # ---disable_warnings -drop table if exists t1, t2, t3, t4; -drop view if exists v1; -drop database if exists mysqltest; -drop function if exists f1; -drop function if exists f2; -drop procedure if exists p1; ---enable_warnings - # Create additional connections used through test connect (addconroot1, localhost, root,,); connect (addconroot2, localhost, root,,); diff --git a/mysql-test/main/trigger_wl3253.result b/mysql-test/main/trigger_wl3253.result index ed08b336c19..e501b2640b0 100644 --- a/mysql-test/main/trigger_wl3253.result +++ b/mysql-test/main/trigger_wl3253.result @@ -310,6 +310,7 @@ CREATE TABLE t1 (a INT); CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1; CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2; CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3; +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -372,6 +373,7 @@ CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2; CREATE TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr1_bi SET @a:=0; CREATE TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=0; # Expected order of triggers in the dump is: tr0_bi, tr1_bi, tr1_1_bi, tr2_i. +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index afdd97a9d58..b820fd82033 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -1370,6 +1370,122 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; # +# MDEV-34069 Zero datetime reinterprets as '1970-01-01 00:00:00' on field_datetime=field_timestamp +# +SET sql_mode=''; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); +SELECT * FROM t1; +a +0000-00-00 00:00:00 +CREATE TABLE t2 (a DATETIME); +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2; +a +0000-00-00 00:00:00 +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +INSERT INTO t2 VALUES ('0000-00-00 00:00:00'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +INSERT INTO t2 SELECT a FROM t1; +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +SELECT * FROM t2; +a +0000-00-00 00:00:00 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +DROP TABLE t2, t1; +SET time_zone=DEFAULT; +SET sql_mode=DEFAULT; +# +# MDEV-34061 unix_timestamp(coalesce(timestamp_column)) returns NULL on '1970-01-01 00:00:00.000001' +# +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(6) NULL); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.000001'); +SELECT unix_timestamp(a) AS c1, unix_timestamp(coalesce(a)) AS c2 FROM t1; +c1 c2 +0.000001 0.000001 +DROP TABLE t1; +SET time_zone=DEFAULT; +# +# MDEV-34088 The TIMESTAMP value of '1970-01-01 00:00:00' can be indirectly inserted in strict mode +# +SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00.1' for column `test`.`t1`.`a` at row 1 +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00 +00:00' for column `test`.`t1`.`a` at row 1 +DROP TABLE t2; +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00' for column `test`.`t1`.`a` at row 1 +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00.1' for column `test`.`t1`.`a` at row 1 +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +ERROR 22007: Incorrect datetime value: '1970-01-01 00:00:00 +00:00' for column `test`.`t1`.`a` at row 1 +DROP TABLE t2; +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET sql_mode=''; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +DROP TABLE t2; +SELECT * FROM t1; +a +0000-00-00 00:00:00 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +DROP TABLE t2; +SELECT * FROM t1; +a +0000-00-00 00:00:00 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# # End of 10.5 tests # # diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index b3dfa19223d..b85682911b6 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -920,6 +920,98 @@ create table t1 (f1 timestamp, f2 timestamp); show create table t1; drop table t1; +--echo # +--echo # MDEV-34069 Zero datetime reinterprets as '1970-01-01 00:00:00' on field_datetime=field_timestamp +--echo # + +SET sql_mode=''; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); +SELECT * FROM t1; +CREATE TABLE t2 (a DATETIME); +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2; +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +INSERT INTO t2 VALUES ('0000-00-00 00:00:00'); +INSERT INTO t2 SELECT a FROM t1; +SELECT * FROM t2; +DROP TABLE t2, t1; +SET time_zone=DEFAULT; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-34061 unix_timestamp(coalesce(timestamp_column)) returns NULL on '1970-01-01 00:00:00.000001' +--echo # + +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(6) NULL); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.000001'); +SELECT unix_timestamp(a) AS c1, unix_timestamp(coalesce(a)) AS c2 FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; + +--echo # +--echo # MDEV-34088 The TIMESTAMP value of '1970-01-01 00:00:00' can be indirectly inserted in strict mode +--echo # + +SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 SELECT a FROM t2; +DROP TABLE t2; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +SET sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 SELECT a FROM t2; +DROP TABLE t2; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET sql_mode=''; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +DROP TABLE t2; +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00'); +INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'); +CREATE TABLE t2 (a TIMESTAMP(1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('1970-01-01 00:00:00.1'); +INSERT INTO t1 SELECT a FROM t2; +DROP TABLE t2; +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/update_innodb.result b/mysql-test/main/update_innodb.result index beab54833d1..fbcbf78d865 100644 --- a/mysql-test/main/update_innodb.result +++ b/mysql-test/main/update_innodb.result @@ -143,3 +143,111 @@ connection default; disconnect con2; drop table t1,t2; # End of 10.4 tests +# +# MDEV-33533: multi-delete using rowid filter +# +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +create index i_n_name on nation(n_name); +analyze table +nation, lineitem, customer, orders, part, supplier, partsupp, region +persistent for all; +Table Op Msg_type Msg_text +dbt3_s001.nation analyze status Engine-independent statistics collected +dbt3_s001.nation analyze status OK +dbt3_s001.lineitem analyze status Engine-independent statistics collected +dbt3_s001.lineitem analyze status OK +dbt3_s001.customer analyze status Engine-independent statistics collected +dbt3_s001.customer analyze status OK +dbt3_s001.orders analyze status Engine-independent statistics collected +dbt3_s001.orders analyze status OK +dbt3_s001.part analyze status Engine-independent statistics collected +dbt3_s001.part analyze status OK +dbt3_s001.supplier analyze status Engine-independent statistics collected +dbt3_s001.supplier analyze status OK +dbt3_s001.partsupp analyze status Engine-independent statistics collected +dbt3_s001.partsupp analyze status OK +dbt3_s001.region analyze status Engine-independent statistics collected +dbt3_s001.region analyze status OK +explain +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE nation ref PRIMARY,i_n_name i_n_name 26 const 1 Using where; Using index +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter +explain format=json +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "cost": "COST_REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "nation", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_n_name"], + "key": "i_n_name", + "key_length": "26", + "used_key_parts": ["n_name"], + "ref": ["const"], + "loops": 1, + "rows": 1, + "cost": "COST_REPLACED", + "filtered": 100, + "attached_condition": "nation.n_name = 'PERU'", + "using_index": true + } + }, + { + "table": { + "table_name": "customer", + "access_type": "ref", + "possible_keys": ["PRIMARY", "i_c_nationkey"], + "key": "i_c_nationkey", + "key_length": "5", + "used_key_parts": ["c_nationkey"], + "ref": ["dbt3_s001.nation.n_nationkey"], + "loops": 1, + "rows": 6, + "cost": "COST_REPLACED", + "filtered": 100, + "using_index": true + } + }, + { + "table": { + "table_name": "orders", + "access_type": "ref", + "possible_keys": ["i_o_orderdate", "i_o_custkey"], + "key": "i_o_custkey", + "key_length": "5", + "used_key_parts": ["o_custkey"], + "ref": ["dbt3_s001.customer.c_custkey"], + "rowid_filter": { + "range": { + "key": "i_o_orderdate", + "used_key_parts": ["o_orderDATE"] + }, + "rows": 119, + "selectivity_pct": 7.933333333 + }, + "loops": 6, + "rows": 15, + "cost": "COST_REPLACED", + "filtered": 7.933333397, + "attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'" + } + } + ] + } +} +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and +o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; +DROP DATABASE dbt3_s001; +set default_storage_engine=@save_default_storage_engine; diff --git a/mysql-test/main/update_innodb.test b/mysql-test/main/update_innodb.test index c213ba8b331..ad728fb8e28 100644 --- a/mysql-test/main/update_innodb.test +++ b/mysql-test/main/update_innodb.test @@ -162,3 +162,50 @@ drop table t1,t2; --enable_view_protocol --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33533: multi-delete using rowid filter +--echo # + +set @save_default_storage_engine=@@default_storage_engine; +set default_storage_engine=InnoDB; + +CREATE DATABASE dbt3_s001; + +use dbt3_s001; + +--disable_query_log +--disable_result_log +--disable_warnings +--source include/dbt3_s001.inc +--enable_warnings +--enable_result_log +--enable_query_log + +create index i_n_name on nation(n_name); +analyze table + nation, lineitem, customer, orders, part, supplier, partsupp, region +persistent for all; + +let $c1= + o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey = c_custkey and + c_nationkey = n_nationkey and + n_name='PERU'; + + +explain +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; +--source include/explain-no-costs.inc +explain format=json +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; + +update orders, customer, nation set orders.o_comment = "+++" where o_orderDATE between '1992-01-01' and '1992-06-30' and + o_custkey = c_custkey and c_nationkey = n_nationkey and n_name='PERU'; + +DROP DATABASE dbt3_s001; + +set default_storage_engine=@save_default_storage_engine; + diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 1745949b3c5..d56a2933f6e 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -436,6 +436,10 @@ sub main { { $opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1; } + elsif (IS_MAC) + { + $opt_parallel= `sysctl -n hw.ncpu`; + } else { my $sys_info= My::SysInfo->new(); @@ -3106,6 +3110,7 @@ sub mysql_install_db { # starting from 10.0 bootstrap scripts require InnoDB mtr_add_arg($args, "--loose-innodb"); mtr_add_arg($args, "--loose-innodb-log-file-size=10M"); + mtr_add_arg($args, "--loose-innodb-fast-shutdown=0"); mtr_add_arg($args, "--disable-sync-frm"); mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/"); mtr_add_arg($args, "--core-file"); @@ -4560,8 +4565,6 @@ sub extract_warning_lines ($$) { qr/WSREP: Guessing address for incoming client/, qr/InnoDB: Difficult to find free blocks in the buffer pool*/, - # for UBSAN - qr/decimal\.c.*: runtime error: signed integer overflow/, # Disable test for UBSAN on dynamically loaded objects qr/runtime error: member call.*object.*'Handler_share'/, qr/sql_type\.cc.* runtime error: member call.*object.* 'Type_collection'/, @@ -5721,6 +5724,8 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'}); } + mtr_add_arg($args, "--wait-for-pos-timeout=%d", $opt_debug_sync_timeout); + client_debug_arg($args, "mysqltest"); if ( $opt_record ) diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index f30cc5ec431..c9eea9b6fd9 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -4,14 +4,7 @@ use My::Platform; @ISA = qw(My::Suite); sub skip_combinations { - my @combinations; - - # disable innodb combinations for configurations that were not built - push @combinations, 'innodb_plugin' unless $ENV{HA_INNODB_SO}; - - push @combinations, 'innodb' unless $::mysqld_variables{'innodb'} eq "ON"; - - my %skip = ( 'include/have_innodb.combinations' => [ @combinations ]); + my %skip; $skip{'include/innodb_encrypt_log.combinations'} = [ 'crypt' ] unless $ENV{DEBUG_KEY_MANAGEMENT_SO}; diff --git a/mysql-test/suite/archive/archive.test b/mysql-test/suite/archive/archive.test index c968ed1e138..2319154cbd3 100644 --- a/mysql-test/suite/archive/archive.test +++ b/mysql-test/suite/archive/archive.test @@ -1610,7 +1610,7 @@ SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2'); # Compression length depends on zip library ---replace_result 583 584 291 292 +--replace_result 583 584 585 584 291 292 SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; DROP TABLE t1; diff --git a/mysql-test/suite/archive/archive_bitfield.result b/mysql-test/suite/archive/archive_bitfield.result index 8c30a5f88f6..8cb4190e842 100644 --- a/mysql-test/suite/archive/archive_bitfield.result +++ b/mysql-test/suite/archive/archive_bitfield.result @@ -180,6 +180,7 @@ INSERT INTO `t1` VALUES (NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1), (NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1), (NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1); +/*!999999\- enable the sandbox mode */ INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1); INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1); diff --git a/mysql-test/suite/atomic/alter_table.test b/mysql-test/suite/atomic/alter_table.test index 1f87b7e71b8..aa265c92b7e 100644 --- a/mysql-test/suite/atomic/alter_table.test +++ b/mysql-test/suite/atomic/alter_table.test @@ -1,7 +1,12 @@ --source include/have_debug.inc --source include/have_innodb.inc --source include/have_log_bin.inc ---source include/not_valgrind.inc + +if (!$BIG_TEST) +{ + --source include/not_valgrind.inc + --source include/not_msan.inc +} # # Testing of atomic create table with crashes in a lot of different places diff --git a/mysql-test/suite/binlog/include/binlog_index.inc b/mysql-test/suite/binlog/include/binlog_index.inc index da6cac18e30..69498f42b82 100644 --- a/mysql-test/suite/binlog/include/binlog_index.inc +++ b/mysql-test/suite/binlog/include/binlog_index.inc @@ -98,7 +98,7 @@ reset master; --echo # crash_purge_before_update_index flush logs; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_purge_before_update_index"; --source include/wait_for_binlog_checkpoint.inc --error 2013 @@ -119,7 +119,7 @@ SELECT @index; --echo # crash_purge_non_critical_after_update_index flush logs; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index"; --source include/wait_for_binlog_checkpoint.inc --error 2013 @@ -143,7 +143,7 @@ SELECT @index; --echo # crash_purge_critical_after_update_index flush logs; ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index"; --source include/wait_for_binlog_checkpoint.inc --error 2013 @@ -167,7 +167,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000008; SELECT @index; --echo # crash_create_non_critical_before_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index"; --error 2013 flush logs; @@ -185,7 +185,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000009; SELECT @index; --echo # crash_create_critical_before_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; --error 2013 flush logs; @@ -205,7 +205,7 @@ file_exists $MYSQLD_DATADIR/master-bin.000011; SELECT @index; --echo # crash_create_after_update_index ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET SESSION debug_dbug="+d,crash_create_after_update_index"; --error 2013 flush logs; diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 9ee854bd192..c0c6b7dbc7f 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -2461,7 +2461,10 @@ START TRANSACTION #Q> '', -- c76 #Q> # #Q> 'a', -- c77 -#Q> '', +#Q> '', -- c78 +#Q> # +#Q> 1 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -2643,7 +2646,10 @@ START TRANSACTION #Q> 'longtext-ucs2', -- c76 not using maximum value here #Q> # #Q> 'c', -- c77 -#Q> 'a,b,c +#Q> 'a,b,c', -- c78 +#Q> # +#Q> 2 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -2910,7 +2916,13 @@ START TRANSACTION #Q> 'mediumtext-ucs2', -- c73 #Q> 'longblob', -- c74 #Q> 'longtext', -- c75 -#Q> 'longtext +#Q> 'longtext-ucs2', -- c76 +#Q> # +#Q> 'b', -- c77 +#Q> 'b,c', -- c78 +#Q> # +#Q> 4 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -3251,7 +3263,21 @@ START TRANSACTION #Q> # #Q> c65 = '' AND #Q> c66 = '' AND -#Q> c67 = +#Q> c67 = '' AND +#Q> c68 = '' AND +#Q> c69 = '' AND +#Q> c70 = '' AND +#Q> c71 = '' AND +#Q> c72 = '' AND +#Q> c73 = '' AND +#Q> c74 = '' AND +#Q> c75 = '' AND +#Q> c76 = '' AND +#Q> # +#Q> c77 = 'a' AND +#Q> c78 = '' AND +#Q> # +#Q> crn = 1 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -3596,7 +3622,17 @@ START TRANSACTION #Q> c68 = 'blob' AND #Q> c69 = 'text' AND #Q> c70 = 'text-ucs2' AND -#Q> c71 = 'mediumblob +#Q> c71 = 'mediumblob' AND +#Q> c72 = 'mediumtext' AND +#Q> c73 = 'mediumtext-ucs2' AND +#Q> c74 = 'longblob' AND +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'c' AND +#Q> c78 = 'a,b,c' AND +#Q> # +#Q> crn = 2 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -3939,7 +3975,18 @@ START TRANSACTION #Q> c67 IS NULL AND #Q> c68 IS NULL AND #Q> c69 IS NULL AND -#Q> c70 IS NULL +#Q> c70 IS NULL AND +#Q> c71 IS NULL AND +#Q> c72 IS NULL AND +#Q> c73 IS NULL AND +#Q> c74 IS NULL AND +#Q> c75 IS NULL AND +#Q> c76 IS NULL AND +#Q> # +#Q> c77 IS NULL AND +#Q> c78 IS NULL AND +#Q> # +#Q> crn = 3 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -4285,7 +4332,16 @@ START TRANSACTION #Q> c69 = 'text' AND #Q> c70 = 'text-ucs2' AND #Q> c71 = 'mediumblob' AND -#Q> c72 = 'me +#Q> c72 = 'mediumtext' AND +#Q> c73 = 'mediumtext-ucs2' AND +#Q> c74 = 'longblob' AND +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'b' AND +#Q> c78 = 'b,c' AND +#Q> # +#Q> crn = 4 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -4545,7 +4601,13 @@ START TRANSACTION #Q> c72 = 'mediumtext' AND #Q> c73 = 'mediumtext-ucs2' AND #Q> c74 = 'longblob' AND -#Q> c75 = ' +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'c' AND +#Q> c78 = 'a,b,c' AND +#Q> # +#Q> crn = 1 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -4722,7 +4784,15 @@ START TRANSACTION #Q> c70 = '' AND #Q> c71 = '' AND #Q> c72 = '' AND -#Q> c73 = '' A +#Q> c73 = '' AND +#Q> c74 = '' AND +#Q> c75 = '' AND +#Q> c76 = '' AND +#Q> # +#Q> c77 = 'a' AND +#Q> c78 = '' AND +#Q> # +#Q> crn = 2 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -4902,7 +4972,13 @@ START TRANSACTION #Q> c72 = 'mediumtext' AND #Q> c73 = 'mediumtext-ucs2' AND #Q> c74 = 'longblob' AND -#Q> c75 = 'longtext' +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'b' AND +#Q> c78 = 'b,c' AND +#Q> # +#Q> crn = 3 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -5080,7 +5156,14 @@ START TRANSACTION #Q> c71 IS NULL AND #Q> c72 IS NULL AND #Q> c73 IS NULL AND -#Q> c74 IS NUL +#Q> c74 IS NULL AND +#Q> c75 IS NULL AND +#Q> c76 IS NULL AND +#Q> # +#Q> c77 IS NULL AND +#Q> c78 IS NULL AND +#Q> # +#Q> crn = 4 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -5311,7 +5394,7 @@ START TRANSACTION #Q> ('2008-08-06','VARCHAR-06',6), #Q> ('2008-08-07','VARCHAR-07',7), #Q> ('2008-08-08','VARCHAR-08',8), -#Q> ('2008-08-09','VARCH +#Q> ('2008-08-09','VARCHAR-09',9) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5738,7 +5821,7 @@ START TRANSACTION #Q> ('2008-01-06','VARCHAR-01-06',6), #Q> ('2008-01-07','VARCHAR-01-07',7), #Q> ('2008-01-08','VARCHAR-01-08',18), -#Q> ('2008-01-09','VARCHAR-0 +#Q> ('2008-01-09','VARCHAR-01-09',19) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5808,7 +5891,7 @@ START TRANSACTION #Q> ('2008-02-06','VARCHAR-02-06',6), #Q> ('2008-02-07','VARCHAR-02-07',7), #Q> ('2008-02-08','VARCHAR-02-08',28), -#Q> ('2008-02-09','VARCHAR-0 +#Q> ('2008-02-09','VARCHAR-02-09',29) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5878,7 +5961,7 @@ START TRANSACTION #Q> ('2008-03-06','VARCHAR-03-06',6), #Q> ('2008-03-07','VARCHAR-03-07',7), #Q> ('2008-03-08','VARCHAR-03-08',38), -#Q> ('2008-03-09','VARCHAR-0 +#Q> ('2008-03-09','VARCHAR-03-09',39) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t3` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5943,7 +6026,7 @@ START TRANSACTION #Q> c_1_1 = ADDDATE(c_1_1,INTERVAL 10 YEAR), #Q> c_2_1 = ADDDATE(c_2_1,INTERVAL 20 YEAR), #Q> c_3_1 = ADDDATE(c_3_1,INTERVAL 30 YEAR) -#Q> WHERE c_1_n = c_2_n AND c_2_n = c +#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_n #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # @@ -6130,7 +6213,7 @@ START TRANSACTION # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> DELETE FROM t1,t2,t3 USING t1 INNER JOIN t2 INNER JOIN t3 -#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_ +#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_n #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # @@ -6346,7 +6429,7 @@ START TRANSACTION #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> LOAD DATA INFILE '../../std_data/loaddata5.dat' #Q> INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) -#Q> SET c3 = 'Wo +#Q> SET c3 = 'Wow' #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index a20816e9c20..9186d065ac7 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -2459,7 +2459,10 @@ START TRANSACTION #Q> '', -- c76 #Q> # #Q> 'a', -- c77 -#Q> '', +#Q> '', -- c78 +#Q> # +#Q> 1 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -2643,7 +2646,10 @@ START TRANSACTION #Q> 'longtext-ucs2', -- c76 not using maximum value here #Q> # #Q> 'c', -- c77 -#Q> 'a,b,c +#Q> 'a,b,c', -- c78 +#Q> # +#Q> 2 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -2912,7 +2918,13 @@ START TRANSACTION #Q> 'mediumtext-ucs2', -- c73 #Q> 'longblob', -- c74 #Q> 'longtext', -- c75 -#Q> 'longtext +#Q> 'longtext-ucs2', -- c76 +#Q> # +#Q> 'b', -- c77 +#Q> 'b,c', -- c78 +#Q> # +#Q> 4 -- crn -- row number +#Q> ) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -3255,7 +3267,21 @@ START TRANSACTION #Q> # #Q> c65 = '' AND #Q> c66 = '' AND -#Q> c67 = +#Q> c67 = '' AND +#Q> c68 = '' AND +#Q> c69 = '' AND +#Q> c70 = '' AND +#Q> c71 = '' AND +#Q> c72 = '' AND +#Q> c73 = '' AND +#Q> c74 = '' AND +#Q> c75 = '' AND +#Q> c76 = '' AND +#Q> # +#Q> c77 = 'a' AND +#Q> c78 = '' AND +#Q> # +#Q> crn = 1 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -3602,7 +3628,17 @@ START TRANSACTION #Q> c68 = 'blob' AND #Q> c69 = 'text' AND #Q> c70 = 'text-ucs2' AND -#Q> c71 = 'mediumblob +#Q> c71 = 'mediumblob' AND +#Q> c72 = 'mediumtext' AND +#Q> c73 = 'mediumtext-ucs2' AND +#Q> c74 = 'longblob' AND +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'c' AND +#Q> c78 = 'a,b,c' AND +#Q> # +#Q> crn = 2 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -3947,7 +3983,18 @@ START TRANSACTION #Q> c67 IS NULL AND #Q> c68 IS NULL AND #Q> c69 IS NULL AND -#Q> c70 IS NULL +#Q> c70 IS NULL AND +#Q> c71 IS NULL AND +#Q> c72 IS NULL AND +#Q> c73 IS NULL AND +#Q> c74 IS NULL AND +#Q> c75 IS NULL AND +#Q> c76 IS NULL AND +#Q> # +#Q> c77 IS NULL AND +#Q> c78 IS NULL AND +#Q> # +#Q> crn = 3 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -4295,7 +4342,16 @@ START TRANSACTION #Q> c69 = 'text' AND #Q> c70 = 'text-ucs2' AND #Q> c71 = 'mediumblob' AND -#Q> c72 = 'me +#Q> c72 = 'mediumtext' AND +#Q> c73 = 'mediumtext-ucs2' AND +#Q> c74 = 'longblob' AND +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'b' AND +#Q> c78 = 'b,c' AND +#Q> # +#Q> crn = 4 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F @@ -4557,7 +4613,13 @@ START TRANSACTION #Q> c72 = 'mediumtext' AND #Q> c73 = 'mediumtext-ucs2' AND #Q> c74 = 'longblob' AND -#Q> c75 = ' +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'c' AND +#Q> c78 = 'a,b,c' AND +#Q> # +#Q> crn = 1 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -4736,7 +4798,15 @@ START TRANSACTION #Q> c70 = '' AND #Q> c71 = '' AND #Q> c72 = '' AND -#Q> c73 = '' A +#Q> c73 = '' AND +#Q> c74 = '' AND +#Q> c75 = '' AND +#Q> c76 = '' AND +#Q> # +#Q> c77 = 'a' AND +#Q> c78 = '' AND +#Q> # +#Q> crn = 2 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -4918,7 +4988,13 @@ START TRANSACTION #Q> c72 = 'mediumtext' AND #Q> c73 = 'mediumtext-ucs2' AND #Q> c74 = 'longblob' AND -#Q> c75 = 'longtext' +#Q> c75 = 'longtext' AND +#Q> c76 = 'longtext-ucs2' AND +#Q> # +#Q> c77 = 'b' AND +#Q> c78 = 'b,c' AND +#Q> # +#Q> crn = 3 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -5098,7 +5174,14 @@ START TRANSACTION #Q> c71 IS NULL AND #Q> c72 IS NULL AND #Q> c73 IS NULL AND -#Q> c74 IS NUL +#Q> c74 IS NULL AND +#Q> c75 IS NULL AND +#Q> c76 IS NULL AND +#Q> # +#Q> c77 IS NULL AND +#Q> c78 IS NULL AND +#Q> # +#Q> crn = 4 #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F @@ -5331,7 +5414,7 @@ START TRANSACTION #Q> ('2008-08-06','VARCHAR-06',6), #Q> ('2008-08-07','VARCHAR-07',7), #Q> ('2008-08-08','VARCHAR-08',8), -#Q> ('2008-08-09','VARCH +#Q> ('2008-08-09','VARCHAR-09',9) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5764,7 +5847,7 @@ START TRANSACTION #Q> ('2008-01-06','VARCHAR-01-06',6), #Q> ('2008-01-07','VARCHAR-01-07',7), #Q> ('2008-01-08','VARCHAR-01-08',18), -#Q> ('2008-01-09','VARCHAR-0 +#Q> ('2008-01-09','VARCHAR-01-09',19) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5836,7 +5919,7 @@ START TRANSACTION #Q> ('2008-02-06','VARCHAR-02-06',6), #Q> ('2008-02-07','VARCHAR-02-07',7), #Q> ('2008-02-08','VARCHAR-02-08',28), -#Q> ('2008-02-09','VARCHAR-0 +#Q> ('2008-02-09','VARCHAR-02-09',29) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5908,7 +5991,7 @@ START TRANSACTION #Q> ('2008-03-06','VARCHAR-03-06',6), #Q> ('2008-03-07','VARCHAR-03-07',7), #Q> ('2008-03-08','VARCHAR-03-08',38), -#Q> ('2008-03-09','VARCHAR-0 +#Q> ('2008-03-09','VARCHAR-03-09',39) #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t3` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -5975,7 +6058,7 @@ START TRANSACTION #Q> c_1_1 = ADDDATE(c_1_1,INTERVAL 10 YEAR), #Q> c_2_1 = ADDDATE(c_2_1,INTERVAL 20 YEAR), #Q> c_3_1 = ADDDATE(c_3_1,INTERVAL 30 YEAR) -#Q> WHERE c_1_n = c_2_n AND c_2_n = c +#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_n #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # @@ -6164,7 +6247,7 @@ START TRANSACTION # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> DELETE FROM t1,t2,t3 USING t1 INNER JOIN t2 INNER JOIN t3 -#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_ +#Q> WHERE c_1_n = c_2_n AND c_2_n = c_3_n #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t2` mapped to number # @@ -6382,7 +6465,7 @@ START TRANSACTION #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Annotate_rows: #Q> LOAD DATA INFILE '../../std_data/loaddata5.dat' #Q> INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) -#Q> SET c3 = 'Wo +#Q> SET c3 = 'Wow' #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # #010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result index bb4d318bdd4..edf8f4e7f71 100644 --- a/mysql-test/suite/binlog/r/binlog_row_annotate.result +++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result @@ -232,7 +232,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # @@ -301,7 +301,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE xtest1.xt1, test2.t2 #Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F @@ -434,7 +434,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # # at # @@ -855,7 +855,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # @@ -924,7 +924,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE xtest1.xt1, test2.t2 #Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F @@ -1057,7 +1057,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # # at # diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result index a0cf5b2dcdb..07e469333da 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result +++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result @@ -204,7 +204,7 @@ START TRANSACTION # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE t1 -#Q> FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n +#Q> FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' #010909 4:46:40 server id # end_log_pos # CRC32 XXX Table_map: `new_test1`.`t1` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F @@ -445,7 +445,7 @@ START TRANSACTION # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> LOAD DATA INFILE '../../std_data/loaddata7.dat' INTO TABLE t1 -#Q> FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n +#Q> FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' #010909 4:46:40 server id # end_log_pos # CRC32 XXX Table_map: `new_test1`.`t1` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F diff --git a/mysql-test/suite/binlog/t/binlog_autocommit_off_no_hang.test b/mysql-test/suite/binlog/t/binlog_autocommit_off_no_hang.test index 8f1dbb2a2dd..149b1a8d97d 100644 --- a/mysql-test/suite/binlog/t/binlog_autocommit_off_no_hang.test +++ b/mysql-test/suite/binlog/t/binlog_autocommit_off_no_hang.test @@ -26,10 +26,10 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=innodb; --echo # Restart the server so mysqld reads the gtid_slave_pos using innodb ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/binlog/t/binlog_rotate_perf.test b/mysql-test/suite/binlog/t/binlog_rotate_perf.test index 74c91feca97..512471e2de1 100644 --- a/mysql-test/suite/binlog/t/binlog_rotate_perf.test +++ b/mysql-test/suite/binlog/t/binlog_rotate_perf.test @@ -68,10 +68,10 @@ while ($loop_times) { # try to change the log-bin configs and restart --echo # ======= now try to change the log-bin config for mysqld ======= ---let $restart_parameters="--log-bin=new_log_bin" +--let $restart_parameters=--log-bin=new_log_bin --echo #begin to restart mysqld --source include/restart_mysqld.inc ---let $restart_parameters= "" +--let $restart_parameters= --source include/show_binary_logs.inc let $loop_times= 10; diff --git a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result index 583d9a30a5a..2a20f9391b2 100644 --- a/mysql-test/suite/binlog_encryption/binlog_row_annotate.result +++ b/mysql-test/suite/binlog_encryption/binlog_row_annotate.result @@ -236,7 +236,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # @@ -305,7 +305,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE xtest1.xt1, test2.t2 #Q> FROM xtest1.xt1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number # # at # #010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F @@ -441,7 +441,7 @@ START TRANSACTION #010909 4:46:40 server id # end_log_pos # Annotate_rows: #Q> DELETE test1.t1, test2.t2 #Q> FROM test1.t1 INNER JOIN test2.t2 INNER JOIN test3.t3 -#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3 +#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3.a #010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number # # at # # at # diff --git a/mysql-test/suite/binlog_encryption/restart_server.inc b/mysql-test/suite/binlog_encryption/restart_server.inc index 8f0fe7d8970..f71858be741 100644 --- a/mysql-test/suite/binlog_encryption/restart_server.inc +++ b/mysql-test/suite/binlog_encryption/restart_server.inc @@ -20,7 +20,7 @@ --connection $_cur_con --enable_reconnect ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect shutdown_server; @@ -31,5 +31,5 @@ if ($rpl_server_parameters) { --let $_rpl_start_server_command= restart:$rpl_server_parameters } ---exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect +--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.result b/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.result index ba131ea094f..6b75dbf6181 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.result +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.result @@ -206,10 +206,12 @@ RETURN x; END || SET sql_log_bin=1; +include/stop_slave_io.inc connection server_1; INSERT INTO t3 VALUES (49,0); connection server_2; -START SLAVE SQL_THREAD; +CHANGE MASTER TO master_use_gtid=no; +include/start_slave.inc SELECT * FROM t3 WHERE a >= 40 ORDER BY a; a b 41 41 @@ -239,10 +241,6 @@ SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; include/start_slave.inc *** 3. Same as (2), but not using gtid mode *** -connection server_2; -include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; -include/start_slave.inc connection server_1; connection con_temp3; SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; diff --git a/mysql-test/suite/compat/oracle/r/gis.result b/mysql-test/suite/compat/oracle/r/gis.result index 113cb0ea402..8145b97d695 100644 --- a/mysql-test/suite/compat/oracle/r/gis.result +++ b/mysql-test/suite/compat/oracle/r/gis.result @@ -33,37 +33,37 @@ ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(PO # MDEV-20009 Add CAST(expr AS pluggable_type) # SELECT CAST(1 AS GEOMETRY); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)' SELECT CAST(1 AS GEOMETRYCOLLECTION); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)' SELECT CAST(1 AS POINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS point)' +ERROR HY000: Operator does not exist: 'CAST(expr AS point)' SELECT CAST(1 AS LINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)' SELECT CAST(1 AS POLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)' SELECT CAST(1 AS MULTIPOINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)' SELECT CAST(1 AS MULTILINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)' SELECT CAST(1 AS MULTIPOLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)' SELECT CONVERT(1, GEOMETRY); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometry)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)' SELECT CONVERT(1, GEOMETRYCOLLECTION); -ERROR HY000: Operator does not exists: 'CAST(expr AS geometrycollection)' +ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)' SELECT CONVERT(1, POINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS point)' +ERROR HY000: Operator does not exist: 'CAST(expr AS point)' SELECT CONVERT(1, LINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS linestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)' SELECT CONVERT(1, POLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS polygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)' SELECT CONVERT(1, MULTIPOINT); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipoint)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)' SELECT CONVERT(1, MULTILINESTRING); -ERROR HY000: Operator does not exists: 'CAST(expr AS multilinestring)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)' SELECT CONVERT(1, MULTIPOLYGON); -ERROR HY000: Operator does not exists: 'CAST(expr AS multipolygon)' +ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)' # # End of 10.5 tests # diff --git a/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result b/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result index fd3dd787f1e..c01524b3cfa 100644 --- a/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result +++ b/mysql-test/suite/compat/oracle/r/mysqldump_restore_func_qualified.result @@ -24,6 +24,7 @@ b1 VARCHAR(64) AS (LPAD(b0,10)) PERSISTENT CREATE VIEW v2 AS SELECT LTRIM(now()) AS a0, LPAD(now(),10) AS b0; +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( diff --git a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result index 24211c6318e..508aea0e74f 100644 --- a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result +++ b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result @@ -34,6 +34,7 @@ PROCEDURE p1; FUNCTION f1 RETURN INT; END; $$ +/*!999999\- enable the sandbox mode */ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test index 9c2918f3118..f4065290938 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change3.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change3.test @@ -16,7 +16,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau --let $MYSQLD_DATADIR = `SELECT @@datadir` --let SEARCH_RANGE = 10000000 --let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -25,7 +25,7 @@ call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* becau 4;770A8A65DA156D24EE2A093277530143 EOF ---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc @@ -47,7 +47,7 @@ UNLOCK TABLES; ALTER TABLE t1 DISCARD TABLESPACE; ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -62,7 +62,7 @@ ib_discard_tablespaces("test", "t1"); ib_restore_tablespaces("test", "t1"); EOF ---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --source include/restart_mysqld.inc @@ -80,7 +80,7 @@ SELECT * FROM t1; -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc --remove_file $MYSQLTEST_VARDIR/keys1.txt @@ -89,7 +89,7 @@ SELECT * FROM t1; 4;770A8A65DA156D24EE2A093277530143 EOF ---exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc DROP TABLE t1; diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_freed.test b/mysql-test/suite/encryption/t/innodb_encrypt_freed.test index 7ba0b5a2d1a..26c1e8dfee5 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_freed.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_freed.test @@ -21,7 +21,7 @@ CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null, SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; CREATE TABLE t2 (f1 int not null)engine=innodb; -let $restart_parameters="--debug=d,ib_log_checkpoint_avoid"; +let $restart_parameters=--debug=d,ib_log_checkpoint_avoid; --source include/restart_mysqld.inc # Stop the purge diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result index bb817b210f2..e75fb25304c 100644 --- a/mysql-test/suite/federated/federatedx.result +++ b/mysql-test/suite/federated/federatedx.result @@ -2243,6 +2243,7 @@ connection master; CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; # Dump table t1 using mysqldump tool +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 2d8e5e6299d..752994c4a26 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -17,12 +17,10 @@ galera_ssl_upgrade : [Warning] Failed to load slave replication state from table 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 -versioning_trx_id : MDEV-18590 : galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch 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() galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed -mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSMM::handle_apply_error() galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes -MW-402 : temporarily disabled at the request of Codership galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch +galera_create_table_as_select : MDEV-33952 fails sporadically diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf index 66238a8e4c2..3ad1a66b9e6 100644 --- a/mysql-test/suite/galera/galera_4nodes.cnf +++ b/mysql-test/suite/galera/galera_4nodes.cnf @@ -21,6 +21,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#gale wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' +auto-increment-offset=1 [mysqld.2] wsrep-on=1 @@ -32,6 +33,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#gale wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' +auto-increment-offset=2 [mysqld.3] wsrep-on=1 @@ -43,6 +45,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#gale wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' +auto-increment-offset=3 [mysqld.4] wsrep-on=1 @@ -54,6 +57,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#gale wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' +auto-increment-offset=4 [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera/include/kill_galera.inc b/mysql-test/suite/galera/include/kill_galera.inc index 28a1b0f368c..3c218a19bee 100644 --- a/mysql-test/suite/galera/include/kill_galera.inc +++ b/mysql-test/suite/galera/include/kill_galera.inc @@ -8,7 +8,7 @@ if (!$kill_signal) # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name # Kill the connected server --disable_reconnect diff --git a/mysql-test/suite/galera/include/shutdown_mysqld.inc b/mysql-test/suite/galera/include/shutdown_mysqld.inc deleted file mode 100644 index 793be8d76ac..00000000000 --- a/mysql-test/suite/galera/include/shutdown_mysqld.inc +++ /dev/null @@ -1,18 +0,0 @@ -# This is the first half of include/restart_mysqld.inc. -if ($rpl_inited) -{ - if (!$allow_rpl_inited) - { - --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc - } -} - -# Write file to make mysql-test-run.pl expect the "crash", but don't start it ---let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` ---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name - -# Send shutdown to the connected server ---shutdown_server ---source include/wait_until_disconnected.inc - diff --git a/mysql-test/suite/galera/include/start_mysqld.inc b/mysql-test/suite/galera/include/start_mysqld.inc index 57af9203d0f..c9bed71f517 100644 --- a/mysql-test/suite/galera/include/start_mysqld.inc +++ b/mysql-test/suite/galera/include/start_mysqld.inc @@ -4,12 +4,12 @@ if ($galera_wsrep_start_position != '') { --echo Using --wsrep-start-position when starting mysqld ... - --exec echo "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" > $_expect_file_name + --write_line "restart:$start_mysqld_params --wsrep-start-position=$galera_wsrep_start_position" $_expect_file_name --let $galera_wsrep_start_position = 0 } if ($galera_wsrep_start_position == '') { - --exec echo "restart:$start_mysqld_params" > $_expect_file_name + --write_line "restart:$start_mysqld_params" $_expect_file_name } --source include/galera_wait_ready.inc diff --git a/mysql-test/suite/galera/r/MDEV-25731.result b/mysql-test/suite/galera/r/MDEV-25731.result index 92e1704e658..11a72730fb1 100644 --- a/mysql-test/suite/galera/r/MDEV-25731.result +++ b/mysql-test/suite/galera/r/MDEV-25731.result @@ -4,9 +4,7 @@ connection node_1; SET GLOBAL wsrep_load_data_splitting=ON; Warnings: Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release -SET GLOBAL wsrep_replicate_myisam=ON; -Warnings: -Warning 1287 '@@wsrep_replicate_myisam' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=REPLICATE_MYISAM' instead +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; CREATE TABLE t1 (c1 int) ENGINE=MYISAM; LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; Warnings: @@ -19,8 +17,11 @@ SELECT COUNT(*) AS EXPECT_6 FROM t1; EXPECT_6 6 connection node_1; -ALTER TABLE t1 ENGINE=InnoDB; +ALTER TABLE t1 ENGINE=Aria; +SET GLOBAL wsrep_mode=REPLICATE_ARIA; LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; +Warnings: +Warning 1235 wsrep_load_data_splitting for other than InnoDB tables SELECT COUNT(*) AS EXPECT_12 FROM t1; EXPECT_12 12 @@ -29,10 +30,18 @@ SELECT COUNT(*) AS EXPECT_12 FROM t1; EXPECT_12 12 connection node_1; +ALTER TABLE t1 ENGINE=InnoDB; +LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; +SELECT COUNT(*) AS EXPECT_18 FROM t1; +EXPECT_18 +18 +connection node_2; +SELECT COUNT(*) AS EXPECT_18 FROM t1; +EXPECT_18 +18 +connection node_1; DROP TABLE t1; SET GLOBAL wsrep_load_data_splitting=OFF; Warnings: Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release -SET GLOBAL wsrep_replicate_myisam=OFF; -Warnings: -Warning 1287 '@@wsrep_replicate_myisam' is deprecated and will be removed in a future release. Please use '@@wsrep_mode=REPLICATE_MYISAM' instead +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/r/MDEV-26499.result b/mysql-test/suite/galera/r/MDEV-26499.result new file mode 100644 index 00000000000..15d372470a4 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26499.result @@ -0,0 +1,6 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +SET GLOBAL debug_dbug="+d,simulate_slow_client_at_shutdown"; diff --git a/mysql-test/suite/galera/r/MDEV-27276.result b/mysql-test/suite/galera/r/MDEV-27276.result index 7e5b29fad7e..38e217a9ea8 100644 --- a/mysql-test/suite/galera/r/MDEV-27276.result +++ b/mysql-test/suite/galera/r/MDEV-27276.result @@ -16,17 +16,15 @@ connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; connection node_1; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1a; +SET SESSION DEBUG_SYNC = "RESET"; connection node_2; SELECT * FROM p; id f2 diff --git a/mysql-test/suite/galera/r/MDEV-27806.result b/mysql-test/suite/galera/r/MDEV-27806.result index 0f7ac79e4cd..6fe288f4e8e 100644 --- a/mysql-test/suite/galera/r/MDEV-27806.result +++ b/mysql-test/suite/galera/r/MDEV-27806.result @@ -37,7 +37,7 @@ mysqld-bin.000002 # Gtid # # BEGIN GTID #-#-# mysqld-bin.000002 # Query # # use `test`; CREATE TABLE `ts1` ( `f1` int(11) NOT NULL ) -mysqld-bin.000002 # Xid # # COMMIT /* XID */ +mysqld-bin.000002 # Query # # COMMIT connection node_2; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/galera/r/MDEV-33828.result b/mysql-test/suite/galera/r/MDEV-33828.result new file mode 100644 index 00000000000..a3ce68166ab --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-33828.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +SET AUTOCOMMIT=ON; +SELECT @@autocommit; +@@autocommit +1 +SET LOCAL enforce_storage_engine=InnoDB; +CREATE TABLE t1(id int not null primary key auto_increment, name varchar(64)) ENGINE=InnoDB; +INSERT INTO t1(name) VALUES ('name1'),('name3'),('name6'),('name2'); +CREATE PROCEDURE sel_proc() +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +SELECT * FROM t1; +END| +CREATE PROCEDURE ins_proc() +BEGIN +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +INSERT INTO t1 VALUES ('name_proc'); +END| +SET AUTOCOMMIT=OFF; +SELECT @@autocommit; +@@autocommit +0 +START TRANSACTION; +insert into t1(name) values('name10'); +select param_list, returns, db, type from mysql.proc where name='sel_proc'; +param_list returns db type + test PROCEDURE +call ins_proc(); +COMMIT; +SET AUTOCOMMIT=ON; +SELECT * FROM t1; +id name +1 name1 +3 name3 +5 name6 +7 name2 +9 name10 +DROP TABLE t1; +DROP PROCEDURE sel_proc; +DROP PROCEDURE ins_proc; diff --git a/mysql-test/suite/galera/r/MW-369.result b/mysql-test/suite/galera/r/MW-369.result index 9f0a77edbbc..b4fb8668e74 100644 --- a/mysql-test/suite/galera/r/MW-369.result +++ b/mysql-test/suite/galera/r/MW-369.result @@ -12,22 +12,20 @@ START TRANSACTION; DELETE FROM p WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; INSERT INTO c VALUES (1, 1); connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -54,22 +52,20 @@ START TRANSACTION; UPDATE p SET f2 = 1 WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; UPDATE c SET f2 = 1 WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; connection node_2; SELECT * FROM p; @@ -94,22 +90,20 @@ START TRANSACTION; UPDATE p SET f2 = 1 WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; DELETE FROM c WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; connection node_2; SELECT * FROM p; @@ -130,22 +124,20 @@ START TRANSACTION; UPDATE p SET f2 = 1 WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; INSERT INTO c VALUES (1, 0);; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -170,22 +162,20 @@ START TRANSACTION; DELETE FROM p WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; UPDATE c SET f2 = 1 WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -215,22 +205,20 @@ START TRANSACTION; INSERT INTO cf (f1, p_id) VALUES (10, 1); connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; INSERT INTO cf (f1, p_id) VALUES (20, 1); connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; connection node_2; SELECT * FROM pf; @@ -255,22 +243,20 @@ START TRANSACTION; UPDATE pg SET f2 = 1 WHERE f1 = 1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; INSERT INTO cg VALUES (1, 1, 0); connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; connection node_2; SELECT * FROM pg; diff --git a/mysql-test/suite/galera/r/MW-402.result b/mysql-test/suite/galera/r/MW-402.result index f692c90d611..e936b83553d 100644 --- a/mysql-test/suite/galera/r/MW-402.result +++ b/mysql-test/suite/galera/r/MW-402.result @@ -15,22 +15,20 @@ START TRANSACTION; UPDATE c SET f2=1 where f1=1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; DELETE FROM p WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -55,22 +53,20 @@ START TRANSACTION; UPDATE c SET f2=2 where f1=1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; UPDATE p set f1=11 WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -97,22 +93,20 @@ START TRANSACTION; UPDATE c SET p_id=2 where f1=1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; UPDATE p set f1=11 WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -130,22 +124,20 @@ START TRANSACTION; UPDATE p set f1=21 WHERE f1 = 11; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; UPDATE c SET p_id=2 where f1=1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; @@ -176,22 +168,20 @@ START TRANSACTION; UPDATE p2 SET f2=2 where f1=1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; DELETE FROM p1 WHERE f1 = 1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; connection node_2; SELECT * FROM p1; @@ -223,22 +213,20 @@ START TRANSACTION; DELETE FROM p2 WHERE f1=1; connection node_1a; SET SESSION wsrep_sync_wait = 0; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; connection node_2; DELETE FROM p1 WHERE f1=1; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; connection node_1; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -SET GLOBAL wsrep_provider_options = 'dbug='; +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction connection node_2; diff --git a/mysql-test/suite/galera/r/galera_load_data.result b/mysql-test/suite/galera/r/galera_load_data.result index 84e96f8a36c..c275eb02ca5 100644 --- a/mysql-test/suite/galera/r/galera_load_data.result +++ b/mysql-test/suite/galera/r/galera_load_data.result @@ -26,9 +26,308 @@ PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1324 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; LOCK TABLES cardtest_tbl WRITE; ALTER TABLE cardtest_tbl DISABLE KEYS; -Warnings: -Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option -INSERT INTO cardtest_tbl VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL); +INSERT INTO cardtest_tbl VALUES +(1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), +(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL); ALTER TABLE cardtest_tbl ENABLE KEYS; Warnings: Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff index 3aad611cacb..9dc845499ad 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff @@ -1,6 +1,6 @@ ---- r/galera_sst_mariabackup.result -+++ r/galera_sst_mariabackup.reject -@@ -516,5 +516,189 @@ +--- galera/r/galera_sst_mariabackup.result 2024-04-11 09:53:12.950512316 +0300 ++++ galera/r/galera_sst_mariabackup,debug.reject 2024-04-11 10:00:36.771144955 +0300 +@@ -524,6 +524,190 @@ 1 DROP TABLE t1; COMMIT; @@ -188,5 +188,6 @@ +DROP TABLE t1; +COMMIT; +SET GLOBAL debug_dbug = $debug_orig; - disconnect node_2; - disconnect node_1; + connection node_2; + Shutting down server ... + connection node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_sst_mariabackup.result index caf602c017c..374f714efb3 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup.result @@ -2,6 +2,14 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_1; +select @@innodb_undo_tablespaces; +@@innodb_undo_tablespaces +0 +connection node_2; +select @@innodb_undo_tablespaces; +@@innodb_undo_tablespaces +3 Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; @@ -516,5 +524,17 @@ COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +connection node_2; +Shutting down server ... +connection node_1; +connection node_2; +Starting server ... +Using --wsrep-start-position when starting mysqld ... +connection node_1; +connection node_2; +select @@innodb_undo_tablespaces; +@@innodb_undo_tablespaces +3 +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=3 because previous shutdown was not with innodb_fast_shutdown=0"); disconnect node_2; disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_table_with_hyphen.result b/mysql-test/suite/galera/r/galera_table_with_hyphen.result new file mode 100644 index 00000000000..c9993004b53 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_table_with_hyphen.result @@ -0,0 +1,52 @@ +connection node_2; +connection node_1; +connection node_1; +set wsrep_sync_wait=0; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE `par-ent` ( id INT AUTO_INCREMENT PRIMARY KEY, j INT) ENGINE=InnoDB; +CREATE TABLE `child` (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, j INT, FOREIGN KEY (parent_id) REFERENCES `par-ent`(id)) ENGINE=InnoDB; +INSERT INTO `par-ent` VALUES (23,0); +connection node_2; +connection node_1a; +SET GLOBAL DEBUG_DBUG='+d,wsrep_ha_write_row'; +connection node_2; +INSERT INTO `child` VALUES (21,23,0),(22,23,0),(23,23,0); +connection node_1a; +SET DEBUG_SYNC='now WAIT_FOR wsrep_ha_write_row_reached'; +connection node_2; +UPDATE `par-ent` SET j=2 WHERE id=23; +connection node_1a; +SET GLOBAL DEBUG_DBUG='-d,wsrep_ha_write_row'; +SET DEBUG_SYNC='now SIGNAL wsrep_ha_write_row_continue'; +SET GLOBAL DEBUG_DBUG="RESET"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_2; +drop table `child`; +drop table `par-ent`; +connection node_1; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE `p-arent-` ( id INT AUTO_INCREMENT PRIMARY KEY, j INT) ENGINE=InnoDB; +CREATE TABLE `c-hild` (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, j INT, FOREIGN KEY (parent_id) REFERENCES `p-arent-`(id)) ENGINE=InnoDB; +INSERT INTO `p-arent-` VALUES (23,0); +connection node_2; +connection node_1a; +SET GLOBAL DEBUG_DBUG='+d,wsrep_ha_write_row'; +connection node_2; +INSERT INTO `c-hild` VALUES (21,23,0),(22,23,0),(23,23,0); +connection node_1a; +SET DEBUG_SYNC='now WAIT_FOR wsrep_ha_write_row_reached'; +connection node_2; +UPDATE `p-arent-` SET j=2 WHERE id=23; +connection node_1a; +SET GLOBAL DEBUG_DBUG='-d,wsrep_ha_write_row'; +SET DEBUG_SYNC='now SIGNAL wsrep_ha_write_row_continue'; +SET GLOBAL DEBUG_DBUG="RESET"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_2; +drop table `c-hild`; +drop table `p-arent-`; diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result index c6b3d8fa554..ff0063fbf7b 100644 --- a/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result +++ b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result @@ -1,7 +1,5 @@ connection node_2; connection node_1; -connection node_1; -connection node_2; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_1; @@ -55,6 +53,7 @@ expect_0 SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; expect_1 1 +CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster."); connection node_4; SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; expect_0 @@ -64,3 +63,5 @@ expect_1 1 CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster."); DROP TABLE t2; +disconnect node_3; +disconnect node_4; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result index 2433a1d9c48..edaefe0e563 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -10,7 +10,7 @@ SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA EXPECT_4 4 connection node_1; -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1); connection node_2; INSERT INTO t1 VALUES (2); @@ -20,6 +20,8 @@ connection node_4; INSERT INTO t1 VALUES (4); connection node_3; INSERT INTO t1 VALUES (13); +connection node_1; +connection node_3; Killing server ... connection node_1; INSERT INTO t1 VALUES (11); @@ -29,8 +31,11 @@ connection node_4; INSERT INTO t1 VALUES (14); connection node_3; INSERT INTO t1 VALUES (131); +connection node_1; connection node_2; INSERT INTO t1 VALUES (22); +connection node_1; +connection node_2; Killing server ... connection node_1; INSERT INTO t1 VALUES (21); @@ -42,6 +47,8 @@ connection node_2; INSERT INTO t1 VALUES (221); connection node_4; INSERT INTO t1 VALUES (34); +connection node_1; +connection node_4; Killing server ... connection node_1; INSERT INTO t1 VALUES (31); diff --git a/mysql-test/suite/galera/r/mdev-22063.result b/mysql-test/suite/galera/r/mdev-22063.result index c594bc47b95..155d1ebbe4f 100644 --- a/mysql-test/suite/galera/r/mdev-22063.result +++ b/mysql-test/suite/galera/r/mdev-22063.result @@ -78,7 +78,6 @@ INSERT INTO t3(id) SELECT seq FROM seq_1_to_1000; REPLACE INTO t4 SELECT * FROM t1; REPLACE INTO t5 SELECT * FROM t2; REPLACE INTO t6 SELECT * FROM t3; -ERROR HY000: Transactional commit not supported by involved engine(s) REPLACE INTO t7 SELECT * FROM t2; REPLACE INTO t8 SELECT * FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t1; @@ -96,9 +95,9 @@ EXPECT_1000 SELECT COUNT(*) AS EXPECT_1000 FROM t5; EXPECT_1000 1000 -SELECT COUNT(*) AS EXPECT_0 FROM t6; -EXPECT_0 -0 +SELECT COUNT(*) AS EXPECT_1000 FROM t6; +EXPECT_1000 +1000 SELECT COUNT(*) AS EXPECT_1000 FROM t7; EXPECT_1000 1000 @@ -121,9 +120,9 @@ EXPECT_1000 SELECT COUNT(*) AS EXPECT_1000 FROM t5; EXPECT_1000 1000 -SELECT COUNT(*) AS EXPECT_0 FROM t6; -EXPECT_0 -0 +SELECT COUNT(*) AS EXPECT_1000 FROM t6; +EXPECT_1000 +1000 SELECT COUNT(*) AS EXPECT_1000 FROM t7; EXPECT_1000 1000 @@ -147,7 +146,6 @@ INSERT INTO t3(id) SELECT seq FROM seq_1_to_1000; INSERT INTO t4 SELECT * FROM t1; INSERT INTO t5 SELECT * FROM t2; INSERT INTO t6 SELECT * FROM t3; -ERROR HY000: Transactional commit not supported by involved engine(s) INSERT INTO t7 SELECT * FROM t2; INSERT INTO t8 SELECT * FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t1; @@ -165,9 +163,9 @@ EXPECT_1000 SELECT COUNT(*) AS EXPECT_1000 FROM t5; EXPECT_1000 1000 -SELECT COUNT(*) AS EXPECT_0 FROM t6; -EXPECT_0 -0 +SELECT COUNT(*) AS EXPECT_1000 FROM t6; +EXPECT_1000 +1000 SELECT COUNT(*) AS EXPECT_1000 FROM t7; EXPECT_1000 1000 @@ -190,9 +188,9 @@ EXPECT_1000 SELECT COUNT(*) AS EXPECT_1000 FROM t5; EXPECT_1000 1000 -SELECT COUNT(*) AS EXPECT_0 FROM t6; -EXPECT_0 -0 +SELECT COUNT(*) AS EXPECT_1000 FROM t6; +EXPECT_1000 +1000 SELECT COUNT(*) AS EXPECT_1000 FROM t7; EXPECT_1000 1000 diff --git a/mysql-test/suite/galera/r/mysql-wsrep#332.result b/mysql-test/suite/galera/r/mysql-wsrep#332.result index 565979a93ae..16b078175bb 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#332.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#332.result @@ -21,14 +21,10 @@ connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; connection node_1; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction @@ -64,14 +60,10 @@ connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; connection node_1; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction @@ -112,14 +104,10 @@ connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; connection node_1; COMMIT; connection node_1a; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction diff --git a/mysql-test/suite/galera/r/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.result b/mysql-test/suite/galera/r/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.result index 76c13fa7b89..5ab00d5d607 100644 --- a/mysql-test/suite/galera/r/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.result +++ b/mysql-test/suite/galera/r/rpl_galera_to_mariadb_clone_slave_using_mariadb-backup.result @@ -45,13 +45,13 @@ connection master; connection slave; ############################################################## ### Running `mariadb-backup --backup,--prepare` and checking -### that xtrabackup_slave_info and xtrabackup_binlog_info are OK +### that mariadb_backup_slave_info and mariadb_backup_binlog_info are OK ### Slave: Create a backup ### Slave: Prepare the backup ### Slave: xtrabackup files: -############################ xtrabackup_slave_info +############################ mariadb_backup_slave_info CHANGE MASTER TO MASTER_LOG_FILE='master_after_tr01_show_master_status_file', MASTER_LOG_POS=master_after_tr01_show_master_status_position; -############################ xtrabackup_binlog_info +############################ mariadb_backup_binlog_info slave_after_tr01_show_master_status_file slave_after_tr01_show_master_status_position slave_after_tr01_gtid_binlog_pos ############################ ############################################################## @@ -137,7 +137,7 @@ tr#01:stmt#01 - slave run#0, before backup tr#01:stmt#02 - slave run#0, before backup ### Slave: Execute the CHANGE MASTER statement to set up the host and port CHANGE MASTER '' TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=###, MASTER_CONNECT_RETRY=1; -### Slave: Execute the CHANGE MASTER statement from xtrabackup_slave_info +### Slave: Execute the CHANGE MASTER statement from mariadb_backup_slave_info CHANGE MASTER TO MASTER_LOG_FILE='master_after_tr01_show_master_status_file', MASTER_LOG_POS=master_after_tr01_show_master_status_position; Warnings: Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'Slave_Pos' to 'No' diff --git a/mysql-test/suite/galera/r/versioning_trx_id.result b/mysql-test/suite/galera/r/versioning_trx_id.result index df92d088834..c28662dcfe6 100644 --- a/mysql-test/suite/galera/r/versioning_trx_id.result +++ b/mysql-test/suite/galera/r/versioning_trx_id.result @@ -17,7 +17,7 @@ a select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; count(*) 0 -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; count(*) 0 connection node_3; @@ -34,7 +34,7 @@ a select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; count(*) 0 -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; count(*) 0 connection node_1; @@ -50,7 +50,7 @@ a select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; count(*) 0 -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; count(*) 0 drop table t1; diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index f6caecdc36a..4c4d26db4c5 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -1,5 +1,6 @@ package My::Suite::Galera; +use warnings; use lib 'suite'; use wsrep::common; @@ -63,6 +64,7 @@ push @::global_suppressions, qr(WSREP: Failed to remove page file .*), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr|WSREP: Send action \{.* STATE_REQUEST} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/galera/t/MDEV-25731.test b/mysql-test/suite/galera/t/MDEV-25731.test index c26fad2fa6a..893cccbb2bd 100644 --- a/mysql-test/suite/galera/t/MDEV-25731.test +++ b/mysql-test/suite/galera/t/MDEV-25731.test @@ -3,7 +3,7 @@ --connection node_1 SET GLOBAL wsrep_load_data_splitting=ON; -SET GLOBAL wsrep_replicate_myisam=ON; +SET GLOBAL wsrep_mode=REPLICATE_MYISAM; CREATE TABLE t1 (c1 int) ENGINE=MYISAM; LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; SELECT COUNT(*) AS EXPECT_6 FROM t1; @@ -12,16 +12,23 @@ SELECT COUNT(*) AS EXPECT_6 FROM t1; SELECT COUNT(*) AS EXPECT_6 FROM t1; --connection node_1 -ALTER TABLE t1 ENGINE=InnoDB; +ALTER TABLE t1 ENGINE=Aria; +SET GLOBAL wsrep_mode=REPLICATE_ARIA; LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; SELECT COUNT(*) AS EXPECT_12 FROM t1; --connection node_2 SELECT COUNT(*) AS EXPECT_12 FROM t1; +--connection node_1 +ALTER TABLE t1 ENGINE=InnoDB; +LOAD DATA INFILE '../../std_data/mdev-25731.dat' IGNORE INTO TABLE t1 LINES TERMINATED BY '\n'; +SELECT COUNT(*) AS EXPECT_18 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS EXPECT_18 FROM t1; + --connection node_1 DROP TABLE t1; SET GLOBAL wsrep_load_data_splitting=OFF; -SET GLOBAL wsrep_replicate_myisam=OFF; - - +SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/MDEV-26499.test b/mysql-test/suite/galera/t/MDEV-26499.test new file mode 100644 index 00000000000..824b28c14f3 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26499.test @@ -0,0 +1,20 @@ +# +# MDEV-26499 +# +# This test reproduces some failure on mysql_shutdown() call +# which manifests sporadically in some galera MTR tests during +# restart of a node. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 +SET GLOBAL debug_dbug="+d,simulate_slow_client_at_shutdown"; +--source include/restart_mysqld.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/MDEV-26597.test b/mysql-test/suite/galera/t/MDEV-26597.test index 783a52cad50..465f1130443 100644 --- a/mysql-test/suite/galera/t/MDEV-26597.test +++ b/mysql-test/suite/galera/t/MDEV-26597.test @@ -18,7 +18,7 @@ SHOW WARNINGS; SET SESSION wsrep_sync_wait = 0; --source include/kill_galera.inc ---let $start_mysqld_params = "" +--let $start_mysqld_params = --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc diff --git a/mysql-test/suite/galera/t/MDEV-27276.test b/mysql-test/suite/galera/t/MDEV-27276.test index 1c589c9e85b..bdce0d91373 100644 --- a/mysql-test/suite/galera/t/MDEV-27276.test +++ b/mysql-test/suite/galera/t/MDEV-27276.test @@ -17,7 +17,7 @@ # We use concurrency facility of test MW-369 to setup the conflict between DDL and DML # -# Open connection node_1a here, MW-369.inc will use it later +# Open connection node_1a here, we will use it later --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 # create FK parent table @@ -28,14 +28,51 @@ CREATE TABLE p (id INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; --let $mw_369_parent_query = INSERT INTO p VALUES(1,0) --let $mw_369_child_query = CREATE TABLE c(id INT NOT NULL PRIMARY KEY, p_id INT, FOREIGN KEY (p_id) REFERENCES p(id) ON DELETE CASCADE) ENGINE=InnoDB -# execute above queries through separate nodes ---source MW-369.inc +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; +--eval $mw_369_parent_query + +# +# Block the $mw_369_child_query from node_2 +# +# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# insert client row, which will make it impossible to replay the +# delete on parent +# +--connection node_2 +--eval $mw_369_child_query + +# +# Wait until $mw_369_child_query from node_2 reaches the sync point and +# block the 'COMMIT' from node_1 before it certifies. +# +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc # Expect certification failure --connection node_1 --error ER_LOCK_DEADLOCK --reap +--connection node_1a +SET SESSION DEBUG_SYNC = "RESET"; + --connection node_2 SELECT * FROM p; SELECT * FROM c; diff --git a/mysql-test/suite/galera/t/MDEV-29142.test b/mysql-test/suite/galera/t/MDEV-29142.test index 316b7f26000..c41302f9e27 100644 --- a/mysql-test/suite/galera/t/MDEV-29142.test +++ b/mysql-test/suite/galera/t/MDEV-29142.test @@ -50,12 +50,12 @@ SET SESSION wsrep_sync_wait = 0; --source include/kill_galera.inc --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat ---let $start_mysqld_params = "--wsrep-new-cluster" +--let $start_mysqld_params =--wsrep-new-cluster --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/start_mysqld.inc --connection node_2 ---let $start_mysqld_params = "" +--let $start_mysqld_params = --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc diff --git a/mysql-test/suite/galera/t/MDEV-33828.cnf b/mysql-test/suite/galera/t/MDEV-33828.cnf new file mode 100644 index 00000000000..4c62448fe3d --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-33828.cnf @@ -0,0 +1,4 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-33828.test b/mysql-test/suite/galera/t/MDEV-33828.test new file mode 100644 index 00000000000..8e30481beee --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-33828.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc + +SET AUTOCOMMIT=ON; +SELECT @@autocommit; + +SET LOCAL enforce_storage_engine=InnoDB; + +CREATE TABLE t1(id int not null primary key auto_increment, name varchar(64)) ENGINE=InnoDB; +INSERT INTO t1(name) VALUES ('name1'),('name3'),('name6'),('name2'); + +DELIMITER |; +CREATE PROCEDURE sel_proc() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + SELECT * FROM t1; +END| + +CREATE PROCEDURE ins_proc() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + INSERT INTO t1 VALUES ('name_proc'); +END| +DELIMITER ;| + +SET AUTOCOMMIT=OFF; +SELECT @@autocommit; + +START TRANSACTION; + +insert into t1(name) values('name10'); + +select param_list, returns, db, type from mysql.proc where name='sel_proc'; + +call ins_proc(); + +COMMIT; + +SET AUTOCOMMIT=ON; + +SELECT * FROM t1; +DROP TABLE t1; +DROP PROCEDURE sel_proc; +DROP PROCEDURE ins_proc; diff --git a/mysql-test/suite/galera/t/MW-369.inc b/mysql-test/suite/galera/t/MW-369.inc index 71df979d6ba..f080d99fe7e 100644 --- a/mysql-test/suite/galera/t/MW-369.inc +++ b/mysql-test/suite/galera/t/MW-369.inc @@ -12,9 +12,9 @@ # START TRANSACTION; # $mw_369_parent_query # node_2 -# $mw_369_child_query - will be blocked on node_1 in apply monitor +# $mw_369_child_query - will be blocked on node_1 in wsrep_apply_cb # node_1: -# COMMIT; - will be blocked on node_1 in local monitor +# COMMIT; - will be blocked on node_1 in wsrep_after_certification # # The $mw_369_child_query is always expected to succeed. The caller is # responsible for checking if the final COMMIT on connection node_1 @@ -32,8 +32,7 @@ START TRANSACTION; # --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connection node_1a SET SESSION wsrep_sync_wait = 0; ---let $galera_sync_point = apply_monitor_slave_enter_sync ---source include/galera_set_sync_point.inc +SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb"; # # insert client row, which will make it impossible to replay the @@ -47,28 +46,37 @@ SET SESSION wsrep_sync_wait = 0; # block the 'COMMIT' from node_1 before it certifies. # --connection node_1a ---source include/galera_wait_sync_point.inc ---source include/galera_clear_sync_point.inc - ---let $galera_sync_point = local_monitor_master_enter_sync ---source include/galera_set_sync_point.inc +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; --connection node_1 +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; --send COMMIT # # Wait until both sync points have been reached # --connection node_1a ---let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync ---source include/galera_wait_sync_point.inc +SET SESSION DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; # # both threads are now parked in sync points, signal them to continue # ---let $galera_sync_point = apply_monitor_slave_enter_sync ---source include/galera_signal_sync_point.inc ---let $galera_sync_point = local_monitor_master_enter_sync ---source include/galera_signal_sync_point.inc ---source include/galera_clear_sync_point.inc +--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%' +--let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST +--source include/wait_condition_with_debug.inc + +SET DEBUG_SYNC = 'now SIGNAL continue_after_certification'; + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%' +--let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST +--source include/wait_condition_with_debug.inc + +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; + +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%' +--let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST +--source include/wait_condition_with_debug.inc + +SET GLOBAL DEBUG_DBUG = ""; +SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/galera/t/MW-369.test b/mysql-test/suite/galera/t/MW-369.test index c8f8c974019..0efac20dbe0 100644 --- a/mysql-test/suite/galera/t/MW-369.test +++ b/mysql-test/suite/galera/t/MW-369.test @@ -24,7 +24,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_debug_sync.inc ---source include/galera_have_debug_sync.inc CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, 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 f2187b83486..ffd2306bfb3 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,9 +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 [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +innodb-log-file-buffering [sst] ssl-mode=VERIFY_CA diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test index b36a0de57b6..940b511f752 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test @@ -37,7 +37,7 @@ UPDATE t1 SET f2 = 'c' WHERE f1 > 2; # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name --let KILL_NODE_PIDFILE = `SELECT @@pid_file` diff --git a/mysql-test/suite/galera/t/galera_load_data.test b/mysql-test/suite/galera/t/galera_load_data.test index c37920a43c4..252580f9426 100644 --- a/mysql-test/suite/galera/t/galera_load_data.test +++ b/mysql-test/suite/galera/t/galera_load_data.test @@ -30,8 +30,308 @@ CREATE TABLE cardtest_tbl ( LOCK TABLES cardtest_tbl WRITE; ALTER TABLE cardtest_tbl DISABLE KEYS; -INSERT INTO cardtest_tbl VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL); - +INSERT INTO cardtest_tbl VALUES + (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL), + (301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL); ALTER TABLE cardtest_tbl ENABLE KEYS; 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 1621414aff5..16abe6fc9ba 100644 --- a/mysql-test/suite/galera/t/galera_pc_recovery.test +++ b/mysql-test/suite/galera/t/galera_pc_recovery.test @@ -27,8 +27,8 @@ INSERT INTO t1 VALUES (1); SELECT COUNT(*) = 1 FROM t1; --let $NODE_2_PIDFILE = `SELECT @@pid_file` ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --exec kill -9 `cat $NODE_1_PIDFILE` `cat $NODE_2_PIDFILE` # Perform --wsrep-recover and preserve the positions into variables by placing them in $MYSQL_TMP_DIR/galera_wsrep_start_position.inc and then --source'ing it @@ -66,8 +66,8 @@ if ($galera_wsrep_start_position2 == '') { # Instruct MTR to perform the actual restart using --wsrep-start-position . Proper --wsrep_cluster_address is used as my.cnf only contains 'gcomm://' for node #1 ---exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position1 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---exec echo "restart: --wsrep-start-position=$galera_wsrep_start_position2 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line "restart: --wsrep-start-position=$galera_wsrep_start_position1 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart: --wsrep-start-position=$galera_wsrep_start_position2 --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1,127.0.0.1:$NODE_GALERAPORT_2" $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --sleep 5 --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test index 6a0f24dbaae..e3a8b749cb4 100644 --- a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test +++ b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test @@ -62,7 +62,7 @@ SELECT * FROM t1; --let $start_mysqld_params=--galera-unknown-option --echo Starting server ... ---exec echo "try:$start_mysqld_params" > $_expect_file_name +--write_line "try:$start_mysqld_params" $_expect_file_name # Sleep to ensure that server exited... @@ -107,7 +107,7 @@ SELECT * FROM t1; --let $start_mysqld_params=--galera-unknown-option --echo Starting server ... ---exec echo "try:$start_mysqld_params" > $_expect_file_name +--write_line "try:$start_mysqld_params" $_expect_file_name # Sleep to ensure that server exited... diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 857a4101406..6cb80831d1f 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -7,9 +7,14 @@ wsrep_debug=1 [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +innodb_fast_shutdown=0 +innodb_undo_tablespaces=0 [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +innodb_fast_shutdown=0 +innodb_undo_tablespaces=3 +innodb_log_file_buffering [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.test b/mysql-test/suite/galera/t/galera_sst_mariabackup.test index bcb9ade3a25..96f8b4dca55 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.test @@ -1,6 +1,5 @@ --source include/big_test.inc --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_mariabackup.inc # Save original auto_increment_offset values. @@ -8,12 +7,39 @@ --let $node_2=node_2 --source include/auto_increment_offset_save.inc +--connection node_1 +select @@innodb_undo_tablespaces; + +--connection node_2 +select @@innodb_undo_tablespaces; + --source suite/galera/include/galera_st_shutdown_slave.inc --source suite/galera/include/galera_st_clean_slave.inc --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc +--connection node_2 +--echo Shutting down server ... +--source include/shutdown_mysqld.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 +--echo Starting server ... +--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 + +--connection node_2 +select @@innodb_undo_tablespaces; + +call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=3 because previous shutdown was not with innodb_fast_shutdown=0"); + # Restore original auto_increment_offset values. --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_table_with_hyphen.inc b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc new file mode 100644 index 00000000000..ac79d864e82 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc @@ -0,0 +1,48 @@ +# +# parameters: +# $fk_child - child table name +# $fk_parent - parent table name +# +--connection node_1 +SET GLOBAL wsrep_slave_threads=2; + +--eval CREATE TABLE `$fk_parent` ( id INT AUTO_INCREMENT PRIMARY KEY, j INT) ENGINE=InnoDB + +--eval CREATE TABLE `$fk_child` (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, j INT, FOREIGN KEY (parent_id) REFERENCES `$fk_parent`(id)) ENGINE=InnoDB + +--eval INSERT INTO `$fk_parent` VALUES (23,0) + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM `$fk_parent`; +--source include/wait_condition.inc + +--connection node_1a +SET GLOBAL DEBUG_DBUG='+d,wsrep_ha_write_row'; + +--connection node_2 +--eval INSERT INTO `$fk_child` VALUES (21,23,0),(22,23,0),(23,23,0) + +--connection node_1a +SET DEBUG_SYNC='now WAIT_FOR wsrep_ha_write_row_reached'; + +--let $wsrep_received_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_received'` + +--connection node_2 +--eval UPDATE `$fk_parent` SET j=2 WHERE id=23 + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_received_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_received' +--source include/wait_condition.inc + +SET GLOBAL DEBUG_DBUG='-d,wsrep_ha_write_row'; +SET DEBUG_SYNC='now SIGNAL wsrep_ha_write_row_continue'; + +SET GLOBAL DEBUG_DBUG="RESET"; +SET DEBUG_SYNC = 'RESET'; + +SET GLOBAL wsrep_slave_threads=DEFAULT; + +--connection node_2 +--eval drop table `$fk_child` +--eval drop table `$fk_parent` + diff --git a/mysql-test/suite/galera/t/galera_table_with_hyphen.test b/mysql-test/suite/galera/t/galera_table_with_hyphen.test new file mode 100644 index 00000000000..1b28bdeb3ca --- /dev/null +++ b/mysql-test/suite/galera/t/galera_table_with_hyphen.test @@ -0,0 +1,34 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +# +# Testing how tables and databases with special characters +# are treated in certification +# +# The test creates two tables having foreign key constraint +# reference and executes two transactions which modify +# same rows. The same test is executed with different names +# containin special characters to see if the certification +# can detect the conflicts +# +# Actual test is in include file galera_table_with_hyphen.inc +# It create the test tables from parameters $fk_child and +# $fk_parent +# +--connection node_1 +set wsrep_sync_wait=0; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait = 0; + +--let $fk_child = child +--let $fk_parent = par-ent + +--source galera_table_with_hyphen.inc + +--let $fk_child = c-hild +--let $fk_parent = p-arent- + +--source galera_table_with_hyphen.inc diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf index 022cfcdc0b0..b2cba42c0bd 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.cnf @@ -2,9 +2,3 @@ [mysqld] wsrep-ignore-apply-errors=0 - -[mysqld.3] -auto_increment_offset=3 - -[mysqld.4] -auto_increment_offset=4 diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test index 5e74af4ab2e..e21c271cba0 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -6,25 +6,15 @@ --source include/galera_cluster.inc --source include/big_test.inc -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc -# The following has to be set hard as these connection doesn't yet exists and -# the auto_increment_offset value changes during the lifetime of the servers. ---let $node_3=node_3 ---let $auto_increment_offset_node_3 = 3; ---let $node_4=node_4 ---let $auto_increment_offset_node_4 = 4; - --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +# Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 --let $node_3=node_3 --let $node_4=node_4 ---source suite/galera/include/auto_increment_offset_save.inc +--source include/auto_increment_offset_save.inc --connection node_3 # Isolate node #3 @@ -92,6 +82,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Unknown table"); --connection node_3 SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster."); --connection node_4 SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; @@ -105,3 +96,6 @@ DROP TABLE t2; --let $node_4=node_4 --let $auto_increment_offset_node_4 = 4; --source suite/galera/include/auto_increment_offset_restore.inc + +--disconnect node_3 +--disconnect node_4 diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.test b/mysql-test/suite/galera/t/galera_wan_restart_sst.test index 7a8c0df4946..e904f46c06a 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.test @@ -11,6 +11,7 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 @@ -27,7 +28,7 @@ SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1); --connection node_2 @@ -45,10 +46,20 @@ INSERT INTO t1 VALUES (4); --connection node_3 INSERT INTO t1 VALUES (13); - ---source include/kill_galera.inc +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc --connection node_1 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_3 +--source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (11); --connection node_2 @@ -62,6 +73,10 @@ INSERT INTO t1 VALUES (14); INSERT INTO t1 VALUES (131); +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + # # Restart node #2 # @@ -69,9 +84,17 @@ INSERT INTO t1 VALUES (131); --connection node_2 INSERT INTO t1 VALUES (22); +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; +--source include/wait_condition.inc + +--connection node_2 --source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (21); --connection node_3 @@ -90,11 +113,21 @@ INSERT INTO t1 VALUES (221); # --connection node_4 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (34); +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 15 FROM t1; +--source include/wait_condition.inc + +--connection node_4 --source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (31); --connection node_2 @@ -105,6 +138,7 @@ INSERT INTO t1 VALUES (33); --connection node_4 --source include/start_mysqld.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat INSERT INTO t1 VALUES (341); diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test index 94ea008cb16..cfa5f8bcead 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test +++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.test @@ -30,7 +30,7 @@ --echo Starting server ... --let $restart_noprint=2 ---let $start_mysqld_params="--wsrep-new-cluster" +--let $start_mysqld_params=--wsrep-new-cluster --source include/start_mysqld.inc --source include/wait_until_ready.inc diff --git a/mysql-test/suite/galera/t/mdev-22063.test b/mysql-test/suite/galera/t/mdev-22063.test index 6a8f1ffa6ce..d0f3e3bc4b4 100644 --- a/mysql-test/suite/galera/t/mdev-22063.test +++ b/mysql-test/suite/galera/t/mdev-22063.test @@ -79,8 +79,6 @@ INSERT INTO t3(id) SELECT seq FROM seq_1_to_1000; REPLACE INTO t4 SELECT * FROM t1; REPLACE INTO t5 SELECT * FROM t2; -# For some reason Aria storage engine does register_ha ---error ER_ERROR_DURING_COMMIT REPLACE INTO t6 SELECT * FROM t3; REPLACE INTO t7 SELECT * FROM t2; REPLACE INTO t8 SELECT * FROM t3; @@ -90,7 +88,7 @@ SELECT COUNT(*) AS EXPECT_1000 FROM t2; SELECT COUNT(*) AS EXPECT_1000 FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t4; SELECT COUNT(*) AS EXPECT_1000 FROM t5; -SELECT COUNT(*) AS EXPECT_0 FROM t6; +SELECT COUNT(*) AS EXPECT_1000 FROM t6; SELECT COUNT(*) AS EXPECT_1000 FROM t7; SELECT COUNT(*) AS EXPECT_1000 FROM t8; @@ -105,7 +103,7 @@ SELECT COUNT(*) AS EXPECT_1000 FROM t2; SELECT COUNT(*) AS EXPECT_1000 FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t4; SELECT COUNT(*) AS EXPECT_1000 FROM t5; -SELECT COUNT(*) AS EXPECT_0 FROM t6; +SELECT COUNT(*) AS EXPECT_1000 FROM t6; SELECT COUNT(*) AS EXPECT_1000 FROM t7; SELECT COUNT(*) AS EXPECT_1000 FROM t8; @@ -129,8 +127,6 @@ INSERT INTO t3(id) SELECT seq FROM seq_1_to_1000; INSERT INTO t4 SELECT * FROM t1; INSERT INTO t5 SELECT * FROM t2; -# For some reason Aria storage engine does register_ha ---error ER_ERROR_DURING_COMMIT INSERT INTO t6 SELECT * FROM t3; INSERT INTO t7 SELECT * FROM t2; INSERT INTO t8 SELECT * FROM t3; @@ -140,7 +136,7 @@ SELECT COUNT(*) AS EXPECT_1000 FROM t2; SELECT COUNT(*) AS EXPECT_1000 FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t4; SELECT COUNT(*) AS EXPECT_1000 FROM t5; -SELECT COUNT(*) AS EXPECT_0 FROM t6; +SELECT COUNT(*) AS EXPECT_1000 FROM t6; SELECT COUNT(*) AS EXPECT_1000 FROM t7; SELECT COUNT(*) AS EXPECT_1000 FROM t8; @@ -155,7 +151,7 @@ SELECT COUNT(*) AS EXPECT_1000 FROM t2; SELECT COUNT(*) AS EXPECT_1000 FROM t3; SELECT COUNT(*) AS EXPECT_1000 FROM t4; SELECT COUNT(*) AS EXPECT_1000 FROM t5; -SELECT COUNT(*) AS EXPECT_0 FROM t6; +SELECT COUNT(*) AS EXPECT_1000 FROM t6; SELECT COUNT(*) AS EXPECT_1000 FROM t7; SELECT COUNT(*) AS EXPECT_1000 FROM t8; diff --git a/mysql-test/suite/galera/t/mdev-22543.test b/mysql-test/suite/galera/t/mdev-22543.test index 1e7d3712639..26257b28814 100644 --- a/mysql-test/suite/galera/t/mdev-22543.test +++ b/mysql-test/suite/galera/t/mdev-22543.test @@ -36,7 +36,7 @@ SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached"; # Restart without waiting. The UPDATE should block FTWRL on node_1, # so the SST cannot be completed and node_2 cannot join before # UPDATE connection is signalled to continue. ---exec echo "restart:$start_mysqld_params" > $_expect_file_name +--write_line "restart:$start_mysqld_params" $_expect_file_name # If the bug is present, FTWRL times out on node_1 in couple of # seconds and node_2 fails to join. --sleep 10 diff --git a/mysql-test/suite/galera/t/mdev-30013.test b/mysql-test/suite/galera/t/mdev-30013.test index 038b66600ce..3795dd32306 100644 --- a/mysql-test/suite/galera/t/mdev-30013.test +++ b/mysql-test/suite/galera/t/mdev-30013.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/force_restart.inc # ARCHIVE plugin must be uninstalled if (!$HA_ARCHIVE_SO) { skip Needs Archive loadable plugin; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#332.test b/mysql-test/suite/galera/t/mysql-wsrep#332.test index e216dfe79d4..464156e832e 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#332.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#332.test @@ -3,7 +3,7 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc -# Open connection node_1a here, MW-369.inc will use it later +# Open connection node_1a here, will use it later --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 # @@ -27,7 +27,42 @@ INSERT INTO c VALUES (2, 2); --let $mw_369_parent_query = UPDATE p SET f1 = f1 + 100 --let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1) ---source MW-369.inc +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; +--eval $mw_369_parent_query + +# +# Block the $mw_369_child_query from node_2 +# +# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# insert client row, which will make it impossible to replay the +# delete on parent +# +--connection node_2 +--eval $mw_369_child_query + +# +# Wait until $mw_369_child_query from node_2 reaches the sync point and +# block the 'COMMIT' from node_1 before it certifies. +# +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc # Expect certification failure --connection node_1 @@ -62,7 +97,42 @@ INSERT INTO c VALUES (2, 2, 2); --let $mw_369_parent_query = UPDATE p1 SET f1 = f1 + 100 --let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1) ---source MW-369.inc +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; +--eval $mw_369_parent_query + +# +# Block the $mw_369_child_query from node_2 +# +# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# insert client row, which will make it impossible to replay the +# delete on parent +# +--connection node_2 +--eval $mw_369_child_query + +# +# Wait until $mw_369_child_query from node_2 reaches the sync point and +# block the 'COMMIT' from node_1 before it certifies. +# +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc # Expect certification failure --connection node_1 @@ -96,7 +166,42 @@ INSERT INTO c VALUES (2, 2, 2); --let $mw_369_parent_query = UPDATE p2 SET f1 = f1 + 100 --let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1) ---source MW-369.inc +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; +--eval $mw_369_parent_query + +# +# Block the $mw_369_child_query from node_2 +# +# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# insert client row, which will make it impossible to replay the +# delete on parent +# +--connection node_2 +--eval $mw_369_child_query + +# +# Wait until $mw_369_child_query from node_2 reaches the sync point and +# block the 'COMMIT' from node_1 before it certifies. +# +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc # Expect certification failure --connection node_1 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 52fd3093931..ebe1d47f200 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 +1,10 @@ !include ../galera_2nodes_as_master.cnf + +[mysqld.1] +innodb-log-file-buffering + +[mysqld.2] +innodb-log-file-buffering + +[mysqld.3] +innodb-log-file-buffering diff --git a/mysql-test/suite/galera/t/versioning_trx_id.test b/mysql-test/suite/galera/t/versioning_trx_id.test index 017379c32c4..fc9ea18eeb4 100644 --- a/mysql-test/suite/galera/t/versioning_trx_id.test +++ b/mysql-test/suite/galera/t/versioning_trx_id.test @@ -13,29 +13,29 @@ set session wsrep_sync_wait=15; insert into t1 (a) values (3),(4); select a from t1; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; -if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { +if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) { select * from mysql.transaction_registry; } -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; --connection node_3 set session wsrep_sync_wait=15; insert into t1 (a) values (5),(6); select a from t1; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; -if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { +if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) { select * from mysql.transaction_registry; } -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; --connection node_1 set session wsrep_sync_wait=15; select a from t1; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; -if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { +if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) { select * from mysql.transaction_registry; } -select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; +select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp; drop table t1; diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 728500f45fc..f71f726c4f9 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -19,3 +19,4 @@ galera_ipv6_mariabackup_section : temporarily disabled at the request of Codersh # 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 diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result index 371ce006dd3..55513ff53af 100644 --- a/mysql-test/suite/galera_3nodes/r/MDEV-29171.result +++ b/mysql-test/suite/galera_3nodes/r/MDEV-29171.result @@ -19,20 +19,40 @@ connection node_2; connection node_1; connection node_1; # restart: --wsrep_new_cluster --wsrep_gtid_domain_id=200 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +VARIABLE_VALUE +Primary +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE +Synced show variables like 'wsrep_gtid_domain_id'; Variable_name Value wsrep_gtid_domain_id 200 connection node_2; # restart +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +VARIABLE_VALUE +Primary +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE +Synced show variables like 'wsrep_gtid_domain_id'; Variable_name Value wsrep_gtid_domain_id 200 +connection node_1; connection node_3; # restart: --wsrep_sst_donor=node2 +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +VARIABLE_VALUE +Primary +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +VARIABLE_VALUE +Synced show variables like 'wsrep_gtid_domain_id'; Variable_name Value wsrep_gtid_domain_id 200 connection node_1; +connection node_1; set global wsrep_gtid_domain_id=100; connection node_2; set global wsrep_gtid_domain_id=100; diff --git a/mysql-test/suite/galera_3nodes/r/galera_allowlist.result b/mysql-test/suite/galera_3nodes/r/galera_allowlist.result index 471444d8c08..a3fb6cf7db5 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_allowlist.result +++ b/mysql-test/suite/galera_3nodes/r/galera_allowlist.result @@ -7,6 +7,9 @@ connection node_2; SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; COUNT(*) = 3 1 +connection node_1; +connection node_2; +connection node_3; connection node_3; SET @@global.wsrep_desync = 1; SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test index bfb7abf9a8b..1ce33bee974 100644 --- a/mysql-test/suite/galera_3nodes/t/MDEV-29171.test +++ b/mysql-test/suite/galera_3nodes/t/MDEV-29171.test @@ -50,6 +50,16 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name; --connection node_1 --let $restart_parameters = --wsrep_new_cluster --wsrep_gtid_domain_id=200 --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 + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; show variables like 'wsrep_gtid_domain_id'; # @@ -59,8 +69,21 @@ show variables like 'wsrep_gtid_domain_id'; --let $restart_parameters = --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 + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; show variables like 'wsrep_gtid_domain_id'; +--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 # # Restart node_3, select node_2 as donor @@ -70,9 +93,23 @@ show variables like 'wsrep_gtid_domain_id'; --let $restart_parameters = --wsrep_sst_donor="node2" --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 + +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; + # Expect domain id 200 show variables like 'wsrep_gtid_domain_id'; +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc # # Cleanup diff --git a/mysql-test/suite/galera_3nodes/t/galera_allowlist.test b/mysql-test/suite/galera_3nodes/t/galera_allowlist.test index 74fff61c4f8..de80965a584 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_allowlist.test +++ b/mysql-test/suite/galera_3nodes/t/galera_allowlist.test @@ -12,6 +12,12 @@ SELECT COUNT(*) = 3 FROM mysql.wsrep_allowlist; --let $galera_server_number = 3 --source include/galera_connect.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + --connection node_3 # Desync and disconnect node 3 from the PC: SET @@global.wsrep_desync = 1; @@ -64,3 +70,6 @@ CALL mtr.add_suppression('WSREP: Connection not allowed'); --connection node_3 CALL mtr.add_suppression('WSREP: Ignoring lack of quorum'); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc 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 5bd03178d1f..c27490faf36 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_consistency.cnf @@ -33,3 +33,6 @@ log_slave_updates=ON log_bin=mariadb-bin-log binlog-format=row wsrep-gtid-mode=ON + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result index eeccfa3b5a3..8fc853f8425 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result @@ -25,6 +25,8 @@ SET SESSION wsrep_sync_wait=0; connection node_2; INSERT INTO t1 VALUES (2); ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2a; +connection node_2; COMMIT; ERROR 08S01: WSREP has not yet prepared node for application use connection node_2a; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result index 9043c66840d..ef21e4ca347 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result @@ -6,20 +6,26 @@ connection node_2; connection node_3; connection node_2; SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; -CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 VARCHAR(30) not null primary key) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; SET SESSION wsrep_trx_fragment_size=1; START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('primary1'),('primary2'),('primary3'),('primary4'),('primary5'); COMMIT; Got one of the listed errors +connection node_1; +connection node_2; # restart connection node_1; SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; COUNT(*) = 0 1 +SELECT * FROM t1; +f1 connection node_2; SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; COUNT(*) = 0 1 +SELECT * FROM t1; +f1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result index ef2bd7a45e1..08e3fc6c3e3 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result @@ -44,6 +44,7 @@ connection node_2; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 +call mtr.add_suppression("WSREP: node uuid:.*"); connection node_1; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test index ba85aa5291c..20d5955e4fc 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test @@ -27,6 +27,12 @@ SET SESSION wsrep_sync_wait=0; --connection node_2 --error ER_LOCK_DEADLOCK INSERT INTO t1 VALUES (2); + +--connection node_2a +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_2 --error ER_UNKNOWN_COM_ERROR COMMIT; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index 5da080a6c2c..700b3c38b6b 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -4,6 +4,7 @@ # --source include/galera_cluster.inc --source include/have_debug_sync.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -13,30 +14,42 @@ --source ../galera/include/auto_increment_offset_save.inc --connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo "wait" > $_expect_file_name +--write_line wait $_expect_file_name -CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 VARCHAR(30) not null primary key) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; SET SESSION wsrep_trx_fragment_size=1; START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('primary1'),('primary2'),('primary3'),('primary4'),('primary5'); --error 2013,2026 COMMIT; +--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 + +--connection node_2 --source include/start_mysqld.inc --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT * FROM t1; --connection node_2 --enable_reconnect SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index 355db2de456..58d744e704d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -6,6 +6,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -86,6 +87,8 @@ SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +# As noted above sometimes node delivers the same view twice +call mtr.add_suppression("WSREP: node uuid:.*"); --connection node_1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result new file mode 100644 index 00000000000..a1495f1c138 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result @@ -0,0 +1,33 @@ +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, f2 INTEGER); +INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1); +SET SESSION wsrep_trx_fragment_size=10; +SET SESSION wsrep_trx_fragment_unit='rows'; +START TRANSACTION; +UPDATE t1 SET f2 = f2 + 10; +connection node_2; +INSERT INTO t1 VALUES (10,2); +connection node_1a; +connection node_1; +INSERT INTO t1 VALUES (9,1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1(f1 INTEGER PRIMARY KEY, f2 INTEGER); +INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1); +SET SESSION wsrep_trx_fragment_size=5; +SET SESSION wsrep_trx_fragment_unit='rows'; +START TRANSACTION; +UPDATE t1 SET f2 = f2 + 10; +connection node_2; +INSERT INTO t1 VALUES (10,2); +connection node_1a; +connection node_1; +INSERT INTO t1 VALUES (9,1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-25718.test b/mysql-test/suite/galera_sr/t/MDEV-25718.test index 9aebbdc7c5c..037cd300709 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-25718.test +++ b/mysql-test/suite/galera_sr/t/MDEV-25718.test @@ -43,8 +43,9 @@ SET SESSION wsrep_sync_wait = 0; SET debug_sync = "now SIGNAL write_row_continue"; # Let's give the INSERT some time, to make sure it does rollback ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = "INSERT INTO t1 VALUES (1)" AND STATE = "Freeing items"; ---source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = "INSERT INTO t1 VALUES (1)" AND (STATE = "Freeing items" OR STATE = 'Rollback'); +--let $wait_condition_on_error_output = SELECT INFO, STATE FROM INFORMATION_SCHEMA.PROCESSLIST +--source include/wait_condition_with_debug.inc # Resume the DDL in streaming_rollback SET SESSION debug_sync = "now SIGNAL wsrep_streaming_rollback_continue"; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test new file mode 100644 index 00000000000..66259b790cc --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test @@ -0,0 +1,68 @@ +# +# Test BF abort for idle SR transactions +# + +--source include/galera_cluster.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +# +# Case 1: BF abort idle SR transaction that has not yet replicated any fragments +# +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER); +INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1); + +--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + +SET SESSION wsrep_trx_fragment_size=10; +SET SESSION wsrep_trx_fragment_unit='rows'; +START TRANSACTION; +UPDATE t1 SET f2 = f2 + 10; + +--connection node_2 +INSERT INTO t1 VALUES (10,2); + +# Wait for SR transaction to be BF aborted +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts' +--source include/wait_condition.inc + + +--connection node_1 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (9,1); +ROLLBACK; + +DROP TABLE t1; + + +# +# Case 2: BF abort idle SR transaction that has already replicated a fragment +# +--connection node_1 +CREATE TABLE t1(f1 INTEGER PRIMARY KEY, f2 INTEGER); +INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1); + +--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` + + +SET SESSION wsrep_trx_fragment_size=5; +SET SESSION wsrep_trx_fragment_unit='rows'; +START TRANSACTION; +UPDATE t1 SET f2 = f2 + 10; + +--connection node_2 +INSERT INTO t1 VALUES (10,2); + +# Wait for SR transaction to be BF aborted +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts' +--source include/wait_condition.inc + +--connection node_1 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (9,1); +ROLLBACK; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test index 5332b1a1579..f6f50fd50c9 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test @@ -38,12 +38,12 @@ SET SESSION wsrep_sync_wait = 0; --source include/kill_galera.inc --remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat ---let $start_mysqld_params = "--wsrep-new-cluster" +--let $start_mysqld_params =--wsrep-new-cluster --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/start_mysqld.inc --connection node_2 ---let $start_mysqld_params = "" +--let $start_mysqld_params = --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc diff --git a/mysql-test/suite/gcol/inc/innodb_v_large_col.inc b/mysql-test/suite/gcol/inc/innodb_v_large_col.inc index 70e188635fa..8ba6920fea4 100644 --- a/mysql-test/suite/gcol/inc/innodb_v_large_col.inc +++ b/mysql-test/suite/gcol/inc/innodb_v_large_col.inc @@ -1,5 +1,3 @@ ---source include/have_innodb.inc - eval CREATE TABLE `t` ( `a` VARCHAR(10000), `b` VARCHAR(3000), `c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc index 68f34978f23..2431d207c3d 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_delete.inc @@ -5,9 +5,6 @@ # "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;" # ---source include/have_innodb.inc ---source include/have_innodb_16k.inc - # turn on flags --disable_query_log SET GLOBAL innodb_monitor_enable=index_page_merge_attempts; diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc index d49272c4087..2ffe1085ccf 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_secondary.inc @@ -6,9 +6,6 @@ # "create index index1 on tab1(b(750));" # ---source include/have_innodb.inc ---source include/have_innodb_16k.inc - # turn on flags --disable_query_log SET GLOBAL innodb_monitor_enable=index_page_merge_attempts; diff --git a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc index ae720e0488d..a7537d60ee2 100644 --- a/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc +++ b/mysql-test/suite/innodb/include/innodb_merge_threshold_update.inc @@ -5,9 +5,6 @@ # "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;" # ---source include/have_innodb.inc ---source include/have_innodb_16k.inc - # turn on flags --disable_query_log SET GLOBAL innodb_monitor_enable=index_page_merge_attempts; diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result index c4469a8c322..af23efe9790 100644 --- a/mysql-test/suite/innodb/r/alter_kill.result +++ b/mysql-test/suite/innodb/r/alter_kill.result @@ -1,3 +1,7 @@ +SELECT @@innodb_doublewrite; +@@innodb_doublewrite +OFF +SET GLOBAL innodb_doublewrite=fast; # # Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP # @@ -12,7 +16,10 @@ connection default; disconnect con1; # Corrupt FIL_PAGE_TYPE in bug16720368.ibd, # and recompute innodb_checksum_algorithm=crc32 -# restart +# restart: --innodb-flush-method=O_DIRECT +SELECT @@innodb_doublewrite; +@@innodb_doublewrite +OFF SELECT COUNT(*) FROM bug16720368; ERROR HY000: Table `test`.`bug16720368` is corrupted. Please drop the table and recreate. INSERT INTO bug16720368 VALUES(1); diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff index 01db97e59f8..7c32d38a1d9 100644 --- a/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff +++ b/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff @@ -1,42 +1,79 @@ -7,8c7,8 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -21,22c21,22 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -35,36c35,36 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -49,50c49,50 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -63,64c63,64 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -77,78c77,78 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 -98,99c98,99 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 +--- alter_not_null.result ++++ alter_not_null,COPY,NON-STRICT.result~ +@@ -4,8 +4,8 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'f1' at row 1 + SELECT * FROM t1; +@@ -18,8 +18,8 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'f1' at row 1 + SELECT * FROM t1; +@@ -32,8 +32,8 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'f1' at row 1 + SELECT * FROM t1; +@@ -46,8 +46,8 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'f1' at row 1 + SELECT * FROM t1; +@@ -60,8 +60,8 @@ + f1 f2 f3 + 2 2 NULL + ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'f3' at row 1 + SELECT * FROM t1; +@@ -74,8 +74,8 @@ + f1 b + 10 NULL + ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'b' at row 1 + SELECT * FROM t1; +@@ -95,8 +95,8 @@ + CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; + INSERT INTO t1 VALUES(1, NULL); + ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'c2' at row 1 + SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff index e02d235cb72..37e97169a11 100644 --- a/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff +++ b/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff @@ -1,72 +1,109 @@ -7,10c7 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -13c10 -< 0 ---- -> NULL -21,24c18 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -27c21 -< ---- -> NULL -35,38c29 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -41c32 -< ---- -> NULL -49,52c40 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -55c43 -< ---- -> NULL -63,66c51 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f3' at row 1 ---- -> ERROR 01000: Data truncated for column 'f3' at row 1 -69c54 -< 2 2 0 ---- -> 2 2 NULL -77,80c62 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'b' at row 1 ---- -> ERROR 01000: Data truncated for column 'b' at row 1 -83c65 -< 10 0 ---- -> 10 NULL -98,99c80,81 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 ---- -> affected rows: 1 -> info: Records: 1 Duplicates: 0 Warnings: 1 +--- alter_not_null.result ++++ alter_not_null,COPY,STRICT.result~ +@@ -4,13 +4,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +-0 ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -18,13 +15,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -32,13 +26,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -46,13 +37,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; + INSERT INTO t1 VALUES(2, 2, NULL); +@@ -60,13 +48,10 @@ + f1 f2 f3 + 2 2 NULL + ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f3' at row 1 ++ERROR 01000: Data truncated for column 'f3' at row 1 + SELECT * FROM t1; + f1 f2 f3 +-2 2 0 ++2 2 NULL + DROP TABLE t1; + CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; + INSERT INTO t1 VALUES(10, NULL); +@@ -74,13 +59,10 @@ + f1 b + 10 NULL + ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'b' at row 1 ++ERROR 01000: Data truncated for column 'b' at row 1 + SELECT * FROM t1; + f1 b +-10 0 ++10 NULL + DROP TABLE t1; + CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; + ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; +@@ -95,8 +77,8 @@ + CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; + INSERT INTO t1 VALUES(1, NULL); + ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 ++affected rows: 1 ++info: Records: 1 Duplicates: 0 Warnings: 1 + Warnings: + Warning 1265 Data truncated for column 'c2' at row 1 + SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff index ec97b174bdf..555f4cdb1df 100644 --- a/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff +++ b/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff @@ -1,66 +1,98 @@ -7,10c7 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -13c10 -< 0 ---- -> NULL -21,24c18 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -27c21 -< ---- -> NULL -35,38c29 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -41c32 -< ---- -> NULL -49,52c40 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f1' at row 1 ---- -> ERROR 01000: Data truncated for column 'f1' at row 1 -55c43 -< ---- -> NULL -63,66c51 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'f3' at row 1 ---- -> ERROR 01000: Data truncated for column 'f3' at row 1 -69c54 -< 2 2 0 ---- -> 2 2 NULL -77,80c62 -< affected rows: 0 -< info: Records: 0 Duplicates: 0 Warnings: 1 -< Warnings: -< Warning 1265 Data truncated for column 'b' at row 1 ---- -> ERROR 01000: Data truncated for column 'b' at row 1 -83c65 -< 10 0 ---- -> 10 NULL +--- alter_not_null.result ++++ alter_not_null,INPLACE,STRICT.result~ +@@ -4,13 +4,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +-0 ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -18,13 +15,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -32,13 +26,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; + INSERT INTO t1 VALUES(NULL); +@@ -46,13 +37,10 @@ + f1 + NULL + ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f1' at row 1 ++ERROR 01000: Data truncated for column 'f1' at row 1 + SELECT * FROM t1; + f1 +- ++NULL + DROP TABLE t1; + CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; + INSERT INTO t1 VALUES(2, 2, NULL); +@@ -60,13 +48,10 @@ + f1 f2 f3 + 2 2 NULL + ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'f3' at row 1 ++ERROR 01000: Data truncated for column 'f3' at row 1 + SELECT * FROM t1; + f1 f2 f3 +-2 2 0 ++2 2 NULL + DROP TABLE t1; + CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; + INSERT INTO t1 VALUES(10, NULL); +@@ -74,13 +59,10 @@ + f1 b + 10 NULL + ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 1 +-Warnings: +-Warning 1265 Data truncated for column 'b' at row 1 ++ERROR 01000: Data truncated for column 'b' at row 1 + SELECT * FROM t1; + f1 b +-10 0 ++10 NULL + DROP TABLE t1; + CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; + ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff index b19abb449ad..ad1f3a447c2 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff @@ -14,7 +14,7 @@ -# bytes: 65536 +# bytes: 131072 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; --# bytes: 4194304 +-# bytes: 2097152 -DROP TABLE t1; -CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff index a1011a1cb90..1412df393ff 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff @@ -13,7 +13,7 @@ -# bytes: 65536 +# bytes: 16384 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; - # bytes: 4194304 + # bytes: 2097152 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff index 010eb8a284d..156925597ab 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff @@ -14,7 +14,7 @@ -# bytes: 65536 +# bytes: 262144 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; --# bytes: 4194304 +-# bytes: 2097152 -DROP TABLE t1; -CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff index 0e1e64724b0..55cf59737d3 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff @@ -13,7 +13,7 @@ -# bytes: 65536 +# bytes: 32768 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; - # bytes: 4194304 + # bytes: 2097152 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize.result b/mysql-test/suite/innodb/r/check_ibd_filesize.result index 0d224d6ac5f..b0f376183ea 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize.result +++ b/mysql-test/suite/innodb/r/check_ibd_filesize.result @@ -10,7 +10,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; # bytes: 65536 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; -# bytes: 4194304 +# bytes: 2097152 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; diff --git a/mysql-test/suite/innodb/r/cursor-restore-unique-null.result b/mysql-test/suite/innodb/r/cursor-restore-unique-null.result new file mode 100644 index 00000000000..29edc47a483 --- /dev/null +++ b/mysql-test/suite/innodb/r/cursor-restore-unique-null.result @@ -0,0 +1,24 @@ +CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `b_c` (`b`,`c`)) +ENGINE=InnoDB, STATS_PERSISTENT=0; +INSERT INTO t SET a = 1, c = 2; +connect con1,localhost,root; +BEGIN; +INSERT INTO t SET a=2, c=2; +connection default; +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL select_locked"; +SELECT * FROM t FORCE INDEX(b) FOR UPDATE; +connection con1; +SET DEBUG_SYNC="now WAIT_FOR select_locked"; +ROLLBACK; +connection default; +# If the bug is not fixed, and the both unique index key fields are +# NULL, there will be two (1, NULL, 2) rows in the result, +# because cursor will be restored to (NULL, 2, 1) position for +# secondary key instead of "supremum". +a b c +1 NULL 2 +COMMIT; +SET DEBUG_SYNC="RESET"; +disconnect con1; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/index_length.result b/mysql-test/suite/innodb/r/index_length.result index cc92780ac32..e0d6a735bb4 100644 --- a/mysql-test/suite/innodb/r/index_length.result +++ b/mysql-test/suite/innodb/r/index_length.result @@ -20,4 +20,12 @@ FLOOR(index_length/@@innodb_page_size) 2 disconnect stop_purge; DROP TABLE t1; +# +# MDEV-22855 Assertion (!field->prefix_len || +# field->fixed_len == field->prefix_len) +# failed in btr_node_ptr_max_size +# +CREATE TABLE t1(c CHAR(194) CHARACTER SET UTF32, KEY k1(c(193)))ENGINE=InnoDB; +INSERT INTO t1 SET c=''; +DROP TABLE t1; # End of 10.4 tests diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result index c55b4a3ddd5..fd33581ffab 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-debug.result +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -108,11 +108,11 @@ DROP TABLE t; # MDEV-26772 InnoDB DDL fails with DUPLICATE KEY error # create table t1(f1 int not null primary key, -f2 int not null, index idx(f2))engine=innodb; +f2 int not null, index idx(f2), index i(f2,f1))engine=innodb; insert into t1 values(1, 1); connect con1,localhost,root,,,; SET DEBUG_SYNC='before_delete_table_stats SIGNAL blocked WAIT_FOR go'; -SET innodb_lock_wait_timeout=0; +SET STATEMENT innodb_lock_wait_timeout=0 FOR ALTER TABLE t1 FORCE, ALGORITHM=COPY; connection default; SET DEBUG_SYNC='now WAIT_FOR blocked'; @@ -124,6 +124,17 @@ connection con1; connection default; COMMIT; SET DEBUG_SYNC=RESET; +RENAME TABLE mysql.innodb_table_stats TO mysql.innodb_table_stats_hidden; +connection con1; +SET DEBUG_SYNC='innodb_commit_inplace_before_lock SIGNAL blocked WAIT_FOR go'; +ALTER TABLE t1 DROP INDEX i; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +RENAME TABLE mysql.innodb_table_stats_hidden TO mysql.innodb_table_stats; +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +connection default; +SET DEBUG_SYNC=RESET; connection con1; ALTER TABLE t1 RENAME KEY idx TO idx1, ALGORITHM=COPY; disconnect con1; diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff b/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff deleted file mode 100644 index bb902e18931..00000000000 --- a/mysql-test/suite/innodb/r/innodb-wl5522,crc32.rdiff +++ /dev/null @@ -1,5 +0,0 @@ -120,121c120 -< Warnings: -< Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification ---- -> ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff b/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff index bb902e18931..283bbe96aae 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff +++ b/mysql-test/suite/innodb/r/innodb-wl5522,strict_crc32.rdiff @@ -1,5 +1,12 @@ -120,121c120 -< Warnings: -< Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification ---- -> ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.) +--- innodb-wl5522.result ++++ innodb-wl5522,strict_crc32.result~ +@@ -131,8 +131,7 @@ + ALTER TABLE t2 IMPORT TABLESPACE; + ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT) + ALTER TABLE t2 IMPORT TABLESPACE; +-Warnings: +-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification ++ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.) + DROP TABLE t2; + SET GLOBAL innodb_file_per_table = 1; + SELECT @@innodb_file_per_table; diff --git a/mysql-test/suite/innodb/r/innodb_timeout_rollback.result b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result index e8fc89e55ba..5f99ad75a12 100644 --- a/mysql-test/suite/innodb/r/innodb_timeout_rollback.result +++ b/mysql-test/suite/innodb/r/innodb_timeout_rollback.result @@ -37,4 +37,4 @@ a drop table t1; disconnect con1; disconnect con2; -End of 5.0 tests +# End of 5.0 tests diff --git a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff index baa017ecf86..ad3d03a7eae 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff @@ -1,2 +1,10 @@ -423a424 -> ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +--- a/mysql-test/suite/innodb/r/insert_into_empty.result ++++ b/mysql-test/suite/innodb/r/insert_into_empty.result +@@ -430,6 +430,7 @@ + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); ++ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index 43b812b586e..d4ffaf89a91 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -251,6 +251,15 @@ c1 1984 3331 DROP TABLE t1; +# +# MDEV-33979 Disallow bulk insert operation during +# partition update statement +# +CREATE TABLE t1(a INT KEY)ENGINE=InnoDB +PARTITION BY KEY(a) PARTITIONS 16; +INSERT INTO t1 VALUES(1); +UPDATE t1 SET a = 2 WHERE a = 1; +DROP TABLE t1; # End of 10.6 tests # # MDEV-26947 UNIQUE column checks fail in InnoDB resulting @@ -467,3 +476,47 @@ DROP TABLE t1; CREATE TABLE t (a CHAR CHARACTER SET utf8) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; INSERT t SELECT left(seq,1) FROM seq_1_to_43691; DROP TABLE t; +# +# MDEV-32453 Bulk insert fails to apply when trigger +# does insert operation +# +CREATE TABLE t(c INT)ENGINE=InnoDB; +CREATE TRIGGER t2_ai AFTER INSERT ON t FOR EACH ROW SET @a:=(SELECT * FROM t); +BEGIN; +INSERT INTO t VALUES (1),(1); +ERROR 21000: Subquery returns more than 1 row +COMMIT; +DROP TABLE t; +# +# MDEV-33868 Assertion `trx->bulk_insert' failed in +# innodb_prepare_commit_versioned +# +CREATE TABLE t (id INT) ENGINE=InnoDB; +select 1 into outfile "VARDIR/tmp/t.outfile"; +BEGIN; +LOAD DATA INFILE 'VARDIR/tmp/t.outfile' INTO TABLE t; +COMMIT; +DROP TABLE t; +# +# MDEV-33934 Assertion `!check_foreigns' failed in +# trx_t::bulk_insert_apply_for_table(dict_table_t*) +# +CREATE TABLE t1(f1 INT,f2 INT,KEY(f1))engine=innodb; +BEGIN; +INSERT INTO t1 VALUES(); +SET STATEMENT FOREIGN_KEY_CHECKS=1 FOR SELECT * FROM t1; +f1 f2 +NULL NULL +COMMIT; +DROP TABLE t1; +# +# MDEV-33970 Assertion `!m.first->second.is_bulk_insert()' +# failed in trx_undo_report_row_operation() +# +CREATE TABLE t1(c1 INT,c2 CHAR) ENGINE=INNODB PARTITION BY KEY(c1) PARTITIONS 2; +begin; +INSERT INTO t1 VALUES(2,0); +DELETE FROM t1; +commit; +DROP TABLE t1; +# End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/instant_alter_extend.result b/mysql-test/suite/innodb/r/instant_alter_extend.result index 33a5f57c7b6..c22043eceb1 100644 Binary files a/mysql-test/suite/innodb/r/instant_alter_extend.result and b/mysql-test/suite/innodb/r/instant_alter_extend.result differ diff --git a/mysql-test/suite/innodb/r/instant_alter_import.result b/mysql-test/suite/innodb/r/instant_alter_import.result index 3e7ee35fdc1..6fe48fb6fab 100644 --- a/mysql-test/suite/innodb/r/instant_alter_import.result +++ b/mysql-test/suite/innodb/r/instant_alter_import.result @@ -64,6 +64,7 @@ alter table t1 discard tablespace; flush tables t2 for export; unlock tables; alter table t1 import tablespace; +# restart select * from t1; z 42 diff --git a/mysql-test/suite/innodb/r/lock_isolation.result b/mysql-test/suite/innodb/r/lock_isolation.result index 88a2ad9326e..31843266617 100644 --- a/mysql-test/suite/innodb/r/lock_isolation.result +++ b/mysql-test/suite/innodb/r/lock_isolation.result @@ -82,7 +82,6 @@ SELECT * FROM t; a b 10 20 10 20 -disconnect consistent; connection default; TRUNCATE TABLE t; INSERT INTO t VALUES(NULL, 1), (2, 2); @@ -99,10 +98,39 @@ a b COMMIT; connection con_weird; COMMIT; -disconnect con_weird; connection default; SELECT * FROM t; a b 10 1 10 20 DROP TABLE t; +# +# MDEV-33802 Weird read view after ROLLBACK of other transactions +# +CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t SET a=1; +BEGIN; +INSERT INTO t SET a=2; +connection consistent; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +ERROR HY000: Record has changed since last read in table 't' +connection con_weird; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +connection default; +ROLLBACK; +connection con_weird; +a b +1 NULL +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +a b +1 NULL +disconnect con_weird; +connection consistent; +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +a b +1 NULL +disconnect consistent; +connection default; +DROP TABLE t; diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,16k,compact,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,16k,dynamic,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,16k,innodb,redundant.rdiff rename to mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,32k,compact,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,32k,dynamic,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,32k,innodb,redundant.rdiff rename to mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,4k,compact,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,4k,dynamic,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,4k,innodb,redundant.rdiff rename to mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,64k,compact,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,64k,dynamic,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,64k,innodb,redundant.rdiff rename to mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,8k,compact,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/max_record_size,8k,dynamic,innodb.rdiff rename to mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index ff750211ced..d97f741efdd 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -180,6 +180,7 @@ icp_attempts disabled icp_no_match disabled icp_out_of_range disabled icp_match disabled +create temporary table orig_innodb_metrics as select name, enabled from information_schema.innodb_metrics; set global innodb_monitor_disable = All; select name from information_schema.innodb_metrics where enabled; name @@ -413,7 +414,7 @@ set global innodb_monitor_reset_all = default; # MONITORS # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*1*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 0 @@ -421,13 +422,13 @@ SET GLOBAL innodb_monitor_enable='module_buffer_page'; INSERT INTO t1 VALUES (1), (2), (3), (4); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*2*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 1 SET GLOBAL innodb_monitor_disable='module_buffer_page'; SET GLOBAL innodb_monitor_reset_all='module_buffer_page'; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*3*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 0 @@ -437,13 +438,13 @@ ERROR 42000: Variable 'innodb_compression_algorithm' can't be set to the value o INSERT INTO t1 VALUES (5), (6), (7), (8); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*4*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 1 SET GLOBAL innodb_monitor_disable='%'; SET GLOBAL innodb_monitor_reset_all='%'; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*5*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 0 @@ -451,7 +452,7 @@ SET GLOBAL innodb_monitor_enable='ALL'; INSERT INTO t1 VALUES (9), (10), (11), (12); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*6*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; NAME COUNT > 0 buffer_page_written_index_leaf 1 @@ -581,6 +582,41 @@ DROP TABLE t1; DROP TABLE fl2; DROP TABLE fl1; DROP TABLE fl0; -SET GLOBAL innodb_monitor_enable=default; -SET GLOBAL innodb_monitor_disable=default; -SET GLOBAL innodb_monitor_reset_all=default; +set global innodb_monitor_disable = 'adaptive\\_hash\\_p%'; +set global innodb_monitor_disable = 'adaptive\\_hash\\_r%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_batch\\_n%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_batch\\_s%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_g%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_s%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_u%'; +set global innodb_monitor_disable = 'buffer\\_f%'; +set global innodb_monitor_disable = 'buffer\\_page\\_%'; +set global innodb_monitor_disable = 'c%'; +set global innodb_monitor_disable = 'ddl%'; +set global innodb_monitor_disable = 'icp%'; +set global innodb_monitor_disable = 'index\\_p%'; +set global innodb_monitor_disable = 'innodb\\_di%'; +set global innodb_monitor_disable = 'innodb\\_l%'; +set global innodb_monitor_disable = 'innodb\\_m%'; +set global innodb_monitor_disable = 'lock\\_re%'; +set global innodb_monitor_disable = 'lock\\_ta%'; +set global innodb_monitor_disable = 'log%'; +set global innodb_monitor_disable = 'm%'; +set global innodb_monitor_disable = 'p%'; +set global innodb_monitor_disable = 't%'; +set global innodb_monitor_enable = 'log\\_w%'; +set global innodb_monitor_enable = 'trx_rseg_history_len'; +set global innodb_monitor_enable = 'trx_undo_slots_cached'; +set global innodb_monitor_enable=default; +Warnings: +Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. +set global innodb_monitor_disable=default; +Warnings: +Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. +set global innodb_monitor_reset_all=default; +Warnings: +Warning 1230 Default value is not defined for this set option. Please specify correct counter or module name. +select name, orig.enabled, new.enabled from +orig_innodb_metrics orig join information_schema.innodb_metrics new using(name) +where orig.enabled != new.enabled; +name enabled enabled diff --git a/mysql-test/suite/innodb/r/restart,16k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,16k.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/restart,16k,innodb.rdiff rename to mysql-test/suite/innodb/r/restart,16k.rdiff diff --git a/mysql-test/suite/innodb/r/restart,32k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,32k.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/restart,32k,innodb.rdiff rename to mysql-test/suite/innodb/r/restart,32k.rdiff diff --git a/mysql-test/suite/innodb/r/restart,4k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,4k.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/restart,4k,innodb.rdiff rename to mysql-test/suite/innodb/r/restart,4k.rdiff diff --git a/mysql-test/suite/innodb/r/restart,64k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,64k.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/restart,64k,innodb.rdiff rename to mysql-test/suite/innodb/r/restart,64k.rdiff diff --git a/mysql-test/suite/innodb/r/restart,8k,innodb.rdiff b/mysql-test/suite/innodb/r/restart,8k.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/restart,8k,innodb.rdiff rename to mysql-test/suite/innodb/r/restart,8k.rdiff diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3,4k.rdiff b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3,4k.rdiff new file mode 100644 index 00000000000..812632aceae --- /dev/null +++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3,4k.rdiff @@ -0,0 +1,2 @@ +91a92 +> ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result index 21085e4cd7e..1fde89ac3b5 100644 --- a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result +++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result @@ -82,3 +82,11 @@ f29(10), f30(10), f31(10), f32(10), f33(10))) ENGINE=InnoDB; ERROR 42000: Too many key parts specified; max 32 parts allowed +# +# MDEV-31161 Assertion failures upon adding a too long key +# to table with COMPRESSED row format +# +CREATE TABLE t1(pk INT PRIMARY KEY, f1 INT, f2 TEXT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +INSERT INTO t1 (pk) VALUES (1); +ALTER TABLE t1 ADD KEY (f1), ADD KEY (f2(1000)); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test index 164ff877b62..f56dcf2c275 100644 --- a/mysql-test/suite/innodb/t/alter_crash.test +++ b/mysql-test/suite/innodb/t/alter_crash.test @@ -70,7 +70,7 @@ let $orig_table_id = `SELECT table_id WHERE name = 'test/t1'`; # Write file to make mysql-test-run.pl expect crash ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --error 2013 ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); @@ -110,7 +110,7 @@ let $orig_table_id = `SELECT table_id WHERE name = 'test/t2'`; # Write file to make mysql-test-run.pl expect crash ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --error 2013 ALTER TABLE t2 ADD PRIMARY KEY (f2, f1); @@ -150,7 +150,7 @@ let $orig_table_id = `select table_id from information_schema.innodb_sys_tables where name = 'test/t1'`; # Write file to make mysql-test-run.pl expect crash ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # --error 2013 ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE; diff --git a/mysql-test/suite/innodb/t/alter_kill-master.opt b/mysql-test/suite/innodb/t/alter_kill-master.opt index e472160c2b7..9eb72834ef6 100644 --- a/mysql-test/suite/innodb/t/alter_kill-master.opt +++ b/mysql-test/suite/innodb/t/alter_kill-master.opt @@ -1 +1 @@ ---innodb-doublewrite=false +--innodb-flush-method=O_DIRECT_NO_FSYNC --skip-innodb-doublewrite diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test index 798f9af00db..3936b3fd9e4 100644 --- a/mysql-test/suite/innodb/t/alter_kill.test +++ b/mysql-test/suite/innodb/t/alter_kill.test @@ -7,6 +7,9 @@ let MYSQLD_DATADIR=`select @@datadir`; let PAGE_SIZE=`select @@innodb_page_size`; +SELECT @@innodb_doublewrite; +SET GLOBAL innodb_doublewrite=fast; + -- disable_query_log call mtr.add_suppression("InnoDB: innodb_force_recovery is on."); call mtr.add_suppression("InnoDB: Ignoring tablespace for.*bug16720368"); @@ -73,8 +76,11 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; close(FILE) || die "Unable to close $file"; EOF +-- let $restart_parameters=--innodb-flush-method=O_DIRECT -- source include/start_mysqld.inc +-- let $restart_parameters= +SELECT @@innodb_doublewrite; --error ER_TABLE_CORRUPT SELECT COUNT(*) FROM bug16720368; --error ER_TABLE_CORRUPT diff --git a/mysql-test/suite/innodb/t/alter_rename_existing.test b/mysql-test/suite/innodb/t/alter_rename_existing.test index 556d8e660b4..f09456e747a 100644 --- a/mysql-test/suite/innodb/t/alter_rename_existing.test +++ b/mysql-test/suite/innodb/t/alter_rename_existing.test @@ -18,7 +18,7 @@ INSERT INTO t1(b) VALUES('one'), ('two'), ('three'); --echo # --echo # Create a file called MYSQLD_DATADIR/test/t1.ibd ---exec echo "This is not t1.ibd" > $MYSQLD_DATADIR/test/t1.ibd +--write_line "This is not t1.ibd" $MYSQLD_DATADIR/test/t1.ibd --echo # Directory listing of test/*.ibd --echo # diff --git a/mysql-test/suite/innodb/t/cursor-restore-unique-null.test b/mysql-test/suite/innodb/t/cursor-restore-unique-null.test new file mode 100644 index 00000000000..409694d695b --- /dev/null +++ b/mysql-test/suite/innodb/t/cursor-restore-unique-null.test @@ -0,0 +1,36 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc + + +CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `b_c` (`b`,`c`)) + ENGINE=InnoDB, STATS_PERSISTENT=0; +INSERT INTO t SET a = 1, c = 2; + +--connect con1,localhost,root +BEGIN; + INSERT INTO t SET a=2, c=2; + +--connection default +BEGIN; +SET DEBUG_SYNC="lock_wait_start SIGNAL select_locked"; +--send SELECT * FROM t FORCE INDEX(b) FOR UPDATE + +--connection con1 +SET DEBUG_SYNC="now WAIT_FOR select_locked"; +ROLLBACK; + +--connection default +--echo # If the bug is not fixed, and the both unique index key fields are +--echo # NULL, there will be two (1, NULL, 2) rows in the result, +--echo # because cursor will be restored to (NULL, 2, 1) position for +--echo # secondary key instead of "supremum". +--reap +COMMIT; + +SET DEBUG_SYNC="RESET"; + +--disconnect con1 +DROP TABLE t; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/doublewrite_debug.test b/mysql-test/suite/innodb/t/doublewrite_debug.test index ab7fd8eba22..b8dcd5068ef 100644 --- a/mysql-test/suite/innodb/t/doublewrite_debug.test +++ b/mysql-test/suite/innodb/t/doublewrite_debug.test @@ -45,7 +45,7 @@ commit work; # Slow shutdown and restart to make sure ibuf merge is finished SET GLOBAL innodb_fast_shutdown = 0; let $shutdown_timeout=; -let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0"; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; --source include/restart_mysqld.inc --source ../include/no_checkpoint_start.inc begin; @@ -95,7 +95,7 @@ select f1, f2 from t1; --echo # Test Begin: Test if recovery works if 1st page of --echo # system tablespace is corrupted and 2nd page as corrupted. -let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0"; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; --source include/restart_mysqld.inc --source ../include/no_checkpoint_start.inc begin; diff --git a/mysql-test/suite/innodb/t/group_commit_crash.test b/mysql-test/suite/innodb/t/group_commit_crash.test index 12f7ba202e3..b0ed854f4f3 100644 --- a/mysql-test/suite/innodb/t/group_commit_crash.test +++ b/mysql-test/suite/innodb/t/group_commit_crash.test @@ -51,7 +51,7 @@ while ($numtests) START TRANSACTION; insert into t1 select * from t2; # Write file to make mysql-test-run.pl expect crash - --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + --write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect eval call setcrash($numtests); diff --git a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test index 6115e3f0050..9b7de7cea56 100644 --- a/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test @@ -51,7 +51,7 @@ while ($numtests) START TRANSACTION; insert into t1 select * from t2; # Write file to make mysql-test-run.pl expect crash - --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + --write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect eval call setcrash($numtests); diff --git a/mysql-test/suite/innodb/t/index_length.test b/mysql-test/suite/innodb/t/index_length.test index bf4940d4b39..03e61a5a8f9 100644 --- a/mysql-test/suite/innodb/t/index_length.test +++ b/mysql-test/suite/innodb/t/index_length.test @@ -20,4 +20,12 @@ WHERE table_schema = 'test' AND table_name = 't1'; disconnect stop_purge; DROP TABLE t1; +--echo # +--echo # MDEV-22855 Assertion (!field->prefix_len || +--echo # field->fixed_len == field->prefix_len) +--echo # failed in btr_node_ptr_max_size +--echo # +CREATE TABLE t1(c CHAR(194) CHARACTER SET UTF32, KEY k1(c(193)))ENGINE=InnoDB; +INSERT INTO t1 SET c=''; +DROP TABLE t1; --echo # End of 10.4 tests diff --git a/mysql-test/suite/innodb/t/index_merge_threshold.test b/mysql-test/suite/innodb/t/index_merge_threshold.test index cb8e117d453..acadf4f06a3 100644 --- a/mysql-test/suite/innodb/t/index_merge_threshold.test +++ b/mysql-test/suite/innodb/t/index_merge_threshold.test @@ -10,6 +10,7 @@ # # Check actual behavior for table, partitioned table and temporary table # ############################################################# +--source include/have_innodb.inc --source include/have_innodb_16k.inc --source include/have_partition.inc diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test index c4a68ac71b7..6b94bfd214f 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-debug.test +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -144,15 +144,14 @@ DROP TABLE t; --echo # create table t1(f1 int not null primary key, - - f2 int not null, index idx(f2))engine=innodb; + f2 int not null, index idx(f2), index i(f2,f1))engine=innodb; insert into t1 values(1, 1); connect(con1,localhost,root,,,); SET DEBUG_SYNC='before_delete_table_stats SIGNAL blocked WAIT_FOR go'; -SET innodb_lock_wait_timeout=0; -send ALTER TABLE t1 FORCE, ALGORITHM=COPY; +send SET STATEMENT innodb_lock_wait_timeout=0 FOR +ALTER TABLE t1 FORCE, ALGORITHM=COPY; connection default; SET DEBUG_SYNC='now WAIT_FOR blocked'; @@ -167,6 +166,21 @@ connection default; COMMIT; SET DEBUG_SYNC=RESET; +RENAME TABLE mysql.innodb_table_stats TO mysql.innodb_table_stats_hidden; +connection con1; +SET DEBUG_SYNC='innodb_commit_inplace_before_lock SIGNAL blocked WAIT_FOR go'; +send ALTER TABLE t1 DROP INDEX i; + +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +RENAME TABLE mysql.innodb_table_stats_hidden TO mysql.innodb_table_stats; +SET DEBUG_SYNC='now SIGNAL go'; + +connection con1; +reap; +connection default; +SET DEBUG_SYNC=RESET; + connection con1; ALTER TABLE t1 RENAME KEY idx TO idx1, ALGORITHM=COPY; disconnect con1; diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test index 2534f03dbec..0b6cbabb802 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test +++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test @@ -35,7 +35,7 @@ let datadir= `select @@datadir`; CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; SET debug_dbug='+d,innodb_alter_commit_crash_before_commit'; ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --error 2013 ALTER TABLE t1 ADD PRIMARY KEY (f2, f1); diff --git a/mysql-test/suite/innodb/t/innodb-corrupted-table.test b/mysql-test/suite/innodb/t/innodb-corrupted-table.test index a064f08d677..dcdaa61859f 100644 --- a/mysql-test/suite/innodb/t/innodb-corrupted-table.test +++ b/mysql-test/suite/innodb/t/innodb-corrupted-table.test @@ -23,14 +23,14 @@ alter table t1 add primary key (pk); --echo # Stop the server, replace the frm with the old one and restart the server ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc --remove_file $datadir/test/t1.frm --copy_file $MYSQLTEST_VARDIR/tmp/t1.frm $datadir/test/t1.frm ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index 2c3c95487f0..f83866b0f4c 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -42,7 +42,7 @@ INSERT INTO t1 VALUES(1),(2),(3); --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect ---exec echo wait > $_expect_file_name +--write_line wait $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; --error 2013 ALTER TABLE t1 DISCARD TABLESPACE; @@ -54,7 +54,7 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INT) ENGINE = InnoDB; INSERT INTO t1 VALUES(1),(2),(3); ---exec echo wait > $_expect_file_name +--write_line wait $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; --error 2013 ALTER TABLE t1 DISCARD TABLESPACE; @@ -96,7 +96,7 @@ EOF --error ER_TABLESPACE_DISCARDED SELECT * FROM t1; ---exec echo wait > $_expect_file_name +--write_line wait $_expect_file_name SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; --error 2013 ALTER TABLE t1 IMPORT TABLESPACE; diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test index 7f1f5c40585..41b9a4d8476 100644 --- a/mysql-test/suite/innodb/t/innodb_bug60196.test +++ b/mysql-test/suite/innodb/t/innodb_bug60196.test @@ -58,7 +58,7 @@ SELECT * FROM bug_60196; --echo # Restart server. # Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Turn on reconnect --enable_reconnect @@ -132,7 +132,7 @@ SELECT * FROM Bug_60309; --echo # Restart server. # Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Turn on reconnect --enable_reconnect diff --git a/mysql-test/suite/innodb/t/innodb_timeout_rollback.test b/mysql-test/suite/innodb/t/innodb_timeout_rollback.test index 44e8acdde13..aa282352356 100644 --- a/mysql-test/suite/innodb/t/innodb_timeout_rollback.test +++ b/mysql-test/suite/innodb/t/innodb_timeout_rollback.test @@ -1,4 +1,5 @@ +--source include/have_innodb.inc --source include/innodb_rollback_on_timeout.inc ---echo End of 5.0 tests +--echo # End of 5.0 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index af7a0b3aec4..e22ed11d723 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -271,6 +271,16 @@ connection default; disconnect con1; SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-33979 Disallow bulk insert operation during +--echo # partition update statement +--echo # +CREATE TABLE t1(a INT KEY)ENGINE=InnoDB + PARTITION BY KEY(a) PARTITIONS 16; +INSERT INTO t1 VALUES(1); +UPDATE t1 SET a = 2 WHERE a = 1; +DROP TABLE t1; --echo # End of 10.6 tests --echo # @@ -495,3 +505,54 @@ DROP TABLE t1; CREATE TABLE t (a CHAR CHARACTER SET utf8) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; INSERT t SELECT left(seq,1) FROM seq_1_to_43691; DROP TABLE t; + +--echo # +--echo # MDEV-32453 Bulk insert fails to apply when trigger +--echo # does insert operation +--echo # +CREATE TABLE t(c INT)ENGINE=InnoDB; +CREATE TRIGGER t2_ai AFTER INSERT ON t FOR EACH ROW SET @a:=(SELECT * FROM t); +BEGIN; +--error ER_SUBQUERY_NO_1_ROW +INSERT INTO t VALUES (1),(1); +COMMIT; +DROP TABLE t; + +--echo # +--echo # MDEV-33868 Assertion `trx->bulk_insert' failed in +--echo # innodb_prepare_commit_versioned +--echo # +CREATE TABLE t (id INT) ENGINE=InnoDB; +--replace_result $MYSQLTEST_VARDIR VARDIR +--disable_ps2_protocol +eval select 1 into outfile "$MYSQLTEST_VARDIR/tmp/t.outfile"; +--enable_ps2_protocol +BEGIN; +--replace_result $MYSQLTEST_VARDIR VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t.outfile' INTO TABLE t; +COMMIT; +DROP TABLE t; +--remove_file $MYSQLTEST_VARDIR/tmp/t.outfile + +--echo # +--echo # MDEV-33934 Assertion `!check_foreigns' failed in +--echo # trx_t::bulk_insert_apply_for_table(dict_table_t*) +--echo # +CREATE TABLE t1(f1 INT,f2 INT,KEY(f1))engine=innodb; +BEGIN; +INSERT INTO t1 VALUES(); +SET STATEMENT FOREIGN_KEY_CHECKS=1 FOR SELECT * FROM t1; +COMMIT; +DROP TABLE t1; + +--echo # +--echo # MDEV-33970 Assertion `!m.first->second.is_bulk_insert()' +--echo # failed in trx_undo_report_row_operation() +--echo # +CREATE TABLE t1(c1 INT,c2 CHAR) ENGINE=INNODB PARTITION BY KEY(c1) PARTITIONS 2; +begin; +INSERT INTO t1 VALUES(2,0); +DELETE FROM t1; +commit; +DROP TABLE t1; +--echo # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/instant_alter_extend.test b/mysql-test/suite/innodb/t/instant_alter_extend.test index 7258ba6d238..636527e598c 100644 --- a/mysql-test/suite/innodb/t/instant_alter_extend.test +++ b/mysql-test/suite/innodb/t/instant_alter_extend.test @@ -256,3 +256,16 @@ select * from t1; check table t1; drop database best; + +--echo # +--echo # MDEV-33214 Table is getting rebuild with +--echo # ALTER TABLE ADD COLUMN +--echo # +use test; +CREATE TABLE t1(f1 INT, f2 VARCHAR(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; +INSERT INTO t1 VALUES(1,'abc'),(2,'def'); +ALTER TABLE t1 ADD (f3 VARCHAR(5000), f4 VARCHAR(20)), ALGORITHM=instant; +ALTER TABLE t1 ADD f5 TEXT, ALGORITHM=INSTANT; +DROP TABLE t1; + +--echo # End of 10.4 tests diff --git a/mysql-test/suite/innodb/t/instant_alter_import.test b/mysql-test/suite/innodb/t/instant_alter_import.test index 3a811def170..fa35c582633 100644 --- a/mysql-test/suite/innodb/t/instant_alter_import.test +++ b/mysql-test/suite/innodb/t/instant_alter_import.test @@ -83,6 +83,7 @@ flush tables t2 for export; unlock tables; alter table t1 import tablespace; +--source include/restart_mysqld.inc select * from t1; --remove_file $MYSQLD_DATADIR/test/t1.ibd diff --git a/mysql-test/suite/innodb/t/lock_isolation.test b/mysql-test/suite/innodb/t/lock_isolation.test index 30d2978f4f2..5c60f6e707c 100644 --- a/mysql-test/suite/innodb/t/lock_isolation.test +++ b/mysql-test/suite/innodb/t/lock_isolation.test @@ -79,7 +79,6 @@ COMMIT; --connection consistent --reap SELECT * FROM t; ---disconnect consistent --connection default TRUNCATE TABLE t; @@ -103,8 +102,48 @@ COMMIT; --connection con_weird --reap COMMIT; ---disconnect con_weird --connection default SELECT * FROM t; DROP TABLE t; + +--echo # +--echo # MDEV-33802 Weird read view after ROLLBACK of other transactions +--echo # + +CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t SET a=1; + +BEGIN; INSERT INTO t SET a=2; + +--connection consistent +START TRANSACTION WITH CONSISTENT SNAPSHOT; +--disable_ps2_protocol +--error ER_CHECKREAD +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +--enable_ps2_protocol + +--connection con_weird +START TRANSACTION WITH CONSISTENT SNAPSHOT; +send +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; + +--connection default +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'Sending data' + and info LIKE 'SELECT * FROM t %'; +--source include/wait_condition.inc +ROLLBACK; + +--connection con_weird +--reap +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +--disconnect con_weird + +--connection consistent +SELECT * FROM t FORCE INDEX (b) FOR UPDATE; +--disconnect consistent + +--connection default +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/log_file_name.test b/mysql-test/suite/innodb/t/log_file_name.test index 9707a1535af..33b1e37e2ce 100644 --- a/mysql-test/suite/innodb/t/log_file_name.test +++ b/mysql-test/suite/innodb/t/log_file_name.test @@ -204,7 +204,7 @@ print FILE "\0" x 16384; close(FILE); EOF ---exec echo "" > $MYSQLD_DATADIR/test/u2.ibd +--write_line "" $MYSQLD_DATADIR/test/u2.ibd --copy_file $MYSQLD_DATADIR/test/u6.ibd $MYSQLD_DATADIR/test/u4.ibd diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test index 63c339e9489..11da213b6e4 100644 --- a/mysql-test/suite/innodb/t/monitor.test +++ b/mysql-test/suite/innodb/t/monitor.test @@ -5,11 +5,11 @@ # sys_vars.innodb_monitor_enable_basic --source include/have_innodb.inc -# Test turn on/off the monitor counter with "all" option -# By default, they will be off. select name, if(enabled,'enabled','disabled') status from information_schema.innodb_metrics; +create temporary table orig_innodb_metrics as select name, enabled from information_schema.innodb_metrics; + set global innodb_monitor_disable = All; select name from information_schema.innodb_metrics where enabled; @@ -315,18 +315,22 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; let $innodb_monitor_enable = `SELECT @@innodb_monitor_enable`; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*1*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; SET GLOBAL innodb_monitor_enable='module_buffer_page'; INSERT INTO t1 VALUES (1), (2), (3), (4); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME + +let $wait_condition= select count > 0 from information_schema.innodb_metrics where name like 'buffer_page_written_index_leaf'; +source include/wait_condition.inc; + +SELECT /*2*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; SET GLOBAL innodb_monitor_disable='module_buffer_page'; SET GLOBAL innodb_monitor_reset_all='module_buffer_page'; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*3*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; SET GLOBAL innodb_monitor_enable='%'; @@ -334,18 +338,22 @@ SET GLOBAL innodb_monitor_enable='%'; SET GLOBAL innodb_monitor_reset_all= '%', innodb_compression_algorithm= foo; INSERT INTO t1 VALUES (5), (6), (7), (8); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME + +let $wait_condition= select count > 0 from information_schema.innodb_metrics where name like 'buffer_page_written_index_leaf'; +source include/wait_condition.inc; + +SELECT /*4*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; SET GLOBAL innodb_monitor_disable='%'; SET GLOBAL innodb_monitor_reset_all='%'; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*5*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; SET GLOBAL innodb_monitor_enable='ALL'; INSERT INTO t1 VALUES (9), (10), (11), (12); FLUSH TABLES t1 FOR EXPORT; UNLOCK TABLES; -SELECT NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +SELECT /*6*/ NAME, COUNT > 0 FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME LIKE 'buffer_page_written_index_leaf'; DROP TABLE t1; @@ -462,8 +470,36 @@ DROP TABLE fl2; DROP TABLE fl1; DROP TABLE fl0; ---disable_warnings -SET GLOBAL innodb_monitor_enable=default; -SET GLOBAL innodb_monitor_disable=default; -SET GLOBAL innodb_monitor_reset_all=default; ---enable_warnings +set global innodb_monitor_disable = 'adaptive\\_hash\\_p%'; +set global innodb_monitor_disable = 'adaptive\\_hash\\_r%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_batch\\_n%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_batch\\_s%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_g%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_s%'; +set global innodb_monitor_disable = 'buffer\\_LRU\\_u%'; +set global innodb_monitor_disable = 'buffer\\_f%'; +set global innodb_monitor_disable = 'buffer\\_page\\_%'; +set global innodb_monitor_disable = 'c%'; +set global innodb_monitor_disable = 'ddl%'; +set global innodb_monitor_disable = 'icp%'; +set global innodb_monitor_disable = 'index\\_p%'; +set global innodb_monitor_disable = 'innodb\\_di%'; +set global innodb_monitor_disable = 'innodb\\_l%'; +set global innodb_monitor_disable = 'innodb\\_m%'; +set global innodb_monitor_disable = 'lock\\_re%'; +set global innodb_monitor_disable = 'lock\\_ta%'; +set global innodb_monitor_disable = 'log%'; +set global innodb_monitor_disable = 'm%'; +set global innodb_monitor_disable = 'p%'; +set global innodb_monitor_disable = 't%'; +set global innodb_monitor_enable = 'log\\_w%'; +set global innodb_monitor_enable = 'trx_rseg_history_len'; +set global innodb_monitor_enable = 'trx_undo_slots_cached'; + +set global innodb_monitor_enable=default; +set global innodb_monitor_disable=default; +set global innodb_monitor_reset_all=default; + +select name, orig.enabled, new.enabled from + orig_innodb_metrics orig join information_schema.innodb_metrics new using(name) + where orig.enabled != new.enabled; diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test index 24029a48aa4..47fedc52725 100644 --- a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test +++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test @@ -85,3 +85,19 @@ CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200), f29(10), f30(10), f31(10), f32(10), f33(10))) ENGINE=InnoDB; + +--echo # +--echo # MDEV-31161 Assertion failures upon adding a too long key +--echo # to table with COMPRESSED row format +--echo # +--let $page_size= `SELECT @@GLOBAL.innodb_page_size` +CREATE TABLE t1(pk INT PRIMARY KEY, f1 INT, f2 TEXT)ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +INSERT INTO t1 (pk) VALUES (1); +let $error_code = 0; +if ($page_size == 4096) { +let $error_code = ER_TOO_BIG_ROWSIZE; +} + +--error $error_code +ALTER TABLE t1 ADD KEY (f1), ADD KEY (f2(1000)); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/sys_truncate_debug.test b/mysql-test/suite/innodb/t/sys_truncate_debug.test index 312a827effa..b3363f105e3 100644 --- a/mysql-test/suite/innodb/t/sys_truncate_debug.test +++ b/mysql-test/suite/innodb/t/sys_truncate_debug.test @@ -24,7 +24,7 @@ DROP TABLE t1; SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE = 0; # Ran out of buffer pool -let $restart_parameters=--debug_dbug="+d,shrink_buffer_pool_full"; +let $restart_parameters=--debug_dbug=+d,shrink_buffer_pool_full; --source include/restart_mysqld.inc --let SEARCH_PATTERN= \[Warning\] InnoDB: Cannot shrink the system tablespace @@ -36,7 +36,7 @@ WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); # Ran out of mtr log size -let $restart_parameters=--debug_dbug="+d,mtr_log_max_size"; +let $restart_parameters=--debug_dbug=+d,mtr_log_max_size; --source include/restart_mysqld.inc --let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot shrink the system tablespace @@ -48,7 +48,7 @@ WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); # Crash after shrinking the system tablespace -let $restart_parameters=--debug_dbug="+d,crash_after_sys_truncate"; +let $restart_parameters=--debug_dbug=+d,crash_after_sys_truncate; --source include/restart_mysqld.inc SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test index a374f9e1bba..9c742ce75c6 100644 --- a/mysql-test/suite/innodb/t/temporary_table.test +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -135,7 +135,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); # We cannot use include/restart_mysqld.inc in this particular test, # because SHOW STATUS would fail due to unwritable (nonexistent) tmpdir. --source include/shutdown_mysqld.inc ---exec echo "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" > $_expect_file_name +--write_line "restart: --tmpdir=/dev/null/$MYSQL_TMP_DIR --skip-innodb-fast-shutdown" $_expect_file_name --enable_reconnect --disable_result_log --disable_query_log diff --git a/mysql-test/suite/innodb/t/undo_space_dblwr.test b/mysql-test/suite/innodb/t/undo_space_dblwr.test index 3f61e91ddf5..52b19a4b7fb 100644 --- a/mysql-test/suite/innodb/t/undo_space_dblwr.test +++ b/mysql-test/suite/innodb/t/undo_space_dblwr.test @@ -12,7 +12,7 @@ insert into t1 values (1, 1); # Slow shutdown and restart to make sure ibuf merge is finished SET GLOBAL innodb_fast_shutdown = 0; let $shutdown_timeout=; -let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0"; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; --source include/restart_mysqld.inc --source ../include/no_checkpoint_start.inc diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test index 4550e06bce8..9abf08ff436 100644 --- a/mysql-test/suite/innodb/t/undo_truncate.test +++ b/mysql-test/suite/innodb/t/undo_truncate.test @@ -13,7 +13,7 @@ call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operation # Re-create the undo log tablespaces after slow shutdown SET GLOBAL innodb_fast_shutdown=0; -let $restart_parameters="--innodb_undo_tablespaces=2"; +let $restart_parameters=--innodb_undo_tablespaces=2; --source include/restart_mysqld.inc SET GLOBAL innodb_undo_log_truncate = 0; diff --git a/mysql-test/suite/innodb/t/undo_truncate_recover.test b/mysql-test/suite/innodb/t/undo_truncate_recover.test index 148c3f939d0..988b28f75b4 100644 --- a/mysql-test/suite/innodb/t/undo_truncate_recover.test +++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test @@ -13,7 +13,7 @@ # Re-create the undo log tablespaces after slow shutdown SET GLOBAL innodb_fast_shutdown=0; -let $restart_parameters="--innodb_undo_tablespaces=2"; +let $restart_parameters=--innodb_undo_tablespaces=2; --source include/restart_mysqld.inc SET GLOBAL innodb_undo_log_truncate = 1; diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test index 168309a5c92..56b9052a47a 100644 --- a/mysql-test/suite/innodb_fts/t/sync.test +++ b/mysql-test/suite/innodb_fts/t/sync.test @@ -115,7 +115,7 @@ CREATE TABLE t1 ( INSERT INTO t1(title) VALUES('database'); ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash'; diff --git a/mysql-test/suite/innodb_gis/t/rollback.test b/mysql-test/suite/innodb_gis/t/rollback.test index fcfe71e2f80..a09986692ee 100644 --- a/mysql-test/suite/innodb_gis/t/rollback.test +++ b/mysql-test/suite/innodb_gis/t/rollback.test @@ -463,7 +463,7 @@ rollback; # Test partial update rollback after recovered. # Crash the server in partial update. ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect set session debug="+d,row_mysql_crash_if_error"; --error 2013 update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3; diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test index 644496d70d6..18c90eff393 100644 --- a/mysql-test/suite/innodb_zip/t/restart.test +++ b/mysql-test/suite/innodb_zip/t/restart.test @@ -404,13 +404,13 @@ SHOW CREATE TABLE t77_restart; --echo # Moving tablespace 't4_restart' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir --copy_file $MYSQL_DATA_DIR/test/t4_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd --remove_file $MYSQL_DATA_DIR/test/t4_restart.ibd ---exec echo $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd > $MYSQL_DATA_DIR/test/t4_restart.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd $MYSQL_DATA_DIR/test/t4_restart.isl --echo # Moving tablespace 't55_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir --copy_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd --remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd --remove_file $MYSQL_DATA_DIR/test/t55_restart.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd > $MYSQL_DATA_DIR/test/t55_restart.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd $MYSQL_DATA_DIR/test/t55_restart.isl --echo # Moving tablespace 't66_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir --copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd @@ -422,9 +422,9 @@ SHOW CREATE TABLE t77_restart; --remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl --remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl --remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl --echo # Moving tablespace 't77_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir --copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd @@ -439,10 +439,10 @@ SHOW CREATE TABLE t77_restart; --remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl --remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl --remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl ---exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl +--write_line $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl --echo ---- MYSQL_DATA_DIR/test --list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index b5bc2a94f01..97a1909a875 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -75,7 +75,7 @@ SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; SELECT * FROM t1; # Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Execute the statement that causes the crash --error 2013 @@ -96,7 +96,7 @@ SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; SELECT COUNT(*) FROM t1; # Don't start up the server right away. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Execute the statement that causes the crash --error 2013 @@ -113,7 +113,7 @@ EOF --echo # Restart and reconnect to the server --enable_reconnect ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result index 375b29d51de..df8ce6f6c5e 100644 --- a/mysql-test/suite/json/r/json_no_table.result +++ b/mysql-test/suite/json/r/json_no_table.result @@ -1002,19 +1002,27 @@ DOUBLE error ER_INVALID_JSON_TEXT_IN_PARAM select json_type(CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8')); json_type(CAST(CAST('2015-01-15' AS DATE) as CHAR CHARACTER SET 'utf8')) -INTEGER +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5 # ---------------------------------------------------------------------- # Test of json_compact(literal) # ---------------------------------------------------------------------- select json_type(json_compact(cast('2014-11-25 18:00' as datetime))); json_type(json_compact(cast('2014-11-25 18:00' as datetime))) -INTEGER +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5 select json_type(json_compact(cast('2014-11-25' as date))); json_type(json_compact(cast('2014-11-25' as date))) -INTEGER +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5 select json_type(json_compact(cast('18:00:59' as time))); json_type(json_compact(cast('18:00:59' as time))) -INTEGER +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 3 select json_type(json_compact(127)); json_type(json_compact(127)) INTEGER @@ -1064,7 +1072,9 @@ json_type(json_compact(3.14E30)) DOUBLE select json_type(json_compact(cast('10101abcde' as binary))); json_type(json_compact(cast('10101abcde' as binary))) -INTEGER +NULL +Warnings: +Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 6 select json_type(json_compact(ST_GeomFromText('POINT(1 1)'))); json_type(json_compact(ST_GeomFromText('POINT(1 1)'))) NULL diff --git a/mysql-test/suite/json/r/type_json.result b/mysql-test/suite/json/r/type_json.result index 333e933eda9..44e14978934 100644 --- a/mysql-test/suite/json/r/type_json.result +++ b/mysql-test/suite/json/r/type_json.result @@ -2880,5 +2880,13 @@ DROP PROCEDURE p1; DROP PROCEDURE p2; DROP TABLE t1, t1c, t2; # +# MDEV-30646 View created via JSON_ARRAYAGG returns incorrect json object +# +CREATE VIEW v1 AS SELECT JSON_OBJECT('plugin','unix_socket') as v1_json; +SELECT JSON_ARRAYAGG(v1_json) FROM v1; +JSON_ARRAYAGG(v1_json) +[{"plugin": "unix_socket"}] +DROP VIEW v1; +# # End of 10.5 tests # diff --git a/mysql-test/suite/json/t/type_json.test b/mysql-test/suite/json/t/type_json.test index f84bef780c3..03236070c8e 100644 --- a/mysql-test/suite/json/t/type_json.test +++ b/mysql-test/suite/json/t/type_json.test @@ -138,6 +138,15 @@ DROP PROCEDURE p2; DROP TABLE t1, t1c, t2; +--echo # +--echo # MDEV-30646 View created via JSON_ARRAYAGG returns incorrect json object +--echo # + +CREATE VIEW v1 AS SELECT JSON_OBJECT('plugin','unix_socket') as v1_json; +SELECT JSON_ARRAYAGG(v1_json) FROM v1; +DROP VIEW v1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/suite/large_tests/r/maria_recover_encrypted.result b/mysql-test/suite/large_tests/r/maria_recover_encrypted.result index a7293d45db6..fb7f1ef1c2f 100644 --- a/mysql-test/suite/large_tests/r/maria_recover_encrypted.result +++ b/mysql-test/suite/large_tests/r/maria_recover_encrypted.result @@ -36,7 +36,7 @@ CALL proc_insert_many(); UNLOCK TABLES; SET debug_dbug="d,crash_shutdown"; shutdown; -ERROR HY000: Lost connection to MySQL server during query +ERROR HY000: Lost connection to server during query SELECT * FROM t1 ORDER BY 1 DESC LIMIT 10; field1 field2 field3 1069999 2069999 3069999 diff --git a/mysql-test/suite/large_tests/t/maria_recover_encrypted.test b/mysql-test/suite/large_tests/t/maria_recover_encrypted.test index 4c590e5e1f9..1064c2c0884 100644 --- a/mysql-test/suite/large_tests/t/maria_recover_encrypted.test +++ b/mysql-test/suite/large_tests/t/maria_recover_encrypted.test @@ -3,6 +3,8 @@ --source include/have_maria.inc --source include/default_charset.inc +--source include/not_embedded.inc +--source include/have_debug.inc # Cleanup --disable_warnings @@ -13,7 +15,7 @@ DROP PROCEDURE IF EXISTS proc_insert_many; # -------- # Configure encryption ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -21,7 +23,7 @@ DROP PROCEDURE IF EXISTS proc_insert_many; 1;76025E3ADC78D74819927DB02AAA4C35 EOF ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc @@ -73,7 +75,7 @@ CALL proc_insert_many(); UNLOCK TABLES; # Crash and restart the server while it's still flushing index ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/key.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect SET debug_dbug="d,crash_shutdown"; --error 2013 shutdown; diff --git a/mysql-test/suite/maria/bulk_insert_crash.test b/mysql-test/suite/maria/bulk_insert_crash.test index d9167c3f0d7..04f3a148ad4 100644 --- a/mysql-test/suite/maria/bulk_insert_crash.test +++ b/mysql-test/suite/maria/bulk_insert_crash.test @@ -12,7 +12,7 @@ # # Write file to make mysql-test-run.pl expect crash and restart ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect create table t1 (a int primary key, b int, c int, unique key(b), key(c)) engine=aria transactional=1; insert into t1 values (1000,1000,1000); diff --git a/mysql-test/suite/maria/encrypt-no-key.test b/mysql-test/suite/maria/encrypt-no-key.test index 457441226cc..e1d674097bf 100644 --- a/mysql-test/suite/maria/encrypt-no-key.test +++ b/mysql-test/suite/maria/encrypt-no-key.test @@ -29,10 +29,10 @@ CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=Aria; --echo # Restart with encryption enabled ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc @@ -43,10 +43,10 @@ LOAD INDEX INTO CACHE t1; # Restart without encryption. Above table should be unreadable ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart:--aria-encrypt-tables=0" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=0" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/maria/encrypt-wrong-key.test b/mysql-test/suite/maria/encrypt-wrong-key.test index ac060c4e9dd..274a165ca4d 100644 --- a/mysql-test/suite/maria/encrypt-wrong-key.test +++ b/mysql-test/suite/maria/encrypt-wrong-key.test @@ -9,7 +9,7 @@ call mtr.add_suppression("System key id 1 is missing"); call mtr.add_suppression("Unknown key id 1"); call mtr.add_suppression("Initialization of encryption failed.*"); ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -17,14 +17,14 @@ call mtr.add_suppression("Initialization of encryption failed.*"); 1;770A8A65DA156D24EE2A093277530142 EOF ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc CREATE TABLE t1 (i INT, KEY(i)) ENGINE=Aria; INSERT INTO t1 VALUES (1); ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc @@ -32,7 +32,7 @@ INSERT INTO t1 VALUES (1); 2;770A8A65DA156D24EE2A093277530143 EOF ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc @@ -43,11 +43,11 @@ repair table t1; --error HA_ERR_NO_ENCRYPTION INSERT INTO t1 VALUES (2); ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--aria-encrypt-tables=1 --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys1.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/maria/repair.result b/mysql-test/suite/maria/repair.result index 458b5503602..7905cb02f28 100644 --- a/mysql-test/suite/maria/repair.result +++ b/mysql-test/suite/maria/repair.result @@ -62,3 +62,26 @@ SET SESSION aria_sort_buffer_size=default; # # End of 10.3 tests # +# +# MDEV-34055 Assertion `readbytes != (size_t)-1 || +# (*__errno_location ()) != 9' failure or corruption errors upon +# REPAIR on Aria tables +# +CREATE OR REPLACE TABLE t1 (a INT, b INT, UNIQUE(b), UNIQUE(a)) ENGINE=Aria; +INSERT INTO t1 VALUES (1,2); +REPAIR TABLE t1 EXTENDED QUICK USE_FRM; +Table Op Msg_type Msg_text +test.t1 repair warning Number of rows changed from 0 to 1 +test.t1 repair status OK +CREATE TABLE t2 (c INT) ENGINE=Aria; +SELECT * FROM t2; +c +REPLACE INTO t1 VALUES (1,3); +REPAIR TABLE t2, t1 QUICK; +Table Op Msg_type Msg_text +test.t2 repair status OK +test.t1 repair status OK +DROP TABLE t1, t2; +# +# End of 10.5 tests +# diff --git a/mysql-test/suite/maria/repair.test b/mysql-test/suite/maria/repair.test index 688ac076e1d..08234a5a546 100644 --- a/mysql-test/suite/maria/repair.test +++ b/mysql-test/suite/maria/repair.test @@ -74,3 +74,22 @@ SET SESSION aria_sort_buffer_size=default; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-34055 Assertion `readbytes != (size_t)-1 || +--echo # (*__errno_location ()) != 9' failure or corruption errors upon +--echo # REPAIR on Aria tables +--echo # + +CREATE OR REPLACE TABLE t1 (a INT, b INT, UNIQUE(b), UNIQUE(a)) ENGINE=Aria; +INSERT INTO t1 VALUES (1,2); +REPAIR TABLE t1 EXTENDED QUICK USE_FRM; +CREATE TABLE t2 (c INT) ENGINE=Aria; +SELECT * FROM t2; +REPLACE INTO t1 VALUES (1,3); +REPAIR TABLE t2, t1 QUICK; +DROP TABLE t1, t2; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result index ae5b42700d1..3407d288264 100644 --- a/mysql-test/suite/mariabackup/backup_grants.result +++ b/mysql-test/suite/mariabackup/backup_grants.result @@ -1,4 +1,4 @@ -CREATE user backup@localhost; +CREATE user backup@localhost IDENTIFIED BY 'xyz'; FOUND 1 /missing required privilege RELOAD/ in backup.log FOUND 1 /missing required privilege PROCESS/ in backup.log FOUND 1 /GRANT USAGE ON/ in backup.log diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test index b4713d231be..a90b4678d44 100644 --- a/mysql-test/suite/mariabackup/backup_grants.test +++ b/mysql-test/suite/mariabackup/backup_grants.test @@ -1,16 +1,16 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; -CREATE user backup@localhost; +CREATE user backup@localhost IDENTIFIED BY 'xyz'; # backup possible for unprivileges user, with --no-lock --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 -ubackup --no-lock --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 -ubackup -pxyz --no-lock --target-dir=$targetdir; --enable_result_log rmdir $targetdir; # backup fails without --no-lock, because of FTWRL --disable_result_log error 1; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 -ubackup -pxyz --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1; --enable_result_log let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log; @@ -23,7 +23,7 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log; # backup succeeds with RELOAD privilege GRANT RELOAD, PROCESS on *.* to backup@localhost; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 -ubackup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --user=backup --password=xyz --target-dir=$targetdir; --enable_result_log rmdir $targetdir; @@ -31,7 +31,7 @@ rmdir $targetdir; # --slave-info and galera info require REPLICA MONITOR --disable_result_log error 1; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user=backup --password=xyz --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1; --enable_result_log rmdir $targetdir; @@ -40,7 +40,7 @@ rmdir $targetdir; GRANT REPLICA MONITOR ON *.* TO backup@localhost; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user backup --password xyz --slave-info --target-dir=$targetdir; --enable_result_log rmdir $targetdir; REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; @@ -48,7 +48,7 @@ REVOKE REPLICA MONITOR ON *.* FROM backup@localhost; # --safe-slave-backup requires REPLICATION SLAVE ADMIN, and REPLICA MONITOR --disable_result_log error 1; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --user backup --password xyz --safe-slave-backup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log; --enable_result_log rmdir $targetdir; @@ -60,7 +60,7 @@ rmdir $targetdir; GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost; GRANT REPLICA MONITOR ON *.* TO backup@localhost; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --safe-slave-backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup -pxyz --safe-slave-backup --target-dir=$targetdir; --enable_result_log rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/encrypted_export.opt b/mysql-test/suite/mariabackup/encrypted_export.opt new file mode 100644 index 00000000000..227c2e03f2f --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_export.opt @@ -0,0 +1,6 @@ +--innodb_encrypt_tables=1 +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key +--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc +--loose-file-key-management-encryption-algorithm=aes_cbc diff --git a/mysql-test/suite/mariabackup/encrypted_export.result b/mysql-test/suite/mariabackup/encrypted_export.result new file mode 100644 index 00000000000..b2add8e6136 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_export.result @@ -0,0 +1,14 @@ +CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB; +insert into t1 values(repeat('a',100)); +select @@innodb_encrypt_tables; +@@innodb_encrypt_tables +ON +# xtrabackup backup +# xtrabackup prepare export +# restart +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/encrypted_export.test b/mysql-test/suite/mariabackup/encrypted_export.test new file mode 100644 index 00000000000..d1802118a09 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_export.test @@ -0,0 +1,29 @@ +--source include/have_file_key_management.inc +--source include/have_innodb.inc + +CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB; +insert into t1 values(repeat('a',100)); + +select @@innodb_encrypt_tables; +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; + +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$targetdir; +--enable_result_log +--source include/shutdown_mysqld.inc + +echo # xtrabackup prepare export; +--disable_result_log +exec $XTRABACKUP --prepare --export --target-dir=$targetdir; +--enable_result_log + +--source include/start_mysqld.inc +let MYSQLD_DATADIR=`select @@datadir`; +ALTER TABLE t1 DISCARD TABLESPACE; +copy_file $targetdir/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd; +copy_file $targetdir/test/t1.cfg $MYSQLD_DATADIR/test/t1.cfg; +ALTER TABLE t1 IMPORT TABLESPACE; +CHECK TABLE t1; +DROP TABLE t1; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/incremental_encrypted.test b/mysql-test/suite/mariabackup/incremental_encrypted.test index ddf7e492a56..d4619e1f454 100644 --- a/mysql-test/suite/mariabackup/incremental_encrypted.test +++ b/mysql-test/suite/mariabackup/incremental_encrypted.test @@ -7,6 +7,12 @@ if (!$EXAMPLE_KEY_MANAGEMENT_SO) } call mtr.add_suppression("InnoDB: New log files created"); +if (`select @@innodb_page_size=65536`) +{ + # this needs too much memory for 32bit + source include/have_64bit.inc; +} + let $basedir=$MYSQLTEST_VARDIR/tmp/backup; let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; diff --git a/mysql-test/suite/mariabackup/undo_space_id.result b/mysql-test/suite/mariabackup/undo_space_id.result index b03b9705569..fd720d123c1 100644 --- a/mysql-test/suite/mariabackup/undo_space_id.result +++ b/mysql-test/suite/mariabackup/undo_space_id.result @@ -11,3 +11,10 @@ undo002 undo001 undo002 DROP TABLE t1; +# +# MDEV-33980 mariadb-backup --backup is missing +# retry logic for undo tablespaces +# +# xtrabackup backup +# Display undo log files from target directory +FOUND 5 /Retrying to read undo tablespace*/ in backup.log diff --git a/mysql-test/suite/mariabackup/undo_space_id.test b/mysql-test/suite/mariabackup/undo_space_id.test index ea762608eb6..32782354537 100644 --- a/mysql-test/suite/mariabackup/undo_space_id.test +++ b/mysql-test/suite/mariabackup/undo_space_id.test @@ -23,3 +23,22 @@ list_files $basedir undo*; DROP TABLE t1; rmdir $basedir; + +--echo # +--echo # MDEV-33980 mariadb-backup --backup is missing +--echo # retry logic for undo tablespaces +--echo # +let $backuplog= $MYSQLTEST_VARDIR/tmp/backup.log; +--echo # xtrabackup backup +--disable_result_log +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir --dbug=+d,undo_space_read_fail > $backuplog; +--enable_result_log +--echo # Display undo log files from target directory +list_files $basedir undo*; + +--let SEARCH_PATTERN=Retrying to read undo tablespace* +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +rmdir $basedir; +remove_file $backuplog; diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.result b/mysql-test/suite/multi_source/gtid_ignore_duplicates.result index e142ff8b981..88b525e21ff 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.result +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.result @@ -174,6 +174,105 @@ a 10 11 12 +*** MDEV-33475: --gtid-ignore-duplicate can double-apply event in case of parallel replication retry +connection server_2; +STOP SLAVE "c2b"; +SET default_master_connection = "c2b"; +include/wait_for_slave_to_stop.inc +STOP SLAVE "a2b"; +SET default_master_connection = "a2b"; +include/wait_for_slave_to_stop.inc +connection server_1; +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +BEGIN; +INSERT INTO t2 VALUES (0, 0); +INSERT INTO t2 VALUES (1, 0); +INSERT INTO t2 VALUES (2, 0); +INSERT INTO t2 VALUES (3, 0); +INSERT INTO t2 VALUES (4, 0); +INSERT INTO t2 VALUES (5, 0); +INSERT INTO t2 VALUES (6, 0); +INSERT INTO t2 VALUES (7, 0); +INSERT INTO t2 VALUES (8, 0); +INSERT INTO t2 VALUES (9, 0); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (0+10, 100); +UPDATE t2 SET b=0 WHERE a<10; +INSERT INTO t2 VALUES (0+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (1+10, 100); +UPDATE t2 SET b=1 WHERE a<10; +INSERT INTO t2 VALUES (1+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (2+10, 100); +UPDATE t2 SET b=2 WHERE a<10; +INSERT INTO t2 VALUES (2+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (3+10, 100); +UPDATE t2 SET b=3 WHERE a<10; +INSERT INTO t2 VALUES (3+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (4+10, 100); +UPDATE t2 SET b=4 WHERE a<10; +INSERT INTO t2 VALUES (4+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (5+10, 100); +UPDATE t2 SET b=5 WHERE a<10; +INSERT INTO t2 VALUES (5+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (6+10, 100); +UPDATE t2 SET b=6 WHERE a<10; +INSERT INTO t2 VALUES (6+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (7+10, 100); +UPDATE t2 SET b=7 WHERE a<10; +INSERT INTO t2 VALUES (7+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (8+10, 100); +UPDATE t2 SET b=8 WHERE a<10; +INSERT INTO t2 VALUES (8+20, 200); +COMMIT; +BEGIN; +INSERT INTO t2 VALUES (9+10, 100); +UPDATE t2 SET b=9 WHERE a<10; +INSERT INTO t2 VALUES (9+20, 200); +COMMIT; +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; +COUNT(*) SUM(a) SUM(b) +30 435 3090 +include/save_master_gtid.inc +connection server_2; +SET @old_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode=aggressive; +SET default_master_connection = "a2b"; +START SLAVE; +include/wait_for_slave_to_start.inc +SET default_master_connection = "c2b"; +START SLAVE; +include/wait_for_slave_to_start.inc +include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; +COUNT(*) SUM(a) SUM(b) +30 435 3090 +connection server_3; +include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; +COUNT(*) SUM(a) SUM(b) +30 435 3090 +connection server_4; +include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; +COUNT(*) SUM(a) SUM(b) +30 435 3090 *** Test also with not using parallel replication. connection server_1; SET default_master_connection = "b2a"; @@ -474,6 +573,7 @@ Warnings: Note 1938 SLAVE 'a2b' stopped Note 1938 SLAVE 'c2b' stopped SET GLOBAL slave_parallel_threads= @old_parallel; +SET GLOBAL slave_parallel_mode= @old_mode; SET GLOBAL gtid_ignore_duplicates= @old_ignore_duplicates; connection server_3; SET GLOBAL gtid_domain_id=0; @@ -491,22 +591,22 @@ Note 1938 SLAVE 'a2d' stopped SET GLOBAL slave_parallel_threads= @old_parallel; SET GLOBAL gtid_ignore_duplicates= @old_ignore_duplicates; connection server_1; -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; include/reset_master_slave.inc disconnect server_1; connection server_2; -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; include/reset_master_slave.inc disconnect server_2; connection server_3; -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; include/reset_master_slave.inc disconnect server_3; connection server_4; -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; include/reset_master_slave.inc disconnect server_4; diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test index 3d2d151bd0d..cbc06920b41 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test @@ -173,6 +173,65 @@ SET default_master_connection = "a2b"; SELECT * FROM t1 WHERE a >= 10 ORDER BY a; +--echo *** MDEV-33475: --gtid-ignore-duplicate can double-apply event in case of parallel replication retry + +# Create a bunch of transactions that will cause conflicts and retries. +# The bug was that the retry code was not handling the --gtid-ignore-duplicates +# option, so events could be doubly-applied. + +--connection server_2 +STOP SLAVE "c2b"; +SET default_master_connection = "c2b"; +--source include/wait_for_slave_to_stop.inc +STOP SLAVE "a2b"; +SET default_master_connection = "a2b"; +--source include/wait_for_slave_to_stop.inc + +--connection server_1 +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +BEGIN; +--let $i= 0 +while ($i < 10) { + eval INSERT INTO t2 VALUES ($i, 0); + inc $i; +} +COMMIT; + +--let $i= 0 +while ($i < 10) { + BEGIN; + eval INSERT INTO t2 VALUES ($i+10, 100); + eval UPDATE t2 SET b=$i WHERE a<10; + eval INSERT INTO t2 VALUES ($i+20, 200); + COMMIT; + inc $i; +} + +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; +--source include/save_master_gtid.inc + +--connection server_2 +SET @old_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode=aggressive; +SET default_master_connection = "a2b"; +START SLAVE; +--source include/wait_for_slave_to_start.inc +SET default_master_connection = "c2b"; +START SLAVE; +--source include/wait_for_slave_to_start.inc + +--source include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; + +--connection server_3 +--source include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; + +--connection server_4 +--source include/sync_with_master_gtid.inc +SELECT COUNT(*), SUM(a), SUM(b) FROM t2; + + --echo *** Test also with not using parallel replication. --connection server_1 @@ -414,6 +473,7 @@ SET GLOBAL gtid_domain_id=0; --sorted_result STOP ALL SLAVES; SET GLOBAL slave_parallel_threads= @old_parallel; +SET GLOBAL slave_parallel_mode= @old_mode; SET GLOBAL gtid_ignore_duplicates= @old_ignore_duplicates; --connection server_3 @@ -431,25 +491,25 @@ SET GLOBAL slave_parallel_threads= @old_parallel; SET GLOBAL gtid_ignore_duplicates= @old_ignore_duplicates; --connection server_1 -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; --source include/reset_master_slave.inc --disconnect server_1 --connection server_2 -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; --source include/reset_master_slave.inc --disconnect server_2 --connection server_3 -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; --source include/reset_master_slave.inc --disconnect server_3 --connection server_4 -DROP TABLE t1; +DROP TABLE t1, t2; ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria; --source include/reset_master_slave.inc --disconnect server_4 diff --git a/mysql-test/suite/parts/inc/partition_crash.inc b/mysql-test/suite/parts/inc/partition_crash.inc index c657ba880c9..bd00f6ca0d5 100644 --- a/mysql-test/suite/parts/inc/partition_crash.inc +++ b/mysql-test/suite/parts/inc/partition_crash.inc @@ -11,7 +11,7 @@ SHOW CREATE TABLE t1; --sorted_result SELECT * FROM t1; ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --disable_reconnect # CR_SERVER_LOST --error 2013 @@ -22,7 +22,7 @@ SELECT * FROM t1; --replace_regex /sql-exchange.*\./sql-exchange./ /sql-shadow-[0-9a-f]*-/sql-shadow-/ --cat_file $DATADIR.files.txt --remove_file $DATADIR.files.txt ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --enable_reconnect --source include/wait_until_connected_again.inc --echo # State after crash recovery diff --git a/mysql-test/suite/parts/r/alter_table.result b/mysql-test/suite/parts/r/alter_table.result index fa458c977c2..8f633370b47 100644 --- a/mysql-test/suite/parts/r/alter_table.result +++ b/mysql-test/suite/parts/r/alter_table.result @@ -1,3 +1,6 @@ +# +# MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER +# set @save_alter_algorithm= @@session.alter_algorithm; SET SESSION alter_algorithm=4; CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3)); @@ -18,9 +21,16 @@ ALTER TABLE t1 ADD COLUMN c INT; ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY DROP table if exists t1; set @@session.alter_algorithm= @save_alter_algorithm; +# +# MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata | +# ERROR 1507 (HY000): Error in list of partitions to DROP +# CREATE TABLE t1 (a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3)); ALTER TABLE t1 DROP PARTITION p; DROP TABLE if exists t1; +# +# MDEV-23357 Server crashes in Sql_cmd_alter_table_exchange_partition::exchange_partition +# CREATE TABLE t1 (i INT); CREATE VIEW v1 as SELECT * FROM t1; CREATE TABLE t2 (i INT); @@ -28,6 +38,7 @@ ALTER TABLE v1 EXCHANGE PARTITION p2 WITH TABLE t2 ; ERROR 42000: Can't open table DROP VIEW v1; DROP TABLE t1, t2; +# End of 10.5 tests # # MDEV-22165 CONVERT PARTITION: move in partition from existing table # @@ -358,3 +369,4 @@ disconnect con1; connection default; drop user u@localhost; drop database db; +# End of 10.11 tests diff --git a/mysql-test/suite/parts/r/mdev_21007.result b/mysql-test/suite/parts/r/mdev_21007.result new file mode 100644 index 00000000000..fb2417ac3ae --- /dev/null +++ b/mysql-test/suite/parts/r/mdev_21007.result @@ -0,0 +1,5 @@ +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result index ec6cbe92b0a..c76c6aba921 100644 --- a/mysql-test/suite/parts/r/partition_alter_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -88,3 +88,25 @@ insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; alter online table t1 delay_key_write=0; alter online table t1 delay_key_write=1; drop table t1; +# +# MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +# +create table t1 (i1 int primary key, i2 int, d1 date, key(i2)) +partition by hash(i1) partitions 3; +insert into t1 values(0, 1, '2010-10-10'); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +PRIMARY +i2 +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +PRIMARY +i2 disabled +alter table t1 add partition (partition p4); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +index_name comment +PRIMARY +i2 disabled +drop table t1; +# End of 10.11 tests diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index 1eddf51b087..129e84e5db4 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -1,3 +1,6 @@ +call mtr.add_suppression("..test.t1_will_crash"); +call mtr.add_suppression("Got an error from unknown thread"); +call mtr.add_suppression("Table 't1_will_crash' is marked as crashed and should be repaired"); CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); FLUSH TABLES; diff --git a/mysql-test/suite/parts/t/alter_table.test b/mysql-test/suite/parts/t/alter_table.test index 9b75add3afa..9c131c733eb 100644 --- a/mysql-test/suite/parts/t/alter_table.test +++ b/mysql-test/suite/parts/t/alter_table.test @@ -1,12 +1,18 @@ # Permissions don't work with embedded --source include/not_embedded.inc + +# +# General bugs with ALTER TABLE and partitions that doesn't have to be run +# on all engines +# + --source include/have_partition.inc --source include/lcase_names.inc --source suite/parts/inc/engines.inc -# -# MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER -# +--echo # +--echo # MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER +--echo # set @save_alter_algorithm= @@session.alter_algorithm; SET SESSION alter_algorithm=4; @@ -18,18 +24,18 @@ DROP table if exists t1; set @@session.alter_algorithm= @save_alter_algorithm; -# -# MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata | -# ERROR 1507 (HY000): Error in list of partitions to DROP -# +--echo # +--echo # MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata | +--echo # ERROR 1507 (HY000): Error in list of partitions to DROP +--echo # CREATE TABLE t1 (a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3)); ALTER TABLE t1 DROP PARTITION p; DROP TABLE if exists t1; -# -# MDEV-23357 Server crashes in Sql_cmd_alter_table_exchange_partition::exchange_partition -# +--echo # +--echo # MDEV-23357 Server crashes in Sql_cmd_alter_table_exchange_partition::exchange_partition +--echo # CREATE TABLE t1 (i INT); CREATE VIEW v1 as SELECT * FROM t1; CREATE TABLE t2 (i INT); @@ -38,6 +44,8 @@ ALTER TABLE v1 EXCHANGE PARTITION p2 WITH TABLE t2 ; DROP VIEW v1; DROP TABLE t1, t2; +--echo # End of 10.5 tests + --echo # --echo # MDEV-22165 CONVERT PARTITION: move in partition from existing table --echo # @@ -319,3 +327,5 @@ alter table t1 convert table tp to partition p2 values less than (1000); --connection default drop user u@localhost; drop database db; + +--echo # End of 10.11 tests diff --git a/mysql-test/suite/parts/t/mdev_21007.test b/mysql-test/suite/parts/t/mdev_21007.test new file mode 100644 index 00000000000..ec6fbe4d108 --- /dev/null +++ b/mysql-test/suite/parts/t/mdev_21007.test @@ -0,0 +1,9 @@ +--source include/have_partition.inc + +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; + +# Cleanup +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index d3abb8842e1..794c07797f9 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -22,3 +22,18 @@ insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; alter online table t1 delay_key_write=0; alter online table t1 delay_key_write=1; drop table t1; + +--echo # +--echo # MDEV-25102 UNIQUE USING HASH error after ALTER ... DISABLE KEYS +--echo # +create table t1 (i1 int primary key, i2 int, d1 date, key(i2)) +partition by hash(i1) partitions 3; +insert into t1 values(0, 1, '2010-10-10'); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +alter table t1 disable keys; +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +alter table t1 add partition (partition p4); +select index_name, comment from information_schema.statistics where table_schema='test' and table_name='t1'; +drop table t1; + +--echo # End of 10.11 tests diff --git a/mysql-test/suite/parts/t/partition_recover_myisam-master.opt b/mysql-test/suite/parts/t/partition_recover_myisam-master.opt deleted file mode 100644 index ddbd7a0a8c5..00000000000 --- a/mysql-test/suite/parts/t/partition_recover_myisam-master.opt +++ /dev/null @@ -1 +0,0 @@ ---myisam-recover-options diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.opt b/mysql-test/suite/parts/t/partition_recover_myisam.opt new file mode 100644 index 00000000000..ca3d0cddc18 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_recover_myisam.opt @@ -0,0 +1 @@ +--safe-mode diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index 91a14a51b3c..3106407bea9 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -1,18 +1,10 @@ # test the auto-recover (--myisam-recover) of partitioned myisam tables ---disable_query_log call mtr.add_suppression("..test.t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread"); call mtr.add_suppression("Table 't1_will_crash' is marked as crashed and should be repaired"); ---enable_query_log --source include/have_partition.inc ---disable_warnings ---disable_query_log -drop table if exists t1_will_crash; ---enable_query_log ---enable_warnings - CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); diff --git a/mysql-test/suite/perfschema/include/memory_aggregate_load.inc b/mysql-test/suite/perfschema/include/memory_aggregate_load.inc index 7a54d25216e..c6e58d094d6 100644 --- a/mysql-test/suite/perfschema/include/memory_aggregate_load.inc +++ b/mysql-test/suite/perfschema/include/memory_aggregate_load.inc @@ -274,7 +274,6 @@ execute dump_users; execute dump_hosts; --disconnect con1 ---disconnect con5 --connection default @@ -283,6 +282,8 @@ let $wait_condition= select count(*) = 0 from performance_schema.threads where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user1'; --source include/wait_condition.inc + +--disconnect con5 let $wait_condition= select count(*) = 1 from performance_schema.threads where `TYPE`='FOREGROUND' and PROCESSLIST_USER= 'user4'; diff --git a/mysql-test/suite/perfschema/include/program_execution.inc b/mysql-test/suite/perfschema/include/program_execution.inc index 8c0bc691898..f774a4d7b50 100644 --- a/mysql-test/suite/perfschema/include/program_execution.inc +++ b/mysql-test/suite/perfschema/include/program_execution.inc @@ -32,7 +32,7 @@ SET GLOBAL event_scheduler=ON; CREATE TABLE table_t(a INT); DELIMITER |; -CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END| diff --git a/mysql-test/suite/perfschema/include/stage_setup.inc b/mysql-test/suite/perfschema/include/stage_setup.inc index 683c4561c15..ba97d9094a9 100644 --- a/mysql-test/suite/perfschema/include/stage_setup.inc +++ b/mysql-test/suite/perfschema/include/stage_setup.inc @@ -121,12 +121,23 @@ begin where thread_id = my_thread_id and nesting_event_id = my_statement_id order by event_id asc; - # Ignore query cache as it may not be enabled - select username, event_name, nesting_event_type - from performance_schema.events_stages_history - where thread_id = my_thread_id - and nesting_event_id = my_statement_id and - event_name not like "%query cache%" + # 1. Ignore query cache as it may not be enabled + # 2. MDL wait consists of short 1 second waits (this is not configurable) + # repeated until lock_wait_timeout is reached. The stage is changed + # to Waiting and back every second. To have predictable result here + # the query filters all sequences of X, "Waiting for MDL", X, + # leaving just X. + with h as ( + select event_id, username, event_name, nesting_event_type, + lag(event_name) over (order by event_id) = lead(event_name) over (order by event_id) + and event_name = "stage/sql/Waiting for stored function metadata lock" as v1, + lag(event_name, 2) over (order by event_id) = event_name + and lag(event_name, 1) over (order by event_id) = "stage/sql/Waiting for stored function metadata lock" as v2 + from performance_schema.events_stages_history + where thread_id = my_thread_id + and nesting_event_id = my_statement_id and + event_name not like "%query cache%" + ) select username, event_name, nesting_event_type from h where v1 is not true and v2 is not true order by event_id asc; end; else diff --git a/mysql-test/suite/perfschema/r/max_program_zero.result b/mysql-test/suite/perfschema/r/max_program_zero.result index 5435efb34ae..0e2928bd07a 100644 --- a/mysql-test/suite/perfschema/r/max_program_zero.result +++ b/mysql-test/suite/perfschema/r/max_program_zero.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/memory_aggregate.result b/mysql-test/suite/perfschema/r/memory_aggregate.result index 69eb033e74b..1d963dd8caa 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate.result @@ -2507,8 +2507,8 @@ execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 6 6 disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_32bit.result b/mysql-test/suite/perfschema/r/memory_aggregate_32bit.result index 2b8ee675650..387af11f91a 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_32bit.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_32bit.result @@ -2507,8 +2507,8 @@ execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 6 6 disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_a.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_a.result index b5c8e1cd3c7..abac503b965 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_a.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_a.result @@ -1903,8 +1903,8 @@ execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 6 6 disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_h.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_h.result index cc0e0c03dcf..f63e6f1d002 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_h.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_h.result @@ -1653,8 +1653,8 @@ user4 2 2 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u.result index 8b24b5b565b..32785952fe7 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u.result @@ -1343,8 +1343,8 @@ execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 6 6 disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u_no_h.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u_no_h.result index 45cbaf88372..e68f0e1baf6 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u_no_h.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_a_no_u_no_h.result @@ -1093,8 +1093,8 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_h.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_h.result index 35d528bf63c..e3b7cd0f998 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_h.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_h.result @@ -2257,8 +2257,8 @@ user4 2 2 execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_u.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_u.result index 1f800ce4ba6..fd9f2c69a42 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_u.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_u.result @@ -1947,8 +1947,8 @@ execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS localhost 6 6 disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/memory_aggregate_no_u_no_h.result b/mysql-test/suite/perfschema/r/memory_aggregate_no_u_no_h.result index b1ac5f24ec9..fdbd2d75d56 100644 --- a/mysql-test/suite/perfschema/r/memory_aggregate_no_u_no_h.result +++ b/mysql-test/suite/perfschema/r/memory_aggregate_no_u_no_h.result @@ -1697,8 +1697,8 @@ USER CURRENT_CONNECTIONS TOTAL_CONNECTIONS execute dump_hosts; HOST CURRENT_CONNECTIONS TOTAL_CONNECTIONS disconnect con1; -disconnect con5; connection default; +disconnect con5; "================== con1/con5 disconnected ==================" "================== Step 10 ==================" call dump_thread(); diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result index 2258cbceea4..6bc0fa32314 100644 --- a/mysql-test/suite/perfschema/r/misc.result +++ b/mysql-test/suite/perfschema/r/misc.result @@ -94,7 +94,7 @@ test t_60905 NULL 5 5 0 1 DROP TABLE t_60905; show global variables like "performance_schema_max_thread_instances"; Variable_name Value -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 explain select * from performance_schema.threads; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE threads ALL NULL NULL NULL NULL 256 diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result index 388fac4b668..080680728e9 100644 --- a/mysql-test/suite/perfschema/r/ortho_iter.result +++ b/mysql-test/suite/perfschema/r/ortho_iter.result @@ -233,7 +233,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -257,7 +257,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/privilege_table_io.result b/mysql-test/suite/perfschema/r/privilege_table_io.result index 8be4b9583ec..9e5e0ad31cc 100644 --- a/mysql-test/suite/perfschema/r/privilege_table_io.result +++ b/mysql-test/suite/perfschema/r/privilege_table_io.result @@ -39,7 +39,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -63,7 +63,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_idle.result b/mysql-test/suite/perfschema/r/start_server_disable_idle.result index bfc49fd3480..dcd8feb3f68 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_stages.result b/mysql-test/suite/perfschema/r/start_server_disable_stages.result index e9f20398467..d2a1d3e296f 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_statements.result b/mysql-test/suite/perfschema/r/start_server_disable_statements.result index ffb45f4f55f..fc50aecdbaa 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result index e271d5a10e6..4cd5aad2813 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_transactions.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_transactions.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_disable_waits.result b/mysql-test/suite/perfschema/r/start_server_disable_waits.result index 833da22583e..4665083f609 100644 --- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result +++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_innodb.result b/mysql-test/suite/perfschema/r/start_server_innodb.result index e3ff0f514a7..0101b370494 100644 --- a/mysql-test/suite/perfschema/r/start_server_innodb.result +++ b/mysql-test/suite/perfschema/r/start_server_innodb.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_low_index.result b/mysql-test/suite/perfschema/r/start_server_low_index.result index ffdf9d65b87..a8706c477c5 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_index.result +++ b/mysql-test/suite/perfschema/r/start_server_low_index.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result index dbb404f6129..37db1bb6f06 100644 --- a/mysql-test/suite/perfschema/r/start_server_low_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_low_table_lock.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 1 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_account.result b/mysql-test/suite/perfschema/r/start_server_no_account.result index f92b0e6bec6..a05cb9c5f2f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_account.result +++ b/mysql-test/suite/perfschema/r/start_server_no_account.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result index fefad55c209..d2e2bc9d2ff 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 0 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result index 0c2f65f6ac9..d2a84d67951 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_cond_inst.result @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_class.result b/mysql-test/suite/perfschema/r/start_server_no_file_class.result index c3f06b53425..bf0e7bfc20e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 0 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result index fd39807d567..b0c690cabcc 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_file_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_file_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_host.result b/mysql-test/suite/perfschema/r/start_server_no_host.result index 43111c5ec40..10c882cc264 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_host.result +++ b/mysql-test/suite/perfschema/r/start_server_no_host.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 0 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_index.result b/mysql-test/suite/perfschema/r/start_server_no_index.result index 15d1184bcbe..4ac8fbaffb4 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_index.result +++ b/mysql-test/suite/perfschema/r/start_server_no_index.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mdl.result b/mysql-test/suite/perfschema/r/start_server_no_mdl.result index b8de90453ce..25f9ea1df9d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mdl.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result index 60066264c90..7283733df5e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_memory_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_memory_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result index 3353b46bbcb..2904bc21fce 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result index d41da361733..17acca63228 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result index 4919de6bb6c..e559d72e13d 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result +++ b/mysql-test/suite/perfschema/r/start_server_no_prepared_stmts_instances.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result index 02a119bdc68..3c1da2a1182 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result index ead01ce2d0e..6da9ed12292 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result index a99f1c0f9be..2038560794b 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_actors.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 0 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result index 7c148889412..ad9e2ebe924 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result +++ b/mysql-test/suite/perfschema/r/start_server_no_setup_objects.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 0 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result index dec0680c511..e7b1235e260 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result index 20adf1a9f64..0ca5fe86afd 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_socket_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result index 044f9475041..75c9fb95005 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stage_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stage_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result index 350f2c6637d..160188e756e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result index d2d7063c32f..07b31f4986f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_stages_history_long.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result index ca7c49cd51a..61609361b3a 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statement_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statement_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result index 8bcb3c56a00..1eb8e625f94 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result index 2a2bf5d3f7c..949965879b5 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_statements_history_long.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result index ec6e40acc00..17d0b2c0e36 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_hdl.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 0 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result index b3f1e4cbcf2..c72093c1f09 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 0 performance_schema_max_table_lock_stat 0 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result index baf9f761358..b093b796caa 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_table_lock.result +++ b/mysql-test/suite/perfschema/r/start_server_no_table_lock.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 0 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result index cd204f3d811..b13140acd9a 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_class.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_class.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 0 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result index d083484cd7c..a4d17b2700b 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result +++ b/mysql-test/suite/perfschema/r/start_server_no_thread_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result index f5a12e5473d..ffe68605722 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result index 76ae9d5fa4e..78570f98125 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_transactions_history_long.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_user.result b/mysql-test/suite/perfschema/r/start_server_no_user.result index 4bd472a22a9..7971e8dd8f4 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_user.result +++ b/mysql-test/suite/perfschema/r/start_server_no_user.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result index f59b156ce1e..0fa5c75164f 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 0 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result index cc70572c7ef..cc90ffb403e 100644 --- a/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result +++ b/mysql-test/suite/perfschema/r/start_server_no_waits_history_long.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 0 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_off.result b/mysql-test/suite/perfschema/r/start_server_off.result index a53d591938c..b409d7ff09a 100644 --- a/mysql-test/suite/perfschema/r/start_server_off.result +++ b/mysql-test/suite/perfschema/r/start_server_off.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_on.result b/mysql-test/suite/perfschema/r/start_server_on.result index e3ff0f514a7..0101b370494 100644 --- a/mysql-test/suite/perfschema/r/start_server_on.result +++ b/mysql-test/suite/perfschema/r/start_server_on.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/start_server_variables.result b/mysql-test/suite/perfschema/r/start_server_variables.result index 7d1d1e05375..2adfc99bc46 100644 --- a/mysql-test/suite/perfschema/r/start_server_variables.result +++ b/mysql-test/suite/perfschema/r/start_server_variables.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 @@ -165,7 +165,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -188,7 +188,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result index 05ec7b0b2b5..44ab09983cc 100644 --- a/mysql-test/suite/perfschema/r/statement_program_lost_inst.result +++ b/mysql-test/suite/perfschema/r/statement_program_lost_inst.result @@ -117,7 +117,7 @@ performance_schema_events_waits_history_long_size 10000 performance_schema_events_waits_history_size 10 performance_schema_hosts_size 100 performance_schema_max_cond_classes 90 -performance_schema_max_cond_instances 1000 +performance_schema_max_cond_instances 1500 performance_schema_max_digest_length 1024 performance_schema_max_file_classes 80 performance_schema_max_file_handles 32768 @@ -141,7 +141,7 @@ performance_schema_max_table_handles 1000 performance_schema_max_table_instances 500 performance_schema_max_table_lock_stat 500 performance_schema_max_thread_classes 50 -performance_schema_max_thread_instances 200 +performance_schema_max_thread_instances 400 performance_schema_session_connect_attrs_size 2048 performance_schema_setup_actors_size 100 performance_schema_setup_objects_size 100 diff --git a/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result b/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result index 5e376a12a18..1a973c9448b 100644 --- a/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result +++ b/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result @@ -145,7 +145,7 @@ Bollywood # Event SET GLOBAL event_scheduler=ON; CREATE TABLE table_t(a INT); -CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END| @@ -165,7 +165,7 @@ statement/sql/call_procedure CALL SampleProc1(30,40,50) NULL NULL 0 statement/sql/call_procedure CALL SampleProc2("Jwalamukhi",34) NULL NULL 0 statement/sql/call_procedure CALL SampleProc3() NULL NULL 0 statement/sql/call_procedure CALL SampleProc4() NULL NULL 0 -statement/sql/create_event CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +statement/sql/create_event CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END NULL NULL 0 diff --git a/mysql-test/suite/perfschema/r/statement_program_non_nested.result b/mysql-test/suite/perfschema/r/statement_program_non_nested.result index af9807cbc97..1c75dac11ac 100644 --- a/mysql-test/suite/perfschema/r/statement_program_non_nested.result +++ b/mysql-test/suite/perfschema/r/statement_program_non_nested.result @@ -145,7 +145,7 @@ Bollywood # Event SET GLOBAL event_scheduler=ON; CREATE TABLE table_t(a INT); -CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END| @@ -182,7 +182,7 @@ statement/sql/call_procedure CALL SampleProc1(30,40,50) stored_programs NULL NUL statement/sql/call_procedure CALL SampleProc2("Jwalamukhi",34) stored_programs NULL NULL NULL NULL 0 statement/sql/call_procedure CALL SampleProc3() stored_programs NULL NULL NULL NULL 0 statement/sql/call_procedure CALL SampleProc4() stored_programs NULL NULL NULL NULL 0 -statement/sql/create_event CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +statement/sql/create_event CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END stored_programs NULL NULL NULL NULL 0 @@ -553,7 +553,7 @@ Bollywood # Event SET GLOBAL event_scheduler=ON; CREATE TABLE table_t(a INT); -CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO +CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND ON COMPLETION NOT PRESERVE DO BEGIN INSERT INTO table_t VALUES(1); END| diff --git a/mysql-test/suite/perfschema/r/threads_history.result b/mysql-test/suite/perfschema/r/threads_history.result index 364a5f6f9e3..d72ace62255 100644 --- a/mysql-test/suite/perfschema/r/threads_history.result +++ b/mysql-test/suite/perfschema/r/threads_history.result @@ -24,27 +24,22 @@ events_waits_history_long YES global_instrumentation YES thread_instrumentation YES statements_digest YES -# Switch to (con1, localhost, user1, , ) connect con1, localhost, user1, , ; update performance_schema.threads set INSTRUMENTED='YES', HISTORY='YES' where PROCESSLIST_ID = connection_id(); -# Switch to (con2, localhost, user2, , ) connect con2, localhost, user2, , ; update performance_schema.threads set INSTRUMENTED='YES', HISTORY='NO' where PROCESSLIST_ID = connection_id(); -# Switch to (con3, localhost, user3, , ) connect con3, localhost, user3, , ; update performance_schema.threads set INSTRUMENTED='NO', HISTORY='YES' where PROCESSLIST_ID = connection_id(); -# Switch to (con4, localhost, user4, , ) connect con4, localhost, user4, , ; update performance_schema.threads set INSTRUMENTED='NO', HISTORY='NO' where PROCESSLIST_ID = connection_id(); -# Switch to connection default connection default; truncate table performance_schema.events_transactions_current; truncate table performance_schema.events_transactions_history; @@ -58,7 +53,6 @@ truncate table performance_schema.events_stages_history_long; truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; -# Switch to connection con1 connection con1; XA START 'XA_CON1', 'XA_BQUAL', 12; select "Hi from con1"; @@ -67,7 +61,6 @@ Hi from con1 XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; -# Switch to connection con2 connection con2; XA START 'XA_CON2', 'XA_BQUAL', 12; select "Hi from con2"; @@ -76,7 +69,6 @@ Hi from con2 XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; -# Switch to connection con3 connection con3; XA START 'XA_CON3', 'XA_BQUAL', 12; select "Hi from con3"; @@ -85,7 +77,6 @@ Hi from con3 XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; -# Switch to connection con4 connection con4; XA START 'XA_CON4', 'XA_BQUAL', 12; select "Hi from con4"; @@ -95,72 +86,124 @@ XA END 'XA_CON4', 'XA_BQUAL', 12; XA PREPARE 'XA_CON4', 'XA_BQUAL', 12; XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; connection default; -"=========================== Transactions user 1" +########################### Transactions user 1 - 1 +select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL +select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL +select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL -"=========================== Transactions user 2" +########################### Transactions user 2 - 1 +select /*2-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con2_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON2 XA_BQUAL +select /*2-1*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-1*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Transactions user 3" +########################### Transactions user 3 - 1 +select /*3-1*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Transactions user 4" +########################### Transactions user 4 - 1 +select /*4-1*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Statements user 1" +########################### Statements user 1 - 1 +select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 +select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_start XA START 'XA_CON1', 'XA_BQUAL', 12 statement/sql/select select "Hi from con1" statement/sql/xa_end XA END 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_prepare XA PREPARE 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 +select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_start XA START 'XA_CON1', 'XA_BQUAL', 12 statement/sql/select select "Hi from con1" statement/sql/xa_end XA END 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_prepare XA PREPARE 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 -"=========================== Statements user 2" +########################### Statements user 2 - 1 +select /*2-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON2', 'XA_BQUAL', 12 +select /*2-1*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-1*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Statements user 3" +########################### Statements user 3 - 1 +select /*3-1*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Statements user 4" +########################### Statements user 4 - 1 +select /*4-1*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Stages user 1" +########################### Stages user 1 - 1 +select /*1-1*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME stage/sql/Starting cleanup stage/sql/Freeing items @@ -172,6 +215,8 @@ stage/sql/Query end stage/sql/Starting cleanup stage/sql/Freeing items stage/sql/Reset for next command +select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history_long +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME stage/sql/starting stage/sql/Query end @@ -215,55 +260,96 @@ stage/sql/Query end stage/sql/Starting cleanup stage/sql/Freeing items stage/sql/Reset for next command -"=========================== Stages user 2" +########################### Stages user 2 - 1 +select /*2-1*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*2-1*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-1*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Stages user 3" +########################### Stages user 3 - 1 +select /*3-1*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Stages user 4" +########################### Stages user 4 - 1 +select /*4-1*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Waits user 1" +########################### Waits user 1 - 1 +select /*1-1*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*1-1*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history +where THREAD_ID = $con1_thread_id; has_waits 1 +select /*1-1*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long +where THREAD_ID = $con1_thread_id; has_waits 1 -"=========================== Waits user 2" +########################### Waits user 2 - 1 +select /*2-1*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*2-1*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-1*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Waits user 3" +########################### Waits user 3 - 1 +select /*3-1*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-1*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Waits user 4" +########################### Waits user 4 - 1 +select /*4-1*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-1*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -# Switch to connection default, disable consumers connection default; update performance_schema.setup_consumers set enabled='NO' where name like "%history%"; @@ -296,7 +382,6 @@ truncate table performance_schema.events_stages_history_long; truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; -# Switch to connection con1 connection con1; XA START 'XA_CON1', 'XA_BQUAL', 12; select "Hi from con1"; @@ -305,7 +390,6 @@ Hi from con1 XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; -# Switch to connection con2 connection con2; XA START 'XA_CON2', 'XA_BQUAL', 12; select "Hi from con2"; @@ -314,7 +398,6 @@ Hi from con2 XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; -# Switch to connection con3 connection con3; XA START 'XA_CON3', 'XA_BQUAL', 12; select "Hi from con3"; @@ -323,7 +406,6 @@ Hi from con3 XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; -# Switch to connection con4 connection con4; XA START 'XA_CON4', 'XA_BQUAL', 12; select "Hi from con4"; @@ -333,117 +415,212 @@ XA END 'XA_CON4', 'XA_BQUAL', 12; XA PREPARE 'XA_CON4', 'XA_BQUAL', 12; XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; connection default; -"=========================== Transactions user 1" +########################### Transactions user 1 - 2 +select /*1-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL +select /*1-2*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con1_thread_id; count(*) 0 +select /*1-2*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con1_thread_id; count(*) 0 -"=========================== Transactions user 2" +########################### Transactions user 2 - 2 +select /*2-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con2_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON2 XA_BQUAL +select /*2-2*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-2*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Transactions user 3" +########################### Transactions user 3 - 2 +select /*3-2*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Transactions user 4" +########################### Transactions user 4 - 2 +select /*4-2*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Statements user 1" +########################### Statements user 1 - 2 +select /*1-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 +select /*1-2*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con1_thread_id; count(*) 0 +select /*1-2*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con1_thread_id; count(*) 0 -"=========================== Statements user 2" +########################### Statements user 2 - 2 +select /*2-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON2', 'XA_BQUAL', 12 +select /*2-2*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-2*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Statements user 3" +########################### Statements user 3 - 2 +select /*3-2*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Statements user 4" +########################### Statements user 4 - 2 +select /*4-2*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Stages user 1" +########################### Stages user 1 - 2 +select /*1-2*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*1-2*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con1_thread_id; count(*) 0 +select /*1-2*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con1_thread_id; count(*) 0 -"=========================== Stages user 2" +########################### Stages user 2 - 2 +select /*2-2*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*2-2*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-2*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Stages user 3" +########################### Stages user 3 - 2 +select /*3-2*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Stages user 4" +########################### Stages user 4 - 2 +select /*4-2*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Waits user 1" +########################### Waits user 1 - 2 +select /*1-2*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history +where THREAD_ID = $con1_thread_id; has_waits 0 +select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history_long +where THREAD_ID = $con1_thread_id; has_waits 0 -"=========================== Waits user 2" +########################### Waits user 2 - 2 +select /*2-2*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*2-2*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-2*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Waits user 3" +########################### Waits user 3 - 2 +select /*3-2*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-2*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Waits user 4" +########################### Waits user 4 - 2 +select /*4-2*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-2*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -# Switch to connection default, enable consumers connection default; update performance_schema.setup_consumers set enabled='YES' where name like "%history%"; @@ -476,7 +653,6 @@ truncate table performance_schema.events_stages_history_long; truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; -# Switch to connection con1 connection con1; XA START 'XA_CON1', 'XA_BQUAL', 12; select "Hi from con1"; @@ -485,7 +661,6 @@ Hi from con1 XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; -# Switch to connection con2 connection con2; XA START 'XA_CON2', 'XA_BQUAL', 12; select "Hi from con2"; @@ -494,7 +669,6 @@ Hi from con2 XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; -# Switch to connection con3 connection con3; XA START 'XA_CON3', 'XA_BQUAL', 12; select "Hi from con3"; @@ -503,7 +677,6 @@ Hi from con3 XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; -# Switch to connection con4 connection con4; XA START 'XA_CON4', 'XA_BQUAL', 12; select "Hi from con4"; @@ -513,72 +686,124 @@ XA END 'XA_CON4', 'XA_BQUAL', 12; XA PREPARE 'XA_CON4', 'XA_BQUAL', 12; XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; connection default; -"=========================== Transactions user 1" +########################### Transactions user 1 - 3 +select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL +select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL +select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long +where THREAD_ID = $con1_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON1 XA_BQUAL -"=========================== Transactions user 2" +########################### Transactions user 2 - 3 +select /*2-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +where THREAD_ID = $con2_thread_id; XID_FORMAT_ID XID_GTRID XID_BQUAL 12 XA_CON2 XA_BQUAL +select /*2-3*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-3*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Transactions user 3" +########################### Transactions user 3 - 3 +select /*3-3*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Transactions user 4" +########################### Transactions user 4 - 3 +select /*4-3*/ count(*) from performance_schema.events_transactions_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_transactions_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_transactions_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Statements user 1" +########################### Statements user 1 - 3 +select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 +select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_start XA START 'XA_CON1', 'XA_BQUAL', 12 statement/sql/select select "Hi from con1" statement/sql/xa_end XA END 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_prepare XA PREPARE 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 +select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_start XA START 'XA_CON1', 'XA_BQUAL', 12 statement/sql/select select "Hi from con1" statement/sql/xa_end XA END 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_prepare XA PREPARE 'XA_CON1', 'XA_BQUAL', 12 statement/sql/xa_commit XA COMMIT 'XA_CON1', 'XA_BQUAL', 12 -"=========================== Statements user 2" +########################### Statements user 2 - 3 +select /*2-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME SQL_TEXT statement/sql/xa_commit XA COMMIT 'XA_CON2', 'XA_BQUAL', 12 +select /*2-3*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-3*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Statements user 3" +########################### Statements user 3 - 3 +select /*3-3*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Statements user 4" +########################### Statements user 4 - 3 +select /*4-3*/ count(*) from performance_schema.events_statements_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_statements_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_statements_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Stages user 1" +########################### Stages user 1 - 3 +select /*1-3*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME stage/sql/Starting cleanup stage/sql/Freeing items @@ -590,6 +815,8 @@ stage/sql/Query end stage/sql/Starting cleanup stage/sql/Freeing items stage/sql/Reset for next command +select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history_long +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME stage/sql/starting stage/sql/Query end @@ -633,55 +860,96 @@ stage/sql/Query end stage/sql/Starting cleanup stage/sql/Freeing items stage/sql/Reset for next command -"=========================== Stages user 2" +########################### Stages user 2 - 3 +select /*2-3*/ EVENT_NAME from performance_schema.events_stages_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME +select /*2-3*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-3*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Stages user 3" +########################### Stages user 3 - 3 +select /*3-3*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Stages user 4" +########################### Stages user 4 - 3 +select /*4-3*/ count(*) from performance_schema.events_stages_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_stages_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_stages_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -"=========================== Waits user 1" +########################### Waits user 1 - 3 +select /*1-3*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*1-3*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history +where THREAD_ID = $con1_thread_id; has_waits 1 +select /*1-3*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long +where THREAD_ID = $con1_thread_id; has_waits 1 -"=========================== Waits user 2" +########################### Waits user 2 - 3 +select /*2-3*/ EVENT_NAME from performance_schema.events_waits_current +where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; EVENT_NAME idle +select /*2-3*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con2_thread_id; count(*) 0 +select /*2-3*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con2_thread_id; count(*) 0 -"=========================== Waits user 3" +########################### Waits user 3 - 3 +select /*3-3*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con3_thread_id; count(*) 0 +select /*3-3*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con3_thread_id; count(*) 0 -"=========================== Waits user 4" +########################### Waits user 4 - 3 +select /*4-3*/ count(*) from performance_schema.events_waits_current +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_waits_history +where THREAD_ID = $con4_thread_id; count(*) 0 +select /*4-3*/ count(*) from performance_schema.events_waits_history_long +where THREAD_ID = $con4_thread_id; count(*) 0 -# Switch to connection default connection default; revoke all privileges, grant option from user1@localhost; revoke all privileges, grant option from user2@localhost; diff --git a/mysql-test/suite/perfschema/t/bad_option.test b/mysql-test/suite/perfschema/t/bad_option.test index 4feb0468e66..3eee669bdde 100644 --- a/mysql-test/suite/perfschema/t/bad_option.test +++ b/mysql-test/suite/perfschema/t/bad_option.test @@ -14,7 +14,7 @@ let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err; let SEARCH_FILE= $error_log; # Stop the server let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --shutdown_server --source include/wait_until_disconnected.inc --error 7 @@ -62,7 +62,7 @@ let SEARCH_PATTERN= Can.t change dir to .*bad_option_h_param; --remove_file $error_log # Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $restart_file +--write_line restart $restart_file # Turn on reconnect --enable_reconnect diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test index 79c23c65616..e8b9691fda5 100644 --- a/mysql-test/suite/perfschema/t/misc.test +++ b/mysql-test/suite/perfschema/t/misc.test @@ -175,6 +175,7 @@ DROP TABLE t_60905; # show global variables like "performance_schema_max_thread_instances"; +replace_result 512 256; explain select * from performance_schema.threads; # diff --git a/mysql-test/suite/perfschema/t/processlist_57.test b/mysql-test/suite/perfschema/t/processlist_57.test index 748d8b7402b..fe8898ed049 100644 --- a/mysql-test/suite/perfschema/t/processlist_57.test +++ b/mysql-test/suite/perfschema/t/processlist_57.test @@ -23,7 +23,7 @@ DROP TABLE performance_schema.processlist; SHOW CREATE TABLE performance_schema.processlist; let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --echo ## --echo ## Server shutdown --echo ## @@ -93,7 +93,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; --error ER_BAD_FIELD_ERROR SHOW PROCESSLIST; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --echo ## --echo ## Server shutdown --echo ## @@ -166,7 +166,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; # Works and returns no data, innodb table is empty. SHOW PROCESSLIST; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --echo ## --echo ## Server shutdown --echo ## @@ -231,7 +231,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; # Works and returns no data, innodb table is empty. SHOW PROCESSLIST; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --echo ## --echo ## Server shutdown --echo ## @@ -306,7 +306,7 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; --replace_column 3 [HOST:PORT] 6 [TIME] SHOW PROCESSLIST; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --echo ## --echo ## Server shutdown --echo ## diff --git a/mysql-test/suite/perfschema/t/setup_instruments_defaults.test b/mysql-test/suite/perfschema/t/setup_instruments_defaults.test index ea59cd4f266..bd33c559d9a 100644 --- a/mysql-test/suite/perfschema/t/setup_instruments_defaults.test +++ b/mysql-test/suite/perfschema/t/setup_instruments_defaults.test @@ -69,7 +69,7 @@ SELECT * FROM performance_schema.setup_instruments WHERE name like "%wait/io/table/sql/handler%"; # Write file to make mysql-test-run.pl wait for the server to stop ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Restart the server --echo # @@ -79,7 +79,7 @@ WHERE name like "%wait/io/table/sql/handler%"; --echo # Restart server with wait/io/table/sql/handler disabled ---exec echo "restart:--loose-performance-schema-instrument=%wait/io/table/sql/%=off" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line "restart:--loose-performance-schema-instrument=%wait/io/table/sql/%=off" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect # Turn on reconnect --echo # Enable reconnect diff --git a/mysql-test/suite/perfschema/t/statement_program_lost_inst.test b/mysql-test/suite/perfschema/t/statement_program_lost_inst.test index 023180b9d2b..0742043bba3 100644 --- a/mysql-test/suite/perfschema/t/statement_program_lost_inst.test +++ b/mysql-test/suite/perfschema/t/statement_program_lost_inst.test @@ -19,10 +19,10 @@ --source include/have_perfschema.inc let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; ---exec echo "wait" > $restart_file +--write_line wait $restart_file --shutdown_server --source include/wait_until_disconnected.inc ---exec echo "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360">$restart_file +--write_line "restart:--performance_schema_max_program_instances=7 --performance_schema_max_statement_stack=2 --thread_stack=655360" $restart_file --enable_reconnect --source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/perfschema/t/threads_history.test b/mysql-test/suite/perfschema/t/threads_history.test index f42dd6d0ab4..aee983339d2 100644 --- a/mysql-test/suite/perfschema/t/threads_history.test +++ b/mysql-test/suite/perfschema/t/threads_history.test @@ -23,7 +23,6 @@ flush privileges; select * from performance_schema.setup_consumers; ---echo # Switch to (con1, localhost, user1, , ) connect (con1, localhost, user1, , ); update performance_schema.threads @@ -33,7 +32,6 @@ update performance_schema.threads let $con1_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; ---echo # Switch to (con2, localhost, user2, , ) connect (con2, localhost, user2, , ); update performance_schema.threads @@ -43,7 +41,6 @@ update performance_schema.threads let $con2_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; ---echo # Switch to (con3, localhost, user3, , ) connect (con3, localhost, user3, , ); update performance_schema.threads @@ -53,7 +50,6 @@ update performance_schema.threads let $con3_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; ---echo # Switch to (con4, localhost, user4, , ) connect (con4, localhost, user4, , ); update performance_schema.threads @@ -63,7 +59,6 @@ update performance_schema.threads let $con4_thread_id= `select THREAD_ID from performance_schema.threads where PROCESSLIST_ID = connection_id()`; ---echo # Switch to connection default --connection default truncate table performance_schema.events_transactions_current; @@ -79,7 +74,6 @@ truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; ---echo # Switch to connection con1 --connection con1 XA START 'XA_CON1', 'XA_BQUAL', 12; @@ -88,7 +82,6 @@ XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; ---echo # Switch to connection con2 --connection con2 XA START 'XA_CON2', 'XA_BQUAL', 12; @@ -97,7 +90,6 @@ XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; ---echo # Switch to connection con3 --connection con3 XA START 'XA_CON3', 'XA_BQUAL', 12; @@ -106,7 +98,6 @@ XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; ---echo # Switch to connection con4 --connection con4 XA START 'XA_CON4', 'XA_BQUAL', 12; @@ -117,165 +108,150 @@ XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; --connection default ---disable_query_log +echo ########################### Transactions user 1 - 1; -echo "=========================== Transactions user 1"; - -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con1_thread_id; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history +evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history where THREAD_ID = $con1_thread_id; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long +evalp select /*1-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Transactions user 2"; +echo ########################### Transactions user 2 - 1; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*2-1*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*2-1*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*2-1*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Transactions user 3"; +echo ########################### Transactions user 3 - 1; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*3-1*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*3-1*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*3-1*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Transactions user 4"; +echo ########################### Transactions user 4 - 1; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*4-1*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*4-1*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*4-1*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Statements user 1"; +echo ########################### Statements user 1 - 1; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; -echo "=========================== Statements user 2"; +echo ########################### Statements user 2 - 1; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_statements_history +evalp select /*2-1*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-1*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*2-1*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Statements user 3"; +echo ########################### Statements user 3 - 1; -eval select count(*) from performance_schema.events_statements_current +evalp select /*3-1*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*3-1*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*3-1*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Statements user 4"; +echo ########################### Statements user 4 - 1; -eval select count(*) from performance_schema.events_statements_current +evalp select /*4-1*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*4-1*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*4-1*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Stages user 1"; +echo ########################### Stages user 1 - 1; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME from performance_schema.events_stages_history - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME from performance_schema.events_stages_history_long - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ EVENT_NAME from performance_schema.events_stages_history_long + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; -echo "=========================== Stages user 2"; +echo ########################### Stages user 2 - 1; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_stages_history +evalp select /*2-1*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-1*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*2-1*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Stages user 3"; +echo ########################### Stages user 3 - 1; -eval select count(*) from performance_schema.events_stages_current +evalp select /*3-1*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*3-1*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*3-1*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Stages user 4"; +echo ########################### Stages user 4 - 1; -eval select count(*) from performance_schema.events_stages_current +evalp select /*4-1*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*4-1*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*4-1*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Waits user 1"; +echo ########################### Waits user 1 - 1; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select (count(*) > 5) as has_waits from performance_schema.events_waits_history +evalp select /*1-1*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-1*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history where THREAD_ID = $con1_thread_id; -eval select (count(*) > 15) as has_waits from performance_schema.events_waits_history_long +evalp select /*1-1*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Waits user 2"; +echo ########################### Waits user 2 - 1; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_waits_history +evalp select /*2-1*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-1*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*2-1*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Waits user 3"; +echo ########################### Waits user 3 - 1; -eval select count(*) from performance_schema.events_waits_current +evalp select /*3-1*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*3-1*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*3-1*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Waits user 4"; +echo ########################### Waits user 4 - 1; -eval select count(*) from performance_schema.events_waits_current +evalp select /*4-1*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*4-1*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*4-1*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con4_thread_id; ---enable_query_log - ---echo # Switch to connection default, disable consumers --connection default update performance_schema.setup_consumers @@ -296,7 +272,6 @@ truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; ---echo # Switch to connection con1 --connection con1 XA START 'XA_CON1', 'XA_BQUAL', 12; @@ -305,7 +280,6 @@ XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; ---echo # Switch to connection con2 --connection con2 XA START 'XA_CON2', 'XA_BQUAL', 12; @@ -314,7 +288,6 @@ XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; ---echo # Switch to connection con3 --connection con3 XA START 'XA_CON3', 'XA_BQUAL', 12; @@ -323,7 +296,6 @@ XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; ---echo # Switch to connection con4 --connection con4 XA START 'XA_CON4', 'XA_BQUAL', 12; @@ -334,161 +306,150 @@ XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; --connection default ---disable_query_log +echo ########################### Transactions user 1 - 2; -echo "=========================== Transactions user 1"; - -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*1-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con1_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*1-2*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con1_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*1-2*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Transactions user 2"; +echo ########################### Transactions user 2 - 2; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*2-2*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*2-2*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*2-2*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Transactions user 3"; +echo ########################### Transactions user 3 - 2; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*3-2*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*3-2*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*3-2*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Transactions user 4"; +echo ########################### Transactions user 4 - 2; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*4-2*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*4-2*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*4-2*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Statements user 1"; +echo ########################### Statements user 1 - 2; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_statements_history +evalp select /*1-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-2*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con1_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*1-2*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Statements user 2"; +echo ########################### Statements user 2 - 2; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_statements_history +evalp select /*2-2*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-2*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*2-2*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Statements user 3"; +echo ########################### Statements user 3 - 2; -eval select count(*) from performance_schema.events_statements_current +evalp select /*3-2*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*3-2*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*3-2*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Statements user 4"; +echo ########################### Statements user 4 - 2; -eval select count(*) from performance_schema.events_statements_current +evalp select /*4-2*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*4-2*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*4-2*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Stages user 1"; +echo ########################### Stages user 1 - 2; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_stages_history +evalp select /*1-2*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-2*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con1_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*1-2*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Stages user 2"; +echo ########################### Stages user 2 - 2; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_stages_history +evalp select /*2-2*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-2*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*2-2*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Stages user 3"; +echo ########################### Stages user 3 - 2; -eval select count(*) from performance_schema.events_stages_current +evalp select /*3-2*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*3-2*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*3-2*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Stages user 4"; +echo ########################### Stages user 4 - 2; -eval select count(*) from performance_schema.events_stages_current +evalp select /*4-2*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*4-2*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*4-2*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Waits user 1"; +echo ########################### Waits user 1 - 2; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) as has_waits from performance_schema.events_waits_history +evalp select /*1-2*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history where THREAD_ID = $con1_thread_id; -eval select count(*) as has_waits from performance_schema.events_waits_history_long +evalp select /*1-2*/ count(*) as has_waits from performance_schema.events_waits_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Waits user 2"; +echo ########################### Waits user 2 - 2; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_waits_history +evalp select /*2-2*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-2*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*2-2*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Waits user 3"; +echo ########################### Waits user 3 - 2; -eval select count(*) from performance_schema.events_waits_current +evalp select /*3-2*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*3-2*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*3-2*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Waits user 4"; +echo ########################### Waits user 4 - 2; -eval select count(*) from performance_schema.events_waits_current +evalp select /*4-2*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*4-2*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*4-2*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con4_thread_id; ---enable_query_log - ---echo # Switch to connection default, enable consumers --connection default update performance_schema.setup_consumers @@ -509,7 +470,6 @@ truncate table performance_schema.events_waits_current; truncate table performance_schema.events_waits_history; truncate table performance_schema.events_waits_history_long; ---echo # Switch to connection con1 --connection con1 XA START 'XA_CON1', 'XA_BQUAL', 12; @@ -518,7 +478,6 @@ XA END 'XA_CON1', 'XA_BQUAL', 12; XA PREPARE 'XA_CON1', 'XA_BQUAL', 12; XA COMMIT 'XA_CON1', 'XA_BQUAL', 12; ---echo # Switch to connection con2 --connection con2 XA START 'XA_CON2', 'XA_BQUAL', 12; @@ -527,7 +486,6 @@ XA END 'XA_CON2', 'XA_BQUAL', 12; XA PREPARE 'XA_CON2', 'XA_BQUAL', 12; XA COMMIT 'XA_CON2', 'XA_BQUAL', 12; ---echo # Switch to connection con3 --connection con3 XA START 'XA_CON3', 'XA_BQUAL', 12; @@ -536,7 +494,6 @@ XA END 'XA_CON3', 'XA_BQUAL', 12; XA PREPARE 'XA_CON3', 'XA_BQUAL', 12; XA COMMIT 'XA_CON3', 'XA_BQUAL', 12; ---echo # Switch to connection con4 --connection con4 XA START 'XA_CON4', 'XA_BQUAL', 12; @@ -547,165 +504,150 @@ XA COMMIT 'XA_CON4', 'XA_BQUAL', 12; --connection default ---disable_query_log +echo ########################### Transactions user 1 - 3; -echo "=========================== Transactions user 1"; - -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con1_thread_id; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history +evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history where THREAD_ID = $con1_thread_id; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long +evalp select /*1-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Transactions user 2"; +echo ########################### Transactions user 2 - 3; -eval select XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current +evalp select /*2-3*/ XID_FORMAT_ID, XID_GTRID, XID_BQUAL from performance_schema.events_transactions_current where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*2-3*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*2-3*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Transactions user 3"; +echo ########################### Transactions user 3 - 3; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*3-3*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*3-3*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*3-3*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Transactions user 4"; +echo ########################### Transactions user 4 - 3; -eval select count(*) from performance_schema.events_transactions_current +evalp select /*4-3*/ count(*) from performance_schema.events_transactions_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history +evalp select /*4-3*/ count(*) from performance_schema.events_transactions_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_transactions_history_long +evalp select /*4-3*/ count(*) from performance_schema.events_transactions_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Statements user 1"; +echo ########################### Statements user 1 - 3; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_history_long + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; -echo "=========================== Statements user 2"; +echo ########################### Statements user 2 - 3; -eval select EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_statements_history +evalp select /*2-3*/ EVENT_NAME, SQL_TEXT from performance_schema.events_statements_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-3*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*2-3*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Statements user 3"; +echo ########################### Statements user 3 - 3; -eval select count(*) from performance_schema.events_statements_current +evalp select /*3-3*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*3-3*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*3-3*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Statements user 4"; +echo ########################### Statements user 4 - 3; -eval select count(*) from performance_schema.events_statements_current +evalp select /*4-3*/ count(*) from performance_schema.events_statements_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history +evalp select /*4-3*/ count(*) from performance_schema.events_statements_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_statements_history_long +evalp select /*4-3*/ count(*) from performance_schema.events_statements_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Stages user 1"; +echo ########################### Stages user 1 - 3; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME from performance_schema.events_stages_history - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select EVENT_NAME from performance_schema.events_stages_history_long - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ EVENT_NAME from performance_schema.events_stages_history_long + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; -echo "=========================== Stages user 2"; +echo ########################### Stages user 2 - 3; -eval select EVENT_NAME from performance_schema.events_stages_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_stages_history +evalp select /*2-3*/ EVENT_NAME from performance_schema.events_stages_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-3*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*2-3*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Stages user 3"; +echo ########################### Stages user 3 - 3; -eval select count(*) from performance_schema.events_stages_current +evalp select /*3-3*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*3-3*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*3-3*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Stages user 4"; +echo ########################### Stages user 4 - 3; -eval select count(*) from performance_schema.events_stages_current +evalp select /*4-3*/ count(*) from performance_schema.events_stages_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history +evalp select /*4-3*/ count(*) from performance_schema.events_stages_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_stages_history_long +evalp select /*4-3*/ count(*) from performance_schema.events_stages_history_long where THREAD_ID = $con4_thread_id; -echo "=========================== Waits user 1"; +echo ########################### Waits user 1 - 3; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con1_thread_id - order by THREAD_ID, EVENT_ID; -eval select (count(*) > 5) as has_waits from performance_schema.events_waits_history +evalp select /*1-3*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con1_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*1-3*/ (count(*) > 5) as has_waits from performance_schema.events_waits_history where THREAD_ID = $con1_thread_id; -eval select (count(*) > 15) as has_waits from performance_schema.events_waits_history_long +evalp select /*1-3*/ (count(*) > 15) as has_waits from performance_schema.events_waits_history_long where THREAD_ID = $con1_thread_id; -echo "=========================== Waits user 2"; +echo ########################### Waits user 2 - 3; -eval select EVENT_NAME from performance_schema.events_waits_current - where THREAD_ID = $con2_thread_id - order by THREAD_ID, EVENT_ID; -eval select count(*) from performance_schema.events_waits_history +evalp select /*2-3*/ EVENT_NAME from performance_schema.events_waits_current + where THREAD_ID = $con2_thread_id order by THREAD_ID, EVENT_ID; +evalp select /*2-3*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con2_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*2-3*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con2_thread_id; -echo "=========================== Waits user 3"; +echo ########################### Waits user 3 - 3; -eval select count(*) from performance_schema.events_waits_current +evalp select /*3-3*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*3-3*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con3_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*3-3*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con3_thread_id; -echo "=========================== Waits user 4"; +echo ########################### Waits user 4 - 3; -eval select count(*) from performance_schema.events_waits_current +evalp select /*4-3*/ count(*) from performance_schema.events_waits_current where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history +evalp select /*4-3*/ count(*) from performance_schema.events_waits_history where THREAD_ID = $con4_thread_id; -eval select count(*) from performance_schema.events_waits_history_long +evalp select /*4-3*/ count(*) from performance_schema.events_waits_history_long where THREAD_ID = $con4_thread_id; ---enable_query_log - ---echo # Switch to connection default --connection default revoke all privileges, grant option from user1@localhost; diff --git a/mysql-test/suite/roles/definer.result b/mysql-test/suite/roles/definer.result index 0ff6a67b966..08e72193bf9 100644 --- a/mysql-test/suite/roles/definer.result +++ b/mysql-test/suite/roles/definer.result @@ -280,6 +280,7 @@ a b c 111 4 0 2 20 200 delete from t1 where a=111; +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result index 83c7a916c13..361838927e9 100644 --- a/mysql-test/suite/rpl/r/parallel_backup.result +++ b/mysql-test/suite/rpl/r/parallel_backup.result @@ -125,7 +125,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; @@ -168,7 +168,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; diff --git a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result index e1fd7701fcc..08955a77291 100644 --- a/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result +++ b/mysql-test/suite/rpl/r/parallel_backup_lsu_off.result @@ -128,7 +128,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; @@ -171,7 +171,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; diff --git a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result index 9e29e5a3875..bb00bf9cbf5 100644 --- a/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result +++ b/mysql-test/suite/rpl/r/parallel_backup_slave_binlog_off.result @@ -128,7 +128,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; @@ -171,7 +171,7 @@ include/save_master_gtid.inc connection slave; SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; -SET @@global.innodb_lock_wait_timeout =1; +SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; include/start_slave.inc connection aux_slave; diff --git a/mysql-test/suite/rpl/r/rpl_domain_id_filter_restart.result b/mysql-test/suite/rpl/r/rpl_domain_id_filter_restart.result index f6eff3f9efc..948b4f48737 100644 --- a/mysql-test/suite/rpl/r/rpl_domain_id_filter_restart.result +++ b/mysql-test/suite/rpl/r/rpl_domain_id_filter_restart.result @@ -21,8 +21,9 @@ INSERT INTO t2 VALUES(1); SELECT * FROM t2; i 1 +include/save_master_gtid.inc connection slave; -connection slave; +include/sync_with_master_gtid.inc SELECT * FROM t1; i 1 diff --git a/mysql-test/suite/rpl/r/rpl_gtid_header_valid.result b/mysql-test/suite/rpl/r/rpl_gtid_header_valid.result new file mode 100644 index 00000000000..6731abc27b7 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_header_valid.result @@ -0,0 +1,146 @@ +include/master-slave.inc +[connection master] +# +# Initialize test data +connection master; +create table t1 (a int) engine=innodb; +include/save_master_gtid.inc +set @@SESSION.debug_dbug= "+d,binlog_force_commit_id"; +connection slave; +set SQL_LOG_BIN= 0; +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594'); +set SQL_LOG_BIN= 1; +include/sync_with_master_gtid.inc +include/stop_slave.inc +include/start_slave.inc +# +# Test FL_PREPARED_XA +connection master; +set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid"; +set @commit_id= 100; +XA START 'x1'; +insert into t1 values (1); +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid"; +XA COMMIT 'x1'; +include/save_master_gtid.inc +# Waiting for slave to find invalid event.. +connection slave; +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +# Reset master binlogs (as there is an invalid event) and slave state +connection master; +RESET MASTER; +connection slave; +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +include/start_slave.inc +# +# Test FL_COMPLETED_XA +connection master; +set @commit_id= 101; +XA START 'x1'; +insert into t1 values (2); +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid"; +XA COMMIT 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid"; +include/save_master_gtid.inc +# Waiting for slave to find invalid event.. +connection slave; +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +# Cleanup hanging XA PREPARE on slave +set statement SQL_LOG_BIN=0 for XA COMMIT 'x1'; +# Reset master binlogs (as there is an invalid event) and slave state +connection master; +RESET MASTER; +connection slave; +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +include/start_slave.inc +# +# Test Missing xid.data (but has format id and length description parts) +connection master; +set @commit_id= 101; +XA START 'x1'; +insert into t1 values (1); +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "+d,negate_xid_data_from_gtid"; +XA COMMIT 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_data_from_gtid"; +include/save_master_gtid.inc +# Waiting for slave to find invalid event.. +connection slave; +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +# Cleanup hanging XA PREPARE on slave +set statement SQL_LOG_BIN=0 for XA COMMIT 'x1'; +# Reset master binlogs (as there is an invalid event) and slave state +connection master; +RESET MASTER; +connection slave; +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +include/start_slave.inc +# +# Test FL_EXTRA_MULTI_ENGINE +connection master; +set @old_dbug= @@SESSION.debug_dbug; +set @@SESSION.debug_dbug= "+d,inject_fl_extra_multi_engine_into_gtid"; +set @commit_id= 102; +insert into t1 values (3); +include/save_master_gtid.inc +set @@SESSION.debug_dbug=@old_dbug; +connection slave; +# Waiting for slave to find invalid event.. +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +# Reset master binlogs (as there is an invalid event) and slave state +connection master; +RESET MASTER; +connection slave; +RESET SLAVE; +RESET MASTER; +set @@global.gtid_slave_pos=""; +include/start_slave.inc +# +# Test FL_COMMIT_ALTER +connection master; +set @old_dbug= @@SESSION.debug_dbug; +set @@SESSION.debug_dbug= "+d,negate_alter_fl_from_gtid"; +set @old_alter_tp= @@SESSION.binlog_alter_two_phase; +set @@SESSION.binlog_alter_two_phase= 1; +alter table t1 add column (nc int); +include/save_master_gtid.inc +set @@SESSION.debug_dbug=@old_dbug; +set @@SESSION.binlog_alter_two_phase=@old_alter_tp; +connection slave; +# Waiting for slave to find invalid event.. +include/wait_for_slave_sql_error.inc [errno=1594] +STOP SLAVE IO_THREAD; +# Reset master binlogs (as there is an invalid event) and slave state +connection master; +RESET MASTER; +connection slave; +SET STATEMENT sql_log_bin=0 FOR alter table t1 add column (nc int); +RESET SLAVE; +RESET MASTER; +set @@global.gtid_slave_pos=""; +include/start_slave.inc +# +# Cleanup +connection master; +drop table t1; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +include/rpl_end.inc +# End of rpl_gtid_header_valid.test diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result index ae0050c353a..e8633cd45bb 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result @@ -111,6 +111,10 @@ a 6 7 *** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable +connection server_1; +INSERT INTO t1 VALUES (8); +DELETE FROM t1 WHERE a=8; +connection server_2; connection server_2; include/stop_slave.inc CHANGE MASTER TO master_use_gtid= no; diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result index 2a578245400..c9baf960d9a 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result @@ -1,8 +1,9 @@ -connect master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; -connect slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK; +include/master-slave.inc +[connection master] connection master; reset master; connection slave; +include/stop_slave.inc set @restore_slave_net_timeout= @@global.slave_net_timeout; set @@global.slave_net_timeout= 10; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; @@ -68,5 +69,5 @@ connection master; drop table t1; connection slave; set @@global.slave_net_timeout= @restore_slave_net_timeout; -include/stop_slave.inc +include/rpl_end.inc End of tests diff --git a/mysql-test/suite/rpl/r/rpl_mdev33798.result b/mysql-test/suite/rpl/r/rpl_mdev33798.result new file mode 100644 index 00000000000..8796e948546 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_mdev33798.result @@ -0,0 +1,143 @@ +include/rpl_init.inc [topology=1->2,1->3] +connect server_2b,127.0.0.1,root,,,$SERVER_MYPORT_2; +connection server_2; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET @old_timeout= @@GLOBAL.lock_wait_timeout; +SET @old_innodb_timeout= @@GLOBAL.innodb_lock_wait_timeout; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=5; +set global slave_parallel_mode= aggressive; +SET GLOBAL lock_wait_timeout= 86400; +SET GLOBAL innodb_lock_wait_timeout= 86400; +SET STATEMENT sql_log_bin=0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +include/start_slave.inc +connection server_1; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0); +connection server_2; +include/stop_slave.inc +connection server_2b; +BEGIN; +SELECT * FROM t1 WHERE a=1 FOR UPDATE; +a b +1 0 +SELECT * FROM t1 WHERE a=5 FOR UPDATE; +a b +5 0 +connection server_1; +SET SESSION gtid_domain_id= 1; +BEGIN; +UPDATE t1 SET b=1 WHERE a=1; +UPDATE t1 SET b=1 WHERE a=7; +COMMIT; +UPDATE t1 SET b=2 WHERE a=3; +SET SESSION gtid_domain_id=2; +BEGIN; +UPDATE t1 SET b=3 WHERE a=5; +UPDATE t1 SET b=3 WHERE a=3; +COMMIT; +UPDATE t1 SET b=4 WHERE a=7; +SET SESSION gtid_domain_id= 0; +include/save_master_gtid.inc +connection server_2; +include/start_slave.inc +connection server_2b; +ROLLBACK; +connection server_2; +include/sync_with_master_gtid.inc +SELECT a, ( +(a=1 AND b=1) OR +(a=3 AND (b=2 OR b=3)) OR +(a=5 AND b=3) OR +(a=7 AND (b=1 OR b=4)) OR +((a MOD 2)=0 AND b=0)) AS `ok` + FROM t1 +ORDER BY a; +a ok +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +connection server_3; +include/sync_with_master_gtid.inc +include/stop_slave.inc +connection server_2; +include/stop_slave.inc +CHANGE MASTER 'm2' to master_port=MYPORT_3 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; +connection server_1; +SET SESSION gtid_domain_id= 1; +BEGIN; +UPDATE t1 SET b=11 WHERE a=1; +UPDATE t1 SET b=11 WHERE a=7; +COMMIT; +UPDATE t1 SET b=12 WHERE a=3; +SET SESSION gtid_domain_id= 1; +connection server_3; +SET SESSION gtid_domain_id=3; +BEGIN; +UPDATE t1 SET b=13 WHERE a=5; +UPDATE t1 SET b=13 WHERE a=3; +COMMIT; +UPDATE t1 SET b=14 WHERE a=7; +include/save_master_gtid.inc +connection server_2b; +BEGIN; +SELECT * FROM t1 WHERE a=1 FOR UPDATE; +a b +1 1 +SELECT * FROM t1 WHERE a=5 FOR UPDATE; +a b +5 3 +START ALL SLAVES; +Warnings: +Note 1937 SLAVE 'm2' started +Note 1937 SLAVE '' started +connection server_2b; +ROLLBACK; +connection server_1; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +connection server_3; +include/save_master_gtid.inc +connection server_2; +include/sync_with_master_gtid.inc +SELECT a, ( +(a=1 AND b=11) OR +(a=3 AND (b=12 OR b=13)) OR +(a=5 AND b=13) OR +(a=7 AND (b=11 OR b=14)) OR +((a MOD 2)=0 AND b=0)) AS `ok` + FROM t1 +ORDER BY a; +a ok +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +SET default_master_connection = 'm2'; +include/stop_slave.inc +RESET SLAVE 'm2' ALL; +SET default_master_connection = ''; +connection server_3; +include/start_slave.inc +disconnect server_2b; +connection server_1; +DROP TABLE t1; +connection server_2; +include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +set global slave_parallel_mode= @old_parallel_mode; +SET GLOBAL lock_wait_timeout= @old_timeout; +SET GLOBAL innodb_lock_wait_timeout= @old_innodb_timeout; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result b/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result index 1172d8e39a9..740d1ddfcfa 100644 --- a/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result +++ b/mysql-test/suite/rpl/r/rpl_mysql_manager_race_condition.result @@ -17,6 +17,36 @@ include/sync_with_master_gtid.inc include/rpl_restart_server.inc [server_number=2 parameters: --debug_dbug="+d,delay_start_handle_manager"] include/start_slave.inc # +# MDEV-33799 +# Ensure that when the binary log is used for recovery (as tc log), that +# the recovery process cannot start the binlog background thread before +# the mysql handle manager has started. +connection slave; +# Add test suppresssions so crash recovery messages don't fail the test +set session sql_log_bin=0; +call mtr.add_suppression("mariadbd: Got error '145.*"); +call mtr.add_suppression("Checking table:.*"); +call mtr.add_suppression("mysql.gtid_slave_pos:.*hasn't closed the table properly"); +call mtr.add_suppression("Can't init tc log"); +call mtr.add_suppression("Aborting"); +set session sql_log_bin=1; +# Create slave-side only table +create table t2 (a int) engine=innodb; +# Crash mariadbd when binlogging transaction to corrupt database state +connection slave1; +set @@session.debug_dbug="+d,crash_before_writing_xid"; +insert into t2 values (1); +connection slave; +connection slave1; +Got one of the listed errors +# Restart mariadbd in recovery mode. Note --tc-heuristic-recover +# forces mysqld to exit with error, so we run mariadbd via CLI +# MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT +connection server_2; +connection slave1; +connection slave; +include/start_slave.inc +# # Cleanup # connection master; @@ -24,4 +54,5 @@ drop table t1; include/save_master_gtid.inc connection slave; include/sync_with_master_gtid.inc +drop table t2; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_multi_domain_xa.result b/mysql-test/suite/rpl/r/rpl_parallel_multi_domain_xa.result new file mode 100644 index 00000000000..1993d09895a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_multi_domain_xa.result @@ -0,0 +1,58 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +call mtr.add_suppression("WSREP: handlerton rollback failed"); +connection master; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +connection slave; +include/stop_slave.inc +SET @old_transaction_retries = @@GLOBAL.slave_transaction_retries; +SET @@global.slave_transaction_retries = 1000; +SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads; +SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads; +SET @@global.slave_parallel_threads = 5; +SET @@global.slave_domain_parallel_threads = 3; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +CHANGE MASTER TO master_use_gtid=slave_pos; +connection master; +CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0); +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @@global.slave_parallel_mode ='optimistic'; +connection master; +include/save_master_gtid.inc +connection slave; +include/start_slave.inc +include/sync_with_master_gtid.inc +include/stop_slave.inc +connection master; +include/save_master_gtid.inc +connection slave; +SET @@global.slave_parallel_mode ='conservative'; +include/start_slave.inc +include/sync_with_master_gtid.inc +include/stop_slave.inc +include/save_master_gtid.inc +connection slave; +SET @@global.slave_parallel_mode = 'optimistic'; +include/start_slave.inc +include/sync_with_master_gtid.inc +include/diff_tables.inc [master:t1, slave:t1] +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_mode = @old_parallel_mode; +SET @@global.slave_parallel_threads = @old_parallel_threads; +SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads; +SET @@global.slave_transaction_retries = @old_transaction_retries; +include/start_slave.inc +connection master; +DROP TABLE t1; +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +connection master; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result index e349353ac59..75012c93f3b 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result @@ -34,7 +34,7 @@ connection server_2; LOCK TABLES t1 WRITE; include/start_slave.inc connection slave; -# Waiting for replica to resume the delay for the transaction +# Waiting for replica to get blocked by the table lock # Sleeping 1s to increment SBM # Ensuring Seconds_Behind_Master increases after sleeping.. # ..done diff --git a/mysql-test/suite/rpl/r/rpl_parallel_seq.result b/mysql-test/suite/rpl/r/rpl_parallel_seq.result index 8f55f52e54c..02287d54e33 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_seq.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_seq.result @@ -127,4 +127,14 @@ CREATE SEQUENCE s4; DROP SEQUENCE s2,s3,s4; DROP TABLE ti; connection slave; +connection master; +CREATE SEQUENCE s; +SELECT NEXTVAL(s); +NEXTVAL(s) +1 +flush binary logs; +DROP SEQUENCE s; +DROP SEQUENCE s; +connection slave; +connection master; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result b/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result index ba131ea094f..6b75dbf6181 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result @@ -206,10 +206,12 @@ RETURN x; END || SET sql_log_bin=1; +include/stop_slave_io.inc connection server_1; INSERT INTO t3 VALUES (49,0); connection server_2; -START SLAVE SQL_THREAD; +CHANGE MASTER TO master_use_gtid=no; +include/start_slave.inc SELECT * FROM t3 WHERE a >= 40 ORDER BY a; a b 41 41 @@ -239,10 +241,6 @@ SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; include/start_slave.inc *** 3. Same as (2), but not using gtid mode *** -connection server_2; -include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; -include/start_slave.inc connection server_1; connection con_temp3; SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; diff --git a/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result b/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result index 5720f647b90..1734b2004dc 100644 --- a/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result +++ b/mysql-test/suite/rpl/r/rpl_rewrite_db_sys_vars.result @@ -12,11 +12,9 @@ select @@session.server_id; create database replica_db1; create database y; create database test_replica; -SELECT @@GLOBAL.replicate_rewrite_db; -@@GLOBAL.replicate_rewrite_db -primary_db1->replica_db1,x->y -# Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... -# ...success +SELECT @@GLOBAL.replicate_rewrite_db, 'primary_db1->replica_db1,x->y' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS'; +@@GLOBAL.replicate_rewrite_db Replicate_Rewrite_DB from SHOW SLAVE STATUS +primary_db1->replica_db1,x->y primary_db1->replica_db1,x->y # Create DBs and tables on primary connection master; create database primary_db1; @@ -60,15 +58,13 @@ SELECT @@GLOBAL.replicate_rewrite_db; @@GLOBAL.replicate_rewrite_db primary_db1->replica_db1,x->y SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; -SELECT @@GLOBAL.replicate_rewrite_db; -@@GLOBAL.replicate_rewrite_db -test_master->test_replica SHOW DATABASES like 'test_replica'; Database (test_replica) test_replica include/start_slave.inc -# Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... -# ...success +SELECT @@GLOBAL.replicate_rewrite_db, 'test_master->test_replica' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS'; +@@GLOBAL.replicate_rewrite_db Replicate_Rewrite_DB from SHOW SLAVE STATUS +test_master->test_replica test_master->test_replica # Create DB and tables on primary connection master; create database test_master; @@ -94,6 +90,8 @@ t 3 include/diff_tables.inc [master:test_master.my_table,slave:test_replica.my_table] # Update of values on primary for DB not set in replication_rewrite_db +include/stop_slave.inc +include/reset_slave.inc connection master; use x; insert into my_table values (314); @@ -104,8 +102,6 @@ t 314 include/save_master_gtid.inc connection slave; -include/stop_slave.inc -include/reset_slave.inc include/start_slave.inc SELECT @@GLOBAL.replicate_rewrite_db; @@GLOBAL.replicate_rewrite_db diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result index ca7c802bfbe..49fdb485c50 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result @@ -44,7 +44,9 @@ SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; connection server_2; include/wait_for_slave_param.inc [Slave_SQL_Running_State] include/stop_slave.inc -include/assert.inc [Table t1 should have 2 rows.] +select count(*) 'on slave must be 2' from t1; +on slave must be 2 +2 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-1-4 @@ -52,7 +54,9 @@ SELECT @@GLOBAL.gtid_current_pos; connection server_1; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. -include/assert.inc [Table t1 should have 1 rows.] +select count(*) 'on master must be 1' from t1; +on master must be 1 +1 FOUND 1 /truncated binlog file:.*master.*000001/ in mysqld.1.err disconnect conn_client; connection server_2; @@ -79,9 +83,9 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value gtid_slave_pos 0-1-4 connection server_1; -SELECT COUNT(*) = 3 as 'true' FROM t1; -true -1 +SELECT COUNT(*) 'must be 3' FROM t1; +must be 3 +3 # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value @@ -113,18 +117,22 @@ connection server_2; #================================================================= connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,; SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; +SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync WAIT_FOR con1_go1"; SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100)); connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; -SET GLOBAL debug_dbug="d,Notify_binlog_EOF"; +SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL con1_go"; +SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con2_ready"; INSERT INTO t1 VALUES (5, REPEAT("x", 4100)); connection server_2; -SET DEBUG_SYNC= "now WAIT_FOR eof_reached"; +SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; # Kill the server connection server_1; include/wait_for_slave_param.inc [Slave_SQL_Running_State] include/stop_slave.inc -include/assert.inc [Table t1 should have 5 rows.] +select count(*) 'on slave must be 5' from t1; +on slave must be 5 +5 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-2-7 @@ -132,7 +140,9 @@ SELECT @@GLOBAL.gtid_current_pos; connection server_2; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. -include/assert.inc [Table t1 should have 3 rows.] +select count(*) 'on master must be 3' from t1; +on master must be 3 +3 FOUND 1 /truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6/ in mysqld.2.err disconnect conn_client; connection server_1; @@ -159,9 +169,9 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value gtid_slave_pos 0-2-7 connection server_2; -SELECT COUNT(*) = 6 as 'true' FROM t1; -true -1 +SELECT COUNT(*) 'must be 6 as' FROM t1; +must be 6 as +6 # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value @@ -205,7 +215,9 @@ SET DEBUG_SYNC= "now WAIT_FOR con3_ready"; connection server_2; include/wait_for_slave_param.inc [Slave_SQL_Running_State] include/stop_slave.inc -include/assert.inc [Table t1 should have 7 rows.] +select count(*) 'on slave must be 7' from t1; +on slave must be 7 +7 SELECT @@GLOBAL.gtid_current_pos; @@GLOBAL.gtid_current_pos 0-1-9 @@ -213,7 +225,9 @@ SELECT @@GLOBAL.gtid_current_pos; connection server_1; # Ensuring variable rpl_semi_sync_slave_enabled is ON.. # Ensuring status rpl_semi_sync_slave_status is OFF.. -include/assert.inc [Table t1 should have 6 rows.] +select count(*) 'on master must be 6' from t1; +on master must be 6 +6 FOUND 1 /truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9/ in mysqld.1.err disconnect conn_client; connection server_2; @@ -242,9 +256,9 @@ Variable_name Value gtid_slave_pos 0-1-9 connection server_1; include/sync_with_master_gtid.inc -SELECT COUNT(*) = 8 as 'true' FROM t1; -true -1 +SELECT COUNT(*) 'must be 8' FROM t1; +must be 8 +8 # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; Variable_name Value diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result index 6124ba01679..8803b4c3392 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result @@ -4,7 +4,7 @@ connection master; SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; connection slave; include/stop_slave.inc -SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1; +SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1; include/start_slave.inc connection master; CREATE TABLE t1 (a INT); @@ -21,7 +21,6 @@ connection slave; include/wait_for_slave_sql_to_start.inc include/wait_for_slave_io_to_start.inc connection master; -SET @@GLOBAL.debug_dbug=""; SET @@GLOBAL. rpl_semi_sync_master_enabled = 0; connection master; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result b/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result index a8e158a25e4..3048b6b5635 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_shutdown_await_ack.result @@ -505,8 +505,8 @@ disconnect con1; connection default; connection con2; SHUTDOWN WAIT FOR ALL SLAVES; -connection server_2; -include/assert_grep.inc [Ensure the primary waited for the ACK of the killed thread] +# Ensure the primary waited for the ACK of the killed thread +FOUND 5 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err connection default; connection server_1; connection server_2; diff --git a/mysql-test/suite/rpl/r/rpl_shutdown_sighup.result b/mysql-test/suite/rpl/r/rpl_shutdown_sighup.result new file mode 100644 index 00000000000..01b35f1dc58 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_shutdown_sighup.result @@ -0,0 +1,50 @@ +include/master-slave.inc +[connection master] +connection slave; +set statement sql_log_bin=0 for call mtr.add_suppression("Signal handler thread did not exit in a timely manner"); +# +# Main test +connection master; +create table t1 (a int); +insert into t1 values (1); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +set @@global.debug_dbug= "+d,hold_sighup_log_refresh"; +# Waiting for sighup to reach reload_acl_and_cache.. +set debug_sync="now wait_for in_reload_acl_and_cache"; +# Signalling signal handler to proceed to sleep before REFRESH_HOSTS +set debug_sync="now signal refresh_logs"; +# Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache) +shutdown; +connection server_2; +connection slave; +include/assert_grep.inc [Ensure Mariadbd did not segfault when shutting down] +connection master; +connection slave; +# +# Error testcase to ensure an error message is shown if the signal +# takes longer than the timeout while processing the SIGHUP +connection slave; +set @@global.debug_dbug= "+d,force_sighup_processing_timeout"; +set @@global.debug_dbug= "+d,hold_sighup_log_refresh"; +connection master; +insert into t1 values (1); +include/save_master_gtid.inc +connection slave; +include/sync_with_master_gtid.inc +# Waiting for sighup to reach reload_acl_and_cache.. +set debug_sync="now wait_for in_reload_acl_and_cache"; +# Signalling signal handler to proceed to sleep before REFRESH_HOSTS +set debug_sync="now signal refresh_logs"; +# Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache) +shutdown; +connection server_2; +connection slave; +include/assert_grep.inc [Ensure warning is issued that signal handler thread is still processing] +# +# Cleanup +connection master; +drop table t1; +include/rpl_end.inc +# End of rpl_shutdown_sighup.test diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index eb6324ff987..03fc8a7836f 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -122,6 +122,31 @@ connection slave; # Slave_skipped_errros = 5 **** We cannot execute a select as there are differences in the **** behavior between STMT and RBR. +**** +**** Ensure transactions which are skipped due to encountering a +**** non-deadlock error which is present in --slave-skip-errors result +**** in partially committed transactions +connection master; +CREATE TABLE t3 (a INT UNIQUE) ENGINE=InnoDB; +connection slave; +connection slave; +INSERT INTO t3 VALUES (3); +connection master; +BEGIN; +INSERT INTO t3 VALUES (1); +INSERT INTO t3 VALUES (2); +INSERT INTO t3 VALUES (3); +INSERT INTO t3 VALUES (4); +COMMIT; +connection slave; +**** Master and slave tables should have the same data, due to the +**** partially replicated transaction's data overlapping with the data +**** that pre-existed on the slave. That is, despite the transaction +**** consisting of 4 statements, the errored statement should be ignored +**** and the other 3 should commit successfully. +include/diff_tables.inc [master:t3,slave:t3] +connection master; +DROP TABLE t3; ==== Clean Up ==== connection master; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_options.result b/mysql-test/suite/rpl/r/rpl_start_alter_options.result index 30854b12be1..c150c18ad80 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_options.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_options.result @@ -369,8 +369,6 @@ connection master; alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant; alter table t1 add index if not exists index_1(f), force , algorithm=instant; alter table t1 disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option alter table t1 enable keys, force , algorithm=copy; Warnings: Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option @@ -460,8 +458,6 @@ connection master; alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy; alter table t1 add index if not exists index_1(f), force , algorithm=nocopy; alter table t1 disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option alter table t1 enable keys, force , algorithm=copy; Warnings: Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option diff --git a/mysql-test/suite/rpl/r/rpl_temporary_error2_skip_all.result b/mysql-test/suite/rpl/r/rpl_temporary_error2_skip_all.result new file mode 100644 index 00000000000..9819aafa5cf --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_temporary_error2_skip_all.result @@ -0,0 +1,64 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +*** Provoke a deadlock on the slave, check that transaction retry succeeds. *** +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +INSERT INTO t1(a) VALUES (1), (2), (3), (4), (5); +connection slave; +SELECT * FROM t1 ORDER BY a; +a b +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +SET sql_log_bin=0; +ALTER TABLE t2 ENGINE=MyISAM; +SET sql_log_bin=1; +connect con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,; +connection con_temp1; +BEGIN; +UPDATE t1 SET b=2 WHERE a=4; +INSERT INTO t2 VALUES (2); +DELETE FROM t2 WHERE a=2; +connection master; +BEGIN; +UPDATE t1 SET b=1 WHERE a=2; +INSERT INTO t2 VALUES (1); +UPDATE t1 SET b=1 WHERE a=4; +COMMIT; +connection slave; +connection con_temp1; +UPDATE t1 SET b=2 WHERE a=2; +SELECT * FROM t1 WHERE a<10 ORDER BY a; +a b +1 NULL +2 2 +3 NULL +4 2 +5 NULL +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +connection slave; +SELECT * FROM t1 ORDER BY a; +a b +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +* There will be one row in t2 because the ignored deadlock does not retry. +SELECT * FROM t2 ORDER BY a; +a +1 +retries +0 +Last_SQL_Errno = '0' +Last_SQL_Error = '' +connection master; +DROP TABLE t1; +DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa.inc b/mysql-test/suite/rpl/t/parallel_backup_xa.inc index 83a6fb79345..5f287aa0ca6 100644 --- a/mysql-test/suite/rpl/t/parallel_backup_xa.inc +++ b/mysql-test/suite/rpl/t/parallel_backup_xa.inc @@ -41,7 +41,7 @@ if ($slave_ooo_error) { SET @sav_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout; SET @sav_slave_transaction_retries = @@global.slave_transaction_retries; - SET @@global.innodb_lock_wait_timeout =1; + SET @@global.innodb_lock_wait_timeout =5; SET @@global.slave_transaction_retries=0; } --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test index 2ce273860fe..19074ce9a84 100644 --- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test +++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_master_crash.test @@ -42,7 +42,7 @@ insert into ti set a=null; insert into tm set a=null; set @@global.debug_dbug="+d,crash_before_send_xid"; ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect connection slave; let $do_domain_ids_before= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1); @@ -64,7 +64,7 @@ connection master; --enable_reconnect --let $rpl_server_number=1 --source include/rpl_start_server.inc -#--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +#--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --echo # Master has restarted successfully save_master_pos; diff --git a/mysql-test/suite/rpl/t/rpl_domain_id_filter_restart.test b/mysql-test/suite/rpl/t/rpl_domain_id_filter_restart.test index 8083b8f232f..38cbbdec7f3 100644 --- a/mysql-test/suite/rpl/t/rpl_domain_id_filter_restart.test +++ b/mysql-test/suite/rpl/t/rpl_domain_id_filter_restart.test @@ -35,9 +35,10 @@ SET @@session.gtid_domain_id= 1; INSERT INTO t2 VALUES(1); SELECT * FROM t2; -sync_slave_with_master; +source include/save_master_gtid.inc; connection slave; +source include/sync_with_master_gtid.inc; SELECT * FROM t1; SELECT * FROM t2; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt index 69c1a64e388..5b3fb44c910 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt @@ -1 +1 @@ ---master-retry-count=100 +--master-retry-count=100 --slave-net-timeout=10 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_header_valid.test b/mysql-test/suite/rpl/t/rpl_gtid_header_valid.test new file mode 100644 index 00000000000..d4d75ba8928 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_header_valid.test @@ -0,0 +1,213 @@ +# +# This test ensures that, when a GTID event is constructed by reading its +# content from a binlog file, the reader (e.g. replica, in this test) cannot +# read beyond the length of the GTID event. That is, we ensure that the +# structure indicated by its flags and extra_flags are consistent with the +# actual content of the event. +# +# To spoof a broken GTID log event, we use the DEBUG_DBUG mechanism to inject +# the master to write invalid GTID events for each flag. The transaction is +# given a commit id to ensure the event is not shorter than GTID_HEADER_LEN, +# which would result in zero padding up to GTID_HEADER_LEN. +# +# +# References: +# MDEV-33672: Gtid_log_event Construction from File Should Ensure Event +# Length When Using Extra Flags +# + +--source include/have_debug.inc + +# GTID event extra_flags are format independent +--source include/have_binlog_format_row.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--echo # +--echo # Initialize test data +--connection master +create table t1 (a int) engine=innodb; +--source include/save_master_gtid.inc +set @@SESSION.debug_dbug= "+d,binlog_force_commit_id"; + +--connection slave +set SQL_LOG_BIN= 0; +call mtr.add_suppression('Found invalid event in binary log'); +call mtr.add_suppression('Slave SQL.*Relay log read failure: Could not parse relay log event entry.* 1594'); +set SQL_LOG_BIN= 1; +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +--source include/start_slave.inc +--let $cid_ctr= 100 + + +--echo # +--echo # Test FL_PREPARED_XA +--connection master +set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid"; +--eval set @commit_id= $cid_ctr + +XA START 'x1'; +insert into t1 values (1); +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid"; +XA COMMIT 'x1'; +--source include/save_master_gtid.inc + +--echo # Waiting for slave to find invalid event.. +--connection slave +let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE +source include/wait_for_slave_sql_error.inc; +STOP SLAVE IO_THREAD; + +--echo # Reset master binlogs (as there is an invalid event) and slave state +--connection master +RESET MASTER; +--connection slave +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +--source include/start_slave.inc + + +--echo # +--echo # Test FL_COMPLETED_XA +--connection master +--inc $cid_ctr +--eval set @commit_id= $cid_ctr +XA START 'x1'; +--let $next_val = `SELECT max(a)+1 FROM t1` +--eval insert into t1 values ($next_val) +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "+d,negate_xid_from_gtid"; +XA COMMIT 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_from_gtid"; +--source include/save_master_gtid.inc + +--echo # Waiting for slave to find invalid event.. +--connection slave +let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE +source include/wait_for_slave_sql_error.inc; +STOP SLAVE IO_THREAD; + +--echo # Cleanup hanging XA PREPARE on slave +set statement SQL_LOG_BIN=0 for XA COMMIT 'x1'; + +--echo # Reset master binlogs (as there is an invalid event) and slave state +--connection master +RESET MASTER; +--connection slave +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +--source include/start_slave.inc + + +--echo # +--echo # Test Missing xid.data (but has format id and length description parts) + +--connection master +--eval set @commit_id= $cid_ctr + +XA START 'x1'; +insert into t1 values (1); +XA END 'x1'; +XA PREPARE 'x1'; +set @@SESSION.debug_dbug= "+d,negate_xid_data_from_gtid"; +XA COMMIT 'x1'; +set @@SESSION.debug_dbug= "-d,negate_xid_data_from_gtid"; +--source include/save_master_gtid.inc + +--echo # Waiting for slave to find invalid event.. +--connection slave +let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE +source include/wait_for_slave_sql_error.inc; +STOP SLAVE IO_THREAD; + +--echo # Cleanup hanging XA PREPARE on slave +set statement SQL_LOG_BIN=0 for XA COMMIT 'x1'; + +--echo # Reset master binlogs (as there is an invalid event) and slave state +--connection master +RESET MASTER; +--connection slave +RESET MASTER; +RESET SLAVE; +set @@global.gtid_slave_pos=""; +--source include/start_slave.inc + + +--echo # +--echo # Test FL_EXTRA_MULTI_ENGINE +--connection master +set @old_dbug= @@SESSION.debug_dbug; +set @@SESSION.debug_dbug= "+d,inject_fl_extra_multi_engine_into_gtid"; +--inc $cid_ctr +--eval set @commit_id= $cid_ctr +--let $next_val = `SELECT max(a)+1 FROM t1` +--eval insert into t1 values ($next_val) +--source include/save_master_gtid.inc +set @@SESSION.debug_dbug=@old_dbug; + +--connection slave +--echo # Waiting for slave to find invalid event.. +let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE +source include/wait_for_slave_sql_error.inc; +STOP SLAVE IO_THREAD; + +--echo # Reset master binlogs (as there is an invalid event) and slave state +--connection master +RESET MASTER; + +--connection slave +RESET SLAVE; +RESET MASTER; +set @@global.gtid_slave_pos=""; +--source include/start_slave.inc + + +--echo # +--echo # Test FL_COMMIT_ALTER +--connection master +set @old_dbug= @@SESSION.debug_dbug; +set @@SESSION.debug_dbug= "+d,negate_alter_fl_from_gtid"; +set @old_alter_tp= @@SESSION.binlog_alter_two_phase; +set @@SESSION.binlog_alter_two_phase= 1; +alter table t1 add column (nc int); +--source include/save_master_gtid.inc +set @@SESSION.debug_dbug=@old_dbug; +set @@SESSION.binlog_alter_two_phase=@old_alter_tp; + +--connection slave +--echo # Waiting for slave to find invalid event.. +let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE +source include/wait_for_slave_sql_error.inc; +STOP SLAVE IO_THREAD; + +--echo # Reset master binlogs (as there is an invalid event) and slave state +--connection master +RESET MASTER; + +--connection slave +# Just to keep tables consistent between master/slave +SET STATEMENT sql_log_bin=0 FOR alter table t1 add column (nc int); +RESET SLAVE; +RESET MASTER; +set @@global.gtid_slave_pos=""; +--source include/start_slave.inc + + +--echo # +--echo # Cleanup + +--connection master +drop table t1; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--source include/rpl_end.inc +--echo # End of rpl_gtid_header_valid.test 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 b5ff294908b..acce6651b8d 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -173,6 +173,24 @@ SELECT * FROM t1 ORDER BY a; --echo *** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable +# In GTID mode, the old-style replication position is also updated. But during +# GTID connect, the old-style position is not known until receiving the fake +# GTID list event, which contains the required position value. If we happened +# to stop the slave above before this fake GTID list event, the test could fail +# with duplicate key errors due to switching to non-GTID mode at a wrong +# position too far back in the binlog. +# +# Work-around this by injecting an extra dummt event and syncing the slave to +# it, ensuring the old-style position will be updated. +# +# This work-around could be removed after MDEV-33996 is fixed. +--connection server_1 +INSERT INTO t1 VALUES (8); +DELETE FROM t1 WHERE a=8; +--save_master_pos +--connection server_2 +--sync_with_master + --connection server_2 --source include/stop_slave.inc CHANGE MASTER TO master_use_gtid= no; diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test index e4753b7be07..8a852fd3abf 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test @@ -8,14 +8,13 @@ # - SHOW STATUS like 'Slave_heartbeat_period' report -- source include/have_log_bin.inc - -connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); -connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); +-- source include/master-slave.inc connection master; reset master; connection slave; +-- source include/stop_slave.inc set @restore_slave_net_timeout= @@global.slave_net_timeout; --disable_warnings set @@global.slave_net_timeout= 10; @@ -170,6 +169,5 @@ set @@global.slave_net_timeout= @restore_slave_net_timeout; --disable_prepare_warnings ---source include/stop_slave.inc - +--source include/rpl_end.inc --echo End of tests diff --git a/mysql-test/suite/rpl/t/rpl_mdev33798.cnf b/mysql-test/suite/rpl/t/rpl_mdev33798.cnf new file mode 100644 index 00000000000..8e5125ea6ca --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mdev33798.cnf @@ -0,0 +1,17 @@ +!include suite/rpl/my.cnf + +[mysqld.1] +log-slave-updates +loose-innodb + +[mysqld.2] +log-slave-updates +loose-innodb + +[mysqld.3] +log-slave-updates +loose-innodb + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_mdev33798.test b/mysql-test/suite/rpl/t/rpl_mdev33798.test new file mode 100644 index 00000000000..1448ed91133 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_mdev33798.test @@ -0,0 +1,182 @@ +--source include/have_innodb.inc +--source include/have_log_bin.inc +--let $rpl_topology=1->2,1->3 +--source include/rpl_init.inc +--connect (server_2b,127.0.0.1,root,,,$SERVER_MYPORT_2) + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET @old_timeout= @@GLOBAL.lock_wait_timeout; +SET @old_innodb_timeout= @@GLOBAL.innodb_lock_wait_timeout; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=5; +set global slave_parallel_mode= aggressive; +# High timeout so we get replication sync error and test failure if the +# conflict handling is insufficient and lock wait timeout occurs. +SET GLOBAL lock_wait_timeout= 86400; +SET GLOBAL innodb_lock_wait_timeout= 86400; +SET STATEMENT sql_log_bin=0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +--source include/start_slave.inc + +--connection server_1 +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +# Test the following scenario: +# +# Transactions T1, T2 in domain 1, U1, U2 in domain 2. +# Wait cycle T1->U2->U1->T2->T1 as follows: +# T1 row lock wait on U2 +# U2 wait_for_prior_commit on U1 +# U1 row lock wait on T2 +# T2 wait_for_prior_commit on T1 +# +# Test that the wait cycle is broken correctly with deadlock kill. + +--connection server_2b +# Temporarily block T1 and U1. +BEGIN; +SELECT * FROM t1 WHERE a=1 FOR UPDATE; +SELECT * FROM t1 WHERE a=5 FOR UPDATE; + +--connection server_1 + +SET SESSION gtid_domain_id= 1; +# T1 in domain 1 +BEGIN; +UPDATE t1 SET b=1 WHERE a=1; +UPDATE t1 SET b=1 WHERE a=7; +COMMIT; +# T2 in domain 1 +UPDATE t1 SET b=2 WHERE a=3; + +SET SESSION gtid_domain_id=2; +# U1 in domain 2 +BEGIN; +UPDATE t1 SET b=3 WHERE a=5; +UPDATE t1 SET b=3 WHERE a=3; +COMMIT; +# U2 in domain 2 +UPDATE t1 SET b=4 WHERE a=7; +SET SESSION gtid_domain_id= 0; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +# Wait until T2, U2 are holding the row locks. +--let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state LIKE '%Waiting for prior transaction to commit%' +--source include/wait_condition.inc + +# Then let T1, U1 continue to conflict on the row locks, and check that +# replication correctly handles the conflict. +--connection server_2b +ROLLBACK; + +--connection server_2 +--source include/sync_with_master_gtid.inc + +# Allow either domain to "win" on the conflicting updates. +SELECT a, ( + (a=1 AND b=1) OR + (a=3 AND (b=2 OR b=3)) OR + (a=5 AND b=3) OR + (a=7 AND (b=1 OR b=4)) OR + ((a MOD 2)=0 AND b=0)) AS `ok` + FROM t1 + ORDER BY a; + +# Now try the same thing with multi-source replication. + +# Make server_3 a second master +--connection server_3 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc + +--connection server_2 +--source include/stop_slave.inc +--replace_result $SERVER_MYPORT_3 MYPORT_3 +eval CHANGE MASTER 'm2' to master_port=$SERVER_MYPORT_3 , master_host='127.0.0.1', master_user='root', master_use_gtid=slave_pos; + +--connection server_1 + +SET SESSION gtid_domain_id= 1; +# T1 in domain 1 +BEGIN; +UPDATE t1 SET b=11 WHERE a=1; +UPDATE t1 SET b=11 WHERE a=7; +COMMIT; +# T2 in domain 1 +UPDATE t1 SET b=12 WHERE a=3; +SET SESSION gtid_domain_id= 1; + +--connection server_3 +SET SESSION gtid_domain_id=3; +# U1 in domain 3 +BEGIN; +UPDATE t1 SET b=13 WHERE a=5; +UPDATE t1 SET b=13 WHERE a=3; +COMMIT; +# U2 in domain 3 +UPDATE t1 SET b=14 WHERE a=7; +--source include/save_master_gtid.inc + +--connection server_2b +# Temporarily block T1 and U1. +BEGIN; +SELECT * FROM t1 WHERE a=1 FOR UPDATE; +SELECT * FROM t1 WHERE a=5 FOR UPDATE; + +START ALL SLAVES; +# Wait until T2, U2 are holding the row locks. +--let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state LIKE '%Waiting for prior transaction to commit%' +--source include/wait_condition.inc + +--connection server_2b +ROLLBACK; + +--connection server_1 +--source include/save_master_gtid.inc +--connection server_2 +--source include/sync_with_master_gtid.inc +--connection server_3 +--source include/save_master_gtid.inc +--connection server_2 +--source include/sync_with_master_gtid.inc + +SELECT a, ( + (a=1 AND b=11) OR + (a=3 AND (b=12 OR b=13)) OR + (a=5 AND b=13) OR + (a=7 AND (b=11 OR b=14)) OR + ((a MOD 2)=0 AND b=0)) AS `ok` + FROM t1 + ORDER BY a; + +SET default_master_connection = 'm2'; +--source include/stop_slave.inc +RESET SLAVE 'm2' ALL; +SET default_master_connection = ''; + +--connection server_3 +--source include/start_slave.inc + +# Cleanup + +--disconnect server_2b +--connection server_1 +DROP TABLE t1; +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +set global slave_parallel_mode= @old_parallel_mode; +SET GLOBAL lock_wait_timeout= @old_timeout; +SET GLOBAL innodb_lock_wait_timeout= @old_innodb_timeout; +--source include/start_slave.inc + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test index 751da3158b7..dd4a0fbbc99 100644 --- a/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test +++ b/mysql-test/suite/rpl/t/rpl_mysql_manager_race_condition.test @@ -18,8 +18,14 @@ # associated with this test should enforce that the binlog background thread is # not created before the handle manager is initialized. # +# Addendum 1) This test is extended for MDEV-33799, as the original fix +# left out the possibility that the binlog background thread can be +# started during recovery if the binary log is used as the transaction +# coordinator. This resulted in similar segfaults as seen by MDEV-26473. +# # References: # MDEV-26473 mysqld got exception 0xc0000005 (rpl_slave_state/rpl_load_gtid_slave_state) +# MDEV-33799 mysql_manager_submit Segfault at Startup Still Possible During Recovery # --source include/have_debug.inc @@ -53,6 +59,63 @@ create table t1 (a int); --source include/start_slave.inc +--echo # +--echo # MDEV-33799 +--echo # Ensure that when the binary log is used for recovery (as tc log), that +--echo # the recovery process cannot start the binlog background thread before +--echo # the mysql handle manager has started. +--connection slave + +--echo # Add test suppresssions so crash recovery messages don't fail the test +set session sql_log_bin=0; +call mtr.add_suppression("mariadbd: Got error '145.*"); +call mtr.add_suppression("Checking table:.*"); +call mtr.add_suppression("mysql.gtid_slave_pos:.*hasn't closed the table properly"); +call mtr.add_suppression("Can't init tc log"); +call mtr.add_suppression("Aborting"); +set session sql_log_bin=1; + +--echo # Create slave-side only table +create table t2 (a int) engine=innodb; + +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +wait +EOF + +--echo # Crash mariadbd when binlogging transaction to corrupt database state +--connection slave1 +set @@session.debug_dbug="+d,crash_before_writing_xid"; +--send insert into t2 values (1) + +--connection slave +--source include/wait_until_disconnected.inc + +--connection slave1 +--error 2013,ER_CONNECTION_KILLED +--reap + +--echo # Restart mariadbd in recovery mode. Note --tc-heuristic-recover +--echo # forces mysqld to exit with error, so we run mariadbd via CLI +--echo # MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT +--error 1 +--exec $MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +restart +EOF + +--connection server_2 +--enable_reconnect +--source include/wait_until_connected_again.inc +--connection slave1 +--enable_reconnect +--source include/wait_until_connected_again.inc +--connection slave +--enable_reconnect +--source include/wait_until_connected_again.inc +--source include/start_slave.inc + + --echo # --echo # Cleanup --echo # @@ -63,5 +126,6 @@ drop table t1; --connection slave --source include/sync_with_master_gtid.inc +drop table t2; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test index c5d2b85cf34..c34c4f20dc0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test @@ -300,7 +300,7 @@ SET GLOBAL slave_parallel_threads=10; # Find the thread id of the driver SQL thread that we want to kill. --let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' --source include/wait_condition.inc ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%relay log%'` SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; SET GLOBAL slave_parallel_max_queued=9000; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_multi_domain_xa.test b/mysql-test/suite/rpl/t/rpl_parallel_multi_domain_xa.test new file mode 100644 index 00000000000..f17634d4df8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_multi_domain_xa.test @@ -0,0 +1,181 @@ +# Similar to rpl_parallel_optimistic_xa to verify XA +# parallel execution with multiple gtid domain. +# References: +# MDEV-33668 Adapt parallel slave's round-robin scheduling to XA events + +--source include/have_innodb.inc +--source include/have_perfschema.inc +--source include/master-slave.inc + +# Tests' global declarations +--let $trx = _trx_ +--let $slave_timeout= -1 + +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +call mtr.add_suppression("WSREP: handlerton rollback failed"); + +--connection master +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +--save_master_pos + +# Prepare to restart slave into optimistic parallel mode +--connection slave +--sync_with_master +--source include/stop_slave.inc +# This test runs huge number of transactions independently in parallel that +# all conflict on a single row. This requires a large number of retries, as a +# transaction can repeatedly conflict/deadlock with a large number of other +# transactions (in a different domain) one by one. +SET @old_transaction_retries = @@GLOBAL.slave_transaction_retries; +SET @@global.slave_transaction_retries = 1000; +SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads; +SET @old_slave_domain_parallel_threads = @@GLOBAL.slave_domain_parallel_threads; +SET @@global.slave_parallel_threads = 5; +SET @@global.slave_domain_parallel_threads = 3; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; + +CHANGE MASTER TO master_use_gtid=slave_pos; + +--connection master +CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0); +--source include/save_master_gtid.inc + +--connection slave +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc + +--let $mode = 2 +# mode = 2 is optimistic +SET @@global.slave_parallel_mode ='optimistic'; +while ($mode) +{ + --connection master + # + # create XA events alternating gtid domains to run them in parallel on slave. + # + --let $domain_num = 3 + --let $trx_num = 777 + --let $i = $trx_num + --let $conn = master + --disable_query_log + while($i > 0) + { + --let $domain_id = `SELECT $i % $domain_num` + --eval set @@gtid_domain_id = $domain_id + # 'decision' to commit 0, or rollback 1 + --let $decision = `SELECT $i % 2` + --eval XA START '$conn$trx$i' + --eval UPDATE t1 SET b = 1 - 2 * $decision WHERE a = 1 + --eval XA END '$conn$trx$i' + --eval XA PREPARE '$conn$trx$i' + --let $term = COMMIT + if ($decision) + { + --let $term = ROLLBACK + } + --eval XA $term '$conn$trx$i' + + --dec $i + } + --enable_query_log + --source include/save_master_gtid.inc + + --connection slave + if (`select $mode = 1`) + { + SET @@global.slave_parallel_mode ='conservative'; + } + --source include/start_slave.inc + --source include/sync_with_master_gtid.inc + --source include/stop_slave.inc + + --dec $mode +} + + +# Generations test. +# Create few ranges of XAP groups length of greater than +# 3 * slave_parallel_threads + 1 +# terminated upon each range. +--let $iter = 3 +--let $generation_len = @@global.slave_parallel_threads +--let $domain_num = 3 +--disable_query_log +--connection master +while ($iter) +{ + --let $k = `select 3 * 3 * $generation_len` + --let $_k = $k + while ($k) + { + --source include/count_sessions.inc + --connect(con$k,localhost,root,,) + # + # create XA events alternating gtid domains to run them in parallel on slave. + # + --let $domain_id = `SELECT $k % $domain_num` + --eval set @@gtid_domain_id = $domain_id + --eval XA START '$trx$k' + --eval INSERT INTO t1 VALUES ($k + 1, $iter) + --eval XA END '$trx$k' + --eval XA PREPARE '$trx$k' + + --disconnect con$k + --connection master + --source include/wait_until_count_sessions.inc + + --dec $k + } + + --connection master + --let $k = $_k + while ($k) + { + --let $term = COMMIT + --let $decision = `SELECT $k % 2` + if ($decision) + { + --let $term = ROLLBACK + } + --eval XA $term '$trx$k' + } + --dec $iter +} +--enable_query_log +--source include/save_master_gtid.inc + +--connection slave +SET @@global.slave_parallel_mode = 'optimistic'; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + + +# +# Overall consistency check +# +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc + + +# +# Clean up. +# +--connection slave +--source include/stop_slave.inc +SET @@global.slave_parallel_mode = @old_parallel_mode; +SET @@global.slave_parallel_threads = @old_parallel_threads; +SET @@global.slave_domain_parallel_threads = @old_slave_domain_parallel_threads; +SET @@global.slave_transaction_retries = @old_transaction_retries; +--source include/start_slave.inc + +--connection master +DROP TABLE t1; +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +--connection master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test index 9c502ff6cb9..90753caf143 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test @@ -1,9 +1,9 @@ # # Ensure that Seconds_Behind_Master works correctly on the parallel replica. # ---source include/master-slave.inc --source include/have_log_bin.inc --source include/have_debug.inc +--source include/master-slave.inc --echo # --echo # MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel Replicas @@ -77,8 +77,8 @@ LOCK TABLES t1 WRITE; --source include/start_slave.inc --connection slave ---echo # Waiting for replica to resume the delay for the transaction ---let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; +--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 --echo # Sleeping 1s to increment SBM diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test index b1b15412b16..cc361a7b35b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_seq.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -195,4 +195,22 @@ DROP TABLE ti; --sync_slave_with_master +# MDEV-31779 server crash in Rows_log_event::update_sequence at replaying binlog +--connection master +--let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1) +CREATE SEQUENCE s; +--disable_ps2_protocol +SELECT NEXTVAL(s); +--enable_ps2_protocol +flush binary logs; +DROP SEQUENCE s; +--exec $MYSQL_BINLOG $datadir/$binlog_file | $MYSQL test +DROP SEQUENCE s; + +--sync_slave_with_master + +--connection master + + --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test index efb998b0443..94f19a6cdd7 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test @@ -295,13 +295,14 @@ CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) || --delimiter ; SET sql_log_bin=1; - +--source include/stop_slave_io.inc --connection server_1 INSERT INTO t3 VALUES (49,0); --save_master_pos --connection server_2 -START SLAVE SQL_THREAD; +CHANGE MASTER TO master_use_gtid=no; +--source include/start_slave.inc --sync_with_master SELECT * FROM t3 WHERE a >= 40 ORDER BY a; # Restore the foo() function. @@ -334,11 +335,6 @@ SET GLOBAL slave_parallel_threads=10; --echo *** 3. Same as (2), but not using gtid mode *** ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; ---source include/start_slave.inc - --connection server_1 # Set up three transactions on the master that will be group-committed # together so they can be replicated in parallel on the slave. diff --git a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test index acca2f6954c..b6a8ccb545c 100644 --- a/mysql-test/suite/rpl/t/rpl_relay_max_extension.test +++ b/mysql-test/suite/rpl/t/rpl_relay_max_extension.test @@ -47,7 +47,7 @@ RESET SLAVE; --echo # --let $datadir = `select @@datadir` ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --shutdown_server 10 --source include/wait_until_disconnected.inc @@ -64,7 +64,7 @@ RESET SLAVE; --echo # Restart slave server --echo # ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --enable_reconnect --source include/wait_until_connected_again.inc SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads; diff --git a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test index 27710063792..fab78a9293b 100644 --- a/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test +++ b/mysql-test/suite/rpl/t/rpl_rewrite_db_sys_vars.test @@ -19,15 +19,8 @@ create database replica_db1; create database y; # This DB will be rewrited from test case create database test_replica; -SELECT @@GLOBAL.replicate_rewrite_db; let $rewrite_db_sss= query_get_value(SHOW SLAVE STATUS, Replicate_Rewrite_DB, 1); ---echo # Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... -if (`SELECT strcmp(@@global.replicate_rewrite_db, "$rewrite_db_sss") != 0`) -{ - die SHOW SLAVE STATUS Replicate_Rewrite_DB value $rewrite_db_sss does not match variable @@GLOBAL.replicate_rewrite_db; -} ---echo # ...success - +eval SELECT @@GLOBAL.replicate_rewrite_db, '$rewrite_db_sss' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS'; --echo # Create DBs and tables on primary connection master; @@ -63,16 +56,10 @@ source include/stop_slave.inc; SET @save_replicate_rewrite_db = @@GLOBAL.replicate_rewrite_db; SELECT @@GLOBAL.replicate_rewrite_db; SET @@GLOBAL.replicate_rewrite_db="test_master->test_replica"; -SELECT @@GLOBAL.replicate_rewrite_db; SHOW DATABASES like 'test_replica'; source include/start_slave.inc; let $rewrite_db_sss= query_get_value(SHOW SLAVE STATUS, Replicate_Rewrite_DB, 1); ---echo # Ensuring SHOW SLAVE STATUS produces correct value for Replicate_Rewrite_DB... -if (`SELECT strcmp(@@global.replicate_rewrite_db, "$rewrite_db_sss") != 0`) -{ - die SHOW SLAVE STATUS Replicate_Rewrite_DB value $rewrite_db_sss does not match variable @@GLOBAL.replicate_rewrite_db; -} ---echo # ...success +eval SELECT @@GLOBAL.replicate_rewrite_db, '$rewrite_db_sss' as 'Replicate_Rewrite_DB from SHOW SLAVE STATUS'; --echo # Create DB and tables on primary connection master; @@ -101,6 +88,9 @@ select * from test_replica.my_table; --source include/diff_tables.inc --echo # Update of values on primary for DB not set in replication_rewrite_db +--source include/stop_slave.inc +--source include/reset_slave.inc + connection master; use x; insert into my_table values (314); @@ -108,9 +98,6 @@ select * from my_table; --source include/save_master_gtid.inc connection slave; ---let $rpl_only_running_threads=1 ---source include/stop_slave.inc ---source include/reset_slave.inc --source include/start_slave.inc SELECT @@GLOBAL.replicate_rewrite_db; --source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc index b092d0018b0..bb705d390ac 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc @@ -34,14 +34,16 @@ if ($case == 1) if ($case == 2) { SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; + SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync WAIT_FOR con1_go1"; --send_eval $query_to_crash --connect (conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) # use the same signal with $query_to_crash SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; - SET GLOBAL debug_dbug="d,Notify_binlog_EOF"; + SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL con1_go"; + SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con2_ready"; --send_eval $query2_to_crash --connection server_$server_to_crash - SET DEBUG_SYNC= "now WAIT_FOR eof_reached"; + SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; --source include/kill_mysqld.inc } @@ -68,9 +70,7 @@ source include/wait_for_slave_param.inc; --error 2003 --source include/stop_slave.inc ---let $assert_cond= COUNT(*) = $expected_rows_on_slave FROM t1 ---let $assert_text= Table t1 should have $expected_rows_on_slave rows. ---source include/assert.inc +--eval select count(*) 'on slave must be $expected_rows_on_slave' from t1 SELECT @@GLOBAL.gtid_current_pos; @@ -95,9 +95,7 @@ if (`SELECT strcmp("OFF", "$slave_semi_sync_status") != 0`) --die Slave started with skip-slave-start yet started with rpl_semi_sync_slave_status=ON } ---let $assert_cond= COUNT(*) = $expected_rows_on_master FROM t1 ---let $assert_text= Table t1 should have $expected_rows_on_master rows. ---source include/assert.inc +--eval select count(*) 'on master must be $expected_rows_on_master' from t1 # Check error log for correct messages. let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.$server_to_crash.err; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test index e1e7a4f1de3..e4d0bc0acd1 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test @@ -83,7 +83,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_1 --sync_with_master ---eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1 +--eval SELECT COUNT(*) 'must be $rows_so_far' FROM t1 --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; @@ -134,7 +134,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_2 --sync_with_master ---eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1 +--eval SELECT COUNT(*) 'must be $rows_so_far as' FROM t1 --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; @@ -185,7 +185,7 @@ SHOW VARIABLES LIKE 'gtid_slave_pos'; --connection server_1 --source include/sync_with_master_gtid.inc ---eval SELECT COUNT(*) = $rows_so_far as 'true' FROM t1 +--eval SELECT COUNT(*) 'must be $rows_so_far' FROM t1 --echo # ... the gtid states on the slave: SHOW VARIABLES LIKE 'gtid_slave_pos'; SHOW VARIABLES LIKE 'gtid_binlog_pos'; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test index 05e6fcca143..d653d84c3b4 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test @@ -4,19 +4,17 @@ # finishes off as specified in particular trying to connect even to a shut down # master for a semisync firewell routine. -source include/not_embedded.inc; -source include/have_debug.inc; source include/master-slave.inc; --connection master ---let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled ` +--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled` SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; --connection slave source include/stop_slave.inc; ---let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled ` -SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1; +--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled` +SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1; source include/start_slave.inc; --connection master @@ -52,7 +50,6 @@ source include/rpl_start_server.inc; #--source include/start_slave.inc --connection master -SET @@GLOBAL.debug_dbug=""; --eval SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master --connection master diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test index c321f2bf72f..4ed9ca0aa7c 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_shutdown_await_ack.test @@ -206,7 +206,6 @@ SET GLOBAL debug_dbug="+d,simulate_delay_semisync_slave_reply"; --echo # Wait for thd to begin semi-sync wait.. --let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = 'Waiting for semi-sync ACK from slave' --source include/wait_condition.inc ---source include/wait_condition.inc --echo # ..done --disconnect con1 @@ -220,15 +219,10 @@ EOF SHUTDOWN WAIT FOR ALL SLAVES; --source include/wait_until_disconnected.inc -# Run assert_grep on server_2 as it uses SQL commands for verification, but -# server_1 has gone away ---connection server_2 ---let $assert_text= Ensure the primary waited for the ACK of the killed thread ---let $assert_select= Delaying shutdown to await semi-sync ACK ---let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err ---let $assert_count= 5 ---let $assert_only_after=CURRENT_TEST ---source include/assert_grep.inc +--echo # Ensure the primary waited for the ACK of the killed thread +--let $SEARCH_PATTERN= Delaying shutdown to await semi-sync ACK +--let $SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err +--source include/search_pattern_in_file.inc --connection default --source include/wait_until_disconnected.inc diff --git a/mysql-test/suite/rpl/t/rpl_shutdown_sighup.test b/mysql-test/suite/rpl/t/rpl_shutdown_sighup.test new file mode 100644 index 00000000000..d1940f81a85 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_shutdown_sighup.test @@ -0,0 +1,154 @@ +# +# The signal handler thread can use various different runtime resources when +# processing a SIGHUP (e.g. master-info information), as the logic calls into +# reload_acl_and_cache(). This test ensures that SIGHUP processing, when +# concurrent with server shutdown, the shutdown logic must wait for the SIGHUP +# processing to finish before cleaning up any resources. +# +# Additionally, the error case is tested such that the signal handler thread +# takes too long processing a SIGHUP, and the main mysqld thread must skip its +# wait and output a warning. +# +# Note the SIGHUP is sent via the command-line kill program via a perl script. +# +# References: +# MDEV-30260: Slave crashed:reload_acl_and_cache during shutdown +# + +--source include/not_windows.inc +--source include/not_embedded.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +# Binlog format doesn't matter +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +# For error test case which forces timeout +--connection slave +set statement sql_log_bin=0 for call mtr.add_suppression("Signal handler thread did not exit in a timely manner"); + + +--echo # +--echo # Main test +--connection master +create table t1 (a int); +insert into t1 values (1); +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +# Make signal handler handle SIGHUP.. +set @@global.debug_dbug= "+d,hold_sighup_log_refresh"; +--let KILL_NODE_PIDFILE = `SELECT @@pid_file` +--perl + my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'}; + my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; + my $mysqld_pid = `cat $pid_filename`; + chomp($mysqld_pid); + system("kill -HUP $mysqld_pid"); + exit(0); +EOF + +--echo # Waiting for sighup to reach reload_acl_and_cache.. +set debug_sync="now wait_for in_reload_acl_and_cache"; +--echo # Signalling signal handler to proceed to sleep before REFRESH_HOSTS +set debug_sync="now signal refresh_logs"; + +# ..while we are shutting down +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +wait +EOF +--echo # Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache) +shutdown; + +--source include/wait_until_disconnected.inc +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +restart: --skip-slave-start=0 +EOF + +--connection server_2 +--enable_reconnect +--source include/wait_until_connected_again.inc + +--connection slave +--enable_reconnect +--source include/wait_until_connected_again.inc + +--let $assert_text= Ensure Mariadbd did not segfault when shutting down +--let $assert_select= got signal 11 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_count= 0 +--let $assert_only_after = CURRENT_TEST: rpl.rpl_shutdown_sighup +--source include/assert_grep.inc + +--connection master +--sync_slave_with_master + + +--echo # +--echo # Error testcase to ensure an error message is shown if the signal +--echo # takes longer than the timeout while processing the SIGHUP + +--connection slave +set @@global.debug_dbug= "+d,force_sighup_processing_timeout"; +set @@global.debug_dbug= "+d,hold_sighup_log_refresh"; + +--connection master +insert into t1 values (1); +--source include/save_master_gtid.inc + +--connection slave +--source include/sync_with_master_gtid.inc + +# Make signal handler handle SIGHUP.. +--let KILL_NODE_PIDFILE = `SELECT @@pid_file` +--perl + my $kill_sig = $ENV{'KILL_SIGNAL_VALUE'}; + my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; + my $mysqld_pid = `cat $pid_filename`; + chomp($mysqld_pid); + system("kill -HUP $mysqld_pid"); + exit(0); +EOF +--echo # Waiting for sighup to reach reload_acl_and_cache.. +set debug_sync="now wait_for in_reload_acl_and_cache"; +--echo # Signalling signal handler to proceed to sleep before REFRESH_HOSTS +set debug_sync="now signal refresh_logs"; + +# ..while we are shutting down +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +wait +EOF +--echo # Starting shutdown (note this will take 3+ seconds due to DBUG my_sleep in reload_acl_and_cache) +shutdown; + +--source include/wait_until_disconnected.inc +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +restart: --skip-slave-start=0 +EOF + +--connection server_2 +--enable_reconnect +--source include/wait_until_connected_again.inc + +--connection slave +--enable_reconnect +--source include/wait_until_connected_again.inc + +--let $assert_text= Ensure warning is issued that signal handler thread is still processing +--let $assert_select= Signal handler thread did not exit in a timely manner. +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_count= 1 +--let $assert_only_after = CURRENT_TEST: rpl.rpl_shutdown_sighup +--source include/assert_grep.inc + + +--echo # +--echo # Cleanup +--connection master +drop table t1; + +--source include/rpl_end.inc +--echo # End of rpl_shutdown_sighup.test diff --git a/mysql-test/suite/rpl/t/rpl_skip_error.test b/mysql-test/suite/rpl/t/rpl_skip_error.test index d3ef834e8ec..ee11ce5ac92 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_error.test +++ b/mysql-test/suite/rpl/t/rpl_skip_error.test @@ -3,7 +3,11 @@ # Verify that --slave-skip-errors works correctly. The error messages # specified by --slave-skip-errors on slave should be ignored. If # such errors occur, they should not be reported and not cause the -# slave to stop. +# slave to stop. If a skipped-due-to-error statement is a part of a +# larger transaction, and the error is not a deadlock error, the rest +# of the transaction should still commit, with just the errored statement +# ignored (note transactions which are skipped due to deadlocks are +# rolled back fully, see rpl_temporary_error2_skip_all.test). # # ==== Method ==== # @@ -164,6 +168,42 @@ let $current_skipped_error= query_get_value(show global status like "Slave_skipp --echo **** We cannot execute a select as there are differences in the --echo **** behavior between STMT and RBR. + +--echo **** +--echo **** Ensure transactions which are skipped due to encountering a +--echo **** non-deadlock error which is present in --slave-skip-errors result +--echo **** in partially committed transactions +# Slave will insert 3 first, and master will insert 3 within a larger trx +--let $value_preexisting_on_slave= 3 + +--connection master +CREATE TABLE t3 (a INT UNIQUE) ENGINE=InnoDB; + +--sync_slave_with_master +--connection slave +--eval INSERT INTO t3 VALUES ($value_preexisting_on_slave) + +--connection master +BEGIN; +INSERT INTO t3 VALUES (1); +INSERT INTO t3 VALUES (2); +--eval INSERT INTO t3 VALUES ($value_preexisting_on_slave) +INSERT INTO t3 VALUES (4); +COMMIT; +--sync_slave_with_master + +--echo **** Master and slave tables should have the same data, due to the +--echo **** partially replicated transaction's data overlapping with the data +--echo **** that pre-existed on the slave. That is, despite the transaction +--echo **** consisting of 4 statements, the errored statement should be ignored +--echo **** and the other 3 should commit successfully. +let $diff_tables=master:t3,slave:t3; +source include/diff_tables.inc; + +--connection master +DROP TABLE t3; + + --echo ==== Clean Up ==== connection master; diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index 1e2ec2ca83b..3dd99e736f2 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -82,7 +82,7 @@ print FILE "failure"; close ($file); EOF ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; --error 2013 FLUSH LOGS; @@ -130,7 +130,7 @@ print FILE @content; close FILE; EOF ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.2.expect SET SESSION debug_dbug="d,crash_before_rotate_relaylog"; --error 2013 FLUSH LOGS; diff --git a/mysql-test/suite/rpl/t/rpl_temporary_error2.test b/mysql-test/suite/rpl/t/rpl_temporary_error2.test index 49194c5d914..3537499d562 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_error2.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_error2.test @@ -64,7 +64,14 @@ ROLLBACK; --connection slave --sync_with_master SELECT * FROM t1 ORDER BY a; ---echo * There will be two rows in t2 due to the retry. +if (!$ignored_db_deadlock) +{ + --echo * There will be two rows in t2 due to the retry. +} +if ($ignored_db_deadlock) +{ + --echo * There will be one row in t2 because the ignored deadlock does not retry. +} SELECT * FROM t2 ORDER BY a; let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); --disable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all-slave.opt b/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all-slave.opt new file mode 100644 index 00000000000..a9ddd73510c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all-slave.opt @@ -0,0 +1 @@ +--slave-skip-errors=all diff --git a/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all.test b/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all.test new file mode 100644 index 00000000000..6801bf184d5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_temporary_error2_skip_all.test @@ -0,0 +1,3 @@ +--source include/have_binlog_format_row.inc +--let $ignored_db_deadlock= 1 +--source rpl_temporary_error2.test diff --git a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test index c14695f98cb..1557fcdcef8 100644 --- a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test +++ b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test @@ -42,10 +42,9 @@ # replication is used by default if master supports it # --source include/have_debug.inc ---source include/master-slave.inc - # Format independent test so just use one --source include/have_binlog_format_mixed.inc +--source include/master-slave.inc --echo # --echo # Slave default configuration should be Slave_Pos diff --git a/mysql-test/suite/s3/mysqldump.result b/mysql-test/suite/s3/mysqldump.result index 3f4c2081388..e0c0caf634e 100644 --- a/mysql-test/suite/s3/mysqldump.result +++ b/mysql-test/suite/s3/mysqldump.result @@ -4,6 +4,7 @@ alter table t1 engine=S3; ##### # mysqldump with --copy-s3-tables=0 (by default) ### +/*!999999\- enable the sandbox mode */ ##### # mysqldump with --copy-s3-tables=0 (by default) XML ### @@ -15,6 +16,7 @@ alter table t1 engine=S3; ##### # mysqldump with --copy-s3-tables=1 ### +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result index 0199bb7162f..7282804340c 100644 --- a/mysql-test/suite/sql_sequence/mysqldump.result +++ b/mysql-test/suite/sql_sequence/mysqldump.result @@ -3,6 +3,7 @@ CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024; insert into t1 values (1),(2); CREATE SEQUENCE x1 engine=innodb; # dump whole database +/*!999999\- enable the sandbox mode */ CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; SELECT SETVAL(`a1`, 1, 0); CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; @@ -18,6 +19,7 @@ INSERT INTO `t1` VALUES (1), (2); # dump by tables order 1 +/*!999999\- enable the sandbox mode */ CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; SELECT SETVAL(`a1`, 1, 0); CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; @@ -33,6 +35,7 @@ INSERT INTO `t1` VALUES (1), (2); # dump by tables order 2 +/*!999999\- enable the sandbox mode */ CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; SELECT SETVAL(`a1`, 1, 0); CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; @@ -48,6 +51,7 @@ INSERT INTO `t1` VALUES (1), (2); # dump by tables only tables +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -59,6 +63,7 @@ INSERT INTO `t1` VALUES (1), (2); # dump by tables only sequences +/*!999999\- enable the sandbox mode */ CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria; SELECT SETVAL(`a1`, 1, 0); CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB; diff --git a/mysql-test/suite/sys_vars/r/debug_dbug_utf16le.result b/mysql-test/suite/sys_vars/r/debug_dbug_utf16le.result new file mode 100644 index 00000000000..83b378f2adf --- /dev/null +++ b/mysql-test/suite/sys_vars/r/debug_dbug_utf16le.result @@ -0,0 +1,31 @@ +# +# Start of 10.5 tests +# +# +# MDEV-28366 GLOBAL debug_dbug setting affected by collation_connection=utf16... +# +SET NAMES utf8; +SET collation_connection=utf16le_general_ci; +SET debug_dbug='d,any_random_string'; +SELECT @@debug_dbug; +@@debug_dbug +d,any_random_string +SET debug_dbug=CONCAT('d,', _latin1 0xDF); +SELECT @@debug_dbug; +@@debug_dbug +d,ß +SELECT HEX(@@debug_dbug); +HEX(@@debug_dbug) +642CC39F +SET @@debug_dbug=NULL; +SELECT @@debug_dbug; +@@debug_dbug + +SET @@debug_dbug=DEFAULT; +SELECT @@debug_dbug; +@@debug_dbug + +SET NAMES latin1; +# +# End of 10.5 tests +# diff --git a/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result index 4a5baf0aeda..9e93d943c9f 100644 --- a/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result @@ -1,33 +1,25 @@ -'#---------------------BS_STVARS_026_01----------------------#' -SELECT COUNT(@@GLOBAL.innodb_doublewrite); -COUNT(@@GLOBAL.innodb_doublewrite) -1 -1 Expected -'#---------------------BS_STVARS_026_02----------------------#' +SELECT @@GLOBAL.innodb_doublewrite; +@@GLOBAL.innodb_doublewrite +ON +SET @@GLOBAL.innodb_doublewrite=0; +SELECT @@GLOBAL.innodb_doublewrite; +@@GLOBAL.innodb_doublewrite +OFF +SET @@GLOBAL.innodb_doublewrite=2; +SET @@GLOBAL.innodb_doublewrite=3; +ERROR 42000: Variable 'innodb_doublewrite' can't be set to the value of '3' +SELECT @@GLOBAL.innodb_doublewrite; +@@GLOBAL.innodb_doublewrite +fast SET @@GLOBAL.innodb_doublewrite=1; -ERROR HY000: Variable 'innodb_doublewrite' is a read only variable -Expected error 'Read only variable' -SELECT COUNT(@@GLOBAL.innodb_doublewrite); -COUNT(@@GLOBAL.innodb_doublewrite) -1 -1 Expected -'#---------------------BS_STVARS_026_03----------------------#' -SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_doublewrite'; -IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE -1 -1 Expected -SELECT COUNT(@@GLOBAL.innodb_doublewrite); -COUNT(@@GLOBAL.innodb_doublewrite) -1 -1 Expected +SELECT @@GLOBAL.innodb_doublewrite; +@@GLOBAL.innodb_doublewrite +ON SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_doublewrite'; COUNT(VARIABLE_VALUE) 1 -1 Expected '#---------------------BS_STVARS_026_04----------------------#' SELECT @@innodb_doublewrite = @@GLOBAL.innodb_doublewrite; @@innodb_doublewrite = @@GLOBAL.innodb_doublewrite @@ -48,6 +40,5 @@ SELECT COUNT(@@GLOBAL.innodb_doublewrite); COUNT(@@GLOBAL.innodb_doublewrite) 1 1 Expected -SELECT innodb_doublewrite = @@SESSION.innodb_doublewrite; -ERROR 42S22: Unknown column 'innodb_doublewrite' in 'field list' -Expected error 'Readonly variable' +SELECT @@innodb_doublewrite = @@SESSION.innodb_doublewrite; +ERROR HY000: Variable 'innodb_doublewrite' is a GLOBAL variable diff --git a/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result b/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result index 2dfe3a65133..7a15a270e15 100644 --- a/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result +++ b/mysql-test/suite/sys_vars/r/replicate_rewrite_db.result @@ -85,15 +85,13 @@ SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate VARIABLE_NAME VARIABLE_VALUE REPLICATE_REWRITE_DB db1->db2,db3->db4 # Check restart with appending the value -# restart: --replicate_rewrite_db=X->Y +# restart: --replicate_rewrite_db='X->Y' SELECT @@GLOBAL.replicate_rewrite_db; @@GLOBAL.replicate_rewrite_db -test->rewrite,mysqltest1->test,a->b,X->Y +test->rewrite,mysqltest1->test,a->b,'X->Y' # Check restart with wrong value on CLI [ERROR] Bad syntax in replicate-rewrite-db.Expected syntax is FROM->TO. -# restart: +# restart SELECT @@GLOBAL.replicate_rewrite_db; @@GLOBAL.replicate_rewrite_db test->rewrite,mysqltest1->test,a->b -# Cleanup. -SET @@GLOBAL.replicate_rewrite_db = @save_replicate_rewrite_db; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 9ae5049be2d..81db8629d19 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -1,4 +1,6 @@ -@@ -49,7 +49,7 @@ +--- sysvars_innodb.result ++++ sysvars_innodb.result,32bit +@@ -47,7 +47,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -7,7 +9,7 @@ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -73,7 +73,7 @@ +@@ -71,7 +71,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -16,7 +18,7 @@ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -85,10 +85,10 @@ +@@ -83,10 +83,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -29,7 +31,7 @@ NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -121,7 +121,7 @@ +@@ -119,7 +119,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 25 VARIABLE_SCOPE GLOBAL @@ -38,7 +40,7 @@ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -205,7 +205,7 @@ +@@ -203,7 +203,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -47,7 +49,7 @@ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed). NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -325,7 +325,7 @@ +@@ -323,7 +323,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -56,7 +58,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -349,7 +349,7 @@ +@@ -347,7 +347,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -65,7 +67,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -625,7 +625,7 @@ +@@ -623,7 +623,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -74,7 +76,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -673,7 +673,7 @@ +@@ -671,7 +671,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -83,7 +85,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -697,7 +697,7 @@ +@@ -695,7 +695,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -92,7 +94,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -721,7 +721,7 @@ +@@ -719,7 +719,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -101,7 +103,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -757,7 +757,7 @@ +@@ -755,7 +755,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -110,7 +112,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -781,10 +781,10 @@ +@@ -779,10 +779,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -123,7 +125,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -817,7 +817,7 @@ +@@ -815,7 +815,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -132,7 +134,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -829,7 +829,7 @@ +@@ -827,7 +827,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -141,7 +143,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -841,7 +841,7 @@ +@@ -839,7 +839,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -150,7 +152,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -853,10 +853,10 @@ +@@ -851,10 +851,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -163,7 +165,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -877,7 +877,7 @@ +@@ -875,7 +875,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -172,7 +174,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -889,10 +889,10 @@ +@@ -887,10 +887,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -185,7 +187,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -937,22 +937,22 @@ +@@ -935,22 +935,22 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -213,20 +215,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -985,10 +985,10 @@ - SESSION_VALUE NULL - DEFAULT_VALUE 16777216 - VARIABLE_SCOPE GLOBAL --VARIABLE_TYPE BIGINT UNSIGNED -+VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Redo log buffer size in bytes. - NUMERIC_MIN_VALUE 2097152 --NUMERIC_MAX_VALUE 18446744073709551615 -+NUMERIC_MAX_VALUE 4294967295 - NUMERIC_BLOCK_SIZE 4096 - ENUM_VALUE_LIST NULL - READ_ONLY YES -@@ -1033,10 +1033,10 @@ +@@ -1043,10 +1043,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -239,7 +228,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1045,10 +1045,10 @@ +@@ -1055,10 +1055,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -252,7 +241,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1081,10 +1081,10 @@ +@@ -1091,10 +1091,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -265,7 +254,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1093,7 +1093,7 @@ +@@ -1103,7 +1103,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -274,7 +263,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1225,10 +1225,10 @@ +@@ -1235,10 +1235,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -287,7 +276,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1249,7 +1249,7 @@ +@@ -1259,7 +1259,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -296,7 +285,7 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1285,7 +1285,7 @@ +@@ -1295,7 +1295,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1000 VARIABLE_SCOPE GLOBAL @@ -305,7 +294,7 @@ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1297,7 +1297,7 @@ +@@ -1307,7 +1307,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -314,7 +303,7 @@ VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1333,7 +1333,7 @@ +@@ -1343,7 +1343,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -323,7 +312,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1405,7 +1405,7 @@ +@@ -1427,7 +1427,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -332,7 +321,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1573,10 +1573,10 @@ +@@ -1595,10 +1595,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 177a91c650c..38dc039e391 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -431,14 +431,14 @@ VARIABLE_NAME INNODB_DOUBLEWRITE SESSION_VALUE NULL DEFAULT_VALUE ON VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enable InnoDB doublewrite buffer (enabled by default). Disable with --skip-innodb-doublewrite. +VARIABLE_TYPE ENUM +VARIABLE_COMMENT Whether and how to use the doublewrite buffer. OFF=Assume that writes of innodb_page_size are atomic; ON=Prevent torn writes (the default); fast=Like ON, but do not synchronize writes to data files NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST OFF,ON -READ_ONLY YES -COMMAND_LINE_ARGUMENT NONE +ENUM_VALUE_LIST OFF,ON,fast +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE SESSION_VALUE NULL DEFAULT_VALUE 1 @@ -887,10 +887,10 @@ VARIABLE_NAME INNODB_LOG_BUFFER_SIZE SESSION_VALUE NULL DEFAULT_VALUE 16777216 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Redo log buffer size in bytes. NUMERIC_MIN_VALUE 2097152 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 2147479552 NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY YES diff --git a/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test b/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test index 9179cfbef4d..f5645e01229 100644 --- a/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test +++ b/mysql-test/suite/sys_vars/t/allow_suspicious_udfs.test @@ -5,10 +5,10 @@ SELECT @@allow_suspicious_udfs AS EXPECT_0; # Restart the server the server with "--allow-suspicious-udfs" option ---let $restart_parameters = "--allow-suspicious-udfs" +--let $restart_parameters = --allow-suspicious-udfs --source include/restart_mysqld.inc SELECT @@allow_suspicious_udfs AS EXPECT_1; # Disable "--allow-suspicious-udfs" to restore the original state ---let $restart_parameters = "--skip-allow-suspicious-udfs" +--let $restart_parameters = --skip-allow-suspicious-udfs --source include/restart_mysqld.inc diff --git a/mysql-test/suite/sys_vars/t/debug_dbug_utf16le.test b/mysql-test/suite/sys_vars/t/debug_dbug_utf16le.test new file mode 100644 index 00000000000..0c4d8f92e93 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/debug_dbug_utf16le.test @@ -0,0 +1,29 @@ +--source include/have_debug.inc +--source include/have_utf16.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-28366 GLOBAL debug_dbug setting affected by collation_connection=utf16... +--echo # + +SET NAMES utf8; +SET collation_connection=utf16le_general_ci; +SET debug_dbug='d,any_random_string'; +SELECT @@debug_dbug; +SET debug_dbug=CONCAT('d,', _latin1 0xDF); +SELECT @@debug_dbug; +SELECT HEX(@@debug_dbug); + +SET @@debug_dbug=NULL; +SELECT @@debug_dbug; + +SET @@debug_dbug=DEFAULT; +SELECT @@debug_dbug; +SET NAMES latin1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.opt b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.opt new file mode 100644 index 00000000000..2bea5a22cde --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.opt @@ -0,0 +1 @@ +--innodb-doublewrite diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test index 1ae10d0f7cf..4e76c0ac33d 100644 --- a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test @@ -1,75 +1,20 @@ - - -################## mysql-test\t\innodb_doublewrite_basic.test ################# -# # -# Variable Name: innodb_doublewrite # -# Scope: Global # -# Access Type: Static # -# Data Type: boolean # -# # -# # -# Creation Date: 2008-02-07 # -# Author : Sharique Abdullah # -# # -# # -# Description:Test Cases of Dynamic System Variable innodb_doublewrite # -# that checks the behavior of this variable in the following ways # -# * Value Check # -# * Scope Check # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### - --source include/have_innodb.inc ---echo '#---------------------BS_STVARS_026_01----------------------#' -#################################################################### -# Displaying default value # -#################################################################### -SELECT COUNT(@@GLOBAL.innodb_doublewrite); ---echo 1 Expected +SELECT @@GLOBAL.innodb_doublewrite; +SET @@GLOBAL.innodb_doublewrite=0; +SELECT @@GLOBAL.innodb_doublewrite; ---echo '#---------------------BS_STVARS_026_02----------------------#' -#################################################################### -# Check if Value can set # -#################################################################### - ---error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_doublewrite=2; +--error ER_WRONG_VALUE_FOR_VAR +SET @@GLOBAL.innodb_doublewrite=3; +SELECT @@GLOBAL.innodb_doublewrite; SET @@GLOBAL.innodb_doublewrite=1; ---echo Expected error 'Read only variable' +SELECT @@GLOBAL.innodb_doublewrite; -SELECT COUNT(@@GLOBAL.innodb_doublewrite); ---echo 1 Expected - - - - ---echo '#---------------------BS_STVARS_026_03----------------------#' -################################################################# -# Check if the value in GLOBAL Table matches value in variable # -################################################################# - ---disable_warnings -SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE +SELECT COUNT(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_doublewrite'; ---enable_warnings ---echo 1 Expected - -SELECT COUNT(@@GLOBAL.innodb_doublewrite); ---echo 1 Expected - ---disable_warnings -SELECT COUNT(VARIABLE_VALUE) -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='innodb_doublewrite'; ---enable_warnings ---echo 1 Expected - - --echo '#---------------------BS_STVARS_026_04----------------------#' ################################################################################ @@ -78,8 +23,6 @@ WHERE VARIABLE_NAME='innodb_doublewrite'; SELECT @@innodb_doublewrite = @@GLOBAL.innodb_doublewrite; --echo 1 Expected - - --echo '#---------------------BS_STVARS_026_05----------------------#' ################################################################################ # Check if innodb_doublewrite can be accessed with and without @@ sign # @@ -99,8 +42,5 @@ SELECT COUNT(@@SESSION.innodb_doublewrite); SELECT COUNT(@@GLOBAL.innodb_doublewrite); --echo 1 Expected ---Error ER_BAD_FIELD_ERROR -SELECT innodb_doublewrite = @@SESSION.innodb_doublewrite; ---echo Expected error 'Readonly variable' - - +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@innodb_doublewrite = @@SESSION.innodb_doublewrite; diff --git a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test index 7fbaab1f260..5a9537f1da2 100644 --- a/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test +++ b/mysql-test/suite/sys_vars/t/replicate_rewrite_db.test @@ -63,7 +63,7 @@ SELECT @@GLOBAL.replicate_rewrite_db; SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='replicate_rewrite_db'; --echo # Check restart with appending the value ---let $restart_parameters = "--replicate_rewrite_db='X->Y'" +--let $restart_parameters = --replicate_rewrite_db='X->Y' --source include/restart_mysqld.inc SELECT @@GLOBAL.replicate_rewrite_db; @@ -76,9 +76,6 @@ SELECT @@GLOBAL.replicate_rewrite_db; --replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // --cat_file $MYSQL_TMP_DIR/mysqld--replicate.err # Restart the server with the default options ---let $restart_parameters = "" +--let $restart_parameters = --source include/start_mysqld.inc SELECT @@GLOBAL.replicate_rewrite_db; - ---echo # Cleanup. -SET @@GLOBAL.replicate_rewrite_db = @save_replicate_rewrite_db; diff --git a/mysql-test/suite/vcol/r/func_regexp.result b/mysql-test/suite/vcol/r/func_regexp.result new file mode 100644 index 00000000000..f7ae11f79b1 --- /dev/null +++ b/mysql-test/suite/vcol/r/func_regexp.result @@ -0,0 +1,24 @@ +# +# Start of 10.5 tests +# +# +# MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +# +CREATE TABLE t1 (c0 INT AS(('' RLIKE '['))); +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +CREATE TABLE t1 (c0 INT AS(REGEXP_INSTR('','['))); +ERROR 42000: Regex error 'missing terminating ] for character class at offset 1' +CREATE TABLE t1 +( +c0 INT, +c1 INT AS(('' RLIKE NULL)), +c2 INT AS(REGEXP_INSTR('',NULL)) +); +INSERT INTO t1 (c0) VALUES (0); +SELECT * FROM t1; +c0 c1 c2 +0 NULL NULL +DROP TABLE t1; +# +# End of 10.5 tests +# diff --git a/mysql-test/suite/vcol/t/func_regexp.test b/mysql-test/suite/vcol/t/func_regexp.test new file mode 100644 index 00000000000..5e97009ab7b --- /dev/null +++ b/mysql-test/suite/vcol/t/func_regexp.test @@ -0,0 +1,30 @@ +--source inc/vcol_init_vars.pre +--source inc/vcol_cleanup.inc + +--echo # +--echo # Start of 10.5 tests +--echo # + +--echo # +--echo # MDEV-21058 CREATE TABLE with generated column and RLIKE results in sigabrt +--echo # + +--error ER_REGEXP_ERROR +CREATE TABLE t1 (c0 INT AS(('' RLIKE '['))); + +--error ER_REGEXP_ERROR +CREATE TABLE t1 (c0 INT AS(REGEXP_INSTR('','['))); + +CREATE TABLE t1 +( + c0 INT, + c1 INT AS(('' RLIKE NULL)), + c2 INT AS(REGEXP_INSTR('',NULL)) +); +INSERT INTO t1 (c0) VALUES (0); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result index c7fe141c19e..08ab03ffcd4 100644 --- a/mysql-test/suite/versioning/r/data.result +++ b/mysql-test/suite/versioning/r/data.result @@ -10,6 +10,7 @@ set timestamp=unix_timestamp('1991-01-02 00:00'); delete from t1 where x=2; set timestamp=default; #MYSQL_DUMP --compact test +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -19,6 +20,7 @@ CREATE TABLE `t1` ( INSERT INTO `t1` VALUES (3); #MYSQL_DUMP --compact --as-of="1990-01-02 00:00" test +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -30,6 +32,7 @@ INSERT INTO `t1` VALUES (2), (3); #MYSQL_DUMP --compact --as-of="1990-08-02 00:00" --databases test +/*!999999\- enable the sandbox mode */ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */; @@ -45,6 +48,7 @@ INSERT INTO `t1` VALUES (2), (3); #MYSQL_DUMP --compact --as-of="1990-08-04 00:00" test t1 +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -87,6 +91,7 @@ select x, check_fields(x, row_start, row_end) from t2 for system_time all order x check_fields(x, row_start, row_end) 1 [CORRECT] 2 [CORRECT] +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -194,6 +199,7 @@ insert t1 (x) values (2); delete from t1 where x=1; mariadb-dump: Cannot use --dump-history for table `t1` with transaction-precise history mariadb-dump: Cannot use --dump-history for table `t1` with transaction-precise history +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 7b0edd42a68..228ed14f44a 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3431,4 +3431,27 @@ ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTOR # # End of 10.5 tests # +# +# MDEV-31903 Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions +# +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create table t1 (x int) engine=aria with system versioning partition by system_time interval 1 hour auto partitions 3; +insert into t1 values (1); +create table t2 (x int) engine=aria; +create trigger tr after insert on t2 for each row update t1 set x= x + 11; +lock tables t1 write, t2 write; +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 13:00:00'); +insert into t2 values (5); +unlock tables; +drop table t1, t2; +set timestamp= default; +# +# MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition +# +create table t (a int) with system versioning partition by system_time limit 100 partitions 3; +drop table t; +# +# End of 10.9 tests +# set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 3699ac286c8..5707746f96c 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2673,5 +2673,43 @@ create table t (a int) with system versioning partition by system_time partition --echo # End of 10.5 tests --echo # +--echo # +--echo # MDEV-31903 Server crashes in _ma_reset_history upon UNLOCK table with auto-create history partitions +--echo # +set timestamp= unix_timestamp('2000-01-01 00:00:00'); +create table t1 (x int) engine=aria with system versioning partition by system_time interval 1 hour auto partitions 3; +insert into t1 values (1); + +create table t2 (x int) engine=aria; +create trigger tr after insert on t2 for each row update t1 set x= x + 11; +lock tables t1 write, t2 write; +update t1 set x= x + 1; +set timestamp= unix_timestamp('2000-01-01 13:00:00'); +insert into t2 values (5); +unlock tables; +drop table t1, t2; +set timestamp= default; + +--echo # +--echo # MDEV-29872 MSAN/Valgrind uninitialised value errors in TABLE::vers_switch_partition +--echo # +create table t (a int) with system versioning partition by system_time limit 100 partitions 3; +let $emb= `select if(version() like '%embedded%', 1, 0)`; +if (!$emb) +{ + --disable_result_log + --disable_query_log + --error ER_DELAYED_NOT_SUPPORTED + insert delayed into t () values (); + --enable_query_log + --enable_result_log +} +# cleanup +drop table t; + +--echo # +--echo # End of 10.9 tests +--echo # + set global innodb_stats_persistent= @save_persistent; --source suite/versioning/common_finish.inc diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.test b/mysql-test/suite/wsrep/t/pool_of_threads.test index 8e95d0ca495..f035236da0e 100644 --- a/mysql-test/suite/wsrep/t/pool_of_threads.test +++ b/mysql-test/suite/wsrep/t/pool_of_threads.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_enabled.inc --source include/have_binlog_format_row.inc diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 758243df10f..ab6d9edf30f 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys) +INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys) SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c get_password.c @@ -59,29 +59,21 @@ IF (WIN32) ENDIF() IF(MSVC_INTEL) - SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c) + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c crc32/crc32c_x86.cc) IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) ENDIF() - ADD_DEFINITIONS(-DHAVE_SSE42 -DHAVE_PCLMUL) - IF(CLANG_CL) - SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") - ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686") - MY_CHECK_CXX_COMPILER_FLAG(-msse4.2) - MY_CHECK_CXX_COMPILER_FLAG(-mpclmul) - CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H) - CHECK_INCLUDE_FILE(x86intrin.h HAVE_X86INTRIN_H) - IF(have_CXX__msse4.2 AND HAVE_CPUID_H) - ADD_DEFINITIONS(-DHAVE_SSE42) - IF (have_CXX__mpclmul AND HAVE_X86INTRIN_H) - ADD_DEFINITIONS(-DHAVE_PCLMUL) - SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c) - SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) - SET_SOURCE_FILES_PROPERTIES(crc32/crc32c_amd64.cc PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") - ENDIF() + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c crc32/crc32c_x86.cc) + IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") + SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES + COMPILE_FLAGS "-msse4.2 -mpclmul") + ENDIF() + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) + IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") + SET_SOURCE_FILES_PROPERTIES(crc32/crc32c_amd64.cc PROPERTIES + COMPILE_FLAGS "-msse4.2 -mpclmul") ENDIF() ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") @@ -164,7 +156,7 @@ ENDIF() ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES}) MAYBE_DISABLE_IPO(mysys) -TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY} +TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARIES} ${LIBNSL} ${LIBM} ${LIBRT} ${CMAKE_DL_LIBS} ${LIBSOCKET} ${LIBEXECINFO}) DTRACE_INSTRUMENT(mysys) diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c index 0e70c21812a..6588606a015 100644 --- a/mysys/crc32/crc32_arm64.c +++ b/mysys/crc32/crc32_arm64.c @@ -1,13 +1,18 @@ #include #include #include +#include -static int pmull_supported; +typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t); -#if defined(HAVE_ARMV8_CRC) +#ifdef HAVE_ARMV8_CRC -#if defined(__APPLE__) -#include +# ifdef HAVE_ARMV8_CRYPTO +static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t); +# endif + +# ifdef __APPLE__ +# include int crc32_aarch64_available(void) { @@ -18,17 +23,17 @@ int crc32_aarch64_available(void) return ret; } -const char *crc32c_aarch64_available(void) +my_crc32_t crc32c_aarch64_available(void) { - if (crc32_aarch64_available() == 0) - return NULL; - pmull_supported = 1; - return "Using ARMv8 crc32 + pmull instructions"; +# ifdef HAVE_ARMV8_CRYPTO + if (crc32_aarch64_available()) + return crc32c_aarch64_pmull; +# endif + return NULL; } - -#else -#include -#if defined(__FreeBSD__) +# else +# include +# ifdef __FreeBSD__ static unsigned long getauxval(unsigned int key) { unsigned long val; @@ -36,17 +41,17 @@ static unsigned long getauxval(unsigned int key) return 0ul; return val; } -#else -# include -#endif +# else +# include +# endif -#ifndef HWCAP_CRC32 -# define HWCAP_CRC32 (1 << 7) -#endif +# ifndef HWCAP_CRC32 +# define HWCAP_CRC32 (1 << 7) +# endif -#ifndef HWCAP_PMULL -# define HWCAP_PMULL (1 << 4) -#endif +# ifndef HWCAP_PMULL +# define HWCAP_PMULL (1 << 4) +# endif /* ARM made crc32 default from ARMv8.1 but optional in ARMv8A * Runtime check API. @@ -56,22 +61,37 @@ int crc32_aarch64_available(void) unsigned long auxv= getauxval(AT_HWCAP); return (auxv & HWCAP_CRC32) != 0; } +# endif -const char *crc32c_aarch64_available(void) +# ifndef __APPLE__ +static unsigned crc32c_aarch64(unsigned, const void *, size_t); + +my_crc32_t crc32c_aarch64_available(void) { unsigned long auxv= getauxval(AT_HWCAP); - if (!(auxv & HWCAP_CRC32)) return NULL; - - pmull_supported= (auxv & HWCAP_PMULL) != 0; - if (pmull_supported) - return "Using ARMv8 crc32 + pmull instructions"; - else - return "Using ARMv8 crc32 instructions"; +# ifdef HAVE_ARMV8_CRYPTO + /* Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030). */ + if (auxv & HWCAP_PMULL) + return crc32c_aarch64_pmull; +# endif + return crc32c_aarch64; } +# endif -#endif /* __APPLE__ */ +const char *crc32c_aarch64_impl(my_crc32_t c) +{ +# ifdef HAVE_ARMV8_CRYPTO + if (c == crc32c_aarch64_pmull) + return "Using ARMv8 crc32 + pmull instructions"; +# endif +# ifndef __APPLE__ + if (c == crc32c_aarch64) + return "Using ARMv8 crc32 instructions"; +# endif + return NULL; +} #endif /* HAVE_ARMV8_CRC */ #ifndef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS @@ -157,131 +177,14 @@ asm(".arch_extension crypto"); PREF4X64L2(buffer,(PREF_OFFSET), 8) \ PREF4X64L2(buffer,(PREF_OFFSET), 12) -uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len) +#ifndef __APPLE__ +static unsigned crc32c_aarch64(unsigned crc, const void *buf, size_t len) { - uint32_t crc0, crc1, crc2; int64_t length= (int64_t)len; + const unsigned char *buffer= buf; crc^= 0xffffffff; - /* Pmull runtime check here. - * Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030). - * - * Consider the condition that the target platform does support hardware crc32 - * but not support PMULL. In this condition, it should leverage the aarch64 - * crc32 instruction (__crc32c) and just only skip parallel computation (pmull/vmull) - * rather than skip all hardware crc32 instruction of computation. - */ - if (pmull_supported) - { -/* The following Macro (HAVE_ARMV8_CRYPTO) is used for compiling check */ -#ifdef HAVE_ARMV8_CRYPTO - -/* Crypto extension Support - * Parallel computation with 1024 Bytes (per block) - * Intrinsics Support - */ -# ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS - const poly64_t k1= 0xe417f38a, k2= 0x8f158014; - uint64_t t0, t1; - - /* Process per block size of 1024 Bytes - * A block size = 8 + 42*3*sizeof(uint64_t) + 8 - */ - while ((length-= 1024) >= 0) - { - /* Prefetch 3*1024 data for avoiding L2 cache miss */ - PREF1KL2(buffer, 1024*3); - /* Do first 8 bytes here for better pipelining */ - crc0= __crc32cd(crc, *(const uint64_t *)buffer); - crc1= 0; - crc2= 0; - buffer+= sizeof(uint64_t); - - /* Process block inline - * Process crc0 last to avoid dependency with above - */ - CRC32C7X3X8(buffer, 0); - CRC32C7X3X8(buffer, 1); - CRC32C7X3X8(buffer, 2); - CRC32C7X3X8(buffer, 3); - CRC32C7X3X8(buffer, 4); - CRC32C7X3X8(buffer, 5); - - buffer+= 42*3*sizeof(uint64_t); - /* Prefetch data for following block to avoid L1 cache miss */ - PREF1KL1(buffer, 1024); - - /* Last 8 bytes - * Merge crc0 and crc1 into crc2 - * crc1 multiply by K2 - * crc0 multiply by K1 - */ - t1= (uint64_t)vmull_p64(crc1, k2); - t0= (uint64_t)vmull_p64(crc0, k1); - crc= __crc32cd(crc2, *(const uint64_t *)buffer); - crc1= __crc32cd(0, t1); - crc^= crc1; - crc0= __crc32cd(0, t0); - crc^= crc0; - - buffer+= sizeof(uint64_t); - } - -# else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ - - /*No intrinsics*/ - __asm__("mov x16, #0xf38a \n\t" - "movk x16, #0xe417, lsl 16 \n\t" - "mov v1.2d[0], x16 \n\t" - "mov x16, #0x8014 \n\t" - "movk x16, #0x8f15, lsl 16 \n\t" - "mov v0.2d[0], x16 \n\t" - :::"x16"); - - while ((length-= 1024) >= 0) - { - PREF1KL2(buffer, 1024*3); - __asm__("crc32cx %w[c0], %w[c], %x[v]\n\t" - :[c0]"=r"(crc0):[c]"r"(crc), [v]"r"(*(const uint64_t *)buffer):); - crc1= 0; - crc2= 0; - buffer+= sizeof(uint64_t); - - CRC32C7X3X8(buffer, 0); - CRC32C7X3X8(buffer, 1); - CRC32C7X3X8(buffer, 2); - CRC32C7X3X8(buffer, 3); - CRC32C7X3X8(buffer, 4); - CRC32C7X3X8(buffer, 5); - - buffer+= 42*3*sizeof(uint64_t); - PREF1KL1(buffer, 1024); - __asm__("mov v2.2d[0], %x[c1] \n\t" - "pmull v2.1q, v2.1d, v0.1d \n\t" - "mov v3.2d[0], %x[c0] \n\t" - "pmull v3.1q, v3.1d, v1.1d \n\t" - "crc32cx %w[c], %w[c2], %x[v] \n\t" - "mov %x[c1], v2.2d[0] \n\t" - "crc32cx %w[c1], wzr, %x[c1] \n\t" - "eor %w[c], %w[c], %w[c1] \n\t" - "mov %x[c0], v3.2d[0] \n\t" - "crc32cx %w[c0], wzr, %x[c0] \n\t" - "eor %w[c], %w[c], %w[c0] \n\t" - :[c1]"+r"(crc1), [c0]"+r"(crc0), [c2]"+r"(crc2), [c]"+r"(crc) - :[v]"r"(*((const uint64_t *)buffer))); - buffer+= sizeof(uint64_t); - } -# endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ - - /* Done if Input data size is aligned with 1024 */ - if (!(length+= 1024)) - return ~crc; - -#endif /* HAVE_ARMV8_CRYPTO */ - - } // end if pmull_supported - while ((length-= sizeof(uint64_t)) >= 0) { CRC32CX(crc, *(uint64_t *)buffer); @@ -306,6 +209,143 @@ uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len) return ~crc; } +#endif + +#ifdef HAVE_ARMV8_CRYPTO +static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len) +{ + int64_t length= (int64_t)len; + const unsigned char *buffer= buf; + + crc^= 0xffffffff; + + /* Crypto extension Support + * Parallel computation with 1024 Bytes (per block) + * Intrinsics Support + */ +# ifdef HAVE_ARMV8_CRC_CRYPTO_INTRINSICS + /* Process per block size of 1024 Bytes + * A block size = 8 + 42*3*sizeof(uint64_t) + 8 + */ + for (const poly64_t k1= 0xe417f38a, k2= 0x8f158014; (length-= 1024) >= 0; ) + { + uint32_t crc0, crc1, crc2; + uint64_t t0, t1; + /* Prefetch 3*1024 data for avoiding L2 cache miss */ + PREF1KL2(buffer, 1024*3); + /* Do first 8 bytes here for better pipelining */ + crc0= __crc32cd(crc, *(const uint64_t *)buffer); + crc1= 0; + crc2= 0; + buffer+= sizeof(uint64_t); + + /* Process block inline + * Process crc0 last to avoid dependency with above + */ + CRC32C7X3X8(buffer, 0); + CRC32C7X3X8(buffer, 1); + CRC32C7X3X8(buffer, 2); + CRC32C7X3X8(buffer, 3); + CRC32C7X3X8(buffer, 4); + CRC32C7X3X8(buffer, 5); + + buffer+= 42*3*sizeof(uint64_t); + /* Prefetch data for following block to avoid L1 cache miss */ + PREF1KL1(buffer, 1024); + + /* Last 8 bytes + * Merge crc0 and crc1 into crc2 + * crc1 multiply by K2 + * crc0 multiply by K1 + */ + t1= (uint64_t)vmull_p64(crc1, k2); + t0= (uint64_t)vmull_p64(crc0, k1); + crc= __crc32cd(crc2, *(const uint64_t *)buffer); + crc1= __crc32cd(0, t1); + crc^= crc1; + crc0= __crc32cd(0, t0); + crc^= crc0; + + buffer+= sizeof(uint64_t); + } + +# else /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ + /*No intrinsics*/ + __asm__("mov x16, #0xf38a \n\t" + "movk x16, #0xe417, lsl 16 \n\t" + "mov v1.2d[0], x16 \n\t" + "mov x16, #0x8014 \n\t" + "movk x16, #0x8f15, lsl 16 \n\t" + "mov v0.2d[0], x16 \n\t" + :::"x16"); + + while ((length-= 1024) >= 0) + { + uint32_t crc0, crc1, crc2; + + PREF1KL2(buffer, 1024*3); + __asm__("crc32cx %w[c0], %w[c], %x[v]\n\t" + :[c0]"=r"(crc0):[c]"r"(crc), [v]"r"(*(const uint64_t *)buffer):); + crc1= 0; + crc2= 0; + buffer+= sizeof(uint64_t); + + CRC32C7X3X8(buffer, 0); + CRC32C7X3X8(buffer, 1); + CRC32C7X3X8(buffer, 2); + CRC32C7X3X8(buffer, 3); + CRC32C7X3X8(buffer, 4); + CRC32C7X3X8(buffer, 5); + + buffer+= 42*3*sizeof(uint64_t); + PREF1KL1(buffer, 1024); + __asm__("mov v2.2d[0], %x[c1] \n\t" + "pmull v2.1q, v2.1d, v0.1d \n\t" + "mov v3.2d[0], %x[c0] \n\t" + "pmull v3.1q, v3.1d, v1.1d \n\t" + "crc32cx %w[c], %w[c2], %x[v] \n\t" + "mov %x[c1], v2.2d[0] \n\t" + "crc32cx %w[c1], wzr, %x[c1] \n\t" + "eor %w[c], %w[c], %w[c1] \n\t" + "mov %x[c0], v3.2d[0] \n\t" + "crc32cx %w[c0], wzr, %x[c0] \n\t" + "eor %w[c], %w[c], %w[c0] \n\t" + :[c1]"+r"(crc1), [c0]"+r"(crc0), [c2]"+r"(crc2), [c]"+r"(crc) + :[v]"r"(*((const uint64_t *)buffer))); + buffer+= sizeof(uint64_t); + } +# endif /* HAVE_ARMV8_CRC_CRYPTO_INTRINSICS */ + + /* Done if Input data size is aligned with 1024 */ + length+= 1024; + if (length) + { + while ((length-= sizeof(uint64_t)) >= 0) + { + CRC32CX(crc, *(uint64_t *)buffer); + buffer+= sizeof(uint64_t); + } + + /* The following is more efficient than the straight loop */ + if (length & sizeof(uint32_t)) + { + CRC32CW(crc, *(uint32_t *)buffer); + buffer+= sizeof(uint32_t); + } + + if (length & sizeof(uint16_t)) + { + CRC32CH(crc, *(uint16_t *)buffer); + buffer+= sizeof(uint16_t); + } + + if (length & sizeof(uint8_t)) + CRC32CB(crc, *buffer); + } + + return ~crc; +} +#endif /* HAVE_ARMV8_CRYPTO */ /* There are multiple approaches to calculate crc. Approach-1: Process 8 bytes then 4 bytes then 2 bytes and then 1 bytes diff --git a/mysys/crc32/crc32_x86.c b/mysys/crc32/crc32_x86.c index f077399caca..ab2522d61cf 100644 --- a/mysys/crc32/crc32_x86.c +++ b/mysys/crc32/crc32_x86.c @@ -56,11 +56,16 @@ #include #ifdef __GNUC__ -#include +# include +# include +# include +# include +# define USE_PCLMUL __attribute__((target("sse4.2,pclmul"))) #elif defined(_MSC_VER) -#include +# include +# define USE_PCLMUL /* nothing */ #else -#error "unknown compiler" +# error "unknown compiler" #endif /** @@ -71,6 +76,7 @@ * * @return \a reg << (\a num * 8) */ +USE_PCLMUL static inline __m128i xmm_shift_left(__m128i reg, const unsigned int num) { static const MY_ALIGNED(16) uint8_t crc_xmm_shift_tab[48]= { @@ -111,6 +117,7 @@ struct crcr_pclmulqdq_ctx * * @return New 16 byte folded data */ +USE_PCLMUL static inline __m128i crcr32_folding_round(const __m128i data_block, const __m128i precomp, const __m128i fold) { @@ -128,6 +135,7 @@ static inline __m128i crcr32_folding_round(const __m128i data_block, * * @return data reduced to 64 bits */ +USE_PCLMUL static inline __m128i crcr32_reduce_128_to_64(__m128i data128, const __m128i precomp) { __m128i tmp0, tmp1, tmp2; @@ -152,6 +160,7 @@ static inline __m128i crcr32_reduce_128_to_64(__m128i data128, const __m128i pre * * @return data reduced to 32 bits */ +USE_PCLMUL static inline uint32_t crcr32_reduce_64_to_32(__m128i data64, const __m128i precomp) { static const MY_ALIGNED(16) uint32_t mask1[4]= { @@ -188,6 +197,7 @@ static inline uint32_t crcr32_reduce_64_to_32(__m128i data64, const __m128i prec * * @return CRC for given \a data block (32 bits wide). */ +USE_PCLMUL static inline uint32_t crcr32_calc_pclmulqdq(const uint8_t *data, uint32_t data_len, uint32_t crc, const struct crcr_pclmulqdq_ctx *params) diff --git a/mysys/crc32/crc32c.cc b/mysys/crc32/crc32c.cc index 2bec041e278..32a45478e94 100644 --- a/mysys/crc32/crc32c.cc +++ b/mysys/crc32/crc32c.cc @@ -19,52 +19,23 @@ #include #include #include -#include -static inline uint32_t DecodeFixed32(const char *ptr) -{ - return uint4korr(ptr); -} -#include -#ifdef _MSC_VER -#include -#endif +#ifdef __powerpc64__ +# include "crc32c_ppc.h" +# ifdef __linux__ +# include -#ifdef HAVE_SSE42 -# ifdef __GNUC__ -# include -# if __GNUC__ < 5 && !defined __clang__ -/* the headers do not really work in GCC before version 5 */ -# define _mm_crc32_u8(crc,data) __builtin_ia32_crc32qi(crc,data) -# define _mm_crc32_u32(crc,data) __builtin_ia32_crc32si(crc,data) -# define _mm_crc32_u64(crc,data) __builtin_ia32_crc32di(crc,data) -# else -# include +# ifndef PPC_FEATURE2_VEC_CRYPTO +# define PPC_FEATURE2_VEC_CRYPTO 0x02000000 +# endif + +# ifndef AT_HWCAP2 +# define AT_HWCAP2 26 # endif -# define USE_SSE42 __attribute__((target("sse4.2"))) -# else -# define USE_SSE42 /* nothing */ # endif #endif - -#ifdef __powerpc64__ -#include "crc32c_ppc.h" - -#if __linux__ -#include - -#ifndef PPC_FEATURE2_VEC_CRYPTO -#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 -#endif - -#ifndef AT_HWCAP2 -#define AT_HWCAP2 26 -#endif - -#endif /* __linux__ */ - -#endif +typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t); namespace mysys_namespace { namespace crc32c { @@ -75,6 +46,7 @@ static int arch_ppc_crc32 = 0; #endif /* __powerpc64__ */ #endif +alignas(CPU_LEVEL1_DCACHE_LINESIZE) static const uint32_t table0_[256] = { 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, @@ -341,8 +313,9 @@ static const uint32_t table3_[256] = { }; // Used to fetch a naturally-aligned 32-bit word in little endian byte-order -static inline uint32_t LE_LOAD32(const uint8_t *p) { - return DecodeFixed32(reinterpret_cast(p)); +static inline uint32_t LE_LOAD32(const uint8_t *p) +{ + return uint4korr(reinterpret_cast(p)); } static inline void Slow_CRC32(uint64_t* l, uint8_t const **p) @@ -362,10 +335,7 @@ static inline void Slow_CRC32(uint64_t* l, uint8_t const **p) table0_[c >> 24]; } -#ifdef ALIGN #undef ALIGN -#endif - // Align n to (1 << m) byte boundary #define ALIGN(n, m) ((n + ((1 << m) - 1)) & ~((1 << m) - 1)) @@ -374,70 +344,30 @@ static inline void Slow_CRC32(uint64_t* l, uint8_t const **p) l = table0_[c] ^ (l >> 8); \ } while (0) -static uint32_t crc32c_slow(uint32_t crc, const char* buf, size_t size) -{ - const uint8_t *p = reinterpret_cast(buf); - const uint8_t *e = p + size; - uint64_t l = crc ^ 0xffffffffu; - - // Point x at first 16-byte aligned byte in string. This might be - // just past the end of the string. - const uintptr_t pval = reinterpret_cast(p); - const uint8_t* x = reinterpret_cast(ALIGN(pval, 4)); - if (x <= e) - // Process bytes until finished or p is 16-byte aligned - while (p != x) - STEP1; - // Process bytes 16 at a time - while ((e-p) >= 16) - { - Slow_CRC32(&l, &p); - Slow_CRC32(&l, &p); - } - // Process bytes 8 at a time - while ((e-p) >= 8) - Slow_CRC32(&l, &p); - // Process the last few bytes - while (p != e) - STEP1; - return static_cast(l ^ 0xffffffffu); -} - -#if defined HAVE_POWER8 -#elif defined HAVE_ARMV8_CRC -#elif defined HAVE_SSE42 -constexpr uint32_t cpuid_ecx_SSE42= 1U << 20; -constexpr uint32_t cpuid_ecx_SSE42_AND_PCLMUL= cpuid_ecx_SSE42 | 1U<<1; - -static uint32_t cpuid_ecx() -{ -#ifdef __GNUC__ - uint32_t reax= 0, rebx= 0, recx= 0, redx= 0; - __cpuid(1, reax, rebx, recx, redx); - return recx; -#elif defined _MSC_VER - int regs[4]; - __cpuid(regs, 1); - return regs[2]; -#else -# error "unknown compiler" +#undef USE_SSE42 +#if defined _MSC_VER && (defined _M_X64 || defined _M_IX86) +# include +# include +# define USE_SSE42 /* nothing */ +#elif defined __GNUC__ && (defined __i386__||defined __x86_64__) +# if __GNUC__ < 5 && !defined __clang_major__ +/* the headers do not really work in GCC before version 5 */ +# define _mm_crc32_u8(crc,data) __builtin_ia32_crc32qi(crc,data) +# define _mm_crc32_u32(crc,data) __builtin_ia32_crc32si(crc,data) +# define _mm_crc32_u64(crc,data) __builtin_ia32_crc32di(crc,data) +# else +# include +# endif +# define USE_SSE42 __attribute__((target("sse4.2"))) #endif -} -extern "C" int crc32_pclmul_enabled(void) -{ - return !(~cpuid_ecx() & cpuid_ecx_SSE42_AND_PCLMUL); -} - -#if SIZEOF_SIZE_T == 8 -extern "C" uint32_t crc32c_3way(uint32_t crc, const char *buf, size_t len); - -USE_SSE42 +#ifdef USE_SSE42 +# if SIZEOF_SIZE_T == 8 static inline uint64_t LE_LOAD64(const uint8_t *ptr) { return uint8korr(reinterpret_cast(ptr)); } -#endif +# endif USE_SSE42 static inline void Fast_CRC32(uint64_t* l, uint8_t const **p) @@ -453,10 +383,11 @@ static inline void Fast_CRC32(uint64_t* l, uint8_t const **p) # endif } +extern "C" USE_SSE42 -static uint32_t crc32c_sse42(uint32_t crc, const char* buf, size_t size) +unsigned crc32c_sse42(unsigned crc, const void* buf, size_t size) { - const uint8_t *p = reinterpret_cast(buf); + const uint8_t *p = static_cast(buf); const uint8_t *e = p + size; uint64_t l = crc ^ 0xffffffffu; @@ -484,107 +415,111 @@ static uint32_t crc32c_sse42(uint32_t crc, const char* buf, size_t size) } #endif -typedef uint32_t (*Function)(uint32_t, const char*, size_t); +static unsigned crc32c_slow(unsigned crc, const void* buf, size_t size) +{ + const uint8_t *p = static_cast(buf); + const uint8_t *e = p + size; + uint64_t l = crc ^ 0xffffffffu; -#if defined(HAVE_POWER8) && defined(HAS_ALTIVEC) -uint32_t ExtendPPCImpl(uint32_t crc, const char *buf, size_t size) { - return crc32c_ppc(crc, (const unsigned char *)buf, size); + // Point x at first 16-byte aligned byte in string. This might be + // just past the end of the string. + const uintptr_t pval = reinterpret_cast(p); + const uint8_t* x = reinterpret_cast(ALIGN(pval, 4)); + if (x <= e) + // Process bytes until finished or p is 16-byte aligned + while (p != x) + STEP1; + // Process bytes 16 at a time + while ((e-p) >= 16) + { + Slow_CRC32(&l, &p); + Slow_CRC32(&l, &p); + } + // Process bytes 8 at a time + while ((e-p) >= 8) + Slow_CRC32(&l, &p); + // Process the last few bytes + while (p != e) + STEP1; + return static_cast(l ^ 0xffffffffu); } -#if __linux__ +#if defined(HAVE_POWER8) && defined(HAS_ALTIVEC) +# ifdef __linux__ static int arch_ppc_probe(void) { arch_ppc_crc32 = 0; -#if defined(__powerpc64__) +# if defined(__powerpc64__) if (getauxval(AT_HWCAP2) & PPC_FEATURE2_VEC_CRYPTO) arch_ppc_crc32 = 1; -#endif /* __powerpc64__ */ +# endif /* __powerpc64__ */ return arch_ppc_crc32; } -#elif __FreeBSD_version >= 1200000 -#include -#include -#include +# elif defined __FreeBSD_version && __FreeBSD_version >= 1200000 +# include +# include +# include static int arch_ppc_probe(void) { unsigned long cpufeatures; arch_ppc_crc32 = 0; -#if defined(__powerpc64__) +# if defined(__powerpc64__) elf_aux_info(AT_HWCAP2, &cpufeatures, sizeof(cpufeatures)); if (cpufeatures & PPC_FEATURE2_HAS_VEC_CRYPTO) arch_ppc_crc32 = 1; -#endif /* __powerpc64__ */ +# endif /* __powerpc64__ */ return arch_ppc_crc32; } -#elif defined(_AIX) || defined(__OpenBSD__) +# elif defined(_AIX) || defined(__OpenBSD__) static int arch_ppc_probe(void) { arch_ppc_crc32 = 0; -#if defined(__powerpc64__) +# if defined(__powerpc64__) // AIX 7.1+/OpenBSD has vector crypto features on all POWER 8+ arch_ppc_crc32 = 1; -#endif /* __powerpc64__ */ +# endif /* __powerpc64__ */ return arch_ppc_crc32; } -#endif // __linux__ +# endif #endif #if defined(HAVE_ARMV8_CRC) -extern "C" const char *crc32c_aarch64_available(void); -extern "C" uint32_t crc32c_aarch64(uint32_t crc, const unsigned char *buffer, uint64_t len); - -static uint32_t ExtendARMImpl(uint32_t crc, const char *buf, size_t size) { - return crc32c_aarch64(crc, (const unsigned char *)buf, (size_t) size); -} +extern "C" my_crc32_t crc32c_aarch64_available(void); +extern "C" const char *crc32c_aarch64_impl(my_crc32_t); +#elif defined __i386__||defined __x86_64__||defined _M_X64||defined _M_IX86 +extern "C" my_crc32_t crc32c_x86_available(void); +extern "C" const char *crc32c_x86_impl(my_crc32_t); #endif -static inline Function Choose_Extend() +static inline my_crc32_t Choose_Extend() { #if defined HAVE_POWER8 && defined HAS_ALTIVEC if (arch_ppc_probe()) - return ExtendPPCImpl; -#elif defined(HAVE_ARMV8_CRC) - if (crc32c_aarch64_available()) - return ExtendARMImpl; -#elif HAVE_SSE42 -# if defined HAVE_PCLMUL && SIZEOF_SIZE_T == 8 - switch (cpuid_ecx() & cpuid_ecx_SSE42_AND_PCLMUL) { - case cpuid_ecx_SSE42_AND_PCLMUL: - return crc32c_3way; - case cpuid_ecx_SSE42: - return crc32c_sse42; - } -# else - if (cpuid_ecx() & cpuid_ecx_SSE42) - return crc32c_sse42; -# endif + return crc32c_ppc; +#elif defined HAVE_ARMV8_CRC + if (my_crc32_t crc= crc32c_aarch64_available()) + return crc; +#elif defined __i386__||defined __x86_64__||defined _M_X64||defined _M_IX86 + if (my_crc32_t crc= crc32c_x86_available()) + return crc; #endif return crc32c_slow; } -static const Function ChosenExtend= Choose_Extend(); - -static inline uint32_t Extend(uint32_t crc, const char* buf, size_t size) -{ - return ChosenExtend(crc, buf, size); -} +static const my_crc32_t ChosenExtend= Choose_Extend(); extern "C" const char *my_crc32c_implementation() { -#if defined(HAVE_POWER8) && defined(HAS_ALTIVEC) - if (ChosenExtend == ExtendPPCImpl) +#if defined HAVE_POWER8 && defined HAS_ALTIVEC + if (ChosenExtend == crc32c_ppc) return "Using POWER8 crc32 instructions"; -#elif defined(HAVE_ARMV8_CRC) - if (const char *ret= crc32c_aarch64_available()) +#elif defined HAVE_ARMV8_CRC + if (const char *ret= crc32c_aarch64_impl(ChosenExtend)) + return ret; +#elif defined __i386__||defined __x86_64__||defined _M_X64||defined _M_IX86 + if (const char *ret= crc32c_x86_impl(ChosenExtend)) return ret; -#elif HAVE_SSE42 -# if defined HAVE_PCLMUL && SIZEOF_SIZE_T == 8 - if (ChosenExtend == crc32c_3way) - return "Using crc32 + pclmulqdq instructions"; -# endif - if (ChosenExtend == crc32c_sse42) - return "Using SSE4.2 crc32 instructions"; #endif return "Using generic crc32 instructions"; } @@ -593,5 +528,5 @@ extern "C" const char *my_crc32c_implementation() extern "C" unsigned my_crc32c(unsigned int crc, const char *buf, size_t size) { - return mysys_namespace::crc32c::Extend(crc,buf, size); + return mysys_namespace::crc32c::ChosenExtend(crc,buf, size); } diff --git a/mysys/crc32/crc32c_amd64.cc b/mysys/crc32/crc32c_amd64.cc index 22c492b457f..147c0ccaba6 100644 --- a/mysys/crc32/crc32c_amd64.cc +++ b/mysys/crc32/crc32c_amd64.cc @@ -47,6 +47,11 @@ #include #include +#ifdef _MSC_VER +# define USE_PCLMUL /* nothing */ +#else +# define USE_PCLMUL __attribute__((target("sse4.2,pclmul"))) +#endif #define CRCtriplet(crc, buf, offset) \ crc##0 = _mm_crc32_u64(crc##0, *(buf##0 + offset)); \ @@ -131,6 +136,7 @@ static const uint64_t clmul_constants alignas(16) [] = { }; // Compute the crc32c value for buffer smaller than 8 +USE_PCLMUL static inline void align_to_8( size_t len, uint64_t& crc0, // crc so far, updated on return @@ -155,6 +161,7 @@ static inline void align_to_8( // CombineCRC performs pclmulqdq multiplication of 2 partial CRC's and a well // chosen constant and xor's these with the remaining CRC. // +USE_PCLMUL static inline uint64_t CombineCRC( size_t block_size, uint64_t crc0, @@ -176,6 +183,7 @@ static inline uint64_t CombineCRC( // Compute CRC-32C using the Intel hardware instruction. extern "C" +USE_PCLMUL uint32_t crc32c_3way(uint32_t crc, const char *buf, size_t len) { const unsigned char* next = (const unsigned char*)buf; diff --git a/mysys/crc32/crc32c_ppc.h b/mysys/crc32/crc32c_ppc.h index c359061c610..797e849b685 100644 --- a/mysys/crc32/crc32c_ppc.h +++ b/mysys/crc32/crc32c_ppc.h @@ -11,8 +11,7 @@ extern "C" { #endif -extern uint32_t crc32c_ppc(uint32_t crc, unsigned char const *buffer, - unsigned len); +extern unsigned crc32c_ppc(unsigned crc, const void *buffer, size_t len); #ifdef __cplusplus } diff --git a/mysys/crc32/crc32c_x86.cc b/mysys/crc32/crc32c_x86.cc new file mode 100644 index 00000000000..02dbf2920eb --- /dev/null +++ b/mysys/crc32/crc32c_x86.cc @@ -0,0 +1,457 @@ +/* Copyright (c) 2024, MariaDB plc + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include +#include +#include + +#ifdef _MSC_VER +# include +# if 0 /* So far, we have no environment where this could be tested. */ +# define USE_VPCLMULQDQ /* nothing */ +# endif +#else +# include +# if __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 8) +# define TARGET "pclmul,avx512f,avx512dq,avx512bw,avx512vl,vpclmulqdq" +# define USE_VPCLMULQDQ __attribute__((target(TARGET))) +# endif +#endif + +extern "C" unsigned crc32c_sse42(unsigned crc, const void* buf, size_t size); + +constexpr uint32_t cpuid_ecx_SSE42= 1U << 20; +constexpr uint32_t cpuid_ecx_SSE42_AND_PCLMUL= cpuid_ecx_SSE42 | 1U << 1; + +static uint32_t cpuid_ecx() +{ +#ifdef __GNUC__ + uint32_t reax= 0, rebx= 0, recx= 0, redx= 0; + __cpuid(1, reax, rebx, recx, redx); + return recx; +#elif defined _MSC_VER + int regs[4]; + __cpuid(regs, 1); + return regs[2]; +#else +# error "unknown compiler" +#endif +} + +typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t); +extern "C" unsigned int crc32_pclmul(unsigned int, const void *, size_t); +extern "C" unsigned int crc32c_3way(unsigned int, const void *, size_t); + +#ifdef USE_VPCLMULQDQ +# include + +# ifdef _MSC_VER +/* MSVC does not seem to define this intrinsic for vmovdqa */ +# define _mm_load_epi32(x) *reinterpret_cast(x) +# endif + +/* + This implementation is based on + crc32_by16_vclmul_avx512 and crc32_refl_by16_vclmul_avx512 + in https://github.com/intel/intel-ipsec-mb/ with some optimizations. + The // comments in crc32_avx512() correspond to assembler labels. +*/ + +/** table of constants corresponding to a CRC polynomial up to degree 32 */ +struct alignas(64) crc32_tab +{ + const uint64_t b2048[2], b1024[2]; + alignas(64) const uint64_t b896[6]; /* includes b786, b640 */ + const uint64_t b512[2]; + const uint64_t b384[2], b256[2], b128[2], zeropad_for_b384[2]; + const uint64_t b64[2], b32[2]; +}; + +/** ISO 3309 CRC-32 (reflected polynomial 0x04C11DB7); zlib crc32() */ +static const crc32_tab refl32 = { + { 0x00000000e95c1271, 0x00000000ce3371cb }, + { 0x00000000910eeec1, 0x0000000033fff533 }, + { 0x000000000cbec0ed, 0x0000000031f8303f, + 0x0000000057c54819, 0x00000000df068dc2, + 0x00000000ae0b5394, 0x000000001c279815 }, + { 0x000000001d9513d7, 0x000000008f352d95 }, + { 0x00000000af449247, 0x000000003db1ecdc }, + { 0x0000000081256527, 0x00000000f1da05aa }, + { 0x00000000ccaa009e, 0x00000000ae689191 }, + { 0, 0 }, + { 0x00000000ccaa009e, 0x00000000b8bc6765 }, + { 0x00000001f7011640, 0x00000001db710640 } +}; + +/** Castagnoli CRC-32C (reflected polynomial 0x1EDC6F41) */ +static const crc32_tab refl32c = { + { 0x00000000b9e02b86, 0x00000000dcb17aa4 }, + { 0x000000000d3b6092, 0x000000006992cea2 }, + { 0x0000000047db8317, 0x000000002ad91c30, + 0x000000000715ce53, 0x00000000c49f4f67, + 0x0000000039d3b296, 0x00000000083a6eec }, + { 0x000000009e4addf8, 0x00000000740eef02 }, + { 0x00000000ddc0152b, 0x000000001c291d04 }, + { 0x00000000ba4fc28e, 0x000000003da6d0cb }, + { 0x00000000493c7d27, 0x00000000f20c0dfe }, + { 0, 0 }, + { 0x00000000493c7d27, 0x00000000dd45aab8 }, + { 0x00000000dea713f0, 0x0000000105ec76f0 } +}; + +/** Some ternary functions */ +class ternary +{ + static constexpr uint8_t A = 0b11110000; + static constexpr uint8_t B = 0b11001100; + static constexpr uint8_t C = 0b10101010; +public: + static constexpr uint8_t XOR3 = A ^ B ^ C; + static constexpr uint8_t XNOR3 = uint8_t(~(A ^ B ^ C)); + static constexpr uint8_t XOR2_AND = (A ^ B) & C; +}; + +USE_VPCLMULQDQ +/** @return a^b^c */ +static inline __m128i xor3_128(__m128i a, __m128i b, __m128i c) +{ + return _mm_ternarylogic_epi64(a, b, c, ternary::XOR3); +} + +USE_VPCLMULQDQ +/** @return ~(a^b^c) */ +static inline __m128i xnor3_128(__m128i a, __m128i b, __m128i c) +{ + return _mm_ternarylogic_epi64(a, b, c, ternary::XNOR3); +} + +USE_VPCLMULQDQ +/** @return a^b^c */ +static inline __m512i xor3_512(__m512i a, __m512i b, __m512i c) +{ + return _mm512_ternarylogic_epi64(a, b, c, ternary::XOR3); +} + +USE_VPCLMULQDQ +/** @return (a^b)&c */ +static inline __m128i xor2_and_128(__m128i a, __m128i b, __m128i c) +{ + return _mm_ternarylogic_epi64(a, b, c, ternary::XOR2_AND); +} + +USE_VPCLMULQDQ +/** Load 64 bytes */ +static inline __m512i load512(const char *b) { return _mm512_loadu_epi8(b); } + +USE_VPCLMULQDQ +/** Load 16 bytes */ +static inline __m128i load128(const char *b) { return _mm_loadu_epi64(b); } + +/** Combine 512 data bits with CRC */ +USE_VPCLMULQDQ +static inline __m512i combine512(__m512i a, __m512i tab, __m512i b) +{ + return xor3_512(b, _mm512_clmulepi64_epi128(a, tab, 0x01), + _mm512_clmulepi64_epi128(a, tab, 0x10)); +} + +# define xor512(a, b) _mm512_xor_epi64(a, b) +# define xor256(a, b) _mm256_xor_epi64(a, b) +# define xor128(a, b) _mm_xor_epi64(a, b) +# define and128(a, b) _mm_and_si128(a, b) + +template USE_VPCLMULQDQ +/** Pick a 128-bit component of a 512-bit vector */ +static inline __m512i extract512_128(__m512i a) +{ + static_assert(bits <= 3, "usage"); +# if defined __GNUC__ && __GNUC__ >= 11 + /* While technically incorrect, this would seem to translate into a + vextracti32x4 instruction, which actually outputs a ZMM register + (anything above the XMM range is cleared). */ + return _mm512_castsi128_si512(_mm512_extracti64x2_epi64(a, bits)); +# else + /* On clang, this is needed in order to get a correct result. */ + return _mm512_maskz_shuffle_i64x2(3, a, a, bits); +# endif +} + +alignas(16) static const uint64_t shuffle128[4] = { + 0x8786858483828100, 0x8f8e8d8c8b8a8988, + 0x0706050403020100, 0x000e0d0c0b0a0908 +}; + +static const __mmask16 size_mask[16] = { + 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, + 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff +}; + +alignas(16) static const uint64_t shift128[4] = { + 0x8786858483828100, 0x8f8e8d8c8b8a8988, + 0x0706050403020100, 0x000e0d0c0b0a0908 +}; + +static const char shift_1_to_3_reflect[7 + 11] = { + -1, -1, -1, -1, -1, -1, -1, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 +}; + +USE_VPCLMULQDQ +static unsigned crc32_avx512(unsigned crc, const char *buf, size_t size, + const crc32_tab &tab) +{ + const __m512i crc_in = _mm512_castsi128_si512(_mm_cvtsi32_si128(~crc)), + b512 = _mm512_broadcast_i32x4(_mm_load_epi32(tab.b512)); + __m128i crc_out; + __m512i lo; + + if (size >= 256) { + lo = xor512(load512(buf), crc_in); + __m512i l1 = load512(buf + 64); + + const __m512i b1024 = _mm512_broadcast_i32x4(_mm_load_epi32(&tab.b1024)); + size -= 256; + if (size >= 256) { + __m512i h0 = load512(buf + 128), + hi = load512(buf + 192); + const __m512i b2048 = _mm512_broadcast_i32x4(_mm_load_epi32(&tab.b2048)); + size -= 256; + do { + buf += 256; + lo = combine512(lo, b2048, load512(buf)); + l1 = combine512(l1, b2048, load512(buf + 64)); + h0 = combine512(h0, b2048, load512(buf + 128)); + hi = combine512(hi, b2048, load512(buf + 192)); + size -= 256; + } while (ssize_t(size) >= 0); + + buf += 256; + lo = combine512(lo, b1024, h0); + l1 = combine512(l1, b1024, hi); + size += 128; + } else { + do { + buf += 128; + lo = combine512(lo, b1024, load512(buf)); + l1 = combine512(l1, b1024, load512(buf + 64)); + size -= 128; + } while (ssize_t(size) >= 0); + + buf += 128; + } + + if (ssize_t(size) >= -64) { + size += 128; + lo = combine512(lo, b512, l1); + goto fold_64_B_loop; + } + + const __m512i + b896 = _mm512_load_epi32(&tab.b896), + b384 = _mm512_load_epi32(&tab.b384); + + __m512i c4 = xor3_512(_mm512_clmulepi64_epi128(lo, b896, 1), + _mm512_clmulepi64_epi128(lo, b896, 0x10), + _mm512_clmulepi64_epi128(l1, b384, 1)); + c4 = xor3_512(c4, _mm512_clmulepi64_epi128(l1, b384, 0x10), + extract512_128<3>(l1)); + + __m256i c2 = _mm512_castsi512_si256(_mm512_shuffle_i64x2(c4, c4, 0b01001110)); + c2 = xor256(c2, _mm512_castsi512_si256(c4)); + crc_out = xor128(_mm256_extracti64x2_epi64(c2, 1), + _mm256_castsi256_si128(c2)); + size += 128 - 16; + goto final_reduction; + } + + __m128i b; + + // less_than_256 + if (size >= 32) { + if (size >= 64) { + lo = xor512(load512(buf), crc_in); + + while (buf += 64, (size -= 64) >= 64) + fold_64_B_loop: + lo = combine512(lo, b512, load512(buf)); + + // reduce_64B + const __m512i b384 = _mm512_load_epi32(&tab.b384); + __m512i crc512 = + xor3_512(_mm512_clmulepi64_epi128(lo, b384, 1), + _mm512_clmulepi64_epi128(lo, b384, 0x10), + extract512_128<3>(lo)); + crc512 = xor512(crc512, _mm512_shuffle_i64x2(crc512, crc512, 0b01001110)); + const __m256i crc256 = _mm512_castsi512_si256(crc512); + crc_out = xor128(_mm256_extracti64x2_epi64(crc256, 1), + _mm256_castsi256_si128(crc256)); + size -= 16; + } else { + // less_than_64 + crc_out = xor128(load128(buf), + _mm512_castsi512_si128(crc_in)); + buf += 16; + size -= 32; + } + + final_reduction: + b = _mm_load_epi32(&tab.b128); + + while (ssize_t(size) >= 0) { + // reduction_loop_16B + crc_out = xor3_128(load128(buf), + _mm_clmulepi64_si128(crc_out, b, 1), + _mm_clmulepi64_si128(crc_out, b, 0x10)); + buf += 16; + size -= 16; + } + // final_reduction_for_128 + + size += 16; + if (size) { + get_last_two_xmms: + const __m128i crc2 = crc_out, d = load128(buf + (size - 16)); + __m128i S = load128(reinterpret_cast(shuffle128) + size); + crc_out = _mm_shuffle_epi8(crc_out, S); + S = xor128(S, _mm_set1_epi32(0x80808080)); + crc_out = xor3_128(_mm_blendv_epi8(_mm_shuffle_epi8(crc2, S), d, S), + _mm_clmulepi64_si128(crc_out, b, 1), + _mm_clmulepi64_si128(crc_out, b, 0x10)); + } + + done_128: + __m128i crc_tmp; + b = _mm_load_epi32(&tab.b64); + crc_tmp = xor128(_mm_clmulepi64_si128(crc_out, b, 0x00), + _mm_srli_si128(crc_out, 8)); + crc_out = _mm_slli_si128(crc_tmp, 4); + crc_out = _mm_clmulepi64_si128(crc_out, b, 0x10); + crc_out = xor128(crc_out, crc_tmp); + + barrett: + b = _mm_load_epi32(&tab.b32); + crc_tmp = crc_out; + crc_out = and128(crc_out, _mm_set_epi64x(~0ULL, ~0xFFFFFFFFULL)); + crc_out = _mm_clmulepi64_si128(crc_out, b, 0); + crc_out = xor2_and_128(crc_out, crc_tmp, _mm_set_epi64x(0, ~0ULL)); + crc_out = xnor3_128(crc_out, crc_tmp, + _mm_clmulepi64_si128(crc_out, b, 0x10)); + return _mm_extract_epi32(crc_out, 2); + } else { + // less_than_32 + if (size > 0) { + if (size > 16) { + crc_out = xor128(load128(buf), + _mm512_castsi512_si128(crc_in)); + buf += 16; + size -= 16; + b = _mm_load_epi32(&tab.b128); + goto get_last_two_xmms; + } else if (size < 16) { + crc_out = _mm_maskz_loadu_epi8(size_mask[size - 1], buf); + crc_out = xor128(crc_out, _mm512_castsi512_si128(crc_in)); + + if (size >= 4) { + crc_out = _mm_shuffle_epi8 + (crc_out, + load128(reinterpret_cast(shift128) + size)); + goto done_128; + } else { + // only_less_than_4 + /* Shift, zero-filling 5 to 7 of the 8-byte crc_out */ + crc_out = _mm_shuffle_epi8(crc_out, + load128(shift_1_to_3_reflect + size - 1)); + goto barrett; + } + } else { + crc_out = xor128(load128(buf), _mm512_castsi512_si128(crc_in)); + goto done_128; + } + } else + return crc; + } +} + +static ATTRIBUTE_NOINLINE int have_vpclmulqdq() +{ +# ifdef _MSC_VER + int regs[4]; + __cpuidex(regs, 7, 0); + uint32_t ebx = regs[1], ecx = regs[2]; +# else + uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; + __cpuid_count(7, 0, eax, ebx, ecx, edx); +# endif + return ecx & 1U<<10/*VPCLMULQDQ*/ && + !(~ebx & ((1U<<16/*AVX512F*/ | 1U<<17/*AVX512DQ*/ | + 1U<<30/*AVX512BW*/ | 1U<<31/*AVX512VL*/))); +} + +static unsigned crc32_vpclmulqdq(unsigned crc, const void *buf, size_t size) +{ + return crc32_avx512(crc, static_cast(buf), size, refl32); +} + +static unsigned crc32c_vpclmulqdq(unsigned crc, const void *buf, size_t size) +{ + return crc32_avx512(crc, static_cast(buf), size, refl32c); +} +#endif + +extern "C" my_crc32_t crc32_pclmul_enabled(void) +{ + if (~cpuid_ecx() & cpuid_ecx_SSE42_AND_PCLMUL) + return nullptr; +#ifdef USE_VPCLMULQDQ + if (have_vpclmulqdq()) + return crc32_vpclmulqdq; +#endif + return crc32_pclmul; +} + +extern "C" my_crc32_t crc32c_x86_available(void) +{ +#ifdef USE_VPCLMULQDQ + if (have_vpclmulqdq()) + return crc32c_vpclmulqdq; +#endif +#if SIZEOF_SIZE_T == 8 + switch (cpuid_ecx() & cpuid_ecx_SSE42_AND_PCLMUL) { + case cpuid_ecx_SSE42_AND_PCLMUL: + return crc32c_3way; + case cpuid_ecx_SSE42: + return crc32c_sse42; + } +#else + if (cpuid_ecx() & cpuid_ecx_SSE42) + return crc32c_sse42; +#endif + return nullptr; +} + +extern "C" const char *crc32c_x86_impl(my_crc32_t c) +{ +#ifdef USE_VPCLMULQDQ + if (c == crc32c_vpclmulqdq) + return "Using AVX512 instructions"; +#endif +#if SIZEOF_SIZE_T == 8 + if (c == crc32c_3way) + return "Using crc32 + pclmulqdq instructions"; +#endif + if (c == crc32c_sse42) + return "Using SSE4.2 crc32 instructions"; + return nullptr; +} diff --git a/mysys/crc32/crc_ppc64.h b/mysys/crc32/crc_ppc64.h index eb9379abc6c..81bbc16dfed 100644 --- a/mysys/crc32/crc_ppc64.h +++ b/mysys/crc32/crc_ppc64.h @@ -28,7 +28,7 @@ * any later version, or * b) the Apache License, Version 2.0 */ - +#include #include @@ -57,12 +57,13 @@ static unsigned int __attribute__ ((aligned (32))) __crc32_vpmsum(unsigned int crc, const void* p, unsigned long len); -unsigned int CRC32_FUNCTION(unsigned int crc, const unsigned char *p, - unsigned long len) +unsigned CRC32_FUNCTION(unsigned crc, const void *buffer, size_t len) { unsigned int prealign; unsigned int tail; + const unsigned char *p = buffer; + #ifdef CRC_XOR crc ^= 0xffffffff; #endif diff --git a/mysys/crc32ieee.cc b/mysys/crc32ieee.cc index 14e8017de4b..c11bdacf77a 100644 --- a/mysys/crc32ieee.cc +++ b/mysys/crc32ieee.cc @@ -26,23 +26,22 @@ static unsigned int my_crc32_zlib(unsigned int crc, const void *data, return (unsigned int) crc32(crc, (const Bytef *)data, (unsigned int) len); } -#ifdef HAVE_PCLMUL -extern "C" int crc32_pclmul_enabled(); -extern "C" unsigned int crc32_pclmul(unsigned int, const void *, size_t); -#elif defined(__GNUC__) && defined(HAVE_ARMV8_CRC) +typedef unsigned int (*my_crc32_t)(unsigned int, const void *, size_t); + +#if defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __x86_64__ +extern "C" my_crc32_t crc32_pclmul_enabled(); +#elif defined HAVE_ARMV8_CRC extern "C" int crc32_aarch64_available(); extern "C" unsigned int crc32_aarch64(unsigned int, const void *, size_t); #endif -typedef unsigned int (*my_crc32_t)(unsigned int, const void *, size_t); - static my_crc32_t init_crc32() { -#ifdef HAVE_PCLMUL - if (crc32_pclmul_enabled()) - return crc32_pclmul; -#elif defined(__GNUC__) && defined(HAVE_ARMV8_CRC) +#if defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __x86_64__ + if (my_crc32_t crc= crc32_pclmul_enabled()) + return crc; +#elif defined HAVE_ARMV8_CRC if (crc32_aarch64_available()) return crc32_aarch64; #endif diff --git a/mysys/errors.c b/mysys/errors.c index b522590ae7b..76ca70fc3b5 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -114,6 +114,13 @@ void init_glob_errs() } #endif +static void my_space_sleep(uint seconds) +{ + sleep(seconds); +} + +void (*my_sleep_for_space)(uint seconds)= my_space_sleep; + void wait_for_free_space(const char *filename, int errors) { if (errors == 0) @@ -125,7 +132,7 @@ void wait_for_free_space(const char *filename, int errors) MYF(ME_BELL | ME_ERROR_LOG | ME_WARNING), MY_WAIT_FOR_USER_TO_FIX_PANIC, MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); - (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); + my_sleep_for_space(MY_WAIT_FOR_USER_TO_FIX_PANIC); } const char **get_global_errmsgs(int nr __attribute__((unused))) diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 5fb84f1fe2f..449302a971e 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -172,7 +172,7 @@ static void validate_value(const char *key, const char *value, #define validate_value(key, value, filename) (void)filename #endif -#define SET_HO_ERROR_AND_CONTINUE(e) { ho_error= (e); continue; } +#define SET_HO_ERROR_AND_CONTINUE(e) { ho_error= (e); (*argc)--; continue; } /** Handle command line options. @@ -903,7 +903,7 @@ static int setval(const struct my_option *opts, void *value, char *argument, } if (err) { - res= EXIT_UNKNOWN_SUFFIX; + res= err; goto ret; }; } @@ -1040,7 +1040,7 @@ static inline ulonglong eval_num_suffix(char *suffix, int *error) case 'E': return 1ULL << 60; default: - *error= 1; + *error= EXIT_UNKNOWN_SUFFIX; return 0ULL; } } @@ -1066,15 +1066,18 @@ static longlong eval_num_suffix_ll(char *argument, if (errno == ERANGE) { my_getopt_error_reporter(ERROR_LEVEL, - "Incorrect integer value: '%s'", argument); - *error= 1; + "Integer value out of range for int64:" + " '%s' for %s", + argument, option_name); + *error= EXIT_ARGUMENT_INVALID; DBUG_RETURN(0); } num*= eval_num_suffix(endchar, error); if (*error) - fprintf(stderr, - "Unknown suffix '%c' used for variable '%s' (value '%s')\n", - *endchar, option_name, argument); + my_getopt_error_reporter(ERROR_LEVEL, + "Unknown suffix '%c' used for variable '%s' (value '%s'). " + "Legal suffix characters are: K, M, G, T, P, E", + *endchar, option_name, argument); DBUG_RETURN(num); } @@ -1097,7 +1100,7 @@ static ulonglong eval_num_suffix_ull(char *argument, my_getopt_error_reporter(ERROR_LEVEL, "Incorrect unsigned value: '%s' for %s", argument, option_name); - *error= 1; + *error= EXIT_ARGUMENT_INVALID; DBUG_RETURN(0); } *error= 0; @@ -1106,15 +1109,18 @@ static ulonglong eval_num_suffix_ull(char *argument, if (errno == ERANGE) { my_getopt_error_reporter(ERROR_LEVEL, - "Incorrect integer value: '%s' for %s", + "Integer value out of range for uint64:" + " '%s' for %s", argument, option_name); - *error= 1; + *error= EXIT_ARGUMENT_INVALID; DBUG_RETURN(0); } num*= eval_num_suffix(endchar, error); if (*error) my_getopt_error_reporter(ERROR_LEVEL, - "Unknown suffix '%c' used for variable '%s' (value '%s')", + "Unknown suffix '%c' used for variable '%s'" + " (value '%s')." + " Legal suffix characters are: K, M, G, T, P, E", *endchar, option_name, argument); DBUG_RETURN(num); } @@ -1134,6 +1140,8 @@ static ulonglong eval_num_suffix_ull(char *argument, static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) { longlong num=eval_num_suffix_ll(arg, err, (char*) optp->name); + if (*err) + return(0); return getopt_ll_limit_value(num, optp, NULL); } @@ -1211,6 +1219,8 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err) { ulonglong num= eval_num_suffix_ull(arg, err, (char*) optp->name); + if (*err) + return(0); return getopt_ull_limit_value(num, optp, NULL); } diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 2e8decd7d06..b2436d2be27 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -220,7 +220,11 @@ void my_thread_global_end(void) fprintf(stderr, "Error in my_thread_global_end(): %d threads didn't exit\n", THR_thread_count); -#endif +#endif /* HAVE_PTHREAD_KILL */ +#ifdef SAFEMALLOC + /* We know we will have memoryleaks, suppress the leak report */ + sf_leaking_memory= 1; +#endif /* SAFEMALLOC */ all_threads_killed= 0; break; } @@ -234,9 +238,7 @@ void my_thread_global_end(void) that could use them. */ if (all_threads_killed) - { my_thread_destroy_internal_mutex(); - } my_thread_global_init_done= 0; } diff --git a/plugin/auth_ed25519/ref10/fe_mul.c b/plugin/auth_ed25519/ref10/fe_mul.c index 26ca8b3682d..8ccad3c30d8 100644 --- a/plugin/auth_ed25519/ref10/fe_mul.c +++ b/plugin/auth_ed25519/ref10/fe_mul.c @@ -1,5 +1,6 @@ #include "fe.h" #include "crypto_int64.h" +#include "crypto_uint64.h" /* h = f * g @@ -179,16 +180,16 @@ void fe_mul(fe h,const fe f,const fe g) crypto_int64 h7 = f0g7+f1g6 +f2g5 +f3g4 +f4g3 +f5g2 +f6g1 +f7g0 +f8g9_19+f9g8_19; crypto_int64 h8 = f0g8+f1g7_2 +f2g6 +f3g5_2 +f4g4 +f5g3_2 +f6g2 +f7g1_2 +f8g0 +f9g9_38; crypto_int64 h9 = f0g9+f1g8 +f2g7 +f3g6 +f4g5 +f5g4 +f6g3 +f7g2 +f8g1 +f9g0 ; - crypto_int64 carry0; - crypto_int64 carry1; - crypto_int64 carry2; - crypto_int64 carry3; - crypto_int64 carry4; - crypto_int64 carry5; - crypto_int64 carry6; - crypto_int64 carry7; - crypto_int64 carry8; - crypto_int64 carry9; + crypto_uint64 carry0; + crypto_uint64 carry1; + crypto_uint64 carry2; + crypto_uint64 carry3; + crypto_uint64 carry4; + crypto_uint64 carry5; + crypto_uint64 carry6; + crypto_uint64 carry7; + crypto_uint64 carry8; + crypto_uint64 carry9; /* |h0| <= (1.65*1.65*2^52*(1+19+19+19+19)+1.65*1.65*2^50*(38+38+38+38+38)) diff --git a/plugin/auth_ed25519/ref10/fe_sq.c b/plugin/auth_ed25519/ref10/fe_sq.c index 8dd119841c6..3c718033a0a 100644 --- a/plugin/auth_ed25519/ref10/fe_sq.c +++ b/plugin/auth_ed25519/ref10/fe_sq.c @@ -1,5 +1,6 @@ #include "fe.h" #include "crypto_int64.h" +#include "crypto_uint64.h" /* h = f * f @@ -106,16 +107,16 @@ void fe_sq(fe h,const fe f) crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38; crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38; crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2; - crypto_int64 carry0; - crypto_int64 carry1; - crypto_int64 carry2; - crypto_int64 carry3; - crypto_int64 carry4; - crypto_int64 carry5; - crypto_int64 carry6; - crypto_int64 carry7; - crypto_int64 carry8; - crypto_int64 carry9; + crypto_uint64 carry0; + crypto_uint64 carry1; + crypto_uint64 carry2; + crypto_uint64 carry3; + crypto_uint64 carry4; + crypto_uint64 carry5; + crypto_uint64 carry6; + crypto_uint64 carry7; + crypto_uint64 carry8; + crypto_uint64 carry9; carry0 = (h0 + (crypto_int64) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26; carry4 = (h4 + (crypto_int64) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26; diff --git a/plugin/auth_ed25519/ref10/fe_sq2.c b/plugin/auth_ed25519/ref10/fe_sq2.c index 026ed3aacf5..97c03cf4899 100644 --- a/plugin/auth_ed25519/ref10/fe_sq2.c +++ b/plugin/auth_ed25519/ref10/fe_sq2.c @@ -1,5 +1,6 @@ #include "fe.h" #include "crypto_int64.h" +#include "crypto_uint64.h" /* h = 2 * f * f @@ -106,16 +107,16 @@ void fe_sq2(fe h,const fe f) crypto_int64 h7 = f0f7_2+f1f6_2 +f2f5_2 +f3f4_2 +f8f9_38; crypto_int64 h8 = f0f8_2+f1f7_4 +f2f6_2 +f3f5_4 +f4f4 +f9f9_38; crypto_int64 h9 = f0f9_2+f1f8_2 +f2f7_2 +f3f6_2 +f4f5_2; - crypto_int64 carry0; - crypto_int64 carry1; - crypto_int64 carry2; - crypto_int64 carry3; - crypto_int64 carry4; - crypto_int64 carry5; - crypto_int64 carry6; - crypto_int64 carry7; - crypto_int64 carry8; - crypto_int64 carry9; + crypto_uint64 carry0; + crypto_uint64 carry1; + crypto_uint64 carry2; + crypto_uint64 carry3; + crypto_uint64 carry4; + crypto_uint64 carry5; + crypto_uint64 carry6; + crypto_uint64 carry7; + crypto_uint64 carry8; + crypto_uint64 carry9; h0 += h0; h1 += h1; diff --git a/plugin/auth_ed25519/ref10/fe_tobytes.c b/plugin/auth_ed25519/ref10/fe_tobytes.c index 0a63baf9c17..a4dff2c1574 100644 --- a/plugin/auth_ed25519/ref10/fe_tobytes.c +++ b/plugin/auth_ed25519/ref10/fe_tobytes.c @@ -1,4 +1,5 @@ #include "fe.h" +#include "crypto_uint32.h" /* Preconditions: @@ -38,16 +39,16 @@ void fe_tobytes(unsigned char *s,const fe h) crypto_int32 h8 = h[8]; crypto_int32 h9 = h[9]; crypto_int32 q; - crypto_int32 carry0; - crypto_int32 carry1; - crypto_int32 carry2; - crypto_int32 carry3; - crypto_int32 carry4; - crypto_int32 carry5; - crypto_int32 carry6; - crypto_int32 carry7; - crypto_int32 carry8; - crypto_int32 carry9; + crypto_uint32 carry0; + crypto_uint32 carry1; + crypto_uint32 carry2; + crypto_uint32 carry3; + crypto_uint32 carry4; + crypto_uint32 carry5; + crypto_uint32 carry6; + crypto_uint32 carry7; + crypto_uint32 carry8; + crypto_uint32 carry9; q = (19 * h9 + (((crypto_int32) 1) << 24)) >> 25; q = (h0 + q) >> 26; @@ -87,32 +88,32 @@ void fe_tobytes(unsigned char *s,const fe h) s[0] = h0 >> 0; s[1] = h0 >> 8; s[2] = h0 >> 16; - s[3] = (h0 >> 24) | (h1 << 2); + s[3] = (h0 >> 24) | ((crypto_uint32)h1 << 2); s[4] = h1 >> 6; s[5] = h1 >> 14; - s[6] = (h1 >> 22) | (h2 << 3); + s[6] = (h1 >> 22) | ((crypto_uint32)h2 << 3); s[7] = h2 >> 5; s[8] = h2 >> 13; - s[9] = (h2 >> 21) | (h3 << 5); + s[9] = (h2 >> 21) | ((crypto_uint32)h3 << 5); s[10] = h3 >> 3; s[11] = h3 >> 11; - s[12] = (h3 >> 19) | (h4 << 6); + s[12] = (h3 >> 19) | ((crypto_uint32)h4 << 6); s[13] = h4 >> 2; s[14] = h4 >> 10; s[15] = h4 >> 18; s[16] = h5 >> 0; s[17] = h5 >> 8; s[18] = h5 >> 16; - s[19] = (h5 >> 24) | (h6 << 1); + s[19] = (h5 >> 24) | ((crypto_uint32)h6 << 1); s[20] = h6 >> 7; s[21] = h6 >> 15; - s[22] = (h6 >> 23) | (h7 << 3); + s[22] = (h6 >> 23) | ((crypto_uint32)h7 << 3); s[23] = h7 >> 5; s[24] = h7 >> 13; - s[25] = (h7 >> 21) | (h8 << 4); + s[25] = (h7 >> 21) | ((crypto_uint32)h8 << 4); s[26] = h8 >> 4; s[27] = h8 >> 12; - s[28] = (h8 >> 20) | (h9 << 6); + s[28] = (h8 >> 20) | ((crypto_uint32)h9 << 6); s[29] = h9 >> 2; s[30] = h9 >> 10; s[31] = h9 >> 18; diff --git a/plugin/auth_ed25519/ref10/ge_scalarmult_base.c b/plugin/auth_ed25519/ref10/ge_scalarmult_base.c index 421e4fa0fba..9a4ced2182f 100644 --- a/plugin/auth_ed25519/ref10/ge_scalarmult_base.c +++ b/plugin/auth_ed25519/ref10/ge_scalarmult_base.c @@ -35,7 +35,7 @@ static void select(ge_precomp *t,int pos,signed char b) { ge_precomp minust; unsigned char bnegative = negative(b); - unsigned char babs = b - (((-bnegative) & b) << 1); + unsigned char babs = b - ((unsigned char)((-bnegative) & b) << 1); ge_precomp_0(t); cmov(t,&base[pos][0],equal(babs,1)); diff --git a/plugin/auth_ed25519/ref10/sc_muladd.c b/plugin/auth_ed25519/ref10/sc_muladd.c index 6f1e9d02d60..7bf222be815 100644 --- a/plugin/auth_ed25519/ref10/sc_muladd.c +++ b/plugin/auth_ed25519/ref10/sc_muladd.c @@ -95,29 +95,29 @@ void sc_muladd(unsigned char *s,const unsigned char *a,const unsigned char *b,co crypto_int64 s21; crypto_int64 s22; crypto_int64 s23; - crypto_int64 carry0; - crypto_int64 carry1; - crypto_int64 carry2; - crypto_int64 carry3; - crypto_int64 carry4; - crypto_int64 carry5; - crypto_int64 carry6; - crypto_int64 carry7; - crypto_int64 carry8; - crypto_int64 carry9; - crypto_int64 carry10; - crypto_int64 carry11; - crypto_int64 carry12; - crypto_int64 carry13; - crypto_int64 carry14; - crypto_int64 carry15; - crypto_int64 carry16; - crypto_int64 carry17; - crypto_int64 carry18; - crypto_int64 carry19; - crypto_int64 carry20; - crypto_int64 carry21; - crypto_int64 carry22; + crypto_uint64 carry0; + crypto_uint64 carry1; + crypto_uint64 carry2; + crypto_uint64 carry3; + crypto_uint64 carry4; + crypto_uint64 carry5; + crypto_uint64 carry6; + crypto_uint64 carry7; + crypto_uint64 carry8; + crypto_uint64 carry9; + crypto_uint64 carry10; + crypto_uint64 carry11; + crypto_uint64 carry12; + crypto_uint64 carry13; + crypto_uint64 carry14; + crypto_uint64 carry15; + crypto_uint64 carry16; + crypto_uint64 carry17; + crypto_uint64 carry18; + crypto_uint64 carry19; + crypto_uint64 carry20; + crypto_uint64 carry21; + crypto_uint64 carry22; s0 = c0 + a0*b0; s1 = c1 + a0*b1 + a1*b0; diff --git a/plugin/auth_ed25519/ref10/sc_reduce.c b/plugin/auth_ed25519/ref10/sc_reduce.c index d01f5a5737e..422d94b6faf 100644 --- a/plugin/auth_ed25519/ref10/sc_reduce.c +++ b/plugin/auth_ed25519/ref10/sc_reduce.c @@ -58,23 +58,23 @@ void sc_reduce(unsigned char *s) crypto_int64 s21 = 2097151 & (load_3(s + 55) >> 1); crypto_int64 s22 = 2097151 & (load_4(s + 57) >> 6); crypto_int64 s23 = (load_4(s + 60) >> 3); - crypto_int64 carry0; - crypto_int64 carry1; - crypto_int64 carry2; - crypto_int64 carry3; - crypto_int64 carry4; - crypto_int64 carry5; - crypto_int64 carry6; - crypto_int64 carry7; - crypto_int64 carry8; - crypto_int64 carry9; - crypto_int64 carry10; - crypto_int64 carry11; - crypto_int64 carry12; - crypto_int64 carry13; - crypto_int64 carry14; - crypto_int64 carry15; - crypto_int64 carry16; + crypto_uint64 carry0; + crypto_uint64 carry1; + crypto_uint64 carry2; + crypto_uint64 carry3; + crypto_uint64 carry4; + crypto_uint64 carry5; + crypto_uint64 carry6; + crypto_uint64 carry7; + crypto_uint64 carry8; + crypto_uint64 carry9; + crypto_uint64 carry10; + crypto_uint64 carry11; + crypto_uint64 carry12; + crypto_uint64 carry13; + crypto_uint64 carry14; + crypto_uint64 carry15; + crypto_uint64 carry16; s11 += s23 * 666643; s12 += s23 * 470296; diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index ba4850f4cba..845e40ccf52 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -339,6 +339,10 @@ static int free(void *p) shutdown_plugin= true; mysql_cond_signal(&sleep_condition); mysql_mutex_unlock(&sleep_mutex); + + for (uint i= 0; i < url_count; i++) + urls[i]->abort(); + pthread_join(sender_thread, NULL); mysql_mutex_destroy(&sleep_mutex); diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h index 04fe1ab6aa1..6021eb85860 100644 --- a/plugin/feedback/feedback.h +++ b/plugin/feedback/feedback.h @@ -52,6 +52,7 @@ class Url { const char *url() { return full_url.str; } size_t url_length() { return full_url.length; } + virtual void abort() = 0; virtual int send(const char* data, size_t data_length) = 0; virtual int set_proxy(const char *proxy, size_t proxy_len) { diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc index 98116dd04f1..590bb06cc5f 100644 --- a/plugin/feedback/url_http.cc +++ b/plugin/feedback/url_http.cc @@ -37,8 +37,9 @@ static const uint FOR_WRITING= 1; class Url_http: public Url { protected: const LEX_STRING host, port, path; - bool ssl; LEX_STRING proxy_host, proxy_port; + my_socket fd; + bool ssl; bool use_proxy() { @@ -47,7 +48,8 @@ class Url_http: public Url { Url_http(LEX_STRING &url_arg, LEX_STRING &host_arg, LEX_STRING &port_arg, LEX_STRING &path_arg, bool ssl_arg) : - Url(url_arg), host(host_arg), port(port_arg), path(path_arg), ssl(ssl_arg) + Url(url_arg), host(host_arg), port(port_arg), path(path_arg), + fd(INVALID_SOCKET), ssl(ssl_arg) { proxy_host.length= 0; } @@ -60,6 +62,7 @@ class Url_http: public Url { } public: + void abort(); int send(const char* data, size_t data_length); int set_proxy(const char *proxy, size_t proxy_len) { @@ -158,13 +161,18 @@ Url* http_create(const char *url, size_t url_length) return new Url_http(full_url, host, port, path, ssl); } +void Url_http::abort() +{ + if (fd != INVALID_SOCKET) + closesocket(fd); // interrupt I/O waits +} + /* do the vio_write and check that all data were sent ok */ #define write_check(VIO, DATA, LEN) \ (vio_write((VIO), (uchar*)(DATA), (LEN)) != (LEN)) int Url_http::send(const char* data, size_t data_length) { - my_socket fd= INVALID_SOCKET; char buf[1024]; size_t len= 0; @@ -180,6 +188,7 @@ int Url_http::send(const char* data, size_t data_length) return 1; } + DBUG_ASSERT(fd == INVALID_SOCKET); for (addr= addrs; addr != NULL; addr= addr->ai_next) { fd= socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); @@ -208,6 +217,7 @@ int Url_http::send(const char* data, size_t data_length) sql_print_error("feedback plugin: vio_new failed for url '%s'", full_url.str); closesocket(fd); + fd= INVALID_SOCKET; return 1; } @@ -236,6 +246,7 @@ int Url_http::send(const char* data, size_t data_length) free_vio_ssl_acceptor_fd(ssl_fd); closesocket(fd); vio_delete(vio); + fd= INVALID_SOCKET; return 1; } } @@ -334,6 +345,7 @@ int Url_http::send(const char* data, size_t data_length) } #endif + fd= INVALID_SOCKET; return res; } diff --git a/plugin/hashicorp_key_management/CMakeLists.txt b/plugin/hashicorp_key_management/CMakeLists.txt index bd1eee844ab..809b480f6ac 100644 --- a/plugin/hashicorp_key_management/CMakeLists.txt +++ b/plugin/hashicorp_key_management/CMakeLists.txt @@ -1,10 +1,13 @@ -INCLUDE(FindCURL) +FIND_PACKAGE(CURL) IF(NOT CURL_FOUND) # Can't build plugin + MESSAGE_ONCE(WARNING "Hashicorp Key Management plugin requires curl development package") RETURN() ENDIF() -INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) +SET_PACKAGE_PROPERTIES(CURL PROPERTIES TYPE REQUIRED) + +INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) set(CPACK_RPM_hashicorp-key-management_PACKAGE_SUMMARY "Hashicorp Key Management plugin for MariaDB" PARENT_SCOPE) set(CPACK_RPM_hashicorp-key-management_PACKAGE_DESCRIPTION "This encryption plugin uses Hashicorp Vault for storing encryption diff --git a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc index bdc2f7345f1..dfeb1aca737 100644 --- a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc +++ b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc @@ -13,28 +13,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ -#include #include #include +#include #include +#include +#include +#include #include #include #include #include -#ifdef _WIN32 -#include -#define alloca _alloca -#endif #include #include #include -#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND) -#define HASHICORP_HAVE_EXCEPTIONS 1 -#else -#define HASHICORP_HAVE_EXCEPTIONS 0 -#endif - #define HASHICORP_DEBUG_LOGGING 0 #define PLUGIN_ERROR_HEADER "hashicorp: " @@ -209,15 +202,6 @@ unsigned int if (key_version == ENCRYPTION_KEY_VERSION_INVALID) { clock_t timestamp; -#if HASHICORP_HAVE_EXCEPTIONS - try - { - VER_INFO &ver_info = latest_version_cache.at(key_id); - version = ver_info.key_version; - timestamp = ver_info.timestamp; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { @@ -225,7 +209,6 @@ unsigned int timestamp = ver_iter->second.timestamp; } else -#endif { mtx.unlock(); return ENCRYPTION_KEY_VERSION_INVALID; @@ -246,13 +229,6 @@ unsigned int } } KEY_INFO info; -#if HASHICORP_HAVE_EXCEPTIONS - try - { - info = key_info_cache.at(KEY_ID_AND_VERSION(key_id, version)); - } - catch (const std::out_of_range &e) -#else KEY_MAP::const_iterator key_iter = key_info_cache.find(KEY_ID_AND_VERSION(key_id, version)); if (key_iter != key_info_cache.end()) @@ -260,7 +236,6 @@ unsigned int info = key_iter->second; } else -#endif { mtx.unlock(); return ENCRYPTION_KEY_VERSION_INVALID; @@ -305,20 +280,12 @@ unsigned int HCData::cache_get_version (unsigned int key_id) { unsigned int version; mtx.lock(); -#if HASHICORP_HAVE_EXCEPTIONS - try - { - version = latest_version_cache.at(key_id).key_version; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { version = ver_iter->second.key_version; } else -#endif { version = ENCRYPTION_KEY_VERSION_INVALID; } @@ -331,15 +298,6 @@ unsigned int HCData::cache_check_version (unsigned int key_id) unsigned int version; clock_t timestamp; mtx.lock(); -#if HASHICORP_HAVE_EXCEPTIONS - try - { - VER_INFO &ver_info = latest_version_cache.at(key_id); - version = ver_info.key_version; - timestamp = ver_info.timestamp; - } - catch (const std::out_of_range &e) -#else VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id); if (ver_iter != latest_version_cache.end()) { @@ -347,7 +305,6 @@ unsigned int HCData::cache_check_version (unsigned int key_id) timestamp = ver_iter->second.timestamp; } else -#endif { mtx.unlock(); #if HASHICORP_DEBUG_LOGGING @@ -978,29 +935,6 @@ struct st_mariadb_encryption hashicorp_key_management_plugin= { 0, 0, 0, 0, 0 }; -#ifdef _MSC_VER - -static int setenv (const char *name, const char *value, int overwrite) -{ - if (!overwrite) - { - size_t len= 0; - int rc= getenv_s(&len, NULL, 0, name); - if (rc) - { - return rc; - } - if (len) - { - errno = EINVAL; - return EINVAL; - } - } - return _putenv_s(name, value); -} - -#endif - #define MAX_URL_SIZE 32768 int HCData::init () @@ -1053,7 +987,11 @@ int HCData::init () bool not_equal= token_env != NULL && strcmp(token_env, token) != 0; if (token_env == NULL || not_equal) { - setenv("VAULT_TOKEN", token, 1); +#if defined(HAVE_SETENV) || !defined(_WIN32) + setenv("VAULT_TOKEN", token, 1); +#else + _putenv_s("VAULT_TOKEN", token); +#endif if (not_equal) { my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER diff --git a/plugin/hashicorp_key_management/mysql-test/vault/suite.pm b/plugin/hashicorp_key_management/mysql-test/vault/suite.pm index fce1737311d..bd08ff4fb18 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/suite.pm +++ b/plugin/hashicorp_key_management/mysql-test/vault/suite.pm @@ -1,9 +1,13 @@ package My::Suite::Vault; +use My::Platform; @ISA = qw(My::Suite); use strict; +return "Hashicorp Key Management plugin tests are currently not available on Windows" + if IS_WINDOWS; + return "You need to set the value of the VAULT_ADDR variable" unless $ENV{VAULT_ADDR}; diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test index 9dee7376497..925e89a3140 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test @@ -11,7 +11,7 @@ --exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null --exec vault kv put /bug/4 data=01234567890123456789012345678904 > /dev/null ---let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug/" --hashicorp-key-management-token="$VAULT_TOKEN" +--let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/bug/ --hashicorp-key-management-token=$VAULT_TOKEN --let $restart_noprint=1 --source include/restart_mysqld.inc diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test index c108781bbd2..7d9a952f6d3 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test @@ -20,7 +20,7 @@ --error 0,1 --remove_file $LOG_FILE ---let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=on --hashicorp-key-management-token="$VAULT_TOKEN" +--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=on --hashicorp-key-management-token=$VAULT_TOKEN --let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE --error 1 @@ -30,14 +30,14 @@ --remove_file $LOG_FILE ---let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/good" +--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/good --let $restart_noprint=1 --source include/start_mysqld.inc CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1; INSERT INTO t1 VALUES ('foo'),('bar'); ---let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/good//" +--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/good// --source include/restart_mysqld.inc CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2; diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test index 2e67c2cc639..62253cd7723 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test @@ -24,7 +24,7 @@ SELECT * FROM t1; --exec vault secrets disable bug > /dev/null --exec vault secrets enable -path /bug -version=2 kv > /dev/null --exec vault kv put /bug/1 data=$my_key > /dev/null ---let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug/" --hashicorp-key-management-token="$VAULT_TOKEN" +--let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/bug/ --hashicorp-key-management-token=$VAULT_TOKEN --source include/restart_mysqld.inc CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1; diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test index c446036aaae..4eb7cdcfdef 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test @@ -8,7 +8,7 @@ replace_result $VAULT_ADDR VAULT_ADDR; SHOW GLOBAL variables LIKE "hashicorp%"; --echo # Restart the server with encryption -let $default_parameters="--innodb-tablespaces-encryption --innodb_encrypt_tables=ON"; +let $default_parameters=--innodb-tablespaces-encryption --innodb_encrypt_tables=ON; let $restart_noprint=1; let $restart_parameters=$default_parameters; --source include/restart_mysqld.inc diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.opt b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.opt new file mode 100644 index 00000000000..1df4643562e --- /dev/null +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.opt @@ -0,0 +1 @@ +--innodb --loose-changed_page_bitmaps --innodb-sys-tables --innodb-flush-log-at-trx-commit=2 --sequence diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test index 6ade4e115a1..977535556cc 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test @@ -8,9 +8,13 @@ CREATE TABLE t(i INT) ENGINE INNODB encrypted=yes encryption_key_id=1; INSERT INTO t VALUES(1); -echo # mariabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--error 0,1 +rmdir $targetdir; + +echo # mariabackup backup; + --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; --enable_result_log diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test index 4d26affb467..ef88b61c74c 100644 --- a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test +++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test @@ -16,7 +16,7 @@ --error 0,1 --remove_file $LOG_FILE ---let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=off --hashicorp-key-management-token="$VAULT_TOKEN" +--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=off --hashicorp-key-management-token=$VAULT_TOKEN --let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE --error 1 @@ -76,7 +76,7 @@ --remove_file $LOG_FILE ---let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug///" +--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/bug/// --let $restart_noprint=1 --source include/start_mysqld.inc diff --git a/plugin/test_sql_service/test_sql_service.c b/plugin/test_sql_service/test_sql_service.c index 8b326c6fa46..8a9b3dab61c 100644 --- a/plugin/test_sql_service/test_sql_service.c +++ b/plugin/test_sql_service/test_sql_service.c @@ -129,7 +129,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev) static int run_test(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save, struct st_mysql_value *value) { - *(my_bool*) save= 0; /* Set value for sql_service_run_test */ + *(my_bool*)save= 1; // must initialize the return value return (test_passed= (do_tests() == 0)) == 0; } @@ -140,6 +140,7 @@ static int run_sql(MYSQL *mysql, void *save, struct st_mysql_value *value) int len= 0; MYSQL_RES *res; + *(my_bool*)save= 1; // must initialize the return value str= value->val_str(value, NULL, &len); if (mysql_real_query(mysql, str, len)) diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index a576a7e163f..31fdcac4f24 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -2359,6 +2359,18 @@ Warning 1292 Incorrect inet6 value: '' Warning 1292 Incorrect inet6 value: '' DROP TABLE t1; # +# MDEV-32458 ASAN unknown-crash in Inet6::ascii_to_fbt when casting character string to inet6 +# +CREATE TABLE t1 (c CHAR(3)); +INSERT INTO t1 VALUES ('1:0'),('00:'); +SELECT * FROM t1 WHERE c>CAST('::1' AS INET6); +c +Warnings: +Warning 1292 Incorrect inet6 value: '1:0' +Warning 1292 Incorrect inet6 value: '00:' +DROP TABLE t1; +# End of 10.6 tests +# # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string # SET sql_mode=''; 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 0c56ecfe4bb..cb3d226f9b6 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1701,6 +1701,17 @@ SELECT 1.00 + (b BETWEEN a AND '') AS f FROM t1 ORDER BY f; SELECT 1.00 + (b IN (a,'')) AS f FROM t1 ORDER BY f; DROP TABLE t1; +--echo # +--echo # MDEV-32458 ASAN unknown-crash in Inet6::ascii_to_fbt when casting character string to inet6 +--echo # + +CREATE TABLE t1 (c CHAR(3)); +INSERT INTO t1 VALUES ('1:0'),('00:'); +SELECT * FROM t1 WHERE c>CAST('::1' AS INET6); +DROP TABLE t1; + +--echo # End of 10.6 tests + --echo # --echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string --echo # diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index 03c8d8133e5..d23073d2b84 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -229,7 +229,7 @@ bool Inet6::ascii_to_fbt(const char *str, size_t str_length) continue; } - if (!*p || p >= str_end) + if (p >= str_end || !*p) { DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: " "ending at ':'.", (int) str_length, str)); diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index 38ebf76256b..a4916e2f9c1 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -36,8 +36,8 @@ public: static Create_func_trt s_singleton; protected: - Create_func_trt() = default; - virtual ~Create_func_trt() = default; + Create_func_trt() = default; + virtual ~Create_func_trt() = default; }; template @@ -132,8 +132,8 @@ public: static Create_func_trt_trx_sees s_singleton; protected: - Create_func_trt_trx_sees() = default; - virtual ~Create_func_trt_trx_sees() = default; + Create_func_trt_trx_sees() = default; + virtual ~Create_func_trt_trx_sees() = default; }; template diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index ed54fbd5fd3..1ba63b7759f 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -47,7 +47,7 @@ dirname0=`dirname $0 2>/dev/null` dirname0=`dirname $dirname0 2>/dev/null` case "$0" in - *mysqld_install_db) + *mysql_install_db) echo "$0: Deprecated program name. It will be removed in a future release, use 'mariadb-install-db' instead" 1>&2 ;; esac @@ -350,33 +350,13 @@ then pamtooldir="$builddir/plugin/auth_pam" elif test -n "$basedir" then - bindir="$basedir/bin" # only used in the help text - resolveip=`find_in_dirs resolveip @resolveip_locations@` - if test -z "$resolveip" - then - cannot_find_file resolveip @resolveip_locations@ - exit 1 - fi - mysqld=`find_in_dirs mariadbd @mysqld_locations@` - if test -z "$mysqld" - then - cannot_find_file mariadbd @mysqld_locations@ - exit 1 - fi - langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@` - if test -z "$langdir" - then - cannot_find_file errmsg.sys @errmsg_locations@ - exit 1 - fi - srcpkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@` - buildpkgdatadir=$srcpkgdatadir - if test -z "$srcpkgdatadir" - then - cannot_find_file fill_help_tables.sql @pkgdata_locations@ - exit 1 - fi - plugindir=`find_in_dirs --dir auth_pam.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin $basedir/lib/*/mariadb19/plugin` + bindir="$basedir/@INSTALL_BINDIR@" + resolveip="$bindir/resolveip" + mysqld="$basedir/@INSTALL_SBINDIR@/mariadbd" + langdir="$basedir/@INSTALL_MYSQLSHAREDIR@/english" + srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@" + buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@" + plugindir="$basedir/@INSTALL_PLUGINDIR@" pamtooldir=$plugindir # relative from where the script was run for a relocatable install elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mariadbd" diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 2b540581253..dbbffee7942 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -23,6 +23,22 @@ trap 'exit 3' INT QUIT TERM # Setting the path for some utilities on CentOS export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin" +commandex() +{ + if [ -n "$BASH_VERSION" ]; then + command -v "$1" || : + elif [ -x "$1" ]; then + echo "$1" + else + which "$1" || : + fi +} + +with_printf=1 +if [ -z "$BASH_VERSION" ]; then + [ -z "$(commandex printf)" ] && with_printf=0 +fi + trim_string() { if [ -n "$BASH_VERSION" ]; then @@ -35,9 +51,9 @@ trim_string() y=${#y} x=$(( z-x-1 )) y=$(( y-x+1 )) - printf '%s' "${1:$x:$y}" + echo "${1:$x:$y}" else - printf '' + echo '' fi else local pattern="[[:space:]${2:-}]" @@ -59,9 +75,9 @@ trim_dir() y=$(( y-x+1 )) x="${1:$x:$y}" [ -z "$x" ] && x='.' - printf '%s' "$x" + echo "$x" else - printf '' + echo '' fi else local pattern="[:space:]${2:-}" @@ -85,9 +101,9 @@ trim_right() y=${#y} if [ $y -ne $z ]; then y=$(( y+1 )) - printf '%s' "${1:0:$y}" + echo "${1:0:$y}" else - printf '' + echo '' fi else local pattern="[[:space:]${2:-}]" @@ -95,6 +111,25 @@ trim_right() fi } +trim_left() +{ + if [ -n "$BASH_VERSION" ]; then + local pattern="[![:space:]${2:-}]" + local x="${1#*$pattern}" + local z=${#1} + x=${#x} + if [ $x -ne $z ]; then + x=$(( z-x-1 )) + echo "${1:$x:$z}" + else + echo '' + fi + else + local pattern="[[:space:]${2:-}]" + echo "$1" | sed -E "s/^$pattern+//g" + fi +} + to_minuses() { local x="$1" @@ -105,11 +140,7 @@ to_minuses() x="$t" t="${t#*_}" done - if [ -n "$BASH_VERSION" ]; then - printf '%s' "$r$x" - else - echo "$r$x" - fi + echo "$r$x" } WSREP_SST_OPT_BYPASS=0 @@ -383,9 +414,11 @@ case "$1" in # option name: if [ -n "$BASH_VERSION" ]; then option="${options:0:1}" + elif [ $with_printf -ne 0 ]; then + option=$(printf '%.1s' "$options") else - # If it's not bash, then we need to use slow - # external utilities: + # If it's not bash and without printf, + # then we need to use slow external utilities: option=$(echo "$options" | cut -c1) fi # And the subsequent characters consider option value: @@ -788,17 +821,6 @@ WSREP_SST_OPT_ADDR="$WSREP_SST_OPT_HOST:$WSREP_SST_OPT_PORT$sst_path" readonly WSREP_SST_OPT_ADDR readonly WSREP_SST_OPT_ADDR_PORT -commandex() -{ - if [ -n "$BASH_VERSION" ]; then - command -v "$1" || : - elif [ -x "$1" ]; then - echo "$1" - else - which "$1" || : - fi -} - # try to use my_print_defaults, mysql and mysqldump that come # with the sources (for MTR suite): script_binary=$(dirname "$0") @@ -929,11 +951,7 @@ parse_cnf() # Truncate spaces: [ -n "$reval" ] && reval=$(trim_string "$reval") - if [ -n "$BASH_VERSION" ]; then - printf '%s' "$reval" - else - echo "$reval" - fi + echo "$reval" } # @@ -986,11 +1004,8 @@ in_config() break fi done - if [ -n "$BASH_VERSION" ]; then - printf '%s' $found - else - echo $found - fi + + echo $found } wsrep_auth_not_set() @@ -1128,9 +1143,7 @@ wsrep_gen_secret() printf '%04x%04x%04x%04x%04x%04x%04x%04x' \ $RANDOM $RANDOM $RANDOM $RANDOM \ $RANDOM $RANDOM $RANDOM $RANDOM - elif [ -n "$(commandex cksum)" -a \ - -n "$(commandex printf)" ] - then + elif [ $with_printf -ne 0 -a -n "$(commandex cksum)" ]; then printf '%08x%08x%08x%08x' \ $(head -8 /dev/urandom | cksum | cut -d ' ' -f1) \ $(head -8 /dev/urandom | cksum | cut -d ' ' -f1) \ @@ -1569,6 +1582,139 @@ check_server_ssl_config() fi } +# Get Common Name (CN) from the certificate: +openssl_getCN() +{ + get_openssl + if [ -z "$OPENSSL_BINARY" ]; then + wsrep_log_error \ + 'openssl not found but it is required for authentication' + exit 42 + fi + + local bug=0 + local CN=$("$OPENSSL_BINARY" x509 -noout -subject -in "$1" 2>&1) || bug=1 + + if [ $bug -ne 0 ]; then + wsrep_log_info "run: \"$OPENSSL_BINARY\" x509 -noout -subject -in \"$1\"" + wsrep_log_info "output: $CN" + wsrep_log_error "******** FATAL ERROR **********************************************" + wsrep_log_error "* Unable to parse the certificate file to obtain the common name. *" + wsrep_log_error "*******************************************************************" + exit 22 + fi + + CN=$(trim_string "$CN") + + if [ -n "$CN" ]; then + # If the string begins with the "subject" prefix + # then we need to remove it: + local saved="$CN" + local remain="${CN#subject}" + if [ "$remain" != "$saved" ]; then + remain=$(trim_left "$remain") + # Now let's check for the presence of "=" character + # after the "subject": + saved="$remain" + remain="${remain#=}" + if [ "$remain" != "$saved" ]; then + remain=$(trim_left "$remain") + else + remain="" + bug=1 + fi + fi + while [ -n "$remain" ]; do + local value="" + # Let's extract the option name - all characters + # up to the first '=' or ',' character (if present): + local option="${remain%%[=,]*}" + if [ "$option" != "$remain" ]; then + option=$(trim_right "$option") + # These variables will be needed to determine + # which separator comes first: + local x="${remain#*=}" + local y="${remain#*,}" + local z=${#remain} + x=${#x}; [ $x -eq $z ] && x=0 + y=${#y}; [ $y -eq $z ] && y=0 + # The remaining string is everything that follows + # the separator character: + remain=$(trim_left "${remain#*[=,]}") + # Let's check what we are dealing with - an equal + # sign or a comma? + if [ $x -gt $y ]; then + # If the remainder begins with a double quote, + # then there is a string containing commas and + # we need to parse it: + saved="$remain" + remain="${remain#\"}" + if [ "$remain" != "$saved" ]; then + while :; do + # We need to find the closing quote: + local prefix="$remain" + remain="${remain#*\"}" + # Let's check if there is a closing quote? + if [ "$remain" = "$prefix" ]; then + bug=1 + break + fi + # Everything up to the closing quote is + # the next part of the value: + value="$value${prefix%%\"*}" + # But if the last character of the value + # is a backslash, then it is a quoted quotation + # mark and we need to add it to the value: + if [ "${value%\\}" != "$value" ]; then + value="$value\"" + else + break + fi + done + [ $bug -ne 0 ] && break + # Now we have to remove "," if it is present + # in the string after the value: + saved=$(trim_left "$remain") + remain="${saved#,}" + if [ "$remain" != "$saved" ]; then + remain=$(trim_left "$remain") + elif [ -n "$remain" ]; then + bug=1 + break + fi + else + # We are dealing with a simple unquoted string value, + # therefore we need to take everything up to the end + # of the string, or up to the next comma character: + value="${remain%%,*}" + if [ "$value" != "$remain" ]; then + remain=$(trim_left "${remain#*,}") + else + remain="" + fi + value=$(trim_right "$value") + fi + if [ "$option" = 'CN' -a -n "$value" ]; then + echo "$value" + return + fi + fi + else + remain="" + fi + done + fi + + if [ $bug -ne 0 ]; then + wsrep_log_error "******** FATAL ERROR **********************************************" + wsrep_log_error "* Unable to parse the certificate options: '$CN'" + wsrep_log_error "*******************************************************************" + exit 22 + fi + + echo '' +} + simple_cleanup() { # Since this is invoked just after exit NNN diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 93973419f0a..fec659d0179 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -1204,11 +1204,11 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then else # BYPASS FOR IST wsrep_log_info "Bypassing the SST for IST" - echo "continue" # now server can resume updating data + echo 'continue' # now server can resume updating data send_magic - echo "1" > "$DATA/$IST_FILE" + echo '1' > "$DATA/$IST_FILE" if [ -n "$scomp" ]; then tcmd="$scomp | $tcmd" @@ -1319,7 +1319,7 @@ else # joiner 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 )) + check_round=$(( check_round+1 )) if [ $check_round -eq 10 ]; then wsrep_log_error "previous SST script still running." exit 114 # EALREADY @@ -1346,16 +1346,7 @@ else # joiner # backward-incompatible behavior: CN="" if [ -n "$tpem" ]; then - # find out my Common Name - get_openssl - if [ -z "$OPENSSL_BINARY" ]; then - wsrep_log_error \ - 'openssl not found but it is required for authentication' - exit 42 - fi - CN=$("$OPENSSL_BINARY" x509 -noout -subject -in "$tpem" | \ - tr ',' '\n' | grep -F 'CN =' | cut -d '=' -f2 | sed s/^\ // | \ - sed s/\ %//) + CN=$(openssl_getCN "$tpem") fi MY_SECRET="$(wsrep_gen_secret)" # Add authentication data to address diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index aabf5bd325e..0d92a3c05b8 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -354,7 +354,7 @@ SST_PID="$DATA/wsrep_sst.pid" 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 )) + check_round=$(( check_round+1 )) if [ $check_round -eq 20 ]; then wsrep_log_error "previous SST script still running." exit 114 # EALREADY @@ -370,7 +370,7 @@ check_round=0 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 )) + check_round=$(( check_round+1 )) if [ $check_round -eq 10 ]; then wsrep_log_error "stunnel daemon still running." exit 114 # EALREADY @@ -388,7 +388,7 @@ 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 )) + check_round=$(( check_round+1 )) if [ $check_round -eq 10 ]; then wsrep_log_error "rsync daemon still running." exit 114 # EALREADY @@ -481,11 +481,7 @@ EOF tar_type=2 fi if [ $tar_type -eq 2 ]; then - if [ -n "$BASH_VERSION" ]; then - printf '%s' "$binlog_files" >&2 - else - echo "$binlog_files" >&2 - fi + echo "$binlog_files" >&2 fi if [ $tar_type -ne 0 ]; then # Preparing list of the binlog file names: @@ -854,16 +850,7 @@ EOF # backward-incompatible behavior: CN="" if [ -n "$SSTCERT" ]; then - # find out my Common Name - get_openssl - if [ -z "$OPENSSL_BINARY" ]; then - wsrep_log_error \ - 'openssl not found but it is required for authentication' - exit 42 - fi - CN=$("$OPENSSL_BINARY" x509 -noout -subject -in "$SSTCERT" | \ - tr ',' '\n' | grep -F 'CN =' | cut -d '=' -f2 | sed s/^\ // | \ - sed s/\ %//) + CN=$(openssl_getCN "$SSTCERT") fi MY_SECRET="$(wsrep_gen_secret)" # Add authentication data to address diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 61460c85499..b45086202a6 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -58,7 +58,7 @@ ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql ${LIBFMT_INCLUDE_DIR} ${PCRE_INCLUDE_DIRS} -${ZLIB_INCLUDE_DIR} +${ZLIB_INCLUDE_DIRS} ${SSL_INCLUDE_DIRS} ${CMAKE_BINARY_DIR}/sql ${CMAKE_SOURCE_DIR}/tpool diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index bfbe04f6015..776be8a5a2f 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -19,7 +19,7 @@ #include "log.h" // sql_print_error #include -#ifdef HAVE_OPENSSL +#ifdef HAVE_des struct st_des_keyschedule des_keyschedule[10]; uint des_default_key; @@ -103,4 +103,4 @@ error: mysql_mutex_unlock(&LOCK_des_key_file); DBUG_RETURN(result); } -#endif /* HAVE_OPENSSL */ +#endif /* HAVE_des */ diff --git a/sql/des_key_file.h b/sql/des_key_file.h index 847cd767b4b..58ed2f87b8e 100644 --- a/sql/des_key_file.h +++ b/sql/des_key_file.h @@ -16,7 +16,7 @@ #ifndef DES_KEY_FILE_INCLUDED #define DES_KEY_FILE_INCLUDED -#ifdef HAVE_OPENSSL +#ifdef HAVE_des #include #include "violite.h" /* DES_cblock, DES_key_schedule */ @@ -35,6 +35,6 @@ extern struct st_des_keyschedule des_keyschedule[10]; extern uint des_default_key; bool load_des_key_file(const char *file_name); -#endif /* HAVE_OPENSSL */ +#endif /* HAVE_des */ #endif /* DES_KEY_FILE_INCLUDED */ diff --git a/sql/field.cc b/sql/field.cc index f71169a0343..573e4b55b85 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5280,6 +5280,8 @@ int Field_timestamp::save_in_field(Field *to) { ulong sec_part; my_time_t ts= get_timestamp(&sec_part); + if (!ts && !sec_part) + return to->store_time_dec(Datetime::zero().get_mysql_time(), decimals()); return to->store_timestamp_dec(Timeval(ts, sec_part), decimals()); } @@ -5401,11 +5403,33 @@ int Field_timestamp::store(longlong nr, bool unsigned_val) } -int Field_timestamp::store_timestamp_dec(const timeval &ts, uint dec) +int Field_timestamp::store_timestamp_dec(const timeval &tv, uint dec) { int warn= 0; time_round_mode_t mode= Datetime::default_round_mode(get_thd()); - store_TIMESTAMP(Timestamp(ts).round(decimals(), mode, &warn)); + const Timestamp ts= Timestamp(tv).round(decimals(), mode, &warn); + store_TIMESTAMP(ts); + if (ts.tv().tv_sec == 0 && ts.tv().tv_usec == 0) + { + /* + The value {tv_sec==0, tv_usec==0} here means '1970-01-01 00:00:00 +00'. + It does not mean zero datetime! because store_timestamp_dec() knows + nothing about zero dates. It inserts only real timeval values. + Zero ts={0,0} here is possible in two scenarios: + - the passed tv was already {0,0} meaning '1970-01-01 00:00:00 +00' + - the passed tv had some microseconds but they were rounded/truncated + to zero: '1970-01-01 00:00:00.1 +00' -> '1970-01-01 00:00:00 +00'. + It does not matter whether rounding/truncation really happened. + In both cases the call for store_TIMESTAMP(ts) above re-interpreted + '1970-01-01 00:00:00 +00:00' to zero date. Return 1 no matter what + sql_mode is. Even if sql_mode allows zero dates, there is still a problem + here: '1970-01-01 00:00:00 +00' could not be stored as-is! + */ + ErrConvString str(STRING_WITH_LEN("1970-01-01 00:00:00 +00:00"), + system_charset_info); + set_datetime_warning(ER_WARN_DATA_OUT_OF_RANGE, &str, "datetime", 1); + return 1; // '1970-01-01 00:00:00 +00' was converted to a zero date + } if (warn) { /* @@ -5419,9 +5443,6 @@ int Field_timestamp::store_timestamp_dec(const timeval &ts, uint dec) */ set_warning(Sql_condition::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); } - if (ts.tv_sec == 0 && ts.tv_usec == 0 && - get_thd()->variables.sql_mode & (ulonglong) TIME_NO_ZERO_DATE) - return zero_time_stored_return_code_with_warning(); return 0; } @@ -5792,8 +5813,10 @@ my_time_t Field_timestampf::get_timestamp(const uchar *pos, bool Field_timestampf::val_native(Native *to) { DBUG_ASSERT(marked_for_read()); + char zero[8]= "\0\0\0\0\0\0\0"; + DBUG_ASSERT(pack_length () <= sizeof(zero)); // Check if it's '0000-00-00 00:00:00' rather than a real timestamp - if (ptr[0] == 0 && ptr[1] == 0 && ptr[2] == 0 && ptr[3] == 0) + if (!memcmp(ptr, zero, pack_length())) { to->length(0); return false; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 54992ec253b..67624548d6f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -693,6 +693,7 @@ int ha_partition::create_partitioning_metadata(const char *path, partition_element *part; DBUG_ENTER("ha_partition::create_partitioning_metadata"); + mark_trx_read_write(); /* We need to update total number of parts since we might write the handler file as part of a partition management command @@ -1678,10 +1679,10 @@ bool ha_partition::is_crashed() const int ha_partition::prepare_new_partition(TABLE *tbl, HA_CREATE_INFO *create_info, handler *file, const char *part_name, - partition_element *p_elem, - uint disable_non_uniq_indexes) + partition_element *p_elem) { int error; + key_map keys_in_use= table->s->keys_in_use; DBUG_ENTER("prepare_new_partition"); /* @@ -1737,8 +1738,8 @@ int ha_partition::prepare_new_partition(TABLE *tbl, goto error_external_lock; DBUG_PRINT("info", ("partition %s external locked", part_name)); - if (disable_non_uniq_indexes) - file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + if (!keys_in_use.is_prefix(table->s->keys)) + file->ha_disable_indexes(keys_in_use, true); DBUG_RETURN(0); error_external_lock: @@ -2034,13 +2035,6 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, calls */ - /* - Before creating new partitions check whether indexes are disabled - in the partitions. - */ - - uint disable_non_uniq_indexes= indexes_are_disabled(); - i= 0; part_count= 0; part_it.rewind(); @@ -2082,8 +2076,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, prepare_new_partition(table, create_info, new_file_array[part], (const char *)part_name_buff, - sub_elem, - disable_non_uniq_indexes)))) + sub_elem)))) { cleanup_new_partition(part_count); DBUG_RETURN(error); @@ -2109,8 +2102,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, prepare_new_partition(table, create_info, new_file_array[i], (const char *)part_name_buff, - part_elem, - disable_non_uniq_indexes)))) + part_elem)))) { cleanup_new_partition(part_count); DBUG_RETURN(error); @@ -3311,10 +3303,12 @@ handlerton *ha_partition::get_def_part_engine(const char *name) goto err; if (state.st_size <= 64) goto err; - if (!(frm_image= (uchar*)my_malloc(key_memory_Partition_share, - state.st_size, MYF(MY_WME)))) + if ((ulonglong)state.st_size >= SIZE_T_MAX) /* Whole file need to fit into memory*/ goto err; - if (mysql_file_read(file, frm_image, state.st_size, MYF(MY_NABP))) + if (!(frm_image= (uchar*)my_malloc(key_memory_Partition_share, + (size_t)state.st_size, MYF(MY_WME)))) + goto err; + if (mysql_file_read(file, frm_image, (size_t)state.st_size, MYF(MY_NABP))) goto err; if (frm_image[64] != '/') @@ -8643,7 +8637,7 @@ int ha_partition::info(uint flag) file->stats.auto_increment_value); } while (*(++file_array)); - DBUG_ASSERT(auto_increment_value); + DBUG_ASSERT(!all_parts_opened || auto_increment_value); stats.auto_increment_value= auto_increment_value; if (all_parts_opened && auto_inc_is_first_in_idx) { @@ -10950,18 +10944,19 @@ int ha_partition::update_next_auto_inc_val() bool ha_partition::need_info_for_auto_inc() { - handler **file= m_file; DBUG_ENTER("ha_partition::need_info_for_auto_inc"); - do + for (uint i= bitmap_get_first_set(&m_locked_partitions); + i < m_tot_parts; + i= bitmap_get_next_set(&m_locked_partitions, i)) { - if ((*file)->need_info_for_auto_inc()) + if ((m_file[i])->need_info_for_auto_inc()) { /* We have to get new auto_increment values from handler */ part_share->auto_inc_initialized= FALSE; DBUG_RETURN(TRUE); } - } while (*(++file)); + } DBUG_RETURN(FALSE); } @@ -11247,7 +11242,7 @@ int ha_partition::calculate_checksum() != 0 Error */ -int ha_partition::disable_indexes(uint mode) +int ha_partition::disable_indexes(key_map map, bool persist) { handler **file; int error= 0; @@ -11255,7 +11250,7 @@ int ha_partition::disable_indexes(uint mode) DBUG_ASSERT(bitmap_is_set_all(&(m_part_info->lock_partitions))); for (file= m_file; *file; file++) { - if (unlikely((error= (*file)->ha_disable_indexes(mode)))) + if (unlikely((error= (*file)->ha_disable_indexes(map, persist)))) break; } return error; @@ -11272,7 +11267,7 @@ int ha_partition::disable_indexes(uint mode) != 0 Error */ -int ha_partition::enable_indexes(uint mode) +int ha_partition::enable_indexes(key_map map, bool persist) { handler **file; int error= 0; @@ -11280,7 +11275,7 @@ int ha_partition::enable_indexes(uint mode) DBUG_ASSERT(bitmap_is_set_all(&(m_part_info->lock_partitions))); for (file= m_file; *file; file++) { - if (unlikely((error= (*file)->ha_enable_indexes(mode)))) + if (unlikely((error= (*file)->ha_enable_indexes(map, persist)))) break; } return error; diff --git a/sql/ha_partition.h b/sql/ha_partition.h index f43dbc8e423..51e199d3c5e 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -578,8 +578,7 @@ private: void cleanup_new_partition(uint part_count); int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info, handler *file, const char *part_name, - partition_element *p_elem, - uint disable_non_uniq_indexes); + partition_element *p_elem); /* delete_table and rename_table uses very similar logic which is packed into this routine. @@ -1583,8 +1582,8 @@ public: Enable/Disable Indexes are only supported by HEAP and MyISAM. ------------------------------------------------------------------------- */ - int disable_indexes(uint mode) override; - int enable_indexes(uint mode) override; + int disable_indexes(key_map map, bool persist) override; + int enable_indexes(key_map map, bool persist) override; int indexes_are_disabled() override; /* diff --git a/sql/handler.cc b/sql/handler.cc index 1238b6751a8..d25ad918372 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -684,13 +684,6 @@ int ha_initialize_handlerton(st_plugin_int *plugin) hton->slot= HA_SLOT_UNDEF; /* Historical Requirement */ plugin->data= hton; // shortcut for the future - /* [remove after merge] notes on merge conflict (MDEV-31400): - 10.6-10.11: 13ba00ff4933cfc1712676f323587504e453d1b5 - 11.0-11.2: 42f8be10f18163c4025710cf6a212e82bddb2f62 - The 10.11->11.0 conflict is trivial, but the reference commit also - contains different non-conflict changes needs to be applied to 11.0 - (and beyond). - */ if (plugin->plugin->init && (ret= plugin->plugin->init(hton))) goto err; @@ -1660,6 +1653,29 @@ ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list, return rw_ha_count; } +#ifdef WITH_WSREP +/** + Check if transaction contains storage engine not supporting + two-phase commit and transaction is read-write. + + @retval + true Transaction contains storage engine not supporting + two phase commit and transaction is read-write + @retval + false otherwise +*/ +static bool wsrep_have_no2pc_rw_ha(Ha_trx_info* ha_list) +{ + for (Ha_trx_info *ha_info=ha_list; ha_info; ha_info= ha_info->next()) + { + handlerton *ht= ha_info->ht(); + // Transaction is read-write and handler does not support 2pc + if (ha_info->is_trx_read_write() && ht->prepare==0) + return true; + } + return false; +} +#endif /* WITH_WSREP */ /** @retval @@ -1872,14 +1888,18 @@ int ha_commit_trans(THD *thd, bool all) */ if (run_wsrep_hooks) { - // This commit involves more than one storage engine and requires - // two phases, but some engines don't support it. - // Issue a message to the client and roll back the transaction. - if (trans->no_2pc && rw_ha_count > 1) + // This commit involves storage engines that do not support two phases. + // We allow read only transactions to such storage engines but not + // read write transactions. + if (trans->no_2pc && rw_ha_count > 1 && wsrep_have_no2pc_rw_ha(trans->ha_list)) { - // REPLACE|INSERT INTO ... SELECT uses TOI for MyISAM|Aria - if (WSREP(thd) && thd->wsrep_cs().mode() != wsrep::client_state::m_toi) - { + // This commit involves more than one storage engine and requires + // two phases, but some engines don't support it. + // Issue a message to the client and roll back the transaction. + + // REPLACE|INSERT INTO ... SELECT uses TOI for MyISAM|Aria + if (WSREP(thd) && thd->wsrep_cs().mode() != wsrep::client_state::m_toi) + { my_message(ER_ERROR_DURING_COMMIT, "Transactional commit not supported " "by involved engine(s)", MYF(0)); error= 1; @@ -5061,6 +5081,12 @@ uint handler::get_dup_key(int error) DBUG_RETURN(errkey); } +bool handler::has_dup_ref() const +{ + DBUG_ASSERT(lookup_errkey != (uint)-1 || errkey != (uint)-1); + return ha_table_flags() & HA_DUPLICATE_POS || lookup_errkey != (uint)-1; +} + /** Delete all files with extension from bas_ext(). @@ -5394,34 +5420,48 @@ handler::ha_check_and_repair(THD *thd) /** Disable indexes: public interface. + @param map has 0 for all indexes that should be disabled + @param persist indexes should stay disabled after server restart + + Currently engines don't support disabling an arbitrary subset of indexes. + + In particular, if the change is persistent: + * auto-increment index should not be disabled + * unique indexes should not be disabled + + if unique or auto-increment indexes are disabled (non-persistently), + the caller should only insert data that does not require + auto-inc generation and does not violate uniqueness + @sa handler::disable_indexes() */ int -handler::ha_disable_indexes(uint mode) +handler::ha_disable_indexes(key_map map, bool persist) { - DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || - m_lock_type != F_UNLCK); + DBUG_ASSERT(table->s->tmp_table != NO_TMP_TABLE || m_lock_type != F_UNLCK); mark_trx_read_write(); - return disable_indexes(mode); + return disable_indexes(map, persist); } /** Enable indexes: public interface. + @param map has 1 for all indexes that should be enabled + @param persist indexes should stay enabled after server restart + @sa handler::enable_indexes() */ int -handler::ha_enable_indexes(uint mode) +handler::ha_enable_indexes(key_map map, bool persist) { - DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || - m_lock_type != F_UNLCK); + DBUG_ASSERT(table->s->tmp_table != NO_TMP_TABLE || m_lock_type != F_UNLCK); mark_trx_read_write(); - return enable_indexes(mode); + return enable_indexes(map, persist); } @@ -5727,8 +5767,6 @@ handler::ha_create_partitioning_metadata(const char *name, DBUG_ASSERT(m_lock_type == F_UNLCK || (!old_name && strcmp(name, table_share->path.str))); - - mark_trx_read_write(); return create_partitioning_metadata(name, old_name, action_flag); } @@ -7568,11 +7606,8 @@ exit: if (error == HA_ERR_FOUND_DUPP_KEY) { table->file->lookup_errkey= key_no; - if (ha_table_flags() & HA_DUPLICATE_POS) - { - lookup_handler->position(table->record[0]); - memcpy(table->file->dup_ref, lookup_handler->ref, ref_length); - } + lookup_handler->position(table->record[0]); + memcpy(table->file->dup_ref, lookup_handler->ref, ref_length); } restore_record(table, file->lookup_buffer); table->restore_blob_values(blob_storage); @@ -7651,7 +7686,7 @@ int handler::check_duplicate_long_entries_update(const uchar *new_rec) So also check for that too */ if((field->is_null(0) != field->is_null(reclength)) || - field->cmp_binary_offset(reclength)) + field->cmp_offset(reclength)) { if((error= check_duplicate_long_entry_key(new_rec, i))) return error; @@ -7860,7 +7895,16 @@ int handler::ha_write_row(const uchar *buf) m_lock_type == F_WRLCK); DBUG_ENTER("handler::ha_write_row"); DEBUG_SYNC_C("ha_write_row_start"); - +#ifdef WITH_WSREP + DBUG_EXECUTE_IF("wsrep_ha_write_row", + { + const char act[]= + "now " + "SIGNAL wsrep_ha_write_row_reached " + "WAIT_FOR wsrep_ha_write_row_continue"; + DBUG_ASSERT(!debug_sync_set_action(ha_thd(), STRING_WITH_LEN(act))); + }); +#endif /* WITH_WSREP */ if ((error= ha_check_overlaps(NULL, buf))) DBUG_RETURN(error); diff --git a/sql/handler.h b/sql/handler.h index 59756dd358a..6f1bc36d8c4 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -457,12 +457,6 @@ enum chf_create_flags { #define HA_FAST_CHANGE_PARTITION (1UL << 13) #define HA_PARTITION_ONE_PHASE (1UL << 14) -/* operations for disable/enable indexes */ -#define HA_KEY_SWITCH_NONUNIQ 0 -#define HA_KEY_SWITCH_ALL 1 -#define HA_KEY_SWITCH_NONUNIQ_SAVE 2 -#define HA_KEY_SWITCH_ALL_SAVE 3 - /* Note: the following includes binlog and closing 0. TODO remove the limit, use dynarrays @@ -3599,8 +3593,8 @@ public: int ha_optimize(THD* thd, HA_CHECK_OPT* check_opt); int ha_analyze(THD* thd, HA_CHECK_OPT* check_opt); bool ha_check_and_repair(THD *thd); - int ha_disable_indexes(uint mode); - int ha_enable_indexes(uint mode); + int ha_disable_indexes(key_map map, bool persist); + int ha_enable_indexes(key_map map, bool persist); int ha_discard_or_import_tablespace(my_bool discard); int ha_rename_table(const char *from, const char *to); void ha_drop_table(const char *name); @@ -3624,6 +3618,7 @@ public: virtual void print_error(int error, myf errflag); virtual bool get_error_message(int error, String *buf); uint get_dup_key(int error); + bool has_dup_ref() const; /** Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_ERR_FOREIGN_DUPLICATE_KEY. @@ -5365,8 +5360,8 @@ public: virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt) { return HA_ADMIN_NOT_IMPLEMENTED; } virtual bool check_and_repair(THD *thd) { return TRUE; } - virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } - virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; } + virtual int disable_indexes(key_map map, bool persist) { return HA_ERR_WRONG_COMMAND; } + virtual int enable_indexes(key_map map, bool persist) { return HA_ERR_WRONG_COMMAND; } virtual int discard_or_import_tablespace(my_bool discard) { return (my_errno=HA_ERR_WRONG_COMMAND); } virtual void drop_table(const char *name); diff --git a/sql/item.cc b/sql/item.cc index b73fd5e7f9d..3b88cd1c4b7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9927,11 +9927,15 @@ Item *Item_default_value::transform(THD *thd, Item_transformer transformer, } -bool Item_default_value::associate_with_target_field(THD *thd, - Item_field *field) +bool Item_default_value:: + associate_with_target_field(THD *thd, + Item_field *field __attribute__((unused))) { m_associated= true; - arg= field; + /* + arg set correctly in constructor (can also differ from field if + it is function with an argument) + */ return tie_field(thd); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0487eb47526..8d8cf3d370b 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1404,7 +1404,13 @@ bool Item_in_optimizer::fix_left(THD *thd) eval_not_null_tables(NULL); with_flags|= (args[0]->with_flags | (args[1]->with_flags & item_with_t::SP_VAR)); - if ((const_item_cache= args[0]->const_item())) + + /* + If left expression is a constant, cache its value. + But don't do that if that involves computing a subquery, as we are in a + prepare-phase rewrite. + */ + if ((const_item_cache= args[0]->const_item()) && !args[0]->with_subquery()) { cache->store(args[0]); cache->cache_value(); @@ -6283,7 +6289,17 @@ bool Regexp_processor_pcre::exec(Item *item, int offset, } -void Regexp_processor_pcre::fix_owner(Item_func *owner, +/* + This method determines the owner's maybe_null flag. + Generally, the result is NULL-able. However, in case + of a constant pattern and a NOT NULL subject, the + result can also be NOT NULL. + @return true - in case if the constant regex compilation failed + (e.g. due to a wrong regex syntax in the pattern). + The compilation error message is put to the DA in this case. + false - otherwise. +*/ +bool Regexp_processor_pcre::fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg) { @@ -6291,16 +6307,30 @@ void Regexp_processor_pcre::fix_owner(Item_func *owner, pattern_arg->const_item() && !pattern_arg->is_expensive()) { - if (compile(pattern_arg, true)) + if (compile(pattern_arg, true/* raise errors to DA, e.g. on bad syntax */)) { owner->set_maybe_null(); // Will always return NULL - return; + if (pattern_arg->null_value) + { + /* + The pattern evaluated to NULL. Regex compilation did not happen. + No errors were put to DA. Continue with maybe_null==true. + The function will return NULL per row. + */ + return false; + } + /* + A syntax error in the pattern, an error was raised to the DA. + Let's abort the query. The caller will send the error to the client. + */ + return true; } set_const(true); owner->base_flags|= subject_arg->base_flags & item_base_t::MAYBE_NULL; } else owner->set_maybe_null(); + return false; } @@ -6312,8 +6342,7 @@ Item_func_regex::fix_length_and_dec(THD *thd) return TRUE; re.init(cmp_collation.collation, 0); - re.fix_owner(this, args[0], args[1]); - return FALSE; + return re.fix_owner(this, args[0], args[1]); } @@ -6337,9 +6366,8 @@ Item_func_regexp_instr::fix_length_and_dec(THD *thd) return TRUE; re.init(cmp_collation.collation, 0); - re.fix_owner(this, args[0], args[1]); max_length= MY_INT32_NUM_DECIMAL_DIGITS; // See also Item_func_locate - return FALSE; + return re.fix_owner(this, args[0], args[1]); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 13922b9ef77..148b1d8fbb0 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -3059,7 +3059,7 @@ public: {} int default_regex_flags(); void init(CHARSET_INFO *data_charset, int extra_flags); - void fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg); + bool fix_owner(Item_func *owner, Item *subject_arg, Item *pattern_arg); bool compile(String *pattern, bool send_error); bool compile(Item *item, bool send_error); bool recompile(Item *item) @@ -3528,13 +3528,11 @@ template class LI, typename T> class Item_equal_iterator { protected: Item_equal *item_equal; - Item *curr_item; + Item *curr_item= nullptr; public: Item_equal_iterator(Item_equal &item_eq) - :LI (item_eq.equal_items) + :LI (item_eq.equal_items), item_equal(&item_eq) { - curr_item= NULL; - item_equal= &item_eq; if (item_eq.with_const) { LI *list_it= this; diff --git a/sql/item_func.cc b/sql/item_func.cc index de70d7fb1e9..947736d2de6 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -72,6 +72,9 @@ bool check_reserved_words(const LEX_CSTRING *name) return FALSE; } +void pause_execution(THD *thd, double timeout); +static int do_pause(THD *thd, Interruptible_wait *timed_cond, + mysql_cond_t *cond, double timeout); /** Test if the sum of arguments overflows the ulonglong range. @@ -2638,12 +2641,12 @@ void Item_func_round::fix_arg_hex_hybrid() } -double my_double_round(double value, longlong dec, bool dec_unsigned, +double my_double_round(double value, longlong dec_value, bool dec_unsigned, bool truncate) { double tmp; - bool dec_negative= (dec < 0) && !dec_unsigned; - ulonglong abs_dec= dec_negative ? -dec : dec; + const Longlong_hybrid dec(dec_value, dec_unsigned); + const ulonglong abs_dec= dec.abs(); /* tmp2 is here to avoid return the value with 80 bit precision This will fix that the test round(0.1,1) = round(0.1,1) is true @@ -2658,22 +2661,24 @@ double my_double_round(double value, longlong dec, bool dec_unsigned, volatile double value_div_tmp= value / tmp; volatile double value_mul_tmp= value * tmp; - if (!dec_negative && std::isinf(tmp)) // "dec" is too large positive number + if (!dec.neg() && std::isinf(tmp)) // "dec" is a too large positive number return value; - if (dec_negative && std::isinf(tmp)) - tmp2= 0.0; - else if (!dec_negative && std::isinf(value_mul_tmp)) + if (dec.neg() && std::isinf(tmp)) // "dec" is a too small negative number + return 0.0; + + // Handle "dec" with a reasonably small absolute value + if (!dec.neg() && std::isinf(value_mul_tmp)) tmp2= value; else if (truncate) { if (value >= 0.0) - tmp2= dec < 0 ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp; + tmp2= dec.neg() ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp; else - tmp2= dec < 0 ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp; + tmp2= dec.neg() ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp; } else - tmp2=dec < 0 ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp; + tmp2=dec.neg() ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp; return tmp2; } @@ -3022,7 +3027,7 @@ double Item_func_min_max::val_real_native() value=tmp; } if ((null_value= args[i]->null_value)) - break; + return 0; } return value; } @@ -3043,7 +3048,7 @@ longlong Item_func_min_max::val_int_native() value=tmp; } if ((null_value= args[i]->null_value)) - break; + return 0; } return value; } @@ -4612,32 +4617,7 @@ longlong Item_func_sleep::val_int() if (timeout < 0.00001) return 0; - timed_cond.set_timeout((ulonglong) (timeout * 1000000000.0)); - - mysql_cond_init(key_item_func_sleep_cond, &cond, NULL); - mysql_mutex_lock(&LOCK_item_func_sleep); - - THD_STAGE_INFO(thd, stage_user_sleep); - thd->mysys_var->current_mutex= &LOCK_item_func_sleep; - thd->mysys_var->current_cond= &cond; - - error= 0; - thd_wait_begin(thd, THD_WAIT_SLEEP); - while (!thd->killed) - { - error= timed_cond.wait(&cond, &LOCK_item_func_sleep); - if (error == ETIMEDOUT || error == ETIME) - break; - error= 0; - } - thd_wait_end(thd); - mysql_mutex_unlock(&LOCK_item_func_sleep); - mysql_mutex_lock(&thd->mysys_var->mutex); - thd->mysys_var->current_mutex= 0; - thd->mysys_var->current_cond= 0; - mysql_mutex_unlock(&thd->mysys_var->mutex); - - mysql_cond_destroy(&cond); + error= do_pause(thd, &timed_cond, &cond, timeout); #ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("sleep_inject_query_done_debug_sync", { @@ -7358,3 +7338,43 @@ void fix_rownum_pointers(THD *thd, SELECT_LEX *select_lex, ha_rows *ptr) ((Item_func_rownum*) item)->store_pointer_to_row_counter(ptr); } } + +static int do_pause(THD *thd, Interruptible_wait *timed_cond, mysql_cond_t *cond, double timeout) +{ + int error= 0; + timed_cond->set_timeout((ulonglong) (timeout * 1000000000.0)); + + mysql_cond_init(key_item_func_sleep_cond, cond, NULL); + mysql_mutex_lock(&LOCK_item_func_sleep); + + THD_STAGE_INFO(thd, stage_user_sleep); + thd->mysys_var->current_mutex= &LOCK_item_func_sleep; + thd->mysys_var->current_cond= cond; + + thd_wait_begin(thd, THD_WAIT_SLEEP); + while (!thd->killed) + { + error= timed_cond->wait(cond, &LOCK_item_func_sleep); + if (error == ETIMEDOUT || error == ETIME) + break; + error= 0; + } + thd_wait_end(thd); + mysql_mutex_unlock(&LOCK_item_func_sleep); + mysql_mutex_lock(&thd->mysys_var->mutex); + thd->mysys_var->current_mutex= 0; + thd->mysys_var->current_cond= 0; + mysql_mutex_unlock(&thd->mysys_var->mutex); + + mysql_cond_destroy(cond); + + return error; +} + +void pause_execution(THD *thd, double timeout) +{ + Interruptible_wait timed_cond(thd); + mysql_cond_t cond; + + do_pause(thd, &timed_cond, &cond, timeout); +} diff --git a/sql/item_func.h b/sql/item_func.h index eab22c577b3..b7f1e1671f8 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -4315,6 +4315,7 @@ public: { return get_item_copy(thd, this); } }; +class Interruptible_wait; Item *get_system_var(THD *thd, enum_var_type var_type, const LEX_CSTRING *name, const LEX_CSTRING *component); diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index c5edf8e1a22..ed07ad4ab26 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -34,6 +34,23 @@ static int dbug_json_check_min_stack_requirement() } #endif +extern void pause_execution(THD *thd, double timeout); + +/* + Allocating memory and *also* using it (reading and + writing from it) because some build instructions cause + compiler to optimize out stack_used_up. Since alloca() + here depends on stack_used_up, it doesnt get executed + correctly and causes json_debug_nonembedded to fail + ( --error ER_STACK_OVERRUN_NEED_MORE does not occur). +*/ + +#define JSON_DO_PAUSE_EXECUTION(A, B) do \ + { \ + DBUG_EXECUTE_IF("json_pause_execution", \ + { pause_execution(A, B); }); \ + } while(0) + /* Compare ASCII string against the string with the specified character set. @@ -1002,16 +1019,17 @@ bool Item_func_json_extract::fix_length_and_dec(THD *thd) } -static bool path_exact(const json_path_with_flags *paths_list, int n_paths, +static int path_exact(const json_path_with_flags *paths_list, int n_paths, const json_path_t *p, json_value_types vt, const int *array_size_counter) { + int count_path= 0; for (; n_paths > 0; n_paths--, paths_list++) { if (json_path_compare(&paths_list->p, p, vt, array_size_counter) == 0) - return TRUE; + count_path++; } - return FALSE; + return count_path; } @@ -1036,7 +1054,7 @@ String *Item_func_json_extract::read_json(String *str, json_engine_t je, sav_je; json_path_t p; const uchar *value; - int not_first_value= 0; + int not_first_value= 0, count_path= 0; uint n_arg; size_t v_len; int possible_multiple_values; @@ -1095,7 +1113,8 @@ String *Item_func_json_extract::read_json(String *str, array_size_counter + (p.last_step - p.steps))) goto error; - if (!path_exact(paths, arg_count-1, &p, je.value_type, array_size_counter)) + if (!(count_path= path_exact(paths, arg_count-1, &p, je.value_type, + array_size_counter))) continue; value= je.value_begin; @@ -1125,9 +1144,12 @@ String *Item_func_json_extract::read_json(String *str, je= sav_je; } - if ((not_first_value && str->append(", ", 2)) || - str->append((const char *) value, v_len)) - goto error; /* Out of memory. */ + for (int count= 0; count < count_path; count++) + { + if (str->append((const char *) value, v_len) || + str->append(", ", 2)) + goto error; /* Out of memory. */ + } not_first_value= 1; @@ -1148,6 +1170,11 @@ String *Item_func_json_extract::read_json(String *str, goto return_null; } + if (str->length()>2) + { + str->chop(); + str->chop(); + } if (possible_multiple_values && str->append(']')) goto error; /* Out of memory. */ @@ -1978,6 +2005,8 @@ err_return: bool Item_func_json_array_append::fix_length_and_dec(THD *thd) { + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + uint n_arg; ulonglong char_length; @@ -2136,6 +2165,8 @@ String *Item_func_json_array_insert::val_str(String *str) uint n_arg, n_path; THD *thd= current_thd; + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + DBUG_ASSERT(fixed()); if ((null_value= args[0]->null_value)) @@ -2541,6 +2572,8 @@ String *Item_func_json_merge::val_str(String *str) THD *thd= current_thd; LINT_INIT(js2); + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + if (args[0]->null_value) goto null_return; @@ -2850,6 +2883,8 @@ String *Item_func_json_merge_patch::val_str(String *str) bool empty_result, merge_to_null; THD *thd= current_thd; + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + /* To report errors properly if some JSON is invalid. */ je1.s.error= je2.s.error= 0; merge_to_null= args[0]->null_value; @@ -3127,6 +3162,12 @@ String *Item_func_json_type::val_str(String *str) break; } + /* ensure the json is at least valid. */ + while(json_scan_next(&je) == 0) {} + + if (je.s.error) + goto error; + str->set(type, strlen(type), &my_charset_utf8mb3_general_ci); return str; @@ -3142,6 +3183,8 @@ bool Item_func_json_insert::fix_length_and_dec(THD *thd) uint n_arg; ulonglong char_length; + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + collation.set(args[0]->collation); char_length= args[0]->max_char_length(); @@ -3436,6 +3479,8 @@ String *Item_func_json_remove::val_str(String *str) DBUG_ASSERT(fixed()); + JSON_DO_PAUSE_EXECUTION(thd, 0.0002); + if (args[0]->null_value) goto null_return; @@ -3487,6 +3532,7 @@ String *Item_func_json_remove::val_str(String *str) { if (je.s.error) goto js_error; + continue; } if (json_read_value(&je)) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 4081218d0e2..cef382470c6 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -795,7 +795,7 @@ bool Item_func_des_encrypt::fix_length_and_dec(THD *thd) String *Item_func_des_encrypt::val_str(String *str) { DBUG_ASSERT(fixed()); -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) +#if defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE; DES_cblock ivec; struct st_des_keyblock keyblock; @@ -884,8 +884,8 @@ error: THD *thd= current_thd; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED), - "des_encrypt", "--with-ssl"); -#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ + "des_encrypt", "openssl des cipher (HAVE_des)"); +#endif /* defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) */ null_value=1; return 0; } @@ -908,7 +908,7 @@ bool Item_func_des_decrypt::fix_length_and_dec(THD *thd) String *Item_func_des_decrypt::val_str(String *str) { DBUG_ASSERT(fixed()); -#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) +#if defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) uint code= ER_WRONG_PARAMETERS_TO_PROCEDURE; DES_cblock ivec; struct st_des_keyblock keyblock; @@ -983,9 +983,9 @@ wrong_key: THD *thd= current_thd; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED), - "des_decrypt", "--with-ssl"); + "des_decrypt", "openssl des cipher (HAVE_des)"); } -#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ +#endif /* defined(HAVE_des) && !defined(EMBEDDED_LIBRARY) */ null_value=1; return 0; } @@ -1688,15 +1688,16 @@ String *Item_func_regexp_replace::val_str_internal(String *str, LEX_CSTRING src, rpl; size_t startoffset= 0; - if ((null_value= - (!(source= args[0]->val_str(&tmp0)) || - !(replace= args[2]->val_str_null_to_empty(&tmp2, null_to_empty)) || - re.recompile(args[1])))) - return (String *) 0; - + source= args[0]->val_str(&tmp0); + if (!source) + goto err; + replace= args[2]->val_str_null_to_empty(&tmp2, null_to_empty); + if (!replace || re.recompile(args[1])) + goto err; if (!(source= re.convert_if_needed(source, &re.subject_converter)) || !(replace= re.convert_if_needed(replace, &re.replace_converter))) goto err; + null_value= false; source->get_value(&src); replace->get_value(&rpl); @@ -1742,7 +1743,7 @@ String *Item_func_regexp_replace::val_str_internal(String *str, err: null_value= true; - return (String *) 0; + return nullptr; } @@ -1878,13 +1879,21 @@ bool Item_func_insert::fix_length_and_dec(THD *thd) String *Item_str_conv::val_str(String *str) { DBUG_ASSERT(fixed()); - String *res; - size_t alloced_length, len; + String *res= args[0]->val_str(&tmp_value); - if ((null_value= (!(res= args[0]->val_str(&tmp_value)) || - str->alloc((alloced_length= res->length() * multiply))))) - return 0; + if (!res) + { + err: + null_value= true; + return nullptr; + } + size_t alloced_length= res->length() * multiply, len; + + if (str->alloc((alloced_length))) + goto err; + + null_value= false; len= converter(collation.collation, (char*) res->ptr(), res->length(), (char*) str->ptr(), alloced_length); DBUG_ASSERT(len <= alloced_length); @@ -5013,6 +5022,11 @@ void Item_func_dyncol_create::print_arguments(String *str, { str->append(STRING_WITH_LEN(" charset ")); str->append(defs[i].cs->cs_name); + if (Charset(defs[i].cs).can_have_collate_clause()) + { + str->append(STRING_WITH_LEN(" collate ")); + str->append(defs[i].cs->coll_name); + } str->append(' '); } break; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 0f252e7dd2c..229136417b0 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -569,6 +569,9 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent, This measure is used instead of JOIN::read_time, because it is considered to be much more reliable than the cost estimate. + Note: the logic in this function must agree with + JOIN::init_join_cache_and_keyread(). + @return true if the subquery is expensive @return false otherwise */ diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index a53e89cc8e3..0ac75f903e9 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3507,6 +3507,24 @@ bool Item_func_timediff::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy if (l_time1.neg != l_time2.neg) l_sign= -l_sign; + if (l_time1.time_type == MYSQL_TIMESTAMP_TIME) + { + /* + In case of TIME-alike arguments: + TIMEDIFF('38:59:59', '839:00:00') + let's truncate extra fractional seconds that might appear if the argument + values were out of the supported TIME range. For example, args[n]->get_time() + for the string literal '839:00:00' returns TIME'838:59:59.999999'. + The fractional part must be truncated according to this->decimals, + to avoid returning more fractional seconds than it was detected + during this->fix_length_and_dec(). + Note, the thd rounding mode should not be important here, as we're removing + redundant digits from the maximum possible value: '838:59:59.999999'. + */ + my_time_trunc(&l_time1, decimals); + my_time_trunc(&l_time2, decimals); + } + if (calc_time_diff(&l_time1, &l_time2, l_sign, &l_time3, fuzzydate)) return (null_value= 1); diff --git a/sql/log.cc b/sql/log.cc index a1b78082bf0..e08af2a3cb3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8078,9 +8078,9 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) if (entry->cache_mngr->using_xa) { - DEBUG_SYNC(entry->thd, "commit_before_prepare_ordered"); + DEBUG_SYNC(orig_entry->thd, "commit_before_prepare_ordered"); run_prepare_ordered(entry->thd, entry->all); - DEBUG_SYNC(entry->thd, "commit_after_prepare_ordered"); + DEBUG_SYNC(orig_entry->thd, "commit_after_prepare_ordered"); } if (cur) diff --git a/sql/log_event.cc b/sql/log_event.cc index 6cf0e10ac06..777285e9fd2 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2420,6 +2420,11 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len, } if (flags2 & (FL_PREPARED_XA | FL_COMPLETED_XA)) { + if (event_len < static_cast(buf - buf_0) + 6) + { + seq_no= 0; + return; + } xid.formatID= uint4korr(buf); buf+= 4; @@ -2428,6 +2433,11 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len, buf+= 2; long data_length= xid.bqual_length + xid.gtrid_length; + if (event_len < static_cast(buf - buf_0) + data_length) + { + seq_no= 0; + return; + } memcpy(xid.data, buf, data_length); buf+= data_length; } @@ -2442,14 +2452,22 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len, */ if (flags_extra & FL_EXTRA_MULTI_ENGINE_E1) { - DBUG_ASSERT(static_cast(buf - buf_0) < event_len); - + if (event_len < static_cast(buf - buf_0) + 1) + { + seq_no= 0; + return; + } extra_engines= *buf++; DBUG_ASSERT(extra_engines > 0); } if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1)) { + if (event_len < static_cast(buf - buf_0) + 8) + { + seq_no= 0; + return; + } sa_seq_no= uint8korr(buf); buf+= 8; } diff --git a/sql/log_event.h b/sql/log_event.h index 2bbf0d77c0f..ac2b03f18b7 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3384,7 +3384,16 @@ public: { return GTID_HEADER_LEN + ((flags2 & FL_GROUP_COMMIT_ID) ? 2 : 0); } - bool is_valid() const { return seq_no != 0; } + + bool is_valid() const + { + /* + seq_no is set to 0 if the structure of a serialized GTID event does not + align with that as indicated by flags and extra_flags. + */ + return seq_no != 0; + } + #ifdef MYSQL_SERVER bool write(); static int make_compatible_event(String *packet, bool *need_dummy_event, diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 471f06de80c..f24d1d91190 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -2921,7 +2921,7 @@ bool Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) { char *pbeg; // beginning of the next line char *pend; // end of the next line - uint cnt= 0; // characters counter + char *qend= m_query_txt + m_query_len; if (!pinfo->short_form) { @@ -2932,28 +2932,21 @@ bool Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) else if (my_b_printf(&pinfo->head_cache, "# Annotate_rows:\n")) goto err; - for (pbeg= m_query_txt; ; pbeg= pend) + for (pbeg= m_query_txt; pbeg < qend; pbeg= pend) { // skip all \r's and \n's at the beginning of the next line - for (;; pbeg++) - { - if (++cnt > m_query_len) - return 0; - - if (*pbeg != '\r' && *pbeg != '\n') - break; - } + for (; pbeg < qend && (*pbeg == '\r' || *pbeg == '\n'); pbeg++) + ; // find end of the next line - for (pend= pbeg + 1; - ++cnt <= m_query_len && *pend != '\r' && *pend != '\n'; - pend++) + for (pend= pbeg + 1; pend < qend && *pend != '\r' && *pend != '\n'; pend++) ; // print next line - if (my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4) || - my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg) || - my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1)) + if (pbeg < qend && + (my_b_write(&pinfo->head_cache, (const uchar*) "#Q> ", 4) || + my_b_write(&pinfo->head_cache, (const uchar*) pbeg, pend - pbeg) || + my_b_write(&pinfo->head_cache, (const uchar*) "\n", 1))) goto err; } diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index beef9d032e3..39a8d0a14e6 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -1927,7 +1927,10 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, { bool is_rb_alter= gtid_flags_extra & Gtid_log_event::FL_ROLLBACK_ALTER_E1; - thd->set_time(when, when_sec_part); +#ifdef WITH_WSREP + if (!wsrep_thd_is_applying(thd)) +#endif + thd->set_time(when, when_sec_part); thd->set_query_and_id((char*)query_arg, q_len_arg, thd->charset(), next_query_id()); thd->variables.pseudo_thread_id= thread_id; // for temp tables @@ -3034,28 +3037,43 @@ Gtid_log_event::write() write_len= GTID_HEADER_LEN + 2; } - if (flags2 & (FL_PREPARED_XA | FL_COMPLETED_XA)) + if (flags2 & (FL_PREPARED_XA | FL_COMPLETED_XA) + && !DBUG_IF("negate_xid_from_gtid")) { int4store(&buf[write_len], xid.formatID); buf[write_len +4]= (uchar) xid.gtrid_length; buf[write_len +4+1]= (uchar) xid.bqual_length; write_len+= 6; long data_length= xid.bqual_length + xid.gtrid_length; - memcpy(buf+write_len, xid.data, data_length); - write_len+= data_length; + + if (!DBUG_IF("negate_xid_data_from_gtid")) + { + memcpy(buf+write_len, xid.data, data_length); + write_len+= data_length; + } } + + DBUG_EXECUTE_IF("inject_fl_extra_multi_engine_into_gtid", { + flags_extra|= FL_EXTRA_MULTI_ENGINE_E1; + }); if (flags_extra > 0) { buf[write_len]= flags_extra; write_len++; } + DBUG_EXECUTE_IF("inject_fl_extra_multi_engine_into_gtid", { + flags_extra&= ~FL_EXTRA_MULTI_ENGINE_E1; + }); + if (flags_extra & FL_EXTRA_MULTI_ENGINE_E1) { buf[write_len]= extra_engines; write_len++; } - if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1)) + if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1) + && !DBUG_IF("negate_alter_fl_from_gtid") + ) { int8store(buf + write_len, sa_seq_no); write_len+= 8; @@ -3698,6 +3716,9 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi) thd->wsrep_affected_rows= 0; #endif +#ifndef DBUG_OFF + bool record_gtid_delayed_for_xa= false; +#endif if (rgi->gtid_pending) { sub_id= rgi->gtid_sub_id; @@ -3716,6 +3737,10 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi) return 1; }); } +#ifndef DBUG_OFF + else + record_gtid_delayed_for_xa= true; +#endif } general_log_print(thd, COM_QUERY, get_query()); @@ -3725,6 +3750,22 @@ int Xid_apply_log_event::do_apply_event(rpl_group_info *rgi) { DBUG_ASSERT(!thd->transaction->xid_state.is_explicit_XA()); + DBUG_ASSERT(record_gtid_delayed_for_xa); + if (thd->rgi_slave->is_parallel_exec) + { + /* + With XA, since the transaction is prepared/committed without updating + the GTID pos (MDEV-32020...), we need here to clear any pending + deadlock kill. + + Otherwise if the kill happened after the prepare/commit completed, it + might end up killing the subsequent GTID position update, causing the + slave to fail with error. + */ + wait_for_pending_deadlock_kill(thd, thd->rgi_slave); + thd->reset_killed(); + } + if ((err= do_record_gtid(thd, rgi, false, &hton, true))) return err; } @@ -3831,7 +3872,8 @@ int XA_prepare_log_event::do_commit() thd->lex->xid= &xid; if (!one_phase) { - if ((res= thd->wait_for_prior_commit())) + if (thd->is_current_stmt_binlog_disabled() && + (res= thd->wait_for_prior_commit())) return res; thd->lex->sql_command= SQLCOM_XA_PREPARE; @@ -5082,23 +5124,23 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) which tested replicate-* rules). */ - if (m_width == table->s->fields && bitmap_is_set_all(&m_cols)) + if (m_width == table->s->fields && bitmap_is_set_all(&m_cols)) set_flags(COMPLETE_ROWS_F); Rpl_table_data rpl_data= *(RPL_TABLE_LIST*)table->pos_in_table_list; /* Set tables write and read sets. - + Read_set contains all slave columns (in case we are going to fetch - a complete record from slave) - - Write_set equals the m_cols bitmap sent from master but it can be - longer if slave has extra columns. - */ + a complete record from slave). + + Write_set equals the m_cols bitmap sent from master but it can be + longer if slave has extra columns. + */ DBUG_PRINT_BITSET("debug", "Setting table's read_set from: %s", &m_cols); - + bitmap_set_all(table->read_set); bitmap_set_all(table->write_set); table->rpl_write_set= table->write_set; @@ -5366,11 +5408,13 @@ static int rows_event_stmt_cleanup(rpl_group_info *rgi, THD * thd) Xid_log_event will come next which will, if some transactional engines are involved, commit the transaction and flush the pending event to the binlog. - If there was a deadlock the transaction should have been rolled back - already. So there should be no need to rollback the transaction. + We check for thd->transaction_rollback_request because it is possible + there was a deadlock that was ignored by slave-skip-errors. Normally, the + deadlock would have been rolled back already. */ - DBUG_ASSERT(! thd->transaction_rollback_request); - error|= (int)(error ? trans_rollback_stmt(thd) : trans_commit_stmt(thd)); + error|= (int) ((error || thd->transaction_rollback_request) + ? trans_rollback_stmt(thd) + : trans_commit_stmt(thd)); /* Now what if this is not a transactional engine? we still need to @@ -6989,6 +7033,7 @@ int Rows_log_event::update_sequence() #if defined(WITH_WSREP) ! WSREP(thd) && #endif + table->in_use->rgi_slave && !(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) && !(old_master= rpl_master_has_bug(thd->rgi_slave->rli, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 84b285035fa..afa1f35a494 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -741,9 +741,6 @@ mysql_mutex_t LOCK_thread_id; server may be fairly high, we need a dedicated lock. */ mysql_mutex_t LOCK_prepared_stmt_count; -#ifdef HAVE_OPENSSL -mysql_mutex_t LOCK_des_key_file; -#endif mysql_mutex_t LOCK_backup_log, LOCK_optimizer_costs; mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; mysql_rwlock_t LOCK_ssl_refresh; @@ -885,7 +882,7 @@ static struct my_option pfs_early_options[]= PSI_file_key key_file_binlog, key_file_binlog_cache, key_file_binlog_index, key_file_binlog_index_cache, key_file_casetest, - key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file, + key_file_dbopt, key_file_ERRMSG, key_select_to_file, key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load, key_file_loadfile, key_file_log_event_data, key_file_log_event_info, key_file_log_ddl, @@ -897,16 +894,19 @@ PSI_file_key key_file_relaylog, key_file_relaylog_index, key_file_relaylog_cache, key_file_relaylog_index_cache; PSI_file_key key_file_binlog_state; +#ifdef HAVE_des +char *des_key_file; +PSI_file_key key_file_des_key_file; +PSI_mutex_key key_LOCK_des_key_file; +mysql_mutex_t LOCK_des_key_file; +#endif /* HAVE_des */ + #ifdef HAVE_PSI_INTERFACE #ifdef HAVE_MMAP PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool, key_LOCK_pending_checkpoint; #endif /* HAVE_MMAP */ -#ifdef HAVE_OPENSSL -PSI_mutex_key key_LOCK_des_key_file; -#endif /* HAVE_OPENSSL */ - PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, key_BINLOG_LOCK_binlog_background_thread, key_LOCK_binlog_end_pos, @@ -964,9 +964,9 @@ static PSI_mutex_info all_server_mutexes[]= { &key_LOCK_pool, "TC_LOG_MMAP::LOCK_pending_checkpoint", 0}, #endif /* HAVE_MMAP */ -#ifdef HAVE_OPENSSL +#ifdef HAVE_des { &key_LOCK_des_key_file, "LOCK_des_key_file", PSI_FLAG_GLOBAL}, -#endif /* HAVE_OPENSSL */ +#endif /* HAVE_des */ { &key_BINLOG_LOCK_index, "MYSQL_BIN_LOG::LOCK_index", 0}, { &key_BINLOG_LOCK_xid_list, "MYSQL_BIN_LOG::LOCK_xid_list", 0}, @@ -1494,7 +1494,6 @@ static void openssl_dynlock_destroy(openssl_lock_t *, const char *, int); static void openssl_lock_function(int, int, const char *, int); static void openssl_lock(int, openssl_lock_t *, const char *, int); #endif /* HAVE_OPENSSL10 */ -char *des_key_file; #ifndef EMBEDDED_LIBRARY struct st_VioSSLFd *ssl_acceptor_fd; #endif @@ -1785,7 +1784,8 @@ static void close_connections(void) "Delaying shutdown to await semi-sync ACK"); } - Events::deinit(); + if (Events::inited) + Events::stop(); slave_prepare_for_shutdown(); ack_receiver.stop(); @@ -1847,6 +1847,12 @@ static void close_connections(void) } /* End of kill phase 2 */ + /* + The signal thread can use server resources, e.g. when processing SIGHUP, + and it must end gracefully before clean_up() + */ + wait_for_signal_thread_to_end(); + DBUG_PRINT("quit",("close_connections thread")); DBUG_VOID_RETURN; } @@ -1915,6 +1921,7 @@ extern "C" void unireg_abort(int exit_code) wsrep_sst_auth_free(); #endif // WITH_WSREP + wait_for_signal_thread_to_end(); clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */ DBUG_PRINT("quit",("done with cleanup in unireg_abort")); mysqld_exit(exit_code); @@ -1923,14 +1930,8 @@ extern "C" void unireg_abort(int exit_code) static void mysqld_exit(int exit_code) { DBUG_ENTER("mysqld_exit"); - /* - Important note: we wait for the signal thread to end, - but if a kill -15 signal was sent, the signal thread did - spawn the kill_server_thread thread, which is running concurrently. - */ rpl_deinit_gtid_waiting(); rpl_deinit_gtid_slave_state(); - wait_for_signal_thread_to_end(); #ifdef WITH_WSREP wsrep_deinit_server(); wsrep_sst_auth_free(); @@ -2014,6 +2015,9 @@ static void clean_up(bool print_message) free_status_vars(); end_thr_alarm(1); /* Free allocated memory */ end_thr_timer(); +#ifndef EMBEDDED_LIBRARY + Events::deinit(); +#endif my_free_open_file_info(); if (defaults_argv) free_defaults(defaults_argv); @@ -2084,16 +2088,31 @@ static void clean_up(bool print_message) */ static void wait_for_signal_thread_to_end() { - uint i; + uint i, n_waits= DBUG_IF("force_sighup_processing_timeout") ? 5 : 100; + int err= 0; /* Wait up to 10 seconds for signal thread to die. We use this mainly to avoid getting warnings that my_thread_end has not been called */ - for (i= 0 ; i < 100 && signal_thread_in_use; i++) + for (i= 0 ; i < n_waits && signal_thread_in_use; i++) { - if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL) == ESRCH) + err= pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); + if (err) break; - my_sleep(100); // Give it time to die + my_sleep(100000); // Give it time to die, .1s per iteration + } + + if (err && err != ESRCH) + { + sql_print_error("Failed to send kill signal to signal handler thread, " + "pthread_kill() errno: %d", err); + } + + if (i == n_waits && signal_thread_in_use && !opt_bootstrap) + { + sql_print_warning("Signal handler thread did not exit in a timely manner. " + "Continuing to wait for it to stop.."); + pthread_join(signal_thread, NULL); } } #endif /*EMBEDDED_LIBRARY*/ @@ -2118,7 +2137,9 @@ static void clean_up_mutexes() mysql_mutex_destroy(&LOCK_global_table_stats); mysql_mutex_destroy(&LOCK_global_index_stats); #ifdef HAVE_OPENSSL +#ifdef HAVE_des mysql_mutex_destroy(&LOCK_des_key_file); +#endif /* HAVE_des */ #if defined(HAVE_OPENSSL10) && !defined(HAVE_WOLFSSL) for (int i= 0; i < CRYPTO_num_locks(); ++i) mysql_rwlock_destroy(&openssl_stdlocks[i].lock); @@ -3130,10 +3151,8 @@ void init_signals(void) (void) sigemptyset(&set); my_sigset(SIGPIPE,SIG_IGN); sigaddset(&set,SIGPIPE); -#ifndef IGNORE_SIGHUP_SIGQUIT sigaddset(&set,SIGQUIT); sigaddset(&set,SIGHUP); -#endif sigaddset(&set,SIGTERM); /* Fix signals if blocked by parents (can happen on Mac OS X) */ @@ -3173,7 +3192,6 @@ static void start_signal_handler(void) (void) pthread_attr_init(&thr_attr); pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM); - (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); (void) my_setstacksize(&thr_attr,my_thread_stack_size); mysql_mutex_lock(&LOCK_start_thread); @@ -3193,18 +3211,6 @@ static void start_signal_handler(void) } -#if defined(USE_ONE_SIGNAL_HAND) -pthread_handler_t kill_server_thread(void *arg __attribute__((unused))) -{ - my_thread_init(); // Initialize new thread - break_connect_loop(); - my_thread_end(); - pthread_exit(0); - return 0; -} -#endif - - /** This threads handles all signals and alarms. */ /* ARGSUSED */ pthread_handler_t signal_hand(void *arg __attribute__((unused))) @@ -3228,20 +3234,20 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) (void) sigaddset(&set,SIGINT); (void) pthread_sigmask(SIG_UNBLOCK,&set,NULL); } - (void) sigemptyset(&set); // Setup up SIGINT for debug + (void) sigemptyset(&set); #ifdef USE_ONE_SIGNAL_HAND (void) sigaddset(&set,THR_SERVER_ALARM); // For alarms #endif -#ifndef IGNORE_SIGHUP_SIGQUIT (void) sigaddset(&set,SIGQUIT); - (void) sigaddset(&set,SIGHUP); -#endif (void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTSTP); /* Save pid to this process (or thread on Linux) */ if (!opt_bootstrap) + { + (void) sigaddset(&set,SIGHUP); create_pid_file(); + } /* signal to start_signal_handler that we are ready @@ -3261,7 +3267,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) int origin; while ((error= my_sigwait(&set, &sig, &origin)) == EINTR) /* no-op */; - if (cleanup_done) + if (abort_loop) { DBUG_PRINT("quit",("signal_handler: calling my_thread_end()")); my_thread_end(); @@ -3284,18 +3290,8 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) { /* Delete the instrumentation for the signal thread */ PSI_CALL_delete_current_thread(); -#ifdef USE_ONE_SIGNAL_HAND - pthread_t tmp; - if (unlikely((error= mysql_thread_create(0, /* Not instrumented */ - &tmp, &connection_attrib, - kill_server_thread, - (void*) &sig)))) - sql_print_error("Can't create thread to kill server (errno= %d)", - error); -#else my_sigset(sig, SIG_IGN); break_connect_loop(); // MIT THREAD has a alarm thread -#endif } break; case SIGHUP: @@ -4120,8 +4116,9 @@ static int init_common_variables() SQLCOM_END + 10); #endif - if (get_options(&remaining_argc, &remaining_argv)) - exit(1); + int opt_err; + if ((opt_err= get_options(&remaining_argc, &remaining_argv))) + exit(opt_err); if (IS_SYSVAR_AUTOSIZE(&server_version_ptr)) set_server_version(server_version, sizeof(server_version)); @@ -4544,8 +4541,10 @@ static int init_thread_environment() mysql_mutex_init(key_LOCK_temp_pool, &LOCK_temp_pool, MY_MUTEX_INIT_FAST); #ifdef HAVE_OPENSSL +#ifdef HAVE_des mysql_mutex_init(key_LOCK_des_key_file, &LOCK_des_key_file, MY_MUTEX_INIT_FAST); +#endif /* HAVE_des */ #if defined(HAVE_OPENSSL10) && !defined(HAVE_WOLFSSL) openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(openssl_lock_t)); @@ -4764,8 +4763,10 @@ static void init_ssl() { have_ssl= SHOW_OPTION_DISABLED; } +#ifdef HAVE_des if (des_key_file) load_des_key_file(des_key_file); +#endif /* HAVE_des */ #endif /* HAVE_OPENSSL */ #endif /* !EMBEDDED_LIBRARY */ } @@ -5025,6 +5026,9 @@ static int init_server_components() error_handler_hook= my_message_sql; proc_info_hook= set_thd_stage_info; + /* Set up hook to handle disk full */ + my_sleep_for_space= mariadb_sleep_for_space; + /* Print source revision hash, as one of the first lines, if not the first in error log, for troubleshooting and debugging purposes @@ -5547,6 +5551,10 @@ static int init_server_components() } #endif +#ifndef EMBEDDED_LIBRARY + start_handle_manager(); +#endif + tc_log= get_tc_log_implementation(); if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file)) @@ -5558,9 +5566,6 @@ static int init_server_components() if (ha_recover(0)) unireg_abort(1); -#ifndef EMBEDDED_LIBRARY - start_handle_manager(); -#endif if (opt_bin_log) { int error; @@ -6657,12 +6662,12 @@ struct my_option my_long_options[]= &opt_debug_sync_timeout, 0, 0, GET_UINT, OPT_ARG, 0, 0, UINT_MAX, 0, 0, 0}, #endif /* defined(ENABLED_DEBUG_SYNC) */ -#ifdef HAVE_OPENSSL +#ifdef HAVE_des {"des-key-file", 0, "Load keys for des_encrypt() and des_encrypt from given file.", &des_key_file, &des_key_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif /* HAVE_OPENSSL */ +#endif /* HAVE_des */ #ifdef HAVE_STACKTRACE {"stack-trace", 0 , "Print a symbolic stack trace on failure", &opt_stack_trace, &opt_stack_trace, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -8033,7 +8038,9 @@ static int mysql_init_variables(void) libwrapName= NullS; #endif #ifdef HAVE_OPENSSL +#ifdef HAVE_des des_key_file = 0; +#endif /* HAVE_des */ #ifndef EMBEDDED_LIBRARY ssl_acceptor_fd= 0; #endif /* ! EMBEDDED_LIBRARY */ @@ -8329,7 +8336,7 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument, case (int) OPT_SAFE: opt_specialflag|= SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC; SYSVAR_AUTOSIZE(delay_key_write_options, (uint) DELAY_KEY_WRITE_NONE); - SYSVAR_AUTOSIZE(myisam_recover_options, HA_RECOVER_DEFAULT); + myisam_recover_options= HA_RECOVER_DEFAULT; ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE); #ifdef HAVE_QUERY_CACHE SYSVAR_AUTOSIZE(query_cache_size, 0); @@ -9304,7 +9311,9 @@ static PSI_file_info all_server_files[]= { &key_file_io_cache, "io_cache", 0}, { &key_file_casetest, "casetest", 0}, { &key_file_dbopt, "dbopt", 0}, +#ifdef HAVE_des { &key_file_des_key_file, "des_key_file", 0}, +#endif { &key_file_ERRMSG, "ERRMSG", 0}, { &key_select_to_file, "select_to_file", 0}, { &key_file_fileparser, "file_parser", 0}, @@ -9431,6 +9440,7 @@ PSI_stage_info stage_user_lock= { 0, "User lock", 0}; PSI_stage_info stage_user_sleep= { 0, "User sleep", 0}; PSI_stage_info stage_verifying_table= { 0, "Verifying table", 0}; PSI_stage_info stage_waiting_for_delay_list= { 0, "Waiting for delay_list", 0}; +PSI_stage_info stage_waiting_for_disk_space= {0, "Waiting for someone to free space", 0}; PSI_stage_info stage_waiting_for_gtid_to_be_written_to_binary_log= { 0, "Waiting for GTID to be written to binary log", 0}; PSI_stage_info stage_waiting_for_handler_insert= { 0, "Waiting for handler insert", 0}; PSI_stage_info stage_waiting_for_handler_lock= { 0, "Waiting for handler lock", 0}; diff --git a/sql/mysqld.h b/sql/mysqld.h index aca44de3746..cd85e815b71 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -316,10 +316,6 @@ extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool, key_LOCK_pending_checkpoint; #endif /* HAVE_MMAP */ -#ifdef HAVE_OPENSSL -extern PSI_mutex_key key_LOCK_des_key_file; -#endif - extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list, key_BINLOG_LOCK_binlog_background_thread, key_LOCK_binlog_end_pos, @@ -399,7 +395,7 @@ extern PSI_thread_key key_thread_delayed_insert, extern PSI_file_key key_file_binlog, key_file_binlog_cache, key_file_binlog_index, key_file_binlog_index_cache, key_file_casetest, - key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file, + key_file_dbopt, key_file_ERRMSG, key_select_to_file, key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load, key_file_loadfile, key_file_log_event_data, key_file_log_event_info, key_file_master_info, key_file_misc, key_file_partition_ddl_log, @@ -412,6 +408,13 @@ extern PSI_socket_key key_socket_tcpip, key_socket_unix, key_socket_client_connection; extern PSI_file_key key_file_binlog_state; +#ifdef HAVE_des +extern char* des_key_file; +extern PSI_file_key key_file_des_key_file; +extern PSI_mutex_key key_LOCK_des_key_file; +extern mysql_mutex_t LOCK_des_key_file; +#endif + #ifdef HAVE_PSI_INTERFACE void init_server_psi_keys(); #endif /* HAVE_PSI_INTERFACE */ @@ -651,6 +654,7 @@ extern PSI_stage_info stage_user_sleep; extern PSI_stage_info stage_verifying_table; extern PSI_stage_info stage_waiting_for_ddl; extern PSI_stage_info stage_waiting_for_delay_list; +extern PSI_stage_info stage_waiting_for_disk_space; extern PSI_stage_info stage_waiting_for_flush; extern PSI_stage_info stage_waiting_for_gtid_to_be_written_to_binary_log; extern PSI_stage_info stage_waiting_for_handler_insert; @@ -766,10 +770,6 @@ extern mysql_mutex_t extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_global_system_variables; extern mysql_rwlock_t LOCK_all_status_vars; extern mysql_mutex_t LOCK_start_thread; -#ifdef HAVE_OPENSSL -extern char* des_key_file; -extern mysql_mutex_t LOCK_des_key_file; -#endif extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_server_started; extern MYSQL_PLUGIN_IMPORT mysql_cond_t COND_server_started; extern mysql_rwlock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; diff --git a/sql/opt_split.cc b/sql/opt_split.cc index aa6054b1244..9ae3eb47cf3 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -1360,6 +1360,7 @@ bool JOIN::fix_all_splittings_in_plan() { table_map prev_tables= 0; table_map all_tables= (table_map(1) << table_count) - 1; + table_map prev_sjm_lookup_tables= 0; for (uint tablenr= 0; tablenr < table_count; tablenr++) { POSITION *cur_pos= &best_positions[tablenr]; @@ -1368,7 +1369,7 @@ bool JOIN::fix_all_splittings_in_plan() { SplM_plan_info *spl_plan= cur_pos->spl_plan; table_map excluded_tables= (all_tables & ~prev_tables) | - sjm_lookup_tables; + prev_sjm_lookup_tables; ; if (spl_plan) { @@ -1386,6 +1387,8 @@ bool JOIN::fix_all_splittings_in_plan() return true; } prev_tables|= tab->table->map; + if (cur_pos->sj_strategy == SJ_OPT_MATERIALIZE) + prev_sjm_lookup_tables|= tab->table->map; } return false; } diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 88287d331ec..bbfc02110a7 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -131,7 +131,7 @@ handle_queued_pos_update(THD *thd, rpl_parallel_thread::queued_event *qev) asynchronously, we need to be sure they will be completed before starting a new transaction. Otherwise the new transaction might suffer a spurious kill. */ -static void +void wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi) { PSI_stage_info old_stage; @@ -215,6 +215,13 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, signal_error_to_sql_driver_thread(thd, rgi, err); thd->wait_for_commit_ptr= NULL; + /* + Calls to check_duplicate_gtid() must match up with + record_and_update_gtid() (or release_domain_owner() in error case). This + assertion tries to catch any missing release of the domain. + */ + DBUG_ASSERT(rgi->gtid_ignore_duplicate_state != rpl_group_info::GTID_DUPLICATE_OWNER); + mysql_mutex_lock(&entry->LOCK_parallel_entry); /* We need to mark that this event group started its commit phase, in case we @@ -908,7 +915,13 @@ do_retry: }); #endif - rgi->cleanup_context(thd, 1); + /* + We are still applying the event group, even though we will roll it back + and retry it. So for --gtid-ignore-duplicates, keep ownership of the + domain during the retry so another master connection will not try to take + over and duplicate apply the same event group (MDEV-33475). + */ + rgi->cleanup_context(thd, 1, 1 /* keep_domain_owner */); wait_for_pending_deadlock_kill(thd, rgi); thd->reset_killed(); thd->clear_error(); @@ -2405,13 +2418,17 @@ rpl_parallel_thread_pool::copy_pool_for_pfs(Relay_log_info *rli) false Worker not allocated (choose_thread_internal not called) */ static bool handle_split_alter(rpl_parallel_entry *e, - Gtid_log_event *gtid_ev, uint32 *idx, + Gtid_log_event *gtid_ev, + //uint32 *idx, + rpl_parallel_entry::sched_bucket **ptr_cur_thr, //choose_thread_internal specific bool *did_enter_cond, rpl_group_info* rgi, PSI_stage_info *old_stage) { uint16 flags_extra= gtid_ev->flags_extra; bool thread_allocated= false; + uint32 i= 0, *idx= &i; + //Step 1 if (flags_extra & Gtid_log_event::FL_START_ALTER_E1 || //This will arrange finding threads for CA/RA as well @@ -2422,11 +2439,12 @@ static bool handle_split_alter(rpl_parallel_entry *e, j is needed for round robin scheduling, we will start with rpl_thread_idx go till rpl_thread_max and then start with 0 to rpl_thread_idx */ - int j= e->rpl_thread_idx; + auto j= static_cast(e->thread_sched_fifo->head() - e->rpl_threads); // formerly e->rpl_thread_idx; for(uint i= 0; i < e->rpl_thread_max; i++) { - if (!e->rpl_threads[j] || e->rpl_threads[j]->current_owner - != &e->rpl_threads[j] || !e->rpl_threads[j]->current_start_alter_id) + if (!e->rpl_threads[j].thr || + e->rpl_threads[j].thr->current_owner != &e->rpl_threads[j].thr || + !e->rpl_threads[j].thr->current_start_alter_id) { //This condition will hit atleast one time no matter what happens *idx= j; @@ -2437,17 +2455,26 @@ static bool handle_split_alter(rpl_parallel_entry *e, j= j % e->rpl_thread_max; } //We did not find and idx - DBUG_ASSERT(0); - return false; + DBUG_ASSERT(0); + + return false; + idx_found: - e->rpl_thread_idx= *idx; - e->choose_thread_internal(*idx, did_enter_cond, rgi, old_stage); + //e->rpl_thread_idx= *idx; + /* place the found *idx index into the head */ + *ptr_cur_thr= &e->rpl_threads[*idx]; + (*ptr_cur_thr)->unlink(); + e->thread_sched_fifo->append(*ptr_cur_thr); + *ptr_cur_thr= e->thread_sched_fifo->head(); + + e->choose_thread_internal(*ptr_cur_thr, did_enter_cond, rgi, + old_stage); thread_allocated= true; if (flags_extra & Gtid_log_event::FL_START_ALTER_E1) { - mysql_mutex_assert_owner(&e->rpl_threads[*idx]->LOCK_rpl_thread); - e->rpl_threads[e->rpl_thread_idx]->current_start_alter_id= gtid_ev->seq_no; - e->rpl_threads[e->rpl_thread_idx]->current_start_alter_domain_id= + mysql_mutex_assert_owner(&e->rpl_threads[*idx].thr->LOCK_rpl_thread); + e->rpl_threads[*idx].thr->current_start_alter_id= gtid_ev->seq_no; + e->rpl_threads[*idx].thr->current_start_alter_domain_id= gtid_ev->domain_id; /* We are locking LOCK_rpl_thread_pool becuase we are going to update @@ -2463,9 +2490,9 @@ idx_found: } else { - e->rpl_threads[*idx]->reserved_start_alter_thread= true; - e->rpl_threads[*idx]->current_start_alter_id= 0; - e->rpl_threads[*idx]->current_start_alter_domain_id= 0; + e->rpl_threads[*idx].thr->reserved_start_alter_thread= true; + e->rpl_threads[*idx].thr->current_start_alter_id= 0; + e->rpl_threads[*idx].thr->current_start_alter_domain_id= 0; } mysql_mutex_unlock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); } @@ -2476,13 +2503,13 @@ idx_found: //Free the corrosponding rpt current_start_alter_id for(uint i= 0; i < e->rpl_thread_max; i++) { - if(e->rpl_threads[i] && - e->rpl_threads[i]->current_start_alter_id == gtid_ev->sa_seq_no && - e->rpl_threads[i]->current_start_alter_domain_id == gtid_ev->domain_id) + if(e->rpl_threads[i].thr && + e->rpl_threads[i].thr->current_start_alter_id == gtid_ev->sa_seq_no && + e->rpl_threads[i].thr->current_start_alter_domain_id == gtid_ev->domain_id) { mysql_mutex_lock(&global_rpl_thread_pool.LOCK_rpl_thread_pool); - e->rpl_threads[i]->current_start_alter_id= 0; - e->rpl_threads[i]->current_start_alter_domain_id= 0; + e->rpl_threads[i].thr->current_start_alter_id= 0; + e->rpl_threads[i].thr->current_start_alter_domain_id= 0; global_rpl_thread_pool.current_start_alters--; e->pending_start_alters--; DBUG_PRINT("info", ("Commit/Rollback alter id %d", i)); @@ -2497,6 +2524,79 @@ idx_found: } +/* + Check when we have done a complete round of scheduling for workers + 0, 1, ..., (rpl_thread_max-1), in this order. + This often occurs every rpl_thread_max event group, but XA XID dependency + restrictions can cause insertion of extra out-of-order worker scheduling + in-between the normal round-robin scheduling. +*/ +void +rpl_parallel_entry::check_scheduling_generation(sched_bucket *cur) +{ + uint32 idx= static_cast(cur - rpl_threads); + DBUG_ASSERT(cur >= rpl_threads); + DBUG_ASSERT(cur < rpl_threads + rpl_thread_max); + if (idx == current_generation_idx) + { + ++idx; + if (idx >= rpl_thread_max) + { + /* A new generation; all workers have been scheduled at least once. */ + idx= 0; + ++current_generation; + } + current_generation_idx= idx; + } +} + + +rpl_parallel_entry::sched_bucket * +rpl_parallel_entry::check_xa_xid_dependency(xid_t *xid) +{ + uint64 cur_gen= current_generation; + my_off_t i= 0; + while (i < maybe_active_xid.elements) + { + /* + Purge no longer active XID from the list: + + - In generation N, XID might have been scheduled for worker W. + - Events in generation (N+1) might run freely in parallel with W. + - Events in generation (N+2) will have done wait_for_prior_commit for + the event group with XID (or a later one), but the XID might still be + active for a bit longer after wakeup_prior_commit(). + - Events in generation (N+3) will have done wait_for_prior_commit() for + an event in W _after_ the XID, so are sure not to see the XID active. + + Therefore, XID can be safely scheduled to a different worker in + generation (N+3) when last prior use was in generation N (or earlier). + */ + xid_active_generation *a= + dynamic_element(&maybe_active_xid, i, xid_active_generation *); + if (a->generation + 3 <= cur_gen) + { + *a= *((xid_active_generation *)pop_dynamic(&maybe_active_xid)); + continue; + } + if (xid->eq(&a->xid)) + { + /* Update the last used generation and return the match. */ + a->generation= cur_gen; + return a->thr; + } + ++i; + } + /* try to keep allocated memory in the range of [2,10] * initial_chunk_size */ + if (maybe_active_xid.elements <= 2 * active_xid_init_alloc() && + maybe_active_xid.max_element > 10 * active_xid_init_alloc()) + freeze_size(&maybe_active_xid); + + /* No matching XID conflicts. */ + return nullptr; +} + + /* Obtain a worker thread that we can queue an event to. @@ -2529,40 +2629,70 @@ rpl_parallel_entry::choose_thread(rpl_group_info *rgi, bool *did_enter_cond, PSI_stage_info *old_stage, Gtid_log_event *gtid_ev) { - uint32 idx; + sched_bucket *cur_thr; - idx= rpl_thread_idx; if (gtid_ev) { - if (++idx >= rpl_thread_max) - idx= 0; + /* New event group; cycle the thread scheduling buckets round-robin. */ + thread_sched_fifo->push_back(thread_sched_fifo->get()); + //rpl_thread_idx will be updated handle_split_alter - if (handle_split_alter(this, gtid_ev, &idx, did_enter_cond, rgi, old_stage)) - return rpl_threads[idx]; + if (handle_split_alter(this, gtid_ev, &cur_thr, did_enter_cond, rgi, + old_stage)) + return cur_thr->thr; + if (gtid_ev->flags2 & (Gtid_log_event::FL_COMPLETED_XA | Gtid_log_event::FL_PREPARED_XA)) - { - idx= my_hash_sort(&my_charset_bin, gtid_ev->xid.key(), - gtid_ev->xid.key_length()) % rpl_thread_max; + { + if ((cur_thr= check_xa_xid_dependency(>id_ev->xid))) + { + /* + A previously scheduled event group with the same XID might still be + active in a worker, so schedule this event group in the same worker + to avoid a conflict. + */ + cur_thr->unlink(); + thread_sched_fifo->append(cur_thr); + } + else + { + /* Record this XID now active. */ + xid_active_generation *a= + (xid_active_generation *)alloc_dynamic(&maybe_active_xid); + if (!a) + return NULL; + a->thr= cur_thr= thread_sched_fifo->head(); + a->generation= current_generation; + a->xid.set(>id_ev->xid); + } } - rpl_thread_idx= idx; + else + cur_thr= thread_sched_fifo->head(); + + check_scheduling_generation(cur_thr); } - return choose_thread_internal(idx, did_enter_cond, rgi, old_stage); + else + cur_thr= thread_sched_fifo->head(); + + return choose_thread_internal(cur_thr /*idx*/, did_enter_cond, rgi, old_stage); } -rpl_parallel_thread * rpl_parallel_entry::choose_thread_internal(uint idx, - bool *did_enter_cond, rpl_group_info *rgi, - PSI_stage_info *old_stage) +rpl_parallel_thread * +rpl_parallel_entry::choose_thread_internal(sched_bucket *cur_thr, + bool *did_enter_cond, + rpl_group_info *rgi, + PSI_stage_info *old_stage) { - rpl_parallel_thread* thr= rpl_threads[idx]; Relay_log_info *rli= rgi->rli; + rpl_parallel_thread *thr= cur_thr->thr; + if (thr) { *did_enter_cond= false; mysql_mutex_lock(&thr->LOCK_rpl_thread); for (;;) { - if (thr->current_owner != &rpl_threads[idx]) + if (thr->current_owner != &cur_thr->thr) { /* The worker thread became idle, and returned to the free list and @@ -2594,17 +2724,16 @@ rpl_parallel_thread * rpl_parallel_entry::choose_thread_internal(uint idx, and this can cause THD::awake to use the wrong mutex. */ #ifdef ENABLED_DEBUG_SYNC - DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", - { - debug_sync_set_action(rli->sql_driver_thd, - STRING_WITH_LEN("now SIGNAL wait_queue_ready")); - };); + DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { + debug_sync_set_action( + rli->sql_driver_thd, + STRING_WITH_LEN("now SIGNAL wait_queue_ready")); + };); #endif rli->sql_driver_thd->set_time_for_next_stage(); - rli->sql_driver_thd->ENTER_COND(&thr->COND_rpl_thread_queue, - &thr->LOCK_rpl_thread, - &stage_waiting_for_room_in_worker_thread, - old_stage); + rli->sql_driver_thd->ENTER_COND( + &thr->COND_rpl_thread_queue, &thr->LOCK_rpl_thread, + &stage_waiting_for_room_in_worker_thread, old_stage); *did_enter_cond= true; } @@ -2614,11 +2743,11 @@ rpl_parallel_thread * rpl_parallel_entry::choose_thread_internal(uint idx, did_enter_cond, old_stage); my_error(ER_CONNECTION_KILLED, MYF(0)); #ifdef ENABLED_DEBUG_SYNC - DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", - { - debug_sync_set_action(rli->sql_driver_thd, - STRING_WITH_LEN("now SIGNAL wait_queue_killed")); - };); + DBUG_EXECUTE_IF("rpl_parallel_wait_queue_max", { + debug_sync_set_action( + rli->sql_driver_thd, + STRING_WITH_LEN("now SIGNAL wait_queue_killed")); + };); #endif slave_output_error_info(rgi, rli->sql_driver_thd); return NULL; @@ -2628,9 +2757,10 @@ rpl_parallel_thread * rpl_parallel_entry::choose_thread_internal(uint idx, } } } + if (!thr) - rpl_threads[idx]= thr= global_rpl_thread_pool.get_thread(&rpl_threads[idx], - this); + cur_thr->thr= thr= + global_rpl_thread_pool.get_thread(&cur_thr->thr, this); return thr; } @@ -2645,6 +2775,7 @@ free_rpl_parallel_entry(void *element) dealloc_gco(e->current_gco); e->current_gco= prev_gco; } + delete_dynamic(&e->maybe_active_xid); mysql_cond_destroy(&e->COND_parallel_entry); mysql_mutex_destroy(&e->LOCK_parallel_entry); my_free(e); @@ -2688,17 +2819,37 @@ rpl_parallel::find(uint32 domain_id, Relay_log_info *rli) ulong count= opt_slave_domain_parallel_threads; if (count == 0 || count > opt_slave_parallel_threads) count= opt_slave_parallel_threads; - rpl_parallel_thread **p; + rpl_parallel_entry::sched_bucket *p; + I_List *fifo; if (!my_multi_malloc(PSI_INSTRUMENT_ME, MYF(MY_WME|MY_ZEROFILL), &e, sizeof(*e), &p, count*sizeof(*p), + &fifo, sizeof(*fifo), NULL)) { my_error(ER_OUTOFMEMORY, MYF(0), (int)(sizeof(*e)+count*sizeof(*p))); return NULL; } + /* Initialize a FIFO of scheduled worker threads. */ + e->thread_sched_fifo = new (fifo) I_List; + /* + (We cycle the FIFO _before_ allocating next entry in + rpl_parallel_entry::choose_thread(). So initialize the FIFO with the + highest element at the front, just so that the first event group gets + scheduled on entry 0). + */ + e->thread_sched_fifo-> + push_back(::new (p+count-1) rpl_parallel_entry::sched_bucket); + for (ulong i= 0; i < count-1; ++i) + e->thread_sched_fifo-> + push_back(::new (p+i) rpl_parallel_entry::sched_bucket); e->rpl_threads= p; e->rpl_thread_max= count; + e->current_generation = 0; + e->current_generation_idx = 0; + init_dynamic_array2(PSI_INSTRUMENT_ME, &e->maybe_active_xid, + sizeof(rpl_parallel_entry::xid_active_generation), + 0, e->active_xid_init_alloc(), 0, MYF(0)); e->domain_id= domain_id; e->stop_on_error_sub_id= (uint64)ULONGLONG_MAX; e->pause_sub_id= (uint64)ULONGLONG_MAX; @@ -2768,10 +2919,10 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) mysql_mutex_unlock(&e->LOCK_parallel_entry); for (j= 0; j < e->rpl_thread_max; ++j) { - if ((rpt= e->rpl_threads[j])) + if ((rpt= e->rpl_threads[j].thr)) { mysql_mutex_lock(&rpt->LOCK_rpl_thread); - if (rpt->current_owner == &e->rpl_threads[j]) + if (rpt->current_owner == &e->rpl_threads[j].thr) mysql_cond_signal(&rpt->COND_rpl_thread); mysql_mutex_unlock(&rpt->LOCK_rpl_thread); } @@ -2830,10 +2981,10 @@ rpl_parallel::wait_for_done(THD *thd, Relay_log_info *rli) e= (struct rpl_parallel_entry *)my_hash_element(&domain_hash, i); for (j= 0; j < e->rpl_thread_max; ++j) { - if ((rpt= e->rpl_threads[j])) + if ((rpt= e->rpl_threads[j].thr)) { mysql_mutex_lock(&rpt->LOCK_rpl_thread); - while (rpt->current_owner == &e->rpl_threads[j]) + while (rpt->current_owner == &e->rpl_threads[j].thr) mysql_cond_wait(&rpt->COND_rpl_thread_stop, &rpt->LOCK_rpl_thread); mysql_mutex_unlock(&rpt->LOCK_rpl_thread); } @@ -2891,7 +3042,7 @@ int rpl_parallel_entry::queue_master_restart(rpl_group_info *rgi, Format_description_log_event *fdev) { - uint32 idx; + sched_bucket *cur_thr; rpl_parallel_thread *thr; rpl_parallel_thread::queued_event *qev; Relay_log_info *rli= rgi->rli; @@ -2906,12 +3057,12 @@ rpl_parallel_entry::queue_master_restart(rpl_group_info *rgi, Thus there is no need for the full complexity of choose_thread(). We only need to check if we have a current worker thread, and queue for it if so. */ - idx= rpl_thread_idx; - thr= rpl_threads[idx]; + cur_thr= thread_sched_fifo->head(); + thr= cur_thr->thr; if (!thr) return 0; mysql_mutex_lock(&thr->LOCK_rpl_thread); - if (thr->current_owner != &rpl_threads[idx]) + if (thr->current_owner != &cur_thr->thr) { /* No active worker thread, so no need to queue the master restart. */ mysql_mutex_unlock(&thr->LOCK_rpl_thread); diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index 307d0e3bada..ef872dec66f 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -344,6 +344,27 @@ struct rpl_parallel_thread_pool { struct rpl_parallel_entry { + /* + A small struct to put worker threads references into a FIFO (using an + I_List) for round-robin scheduling. + */ + struct sched_bucket : public ilink { + sched_bucket() : thr(nullptr) { } + rpl_parallel_thread *thr; + }; + /* + A struct to keep track of into which "generation" an XA XID was last + scheduled. A "generation" means that we know that every worker thread + slot in the rpl_parallel_entry was scheduled at least once. When more + that two generations have passed, we can safely reuse the XID in a + different worker. + */ + struct xid_active_generation { + uint64 generation; + sched_bucket *thr; + xid_t xid; + }; + mysql_mutex_t LOCK_parallel_entry; mysql_cond_t COND_parallel_entry; uint32 domain_id; @@ -374,17 +395,36 @@ struct rpl_parallel_entry { uint64 stop_sub_id; /* - Cyclic array recording the last rpl_thread_max worker threads that we + Array recording the last rpl_thread_max worker threads that we queued event for. This is used to limit how many workers a single domain can occupy (--slave-domain-parallel-threads). + The array is structured as a FIFO using an I_List thread_sched_fifo. + Note that workers are never explicitly deleted from the array. Instead, we need to check (under LOCK_rpl_thread) that the thread still belongs to us before re-using (rpl_thread::current_owner). */ - rpl_parallel_thread **rpl_threads; + sched_bucket *rpl_threads; + I_List *thread_sched_fifo; uint32 rpl_thread_max; - uint32 rpl_thread_idx; + /* + Keep track of all XA XIDs that may still be active in a worker thread. + The elements are of type xid_active_generation. + */ + DYNAMIC_ARRAY maybe_active_xid; + /* + Keeping track of the current scheduling generation. + + A new generation means that every worker thread in the rpl_threads array + have been scheduled at least one event group. + + When we have scheduled to slot current_generation_idx= 0, 1, ..., N-1 in this + order, we know that (at least) one generation has passed. + */ + uint64 current_generation; + uint32 current_generation_idx; + /* The sub_id of the last transaction to commit within this domain_id. Must be accessed under LOCK_parallel_entry protection. @@ -440,14 +480,22 @@ struct rpl_parallel_entry { /* Relay log info of replication source for this entry. */ Relay_log_info *rli; + void check_scheduling_generation(sched_bucket *cur); + sched_bucket *check_xa_xid_dependency(xid_t *xid); rpl_parallel_thread * choose_thread(rpl_group_info *rgi, bool *did_enter_cond, PSI_stage_info *old_stage, Gtid_log_event *gtid_ev); rpl_parallel_thread * - choose_thread_internal(uint idx, bool *did_enter_cond, rpl_group_info *rgi, - PSI_stage_info *old_stage); + choose_thread_internal(sched_bucket *cur_thr, bool *did_enter_cond, + rpl_group_info *rgi, PSI_stage_info *old_stage); int queue_master_restart(rpl_group_info *rgi, Format_description_log_event *fdev); + /* + the initial size of maybe_ array corresponds to the case of + each worker receives perhaps unlikely XA-PREPARE and XA-COMMIT within + the same generation. + */ + inline uint active_xid_init_alloc() { return 3 * 2 * rpl_thread_max; } }; struct rpl_parallel { HASH domain_hash; @@ -470,6 +518,7 @@ struct rpl_parallel { extern struct rpl_parallel_thread_pool global_rpl_thread_pool; +extern void wait_for_pending_deadlock_kill(THD *thd, rpl_group_info *rgi); extern int rpl_parallel_resize_pool_if_no_slaves(void); extern int rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool); extern int rpl_parallel_inactivate_pool(rpl_parallel_thread_pool *pool); diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index b29cff16c6a..66b6429b758 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -44,8 +44,6 @@ rpl_slave_state *rpl_global_gtid_slave_state; /* Object used for MASTER_GTID_WAIT(). */ gtid_waiting rpl_global_gtid_waiting; -const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event"; - Relay_log_info::Relay_log_info(bool is_slave_recovery, const char* thread_name) :Slave_reporting_capability(thread_name), replicate_same_server_id(::replicate_same_server_id), @@ -2249,7 +2247,7 @@ delete_or_keep_event_post_apply(rpl_group_info *rgi, } -void rpl_group_info::cleanup_context(THD *thd, bool error) +void rpl_group_info::cleanup_context(THD *thd, bool error, bool keep_domain_owner) { DBUG_ENTER("rpl_group_info::cleanup_context"); DBUG_PRINT("enter", ("error: %d", (int) error)); @@ -2304,7 +2302,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error) Ensure we always release the domain for others to process, when using --gtid-ignore-duplicates. */ - if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL) + if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL && !keep_domain_owner) rpl_global_gtid_slave_state->release_domain_owner(this); } diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 8220370d77f..30a0e0be0c2 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -506,11 +506,6 @@ public: m_flags&= ~flag; } - /** - Text used in THD::proc_info when the slave SQL thread is delaying. - */ - static const char *const state_delaying_string; - bool flush(); /** @@ -533,7 +528,7 @@ public: { mysql_mutex_assert_owner(&data_lock); sql_delay_end= delay_end; - thd_proc_info(sql_driver_thd, state_delaying_string); + THD_STAGE_INFO(sql_driver_thd, stage_sql_thd_waiting_until_delay); } int32 get_sql_delay() { return sql_delay; } @@ -564,6 +559,10 @@ private: Guarded by data_lock. Written by the sql thread. Read by client threads executing SHOW SLAVE STATUS. + + This is calculated as: + clock_time_for_event_on_master + clock_difference_between_master_and_slave + + SQL_DELAY. */ time_t sql_delay_end; @@ -958,7 +957,7 @@ struct rpl_group_info } void clear_tables_to_lock(); - void cleanup_context(THD *, bool); + void cleanup_context(THD *, bool, bool keep_domain_owner= false); void slave_close_thread_tables(THD *); void mark_start_commit_no_lock(); void mark_start_commit(); diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 06513387ac7..f8c6ddaa28b 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -1,4 +1,4 @@ -/* Copyright 2018-2023 Codership Oy +/* Copyright 2018-2024 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 @@ -263,12 +263,28 @@ extern "C" my_bool wsrep_thd_order_before(const THD *left, const THD *right) return FALSE; } +/** Check if wsrep transaction is aborting state. + +Calling function should make sure that wsrep transaction state +can't change during this function. + +This function is called from +wsrep_abort_thd where we hold THD::LOCK_thd_data +wsrep_handle_mdl_conflict we hold THD::LOCK_thd_data +wsrep_assert_no_bf_bf_wait we hold lock_sys.latch +innobase_kill_query we hold THD::LOCK_thd_data (THD::awake_no_mutex) + +@param thd thread handle + +@return true if wsrep transaction is aborting +@return false if not + +*/ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd) { - mysql_mutex_assert_owner(&thd->LOCK_thd_data); - const wsrep::client_state& cs(thd->wsrep_cs()); const enum wsrep::transaction::state tx_state(cs.transaction().state()); + switch (tx_state) { case wsrep::transaction::s_must_abort: @@ -277,7 +293,7 @@ extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd) case wsrep::transaction::s_aborting: return true; default: - return false; + break; } return false; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 0b3d6ff6c74..493a8cbd720 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -12147,7 +12147,7 @@ ER_UNKNOWN_DATA_TYPE spa "Tipo de datos desconocido: '%-.64s'" sw "Aina ya data isiyojulikana: '% -.64s'" ER_UNKNOWN_OPERATOR - eng "Operator does not exists: '%-.128s'" + eng "Operator does not exist: '%-.128s'" spa "El operador no existe: '%-.128s'" sw "Opereta haipo: '% -.128s'" ER_UNUSED_29 diff --git a/sql/slave.cc b/sql/slave.cc index 099d5939811..53bd0db77af 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3363,7 +3363,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, // to ensure that we use the same value throughout this function. const char *slave_sql_running_state= mi->rli.sql_driver_thd ? mi->rli.sql_driver_thd->proc_info : ""; - if (slave_sql_running_state == Relay_log_info::state_delaying_string) + if (slave_sql_running_state == stage_sql_thd_waiting_until_delay.m_name) { time_t t= my_time(0), sql_delay_end= mi->rli.get_sql_delay_end(); protocol->store((uint32)(t < sql_delay_end ? sql_delay_end - t : 0)); @@ -3935,7 +3935,7 @@ apply_event_and_update_pos_apply(Log_event* ev, THD* thd, rpl_group_info *rgi, if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && ((rli->mi->using_parallel() && rli->mi->parallel_mode <= SLAVE_PARALLEL_CONSERVATIVE) || - wsrep_ready == 0)) { + !wsrep_ready_get())) { rli->abort_slave= 1; rli->report(ERROR_LEVEL, ER_UNKNOWN_COM_ERROR, rgi->gtid_info(), "Node has dropped from cluster"); @@ -4402,6 +4402,13 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, rli->last_inuse_relaylog->dequeued_count))) && event_can_update_last_master_timestamp(ev)) { + /* + This is the first event from the master after the slave was up to date + and has been waiting for new events. + We update last_master_timestamp before executing the event to not + have Seconds_after_master == 0 while executing the event. + last_master_timestamp will be updated again when the event is commited. + */ if (rli->last_master_timestamp < ev->when) { rli->last_master_timestamp= ev->when; @@ -4438,7 +4445,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli, Seconds_Behind_Master is zero. */ if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT && - rli->last_master_timestamp < ev->when) + rli->last_master_timestamp < ev->when + (time_t) ev->exec_time) rli->last_master_timestamp= ev->when + (time_t) ev->exec_time; DBUG_ASSERT(rli->last_master_timestamp >= 0); @@ -7241,9 +7248,6 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, default_client_charset_info->cs_name.str); } - /* This one is not strictly needed but we have it here for completeness */ - mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); - /* Set MYSQL_PLUGIN_DIR in case master asks for an external authentication plugin */ if (opt_plugin_dir_ptr && *opt_plugin_dir_ptr) mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr); @@ -7387,8 +7391,6 @@ MYSQL *rpl_connect_master(MYSQL *mysql) mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->cs_name.str); - /* This one is not strictly needed but we have it here for completeness */ - mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); if (mi->user == NULL || mi->user[0] == 0 diff --git a/sql/sp.cc b/sql/sp.cc index 742df1d71ee..8dccfd70a8a 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -2003,7 +2003,7 @@ Sp_handler::sp_show_create_routine(THD *thd, DBUG_EXECUTE_IF("cache_sp_in_show_create", /* Some tests need just need a way to cache SP without other side-effects.*/ - sp_cache_routine(thd, name, false, &sp); + sp_cache_routine(thd, name, &sp); sp->show_create_routine(thd, this); DBUG_RETURN(false); ); @@ -2427,7 +2427,7 @@ Sp_handler::sp_cache_routine_reentrant(THD *thd, int ret; Parser_state *oldps= thd->m_parser_state; thd->m_parser_state= NULL; - ret= sp_cache_routine(thd, name, false, sp); + ret= sp_cache_routine(thd, name, sp); thd->m_parser_state= oldps; return ret; } @@ -2834,7 +2834,6 @@ void sp_update_stmt_used_routines(THD *thd, Query_tables_list *prelocking_ctx, */ int Sroutine_hash_entry::sp_cache_routine(THD *thd, - bool lookup_only, sp_head **sp) const { char qname_buff[NAME_LEN*2+1+1]; @@ -2847,7 +2846,7 @@ int Sroutine_hash_entry::sp_cache_routine(THD *thd, */ DBUG_ASSERT(mdl_request.ticket || this == thd->lex->sroutines_list.first); - return m_handler->sp_cache_routine(thd, &name, lookup_only, sp); + return m_handler->sp_cache_routine(thd, &name, sp); } @@ -2859,9 +2858,6 @@ int Sroutine_hash_entry::sp_cache_routine(THD *thd, @param[in] thd Thread context. @param[in] name Name of routine. - @param[in] lookup_only Only check that the routine is in the cache. - If it's not, don't try to load. If it is present, - but old, don't try to reload. @param[out] sp Pointer to sp_head object for routine, NULL if routine was not found. @@ -2872,7 +2868,6 @@ int Sroutine_hash_entry::sp_cache_routine(THD *thd, int Sp_handler::sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const { int ret= 0; @@ -2884,9 +2879,6 @@ int Sp_handler::sp_cache_routine(THD *thd, *sp= sp_cache_lookup(spc, name); - if (lookup_only) - DBUG_RETURN(SP_OK); - if (*sp) { sp_cache_flush_obsolete(spc, sp); @@ -2938,7 +2930,6 @@ int Sp_handler::sp_cache_routine(THD *thd, * name->m_db is a database name, e.g. "dbname" * name->m_name is a package-qualified name, e.g. "pkgname.spname" - @param lookup_only - don't load mysql.proc if not cached @param [OUT] sp - the result is returned here. @retval false - loaded or does not exists @retval true - error while loading mysql.proc @@ -2948,14 +2939,13 @@ int Sp_handler::sp_cache_package_routine(THD *thd, const LEX_CSTRING &pkgname_cstr, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const + sp_head **sp) const { DBUG_ENTER("sp_cache_package_routine"); DBUG_ASSERT(type() == SP_TYPE_FUNCTION || type() == SP_TYPE_PROCEDURE); sp_name pkgname(&name->m_db, &pkgname_cstr, false); sp_head *ph= NULL; int ret= sp_handler_package_body.sp_cache_routine(thd, &pkgname, - lookup_only, &ph); if (!ret) { @@ -2990,12 +2980,12 @@ Sp_handler::sp_cache_package_routine(THD *thd, int Sp_handler::sp_cache_package_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const + sp_head **sp) const { DBUG_ENTER("Sp_handler::sp_cache_package_routine"); Prefix_name_buf pkgname(thd, name->m_name); DBUG_ASSERT(pkgname.length); - DBUG_RETURN(sp_cache_package_routine(thd, pkgname, name, lookup_only, sp)); + DBUG_RETURN(sp_cache_package_routine(thd, pkgname, name, sp)); } diff --git a/sql/sp.h b/sql/sp.h index 45e2ebc6385..1d75160ce82 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -103,10 +103,10 @@ protected: int sp_cache_package_routine(THD *thd, const LEX_CSTRING &pkgname_cstr, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; + sp_head **sp) const; int sp_cache_package_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; + sp_head **sp) const; sp_head *sp_find_package_routine(THD *thd, const LEX_CSTRING pkgname_str, const Database_qualified_name *name, @@ -203,7 +203,7 @@ public: const Database_qualified_name *name, bool cache_only) const; virtual int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const; + sp_head **sp) const; int sp_cache_routine_reentrant(THD *thd, const Database_qualified_name *nm, @@ -284,9 +284,9 @@ class Sp_handler_package_procedure: public Sp_handler_procedure { public: int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const + sp_head **sp) const { - return sp_cache_package_routine(thd, name, lookup_only, sp); + return sp_cache_package_routine(thd, name, sp); } sp_head *sp_find_routine(THD *thd, const Database_qualified_name *name, @@ -333,9 +333,9 @@ class Sp_handler_package_function: public Sp_handler_function { public: int sp_cache_routine(THD *thd, const Database_qualified_name *name, - bool lookup_only, sp_head **sp) const + sp_head **sp) const { - return sp_cache_package_routine(thd, name, lookup_only, sp); + return sp_cache_package_routine(thd, name, sp); } sp_head *sp_find_routine(THD *thd, const Database_qualified_name *name, @@ -633,7 +633,7 @@ public: const Sp_handler *m_handler; - int sp_cache_routine(THD *thd, bool lookup_only, sp_head **sp) const; + int sp_cache_routine(THD *thd, sp_head **sp) const; }; diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index d005f6adb89..2a777c14d92 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -78,6 +78,8 @@ private: /* All routines in this cache */ HASH m_hashtable; +public: + void clear(); }; // class sp_cache #ifdef HAVE_PSI_INTERFACE @@ -314,6 +316,10 @@ sp_cache::cleanup() my_hash_free(&m_hashtable); } +void sp_cache::clear() +{ + my_hash_reset(&m_hashtable); +} void Sp_caches::sp_caches_clear() { @@ -322,3 +328,15 @@ void Sp_caches::sp_caches_clear() sp_cache_clear(&sp_package_spec_cache); sp_cache_clear(&sp_package_body_cache); } + +void Sp_caches::sp_caches_empty() +{ + if (sp_proc_cache) + sp_proc_cache->clear(); + if (sp_func_cache) + sp_func_cache->clear(); + if (sp_package_spec_cache) + sp_package_spec_cache->clear(); + if (sp_package_body_cache) + sp_package_body_cache->clear(); +} diff --git a/sql/sp_instr.cc b/sql/sp_instr.cc index 650d068d71f..4ffb49a8cf2 100644 --- a/sql/sp_instr.cc +++ b/sql/sp_instr.cc @@ -898,6 +898,9 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) thd->update_stats(); thd->lex->sql_command= save_sql_command; *nextp= m_ip+1; +#ifdef PROTECT_STATEMENT_MEMROOT + mark_as_qc_used(); +#endif } thd->set_query(query_backup); thd->query_name_consts= 0; diff --git a/sql/sp_instr.h b/sql/sp_instr.h index 4d4dd3e76e1..ae466608663 100644 --- a/sql/sp_instr.h +++ b/sql/sp_instr.h @@ -112,7 +112,7 @@ public: m_ctx(ctx), m_lineno(0) #ifdef PROTECT_STATEMENT_MEMROOT - , m_has_been_run(false) + , m_has_been_run(NON_RUN) #endif {} @@ -214,21 +214,29 @@ public: #ifdef PROTECT_STATEMENT_MEMROOT bool has_been_run() const { - return m_has_been_run; + return m_has_been_run == RUN; + } + + void mark_as_qc_used() + { + m_has_been_run= QC; } void mark_as_run() { - m_has_been_run= true; + if (m_has_been_run == QC) + m_has_been_run= NON_RUN; // answer was from WC => not really executed + else + m_has_been_run= RUN; } void mark_as_not_run() { - m_has_been_run= false; + m_has_been_run= NON_RUN; } private: - bool m_has_been_run; + enum {NON_RUN, QC, RUN} m_has_been_run; #endif }; // class sp_instr : public Sql_alloc diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 97137a41174..f8fd9675a5d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3812,7 +3812,7 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx, DBUG_RETURN(TRUE); /* Ensures the routine is up-to-date and cached, if exists. */ - if (rt->sp_cache_routine(thd, has_prelocking_list, &sp)) + if (rt->sp_cache_routine(thd, &sp)) DBUG_RETURN(TRUE); /* Remember the version of the routine in the parse tree. */ @@ -3853,7 +3853,7 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx, Validating routine version is unnecessary, since CALL does not affect the prepared statement prelocked list. */ - if (rt->sp_cache_routine(thd, false, &sp)) + if (rt->sp_cache_routine(thd, &sp)) DBUG_RETURN(TRUE); } } @@ -5904,13 +5904,23 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count, uint flags) } } - DEBUG_SYNC(thd, "before_lock_tables_takes_lock"); +#ifdef ENABLED_DEBUG_SYNC + if (!tables || + !(strcmp(tables->db.str, "mysql") == 0 && + strcmp(tables->table_name.str, "proc") == 0)) + DEBUG_SYNC(thd, "before_lock_tables_takes_lock"); +#endif if (! (thd->lock= mysql_lock_tables(thd, start, (uint) (ptr - start), flags))) DBUG_RETURN(TRUE); - DEBUG_SYNC(thd, "after_lock_tables_takes_lock"); +#ifdef ENABLED_DEBUG_SYNC + if (!tables || + !(strcmp(tables->db.str, "mysql") == 0 && + strcmp(tables->table_name.str, "proc") == 0)) + DEBUG_SYNC(thd, "after_lock_tables_takes_lock"); +#endif if (thd->lex->requires_prelocking() && thd->lex->sql_command != SQLCOM_LOCK_TABLES && diff --git a/sql/sql_bootstrap.cc b/sql/sql_bootstrap.cc index b39d7a57bc0..72821384bb6 100644 --- a/sql/sql_bootstrap.cc +++ b/sql/sql_bootstrap.cc @@ -33,26 +33,35 @@ extern "C" int read_bootstrap_query(char *query, int *query_length, fgets_input_t input, fgets_fn_t fgets_fn, int preserve_delimiter, int *error) { - char line_buffer[MAX_BOOTSTRAP_LINE_SIZE]; + char *line_buffer; const char *line; size_t len; size_t query_len= 0; int fgets_error= 0; + int exit_code= 0; *error= 0; + line_buffer= (char*) malloc(MAX_BOOTSTRAP_LINE_SIZE); + *query_length= 0; for ( ; ; ) { - line= (*fgets_fn)(line_buffer, sizeof(line_buffer), input, &fgets_error); + line= (*fgets_fn)(line_buffer, MAX_BOOTSTRAP_LINE_SIZE, input, &fgets_error); if (error) *error= fgets_error; if (fgets_error != 0) - return READ_BOOTSTRAP_ERROR; + { + exit_code= READ_BOOTSTRAP_ERROR; + break; + } if (line == NULL) - return (query_len == 0) ? READ_BOOTSTRAP_EOF : READ_BOOTSTRAP_ERROR; + { + exit_code= (query_len == 0) ? READ_BOOTSTRAP_EOF : READ_BOOTSTRAP_ERROR; + break; + } len= strlen(line); @@ -98,7 +107,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length, if (!p || !p[1]) { /* Invalid DELIMITER specifier */ - return READ_BOOTSTRAP_ERROR; + exit_code= READ_BOOTSTRAP_ERROR; + break; } delimiter.assign(p+1); if (preserve_delimiter) @@ -106,7 +116,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length, memcpy(query,line,len); query[len]=0; *query_length = (int)len; - return READ_BOOTSTRAP_SUCCESS; + exit_code= READ_BOOTSTRAP_SUCCESS; + break; } continue; } @@ -125,7 +136,8 @@ extern "C" int read_bootstrap_query(char *query, int *query_length, } query[query_len]= '\0'; *query_length= (int)query_len; - return READ_BOOTSTRAP_QUERY_SIZE; + exit_code= READ_BOOTSTRAP_QUERY_SIZE; + break; } if (query_len != 0) @@ -152,8 +164,11 @@ extern "C" int read_bootstrap_query(char *query, int *query_length, } query[query_len]= 0; *query_length= (int)query_len; - return READ_BOOTSTRAP_SUCCESS; + exit_code= READ_BOOTSTRAP_SUCCESS; + break; } } + free(line_buffer); + return exit_code; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index b284189db23..34d063fcca0 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2530,14 +2530,9 @@ void Query_cache::destroy() void Query_cache::disable_query_cache(THD *thd) { + lock(thd); m_cache_status= DISABLE_REQUEST; - /* - If there is no requests in progress try to free buffer. - try_lock(TRY) will exit immediately if there is lock. - unlock() should free block. - */ - if (m_requests_in_progress == 0 && !try_lock(thd, TRY)) - unlock(); + unlock(); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fc7ba45d4dd..d729be6b717 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -893,6 +893,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) prepare_derived_at_open= FALSE; create_tmp_table_for_derived= FALSE; save_prep_leaf_list= FALSE; + reset_sp_cache= false; org_charset= 0; /* Restore THR_THD */ set_current_thd(old_THR_THD); @@ -5386,14 +5387,38 @@ thd_rpl_deadlock_check(MYSQL_THD thd, MYSQL_THD other_thd) return 0; if (!rgi->is_parallel_exec) return 0; - if (rgi->rli != other_rgi->rli) - return 0; - if (!rgi->gtid_sub_id || !other_rgi->gtid_sub_id) - return 0; - if (rgi->current_gtid.domain_id != other_rgi->current_gtid.domain_id) - return 0; - if (rgi->gtid_sub_id > other_rgi->gtid_sub_id) - return 0; + if (rgi->rli == other_rgi->rli && + rgi->current_gtid.domain_id == other_rgi->current_gtid.domain_id) + { + /* + Within the same master connection and domain, we can compare transaction + order on the GTID sub_id, and rollback the later transaction to allow the + earlier transaction to commit first. + */ + if (!rgi->gtid_sub_id || !other_rgi->gtid_sub_id || + rgi->gtid_sub_id > other_rgi->gtid_sub_id) + return 0; + } + else + { + /* + Lock conflicts between different master connections or domains should + usually not occur, but could still happen if user is running some + special setup that tolerates conflicting updates (or in case of user + error). We do not have a pre-defined ordering of transactions in this + case, but we still need to handle conflicts in _some_ way to avoid + undetected deadlocks and hangs. + + We do this by rolling back and retrying any transaction that is being + _optimistically_ applied. This can be overly conservative in some cases, + but should be fine as conflicts between different master connections / + domains are not common. And it ensures that we won't end up in a + deadlock and hang due to a transaction doing wait_for_prior_commit while + holding locks that block something in another master connection. + */ + if (other_rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC) + return 0; + } if (rgi->finish_event_group_called || other_rgi->finish_event_group_called) { /* @@ -8180,6 +8205,34 @@ wait_for_commit::unregister_wait_for_prior_commit2() mysql_mutex_unlock(&LOCK_wait_commit); } +/* + Wait # seconds or until someone sends a signal (through kill) + + Note that this must have same prototype as my_sleep_for_space() +*/ + +C_MODE_START + +void mariadb_sleep_for_space(unsigned int seconds) +{ + THD *thd= current_thd; + PSI_stage_info old_stage; + if (!thd) + { + sleep(seconds); + return; + } + mysql_mutex_lock(&thd->LOCK_wakeup_ready); + thd->ENTER_COND(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready, + &stage_waiting_for_disk_space, &old_stage); + if (!thd->killed) + mysql_cond_wait(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready); + thd->EXIT_COND(&old_stage); + return; +} + +C_MODE_END + bool Discrete_intervals_list::append(ulonglong start, ulonglong val, ulonglong incr) diff --git a/sql/sql_class.h b/sql/sql_class.h index 8333fda05e0..d6eebf5ebde 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,5 +1,4 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2009, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify @@ -2482,6 +2481,11 @@ public: swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache); } void sp_caches_clear(); + /** + Clear content of sp related caches. + Don't delete cache objects itself. + */ + void sp_caches_empty(); }; @@ -2974,6 +2978,12 @@ public: bool save_prep_leaf_list; + /** + The data member reset_sp_cache is to signal that content of sp_cache + must be reset (all items be removed from it). + */ + bool reset_sp_cache; + /* container for handler's private per-connection data */ Ha_data ha_data[MAX_HA]; @@ -4851,24 +4861,24 @@ public: */ bool copy_db_to(LEX_CSTRING *to) { - if (db.str == NULL) + if (db.str) { - /* - No default database is set. In this case if it's guaranteed that - no CTE can be used in the statement then we can throw an error right - now at the parser stage. Otherwise the decision about throwing such - a message must be postponed until a post-parser stage when we are able - to resolve all CTE names as we don't need this message to be thrown - for any CTE references. - */ - if (!lex->with_cte_resolution) - my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); - return TRUE; + to->str= strmake(db.str, db.length); + to->length= db.length; + return to->str == NULL; /* True on error */ } - to->str= strmake(db.str, db.length); - to->length= db.length; - return to->str == NULL; /* True on error */ + /* + No default database is set. In this case if it's guaranteed that + no CTE can be used in the statement then we can throw an error right + now at the parser stage. Otherwise the decision about throwing such + a message must be postponed until a post-parser stage when we are able + to resolve all CTE names as we don't need this message to be thrown + for any CTE references. + */ + if (!lex->with_cte_resolution) + my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); + return TRUE; } /* Get db name or "". Use for printing current db */ const char *get_db() @@ -8264,6 +8274,10 @@ extern THD_list server_threads; void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps, uint field_count); +C_MODE_START +void mariadb_sleep_for_space(unsigned int seconds); +C_MODE_END + #ifdef WITH_WSREP extern void wsrep_to_isolation_end(THD*); #endif diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c579ad17550..e16ac1c1007 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1951,14 +1951,31 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink) was used. This ensures that we don't get a problem when the whole range of the key has been used. */ - if (info->handle_duplicates == DUP_REPLACE && table->next_number_field && + if (info->handle_duplicates == DUP_REPLACE && key_nr == table->s->next_number_index && insert_id_for_cur_row > 0) goto err; - if (table->file->ha_table_flags() & HA_DUPLICATE_POS) + if (table->file->has_dup_ref()) { + /* + If engine doesn't support HA_DUPLICATE_POS, the handler may init to + INDEX, but dup_ref could also be set by lookup_handled (and then, + lookup_errkey is set, f.ex. long unique duplicate). + + In such case, handler would stay uninitialized, so do it here. + */ + bool init_lookup_handler= table->file->lookup_errkey != (uint)-1 && + table->file->inited == handler::NONE; + if (init_lookup_handler && table->file->ha_rnd_init_with_error(false)) + goto err; + DBUG_ASSERT(table->file->inited == handler::RND); - if (table->file->ha_rnd_pos(table->record[1],table->file->dup_ref)) - goto err; + int rnd_pos_err= table->file->ha_rnd_pos(table->record[1], + table->file->dup_ref); + + if (init_lookup_handler) + table->file->ha_rnd_end(); + if (rnd_pos_err) + goto err; } else { @@ -2401,7 +2418,7 @@ public: passed from connection thread to the handler thread. */ MDL_request grl_protection; - Delayed_insert(SELECT_LEX *current_select) + Delayed_insert(LEX *lex) :locks_in_memory(0), thd(next_thread_id()), table(0),tables_in_use(0), stacked_inserts(0), status(0), retry(0), handler_thread_initialized(FALSE), group_count(0) @@ -2414,8 +2431,9 @@ public: strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user); thd.current_tablenr=0; thd.set_command(COM_DELAYED_INSERT); - thd.lex->current_select= current_select; - thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock() + thd.lex->current_select= lex->current_select; + thd.lex->sql_command= lex->sql_command; // For innodb::store_lock() + thd.lex->duplicates= lex->duplicates; /* Prevent changes to global.lock_wait_timeout from affecting delayed insert threads as any timeouts in delayed inserts @@ -2591,7 +2609,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request, */ if (! (di= find_handler(thd, table_list))) { - if (!(di= new Delayed_insert(thd->lex->current_select))) + if (!(di= new Delayed_insert(thd->lex))) goto end_create; /* diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 1ef4b3f44b4..b80f386179f 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -1595,6 +1595,7 @@ bool JOIN_CACHE::put_record() { bool is_full; uchar *link= 0; + DBUG_ASSERT(!for_explain_only); if (prev_cache) link= prev_cache->get_curr_rec_link(); write_record_data(link, &is_full); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5e343cd7784..5fd1c8cfa40 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4276,17 +4276,18 @@ uint8 LEX::get_effective_with_check(TABLE_LIST *view) bool LEX::copy_db_to(LEX_CSTRING *to) { - if (sphead && sphead->m_name.str) - { - DBUG_ASSERT(sphead->m_db.str && sphead->m_db.length); - /* - It is safe to assign the string by-pointer, both sphead and - its statements reside in the same memory root. - */ - *to= sphead->m_db; - return FALSE; - } - return thd->copy_db_to(to); + if (!sphead || !sphead->m_name.str) + return thd->copy_db_to(to); + + DBUG_ASSERT(sphead->m_db.str); + DBUG_ASSERT(sphead->m_db.length); + + /* + It is safe to assign the string by-pointer, both sphead and + its statements reside in the same memory root. + */ + *to= sphead->m_db; + return FALSE; } /** diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 5cd66d8047a..b3d95c9ed31 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -26,7 +26,11 @@ #include "sql_manager.h" #include "sql_base.h" // flush_tables -static bool volatile manager_thread_in_use = 0; +/* + Values for manager_thread_in_use: 0 means "not started". 1 means "started + and active". 2 means "stopped". +*/ +static int volatile manager_thread_in_use = 0; static bool abort_manager = false; pthread_t manager_thread; @@ -44,7 +48,7 @@ static struct handler_cb *cb_list; // protected by LOCK_manager bool mysql_manager_submit(void (*action)(void *), void *data) { bool result= FALSE; - DBUG_ASSERT(manager_thread_in_use); + DBUG_ASSERT(manager_thread_in_use == 1); struct handler_cb **cb; mysql_mutex_lock(&LOCK_manager); cb= &cb_list; @@ -119,7 +123,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused))) mysql_mutex_lock(&LOCK_manager); } DBUG_ASSERT(cb_list == NULL); - manager_thread_in_use = 0; + manager_thread_in_use = 2; mysql_mutex_unlock(&LOCK_manager); mysql_mutex_destroy(&LOCK_manager); mysql_cond_destroy(&COND_manager); @@ -148,6 +152,15 @@ void start_handle_manager() } mysql_mutex_lock(&LOCK_manager); + /* + Wait for manager thread to have started, otherwise in extreme cases the + server may start up and have initiated shutdown at the time the manager + thread even starts to run. + + Allow both values 1 and 2 for manager_thread_in_use, so that we will not + get stuck here if the manager thread somehow manages to start up and + abort again before we have time to test it here. + */ while (!manager_thread_in_use) mysql_cond_wait(&COND_manager, &LOCK_manager); mysql_mutex_unlock(&LOCK_manager); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f97a1ac5301..9fee1c5a50c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2249,6 +2249,7 @@ dispatch_command_return dispatch_command(enum enum_server_command command, THD * my_eof(thd); kill_mysql(thd); error=TRUE; + DBUG_EXECUTE_IF("simulate_slow_client_at_shutdown", my_sleep(2000000);); break; } #endif @@ -2406,6 +2407,11 @@ resume: } #endif /* WITH_WSREP */ + if (thd->reset_sp_cache) + { + thd->sp_caches_empty(); + thd->reset_sp_cache= false; + } if (do_end_of_statement) { @@ -2482,6 +2488,7 @@ resume: MYSQL_COMMAND_DONE(res); } DEBUG_SYNC(thd,"dispatch_command_end"); + DEBUG_SYNC(thd,"dispatch_command_end2"); /* Check that some variables are reset properly */ DBUG_ASSERT(thd->abort_on_warning == 0); @@ -5640,7 +5647,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) if (sph->sp_resolve_package_routine(thd, thd->lex->sphead, lex->spname, &sph, &pkgname)) return true; - if (sph->sp_cache_routine(thd, lex->spname, false, &sp)) + if (sph->sp_cache_routine(thd, lex->spname, &sp)) goto error; if (!sp || sp->show_routine_code(thd)) { @@ -8040,10 +8047,6 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, List *partition_names, LEX_STRING *option) { - TABLE_LIST *ptr; - TABLE_LIST *UNINIT_VAR(previous_table_ref); /* The table preceding the current one. */ - LEX_CSTRING alias_str; - LEX *lex= thd->lex; DBUG_ENTER("add_table_to_list"); DBUG_PRINT("enter", ("Table '%s' (%p) Select %p (%u)", (alias ? alias->str : table->table.str), @@ -8053,9 +8056,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (unlikely(!table)) DBUG_RETURN(0); // End of memory - alias_str= alias ? *alias : table->table; - DBUG_ASSERT(alias_str.str); - if (!MY_TEST(table_options & TL_OPTION_ALIAS) && + if (!(table_options & TL_OPTION_ALIAS) && unlikely(check_table_name(table->table.str, table->table.length, FALSE))) { my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); @@ -8070,6 +8071,34 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, DBUG_RETURN(0); } + LEX_CSTRING db{0, 0}; + bool fqtn= false; + LEX *lex= thd->lex; + if (table->db.str) + { + fqtn= TRUE; + db= table->db; + } + else if (!lex->with_cte_resolution && lex->copy_db_to(&db)) + DBUG_RETURN(0); + else + fqtn= FALSE; + bool info_schema= is_infoschema_db(&db); + if (!table->sel && info_schema && + (table_options & TL_OPTION_UPDATING) && + /* Special cases which are processed by commands itself */ + lex->sql_command != SQLCOM_CHECK && + lex->sql_command != SQLCOM_CHECKSUM) + { + my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), + thd->security_ctx->priv_user, + thd->security_ctx->priv_host, + INFORMATION_SCHEMA_NAME.str); + DBUG_RETURN(0); + } + + LEX_CSTRING alias_str= alias ? *alias : table->table; + DBUG_ASSERT(alias_str.str); if (!alias) /* Alias is case sensitive */ { if (unlikely(table->sel)) @@ -8082,63 +8111,15 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (unlikely(!(alias_str.str= (char*) thd->memdup(alias_str.str, alias_str.length+1)))) DBUG_RETURN(0); } - if (unlikely(!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))) - DBUG_RETURN(0); /* purecov: inspected */ - if (table->db.str) - { - ptr->is_fqtn= TRUE; - ptr->db= table->db; - } - else if (!lex->with_cte_resolution && lex->copy_db_to(&ptr->db)) - DBUG_RETURN(0); - else - ptr->is_fqtn= FALSE; - ptr->alias= alias_str; - ptr->is_alias= alias ? TRUE : FALSE; - if (lower_case_table_names) - { - if (table->table.length) - table->table.length= my_casedn_str(files_charset_info, - (char*) table->table.str); - if (ptr->db.length && ptr->db.str != any_db.str) - ptr->db.length= my_casedn_str(files_charset_info, (char*) ptr->db.str); - } + bool has_alias_ptr= alias != nullptr; + void *memregion= thd->calloc(sizeof(TABLE_LIST)); + TABLE_LIST *ptr= new (memregion) TABLE_LIST(thd, db, fqtn, alias_str, + has_alias_ptr, table, lock_type, + mdl_type, table_options, + info_schema, this, + index_hints_arg, option); - ptr->table_name= table->table; - ptr->lock_type= lock_type; - ptr->mdl_type= mdl_type; - ptr->table_options= table_options; - ptr->updating= MY_TEST(table_options & TL_OPTION_UPDATING); - ptr->ignore_leaves= MY_TEST(table_options & TL_OPTION_IGNORE_LEAVES); - ptr->sequence= MY_TEST(table_options & TL_OPTION_SEQUENCE); - ptr->derived= table->sel; - if (!ptr->derived && is_infoschema_db(&ptr->db)) - { - if (ptr->updating && - /* Special cases which are processed by commands itself */ - lex->sql_command != SQLCOM_CHECK && - lex->sql_command != SQLCOM_CHECKSUM) - { - my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), - thd->security_ctx->priv_user, - thd->security_ctx->priv_host, - INFORMATION_SCHEMA_NAME.str); - DBUG_RETURN(0); - } - ST_SCHEMA_TABLE *schema_table; - schema_table= find_schema_table(thd, &ptr->table_name); - ptr->schema_table_name= ptr->table_name; - ptr->schema_table= schema_table; - } - ptr->select_lex= this; - /* - We can't cache internal temporary tables between prepares as the - table may be deleted before next execution. - */ - ptr->cacheable_table= !table->is_derived_table(); - ptr->index_hints= index_hints_arg; - ptr->option= option ? option->str : 0; /* check that used name is unique. Sequences are ignored */ if (lock_type != TL_IGNORE && !ptr->sequence) { @@ -8161,6 +8142,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, } } /* Store the table reference preceding the current one. */ + TABLE_LIST *UNINIT_VAR(previous_table_ref); /* The table preceding the current one. */ if (table_list.elements > 0 && likely(!ptr->sequence)) { /* diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 483ea1566c5..590c2a508f4 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -7753,7 +7753,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ERROR_INJECT("add_partition_1") || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || ERROR_INJECT("add_partition_2") || - wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) || + wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME) || ERROR_INJECT("add_partition_3") || write_log_add_change_partition(lpt) || ERROR_INJECT("add_partition_4") || diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 412924fde86..32d6d6909ee 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -4265,7 +4265,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, if (unlikely(error)) { - sql_print_error("Parsing options for plugin '%s' failed.", + sql_print_error("Parsing options for plugin '%s' failed. Disabling plugin", tmp->name.str); goto err; } diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 8104806af71..0c0b863edf3 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -68,6 +68,15 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, bool result=0; select_errors=0; /* Write if more errors */ int tmp_write_to_binlog= *write_to_binlog= 1; +#ifndef DBUG_OFF + /* + When invoked for handling a SIGHUP by rpl_shutdown_sighup.test, we need to + force the signal handler to wait after REFRESH_TABLES, as that will check + for a killed server, and we need to call hostname_cache_refresh after + server cleanup has happened to trigger MDEV-30260. + */ + int do_dbug_sleep= 0; +#endif DBUG_ASSERT(!thd || !thd->in_sub_stmt); @@ -102,6 +111,15 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, */ my_error(ER_UNKNOWN_ERROR, MYF(0)); } + +#ifndef DBUG_OFF + DBUG_EXECUTE_IF("hold_sighup_log_refresh", { + DBUG_ASSERT(!debug_sync_set_action( + thd, STRING_WITH_LEN("now SIGNAL in_reload_acl_and_cache " + "WAIT_FOR refresh_logs"))); + do_dbug_sleep= 1; + }); +#endif } opt_noacl= 0; @@ -354,6 +372,11 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, } my_dbopt_cleanup(); } + +#ifndef DBUG_OFF + if (do_dbug_sleep) + my_sleep(3000000); // 3s +#endif if (options & REFRESH_HOSTS) hostname_cache_refresh(); if (thd && (options & REFRESH_STATUS)) @@ -372,7 +395,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, } } #endif -#ifdef HAVE_OPENSSL +#ifdef HAVE_des if (options & REFRESH_DES_KEY_FILE) { if (des_key_file && load_des_key_file(des_key_file)) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 4fadc176cad..95e3ce42f78 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -221,7 +221,7 @@ static int fake_rotate_event(binlog_send_info *info, ulonglong position, char* p = info->log_file_name+dirname_length(info->log_file_name); uint ident_len = (uint) strlen(p); String *packet= info->packet; - ha_checksum crc; + ha_checksum crc= 0; /* reset transmit packet for the fake rotate event below */ if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg)) @@ -262,7 +262,7 @@ static int fake_gtid_list_event(binlog_send_info *info, { my_bool do_checksum; int err; - ha_checksum crc; + ha_checksum crc= 0; char buf[128]; String str(buf, sizeof(buf), system_charset_info); String* packet= info->packet; @@ -2828,12 +2828,6 @@ static int send_one_binlog_file(binlog_send_info *info, */ if (send_events(info, log, linfo, end_pos)) return 1; - DBUG_EXECUTE_IF("Notify_binlog_EOF", - { - const char act[]= "now signal eof_reached"; - DBUG_ASSERT(!debug_sync_set_action(current_thd, - STRING_WITH_LEN(act))); - };); } return 1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c8ed6b93d7b..007bbdc57d9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -850,37 +850,57 @@ void remove_redundant_subquery_clauses(st_select_lex *subq_select_lex) if (subq_select_lex->group_list.elements && !subq_select_lex->with_sum_func && !subq_select_lex->join->having) { + /* + Temporary workaround for MDEV-28621: Do not remove GROUP BY expression + if it has any subqueries in it. + */ + bool have_subquery= false; for (ORDER *ord= subq_select_lex->group_list.first; ord; ord= ord->next) { - /* - Do not remove the item if it is used in select list and then referred - from GROUP BY clause by its name or number. Example: - - select (select ... ) as SUBQ ... group by SUBQ - - Here SUBQ cannot be removed. - */ - if (!ord->in_field_list) + if ((*ord->item)->with_subquery()) { - (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); - /* - Remove from the JOIN::all_fields list any reference to the elements - of the eliminated GROUP BY list unless it is 'in_field_list'. - This is needed in order not to confuse JOIN::make_aggr_tables_info() - when it constructs different structure for execution phase. - */ - List_iterator li(subq_select_lex->join->all_fields); - Item *item; - while ((item= li++)) - { - if (item == *ord->item) - li.remove(); - } + have_subquery= true; + break; } } - subq_select_lex->join->group_list= NULL; - subq_select_lex->group_list.empty(); - DBUG_PRINT("info", ("GROUP BY removed")); + + if (!have_subquery) + { + for (ORDER *ord= subq_select_lex->group_list.first; ord; ord= ord->next) + { + /* + Do not remove the item if it is used in select list and then referred + from GROUP BY clause by its name or number. Example: + + select (select ... ) as SUBQ ... group by SUBQ + + Here SUBQ cannot be removed. + */ + if (!ord->in_field_list) + { + /* + Not necessary due to workaround for MDEV-28621: + (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); + */ + /* + Remove from the JOIN::all_fields list any reference to the elements + of the eliminated GROUP BY list unless it is 'in_field_list'. + This is needed in order not to confuse JOIN::make_aggr_tables_info() + when it constructs different structure for execution phase. + */ + List_iterator li(subq_select_lex->join->all_fields); + Item *item; + while ((item= li++)) + { + if (item == *ord->item) + li.remove(); + } + } + } + subq_select_lex->join->group_list= NULL; + subq_select_lex->group_list.empty(); + DBUG_PRINT("info", ("GROUP BY removed")); + } } /* @@ -3661,7 +3681,7 @@ bool JOIN::make_aggr_tables_info() distinct in the engine, so we do this for all queries, not only GROUP BY queries. */ - if (tables_list && top_join_tab_count && !procedure) + if (tables_list && top_join_tab_count && !only_const_tables() && !procedure) { /* At the moment we only support push down for queries where @@ -22747,7 +22767,7 @@ create_internal_tmp_table_from_heap(THD *thd, TABLE *table, if (open_tmp_table(&new_table)) goto err1; if (table->file->indexes_are_disabled()) - new_table.file->ha_disable_indexes(HA_KEY_SWITCH_ALL); + new_table.file->ha_disable_indexes(key_map(0), false); table->file->ha_index_or_rnd_end(); if (table->file->ha_rnd_init_with_error(1)) DBUG_RETURN(1); @@ -33148,7 +33168,26 @@ void JOIN::init_join_cache_and_keyread() */ table->mark_index_columns(table->file->keyread, table->read_set); } - if (tab->cache && tab->cache->init(select_options & SELECT_DESCRIBE)) + bool init_for_explain= false; + + /* + Can we use lightweight initalization mode just for EXPLAINs? We can if + we're certain that the optimizer will not execute the subquery. + The optimzier will not execute the subquery if it's too expensive. For + the exact criteria, see Item_subselect::is_expensive(). + Note that the subquery might be a UNION and we might not yet know if it + is expensive. + What we do know is that if this SELECT is too expensive, then the whole + subquery will be too expensive as well. + So, we can use lightweight initialization (init_for_explain=true) if this + SELECT examines more than @@expensive_subquery_limit rows. + */ + if ((select_options & SELECT_DESCRIBE) && + get_examined_rows() >= thd->variables.expensive_subquery_limit) + { + init_for_explain= true; + } + if (tab->cache && tab->cache->init(init_for_explain)) revise_cache_usage(tab); else tab->remove_redundant_bnl_scan_conds(); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4a7cf893de4..895c737387c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9762,7 +9762,7 @@ ST_FIELD_INFO stat_fields_info[]= Column("PACKED", Varchar(10), NULLABLE, "Packed", OPEN_FRM_ONLY), Column("NULLABLE", Varchar(3), NOT_NULL, "Null", OPEN_FRM_ONLY), Column("INDEX_TYPE", Varchar(16), NOT_NULL, "Index_type", OPEN_FULL_TABLE), - Column("COMMENT", Varchar(16), NULLABLE, "Comment", OPEN_FRM_ONLY), + Column("COMMENT", Varchar(16), NULLABLE, "Comment", OPEN_FULL_TABLE), Column("INDEX_COMMENT", Varchar(INDEX_COMMENT_MAXLEN), NOT_NULL, "Index_comment",OPEN_FRM_ONLY), Column("IGNORED", Varchar(3), NOT_NULL, "Ignored", OPEN_FRM_ONLY), @@ -10371,6 +10371,7 @@ ST_SCHEMA_TABLE schema_tables[]= int initialize_schema_table(st_plugin_int *plugin) { ST_SCHEMA_TABLE *schema_table; + int err; DBUG_ENTER("initialize_schema_table"); if (!(schema_table= (ST_SCHEMA_TABLE *)my_malloc(key_memory_ST_SCHEMA_TABLE, @@ -10387,12 +10388,15 @@ int initialize_schema_table(st_plugin_int *plugin) /* Make the name available to the init() function. */ schema_table->table_name= plugin->name.str; - if (plugin->plugin->init(schema_table)) + if ((err= plugin->plugin->init(schema_table))) { - sql_print_error("Plugin '%s' init function returned error.", - plugin->name.str); + if (err != HA_ERR_RETRY_INIT) + sql_print_error("Plugin '%s' init function returned error.", + plugin->name.str); plugin->data= NULL; my_free(schema_table); + if (err == HA_ERR_RETRY_INIT) + DBUG_RETURN(err); DBUG_RETURN(1); } diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 408a5cfe1f6..bdff67df773 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2906,6 +2906,9 @@ int collect_statistics_for_table(THD *thd, TABLE *table) After having been updated the statistical system tables are closed. */ +/* Stack usage 20248 from clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int update_statistics_for_table(THD *thd, TABLE *table) { TABLE_LIST tables[STATISTICS_TABLES]; @@ -2990,6 +2993,7 @@ int update_statistics_for_table(THD *thd, TABLE *table) new_trans.restore_old_transaction(); DBUG_RETURN(rc); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** @@ -3397,6 +3401,9 @@ end: The function is called when executing the statement DROP TABLE 'tab'. */ +/* Stack size 20248 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab) { @@ -3465,6 +3472,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, new_trans.restore_old_transaction(); DBUG_RETURN(rc); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** @@ -4009,6 +4017,9 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab, The function is called when executing any statement that renames a table */ +/* Stack size 20968 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab, const LEX_CSTRING *new_db, @@ -4086,6 +4097,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, new_trans.restore_old_transaction(); DBUG_RETURN(rc); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f6ece121dfa..4e25a18407c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1472,6 +1472,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, temporary_table_was_dropped= 1; } is_temporary= 1; + thd->reset_sp_cache= true; } if ((drop_temporary && if_exists) || temporary_table_was_dropped) @@ -1845,8 +1846,11 @@ report_error: } DBUG_PRINT("table", ("table: %p s: %p", table->table, table->table ? table->table->s : NULL)); + if (is_temporary_table(table)) + thd->reset_sp_cache= true; } DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog"); + thd->used|= THD::THREAD_SPECIFIC_USED; error= 0; @@ -4685,6 +4689,7 @@ int create_table_impl(THD *thd, if (is_trans != NULL) *is_trans= table->file->has_transactions(); + thd->reset_sp_cache= true; thd->used|= THD::THREAD_SPECIFIC_USED; create_info->table= table; // Store pointer to table } @@ -5173,7 +5178,8 @@ static bool make_unique_constraint_name(THD *thd, LEX_CSTRING *name, if (!check) // Found unique name { name->length= (size_t) (real_end - buff); - name->str= strmake_root(thd->stmt_arena->mem_root, buff, name->length); + name->str= thd->strmake(buff, name->length); + return (name->str == NULL); } } @@ -7408,14 +7414,28 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled, switch (keys_onoff) { case Alter_info::ENABLE: DEBUG_SYNC(table->in_use, "alter_table_enable_indexes"); - error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + error= table->file->ha_enable_indexes(key_map(table->s->keys), true); break; case Alter_info::LEAVE_AS_IS: if (!indexes_were_disabled) break; /* fall through */ case Alter_info::DISABLE: - error= table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); + { + key_map map= table->s->keys_in_use; + bool do_clear= false; + for (uint i=0; i < table->s->keys; i++) + { + if (!(table->s->key_info[i].flags & HA_NOSAME) && + i != table->s->next_number_index) + { + map.clear_bit(i); + do_clear= true; + } + } + if (do_clear) + error= table->file->ha_disable_indexes(map, true); + } } if (unlikely(error)) @@ -10428,14 +10448,14 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, if we can support implementing storage engine. */ if (WSREP(thd) && table && table->s->sequence && - wsrep_check_sequence(thd, thd->lex->create_info.seq_create_info, used_engine)) + wsrep_check_sequence(thd, create_info->seq_create_info, used_engine)) DBUG_RETURN(TRUE); - if (WSREP(thd) && + if (WSREP(thd) && table && (thd->lex->sql_command == SQLCOM_ALTER_TABLE || thd->lex->sql_command == SQLCOM_CREATE_INDEX || thd->lex->sql_command == SQLCOM_DROP_INDEX) && - !wsrep_should_replicate_ddl(thd, table_list->table->s->db_type())) + !wsrep_should_replicate_ddl(thd, table->s->db_type())) DBUG_RETURN(true); #endif /* WITH_WSREP */ @@ -13104,12 +13124,10 @@ bool Sql_cmd_create_table_like::execute(THD *thd) wsrep_check_sequence(thd, lex->create_info.seq_create_info, used_engine)) DBUG_RETURN(true); - WSREP_TO_ISOLATION_BEGIN_ALTER(create_table->db.str, - create_table->table_name.str, - first_table, &alter_info, NULL, - &create_info) - { - WSREP_WARN("CREATE TABLE isolation failure"); + WSREP_TO_ISOLATION_BEGIN_ALTER(create_table->db.str, create_table->table_name.str, + first_table, &alter_info, NULL, &create_info) + { + WSREP_WARN("CREATE TABLE isolation failure"); res= true; goto end_with_restore_list; } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 6e550e2cb84..9ef1825a16e 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -483,7 +483,7 @@ bool select_unit_ext::disable_index_if_needed(SELECT_LEX *curr_sl) !curr_sl->next_select()) ) { is_index_enabled= false; - if (table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL)) + if (table->file->ha_disable_indexes(key_map(0), false)) return false; table->no_keyread=1; return true; @@ -1263,26 +1263,21 @@ bool st_select_lex_unit::join_union_item_types(THD *thd_arg, } -bool init_item_int(THD* thd, Item_int* &item) +static bool init_item_int(THD* thd, Item_int* &item) { if (!item) { - Query_arena *arena, backup_arena; - arena= thd->activate_stmt_arena_if_needed(&backup_arena); - item= new (thd->mem_root) Item_int(thd, 0); - if (arena) - thd->restore_active_arena(arena, &backup_arena); - if (!item) - return false; + return true; } else { item->value= 0; } - return true; + + return false; } /** @@ -1846,8 +1841,12 @@ cont: for(uint i= 0; i< hidden; i++) { - init_item_int(thd, addon_fields[i]); - types.push_front(addon_fields[i]); + if (init_item_int(thd, addon_fields[i]) || + types.push_front(addon_fields[i])) + { + types.empty(); + goto err; + } addon_fields[i]->name.str= i ? "__CNT_1" : "__CNT_2"; addon_fields[i]->name.length= 7; } @@ -2201,7 +2200,7 @@ bool st_select_lex_unit::optimize() /* re-enabling indexes for next subselect iteration */ if ((union_result->force_enable_index_if_needed() || union_distinct)) { - if(table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL)) + if(table->file->ha_enable_indexes(key_map(table->s->keys), false)) DBUG_ASSERT(0); else table->no_keyread= 0; @@ -2324,7 +2323,7 @@ bool st_select_lex_unit::exec_inner() union_result->table && union_result->table->is_created()) { union_result->table->file->ha_delete_all_rows(); - union_result->table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL); + union_result->table->file->ha_enable_indexes(key_map(table->s->keys), false); } } @@ -2392,7 +2391,7 @@ bool st_select_lex_unit::exec_inner() { // This is UNION DISTINCT, so there should be a fake_select_lex DBUG_ASSERT(fake_select_lex != NULL); - if (unlikely(table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL))) + if (table->file->ha_disable_indexes(key_map(0), false)) return true; table->no_keyread=1; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 5ecd7f8ac22..0667d12a9e0 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2502,8 +2502,6 @@ int multi_update::do_updates() table = cur_table->table; if (table == table_to_update) continue; // Already updated - if (table->file->pushed_rowid_filter) - table->file->disable_pushed_rowid_filter(); org_updated= updated; tmp_table= tmp_tables[cur_table->shared]; tmp_table->file->extra(HA_EXTRA_CACHE); // Change to read cache @@ -2697,9 +2695,7 @@ int multi_update::do_updates() (void) tmp_table->file->ha_rnd_end(); check_opt_it.rewind(); while (TABLE *tbl= check_opt_it++) - tbl->file->ha_rnd_end(); - if (table->file->save_pushed_rowid_filter) - table->file->enable_pushed_rowid_filter(); + tbl->file->ha_rnd_end(); } DBUG_RETURN(0); @@ -2710,8 +2706,6 @@ err: } err2: - if (table->file->save_pushed_rowid_filter) - table->file->enable_pushed_rowid_filter(); if (table->file->inited) (void) table->file->ha_rnd_end(); if (tmp_table->file->inited) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1bb2cc227ce..3c9373cd34f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -83,6 +83,9 @@ #pragma GCC diagnostic ignored "-Wunused-label" /* yyexhaustedlab: */ #endif +/* Stack size 28200 with clang for MYSQLparse() and ORAparse() */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int yylex(void *yylval, void *yythd); #define yyoverflow(A,B,C,D,E,F) \ diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl index 32b215ee72d..0edb87d53c8 100644 --- a/sql/sys_vars.inl +++ b/sql/sys_vars.inl @@ -999,21 +999,10 @@ public: { option.var_type|= GET_STR; } bool do_check(THD *thd, set_var *var) { - char buff[STRING_BUFFER_USUAL_SIZE]; - String str(buff, sizeof(buff), system_charset_info), *res; - - if (!(res=var->value->val_str(&str))) - { + bool rc= Sys_var_charptr::do_string_check(thd, var, charset(thd)); + if (var->save_result.string_value.str == nullptr) var->save_result.string_value.str= const_cast(""); - var->save_result.string_value.length= 0; - } - else - { - size_t len= res->length(); - var->save_result.string_value.str= thd->strmake(res->ptr(), len); - var->save_result.string_value.length= len; - } - return false; + return rc; } bool session_update(THD *thd, set_var *var) { diff --git a/sql/table.cc b/sql/table.cc index 414f7ac41c2..ea0ef2a8c0c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -54,6 +54,7 @@ #include "wsrep_schema.h" #endif #include "log_event.h" // MAX_TABLE_MAP_ID +#include "sql_class.h" /* For MySQL 5.7 virtual fields */ #define MYSQL57_GENERATED_FIELD 128 @@ -3398,6 +3399,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, goto err; // Wrong field definition reg_field->flags |= AUTO_INCREMENT_FLAG; } + else + share->next_number_index= MAX_KEY; if (share->blob_fields) { @@ -5991,6 +5994,57 @@ void TABLE::reset_item_list(List *item_list, uint skip) const } } +TABLE_LIST::TABLE_LIST(THD *thd, + LEX_CSTRING db_str, + bool fqtn, + LEX_CSTRING alias_str, + bool has_alias_ptr, + Table_ident *table_ident, + thr_lock_type lock_t, + enum_mdl_type mdl_t, + ulong table_opts, + bool info_schema, + st_select_lex *sel, + List *index_hints_ptr, + LEX_STRING *option_ptr) +{ + db= db_str; + is_fqtn= fqtn; + alias= alias_str; + is_alias= has_alias_ptr; + if (lower_case_table_names) + { + if (table_ident->table.length) + table_ident->table.length= my_casedn_str(files_charset_info, + (char*) table_ident->table.str); + if (db.length && db.str != any_db.str) + db.length= my_casedn_str(files_charset_info, (char*) db.str); + } + + table_name= table_ident->table; + lock_type= lock_t; + mdl_type= mdl_t; + table_options= table_opts; + updating= table_options & TL_OPTION_UPDATING; + ignore_leaves= table_options & TL_OPTION_IGNORE_LEAVES; + sequence= table_options & TL_OPTION_SEQUENCE; + derived= table_ident->sel; + + if (!table_ident->sel && info_schema) + { + schema_table= find_schema_table(thd, &table_name); + schema_table_name= table_name; + } + select_lex= sel; + /* + We can't cache internal temporary tables between prepares as the + table may be deleted before next exection. + */ + cacheable_table= !table_ident->is_derived_table(); + index_hints= index_hints_ptr; + option= option_ptr ? option_ptr->str : 0; +} + /* calculate md5 of query @@ -9365,7 +9419,7 @@ void TABLE::period_prepare_autoinc() if (!found_next_number_field) return; /* Don't generate a new value if the autoinc index is WITHOUT OVERLAPS */ - DBUG_ASSERT(s->next_number_index != (uint)-1); + DBUG_ASSERT(s->next_number_index < MAX_KEY); if (key_info[s->next_number_index].without_overlaps) return; @@ -9709,7 +9763,8 @@ bool TABLE::insert_all_rows_into_tmp_table(THD *thd, } if (file->indexes_are_disabled()) - tmp_table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL); + tmp_table->file->ha_disable_indexes(key_map(0), false); + file->ha_index_or_rnd_end(); if (unlikely(file->ha_rnd_init_with_error(1))) diff --git a/sql/table.h b/sql/table.h index 2c9b1e6774c..93386db8455 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2297,8 +2297,23 @@ struct TABLE_CHAIN void set_end_pos(TABLE_LIST **pos) { end_pos= pos; } }; +class Table_ident; struct TABLE_LIST { + TABLE_LIST(THD *thd, + LEX_CSTRING db_str, + bool fqtn, + LEX_CSTRING alias_str, + bool has_alias_ptr, + Table_ident *table_ident, + thr_lock_type lock_t, + enum_mdl_type mdl_t, + ulong table_opts, + bool info_schema, + st_select_lex *sel, + List *index_hints_ptr, + LEX_STRING *option_ptr); + TABLE_LIST() = default; /* Remove gcc warning */ enum prelocking_types diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 7261eabfd82..0a653474ffa 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -107,7 +107,7 @@ struct pool_timer_t mysql_cond_t cond; volatile uint64 current_microtime; std::atomic next_timeout_check; - int tick_interval; + uint tick_interval; bool shutdown; pthread_t timer_thread_id; }; @@ -569,7 +569,7 @@ static void* timer_thread(void *param) struct timespec ts; int err; - set_timespec_nsec(ts,timer->tick_interval*1000000); + set_timespec_nsec(ts, timer->tick_interval*1000000LL); mysql_mutex_lock(&timer->mutex); err= mysql_cond_timedwait(&timer->cond, &timer->mutex, &ts); if (timer->shutdown) diff --git a/sql/tztime.cc b/sql/tztime.cc index e77a7529332..a2f2d2d2aa0 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2721,6 +2721,8 @@ static const char *lock_tables= " time_zone_transition WRITE,\n" " time_zone_transition_type WRITE"; static const char *trunc_tables_const= + "SET @old_alter_alg=@@SESSION.alter_algorithm;\n" + "SET session alter_algorithm='COPY';\n" "TRUNCATE TABLE time_zone;\n" "TRUNCATE TABLE time_zone_name;\n" "TRUNCATE TABLE time_zone_transition;\n" @@ -2869,6 +2871,9 @@ main(int argc, char **argv) "concat('ALTER TABLE time_zone_transition_type ENGINE=', " "@time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0');\n"); + if (argc == 1 && !opt_leap) + printf("SET session alter_algorithm=@old_alter_alg;\n"); + free_allocated_data(); my_end(0); return 0; diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index 8767f698bf2..eee9dc02319 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -177,8 +177,7 @@ int wsrep_apply_events(THD* thd, break; } - - if (!thd->variables.gtid_seq_no && wsrep_thd_is_toi(thd) && + if (!thd->variables.gtid_seq_no && wsrep_thd_is_toi(thd) && (ev->get_type_code() == QUERY_EVENT)) { uint64 seqno= wsrep_gtid_server.seqno_inc(); @@ -188,18 +187,10 @@ int wsrep_apply_events(THD* thd, thd->variables.gtid_seq_no= seqno; } } + /* Use the original server id for logging. */ thd->set_server_id(ev->server_id); - thd->set_time(); // time the query - thd->transaction->start_time.reset(thd); thd->lex->current_select= 0; - if (!ev->when) - { - my_hrtime_t hrtime= my_hrtime(); - ev->when= hrtime_to_my_time(hrtime); - ev->when_sec_part= hrtime_sec_part(hrtime); - } - thd->variables.option_bits= (thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) | (ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0); diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index ecb0e487f2b..7eb3f07849a 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -214,6 +214,7 @@ int Wsrep_high_priority_service::start_transaction( const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta) { DBUG_ENTER(" Wsrep_high_priority_service::start_transaction"); + m_thd->set_time(); DBUG_RETURN(m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta) || trans_begin(m_thd)); } @@ -425,6 +426,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); wsrep_thd_set_ignored_error(thd, false); trans_commit(thd); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 5d49c47b932..9cdf7bb4bb1 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1133,10 +1133,8 @@ void wsrep_recover() } } - -void wsrep_stop_replication(THD *thd) +static void wsrep_stop_replication_common(THD *thd) { - WSREP_INFO("Stop replication by %llu", (thd) ? thd->thread_id : 0); if (Wsrep_server_state::instance().state() != Wsrep_server_state::s_disconnected) { @@ -1149,10 +1147,10 @@ void wsrep_stop_replication(THD *thd) } } - /* my connection, should not terminate with wsrep_close_client_connection(), - make transaction to rollback - */ - if (thd && !thd->wsrep_applier) trans_rollback(thd); + /* my connection, should not terminate with + wsrep_close_client_connections(), make transaction to rollback */ + if (thd && !thd->wsrep_applier) + trans_rollback(thd); wsrep_close_client_connections(TRUE, thd); /* wait until appliers have stopped */ @@ -1161,26 +1159,16 @@ void wsrep_stop_replication(THD *thd) node_uuid= WSREP_UUID_UNDEFINED; } +void wsrep_stop_replication(THD *thd) +{ + WSREP_INFO("Stop replication by %llu", (thd) ? thd->thread_id : 0); + wsrep_stop_replication_common(thd); +} + void wsrep_shutdown_replication() { WSREP_INFO("Shutdown replication"); - if (Wsrep_server_state::instance().state() != wsrep::server_state::s_disconnected) - { - WSREP_DEBUG("Disconnect provider"); - Wsrep_server_state::instance().disconnect(); - if (Wsrep_server_state::instance().wait_until_state( - Wsrep_server_state::s_disconnected)) - { - WSREP_WARN("Wsrep interrupted while waiting for disconnected state"); - } - } - - wsrep_close_client_connections(TRUE); - - /* wait until appliers have stopped */ - wsrep_wait_appliers_close(NULL); - node_uuid= WSREP_UUID_UNDEFINED; - + wsrep_stop_replication_common(nullptr); /* Undocking the thread specific data. */ set_current_thd(nullptr); } @@ -3355,14 +3343,20 @@ static my_bool have_client_connections(THD *thd, void*) { DBUG_PRINT("quit",("Informing thread %lld that it's time to die", (longlong) thd->thread_id)); - if (is_client_connection(thd) && - (thd->killed == KILL_CONNECTION || - thd->killed == KILL_CONNECTION_HARD)) + if (is_client_connection(thd)) { - (void)abort_replicated(thd); - return 1; + if (thd->killed == KILL_CONNECTION || + thd->killed == KILL_CONNECTION_HARD) + { + (void)abort_replicated(thd); + return true; + } + if (thd->get_stmt_da()->is_eof()) + { + return true; + } } - return 0; + return false; } static void wsrep_close_thread(THD *thd) @@ -3400,14 +3394,24 @@ static my_bool kill_all_threads(THD *thd, THD *caller_thd) /* We skip slave threads & scheduler on this first loop through. */ if (is_client_connection(thd) && thd != caller_thd) { + if (thd->get_stmt_da()->is_eof()) + { + return 0; + } + if (is_replaying_connection(thd)) + { thd->set_killed(KILL_CONNECTION_HARD); - else if (!abort_replicated(thd)) + return 0; + } + + if (!abort_replicated(thd)) { /* replicated transactions must be skipped */ WSREP_DEBUG("closing connection %lld", (longlong) thd->thread_id); /* instead of wsrep_close_thread() we do now soft kill by THD::awake */ thd->awake(KILL_CONNECTION_HARD); + return 0; } } return 0; @@ -3419,6 +3423,7 @@ static my_bool kill_remaining_threads(THD *thd, THD *caller_thd) if (is_client_connection(thd) && !abort_replicated(thd) && !is_replaying_connection(thd) && + !thd->get_stmt_da()->is_eof() && thd_is_connection_alive(thd) && thd != caller_thd) { @@ -3913,7 +3918,7 @@ void wsrep_ready_set(bool ready_value) mysql_mutex_lock(&LOCK_wsrep_ready); wsrep_ready= ready_value; // Signal if we have reached ready state - if (wsrep_ready) + if (ready_value) mysql_cond_signal(&COND_wsrep_ready); mysql_mutex_unlock(&LOCK_wsrep_ready); } diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc index 6cf4fc4c1a2..fd086ce4a89 100644 --- a/sql/wsrep_notify.cc +++ b/sql/wsrep_notify.cc @@ -28,7 +28,7 @@ void wsrep_notify_status(enum wsrep::server_state::state status, if (!view) { WSREP_DEBUG("wsrep_notify_status server not yet ready : wsrep_ready=%d status %d", - wsrep_ready, (int)status); + (int) wsrep_ready_get(), (int)status); return; } diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index c6e45340dd1..d9baf69999a 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -272,25 +272,17 @@ static void finish_stmt(THD* thd) { close_thread_tables(thd); } -static int open_table(THD* thd, - const LEX_CSTRING *schema_name, - const LEX_CSTRING *table_name, - enum thr_lock_type const lock_type, - TABLE** table) { - assert(table); - *table= NULL; - +static int open_table(THD *thd, const LEX_CSTRING *schema_name, + const LEX_CSTRING *table_name, + enum thr_lock_type const lock_type, + TABLE_LIST *table_list) +{ + assert(table_list); DBUG_ENTER("Wsrep_schema::open_table()"); - - TABLE_LIST tables; - uint flags= (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK | - MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY | - MYSQL_OPEN_IGNORE_FLUSH | - MYSQL_LOCK_IGNORE_TIMEOUT); - - tables.init_one_table(schema_name, - table_name, - NULL, lock_type); + const uint flags= (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK | + MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY | + MYSQL_OPEN_IGNORE_FLUSH | MYSQL_LOCK_IGNORE_TIMEOUT); + table_list->init_one_table(schema_name, table_name, NULL, lock_type); thd->lex->query_tables_own_last= 0; // No need to open table if the query was bf aborted, @@ -300,37 +292,39 @@ static int open_table(THD* thd, (thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED)); if (interrupted || - !open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) { + !open_n_lock_single_table(thd, table_list, table_list->lock_type, flags)) + { close_thread_tables(thd); DBUG_RETURN(1); } - *table= tables.table; - (*table)->use_all_columns(); + table_list->table->use_all_columns(); DBUG_RETURN(0); } - -static int open_for_write(THD* thd, const char* table_name, TABLE** table) { +static int open_for_write(THD* thd, const char* table_name, TABLE_LIST* table_list) +{ LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() }; LEX_CSTRING table_str= { table_name, strlen(table_name) }; if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE, - table)) { + table_list)) + { // No need to log an error if the query was bf aborted, // thd client will get ER_LOCK_DEADLOCK in the end. const bool interrupted= thd->killed || (thd->is_error() && (thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED)); - if (!interrupted) { + if (!interrupted) + { WSREP_ERROR("Failed to open table %s.%s for writing", schema_str.str, table_name); } return 1; } - empty_record(*table); - (*table)->use_all_columns(); - restore_record(*table, s->default_values); + empty_record(table_list->table); + table_list->table->use_all_columns(); + restore_record(table_list->table, s->default_values); return 0; } @@ -479,19 +473,21 @@ static int delete_row(TABLE* table) { return 0; } -static int open_for_read(THD* thd, const char* table_name, TABLE** table) { - +static int open_for_read(THD *thd, const char *table_name, + TABLE_LIST *table_list) +{ LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() }; LEX_CSTRING table_str= { table_name, strlen(table_name) }; if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_READ, - table)) { + table_list)) + { WSREP_ERROR("Failed to open table %s.%s for reading", schema_str.str, table_name); return 1; } - empty_record(*table); - (*table)->use_all_columns(); - restore_record(*table, s->default_values); + empty_record(table_list->table); + table_list->table->use_all_columns(); + restore_record(table_list->table, s->default_values); return 0; } @@ -752,8 +748,10 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view) assert(view.status() == Wsrep_view::primary); int ret= 1; int error; + TABLE_LIST cluster_table_l; TABLE* cluster_table= 0; - TABLE* members_table= 0; + TABLE_LIST members_table_l; + TABLE* members_table = 0; #ifdef WSREP_SCHEMA_MEMBERS_HISTORY TABLE* members_history_table= 0; #endif /* WSREP_SCHEMA_MEMBERS_HISTORY */ @@ -778,11 +776,13 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view) Store cluster view info */ Wsrep_schema_impl::init_stmt(thd); - if (Wsrep_schema_impl::open_for_write(thd, cluster_table_str.c_str(), &cluster_table)) + if (Wsrep_schema_impl::open_for_write(thd, cluster_table_str.c_str(), &cluster_table_l)) { goto out; } + cluster_table= cluster_table_l.table; + Wsrep_schema_impl::store(cluster_table, 0, view.state_id().id()); Wsrep_schema_impl::store(cluster_table, 1, view.view_seqno().get()); Wsrep_schema_impl::store(cluster_table, 2, view.state_id().seqno().get()); @@ -802,12 +802,14 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view) */ Wsrep_schema_impl::init_stmt(thd); if (Wsrep_schema_impl::open_for_write(thd, members_table_str.c_str(), - &members_table)) + &members_table_l)) { WSREP_ERROR("failed to open wsrep.members table"); goto out; } + members_table= members_table_l.table; + for (size_t i= 0; i < view.members().size(); ++i) { Wsrep_schema_impl::store(members_table, 0, view.members()[i].id()); @@ -861,8 +863,10 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const { int ret= 1; int error; + TABLE_LIST cluster_table_l; TABLE* cluster_table= 0; bool end_cluster_scan= false; + TABLE_LIST members_table_l; TABLE* members_table= 0; bool end_members_scan= false; @@ -888,8 +892,12 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const { Read cluster info from cluster table */ Wsrep_schema_impl::init_stmt(thd); - if (Wsrep_schema_impl::open_for_read(thd, cluster_table_str.c_str(), &cluster_table) || - Wsrep_schema_impl::init_for_scan(cluster_table)) { + if (Wsrep_schema_impl::open_for_read(thd, cluster_table_str.c_str(), &cluster_table_l)) { + goto out; + } + cluster_table = cluster_table_l.table; + + if (Wsrep_schema_impl::init_for_scan(cluster_table)) { goto out; } @@ -913,8 +921,14 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const { Read members from members table */ Wsrep_schema_impl::init_stmt(thd); - if (Wsrep_schema_impl::open_for_read(thd, members_table_str.c_str(), &members_table) || - Wsrep_schema_impl::init_for_scan(members_table)) { + if (Wsrep_schema_impl::open_for_read(thd, members_table_str.c_str(), + &members_table_l)) + { + goto out; + } + + members_table= members_table_l.table; + if (Wsrep_schema_impl::init_for_scan(members_table)) { goto out; } end_members_scan= true; @@ -1018,14 +1032,15 @@ int Wsrep_schema::append_fragment(THD* thd, Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd); Wsrep_schema_impl::init_stmt(thd); - TABLE* frag_table= 0; - if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)) + TABLE_LIST frag_table_l; + if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table_l)) { trans_rollback_stmt(thd); thd->lex->restore_backup_query_tables_list(&query_tables_list_backup); DBUG_RETURN(1); } + TABLE* frag_table= frag_table_l.table; Wsrep_schema_impl::store(frag_table, 0, server_id); Wsrep_schema_impl::store(frag_table, 1, transaction_id.get()); Wsrep_schema_impl::store(frag_table, 2, seqno.get()); @@ -1069,13 +1084,15 @@ int Wsrep_schema::update_fragment_meta(THD* thd, uchar *key=NULL; key_part_map key_map= 0; TABLE* frag_table= 0; + TABLE_LIST frag_table_l; Wsrep_schema_impl::init_stmt(thd); - if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)) + if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table_l)) { thd->lex->restore_backup_query_tables_list(&query_tables_list_backup); DBUG_RETURN(1); } + frag_table= frag_table_l.table; /* Find record with the given uuid, trx id, and seqno -1 */ Wsrep_schema_impl::store(frag_table, 0, ws_meta.server_id()); @@ -1163,7 +1180,10 @@ static int remove_fragment(THD* thd, seqno.get(), error); } - ret= error; + else + { + ret= error; + } } else if (Wsrep_schema_impl::delete_row(frag_table)) { @@ -1195,12 +1215,14 @@ int Wsrep_schema::remove_fragments(THD* thd, thd->reset_n_backup_open_tables_state(&open_tables_backup); TABLE* frag_table= 0; - if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table)) + TABLE_LIST frag_table_l; + if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table_l)) { ret= 1; } else { + frag_table= frag_table_l.table; for (std::vector::const_iterator i= fragments.begin(); i != fragments.end(); ++i) { @@ -1243,40 +1265,35 @@ int Wsrep_schema::remove_fragments(THD* thd, DBUG_RETURN(ret); } -int Wsrep_schema::replay_transaction(THD* orig_thd, - Relay_log_info* rli, - const wsrep::ws_meta& ws_meta, - const std::vector& fragments) +static int replay_transaction(THD* thd, + THD* orig_thd, + Relay_log_info* rli, + const wsrep::ws_meta& ws_meta, + const std::vector& fragments) { - DBUG_ENTER("Wsrep_schema::replay_transaction"); - DBUG_ASSERT(!fragments.empty()); - - THD thd(next_thread_id(), true); - thd.thread_stack= (orig_thd ? orig_thd->thread_stack : - (char*) &thd); - wsrep_assign_from_threadvars(&thd); - - Wsrep_schema_impl::wsrep_off wsrep_off(&thd); - Wsrep_schema_impl::binlog_off binlog_off(&thd); - Wsrep_schema_impl::sql_safe_updates sql_safe_updates(&thd); - Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, &thd); + Wsrep_schema_impl::wsrep_off wsrep_off(thd); + Wsrep_schema_impl::binlog_off binlog_off(thd); + Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd); + Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, thd); int ret= 1; int error; TABLE* frag_table= 0; + TABLE_LIST frag_table_l; uchar *key=NULL; key_part_map key_map= 0; for (std::vector::const_iterator i= fragments.begin(); i != fragments.end(); ++i) { - Wsrep_schema_impl::init_stmt(&thd); - if ((error= Wsrep_schema_impl::open_for_read(&thd, sr_table_str.c_str(), &frag_table))) + Wsrep_schema_impl::init_stmt(thd); + if ((error= Wsrep_schema_impl::open_for_read(thd, sr_table_str.c_str(), &frag_table_l))) { WSREP_WARN("Could not open SR table for read: %d", error); - Wsrep_schema_impl::finish_stmt(&thd); - DBUG_RETURN(1); + Wsrep_schema_impl::finish_stmt(thd); + return 1; } + frag_table= frag_table_l.table; Wsrep_schema_impl::store(frag_table, 0, ws_meta.server_id()); Wsrep_schema_impl::store(frag_table, 1, ws_meta.transaction_id().get()); @@ -1305,7 +1322,7 @@ int Wsrep_schema::replay_transaction(THD* orig_thd, frag_table->field[4]->val_str(&buf); { - Wsrep_schema_impl::thd_context_switch thd_context_switch(&thd, orig_thd); + Wsrep_schema_impl::thd_context_switch thd_context_switch(thd, orig_thd); ret= wsrep_apply_events(orig_thd, rli, buf.ptr(), buf.length()); if (ret) @@ -1316,18 +1333,20 @@ int Wsrep_schema::replay_transaction(THD* orig_thd, } Wsrep_schema_impl::end_index_scan(frag_table); - Wsrep_schema_impl::finish_stmt(&thd); + Wsrep_schema_impl::finish_stmt(thd); - Wsrep_schema_impl::init_stmt(&thd); + Wsrep_schema_impl::init_stmt(thd); - if ((error= Wsrep_schema_impl::open_for_write(&thd, + if ((error= Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), - &frag_table))) + &frag_table_l))) { WSREP_WARN("Could not open SR table for write: %d", error); - Wsrep_schema_impl::finish_stmt(&thd); - DBUG_RETURN(1); + Wsrep_schema_impl::finish_stmt(thd); + ret= 1; + break; } + frag_table= frag_table_l.table; error= Wsrep_schema_impl::init_for_index_scan(frag_table, key, @@ -1351,86 +1370,120 @@ int Wsrep_schema::replay_transaction(THD* orig_thd, break; } Wsrep_schema_impl::end_index_scan(frag_table); - Wsrep_schema_impl::finish_stmt(&thd); + Wsrep_schema_impl::finish_stmt(thd); my_free(key); key= NULL; } if (key) my_free(key); + + return ret; +} + +int Wsrep_schema::replay_transaction(THD* orig_thd, + Relay_log_info* rli, + const wsrep::ws_meta& ws_meta, + const std::vector& fragments) +{ + DBUG_ENTER("Wsrep_schema::replay_transaction"); + DBUG_ASSERT(!fragments.empty()); + + THD *thd= new THD(next_thread_id(), true); + if (!thd) + { + WSREP_WARN("Could not allocate memory for THD"); + DBUG_RETURN(1); + } + + thd->thread_stack= (orig_thd ? orig_thd->thread_stack : (char *) &thd); + wsrep_assign_from_threadvars(thd); + + int ret= ::replay_transaction(thd, orig_thd, rli, ws_meta, fragments); + + delete thd; DBUG_RETURN(ret); } -int Wsrep_schema::recover_sr_transactions(THD *orig_thd) +static int recover_sr_transactions(THD* storage_thd, THD* orig_thd) { - DBUG_ENTER("Wsrep_schema::recover_sr_transactions"); - THD storage_thd(next_thread_id(), true); - storage_thd.thread_stack= (orig_thd ? orig_thd->thread_stack : - (char*) &storage_thd); - wsrep_assign_from_threadvars(&storage_thd); TABLE* frag_table= 0; + TABLE_LIST frag_table_l; TABLE* cluster_table= 0; - Wsrep_storage_service storage_service(&storage_thd); - Wsrep_schema_impl::binlog_off binlog_off(&storage_thd); - Wsrep_schema_impl::wsrep_off wsrep_off(&storage_thd); - Wsrep_schema_impl::sql_safe_updates sql_safe_updates(&storage_thd); + TABLE_LIST cluster_table_l; + Wsrep_storage_service storage_service(storage_thd); + Wsrep_schema_impl::binlog_off binlog_off(storage_thd); + Wsrep_schema_impl::wsrep_off wsrep_off(storage_thd); + Wsrep_schema_impl::sql_safe_updates sql_safe_updates(storage_thd); Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, - &storage_thd); + storage_thd); Wsrep_server_state& server_state(Wsrep_server_state::instance()); int ret= 1; int error; wsrep::id cluster_id; - Wsrep_schema_impl::init_stmt(&storage_thd); - storage_thd.wsrep_skip_locking= FALSE; - if (Wsrep_schema_impl::open_for_read(&storage_thd, - cluster_table_str.c_str(), - &cluster_table) || - Wsrep_schema_impl::init_for_scan(cluster_table)) + Wsrep_schema_impl::init_stmt(storage_thd); + storage_thd->wsrep_skip_locking= FALSE; + if (Wsrep_schema_impl::open_for_read(storage_thd, cluster_table_str.c_str(), + &cluster_table_l)) { - Wsrep_schema_impl::finish_stmt(&storage_thd); - DBUG_RETURN(1); + Wsrep_schema_impl::finish_stmt(storage_thd); + return 1; + } + cluster_table= cluster_table_l.table; + + if (Wsrep_schema_impl::init_for_scan(cluster_table)) + { + Wsrep_schema_impl::finish_stmt(storage_thd); + return 1; } if ((error= Wsrep_schema_impl::next_record(cluster_table))) { Wsrep_schema_impl::end_scan(cluster_table); - Wsrep_schema_impl::finish_stmt(&storage_thd); - trans_commit(&storage_thd); + Wsrep_schema_impl::finish_stmt(storage_thd); + trans_commit(storage_thd); if (error == HA_ERR_END_OF_FILE) { WSREP_INFO("Cluster table is empty, not recovering transactions"); - DBUG_RETURN(0); + return 0; } else { WSREP_ERROR("Failed to read cluster table: %d", error); - DBUG_RETURN(1); + return 1; } } Wsrep_schema_impl::scan(cluster_table, 0, cluster_id); Wsrep_schema_impl::end_scan(cluster_table); - Wsrep_schema_impl::finish_stmt(&storage_thd); + Wsrep_schema_impl::finish_stmt(storage_thd); std::ostringstream os; os << cluster_id; WSREP_INFO("Recovered cluster id %s", os.str().c_str()); - storage_thd.wsrep_skip_locking= TRUE; - Wsrep_schema_impl::init_stmt(&storage_thd); + storage_thd->wsrep_skip_locking= TRUE; + Wsrep_schema_impl::init_stmt(storage_thd); /* Open the table for reading and writing so that fragments without valid seqno can be deleted. */ - if (Wsrep_schema_impl::open_for_write(&storage_thd, sr_table_str.c_str(), &frag_table) || - Wsrep_schema_impl::init_for_scan(frag_table)) + if (Wsrep_schema_impl::open_for_write(storage_thd, sr_table_str.c_str(), + &frag_table_l)) { WSREP_ERROR("Failed to open SR table for write"); goto out; } + frag_table= frag_table_l.table; + + if (Wsrep_schema_impl::init_for_scan(frag_table)) + { + WSREP_ERROR("Failed to init for index scan"); + goto out; + } while (0 == error) { @@ -1474,7 +1527,7 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd) transaction_id))) { DBUG_ASSERT(wsrep::starts_transaction(flags)); - applier = wsrep_create_streaming_applier(&storage_thd, "recovery"); + applier = wsrep_create_streaming_applier(storage_thd, "recovery"); server_state.start_streaming_applier(server_id, transaction_id, applier); applier->start_transaction(wsrep::ws_handle(transaction_id, 0), @@ -1502,10 +1555,30 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd) } } Wsrep_schema_impl::end_scan(frag_table); - Wsrep_schema_impl::finish_stmt(&storage_thd); - trans_commit(&storage_thd); - storage_thd.set_mysys_var(0); + Wsrep_schema_impl::finish_stmt(storage_thd); + trans_commit(storage_thd); + storage_thd->set_mysys_var(0); out: + return ret; +} + +int Wsrep_schema::recover_sr_transactions(THD *orig_thd) +{ + DBUG_ENTER("Wsrep_schema::recover_sr_transactions"); + + THD *storage_thd= new THD(next_thread_id(), true); + if (!storage_thd) + { + WSREP_WARN("Could not allocate memory for THD"); + DBUG_RETURN(1); + } + storage_thd->thread_stack= + (orig_thd ? orig_thd->thread_stack : (char *) &storage_thd); + wsrep_assign_from_threadvars(storage_thd); + + int ret= ::recover_sr_transactions(storage_thd, orig_thd); + + delete storage_thd; DBUG_RETURN(ret); } @@ -1521,13 +1594,15 @@ void Wsrep_schema::clear_allowlist() thd->thread_stack= (char*)&thd; wsrep_init_thd_for_schema(thd); TABLE* allowlist_table= 0; + TABLE_LIST allowlist_table_l; int error= 0; Wsrep_schema_impl::init_stmt(thd); if (Wsrep_schema_impl::open_for_write(thd, allowlist_table_str.c_str(), - &allowlist_table) || - Wsrep_schema_impl::init_for_scan(allowlist_table)) + &allowlist_table_l) || + (allowlist_table= allowlist_table_l.table, + Wsrep_schema_impl::init_for_scan(allowlist_table))) { WSREP_ERROR("Failed to open mysql.wsrep_allowlist table"); goto out; @@ -1567,14 +1642,16 @@ void Wsrep_schema::store_allowlist(std::vector& ip_allowlist) thd->thread_stack= (char*)&thd; wsrep_init_thd_for_schema(thd); TABLE* allowlist_table= 0; + TABLE_LIST allowlist_table_l; int error; Wsrep_schema_impl::init_stmt(thd); if (Wsrep_schema_impl::open_for_write(thd, allowlist_table_str.c_str(), - &allowlist_table)) + &allowlist_table_l)) { WSREP_ERROR("Failed to open mysql.wsrep_allowlist table"); goto out; } + allowlist_table= allowlist_table_l.table; for (size_t i= 0; i < ip_allowlist.size(); ++i) { Wsrep_schema_impl::store(allowlist_table, 0, ip_allowlist[i]); @@ -1618,6 +1695,7 @@ static void *allowlist_check_thread(void *param) int error; TABLE *allowlist_table= 0; + TABLE_LIST allowlist_table_l; bool match_found_or_empty= false; bool table_have_rows= false; char row[64]= { @@ -1629,8 +1707,9 @@ static void *allowlist_check_thread(void *param) */ Wsrep_schema_impl::init_stmt(&thd); if (Wsrep_schema_impl::open_for_read(&thd, allowlist_table_str.c_str(), - &allowlist_table) || - Wsrep_schema_impl::init_for_scan(allowlist_table)) + &allowlist_table_l) || + (allowlist_table= allowlist_table_l.table, + Wsrep_schema_impl::init_for_scan(allowlist_table))) { goto out; } diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index c3df6e9f73c..19fa4470687 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -345,7 +345,6 @@ void Wsrep_server_service::log_state_change( switch (current_state) { case Wsrep_server_state::s_synced: - wsrep_ready= TRUE; WSREP_INFO("Synchronized with group, ready for connections"); wsrep_ready_set(true); /* fall through */ diff --git a/storage/archive/CMakeLists.txt b/storage/archive/CMakeLists.txt index 5b6818fc921..5c7b6aa4aab 100644 --- a/storage/archive/CMakeLists.txt +++ b/storage/archive/CMakeLists.txt @@ -14,5 +14,5 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h) -MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY}) +MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARIES}) diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 2a8deb431b1..03269625040 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -269,6 +269,9 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg) archive_reader_open= FALSE; } +/* Stack size 50264 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share) { DBUG_ENTER("archive_discover"); @@ -310,6 +313,7 @@ ret: my_free(frm_ptr); DBUG_RETURN(my_errno); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** @brief Read version 1 meta file (5.0 compatibility routine). @@ -480,6 +484,10 @@ int ha_archive::read_data_header(azio_stream *file_to_read) See ha_example.cc for a longer description. */ + +/* Stack size 49608 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + Archive_share *ha_archive::get_share(const char *table_name, int *rc) { Archive_share *tmp_share; @@ -542,6 +550,7 @@ err: DBUG_RETURN(tmp_share); } +PRAGMA_REENABLE_CHECK_STACK_FRAME int Archive_share::init_archive_writer() @@ -763,6 +772,9 @@ int ha_archive::frm_compare(azio_stream *s) of creation. */ +/* Stack size 49608 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int ha_archive::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { @@ -880,6 +892,7 @@ error: /* Return error number, if we got one */ DBUG_RETURN(error ? error : -1); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* This is where the actual row is written out. @@ -1544,6 +1557,10 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) The table can become fragmented if data was inserted, read, and then inserted again. What we do is open up the file and recompress it completely. */ + +/* Stack size 50152 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) { int rc= 0; @@ -1669,6 +1686,7 @@ error: DBUG_RETURN(rc); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* Below is an example of how to setup row level locking. @@ -2010,4 +2028,3 @@ maria_declare_plugin(archive) MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; - diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index bf4a805762e..263fb80357d 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -1,6 +1,7 @@ #set(PLUGIN_COLUMNSTORE "NO" CACHE STRING "Enable ColumnStore engine") -if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}") +if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}" OR + (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/columnstore/CMakeLists.txt)) return() endif() diff --git a/storage/columnstore/columnstore b/storage/columnstore/columnstore index 15fc0328c60..a81afdaf5bb 160000 --- a/storage/columnstore/columnstore +++ b/storage/columnstore/columnstore @@ -1 +1 @@ -Subproject commit 15fc0328c603e4d61f89df6851357804c20af21e +Subproject commit a81afdaf5bb995ab50a029c201772c859d711447 diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 51d1cf2fe39..31f7d2eb9e5 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -406,7 +406,7 @@ MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES} STORAGE_ENGINE COMPONENT connect-engine RECOMPILE_FOR_EMBEDDED - LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY} + LINK_LIBRARIES ${ZLIB_LIBRARIES} ${XML_LIBRARY} ${ICONV_LIBRARY} ${ODBC_LIBRARY} ${JDBC_LIBRARY} ${MONGOC_LIBRARY} ${IPHLPAPI_LIBRARY} ${REST_LIBRARY}) IF(NOT TARGET connect) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 0d4fb857598..0d6449da7f4 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -6454,6 +6454,9 @@ char *ha_connect::GetDBfromName(const char *name) ha_create_table() in handle.cc */ +/* Stack size 25608 in clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int ha_connect::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { @@ -6998,6 +7001,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, table= st; DBUG_RETURN(rc); } // end of create +PRAGMA_REENABLE_CHECK_STACK_FRAME /** Used to check whether a file based outward table can be populated by @@ -7005,6 +7009,10 @@ int ha_connect::create(const char *name, TABLE *table_arg, - file does not exist or is void - user has file privilege */ + +/* Stack size 16664 in clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + bool ha_connect::FileExists(const char *fn, bool bf) { if (!fn || !*fn) @@ -7055,6 +7063,7 @@ bool ha_connect::FileExists(const char *fn, bool bf) return true; } // end of FileExists +PRAGMA_REENABLE_CHECK_STACK_FRAME // Called by SameString and NoFieldOptionChange bool ha_connect::CheckString(PCSZ str1, PCSZ str2) diff --git a/storage/connect/ioapi.h b/storage/connect/ioapi.h index 44430e56dd4..94b292ed78f 100644 --- a/storage/connect/ioapi.h +++ b/storage/connect/ioapi.h @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stre typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 1dcbca88a7b..d1c68dcc96a 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -229,6 +229,7 @@ a 20 30 # Start of mysqldump ------ +/*!999999\- enable the sandbox mode */ /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index d0b7b3163b6..7e2857f17a0 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -125,8 +125,11 @@ PTDB TDBMUL::Duplicate(PGLOBAL g) /* have a LRECL that is the sum of the lengths of all components. */ /* This is why we use a big filename array to take care of that. */ /***********************************************************************/ + +PRAGMA_DISABLE_CHECK_STACK_FRAME + bool TDBMUL::InitFileNames(PGLOBAL g) - { +{ #define PFNZ 4096 #define FNSZ (_MAX_DRIVE+_MAX_DIR+_MAX_FNAME+_MAX_EXT) PTDBDIR dirp; @@ -234,6 +237,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) NumFiles = n; return false; } // end of InitFileNames +PRAGMA_REENABLE_CHECK_STACK_FRAME /***********************************************************************/ /* The table column list is the sub-table column list. */ diff --git a/storage/connect/unzip.c b/storage/connect/unzip.c index 909350435a5..de69f4b62eb 100644 --- a/storage/connect/unzip.c +++ b/storage/connect/unzip.c @@ -122,7 +122,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -542,7 +542,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return 0; if (uL != 0) @@ -590,10 +590,10 @@ local unzFile unzOpenInternal (const void *path, ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ + uLong number_disk; /* number of the current disk, used for + spanning ZIP, unsupported, always 0*/ + uLong number_disk_with_CD; /* number the disk with central dir, used + for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir (same than number_entry on nospan) */ diff --git a/storage/connect/unzip.h b/storage/connect/unzip.h index 2104e391507..ef0451098b1 100644 --- a/storage/connect/unzip.h +++ b/storage/connect/unzip.h @@ -306,7 +306,7 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain somes info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). diff --git a/storage/connect/zip.c b/storage/connect/zip.c index 40c1d6794c0..523ea22299d 100644 --- a/storage/connect/zip.c +++ b/storage/connect/zip.c @@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -814,71 +814,66 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { /************************************************************/ extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) { - zip64_internal ziinit; zip64_internal* zi; int err=ZIP_OK; - ziinit.z_filefunc.zseek32_file = NULL; - ziinit.z_filefunc.ztell32_file = NULL; - if (pzlib_filefunc64_32_def==NULL) - fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); - else - ziinit.z_filefunc = *pzlib_filefunc64_32_def; + if (!(zi = (zip64_internal*)ALLOC(sizeof(zip64_internal)))) + return NULL; - ziinit.filestream = ZOPEN64(ziinit.z_filefunc, + zi->z_filefunc.zseek32_file = NULL; + zi->z_filefunc.ztell32_file = NULL; + if (pzlib_filefunc64_32_def==NULL) + fill_fopen64_filefunc(&zi->z_filefunc.zfile_func64); + else + zi->z_filefunc = *pzlib_filefunc64_32_def; + + zi->filestream = ZOPEN64(zi->z_filefunc, pathname, (append == APPEND_STATUS_CREATE) ? (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) : (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING)); - if (ziinit.filestream == NULL) - return NULL; - - if (append == APPEND_STATUS_CREATEAFTER) - ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END); - - ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream); - ziinit.in_opened_file_inzip = 0; - ziinit.ci.stream_initialised = 0; - ziinit.number_entry = 0; - ziinit.add_position_when_writing_offset = 0; - init_linkedlist(&(ziinit.central_dir)); - - - - zi = (zip64_internal*)ALLOC(sizeof(zip64_internal)); - if (zi==NULL) + if (zi->filestream == NULL) { - ZCLOSE64(ziinit.z_filefunc,ziinit.filestream); + free(zi); return NULL; } + if (append == APPEND_STATUS_CREATEAFTER) + ZSEEK64(zi->z_filefunc,zi->filestream,0,SEEK_END); + + zi->begin_pos = ZTELL64(zi->z_filefunc,zi->filestream); + zi->in_opened_file_inzip = 0; + zi->ci.stream_initialised = 0; + zi->number_entry = 0; + zi->add_position_when_writing_offset = 0; + init_linkedlist(&(zi->central_dir)); + /* now we add file in a zipfile */ # ifndef NO_ADDFILEINEXISTINGZIP - ziinit.globalcomment = NULL; + zi->globalcomment = NULL; if (append == APPEND_STATUS_ADDINZIP) { // Read and Cache Central Directory Records - err = LoadCentralDirectoryRecord(&ziinit); + err = LoadCentralDirectoryRecord(zi); } if (globalcomment) { - *globalcomment = ziinit.globalcomment; + *globalcomment = zi->globalcomment; } # endif /* !NO_ADDFILEINEXISTINGZIP*/ if (err != ZIP_OK) { # ifndef NO_ADDFILEINEXISTINGZIP - free(ziinit.globalcomment); + free(zi->globalcomment); # endif /* !NO_ADDFILEINEXISTINGZIP*/ free(zi); return NULL; } else { - *zi = ziinit; return (zipFile)zi; } } @@ -1042,6 +1037,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1596,7 +1602,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1860,7 +1866,7 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); diff --git a/storage/connect/zip.h b/storage/connect/zip.h index 5fc08413241..3e230d3405f 100644 --- a/storage/connect/zip.h +++ b/storage/connect/zip.h @@ -177,9 +177,9 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index cc7dc79e508..187d65b050e 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -499,31 +499,22 @@ int ha_heap::external_lock(THD *thd, int lock_type) SYNOPSIS disable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ disable all non-unique keys - HA_KEY_SWITCH_ALL disable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent DESCRIPTION - Disable indexes and clear keys to use for scanning. - - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_NONUNIQ_SAVE is not implemented with HEAP. - HA_KEY_SWITCH_ALL_SAVE is not implemented with HEAP. + See handler::ha_disable_indexes() RETURN 0 ok HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_heap::disable_indexes(uint mode) +int ha_heap::disable_indexes(key_map map, bool persist) { int error; - if (mode == HA_KEY_SWITCH_ALL) + if (!persist) { + DBUG_ASSERT(map.is_clear_all()); if (!(error= heap_disable_indexes(file))) set_keys_for_scanning(); } @@ -541,11 +532,6 @@ int ha_heap::disable_indexes(uint mode) SYNOPSIS enable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ enable all non-unique keys - HA_KEY_SWITCH_ALL enable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent DESCRIPTION Enable indexes and set keys to use for scanning. @@ -554,10 +540,7 @@ int ha_heap::disable_indexes(uint mode) since the heap storage engine cannot repair the indexes. To be sure, call handler::delete_all_rows() before. - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_NONUNIQ_SAVE is not implemented with HEAP. - HA_KEY_SWITCH_ALL_SAVE is not implemented with HEAP. + See also handler::ha_enable_indexes() RETURN 0 ok @@ -565,12 +548,13 @@ int ha_heap::disable_indexes(uint mode) HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_heap::enable_indexes(uint mode) +int ha_heap::enable_indexes(key_map map, bool persist) { int error; - if (mode == HA_KEY_SWITCH_ALL) + if (!persist) { + DBUG_ASSERT(map.is_prefix(table->s->keys)); if (!(error= heap_enable_indexes(file))) set_keys_for_scanning(); } diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index eed91176136..837eae15fee 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -99,8 +99,8 @@ public: int external_lock(THD *thd, int lock_type) override; int delete_all_rows(void) override; int reset_auto_increment(ulonglong value) override; - int disable_indexes(uint mode) override; - int enable_indexes(uint mode) override; + int disable_indexes(key_map map, bool persist) override; + int enable_indexes(key_map map, bool persist) override; int indexes_are_disabled(void) override; ha_rows records_in_range(uint inx, const key_range *start_key, const key_range *end_key, page_range *pages) override; diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index bccace8eceb..84fb684574e 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -48,6 +48,13 @@ IF(UNIX) IF(HAVE_LIBNUMA) LINK_LIBRARIES(numa) ENDIF() + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch|AARCH|p(ower)?pc|x86_|amd)64") + OPTION(WITH_INNODB_PMEM "Support memory-mapped InnoDB redo log" ON) + ELSE() # Disable by default on ISA that are not covered by our CI + OPTION(WITH_INNODB_PMEM "Support memory-mapped InnoDB redo log" OFF) + ENDIF() + ENDIF() ENDIF() ENDIF() @@ -132,7 +139,6 @@ SET(INNOBASE_SOURCES btr/btr0cur.cc btr/btr0pcur.cc btr/btr0sea.cc - buf/buf0block_hint.cc buf/buf0buddy.cc buf/buf0buf.cc buf/buf0dblwr.cc @@ -423,26 +429,16 @@ SET(INNOBASE_SOURCES ut/ut0vec.cc ut/ut0wqueue.cc) -OPTION(WITH_PMEM "Support redo log in persistent memory" OFF) -FIND_PACKAGE(PMEM) -IF(PMEM_FOUND) - INCLUDE_DIRECTORIES(${PMEM_INCLUDES}) - ADD_COMPILE_FLAGS(log/log0log.cc log/log0recv.cc - buf/buf0flu.cc mtr/mtr0mtr.cc trx/trx0trx.cc srv/srv0start.cc - COMPILE_FLAGS "-DHAVE_PMEM") - SET(PMEM_LIBRARY ${PMEM_LIBRARIES}) -ELSE() - IF(WITH_PMEM) - MESSAGE(FATAL_ERROR "WITH_PMEM=ON cannot be satisfied") - ENDIF() +IF(WITH_INNODB_PMEM) + ADD_DEFINITIONS(-DHAVE_PMEM) + SET(INNOBASE_SOURCES ${INNOBASE_SOURCES} include/cache.h sync/cache.cc) ENDIF() MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE MODULE_OUTPUT_NAME ha_innodb DEFAULT RECOMPILE_FOR_EMBEDDED LINK_LIBRARIES - ${ZLIB_LIBRARY} - ${PMEM_LIBRARY} + ${ZLIB_LIBRARIES} ${NUMA_LIBRARY} ${LIBSYSTEMD} ${LINKER_SCRIPT}) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 0db2c2d75b8..45207d9d02d 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -260,6 +260,8 @@ btr_root_block_get( mtr_t* mtr, /*!< in: mtr */ dberr_t* err) /*!< out: error code */ { + ut_ad(mode != RW_NO_LATCH); + if (!index->table || !index->table->space) { *err= DB_TABLESPACE_NOT_FOUND; @@ -281,13 +283,12 @@ btr_root_block_get( if (UNIV_LIKELY(block != nullptr)) { - if (UNIV_UNLIKELY(mode == RW_NO_LATCH)); - else if (!!page_is_comp(block->page.frame) != - index->table->not_redundant() || - btr_page_get_index_id(block->page.frame) != index->id || - !fil_page_index_page_check(block->page.frame) || - index->is_spatial() != - (fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE)) + if (!!page_is_comp(block->page.frame) != + index->table->not_redundant() || + btr_page_get_index_id(block->page.frame) != index->id || + !fil_page_index_page_check(block->page.frame) || + index->is_spatial() != + (fil_page_get_type(block->page.frame) == FIL_PAGE_RTREE)) { *err= DB_PAGE_CORRUPTED; block= nullptr; @@ -530,6 +531,31 @@ btr_block_reget(mtr_t *mtr, const dict_index_t &index, return btr_block_get(index, id.page_no(), RW_X_LATCH, mtr, err); } +static MY_ATTRIBUTE((nonnull, warn_unused_result)) +/** Acquire a latch on the index root page for allocating or freeing pages. +@param index index tree +@param mtr mini-transaction +@param err error code +@return root page +@retval nullptr if an error occurred */ +buf_block_t *btr_root_block_sx(dict_index_t *index, mtr_t *mtr, dberr_t *err) +{ + buf_block_t *root= + mtr->get_already_latched(page_id_t{index->table->space_id, index->page}, + MTR_MEMO_PAGE_SX_FIX); + if (!root) + { + root= btr_root_block_get(index, RW_SX_LATCH, mtr, err); + if (UNIV_UNLIKELY(!root)) + return root; + } +#ifdef BTR_CUR_HASH_ADAPT + else + ut_ad(!root->index || !root->index->freed()); +#endif + return root; +} + /**************************************************************//** Allocates a new file page to be used in an index tree. NOTE: we assume that the caller has made the reservation for free extents! @@ -552,21 +578,9 @@ btr_page_alloc( { ut_ad(level < BTR_MAX_NODE_LEVEL); - const auto savepoint= mtr->get_savepoint(); - buf_block_t *root= btr_root_block_get(index, RW_NO_LATCH, mtr, err); + buf_block_t *root= btr_root_block_sx(index, mtr, err); if (UNIV_UNLIKELY(!root)) return root; - - const bool have_latch= mtr->have_u_or_x_latch(*root); -#ifdef BTR_CUR_HASH_ADAPT - ut_ad(!have_latch || !root->index || !root->index->freed()); -#endif - mtr->rollback_to_savepoint(savepoint); - - if (!have_latch && - UNIV_UNLIKELY(!(root= btr_root_block_get(index, RW_SX_LATCH, mtr, err)))) - return root; - fseg_header_t *seg_header= root->page.frame + (level ? PAGE_HEADER + PAGE_BTR_SEG_TOP : PAGE_HEADER + PAGE_BTR_SEG_LEAF); return fseg_alloc_free_page_general(seg_header, hint_page_no, file_direction, @@ -608,24 +622,16 @@ dberr_t btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, fil_space_t *space= index->table->space; dberr_t err; - const auto savepoint= mtr->get_savepoint(); - if (buf_block_t *root= btr_root_block_get(index, RW_NO_LATCH, mtr, &err)) + if (buf_block_t *root= btr_root_block_sx(index, mtr, &err)) { - const bool have_latch= mtr->have_u_or_x_latch(*root); -#ifdef BTR_CUR_HASH_ADAPT - ut_ad(!have_latch || !root->index || !root->index->freed()); -#endif - mtr->rollback_to_savepoint(savepoint); - if (have_latch || - (root= btr_root_block_get(index, RW_SX_LATCH, mtr, &err))) - err= fseg_free_page(&root->page.frame[blob || - page_is_leaf(block->page.frame) - ? PAGE_HEADER + PAGE_BTR_SEG_LEAF - : PAGE_HEADER + PAGE_BTR_SEG_TOP], - space, page, mtr, space_latched); + err= fseg_free_page(&root->page.frame[blob || + page_is_leaf(block->page.frame) + ? PAGE_HEADER + PAGE_BTR_SEG_LEAF + : PAGE_HEADER + PAGE_BTR_SEG_TOP], + space, page, mtr, space_latched); + if (err == DB_SUCCESS) + buf_page_free(space, page, mtr); } - if (err == DB_SUCCESS) - buf_page_free(space, page, mtr); /* The page was marked free in the allocation bitmap, but it should remain exclusively latched until mtr_t::commit() or until it diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index b9ea48af9f8..094d7570dc0 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -833,7 +833,7 @@ PageBulk::release() m_block->page.fix(); /* No other threads can modify this block. */ - m_modify_clock = buf_block_get_modify_clock(m_block); + m_modify_clock = m_block->modify_clock; m_mtr.commit(); } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index fb0efe08130..799a8575a83 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -805,7 +805,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) /* Determine the maximum length of the index field. */ field_max_size = dict_col_get_fixed_size(col, comp); - if (field_max_size) { + if (field_max_size && field->fixed_len) { /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len || field->fixed_len == field->prefix_len); @@ -923,7 +923,7 @@ static inline page_cur_mode_t btr_cur_nonleaf_mode(page_cur_mode_t mode) return PAGE_CUR_LE; } -static MY_ATTRIBUTE((nonnull)) +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 @@ -934,8 +934,9 @@ static MY_ATTRIBUTE((nonnull)) @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 */ -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(buf_block_t *block, page_id_t page_id, + ulint zip_size, + rw_lock_type_t rw_latch, mtr_t *mtr, dberr_t *err) { ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); ut_ad(page_id.space() == block->page.id().space()); @@ -943,46 +944,80 @@ int btr_latch_prev(buf_block_t *block, page_id_t page_id, ulint zip_size, const auto prev_savepoint= mtr->get_savepoint(); ut_ad(block == mtr->at_savepoint(prev_savepoint - 1)); - page_id.set_page_no(btr_page_get_prev(block->page.frame)); + const page_t *const page= block->page.frame; + page_id.set_page_no(btr_page_get_prev(page)); + /* We are holding a latch on the current page. + + We will start by buffer-fixing the left sibling. Waiting for a latch + on it while holding a latch on the current page could lead to a + deadlock, because another thread could hold that latch and wait for + a right sibling page latch (the current page). + + If there is a conflict, we will temporarily release our latch on the + current block while waiting for a latch on the left sibling. The + buffer-fixes on both blocks will prevent eviction. */ + + retry: buf_block_t *prev= buf_page_get_gen(page_id, zip_size, RW_NO_LATCH, nullptr, BUF_GET, mtr, err); if (UNIV_UNLIKELY(!prev)) return 0; int ret= 1; - if (UNIV_UNLIKELY(rw_latch == RW_S_LATCH)) + 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()) { - if (UNIV_LIKELY(prev->page.lock.s_lock_try())) + mtr->lock_register(prev_savepoint, mtr_memo_type_t(rw_latch)); + if (UNIV_UNLIKELY(prev->page.id() != page_id)) { - mtr->lock_register(prev_savepoint, MTR_MEMO_PAGE_S_FIX); - goto prev_latched; + fail: + /* the page was just read and found to be corrupted */ + mtr->rollback_to_savepoint(prev_savepoint); + return 0; } - block->page.lock.s_unlock(); } else { - if (UNIV_LIKELY(prev->page.lock.x_lock_try())) + ut_ad(mtr->at_savepoint(mtr->get_savepoint() - 1)->page.id() == page_id); + mtr->release_last_page(); + 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) + block->page.lock.s_lock(); + else + block->page.lock.x_lock(); + + const page_id_t prev_page_id= page_id; + page_id.set_page_no(btr_page_get_prev(page)); + + if (UNIV_UNLIKELY(page_id != prev_page_id)) { - mtr->lock_register(prev_savepoint, MTR_MEMO_PAGE_X_FIX); - goto prev_latched; + mtr->release_last_page(); + if (page_id.page_no() == FIL_NULL) + return -1; + goto retry; } - block->page.lock.x_unlock(); + + if (UNIV_UNLIKELY(!prev)) + goto fail; + + ret= -1; } - ret= -1; - mtr->lock_register(prev_savepoint - 1, MTR_MEMO_BUF_FIX); - mtr->rollback_to_savepoint(prev_savepoint); - prev= buf_page_get_gen(page_id, zip_size, rw_latch, prev, BUF_GET, mtr, err); - if (UNIV_UNLIKELY(!prev)) - return 0; - mtr->upgrade_buffer_fix(prev_savepoint - 1, rw_latch); - - prev_latched: - if (memcmp_aligned<2>(FIL_PAGE_TYPE + prev->page.frame, - FIL_PAGE_TYPE + block->page.frame, 2) || - memcmp_aligned<2>(PAGE_HEADER + PAGE_INDEX_ID + prev->page.frame, - PAGE_HEADER + PAGE_INDEX_ID + block->page.frame, 8) || - page_is_comp(prev->page.frame) != page_is_comp(block->page.frame)) + const page_t *const p= prev->page.frame; + if (memcmp_aligned<4>(FIL_PAGE_NEXT + p, FIL_PAGE_OFFSET + page, 4) || + memcmp_aligned<2>(FIL_PAGE_TYPE + p, FIL_PAGE_TYPE + page, 2) || + memcmp_aligned<2>(PAGE_HEADER + PAGE_INDEX_ID + p, + PAGE_HEADER + PAGE_INDEX_ID + page, 8) || + page_is_comp(p) != page_is_comp(page)) { ut_ad("corrupted" == 0); // FIXME: remove this *err= DB_CORRUPTION; @@ -5791,7 +5826,6 @@ btr_store_big_rec_extern_fields( for (ulint blob_npages = 0;; ++blob_npages) { buf_block_t* block; const ulint commit_freq = 4; - uint32_t r_extents; ut_ad(page_align(field_ref) == page_align(rec)); @@ -5826,22 +5860,14 @@ btr_store_big_rec_extern_fields( hint_prev = rec_block->page.id().page_no(); } - error = fsp_reserve_free_extents( - &r_extents, index->table->space, 1, - FSP_BLOB, &mtr, 1); - if (UNIV_UNLIKELY(error != DB_SUCCESS)) { -alloc_fail: - mtr.commit(); - goto func_exit; - } - block = btr_page_alloc(index, hint_prev + 1, FSP_NO_DIR, 0, &mtr, &mtr, &error); - index->table->space->release_free_extents(r_extents); if (!block) { - goto alloc_fail; +alloc_fail: + mtr.commit(); + goto func_exit; } const uint32_t space_id = block->page.id().space(); diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 0bf279ab371..61afa3c9132 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -173,10 +173,8 @@ before_first: cursor->old_n_fields, &cursor->old_rec_buf, &cursor->buf_size); - cursor->block_when_stored.store(block); - - /* Function try to check if block is S/X latch. */ - cursor->modify_clock = buf_block_get_modify_clock(block); + cursor->old_page_id = block->page.id(); + cursor->modify_clock = block->modify_clock; } /**************************************************************//** @@ -208,101 +206,80 @@ btr_pcur_copy_stored_position( } /** Optimistically latches the leaf page or pages requested. -@param[in] block guessed buffer block -@param[in,out] pcur cursor -@param[in,out] latch_mode BTR_SEARCH_LEAF, ... -@param[in,out] mtr mini-transaction -@return true if success */ +@param pcur persistent cursor +@param latch_mode BTR_SEARCH_LEAF, ... +@param mtr mini-transaction +@return true on success */ TRANSACTIONAL_TARGET -static bool btr_pcur_optimistic_latch_leaves(buf_block_t *block, - btr_pcur_t *pcur, +static bool btr_pcur_optimistic_latch_leaves(btr_pcur_t *pcur, btr_latch_mode *latch_mode, mtr_t *mtr) { - ut_ad(block->page.buf_fix_count()); - ut_ad(block->page.in_file()); - ut_ad(block->page.frame); - static_assert(BTR_SEARCH_PREV & BTR_SEARCH_LEAF, ""); static_assert(BTR_MODIFY_PREV & BTR_MODIFY_LEAF, ""); static_assert((BTR_SEARCH_PREV ^ BTR_MODIFY_PREV) == (RW_S_LATCH ^ RW_X_LATCH), ""); + buf_block_t *const block= + buf_page_optimistic_fix(pcur->btr_cur.page_cur.block, pcur->old_page_id); + + if (!block) + return false; + + if (*latch_mode == BTR_SEARCH_LEAF || *latch_mode == BTR_MODIFY_LEAF) + return buf_page_optimistic_get(block, rw_lock_type_t(*latch_mode), + pcur->modify_clock, mtr); + + ut_ad(*latch_mode == BTR_SEARCH_PREV || *latch_mode == BTR_MODIFY_PREV); const rw_lock_type_t mode= rw_lock_type_t(*latch_mode & (RW_X_LATCH | RW_S_LATCH)); - switch (*latch_mode) { - default: - ut_ad(*latch_mode == BTR_SEARCH_LEAF || *latch_mode == BTR_MODIFY_LEAF); - return buf_page_optimistic_get(mode, block, pcur->modify_clock, mtr); - case BTR_SEARCH_PREV: - case BTR_MODIFY_PREV: - page_id_t id{0}; - uint32_t left_page_no; - ulint zip_size; - buf_block_t *left_block= nullptr; - { - transactional_shared_lock_guard g{block->page.lock}; - if (block->modify_clock != pcur->modify_clock) - return false; - id= block->page.id(); - zip_size= block->zip_size(); - left_page_no= btr_page_get_prev(block->page.frame); - } + uint64_t modify_clock; + uint32_t left_page_no; + const page_t *const page= block->page.frame; + { + transactional_shared_lock_guard g{block->page.lock}; + modify_clock= block->modify_clock; + left_page_no= btr_page_get_prev(page); + } - if (left_page_no != FIL_NULL) - { - left_block= - buf_page_get_gen(page_id_t(id.space(), left_page_no), zip_size, - mode, nullptr, BUF_GET_POSSIBLY_FREED, mtr); + const auto savepoint= mtr->get_savepoint(); + mtr->memo_push(block, MTR_MEMO_BUF_FIX); - if (!left_block); - else if (btr_page_get_next(left_block->page.frame) != id.page_no()) - { -release_left_block: - mtr->release_last_page(); - return false; - } - else - buf_page_make_young_if_needed(&left_block->page); - } - - if (buf_page_optimistic_get(mode, block, pcur->modify_clock, mtr)) - { - if (btr_page_get_prev(block->page.frame) == left_page_no) - { - /* block was already buffer-fixed while entering the function and - buf_page_optimistic_get() buffer-fixes it again. */ - ut_ad(2 <= block->page.buf_fix_count()); - *latch_mode= btr_latch_mode(mode); - return true; - } - - mtr->release_last_page(); - } - - ut_ad(block->page.buf_fix_count()); - if (left_block) - goto release_left_block; + if (UNIV_UNLIKELY(modify_clock != pcur->modify_clock)) + { + fail: + mtr->rollback_to_savepoint(savepoint); return false; } -} -/** Structure acts as functor to do the latching of leaf pages. -It returns true if latching of leaf pages succeeded and false -otherwise. */ -struct optimistic_latch_leaves -{ - btr_pcur_t *const cursor; - btr_latch_mode *const latch_mode; - mtr_t *const mtr; - - bool operator()(buf_block_t *hint) const + buf_block_t *prev; + if (left_page_no != FIL_NULL) { - return hint && - btr_pcur_optimistic_latch_leaves(hint, cursor, latch_mode, mtr); + prev= buf_page_get_gen(page_id_t(pcur->old_page_id.space(), + left_page_no), block->zip_size(), + mode, nullptr, BUF_GET_POSSIBLY_FREED, mtr); + if (!prev || + page_is_comp(prev->page.frame) != page_is_comp(block->page.frame) || + memcmp_aligned<2>(block->page.frame, prev->page.frame, 2) || + memcmp_aligned<2>(block->page.frame + PAGE_HEADER + PAGE_INDEX_ID, + prev->page.frame + PAGE_HEADER + PAGE_INDEX_ID, 8)) + goto fail; } -}; + else + prev= nullptr; + + mtr->upgrade_buffer_fix(savepoint, mode); + + if (UNIV_UNLIKELY(block->modify_clock != modify_clock) || + UNIV_UNLIKELY(block->page.is_freed()) || + (prev && + memcmp_aligned<4>(FIL_PAGE_NEXT + prev->page.frame, + FIL_PAGE_OFFSET + page, 4))) + goto fail; + + return true; +} /** Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified latches. If the cursor position @@ -325,6 +302,7 @@ btr_pcur_t::SAME_UNIQ cursor position is on user rec and points on the record with the same unique field values as in the stored record, btr_pcur_t::NOT_SAME cursor position is not on user rec or points on the record with not the samebuniq field values as in the stored */ +TRANSACTIONAL_TARGET btr_pcur_t::restore_status btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) { @@ -355,7 +333,6 @@ btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) latch_mode = BTR_LATCH_MODE_WITHOUT_INTENTION(restore_latch_mode); pos_state = BTR_PCUR_IS_POSITIONED; - block_when_stored.clear(); return restore_status::NOT_SAME; } @@ -372,9 +349,8 @@ btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) case BTR_SEARCH_PREV: case BTR_MODIFY_PREV: /* Try optimistic restoration. */ - if (block_when_stored.run_with_hint( - optimistic_latch_leaves{this, &restore_latch_mode, - mtr})) { + if (btr_pcur_optimistic_latch_leaves(this, &restore_latch_mode, + mtr)) { pos_state = BTR_PCUR_IS_POSITIONED; latch_mode = restore_latch_mode; @@ -479,16 +455,22 @@ btr_pcur_t::restore_position(btr_latch_mode restore_latch_mode, mtr_t *mtr) since the cursor can now be on a different page! But we can retain the value of old_rec */ - block_when_stored.store(btr_pcur_get_block(this)); - modify_clock= buf_block_get_modify_clock( - block_when_stored.block()); + old_page_id = btr_cur.page_cur.block->page.id(); + modify_clock = btr_cur.page_cur.block->modify_clock; mem_heap_free(heap); return restore_status::SAME_ALL; } - if (n_matched_fields >= index->n_uniq) - ret_val= restore_status::SAME_UNIQ; + if (n_matched_fields >= index->n_uniq + /* Unique indexes can contain "NULL" keys, and if all + unique fields are NULL and not all tuple + fields match to record fields, then treat it as if + restored cursor position points to the record with + not the same unique key. */ + && !(index->n_nullable + && dtuple_contains_null(tuple, index->n_uniq))) + ret_val= restore_status::SAME_UNIQ; } mem_heap_free(heap); @@ -605,40 +587,33 @@ btr_pcur_move_backward_from_page( return true; } - buf_block_t* block = btr_pcur_get_block(cursor); + buf_block_t* block = mtr->at_savepoint(0); + ut_ad(block == btr_pcur_get_block(cursor)); + const page_t* const page = block->page.frame; + /* btr_pcur_optimistic_latch_leaves() will acquire a latch on + the preceding page if one exists; + if that fails, btr_cur_t::search_leaf() invoked by + btr_pcur_open_with_no_init() will also acquire a latch on the + succeeding page. Our caller only needs one page latch. */ + ut_ad(mtr->get_savepoint() <= 3); - if (page_has_prev(block->page.frame)) { - buf_block_t* left_block - = mtr->at_savepoint(mtr->get_savepoint() - 1); - const page_t* const left = left_block->page.frame; - if (memcmp_aligned<4>(left + FIL_PAGE_NEXT, - block->page.frame - + FIL_PAGE_OFFSET, 4)) { - /* This should be the right sibling page, or - if there is none, the current block. */ - ut_ad(left_block == block - || !memcmp_aligned<4>(left + FIL_PAGE_PREV, - block->page.frame - + FIL_PAGE_OFFSET, 4)); - /* The previous one must be the left sibling. */ - left_block - = mtr->at_savepoint(mtr->get_savepoint() - 2); - ut_ad(!memcmp_aligned<4>(left_block->page.frame - + FIL_PAGE_NEXT, - block->page.frame - + FIL_PAGE_OFFSET, 4)); - } + if (page_has_prev(page)) { + buf_block_t* const left_block = mtr->at_savepoint(1); + ut_ad(!memcmp_aligned<4>(page + FIL_PAGE_OFFSET, + left_block->page.frame + + FIL_PAGE_NEXT, 4)); if (btr_pcur_is_before_first_on_page(cursor)) { + /* Reposition on the previous page. */ page_cur_set_after_last(left_block, &cursor->btr_cur.page_cur); /* Release the right sibling. */ - } else { - /* Release the left sibling. */ + mtr->rollback_to_savepoint(0, 1); block = left_block; } - mtr->release(*block); } + mtr->rollback_to_savepoint(1); + ut_ad(block == mtr->at_savepoint(0)); cursor->latch_mode = latch_mode; cursor->old_rec = nullptr; return false; diff --git a/storage/innobase/buf/buf0block_hint.cc b/storage/innobase/buf/buf0block_hint.cc deleted file mode 100644 index 6bd01faa279..00000000000 --- a/storage/innobase/buf/buf0block_hint.cc +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, 2021, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License, version 2.0, as published by the -Free Software Foundation. - -This program is also distributed with certain software (including but not -limited to OpenSSL) that is licensed under separate terms, as designated in a -particular file or component or in included license documentation. The authors -of MySQL hereby grant you an additional permission to link the program and -your derivative works with the separately licensed software that they have -included with MySQL. - -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, version 2.0, -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-1301 USA - -*****************************************************************************/ - -#include "buf0block_hint.h" -namespace buf { - -TRANSACTIONAL_TARGET -void Block_hint::buffer_fix_block_if_still_valid() -{ - /* To check if m_block belongs to the current buf_pool, we must - prevent freeing memory while we check, and until we buffer-fix the - block. For this purpose it is enough to latch any of the many - latches taken by buf_pool_t::resize(). - - Similar to buf_page_optimistic_get(), we must validate - m_block->page.id() after acquiring the hash_lock, because the object - may have been freed and not actually attached to buf_pool.page_hash - at the moment. (The block could have been reused to store a - different page, and that slice of buf_pool.page_hash could be protected - by another hash_lock that we are not holding.) - - Finally, we must ensure that the block is not being freed. */ - if (m_block) - { - auto &cell= buf_pool.page_hash.cell_get(m_page_id.fold()); - transactional_shared_lock_guard g - {buf_pool.page_hash.lock_get(cell)}; - if (buf_pool.is_uncompressed(m_block) && m_page_id == m_block->page.id() && - m_block->page.frame && m_block->page.in_file()) - m_block->page.fix(); - else - clear(); - } -} -} // namespace buf diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 13c58c6a0cb..07375bcbd10 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2705,9 +2705,9 @@ got_block: if (state > buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) { if (mode == BUF_PEEK_IF_IN_POOL) { ignore_block: + block->unfix(); ut_ad(mode == BUF_GET_POSSIBLY_FREED || mode == BUF_PEEK_IF_IN_POOL); - block->unfix(); if (err) { *err = DB_CORRUPTION; } @@ -2721,16 +2721,32 @@ ignore_block: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - block->page.lock.s_lock(); + if (rw_latch != RW_NO_LATCH) { + block->page.lock.s_lock(); + } else if (!block->page.lock.s_lock_try()) { + /* For RW_NO_LATCH, we should not try to acquire S or X + latch directly as we could be violating the latching + order resulting in deadlock. Instead we try latching the + page and retry in case of a failure. */ + goto wait_for_read; + } state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); const page_id_t id{block->page.id()}; block->page.lock.s_unlock(); - if (UNIV_UNLIKELY(id != page_id)) { + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + if (UNIV_UNLIKELY(id == page_id)) { + /* The page read was completed, and + another thread marked the page as free + while we were waiting. */ + goto ignore_block; + } + ut_ad(id == page_id_t{~0ULL}); block->page.unfix(); + if (++retries < BUF_PAGE_READ_MAX_RETRIES) { goto loop; } @@ -2741,6 +2757,7 @@ ignore_block: return nullptr; } + ut_ad(id == page_id); } else if (mode != BUF_PEEK_IF_IN_POOL) { } else if (!mtr) { ut_ad(!block->page.oldest_modification()); @@ -2767,6 +2784,7 @@ free_unfixed_block: if (UNIV_UNLIKELY(!block->page.frame)) { if (!block->page.lock.x_lock_try()) { wait_for_unzip: +wait_for_read: /* The page is being read or written, or another thread is executing buf_zip_decompress() in buf_page_get_gen() on it. */ @@ -2885,28 +2903,10 @@ wait_for_unfix: return block; case RW_S_LATCH: block->page.lock.s_lock(); - ut_ad(!block->page.is_read_fixed()); - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - block->page.lock.s_unlock(); - block->page.lock.x_lock(); -page_id_mismatch: - if (block->page.id().is_corrupted()) { - buf_pool.corrupted_evict(&block->page, - block->page.state()); - } - if (err) { - *err = DB_CORRUPTION; - } - return nullptr; - } break; case RW_SX_LATCH: block->page.lock.u_lock(); ut_ad(!block->page.is_io_fixed()); - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - block->page.lock.u_x_upgrade(); - goto page_id_mismatch; - } break; default: ut_ad(rw_latch == RW_X_LATCH); @@ -2916,9 +2916,6 @@ page_id_mismatch: mtr->page_lock_upgrade(*block); return block; } - if (UNIV_UNLIKELY(block->page.id() != page_id)) { - goto page_id_mismatch; - } } mtr->memo_push(block, mtr_memo_type_t(rw_latch)); @@ -2937,77 +2934,70 @@ This is the general function used to get optimistic access to a database page. @return TRUE if success */ TRANSACTIONAL_TARGET -bool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, - uint64_t modify_clock, mtr_t *mtr) +buf_block_t *buf_page_optimistic_fix(buf_block_t *block, page_id_t id) +{ + buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); + transactional_shared_lock_guard g + {buf_pool.page_hash.lock_get(chain)}; + if (UNIV_UNLIKELY(!buf_pool.is_uncompressed(block) || + id != block->page.id() || !block->page.frame)) + return nullptr; + const auto state= block->page.state(); + if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED || + state >= buf_page_t::READ_FIX)) + return nullptr; + block->page.fix(); + return block; +} + +buf_block_t *buf_page_optimistic_get(buf_block_t *block, + rw_lock_type_t rw_latch, + uint64_t modify_clock, mtr_t *mtr) { - ut_ad(block); - ut_ad(mtr); ut_ad(mtr->is_active()); ut_ad(rw_latch == RW_S_LATCH || rw_latch == RW_X_LATCH); + ut_ad(block->page.buf_fix_count()); - if (have_transactional_memory); - else if (UNIV_UNLIKELY(!block->page.frame)) - return false; - else + if (rw_latch == RW_S_LATCH) { - const auto state= block->page.state(); - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED || - state >= buf_page_t::READ_FIX)) - return false; - } - - bool success; - const page_id_t id{block->page.id()}; - buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); - bool have_u_not_x= false; - - { - transactional_shared_lock_guard g - {buf_pool.page_hash.lock_get(chain)}; - if (UNIV_UNLIKELY(id != block->page.id() || !block->page.frame)) - return false; - const auto state= block->page.state(); - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED || - state >= buf_page_t::READ_FIX)) - return false; - - if (rw_latch == RW_S_LATCH) - success= block->page.lock.s_lock_try(); - else + if (!block->page.lock.s_lock_try()) { - have_u_not_x= block->page.lock.have_u_not_x(); - success= have_u_not_x || block->page.lock.x_lock_try(); + fail: + block->page.unfix(); + return nullptr; } - } - - if (!success) - return false; - - if (have_u_not_x) - { - block->page.lock.u_x_upgrade(); - mtr->page_lock_upgrade(*block); - ut_ad(id == block->page.id()); - ut_ad(modify_clock == block->modify_clock); - } - else - { - ut_ad(rw_latch == RW_S_LATCH || !block->page.is_io_fixed()); - ut_ad(id == block->page.id()); if (modify_clock != block->modify_clock || block->page.is_freed()) { - if (rw_latch == RW_S_LATCH) - block->page.lock.s_unlock(); - else - block->page.lock.x_unlock(); - return false; + block->page.lock.s_unlock(); + goto fail; } - block->page.fix(); ut_ad(!block->page.is_read_fixed()); buf_page_make_young_if_needed(&block->page); - mtr->memo_push(block, mtr_memo_type_t(rw_latch)); + mtr->memo_push(block, MTR_MEMO_PAGE_S_FIX); + } + else if (block->page.lock.have_u_not_x()) + { + block->page.lock.u_x_upgrade(); + block->page.unfix(); + mtr->page_lock_upgrade(*block); + ut_ad(modify_clock == block->modify_clock); + } + else if (!block->page.lock.x_lock_try()) + goto fail; + else + { + ut_ad(!block->page.is_io_fixed()); + + if (modify_clock != block->modify_clock || block->page.is_freed()) + { + block->page.lock.x_unlock(); + goto fail; + } + + buf_page_make_young_if_needed(&block->page); + mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); } ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); @@ -3017,7 +3007,7 @@ bool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, ut_ad(~buf_page_t::LRU_MASK & state); ut_ad(block->page.frame); - return true; + return block; } /** Try to S-latch a page. diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index e2702adc880..ec64d8d46ff 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -53,6 +53,7 @@ void buf_dblwr_t::init() active_slot= &slots[0]; mysql_mutex_init(buf_dblwr_mutex_key, &mutex, nullptr); pthread_cond_init(&cond, nullptr); + block_size= FSP_EXTENT_SIZE; } } @@ -67,7 +68,7 @@ inline void buf_dblwr_t::init(const byte *header) block1= page_id_t(0, mach_read_from_4(header + TRX_SYS_DOUBLEWRITE_BLOCK1)); block2= page_id_t(0, mach_read_from_4(header + TRX_SYS_DOUBLEWRITE_BLOCK2)); - const uint32_t buf_size= 2 * block_size(); + const uint32_t buf_size= 2 * block_size; for (int i= 0; i < 2; i++) { slots[i].write_buf= static_cast @@ -86,7 +87,7 @@ bool buf_dblwr_t::create() return true; mtr_t mtr; - const ulint size= block_size(); + const ulint size= block_size; start_again: mtr.start(); @@ -251,7 +252,7 @@ loads the pages from double write buffer into memory. dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path) { ut_ad(this == &buf_dblwr); - const uint32_t size= block_size(); + const uint32_t size= block_size; /* We do the file i/o past the buffer pool */ byte *read_buf= static_cast(aligned_malloc(srv_page_size, @@ -488,7 +489,6 @@ void buf_dblwr_t::write_completed() mysql_mutex_lock(&mutex); ut_ad(is_created()); - ut_ad(srv_use_doublewrite_buf); ut_ad(batch_running); slot *flush_slot= active_slot == &slots[0] ? &slots[1] : &slots[0]; ut_ad(flush_slot->reserved); @@ -574,7 +574,7 @@ static void buf_dblwr_check_block(const buf_page_t *bpage) bool buf_dblwr_t::flush_buffered_writes(const ulint size) { mysql_mutex_assert_owner(&mutex); - ut_ad(size == block_size()); + ut_ad(size == block_size); for (;;) { @@ -647,7 +647,6 @@ static void *get_frame(const IORequest &request) void buf_dblwr_t::flush_buffered_writes_completed(const IORequest &request) { ut_ad(this == &buf_dblwr); - ut_ad(srv_use_doublewrite_buf); ut_ad(is_created()); ut_ad(!srv_read_only_mode); ut_ad(!request.bpage); @@ -670,8 +669,14 @@ void buf_dblwr_t::flush_buffered_writes_completed(const IORequest &request) pages_written+= flush_slot->first_free; mysql_mutex_unlock(&mutex); - /* Now flush the doublewrite buffer data to disk */ - fil_system.sys_space->flush(); + /* Make the doublewrite durable. Note: The doublewrite buffer is + always in the first file of the system tablespace. We will not + bother about fil_system.unflushed_spaces, which can result in a + redundant call during fil_flush_file_spaces() in + log_checkpoint(). Writes to the system tablespace should be rare, + except when executing DDL or using the non-default settings + innodb_file_per_table=OFF or innodb_undo_tablespaces=0. */ + os_file_flush(request.node->handle); /* The writes have been flushed to disk now and in recovery we will find them in the doublewrite buffer blocks. Next, write the data pages. */ @@ -714,17 +719,18 @@ posted, and also when we may have to wait for a page latch! Otherwise a deadlock of threads can occur. */ void buf_dblwr_t::flush_buffered_writes() { - if (!is_created() || !srv_use_doublewrite_buf) + mysql_mutex_lock(&mutex); + + if (!in_use() && active_slot->first_free == 0) { + mysql_mutex_unlock(&mutex); fil_flush_file_spaces(); return; } ut_ad(!srv_read_only_mode); - const ulint size= block_size(); - mysql_mutex_lock(&mutex); - if (!flush_buffered_writes(size)) + if (!flush_buffered_writes(block_size)) mysql_mutex_unlock(&mutex); } @@ -734,8 +740,6 @@ flush_buffered_writes() will be invoked to make space. @param size payload size in bytes */ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size) { - ut_ad(request.is_async()); - ut_ad(request.is_write()); ut_ad(request.bpage); ut_ad(request.bpage->in_file()); ut_ad(request.node); @@ -744,7 +748,7 @@ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size) ut_ad(request.node->space->referenced()); ut_ad(!srv_read_only_mode); - const ulint buf_size= 2 * block_size(); + const ulint buf_size= 2 * block_size; mysql_mutex_lock(&mutex); @@ -773,7 +777,7 @@ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size) ut_ad(active_slot->reserved == active_slot->first_free); ut_ad(active_slot->reserved < buf_size); new (active_slot->buf_block_arr + active_slot->first_free++) - element{request, size}; + element{request.doublewritten(), size}; active_slot->reserved= active_slot->first_free; if (active_slot->first_free != buf_size || diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 4e54c7055ca..a69877ba34f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -350,9 +350,9 @@ void buf_page_write_complete(const IORequest &request, bool error) else { bpage->write_complete(persistent, error, state); - if (state < buf_page_t::WRITE_FIX_REINIT && - request.node->space->use_doublewrite()) + if (request.is_doublewritten()) { + ut_ad(state < buf_page_t::WRITE_FIX_REINIT); ut_ad(persistent); buf_dblwr.write_completed(); } @@ -1731,7 +1731,7 @@ static ulint buf_flush_LRU(ulint max_n) } #ifdef HAVE_PMEM -# include +# include "cache.h" #endif /** Write checkpoint information to the log header and release mutex. @@ -2257,7 +2257,7 @@ func_exit: sum_pages += last_pages_in; - const ulint time_elapsed = std::max(curr_time - prev_time, 1); + const ulint time_elapsed = std::max(ulint(curr_time - prev_time), 1); /* We update our variables every innodb_flushing_avg_loops iterations to smooth out transition in workload. */ diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 6263e1ead17..e33f86e9b55 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2009,7 +2009,6 @@ dict_index_add_to_cache( new_index->n_fields = new_index->n_def; new_index->trx_id = index->trx_id; new_index->set_committed(index->is_committed()); - new_index->nulls_equal = index->nulls_equal; n_ord = new_index->n_uniq; /* Flag the ordering columns and also set column max_prefix */ diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 83435867b04..0d67e1a9f6c 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2290,7 +2290,7 @@ void fil_space_crypt_close_tablespace(const fil_space_t *space) << space->chain.start->name << " (" << space->id << ") active threads " << crypt_data->rotate_state.active_threads - << "flushing=" + << " flushing=" << crypt_data->rotate_state.flushing << "."; last = now; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 06d2117dd9c..b16a4c54f5c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1246,9 +1246,6 @@ void fil_system_t::create(ulint hash_size) ut_ad(!is_initialised()); ut_ad(!(srv_page_size % FSP_EXTENT_SIZE)); ut_ad(srv_page_size); - ut_ad(!spaces.array); - - m_initialised = true; compile_time_assert(!(UNIV_PAGE_SIZE_MAX % FSP_EXTENT_SIZE_MAX)); compile_time_assert(!(UNIV_PAGE_SIZE_MIN % FSP_EXTENT_SIZE_MIN)); @@ -1259,6 +1256,8 @@ void fil_system_t::create(ulint hash_size) spaces.create(hash_size); + need_unflushed_spaces = !write_through && buf_dblwr.need_fsync(); + fil_space_crypt_init(); #ifdef __linux__ ssd.clear(); @@ -1332,13 +1331,12 @@ void fil_system_t::close() if (is_initialised()) { - m_initialised= false; spaces.free(); mysql_mutex_destroy(&mutex); fil_space_crypt_cleanup(); } - ut_ad(!spaces.array); + ut_ad(!is_initialised()); #ifdef __linux__ ssd.clear(); @@ -1479,6 +1477,7 @@ void fil_system_t::set_write_through(bool write_through) { this->write_through= write_through; fil_space_t::reopen_all(); + need_unflushed_spaces = !write_through && buf_dblwr.need_fsync(); } mysql_mutex_unlock(&mutex); @@ -2848,19 +2847,18 @@ static void fil_invalid_page_access_msg(const char *name, } /** Update the data structures on write completion */ -inline void fil_node_t::complete_write() +void fil_space_t::complete_write() { mysql_mutex_assert_not_owner(&fil_system.mutex); - if (space->purpose != FIL_TYPE_TEMPORARY && - (!fil_system.is_write_through() && !my_disable_sync) && - space->set_needs_flush()) + if (purpose != FIL_TYPE_TEMPORARY && + fil_system.use_unflushed_spaces() && set_needs_flush()) { mysql_mutex_lock(&fil_system.mutex); - if (!space->is_in_unflushed_spaces) + if (!is_in_unflushed_spaces) { - space->is_in_unflushed_spaces= true; - fil_system.unflushed_spaces.push_front(*space); + is_in_unflushed_spaces= true; + fil_system.unflushed_spaces.push_front(*this); } mysql_mutex_unlock(&fil_system.mutex); } @@ -2960,7 +2958,7 @@ io_error: if (!type.is_async()) { if (type.is_write()) { release_sync_write: - node->complete_write(); + complete_write(); release: release(); goto func_exit; @@ -2980,21 +2978,28 @@ void IORequest::write_complete(int io_error) const { ut_ad(fil_validate_skip()); ut_ad(node); + fil_space_t *space= node->space; ut_ad(is_write()); - node->complete_write(); if (!bpage) { ut_ad(!srv_read_only_mode); if (type == IORequest::DBLWR_BATCH) + { buf_dblwr.flush_buffered_writes_completed(*this); + /* Above, we already invoked os_file_flush() on the + doublewrite buffer if needed. */ + goto func_exit; + } else ut_ad(type == IORequest::WRITE_ASYNC); } else buf_page_write_complete(*this, io_error); - node->space->release(); + space->complete_write(); + func_exit: + space->release(); } void IORequest::read_complete(int io_error) const diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index ecdc280f343..d0d406a0c1e 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -258,6 +258,7 @@ inline void xdes_init(const buf_block_t &block, xdes_t *descr, mtr_t *mtr) } /** Mark a page used in an extent descriptor. +@param[in] space tablespace @param[in,out] seg_inode segment inode @param[in,out] iblock segment inode page @param[in] page page number @@ -267,7 +268,8 @@ inline void xdes_init(const buf_block_t &block, xdes_t *descr, mtr_t *mtr) @return error code */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t -fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, +fseg_mark_page_used(const fil_space_t *space, + fseg_inode_t *seg_inode, buf_block_t *iblock, uint32_t page, xdes_t *descr, buf_block_t *xdes, mtr_t *mtr) { ut_ad(fil_page_get_type(iblock->page.frame) == FIL_PAGE_INODE); @@ -277,15 +279,16 @@ fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, const uint16_t xoffset= uint16_t(descr - xdes->page.frame + XDES_FLST_NODE); const uint16_t ioffset= uint16_t(seg_inode - iblock->page.frame); + const uint32_t limit= space->free_limit; if (!xdes_get_n_used(descr)) { /* We move the extent from the free list to the NOT_FULL list */ if (dberr_t err= flst_remove(iblock, uint16_t(FSEG_FREE + ioffset), - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; if (dberr_t err= flst_add_last(iblock, uint16_t(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; } @@ -302,10 +305,10 @@ fseg_mark_page_used(fseg_inode_t *seg_inode, buf_block_t *iblock, { /* We move the extent from the NOT_FULL list to the FULL list */ if (dberr_t err= flst_remove(iblock, uint16_t(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; if (dberr_t err= flst_add_last(iblock, uint16_t(FSEG_FULL + ioffset), - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; mtr->write<4>(*iblock, seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used - FSP_EXTENT_SIZE); @@ -890,7 +893,7 @@ fsp_fill_free_list( xdes_set_free(*xdes, descr, 1, mtr); xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr)) + xdes, xoffset, space->free_limit, mtr)) return err; byte *n_used= FSP_HEADER_OFFSET + FSP_FRAG_N_USED + header->page.frame; mtr->write<4>(*header, n_used, 2U + mach_read_from_4(n_used)); @@ -899,7 +902,7 @@ fsp_fill_free_list( { if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE, - xdes, xoffset, mtr)) + xdes, xoffset, space->free_limit, mtr)) return err; count++; } @@ -950,7 +953,11 @@ corrupted: first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE + header->page.frame); - if (first.page == FIL_NULL) { + if (first.page >= space->free_limit) { + if (first.page != FIL_NULL) { + goto flst_corrupted; + } + *err = fsp_fill_free_list(false, space, header, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { goto corrupted; @@ -961,6 +968,17 @@ corrupted: if (first.page == FIL_NULL) { return nullptr; /* No free extents left */ } + if (first.page >= space->free_limit) { + goto flst_corrupted; + } + } + + if (first.boffset < FSP_HEADER_OFFSET + FSP_HEADER_SIZE + || first.boffset >= space->physical_size() + - (XDES_SIZE + FIL_PAGE_DATA_END)) { + flst_corrupted: + *err = DB_CORRUPTION; + goto corrupted; } descr = xdes_lst_get_descriptor(*space, first, mtr, @@ -973,7 +991,7 @@ corrupted: *err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE, desc_block, static_cast(descr - desc_block->page.frame + XDES_FLST_NODE), - mtr); + space->free_limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return nullptr; } @@ -990,11 +1008,12 @@ MY_ATTRIBUTE((nonnull, warn_unused_result)) @param[in,out] xdes extent descriptor page @param[in,out] descr extent descriptor @param[in] bit slot to allocate in the extent +@param[in] space tablespace @param[in,out] mtr mini-transaction @return error code */ static dberr_t fsp_alloc_from_free_frag(buf_block_t *header, buf_block_t *xdes, xdes_t *descr, - uint32_t bit, mtr_t *mtr) + uint32_t bit, fil_space_t *space, mtr_t *mtr) { if (UNIV_UNLIKELY(xdes_get_state(descr) != XDES_FREE_FRAG || !xdes_is_free(descr, bit))) @@ -1007,14 +1026,15 @@ fsp_alloc_from_free_frag(buf_block_t *header, buf_block_t *xdes, xdes_t *descr, if (xdes_is_full(descr)) { + const uint32_t limit= space->free_limit; /* The fragment is full: move it to another list */ const uint16_t xoffset= static_cast(descr - xdes->page.frame + XDES_FLST_NODE); if (dberr_t err= flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; if (dberr_t err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, - xdes, xoffset, mtr)) + xdes, xoffset, limit, mtr)) return err; xdes_set_state(*xdes, descr, XDES_FULL_FRAG, mtr); n_used-= FSP_EXTENT_SIZE; @@ -1076,8 +1096,11 @@ buf_block_t *fsp_alloc_free_page(fil_space_t *space, uint32_t hint, /* Else take the first extent in free_frag list */ fil_addr_t first = flst_get_first(FSP_HEADER_OFFSET + FSP_FREE_FRAG + block->page.frame); - if (first.page == FIL_NULL) + if (first.page >= space->free_limit) { + if (first.page != FIL_NULL) + goto flst_corrupted; + /* There are no partially full fragments: allocate a free extent and add it to the FREE_FRAG list. NOTE that the allocation may have as a side-effect that an extent containing a descriptor @@ -1088,13 +1111,23 @@ buf_block_t *fsp_alloc_free_page(fil_space_t *space, uint32_t hint, return nullptr; *err= flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE_FRAG, xdes, static_cast(descr - xdes->page.frame + - XDES_FLST_NODE), mtr); + XDES_FLST_NODE), + space->free_limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) return nullptr; xdes_set_state(*xdes, descr, XDES_FREE_FRAG, mtr); } else { + if (first.boffset < FSP_HEADER_OFFSET + FSP_HEADER_SIZE || + first.boffset >= space->physical_size() - + (XDES_SIZE + FIL_PAGE_DATA_END)) + { + flst_corrupted: + *err= DB_CORRUPTION; + goto err_exit; + } + descr= xdes_lst_get_descriptor(*space, first, mtr, &xdes, err); if (!descr) return nullptr; @@ -1141,7 +1174,7 @@ buf_block_t *fsp_alloc_free_page(fil_space_t *space, uint32_t hint, } } - *err= fsp_alloc_from_free_frag(block, xdes, descr, free, mtr); + *err= fsp_alloc_from_free_frag(block, xdes, descr, free, space, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) goto corrupted; return fsp_page_create(space, page_no, init_mtr); @@ -1180,7 +1213,8 @@ static dberr_t fsp_free_extent(fil_space_t* space, uint32_t offset, space->free_len++; return flst_add_last(block, FSP_HEADER_OFFSET + FSP_FREE, xdes, static_cast(descr - xdes->page.frame + - XDES_FLST_NODE), mtr); + XDES_FLST_NODE), + space->free_limit, mtr); } MY_ATTRIBUTE((nonnull)) @@ -1234,16 +1268,17 @@ static dberr_t fsp_free_page(fil_space_t *space, uint32_t offset, mtr_t *mtr) const uint16_t xoffset= static_cast(descr - xdes->page.frame + XDES_FLST_NODE); + const uint32_t limit = space->free_limit; if (state == XDES_FULL_FRAG) { /* The fragment was full: move it to another list */ err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FULL_FRAG, - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } err = flst_add_last(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } @@ -1265,7 +1300,7 @@ static dberr_t fsp_free_page(fil_space_t *space, uint32_t offset, mtr_t *mtr) if (!xdes_get_n_used(descr)) { /* The extent has become free: move it to another list */ err = flst_remove(header, FSP_HEADER_OFFSET + FSP_FREE_FRAG, - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (err == DB_SUCCESS) { err = fsp_free_extent(space, offset, mtr); } @@ -1359,7 +1394,7 @@ static dberr_t fsp_alloc_seg_inode_page(fil_space_t *space, #endif return flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - block, FSEG_INODE_PAGE_NODE, mtr); + block, FSEG_INODE_PAGE_NODE, space->free_limit, mtr); } MY_ATTRIBUTE((nonnull, warn_unused_result)) @@ -1415,12 +1450,13 @@ fsp_alloc_seg_inode(fil_space_t *space, buf_block_t *header, { /* There are no other unused headers left on the page: move it to another list */ + const uint32_t limit= space->free_limit; *err= flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - block, FSEG_INODE_PAGE_NODE, mtr); + block, FSEG_INODE_PAGE_NODE, limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) return nullptr; *err= flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, - block, FSEG_INODE_PAGE_NODE, mtr); + block, FSEG_INODE_PAGE_NODE, limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) return nullptr; } @@ -1453,16 +1489,17 @@ static void fsp_free_seg_inode(fil_space_t *space, fseg_inode_t *inode, } const ulint physical_size= space->physical_size(); + const uint32_t limit= space->free_limit; if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(iblock->page.frame, 0, physical_size)) { /* Move the page to another list */ if (flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FULL, - iblock, FSEG_INODE_PAGE_NODE, mtr) != DB_SUCCESS) + iblock, FSEG_INODE_PAGE_NODE, limit, mtr) != DB_SUCCESS) return; if (flst_add_last(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - iblock, FSEG_INODE_PAGE_NODE, mtr) != DB_SUCCESS) + iblock, FSEG_INODE_PAGE_NODE, limit, mtr) != DB_SUCCESS) return; } @@ -1474,7 +1511,7 @@ static void fsp_free_seg_inode(fil_space_t *space, fseg_inode_t *inode, /* There are no other used headers left on the page: free it */ if (flst_remove(header, FSP_HEADER_OFFSET + FSP_SEG_INODES_FREE, - iblock, FSEG_INODE_PAGE_NODE, mtr) == DB_SUCCESS) + iblock, FSEG_INODE_PAGE_NODE, limit, mtr) == DB_SUCCESS) fsp_free_page(space, iblock->page.id().page_no(), mtr); } @@ -1847,7 +1884,8 @@ static dberr_t fseg_fill_free_list(const fseg_inode_t *inode, static_cast(inode - iblock->page.frame + FSEG_FREE), xdes, static_cast(descr - xdes->page.frame + - XDES_FLST_NODE), mtr)) + XDES_FLST_NODE), + space->free_limit, mtr)) return err; xdes_set_state(*xdes, descr, XDES_FSEG, mtr); mtr->memcpy(*xdes, descr + XDES_ID, inode + FSEG_ID, 8); @@ -1882,11 +1920,25 @@ fseg_alloc_free_extent( ut_ad(!memcmp(FSEG_MAGIC_N_BYTES, FSEG_MAGIC_N + inode, 4)); ut_d(space->modify_check(*mtr)); + if (UNIV_UNLIKELY(page_offset(inode) < FSEG_ARR_OFFSET)) + { + corrupted: + *err= DB_CORRUPTION; + space->set_corrupted(); + return nullptr; + } + if (flst_get_len(inode + FSEG_FREE)) { + const fil_addr_t first= flst_get_first(inode + FSEG_FREE); + if (first.page >= space->free_limit || + first.boffset < FSP_HEADER_OFFSET + FSP_HEADER_SIZE || + first.boffset >= space->physical_size() - + (XDES_SIZE + FIL_PAGE_DATA_END)) + goto corrupted; + /* Segment free list is not empty, allocate from it */ - return xdes_lst_get_descriptor(*space, flst_get_first(inode + FSEG_FREE), - mtr, xdes, err); + return xdes_lst_get_descriptor(*space, first, mtr, xdes, err); } xdes_t* descr= fsp_alloc_free_extent(space, 0, xdes, mtr, err); @@ -1898,7 +1950,8 @@ fseg_alloc_free_extent( static_cast(inode - iblock->page.frame + FSEG_FREE), *xdes, static_cast(descr - (*xdes)->page.frame + - XDES_FLST_NODE), mtr); + XDES_FLST_NODE), + space->free_limit, mtr); if (UNIV_LIKELY(*err != DB_SUCCESS)) return nullptr; /* Try to fill the segment free list */ @@ -2039,7 +2092,8 @@ take_hinted_page: + FSEG_FREE), xdes, static_cast(ret_descr - xdes->page.frame - + XDES_FLST_NODE), mtr); + + XDES_FLST_NODE), + space->free_limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return nullptr; } @@ -2085,6 +2139,14 @@ take_hinted_page: return nullptr; } + if (first.page >= space->free_limit + || first.boffset < FSP_HEADER_OFFSET + FSP_HEADER_SIZE + || first.boffset >= space->physical_size() + - (XDES_SIZE + FIL_PAGE_DATA_END)) { + *err= DB_CORRUPTION; + return nullptr; + } + ret_descr = xdes_lst_get_descriptor(*space, first, mtr, &xdes); if (!ret_descr) { return nullptr; @@ -2178,8 +2240,8 @@ got_hinted_page: ut_ad(xdes == xxdes); ut_ad(xdes_is_free(ret_descr, ret_page % extent_size)); - *err = fseg_mark_page_used(seg_inode, iblock, ret_page, - ret_descr, xdes, mtr); + *err = fseg_mark_page_used(space, seg_inode, iblock, ret_page, + ret_descr, xdes, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return nullptr; } @@ -2520,18 +2582,19 @@ corrupted: const uint16_t xoffset= uint16_t(descr - xdes->page.frame + XDES_FLST_NODE); const uint16_t ioffset= uint16_t(seg_inode - iblock->page.frame); + const uint32_t limit = space->free_limit; if (xdes_is_full(descr)) { /* The fragment is full: move it to another list */ err = flst_remove(iblock, static_cast(FSEG_FULL + ioffset), - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } err = flst_add_last(iblock, static_cast(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } @@ -2549,7 +2612,7 @@ corrupted: if (!xdes_get_n_used(descr)) { err = flst_remove(iblock, static_cast(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } @@ -2694,11 +2757,12 @@ fseg_free_extent( #endif /* BTR_CUR_HASH_ADAPT */ uint16_t lst; + uint32_t limit = space->free_limit; if (xdes_is_full(descr)) { lst = static_cast(FSEG_FULL + ioffset); remove: - err = flst_remove(iblock, lst, xdes, xoffset, mtr); + err = flst_remove(iblock, lst, xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } @@ -2708,7 +2772,7 @@ remove: } else { err = flst_remove( iblock, static_cast(FSEG_NOT_FULL + ioffset), - xdes, xoffset, mtr); + xdes, xoffset, limit, mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { return err; } @@ -2958,7 +3022,10 @@ fseg_get_first_extent( return nullptr; } - if (first.page == FIL_NULL) + if (first.page >= space->free_limit || + first.boffset < FSP_HEADER_OFFSET + FSP_HEADER_SIZE || + first.boffset >= space->physical_size() - + (XDES_SIZE + FIL_PAGE_DATA_END)) goto corrupted; return xdes_lst_get_descriptor(*space, first, mtr, nullptr, err); @@ -3534,12 +3601,12 @@ func_exit: if (fixed_size > last_used_extent) last_used_extent= fixed_size; - my_bool old_dblwr_buf= srv_use_doublewrite_buf; + bool old_dblwr_buf= buf_dblwr.in_use(); /* Flush all pages in buffer pool, so that it doesn't have to use doublewrite buffer and disable dblwr and there should be enough space in redo log */ log_make_checkpoint(); - srv_use_doublewrite_buf= false; + fil_system.set_use_doublewrite(false); buf_block_t *header= nullptr; ut_ad(!fsp_sys_tablespace_validate()); @@ -3625,5 +3692,5 @@ mtr_max: mtr.commit_shrink(*space, last_used_extent); sql_print_information("InnoDB: System tablespace truncated successfully"); - srv_use_doublewrite_buf= old_dblwr_buf; + fil_system.set_use_doublewrite(old_dblwr_buf); } diff --git a/storage/innobase/fut/fut0lst.cc b/storage/innobase/fut/fut0lst.cc index 48cb8bccdc3..1f9b9c26eb2 100644 --- a/storage/innobase/fut/fut0lst.cc +++ b/storage/innobase/fut/fut0lst.cc @@ -113,17 +113,18 @@ static void flst_add_to_empty(buf_block_t *base, uint16_t boffset, } /** Insert a node after another one. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] cur insert position block -@param[in] coffset byte offset of the insert position -@param[in,out] add block to be added -@param[in] aoffset byte offset of the block to be added -@param[in,out] mtr mini-transaction */ +@param base base node block +@param boffset byte offset of the base node +@param cur insert position block +@param coffset byte offset of the insert position +@param add block to be added +@param aoffset byte offset of the block to be added +@param limit fil_space_t::free_limit +@param mtr mini-transaction */ static dberr_t flst_insert_after(buf_block_t *base, uint16_t boffset, buf_block_t *cur, uint16_t coffset, buf_block_t *add, uint16_t aoffset, - mtr_t *mtr) + uint32_t limit, mtr_t *mtr) { ut_ad(base != cur || boffset != coffset); ut_ad(base != add || boffset != aoffset); @@ -139,6 +140,15 @@ static dberr_t flst_insert_after(buf_block_t *base, uint16_t boffset, MTR_MEMO_PAGE_SX_FIX)); fil_addr_t next_addr= flst_get_next_addr(cur->page.frame + coffset); + if (next_addr.page >= limit) + { + if (UNIV_UNLIKELY(next_addr.page != FIL_NULL)) + return DB_CORRUPTION; + } + else if (UNIV_UNLIKELY(next_addr.boffset < FIL_PAGE_DATA || + next_addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; flst_write_addr(*add, add->page.frame + aoffset + FLST_PREV, cur->page.id().page_no(), coffset, mtr); @@ -167,18 +177,19 @@ static dberr_t flst_insert_after(buf_block_t *base, uint16_t boffset, } /** Insert a node before another one. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] cur insert position block -@param[in] coffset byte offset of the insert position -@param[in,out] add block to be added -@param[in] aoffset byte offset of the block to be added -@param[in,out] mtr mini-transaction +@param base base node block +@param boffset byte offset of the base node +@param cur insert position block +@param coffset byte offset of the insert position +@param add block to be added +@param aoffset byte offset of the block to be added +@param limit fil_space_t::free_limit +@param mtr mini-transaction @return error code */ static dberr_t flst_insert_before(buf_block_t *base, uint16_t boffset, buf_block_t *cur, uint16_t coffset, buf_block_t *add, uint16_t aoffset, - mtr_t *mtr) + uint32_t limit, mtr_t *mtr) { ut_ad(base != cur || boffset != coffset); ut_ad(base != add || boffset != aoffset); @@ -194,6 +205,15 @@ static dberr_t flst_insert_before(buf_block_t *base, uint16_t boffset, MTR_MEMO_PAGE_SX_FIX)); fil_addr_t prev_addr= flst_get_prev_addr(cur->page.frame + coffset); + if (prev_addr.page >= limit) + { + if (UNIV_UNLIKELY(prev_addr.page != FIL_NULL)) + return DB_CORRUPTION; + } + else if (UNIV_UNLIKELY(prev_addr.boffset < FIL_PAGE_DATA || + prev_addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; flst_write_addr(*add, add->page.frame + aoffset + FLST_PREV, prev_addr.page, prev_addr.boffset, mtr); @@ -234,14 +254,9 @@ void flst_init(const buf_block_t& block, byte *base, mtr_t *mtr) flst_zero_both(block, base + FLST_FIRST, mtr); } -/** Append a file list node to a list. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] add block to be added -@param[in] aoffset byte offset of the node to be added -@param[in,outr] mtr mini-transaction */ dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) + buf_block_t *add, uint16_t aoffset, + uint32_t limit, mtr_t *mtr) { ut_ad(base != add || boffset != aoffset); ut_ad(boffset < base->physical_size()); @@ -258,6 +273,13 @@ dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, else { fil_addr_t addr= flst_get_last(base->page.frame + boffset); + if (UNIV_UNLIKELY(addr.page >= limit)) + return DB_CORRUPTION; + else if (UNIV_UNLIKELY(addr.boffset < FIL_PAGE_DATA || + addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; + buf_block_t *cur= add; dberr_t err; if (addr.page != add->page.id().page_no() && @@ -266,19 +288,13 @@ dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, BUF_GET_POSSIBLY_FREED, mtr, &err))) return err; return flst_insert_after(base, boffset, cur, addr.boffset, - add, aoffset, mtr); + add, aoffset, limit, mtr); } } -/** Prepend a file list node to a list. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] add block to be added -@param[in] aoffset byte offset of the node to be added -@param[in,out] mtr mini-transaction -@return error code */ dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) + buf_block_t *add, uint16_t aoffset, + uint32_t limit, mtr_t *mtr) { ut_ad(base != add || boffset != aoffset); ut_ad(boffset < base->physical_size()); @@ -296,6 +312,12 @@ dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, else { fil_addr_t addr= flst_get_first(base->page.frame + boffset); + if (UNIV_UNLIKELY(addr.page >= limit)) + return DB_CORRUPTION; + else if (UNIV_UNLIKELY(addr.boffset < FIL_PAGE_DATA || + addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; buf_block_t *cur= add; dberr_t err; if (addr.page != add->page.id().page_no() && @@ -304,19 +326,13 @@ dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, BUF_GET_POSSIBLY_FREED, mtr, &err))) return err; return flst_insert_before(base, boffset, cur, addr.boffset, - add, aoffset, mtr); + add, aoffset, limit, mtr); } } -/** Remove a file list node. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] cur block to be removed -@param[in] coffset byte offset of the current record to be removed -@param[in,out] mtr mini-transaction -@return error code */ dberr_t flst_remove(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, mtr_t *mtr) + buf_block_t *cur, uint16_t coffset, + uint32_t limit, mtr_t *mtr) { ut_ad(boffset < base->physical_size()); ut_ad(coffset < cur->physical_size()); @@ -329,9 +345,27 @@ dberr_t flst_remove(buf_block_t *base, uint16_t boffset, const fil_addr_t next_addr= flst_get_next_addr(cur->page.frame + coffset); dberr_t err= DB_SUCCESS; - if (prev_addr.page == FIL_NULL) + if (next_addr.page >= limit) + { + if (next_addr.page != FIL_NULL) + return DB_CORRUPTION; + } + else if (UNIV_UNLIKELY(next_addr.boffset < FIL_PAGE_DATA || + next_addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; + + if (prev_addr.page >= limit) + { + if (prev_addr.page != FIL_NULL) + return DB_CORRUPTION; flst_write_addr(*base, base->page.frame + boffset + FLST_FIRST, next_addr.page, next_addr.boffset, mtr); + } + else if (UNIV_UNLIKELY(prev_addr.boffset < FIL_PAGE_DATA || + prev_addr.boffset >= base->physical_size() - + FIL_PAGE_DATA_END)) + return DB_CORRUPTION; else { buf_block_t *b= cur; @@ -375,25 +409,19 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr) ut_ad(mtr->memo_contains_flagged(base, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); - /* We use two mini-transaction handles: the first is used to lock - the base node, and prevent other threads from modifying the list. - The second is used to traverse the list. We cannot run the second - mtr without committing it at times, because if the list is long, - the x-locked pages could fill the buffer, resulting in a deadlock. */ - mtr_t mtr2; - const uint32_t len= flst_get_len(base->page.frame + boffset); fil_addr_t addr= flst_get_first(base->page.frame + boffset); for (uint32_t i= len; i--; ) { - mtr2.start(); + ut_ad(addr.boffset >= FIL_PAGE_DATA); + ut_ad(addr.boffset < base->physical_size() - FIL_PAGE_DATA_END); const buf_block_t *b= buf_page_get_gen(page_id_t(base->page.id().space(), addr.page), base->zip_size(), RW_SX_LATCH, nullptr, BUF_GET, mtr); ut_ad(b); addr= flst_get_next_addr(b->page.frame + addr.boffset); - mtr2.commit(); + mtr->release_last_page(); } ut_ad(addr.page == FIL_NULL); @@ -402,13 +430,14 @@ void flst_validate(const buf_block_t *base, uint16_t boffset, mtr_t *mtr) for (uint32_t i= len; i--; ) { - mtr2.start(); + ut_ad(addr.boffset >= FIL_PAGE_DATA); + ut_ad(addr.boffset < base->physical_size() - FIL_PAGE_DATA_END); const buf_block_t *b= buf_page_get_gen(page_id_t(base->page.id().space(), addr.page), base->zip_size(), RW_SX_LATCH, nullptr, BUF_GET, mtr); ut_ad(b); addr= flst_get_prev_addr(b->page.frame + addr.boffset); - mtr2.commit(); + mtr->release_last_page(); } ut_ad(addr.page == FIL_NULL); diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 65658835bb6..10a12a785df 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -288,10 +288,6 @@ rtr_pcur_getnext_from_path( mtr->rollback_to_savepoint(1); } - ut_ad((my_latch_mode | 4) == BTR_CONT_MODIFY_TREE - || !page_is_leaf(btr_cur_get_page(btr_cur)) - || !btr_cur->page_cur.block->page.lock.have_any()); - const auto block_savepoint = mtr->get_savepoint(); block = buf_page_get_gen( page_id_t(index->table->space_id, @@ -510,7 +506,7 @@ rtr_pcur_move_to_next( mysql_mutex_unlock(&rtr_info->matches->rtr_match_mutex); cursor->btr_cur.page_cur.rec = rec.r_rec; - cursor->btr_cur.page_cur.block = &rtr_info->matches->block; + cursor->btr_cur.page_cur.block = rtr_info->matches->block; DEBUG_SYNC_C("rtr_pcur_move_to_next_return"); return(true); @@ -671,8 +667,13 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, buf_mode, mtr, &err); if (!block) { - if (err == DB_DECRYPTION_FAILED) - btr_decryption_failed(*index); + if (err) + { + err_exit: + if (err == DB_DECRYPTION_FAILED) + btr_decryption_failed(*index); + mtr->rollback_to_savepoint(savepoint); + } func_exit: if (UNIV_LIKELY_NULL(heap)) mem_heap_free(heap); @@ -736,7 +737,8 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, #endif } - if (height == 0) { + if (height == 0) + { if (rw_latch == RW_NO_LATCH) { ut_ad(block == mtr->at_savepoint(block_savepoint)); @@ -820,7 +822,7 @@ dberr_t rtr_search_to_nth_level(btr_cur_t *cur, que_thr_t *thr, if (page_cur_search_with_match(tuple, page_mode, &up_match, &low_match, &cur->page_cur, nullptr)) { err= DB_CORRUPTION; - goto func_exit; + goto err_exit; } } @@ -1327,21 +1329,15 @@ rtr_create_rtr_info( rtr_info->thr = thr; if (init_matches) { - rtr_info->heap = mem_heap_create(sizeof(*(rtr_info->matches))); rtr_info->matches = static_cast( - mem_heap_zalloc( - rtr_info->heap, - sizeof(*rtr_info->matches))); + ut_zalloc_nokey(sizeof *rtr_info->matches)); rtr_info->matches->matched_recs = UT_NEW_NOKEY(rtr_rec_vector()); - rtr_info->matches->bufp = page_align(rtr_info->matches->rec_buf - + UNIV_PAGE_SIZE_MAX + 1); mysql_mutex_init(rtr_match_mutex_key, &rtr_info->matches->rtr_match_mutex, nullptr); - rtr_info->matches->block.page.lock.init(); } rtr_info->path = UT_NEW_NOKEY(rtr_node_path_t()); @@ -1460,18 +1456,16 @@ rtr_clean_rtr_info( if (free_all) { if (rtr_info->matches) { - if (rtr_info->matches->matched_recs != NULL) { - UT_DELETE(rtr_info->matches->matched_recs); + if (rtr_info->matches->block) { + buf_block_free(rtr_info->matches->block); + rtr_info->matches->block = nullptr; } - rtr_info->matches->block.page.lock.free(); + UT_DELETE(rtr_info->matches->matched_recs); mysql_mutex_destroy( &rtr_info->matches->rtr_match_mutex); - } - - if (rtr_info->heap) { - mem_heap_free(rtr_info->heap); + ut_free(rtr_info->matches); } if (initialized) { @@ -1581,7 +1575,7 @@ rtr_check_discard_page( if (auto matches = rtr_info->matches) { mysql_mutex_lock(&matches->rtr_match_mutex); - if (matches->block.page.id() == id) { + if (matches->block->page.id() == id) { matches->matched_recs->clear(); matches->valid = false; } @@ -1595,23 +1589,6 @@ rtr_check_discard_page( lock_sys.prdt_page_free_from_discard(id, true); } -/** Structure acts as functor to get the optimistic access of the page. -It returns true if it successfully gets the page. */ -struct optimistic_get -{ - btr_pcur_t *const r_cursor; - mtr_t *const mtr; - - optimistic_get(btr_pcur_t *r_cursor,mtr_t *mtr) - :r_cursor(r_cursor), mtr(mtr) {} - - bool operator()(buf_block_t *hint) const - { - return hint && buf_page_optimistic_get( - RW_X_LATCH, hint, r_cursor->modify_clock, mtr); - } -}; - /** Restore the stored position of a persistent cursor bufferfixing the page */ static bool @@ -1643,8 +1620,11 @@ rtr_cur_restore_position( r_cursor->modify_clock = 100; ); - if (r_cursor->block_when_stored.run_with_hint( - optimistic_get(r_cursor, mtr))) { + if (buf_page_optimistic_fix(r_cursor->btr_cur.page_cur.block, + r_cursor->old_page_id) + && buf_page_optimistic_get(r_cursor->btr_cur.page_cur.block, + RW_X_LATCH, r_cursor->modify_clock, + mtr)) { ut_ad(r_cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_ad(r_cursor->rel_pos == BTR_PCUR_ON); @@ -1789,7 +1769,7 @@ rtr_leaf_push_match_rec( ulint data_len; rtr_rec_t rtr_rec; - buf = match_rec->block.page.frame + match_rec->used; + buf = match_rec->block->page.frame + match_rec->used; ut_ad(page_rec_is_leaf(rec)); copy = rec_copy(buf, rec, offsets); @@ -1886,43 +1866,6 @@ rtr_non_leaf_insert_stack_push( new_seq, level, child_no, my_cursor, mbr_inc); } -/** Copy a buf_block_t, except "block->page.lock". -@param[in,out] matches copy to match->block -@param[in] block block to copy */ -static -void -rtr_copy_buf( - matched_rec_t* matches, - const buf_block_t* block) -{ - /* Copy all members of "block" to "matches->block" except "lock". - We skip "lock" because it is not used - from the dummy buf_block_t we create here and because memcpy()ing - it generates (valid) compiler warnings that the vtable pointer - will be copied. */ - matches->block.page.lock.free(); - new (&matches->block.page) buf_page_t(block->page); - matches->block.page.frame = block->page.frame; - matches->block.unzip_LRU = block->unzip_LRU; - - ut_d(matches->block.in_unzip_LRU_list = block->in_unzip_LRU_list); - ut_d(matches->block.in_withdraw_list = block->in_withdraw_list); - - /* Skip buf_block_t::lock */ - matches->block.modify_clock = block->modify_clock; -#ifdef BTR_CUR_HASH_ADAPT - matches->block.n_hash_helps = block->n_hash_helps; - matches->block.n_fields = block->n_fields; - matches->block.left_side = block->left_side; -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG - matches->block.n_pointers = 0; -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - matches->block.curr_n_fields = block->curr_n_fields; - matches->block.curr_left_side = block->curr_left_side; - matches->block.index = block->index; -#endif /* BTR_CUR_HASH_ADAPT */ -} - /****************************************************************//** Generate a shadow copy of the page block header to save the matched records */ @@ -1936,16 +1879,18 @@ rtr_init_match( { ut_ad(matches->matched_recs->empty()); matches->locked = false; - rtr_copy_buf(matches, block); - matches->block.page.frame = matches->bufp; matches->valid = false; + if (!matches->block) { + matches->block = buf_block_alloc(); + } + + matches->block->page.init(buf_page_t::MEMORY, block->page.id()); /* We have to copy PAGE_*_SUPREMUM_END bytes so that we can use infimum/supremum of this page as normal btr page for search. */ - memcpy(matches->block.page.frame, page, page_is_comp(page) - ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END); matches->used = page_is_comp(page) ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END; + memcpy(matches->block->page.frame, page, matches->used); #ifdef RTR_SEARCH_DIAGNOSTIC ulint pageno = page_get_page_no(page); fprintf(stderr, "INNODB_RTR: Searching leaf page %d\n", @@ -2372,7 +2317,7 @@ rtr_cur_search_with_match( #endif /* UNIV_DEBUG */ /* Pop the last match record and position on it */ match_rec->matched_recs->pop_back(); - page_cur_position(test_rec.r_rec, &match_rec->block, + page_cur_position(test_rec.r_rec, match_rec->block, cursor); } } else { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 21f9a24cf81..85af433797c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -351,7 +351,7 @@ static TYPELIB innodb_default_row_format_typelib = { }; /** Names of allowed values of innodb_flush_method */ -const char* innodb_flush_method_names[] = { +static const char* innodb_flush_method_names[] = { "fsync", "O_DSYNC", "littlesync", @@ -379,6 +379,18 @@ TYPELIB innodb_flush_method_typelib = { /** Deprecated parameter */ static ulong innodb_flush_method; +/** Names of allowed values of innodb_doublewrite */ +static const char *innodb_doublewrite_names[]= + {"OFF", "ON", "fast", nullptr}; + +/** Enumeration of innodb_doublewrite */ +TYPELIB innodb_doublewrite_typelib= { + array_elements(innodb_doublewrite_names) - 1, + "innodb_doublewrite_typelib", + innodb_doublewrite_names, + nullptr +}; + /** Names of allowed values of innodb_deadlock_report */ static const char *innodb_deadlock_report_names[]= { "off", /* Do not report any details of deadlocks */ @@ -3975,6 +3987,10 @@ static int innodb_init_params() } else if (innodb_flush_method >= 4 /* O_DIRECT */ IF_WIN(&& innodb_flush_method < 8 /* normal */,)) { /* O_DIRECT and similar settings do nothing */ + if (innodb_flush_method == 5 /* O_DIRECT_NO_FSYNC */ + && buf_dblwr.use) { + buf_dblwr.use = buf_dblwr.USE_FAST; + } #ifdef O_DIRECT } else if (srv_use_atomic_writes && my_may_have_atomic_write) { /* If atomic writes are enabled, do the same as with @@ -5812,6 +5828,7 @@ ha_innobase::open(const char* name, int, uint) /* Will be allocated if it is needed in ::update_row() */ m_upd_buf = NULL; m_upd_buf_size = 0; + m_disable_rowid_filter = false; char* is_part = is_partition(norm_name); THD* thd = ha_thd(); @@ -7298,7 +7315,8 @@ ha_innobase::build_template( /* Below we check column by column if we need to access the clustered index. */ - if (pushed_rowid_filter && rowid_filter_is_active) { + if (pushed_rowid_filter && rowid_filter_is_active + && !m_disable_rowid_filter) { fetch_primary_key_cols = TRUE; m_prebuilt->pk_filter = this; } else { @@ -7329,26 +7347,56 @@ ha_innobase::build_template( ulint num_v = 0; - if (active_index != MAX_KEY - && active_index == pushed_idx_cond_keyno) { - m_prebuilt->idx_cond = this; - goto icp; - } else if (pushed_rowid_filter && rowid_filter_is_active) { -icp: - /* Push down an index condition or an end_range check. */ + /* MDEV-31154: For pushed down index condition we don't support virtual + column and idx_cond_push() does check for it. For row ID filtering we + don't need such restrictions but we get into trouble trying to use the + ICP path. + + 1. It should be fine to follow no_icp path if primary key is generated. + However, with user specified primary key(PK), the row is identified by + the PK and those columns need to be converted to mysql format in + row_search_idx_cond_check before doing the comparison. Since secondary + indexes always have PK appended in innodb, it works with current ICP + handling code when fetch_primary_key_cols is set to TRUE. + + 2. Although ICP comparison and Row ID comparison works on different + columns the current ICP code can be shared by both. + + 3. In most cases, it works today by jumping to goto no_icp when we + encounter a virtual column. This is hackish and already have some + issues as it cannot handle PK and all states are not reset properly, + for example, idx_cond_n_cols is not reset. + + 4. We already encountered MDEV-28747 m_prebuilt->idx_cond was being set. + + Neither ICP nor row ID comparison needs virtual columns and the code is + simplified to handle both. It should handle the issues. */ + + const bool pushed_down = active_index != MAX_KEY + && active_index == pushed_idx_cond_keyno + && !m_disable_rowid_filter; + + m_prebuilt->idx_cond = pushed_down ? this : nullptr; + + if (m_prebuilt->idx_cond || m_prebuilt->pk_filter) { + /* Push down an index condition, end_range check or row ID + filter */ for (ulint i = 0; i < n_fields; i++) { const Field* field = table->field[i]; const bool is_v = !field->stored_in_db(); - if (is_v && skip_virtual) { - num_v++; - continue; - } + bool index_contains = index->contains_col_or_prefix( is_v ? num_v : i - num_v, is_v); - if (is_v && index_contains) { - m_prebuilt->n_template = 0; - num_v = 0; - goto no_icp; + + if (is_v) { + if (index_contains) { + /* We want to ensure that ICP is not + used with virtual columns. */ + ut_ad(!pushed_down); + m_prebuilt->idx_cond = nullptr; + } + num_v++; + continue; } /* Test if an end_range or an index condition @@ -7368,7 +7416,7 @@ icp: which would be acceptable if end_range==NULL. */ if (build_template_needs_field_in_icp( index, m_prebuilt, index_contains, - is_v ? num_v : i - num_v, is_v)) { + i - num_v, false)) { if (!whole_row) { field = build_template_needs_field( index_contains, @@ -7377,15 +7425,10 @@ icp: fetch_primary_key_cols, index, table, i, num_v); if (!field) { - if (is_v) { - num_v++; - } continue; } } - ut_ad(!is_v); - mysql_row_templ_t* templ= build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, 0); @@ -7462,15 +7505,16 @@ icp: */ } - if (is_v) { - num_v++; - } } - ut_ad(m_prebuilt->idx_cond_n_cols > 0); - ut_ad(m_prebuilt->idx_cond_n_cols == m_prebuilt->n_template); - num_v = 0; + ut_ad(m_prebuilt->idx_cond_n_cols == m_prebuilt->n_template); + if (m_prebuilt->idx_cond_n_cols == 0) { + /* No columns to push down. It is safe to jump to np ICP + path. */ + m_prebuilt->idx_cond = nullptr; + goto no_icp; + } /* Include the fields that are not needed in index condition pushdown. */ @@ -7485,7 +7529,7 @@ icp: bool index_contains = index->contains_col_or_prefix( is_v ? num_v : i - num_v, is_v); - if (!build_template_needs_field_in_icp( + if (is_v || !build_template_needs_field_in_icp( index, m_prebuilt, index_contains, is_v ? num_v : i - num_v, is_v)) { /* Not needed in ICP */ @@ -7518,7 +7562,7 @@ icp: } else { no_icp: /* No index condition pushdown */ - m_prebuilt->idx_cond = NULL; + ut_ad(!m_prebuilt->idx_cond); ut_ad(num_v == 0); for (ulint i = 0; i < n_fields; i++) { @@ -8672,6 +8716,7 @@ ha_innobase::delete_row( : PLAIN_DELETE; trx->fts_next_doc_id = 0; + ut_ad(!trx->is_bulk_insert()); error = row_update_for_mysql(m_prebuilt); #ifdef WITH_WSREP @@ -8779,47 +8824,63 @@ ha_innobase::index_end(void) DBUG_RETURN(0); } -/*********************************************************************//** -Converts a search mode flag understood by MySQL to a flag understood -by InnoDB. */ -page_cur_mode_t -convert_search_mode_to_innobase( -/*============================*/ - ha_rkey_function find_flag) +/** Convert a MariaDB search mode to an InnoDB search mode. +@tparam last_match whether last_match_mode is to be set +@param find_flag MariaDB search mode +@param mode InnoDB search mode +@param last_match_mode pointer to ha_innobase::m_last_match_mode +@return whether the search mode is unsupported */ +template +static bool convert_search_mode_to_innobase(ha_rkey_function find_flag, + page_cur_mode_t &mode, + uint *last_match_mode= nullptr) { - switch (find_flag) { - case HA_READ_KEY_EXACT: - /* this does not require the index to be UNIQUE */ - case HA_READ_KEY_OR_NEXT: - return(PAGE_CUR_GE); - case HA_READ_AFTER_KEY: - return(PAGE_CUR_G); - case HA_READ_BEFORE_KEY: - return(PAGE_CUR_L); - case HA_READ_KEY_OR_PREV: - case HA_READ_PREFIX_LAST: - case HA_READ_PREFIX_LAST_OR_PREV: - return(PAGE_CUR_LE); - case HA_READ_MBR_CONTAIN: - return(PAGE_CUR_CONTAIN); - case HA_READ_MBR_INTERSECT: - return(PAGE_CUR_INTERSECT); - case HA_READ_MBR_WITHIN: - return(PAGE_CUR_WITHIN); - case HA_READ_MBR_DISJOINT: - return(PAGE_CUR_DISJOINT); - case HA_READ_MBR_EQUAL: - return(PAGE_CUR_MBR_EQUAL); - case HA_READ_PREFIX: - return(PAGE_CUR_UNSUPP); - /* do not use "default:" in order to produce a gcc warning: - enumeration value '...' not handled in switch - (if -Wswitch or -Wall is used) */ - } + mode= PAGE_CUR_LE; + if (last_match) + *last_match_mode= 0; - my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "this functionality"); + switch (find_flag) { + case HA_READ_KEY_EXACT: + /* this does not require the index to be UNIQUE */ + if (last_match) + *last_match_mode= ROW_SEL_EXACT; + /* fall through */ + case HA_READ_KEY_OR_NEXT: + mode= PAGE_CUR_GE; + return false; + case HA_READ_AFTER_KEY: + mode= PAGE_CUR_G; + return false; + case HA_READ_BEFORE_KEY: + mode= PAGE_CUR_L; + return false; + case HA_READ_PREFIX_LAST: + if (last_match) + *last_match_mode= ROW_SEL_EXACT_PREFIX; + /* fall through */ + case HA_READ_KEY_OR_PREV: + case HA_READ_PREFIX_LAST_OR_PREV: + return false; + case HA_READ_MBR_CONTAIN: + mode= PAGE_CUR_CONTAIN; + return false; + case HA_READ_MBR_INTERSECT: + mode= PAGE_CUR_INTERSECT; + return false; + case HA_READ_MBR_WITHIN: + mode= PAGE_CUR_WITHIN; + return false; + case HA_READ_MBR_DISJOINT: + mode= PAGE_CUR_DISJOINT; + return false; + case HA_READ_MBR_EQUAL: + mode= PAGE_CUR_MBR_EQUAL; + return false; + case HA_READ_PREFIX: + break; + } - return(PAGE_CUR_UNSUPP); + return true; } /* @@ -8897,8 +8958,7 @@ ha_innobase::index_read( mariadb_set_stats set_stats_temporary(handler_stats); DEBUG_SYNC_C("ha_innobase_index_read_begin"); - ut_a(m_prebuilt->trx == thd_to_trx(m_user_thd)); - ut_ad(key_len != 0 || find_flag != HA_READ_KEY_EXACT); + ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd)); dict_index_t* index = m_prebuilt->index; @@ -8934,7 +8994,8 @@ ha_innobase::index_read( build_template(false); } - if (key_ptr != NULL) { + if (key_len) { + ut_ad(key_ptr); /* Convert the search key value to InnoDB format into m_prebuilt->search_tuple */ @@ -8944,84 +9005,58 @@ ha_innobase::index_read( m_prebuilt->srch_key_val_len, index, (byte*) key_ptr, - (ulint) key_len); + key_len); DBUG_ASSERT(m_prebuilt->search_tuple->n_fields > 0); } else { + ut_ad(find_flag != HA_READ_KEY_EXACT); /* We position the cursor to the last or the first entry in the index */ dtuple_set_n_fields(m_prebuilt->search_tuple, 0); } - page_cur_mode_t mode = convert_search_mode_to_innobase(find_flag); + page_cur_mode_t mode; - ulint match_mode = 0; - - if (find_flag == HA_READ_KEY_EXACT) { - - match_mode = ROW_SEL_EXACT; - - } else if (find_flag == HA_READ_PREFIX_LAST) { - - match_mode = ROW_SEL_EXACT_PREFIX; + if (convert_search_mode_to_innobase(find_flag, mode, + &m_last_match_mode)) { + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_UNSUPPORTED); } - m_last_match_mode = (uint) match_mode; - - dberr_t ret = mode == PAGE_CUR_UNSUPP ? DB_UNSUPPORTED - : row_search_mvcc(buf, mode, m_prebuilt, match_mode, 0); + dberr_t ret = + row_search_mvcc(buf, mode, m_prebuilt, m_last_match_mode, 0); DBUG_EXECUTE_IF("ib_select_query_failure", ret = DB_ERROR;); - int error; + if (UNIV_LIKELY(ret == DB_SUCCESS)) { + table->status = 0; + DBUG_RETURN(0); + } + + table->status = STATUS_NOT_FOUND; switch (ret) { - case DB_SUCCESS: - error = 0; - table->status = 0; - break; - - case DB_RECORD_NOT_FOUND: - error = HA_ERR_KEY_NOT_FOUND; - table->status = STATUS_NOT_FOUND; - break; - - case DB_END_OF_INDEX: - error = HA_ERR_KEY_NOT_FOUND; - table->status = STATUS_NOT_FOUND; - break; - case DB_TABLESPACE_DELETED: ib_senderrf( m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR, ER_TABLESPACE_DISCARDED, table->s->table_name.str); - - table->status = STATUS_NOT_FOUND; - error = HA_ERR_TABLESPACE_MISSING; - break; - + DBUG_RETURN(HA_ERR_TABLESPACE_MISSING); + case DB_RECORD_NOT_FOUND: + case DB_END_OF_INDEX: + DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); case DB_TABLESPACE_NOT_FOUND: - ib_senderrf( m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR, ER_TABLESPACE_MISSING, table->s->table_name.str); - - table->status = STATUS_NOT_FOUND; - error = HA_ERR_TABLESPACE_MISSING; - break; - + DBUG_RETURN(HA_ERR_TABLESPACE_MISSING); default: - error = convert_error_code_to_mysql( - ret, m_prebuilt->table->flags, m_user_thd); - - table->status = STATUS_NOT_FOUND; - break; + DBUG_RETURN(convert_error_code_to_mysql( + ret, m_prebuilt->table->flags, + m_user_thd)); } - - DBUG_RETURN(error); } /*******************************************************************//** @@ -9371,6 +9406,11 @@ ha_innobase::rnd_init( { int err; + /* Don't use rowid filter when doing full table scan or rnd_pos calls.*/ + if (!scan) { + m_disable_rowid_filter = true; + } + /* Store the active index value so that we can restore the original value after a scan */ @@ -9380,6 +9420,12 @@ ha_innobase::rnd_init( err = change_active_index(m_primary_key); } + if (err && !scan) { + /* Restore the original value in case of error */ + m_disable_rowid_filter = false; + } + + /* Don't use semi-consistent read in random row reads (by position). This means we must disable semi_consistent_read if scan is false */ @@ -9400,6 +9446,7 @@ int ha_innobase::rnd_end(void) /*======================*/ { + m_disable_rowid_filter = false; return(index_end()); } @@ -9448,11 +9495,10 @@ ha_innobase::rnd_pos( DBUG_ENTER("rnd_pos"); DBUG_DUMP("key", pos, ref_length); - ut_a(m_prebuilt->trx == thd_to_trx(ha_thd())); - /* Note that we assume the length of the row reference is fixed for the table, and it is == ref_length */ + DBUG_ASSERT(m_disable_rowid_filter == true); int error = index_read(buf, pos, (uint)ref_length, HA_READ_KEY_EXACT); if (error != 0) { @@ -9878,7 +9924,8 @@ wsrep_append_foreign_key( } ulint rcode = DB_SUCCESS; - char cache_key[513] = {'\0'}; + char cache_key[MAX_FULL_NAME_LEN] = {'\0'}; + char db_name[MAX_DATABASE_NAME_LEN+1] = {'\0'}; size_t cache_key_len = 0; if ( !((referenced) ? @@ -9968,14 +10015,38 @@ wsrep_append_foreign_key( return DB_ERROR; } - strncpy(cache_key, + char * fk_table = (wsrep_protocol_version > 1) ? ((referenced) ? foreign->referenced_table->name.m_name : foreign->foreign_table->name.m_name) : - foreign->foreign_table->name.m_name, sizeof(cache_key) - 1); - cache_key_len = strlen(cache_key); + foreign->foreign_table->name.m_name; + /* convert db and table name parts separately to system charset */ + ulint db_name_len = dict_get_db_name_len(fk_table); + strmake(db_name, fk_table, db_name_len); + uint errors; + cache_key_len= innobase_convert_to_system_charset(cache_key, + db_name, sizeof(cache_key), &errors); + if (errors) { + WSREP_WARN("unexpected foreign key table %s %s", + foreign->referenced_table->name.m_name, + foreign->foreign_table->name.m_name); + return DB_ERROR; + } + + /* after db name adding 0 and then converted table name */ + cache_key[db_name_len]= '\0'; + cache_key_len++; + + cache_key_len+= innobase_convert_to_system_charset(cache_key+cache_key_len, + fk_table+db_name_len+1, sizeof(cache_key), &errors); + if (errors) { + WSREP_WARN("unexpected foreign key table %s %s", + foreign->referenced_table->name.m_name, + foreign->foreign_table->name.m_name); + return DB_ERROR; + } #ifdef WSREP_DEBUG_PRINT ulint j; fprintf(stderr, "FK parent key, table: %s %s len: %lu ", @@ -9985,16 +10056,6 @@ wsrep_append_foreign_key( } fprintf(stderr, "\n"); #endif - char *p = strchr(cache_key, '/'); - - if (p) { - *p = '\0'; - } else { - WSREP_WARN("unexpected foreign key table %s %s", - foreign->referenced_table->name.m_name, - foreign->foreign_table->name.m_name); - } - wsrep_buf_t wkey_part[3]; wsrep_key_t wkey = {wkey_part, 3}; @@ -14193,14 +14254,14 @@ ha_innobase::records_in_range( dict_index_t* index; dtuple_t* range_start; dtuple_t* range_end; - ha_rows n_rows; + ha_rows n_rows = HA_POS_ERROR; page_cur_mode_t mode1; page_cur_mode_t mode2; mem_heap_t* heap; DBUG_ENTER("records_in_range"); - ut_a(m_prebuilt->trx == thd_to_trx(ha_thd())); + ut_ad(m_prebuilt->trx == thd_to_trx(ha_thd())); m_prebuilt->trx->op_info = "estimating records in index range"; @@ -14213,12 +14274,7 @@ ha_innobase::records_in_range( /* There exists possibility of not being able to find requested index due to inconsistency between MySQL and InoDB dictionary info. Necessary message should have been printed in innobase_get_index() */ - if (!m_prebuilt->table->space) { - n_rows = HA_POS_ERROR; - goto func_exit; - } - if (!index) { - n_rows = HA_POS_ERROR; + if (!index || !m_prebuilt->table->space) { goto func_exit; } if (index->is_corrupted()) { @@ -14234,61 +14290,50 @@ ha_innobase::records_in_range( + sizeof(dtuple_t))); range_start = dtuple_create(heap, key->ext_key_parts); - dict_index_copy_types(range_start, index, key->ext_key_parts); range_end = dtuple_create(heap, key->ext_key_parts); - dict_index_copy_types(range_end, index, key->ext_key_parts); - row_sel_convert_mysql_key_to_innobase( - range_start, - m_prebuilt->srch_key_val1, - m_prebuilt->srch_key_val_len, - index, - (byte*) (min_key ? min_key->key : (const uchar*) 0), - (ulint) (min_key ? min_key->length : 0)); - - DBUG_ASSERT(min_key - ? range_start->n_fields > 0 - : range_start->n_fields == 0); - - row_sel_convert_mysql_key_to_innobase( - range_end, - m_prebuilt->srch_key_val2, - m_prebuilt->srch_key_val_len, - index, - (byte*) (max_key ? max_key->key : (const uchar*) 0), - (ulint) (max_key ? max_key->length : 0)); - - DBUG_ASSERT(max_key - ? range_end->n_fields > 0 - : range_end->n_fields == 0); - - mode1 = convert_search_mode_to_innobase( - min_key ? min_key->flag : HA_READ_KEY_EXACT); - - mode2 = convert_search_mode_to_innobase( - max_key ? max_key->flag : HA_READ_KEY_EXACT); - - if (mode1 != PAGE_CUR_UNSUPP && mode2 != PAGE_CUR_UNSUPP) { - - if (dict_index_is_spatial(index)) { - /*Only min_key used in spatial index. */ - n_rows = rtr_estimate_n_rows_in_range( - index, range_start, mode1); - } else { - btr_pos_t tuple1(range_start, mode1, pages->first_page); - btr_pos_t tuple2(range_end, mode2, pages->last_page); - n_rows = btr_estimate_n_rows_in_range( - index, &tuple1, &tuple2); - pages->first_page= tuple1.page_id.raw(); - pages->last_page= tuple2.page_id.raw(); - } + if (!min_key) { + mode1 = PAGE_CUR_GE; + dtuple_set_n_fields(range_start, 0); + } else if (convert_search_mode_to_innobase(min_key->flag, mode1)) { + goto unsupported; } else { - - n_rows = HA_POS_ERROR; + dict_index_copy_types(range_start, index, key->ext_key_parts); + row_sel_convert_mysql_key_to_innobase( + range_start, + m_prebuilt->srch_key_val1, + m_prebuilt->srch_key_val_len, + index, min_key->key, min_key->length); + DBUG_ASSERT(range_start->n_fields > 0); } - mem_heap_free(heap); + if (!max_key) { + mode2 = PAGE_CUR_GE; + dtuple_set_n_fields(range_end, 0); + } else if (convert_search_mode_to_innobase(max_key->flag, mode2)) { + goto unsupported; + } else { + dict_index_copy_types(range_end, index, key->ext_key_parts); + row_sel_convert_mysql_key_to_innobase( + range_end, + m_prebuilt->srch_key_val2, + m_prebuilt->srch_key_val_len, + index, max_key->key, max_key->length); + DBUG_ASSERT(range_end->n_fields > 0); + } + + if (dict_index_is_spatial(index)) { + /*Only min_key used in spatial index. */ + n_rows = rtr_estimate_n_rows_in_range( + index, range_start, mode1); + } else { + btr_pos_t tuple1(range_start, mode1, pages->first_page); + btr_pos_t tuple2(range_end, mode2, pages->last_page); + n_rows = btr_estimate_n_rows_in_range(index, &tuple1, &tuple2); + pages->first_page= tuple1.page_id.raw(); + pages->last_page= tuple2.page_id.raw(); + } DBUG_EXECUTE_IF( "print_btr_estimate_n_rows_in_range_return_value", @@ -14299,11 +14344,7 @@ ha_innobase::records_in_range( (longlong) n_rows); ); -func_exit: - - m_prebuilt->trx->op_info = (char*)""; - - /* The MySQL optimizer seems to believe an estimate of 0 rows is + /* The MariaDB optimizer seems to believe an estimate of 0 rows is always accurate and may return the result 'Empty set' based on that. The accuracy is not guaranteed, and even if it were, for a locking read we should anyway perform the search to set the next-key lock. @@ -14313,6 +14354,10 @@ func_exit: n_rows = 1; } +unsupported: + mem_heap_free(heap); +func_exit: + m_prebuilt->trx->op_info = ""; DBUG_RETURN((ha_rows) n_rows); } @@ -15782,7 +15827,7 @@ ha_innobase::start_stmt( } /* fall through */ default: - trx->end_bulk_insert(*m_prebuilt->table); + trx->bulk_insert_apply_for_table(m_prebuilt->table); if (!trx->bulk_insert) { break; } @@ -15976,7 +16021,7 @@ ha_innobase::external_lock( } /* fall through */ default: - trx->end_bulk_insert(*m_prebuilt->table); + trx->bulk_insert_apply_for_table(m_prebuilt->table); if (!trx->bulk_insert) { break; } @@ -18402,6 +18447,12 @@ static void innodb_data_file_write_through_update(THD *, st_mysql_sys_var*, mysql_mutex_lock(&LOCK_global_system_variables); } +static void innodb_doublewrite_update(THD *, st_mysql_sys_var*, + void *, const void *save) +{ + fil_system.set_use_doublewrite(*static_cast(save)); +} + static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, void *var, const void *save) { @@ -18735,11 +18786,14 @@ static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, "The common part for InnoDB table spaces.", NULL, NULL, NULL); -static MYSQL_SYSVAR_BOOL(doublewrite, srv_use_doublewrite_buf, - PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "Enable InnoDB doublewrite buffer (enabled by default)." - " Disable with --skip-innodb-doublewrite.", - NULL, NULL, TRUE); +static MYSQL_SYSVAR_ENUM(doublewrite, buf_dblwr.use, + PLUGIN_VAR_OPCMDARG, + "Whether and how to use the doublewrite buffer. " + "OFF=Assume that writes of innodb_page_size are atomic; " + "ON=Prevent torn writes (the default); " + "fast=Like ON, but do not synchronize writes to data files", + nullptr, innodb_doublewrite_update, true, + &innodb_doublewrite_typelib); static MYSQL_SYSVAR_BOOL(use_atomic_writes, srv_use_atomic_writes, PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, @@ -19223,10 +19277,10 @@ static MYSQL_SYSVAR_ULONG(page_size, srv_page_size, NULL, NULL, UNIV_PAGE_SIZE_DEF, UNIV_PAGE_SIZE_MIN, UNIV_PAGE_SIZE_MAX, 0); -static MYSQL_SYSVAR_SIZE_T(log_buffer_size, log_sys.buf_size, +static MYSQL_SYSVAR_UINT(log_buffer_size, log_sys.buf_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Redo log buffer size in bytes.", - NULL, NULL, 16U << 20, 2U << 20, SIZE_T_MAX, 4096); + NULL, NULL, 16U << 20, 2U << 20, log_sys.buf_size_max, 4096); #if defined __linux__ || defined _WIN32 static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered, diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 3c9d2def05c..86ece0df63b 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -522,6 +522,10 @@ protected: /** If mysql has locked with external_lock() */ bool m_mysql_has_locked; + + /** If true, disable the Rowid Filter. It is disabled when + the enigne is intialized for making rnd_pos() calls */ + bool m_disable_rowid_filter; }; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 9bd942796ff..560840c53a0 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1728,11 +1728,9 @@ instant_alter_column_possible( ut_ad(!is_null || nullable); n_nullable += nullable; n_add++; - uint l; + uint l = (*af)->pack_length(); switch ((*af)->type()) { case MYSQL_TYPE_VARCHAR: - l = reinterpret_cast - (*af)->get_length(); variable_length: if (l >= min_local_len) { max_size += blob_prefix @@ -1746,7 +1744,6 @@ instant_alter_column_possible( if (!is_null) { min_size += l; } - l = (*af)->pack_length(); max_size += l; lenlen += l > 255 ? 2 : 1; } @@ -1760,7 +1757,6 @@ instant_alter_column_possible( ((*af))->get_length(); goto variable_length; default: - l = (*af)->pack_length(); if (l > 255 && ib_table.not_redundant()) { goto variable_length; } @@ -7457,6 +7453,7 @@ error_handled: row_mysql_lock_data_dictionary(ctx->trx); } else { row_merge_drop_indexes(ctx->trx, user_table, true); + user_table->indexes.start->online_log = nullptr; ctx->trx->commit(); } @@ -10253,6 +10250,7 @@ when rebuilding the table. @param ctx In-place ALTER TABLE context @param altered_table MySQL table that is being altered @param old_table MySQL table as it is before the ALTER operation +@param statistics_exist whether to update InnoDB persistent statistics @param trx Data dictionary transaction @param table_name Table name in MySQL @retval true Failure @@ -10536,6 +10534,7 @@ when not rebuilding the table. @param ha_alter_info Data used during in-place alter @param ctx In-place ALTER TABLE context @param old_table MySQL table as it is before the ALTER operation +@param statistics_exist whether to update InnoDB persistent statistics @param trx Data dictionary transaction @param table_name Table name in MySQL @retval true Failure @@ -10549,6 +10548,7 @@ commit_try_norebuild( ha_innobase_inplace_ctx*ctx, TABLE* altered_table, const TABLE* old_table, + bool statistics_exist, trx_t* trx, const char* table_name) { @@ -10663,6 +10663,10 @@ commit_try_norebuild( goto handle_error; } + if (!statistics_exist) { + continue; + } + error = dict_stats_delete_from_index_stats(db, table, index->name, trx); switch (error) { @@ -10674,7 +10678,8 @@ commit_try_norebuild( } } - if (const size_t size = ha_alter_info->rename_keys.size()) { + if (!statistics_exist) { + } 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]; @@ -11421,6 +11426,8 @@ err_index: } } + DEBUG_SYNC(m_user_thd, "innodb_commit_inplace_before_lock"); + DBUG_EXECUTE_IF("stats_lock_fail", error = DB_LOCK_WAIT_TIMEOUT; trx_rollback_for_mysql(trx);); @@ -11504,7 +11511,9 @@ fail: goto fail; } } else if (commit_try_norebuild(ha_alter_info, ctx, - altered_table, table, trx, + altered_table, table, + table_stats && index_stats, + trx, table_share->table_name.str)) { goto fail; } diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 4fff8bed133..5d0b2557fe4 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -22,6 +22,7 @@ this program; if not, write to the Free Software Foundation, Inc., Upgrade and removal of the InnoDB change buffer */ +#include #include "ibuf0ibuf.h" #include "btr0sea.h" #include "btr0pcur.h" @@ -256,7 +257,8 @@ func_exit: const uint32_t page_no= flst_get_last(PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST + root->page.frame).page; - if (page_no == FIL_NULL) + + if (page_no == FIL_NULL || page_no >= fil_system.sys_space->free_limit) { mtr.set_modified(*root); fsp_init_file_page(fil_system.sys_space, root, &mtr); @@ -288,7 +290,8 @@ func_exit: buf_page_get_gen(page_id_t{0, page_no}, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr, &err)) err= flst_remove(root, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, - block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr); + block, PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, + fil_system.sys_space->free_limit, &mtr); if (err == DB_SUCCESS) buf_page_free(fil_system.sys_space, page_no, &mtr); diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index c66a3bfa329..5f84328da19 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -28,7 +28,6 @@ Created 2/23/1996 Heikki Tuuri #include "dict0dict.h" #include "btr0cur.h" -#include "buf0block_hint.h" #include "btr0btr.h" #include "gis0rtree.h" @@ -332,8 +331,8 @@ struct btr_pcur_t /** BTR_PCUR_ON, BTR_PCUR_BEFORE, or BTR_PCUR_AFTER, depending on whether cursor was on, before, or after the old_rec record */ btr_pcur_pos_t rel_pos= btr_pcur_pos_t(0); - /** buffer block when the position was stored */ - buf::Block_hint block_when_stored; + /** the page identifier of old_rec */ + page_id_t old_page_id{0,0}; /** the modify clock value of the buffer block when the cursor position was stored */ ib_uint64_t modify_clock= 0; @@ -432,7 +431,8 @@ btr_pcur_open( } /** Open a cursor on the first user record satisfying the search condition; -in case of no match, after the last index record. */ +in case of no match, after the last index record. +@return DB_SUCCESS or error code */ MY_ATTRIBUTE((nonnull, warn_unused_result)) inline dberr_t diff --git a/storage/innobase/include/buf0block_hint.h b/storage/innobase/include/buf0block_hint.h deleted file mode 100644 index d4fee7c1e99..00000000000 --- a/storage/innobase/include/buf0block_hint.h +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2020, MariaDB Corporation. -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License, version 2.0, as published by the -Free Software Foundation. - -This program is also distributed with certain software (including but not -limited to OpenSSL) that is licensed under separate terms, as designated in a -particular file or component or in included license documentation. The authors -of MySQL hereby grant you an additional permission to link the program and -your derivative works with the separately licensed software that they have -included with MySQL. - -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, version 2.0, -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-1301 USA - -*****************************************************************************/ -#pragma once -#include "buf0buf.h" - -namespace buf { -class Block_hint { -public: - /** Stores the pointer to the block, which is currently buffer-fixed. - @param block a pointer to a buffer-fixed block to be stored */ - inline void store(buf_block_t *block) - { - ut_ad(block->page.buf_fix_count()); - m_block= block; - m_page_id= block->page.id(); - } - - /** Clears currently stored pointer. */ - inline void clear() { m_block= nullptr; } - - /** Invoke f on m_block(which may be null) - @param f The function to be executed. It will be passed the pointer. - If you wish to use the block pointer subsequently, - you need to ensure you buffer-fix it before returning from f. - @return the return value of f - */ - template - bool run_with_hint(const F &f) - { - buffer_fix_block_if_still_valid(); - /* m_block could be changed during f() call, so we use local - variable to remember which block we need to unfix */ - buf_block_t *block= m_block; - bool res= f(block); - if (block) - block->page.unfix(); - return res; - } - - buf_block_t *block() const { return m_block; } - - private: - /** The block pointer stored by store(). */ - buf_block_t *m_block= nullptr; - /** If m_block is non-null, the m_block->page.id at time it was stored. */ - page_id_t m_page_id{0, 0}; - - /** A helper function which checks if m_block is not a dangling pointer and - still points to block with page with m_page_id and if so, buffer-fixes it, - otherwise clear()s it */ - void buffer_fix_block_if_still_valid(); -}; -} // namespace buf diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index c12708a0f15..e154f788820 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -154,14 +154,25 @@ buf_block_free( #define buf_page_get(ID, SIZE, LA, MTR) \ buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, MTR) -/** Try to acquire a page latch. -@param rw_latch RW_S_LATCH or RW_X_LATCH +/** Try to buffer-fix a page. @param block guessed block +@param id expected block->page.id() +@return block if it was buffer-fixed +@retval nullptr if the block no longer is valid */ +buf_block_t *buf_page_optimistic_fix(buf_block_t *block, page_id_t id) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +/** Try to acquire a page latch after buf_page_optimistic_fix(). +@param block buffer-fixed block +@param rw_latch RW_S_LATCH or RW_X_LATCH @param modify_clock expected value of block->modify_clock @param mtr mini-transaction -@return whether the latch was acquired (the page is an allocated file page) */ -bool buf_page_optimistic_get(ulint rw_latch, buf_block_t *block, - uint64_t modify_clock, mtr_t *mtr); +@return block if the latch was acquired +@retval nullptr if block->unfix() was called because it no longer is valid */ +buf_block_t *buf_page_optimistic_get(buf_block_t *block, + rw_lock_type_t rw_latch, + uint64_t modify_clock, mtr_t *mtr) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Try to S-latch a page. Suitable for using when holding the lock_sys latches (as it avoids deadlock). @@ -256,15 +267,6 @@ on the block. */ UNIV_INLINE void buf_block_modify_clock_inc( -/*=======================*/ - buf_block_t* block); /*!< in: block */ -/********************************************************************//** -Returns the value of the modify clock. The caller must have an s-lock -or x-lock on the block. -@return value */ -UNIV_INLINE -ib_uint64_t -buf_block_get_modify_clock( /*=======================*/ buf_block_t* block); /*!< in: block */ #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/buf0buf.inl b/storage/innobase/include/buf0buf.inl index 1fc463a8341..048e3d15906 100644 --- a/storage/innobase/include/buf0buf.inl +++ b/storage/innobase/include/buf0buf.inl @@ -116,17 +116,3 @@ buf_block_modify_clock_inc( block->modify_clock++; } - -/********************************************************************//** -Returns the value of the modify clock. The caller must have an s-lock -or x-lock on the block. -@return value */ -UNIV_INLINE -ib_uint64_t -buf_block_get_modify_clock( -/*=======================*/ - buf_block_t* block) /*!< in: block */ -{ - ut_ad(block->page.lock.have_any()); - return(block->modify_clock); -} diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index 6e7662d9b81..f912775de59 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -53,9 +53,9 @@ class buf_dblwr_t element* buf_block_arr; }; - /** the page number of the first doublewrite block (block_size() pages) */ + /** the page number of the first doublewrite block (block_size pages) */ page_id_t block1{0, 0}; - /** the page number of the second doublewrite block (block_size() pages) */ + /** the page number of the second doublewrite block (block_size pages) */ page_id_t block2{0, 0}; /** mutex protecting the data members below */ @@ -74,6 +74,22 @@ class buf_dblwr_t slot slots[2]; slot *active_slot; + /** Size of the doublewrite block in pages */ + uint32_t block_size; + +public: + /** Values of use */ + enum usage { + /** Assume that writes are atomic */ + USE_NO= 0, + /** Use the doublewrite buffer with full durability */ + USE_YES, + /** Durable writes to the doublewrite buffer, not to data files */ + USE_FAST + }; + /** The value of innodb_doublewrite */ + ulong use; +private: /** Initialise the persistent storage of the doublewrite buffer. @param header doublewrite page header in the TRX_SYS page */ inline void init(const byte *header); @@ -126,9 +142,6 @@ public: @param request the completed batch write request */ void flush_buffered_writes_completed(const IORequest &request); - /** Size of the doublewrite block in pages */ - uint32_t block_size() const { return FSP_EXTENT_SIZE; } - /** Schedule a page write. If the doublewrite memory buffer is full, flush_buffered_writes() will be invoked to make space. @param request asynchronous write request @@ -139,6 +152,19 @@ public: bool is_created() const { return UNIV_LIKELY(block1 != page_id_t(0, 0)); } + /** @return whether the doublewrite buffer is in use */ + bool in_use() const { return is_created() && use; } + /** @return whether fsync() is needed on non-doublewrite pages */ + bool need_fsync() const { return use < USE_FAST; } + + void set_use(ulong use) + { + ut_ad(use <= USE_FAST); + mysql_mutex_lock(&mutex); + this->use= use; + mysql_mutex_unlock(&mutex); + } + /** @return whether a page identifier is part of the doublewrite buffer */ bool is_inside(const page_id_t id) const { @@ -147,8 +173,8 @@ public: ut_ad(block1 < block2); if (id < block1) return false; - const uint32_t size= block_size(); - return id < block1 + size || (id >= block2 && id < block2 + size); + return id < block1 + block_size || + (id >= block2 && id < block2 + block_size); } /** Wait for flush_buffered_writes() to be fully completed */ diff --git a/storage/innobase/include/cache.h b/storage/innobase/include/cache.h new file mode 100644 index 00000000000..0647cbe6dc4 --- /dev/null +++ b/storage/innobase/include/cache.h @@ -0,0 +1,33 @@ +/***************************************************************************** + +Copyright (c) 2024, MariaDB plc + +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 02110-1335 USA + +*****************************************************************************/ + +#pragma once +#include + +#if defined __x86_64__ || defined __aarch64__ || defined __powerpc64__ +struct pmem_control +{ + void (*persist)(const void *, size_t); +public: + pmem_control(); +}; +extern const pmem_control pmem; +# define pmem_persist(buf, size) pmem.persist(buf, size) +#else +void pmem_persist(const void *buf, size_t size); +#endif diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index a5356e0d1a3..fcb543ebb1a 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -339,15 +339,12 @@ dtuple_set_types_binary( dtuple_t* tuple, /*!< in: data tuple */ ulint n) /*!< in: number of fields to set */ MY_ATTRIBUTE((nonnull)); -/**********************************************************************//** -Checks if a dtuple contains an SQL null value. -@return TRUE if some field is SQL null */ +/** Checks if a dtuple contains an SQL null value. +@param tuple tuple +@param fields_number number of fields in the tuple to check +@return true if some field is SQL null */ UNIV_INLINE -ibool -dtuple_contains_null( -/*=================*/ - const dtuple_t* tuple) /*!< in: dtuple */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); +bool dtuple_contains_null(const dtuple_t *tuple, ulint fields_number = 0); /**********************************************************//** Checks that a data field is typed. Asserts an error if not. @return TRUE if ok */ diff --git a/storage/innobase/include/data0data.inl b/storage/innobase/include/data0data.inl index 2d1bf5a2d50..b6c6ace8dc0 100644 --- a/storage/innobase/include/data0data.inl +++ b/storage/innobase/include/data0data.inl @@ -596,28 +596,18 @@ data_write_sql_null( memset(data, 0, len); } -/**********************************************************************//** -Checks if a dtuple contains an SQL null value. -@return TRUE if some field is SQL null */ +/** Checks if a dtuple contains an SQL null value. +@param tuple tuple +@param fields_number number of fields in the tuple to check +@return true if some field is SQL null */ UNIV_INLINE -ibool -dtuple_contains_null( -/*=================*/ - const dtuple_t* tuple) /*!< in: dtuple */ +bool dtuple_contains_null(const dtuple_t *tuple, ulint fields_number) { - ulint n; - ulint i; - - n = dtuple_get_n_fields(tuple); - - for (i = 0; i < n; i++) { - if (dfield_is_null(dtuple_get_nth_field(tuple, i))) { - - return(TRUE); - } - } - - return(FALSE); + ulint n= fields_number ? fields_number : dtuple_get_n_fields(tuple); + for (ulint i= 0; i < n; i++) + if (dfield_is_null(dtuple_get_nth_field(tuple, i))) + return true; + return false; } /**************************************************************//** diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 1fac79e78b1..52bb4777202 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1006,8 +1006,6 @@ struct dict_index_t { /*!< number of columns the user defined to be in the index: in the internal representation we add more columns */ - unsigned nulls_equal:1; - /*!< if true, SQL NULL == SQL NULL */ unsigned n_uniq:10;/*!< number of fields from the beginning which are enough to determine an index entry uniquely */ diff --git a/storage/innobase/include/dict0mem.inl b/storage/innobase/include/dict0mem.inl index d60ee5d9bf4..edb7cf92cd5 100644 --- a/storage/innobase/include/dict0mem.inl +++ b/storage/innobase/include/dict0mem.inl @@ -63,6 +63,5 @@ dict_mem_fill_index_struct( & index->MAX_N_FIELDS; /* The '1 +' above prevents allocation of an empty mem block */ - index->nulls_equal = false; ut_d(index->magic_n = DICT_INDEX_MAGIC_N); } diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h index c2fc93c4cf3..7a4e6760019 100644 --- a/storage/innobase/include/dyn0buf.h +++ b/storage/innobase/include/dyn0buf.h @@ -149,8 +149,7 @@ public: /** Storage */ byte m_data[MAX_DATA_SIZE]; - /** number of data bytes used in this block; - DYN_BLOCK_FULL_FLAG is set when the block becomes full */ + /** number of data bytes used in this block */ uint32_t m_used; friend class mtr_buf_t; diff --git a/storage/innobase/include/dyn0types.h b/storage/innobase/include/dyn0types.h index 83d0b0d64c2..af7f663d970 100644 --- a/storage/innobase/include/dyn0types.h +++ b/storage/innobase/include/dyn0types.h @@ -33,7 +33,4 @@ Created 2013-03-16 Sunny Bains /** This is the initial 'payload' size of a dynamic array */ #define DYN_ARRAY_DATA_SIZE 512 -/** Flag for dyn_block_t::used that indicates a full block */ -#define DYN_BLOCK_FULL_FLAG 0x1000000UL - #endif /* dyn0types_h */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 1f9b329efa3..94de29f494c 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -48,9 +48,6 @@ struct named_spaces_tag_t; using space_list_t= ilist; -// Forward declaration -extern my_bool srv_use_doublewrite_buf; - /** Undo tablespaces starts with space_id. */ extern uint32_t srv_undo_space_id_start; /** The number of UNDO tablespaces that are open and ready to use. */ @@ -1008,6 +1005,9 @@ public: /** @return the tablespace name (databasename/tablename) */ name_type name() const; + /** Update the data structures on write completion */ + void complete_write(); + private: /** @return whether the file is usable for io() */ ATTRIBUTE_COLD bool prepare_acquired(); @@ -1080,9 +1080,6 @@ struct fil_node_t final @return detached handle or OS_FILE_CLOSED */ inline pfs_os_file_t close_to_free(bool detach_handle= false); - /** Update the data structures on write completion */ - inline void complete_write(); - private: /** Does stuff common for close() and detach() */ void prepare_to_close_or_detach(); @@ -1090,8 +1087,7 @@ private: inline bool fil_space_t::use_doublewrite() const { - return !UT_LIST_GET_FIRST(chain)->atomic_write && srv_use_doublewrite_buf && - buf_dblwr.is_created(); + return !UT_LIST_GET_FIRST(chain)->atomic_write && buf_dblwr.in_use(); } inline void fil_space_t::set_imported() @@ -1352,9 +1348,9 @@ struct fil_system_t Some members may require late initialisation, thus we just mark object as uninitialised. Real initialisation happens in create(). */ - fil_system_t() : m_initialised(false) {} + fil_system_t() {} - bool is_initialised() const { return m_initialised; } + bool is_initialised() const { return spaces.array; } /** Create the file system interface at database start. @@ -1367,8 +1363,6 @@ struct fil_system_t void close(); private: - bool m_initialised; - /** Points to the last opened space in space_list. Protected with fil_system.mutex. */ fil_space_t *space_list_last_opened= nullptr; @@ -1404,19 +1398,32 @@ public: /** Map of fil_space_t::id to fil_space_t* */ hash_table_t spaces; - /** whether each write to data files is durable (O_DSYNC) */ + /** false=invoke fsync() or fdatasync() on data files before checkpoint; + true=each write is durable (O_DSYNC) */ my_bool write_through; /** whether data files are buffered (not O_DIRECT) */ my_bool buffered; + /** whether fdatasync() is needed on data files */ + Atomic_relaxed need_unflushed_spaces; /** Try to enable or disable write-through of data files */ void set_write_through(bool write_through); + /** Update innodb_doublewrite */ + void set_use_doublewrite(ulong use) + { + buf_dblwr.set_use(use); + need_unflushed_spaces= !write_through && buf_dblwr.need_fsync(); + } + /** Try to enable or disable file system caching of data files */ void set_buffered(bool buffered); TPOOL_SUPPRESS_TSAN bool is_write_through() const { return write_through; } TPOOL_SUPPRESS_TSAN bool is_buffered() const { return buffered; } + /** @return whether to update unflushed_spaces */ + bool use_unflushed_spaces() const { return need_unflushed_spaces; } + /** tablespaces for which fil_space_t::needs_flush() holds */ sized_ilist unflushed_spaces; /** number of currently open files; protected by mutex */ diff --git a/storage/innobase/include/fut0lst.h b/storage/innobase/include/fut0lst.h index abef53c949b..dc8806a5c74 100644 --- a/storage/innobase/include/fut0lst.h +++ b/storage/innobase/include/fut0lst.h @@ -78,34 +78,40 @@ void flst_init(const buf_block_t &block, byte *base, mtr_t *mtr) MY_ATTRIBUTE((nonnull)); /** Append a file list node to a list. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] add block to be added -@param[in] aoffset byte offset of the node to be added -@param[in,out] mtr mini-transaction +@param base base node block +@param boffset byte offset of the base node +@param add block to be added +@param aoffset byte offset of the node to be added +@param limit fil_space_t::free_limit +@param mtr mini-transaction @return error code */ dberr_t flst_add_last(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) + buf_block_t *add, uint16_t aoffset, + uint32_t limit, mtr_t *mtr) MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Prepend a file list node to a list. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] add block to be added -@param[in] aoffset byte offset of the node to be added -@param[in,out] mtr mini-transaction +@param base base node block +@param boffset byte offset of the base node +@param add block to be added +@param aoffset byte offset of the node to be added +@param limit fil_space_t::free_limit +@param mtr mini-transaction @return error code */ dberr_t flst_add_first(buf_block_t *base, uint16_t boffset, - buf_block_t *add, uint16_t aoffset, mtr_t *mtr) + buf_block_t *add, uint16_t aoffset, + uint32_t limit, mtr_t *mtr) MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Remove a file list node. -@param[in,out] base base node block -@param[in] boffset byte offset of the base node -@param[in,out] cur block to be removed -@param[in] coffset byte offset of the current record to be removed -@param[in,out] mtr mini-transaction +@param base base node block +@param boffset byte offset of the base node +@param cur block to be removed +@param coffset byte offset of the current record to be removed +@param limit fil_space_t::free_limit +@param mtr mini-transaction @return error code */ dberr_t flst_remove(buf_block_t *base, uint16_t boffset, - buf_block_t *cur, uint16_t coffset, mtr_t *mtr) + buf_block_t *cur, uint16_t coffset, + uint32_t limit, mtr_t *mtr) MY_ATTRIBUTE((nonnull, warn_unused_result)); /** @return the length of a list */ @@ -117,11 +123,9 @@ inline uint32_t flst_get_len(const flst_base_node_t *base) /** @return a file address */ inline fil_addr_t flst_read_addr(const byte *faddr) { - fil_addr_t addr= { mach_read_from_4(faddr + FIL_ADDR_PAGE), - mach_read_from_2(faddr + FIL_ADDR_BYTE) }; - ut_a(addr.page == FIL_NULL || addr.boffset >= FIL_PAGE_DATA); - ut_a(ut_align_offset(faddr, srv_page_size) >= FIL_PAGE_DATA); - return addr; + ut_ad(ut_align_offset(faddr, srv_page_size) >= FIL_PAGE_DATA); + return fil_addr_t{mach_read_from_4(faddr + FIL_ADDR_PAGE), + mach_read_from_2(faddr + FIL_ADDR_BYTE)}; } /** @return list first node address */ diff --git a/storage/innobase/include/gis0type.h b/storage/innobase/include/gis0type.h index d6a4ef67a38..2dc25a898b7 100644 --- a/storage/innobase/include/gis0type.h +++ b/storage/innobase/include/gis0type.h @@ -66,10 +66,7 @@ typedef std::vector > rtr_rec_vector; /* Structure for matched records on the leaf page */ typedef struct matched_rec { - byte* bufp; /*!< aligned buffer point */ - byte rec_buf[UNIV_PAGE_SIZE_MAX * 2]; - /*!< buffer used to copy matching rec */ - buf_block_t block; /*!< the shadow buffer block */ + buf_block_t* block; /*!< the shadow buffer block */ ulint used; /*!< memory used */ rtr_rec_vector* matched_recs; /*!< vector holding the matching rec */ mysql_mutex_t rtr_match_mutex;/*!< mutex protect the match_recs @@ -107,7 +104,6 @@ typedef struct rtr_info{ /*!< mutex protect the "path" vector */ rtr_mbr_t mbr; /*!< the search MBR */ que_thr_t* thr; /*!< the search thread */ - mem_heap_t* heap; /*!< memory heap */ btr_cur_t* cursor; /*!< cursor used for search */ dict_index_t* index; /*!< index it is searching */ bool need_prdt_lock; diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 26e6a57c54c..85d01f2fc9e 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -132,6 +132,9 @@ public: /** Redo log buffer */ struct log_t { + /** The maximum buf_size */ + static constexpr unsigned buf_size_max= os_file_request_size_max; + /** The original (not version-tagged) InnoDB redo log format */ static constexpr uint32_t FORMAT_3_23= 0; /** The MySQL 5.7.9/MariaDB 10.2.2 log format */ @@ -187,7 +190,7 @@ 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) */ - size_t buf_size; + unsigned buf_size; /** log file size in bytes, including the header */ lsn_t file_size; @@ -227,8 +230,6 @@ public: /** Last written LSN */ lsn_t write_lsn; - /** recommended maximum buf_free size, after which the buffer is flushed */ - size_t max_buf_free; /** buffer for writing data to ib_logfile0, or nullptr if is_pmem() In write_buf(), buf and flush_buf are swapped */ @@ -238,6 +239,10 @@ public: std::atomic need_checkpoint; /** whether a checkpoint is pending; protected by latch.wr_lock() */ Atomic_relaxed checkpoint_pending; + /** next checkpoint number (protected by latch.wr_lock()) */ + byte next_checkpoint_no; + /** recommended maximum buf_free size, after which the buffer is flushed */ + unsigned max_buf_free; /** Log sequence number when a log file overwrite (broken crash recovery) was noticed. Protected by latch.wr_lock(). */ lsn_t overwrite_warned; @@ -246,8 +251,6 @@ public: Atomic_relaxed last_checkpoint_lsn; /** next checkpoint LSN (protected by latch.wr_lock()) */ lsn_t next_checkpoint_lsn; - /** next checkpoint number (protected by latch.wr_lock()) */ - ulint next_checkpoint_no; /** Log file */ log_file_t log; @@ -322,6 +325,7 @@ public: /** whether there is capacity in the log buffer */ bool buf_free_ok() const noexcept { + ut_ad(!is_pmem()); return (buf_free.load(std::memory_order_relaxed) & ~buf_free_LOCK) < max_buf_free; } diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 7621e5a0b6f..27811872c58 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -686,6 +686,13 @@ private: /** Encrypt the log */ ATTRIBUTE_NOINLINE void encrypt(); + /** Commit the mini-transaction log. + @tparam pmem log_sys.is_pmem() + @param mtr mini-transaction + @param lsns {start_lsn,flush_ahead} */ + template + static void commit_log(mtr_t *mtr, std::pair lsns); + /** Append the redo log records to the redo log buffer. @return {start_lsn,flush_ahead} */ std::pair do_write(); @@ -699,6 +706,8 @@ private: template static std::pair finish_writer(mtr_t *mtr, size_t len); + /** The applicable variant of commit_log() */ + static void (*commit_logger)(mtr_t *, std::pair); /** The applicable variant of finish_writer() */ static std::pair (*finisher)(mtr_t *, size_t); diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index a5953dcfd51..ce6864754c2 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -46,6 +46,18 @@ Created 10/21/1995 Heikki Tuuri #include #endif /* !_WIN32 */ +/** The maximum size of a read or write request. + +According to Linux "man 2 read" and "man 2 write" this applies to +both 32-bit and 64-bit systems. + +On FreeBSD, the limit is close to the Linux one, INT_MAX. + +On Microsoft Windows, the limit is UINT_MAX (4 GiB - 1). + +On other systems, the limit typically is up to SSIZE_T_MAX. */ +static constexpr unsigned os_file_request_size_max= 0x7ffff000; + extern bool os_has_said_disk_full; /** File offset in bytes */ @@ -185,10 +197,14 @@ public: WRITE_SYNC= 16, /** Asynchronous write */ WRITE_ASYNC= WRITE_SYNC | 1, + /** Asynchronous doublewritten page */ + WRITE_DBL= WRITE_ASYNC | 4, /** A doublewrite batch */ DBLWR_BATCH= WRITE_ASYNC | 8, /** Write data and punch hole for the rest */ PUNCH= WRITE_ASYNC | 16, + /** Write doublewritten data and punch hole for the rest */ + PUNCH_DBL= PUNCH | 4, /** Zero out a range of bytes in fil_space_t::io() */ PUNCH_RANGE= WRITE_SYNC | 32, }; @@ -204,6 +220,14 @@ public: bool is_read() const { return (type & READ_SYNC) != 0; } bool is_write() const { return (type & WRITE_SYNC) != 0; } bool is_async() const { return (type & (READ_SYNC ^ READ_ASYNC)) != 0; } + bool is_doublewritten() const { return (type & 4) != 0; } + + /** Create a write request for the doublewrite buffer. */ + IORequest doublewritten() const + { + ut_ad(type == WRITE_ASYNC || type == PUNCH); + return IORequest{bpage, slot, node, Type(type | 4)}; + } void write_complete(int io_error) const; void read_complete(int io_error) const; diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h index 8134c60fe72..54e4a1d283f 100644 --- a/storage/innobase/include/row0sel.h +++ b/storage/innobase/include/row0sel.h @@ -115,8 +115,8 @@ row_sel_convert_mysql_key_to_innobase( ulint buf_len, /*!< in: buffer length */ dict_index_t* index, /*!< in: index of the key value */ const byte* key_ptr, /*!< in: MySQL key value */ - ulint key_len); /*!< in: MySQL key value length */ - + ulint key_len) /*!< in: MySQL key value length */ + MY_ATTRIBUTE((nonnull(1,4,5))); /** Search for rows in the database using cursor. Function is mainly used for tables that are shared across connections and diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index c24fd409300..df25983acab 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -293,7 +293,6 @@ extern my_bool srv_stats_include_delete_marked; extern unsigned long long srv_stats_modified_counter; extern my_bool srv_stats_sample_traditional; -extern my_bool srv_use_doublewrite_buf; extern ulong srv_checksum_algorithm; extern my_bool srv_force_primary_key; diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 0f4f8afa15b..1fb6cd68538 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -55,80 +55,74 @@ Run a purge batch. @return number of undo log pages handled in the batch */ ulint trx_purge(ulint n_tasks, ulint history_size); -/** Rollback segements from a given transaction with trx-no -scheduled for purge. */ -class TrxUndoRsegs { -private: - typedef std::vector > - trx_rsegs_t; -public: - typedef trx_rsegs_t::iterator iterator; - typedef trx_rsegs_t::const_iterator const_iterator; - - TrxUndoRsegs() = default; - - /** Constructor */ - TrxUndoRsegs(trx_rseg_t& rseg) - : trx_no(rseg.last_trx_no()), m_rsegs(1, &rseg) {} - /** Constructor */ - TrxUndoRsegs(trx_id_t trx_no, trx_rseg_t& rseg) - : trx_no(trx_no), m_rsegs(1, &rseg) {} - - bool operator!=(const TrxUndoRsegs& other) const - { return trx_no != other.trx_no; } - bool empty() const { return m_rsegs.empty(); } - void erase(iterator& it) { m_rsegs.erase(it); } - iterator begin() { return(m_rsegs.begin()); } - iterator end() { return(m_rsegs.end()); } - const_iterator begin() const { return m_rsegs.begin(); } - const_iterator end() const { return m_rsegs.end(); } - - /** Compare two TrxUndoRsegs based on trx_no. - @param elem1 first element to compare - @param elem2 second element to compare - @return true if elem1 > elem2 else false.*/ - bool operator()(const TrxUndoRsegs& lhs, const TrxUndoRsegs& rhs) - { - return(lhs.trx_no > rhs.trx_no); - } - - /** Copy of trx_rseg_t::last_trx_no() */ - trx_id_t trx_no= 0; -private: - /** Rollback segments of a transaction, scheduled for purge. */ - trx_rsegs_t m_rsegs{}; -}; - -typedef std::priority_queue< - TrxUndoRsegs, - std::vector >, - TrxUndoRsegs> purge_pq_t; - -/** Chooses the rollback segment with the oldest committed transaction */ -struct TrxUndoRsegsIterator { - /** Constructor */ - TrxUndoRsegsIterator(); - /** Sets the next rseg to purge in purge_sys. - Executed in the purge coordinator thread. - @retval false when nothing is to be purged - @retval true when purge_sys.rseg->latch was locked */ - inline bool set_next(); - -private: - // Disable copying - TrxUndoRsegsIterator(const TrxUndoRsegsIterator&); - TrxUndoRsegsIterator& operator=(const TrxUndoRsegsIterator&); - - /** The current element to process */ - TrxUndoRsegs m_rsegs; - /** Track the current element in m_rsegs */ - TrxUndoRsegs::const_iterator m_iter; -}; - /** The control structure used in the purge operation */ class purge_sys_t { - friend TrxUndoRsegsIterator; + /** Min-heap based priority queue of (trx_no, trx_sys.rseg_array index) + pairs, ordered on trx_no. The highest 64-TRX_NO_SHIFT bits of each element is + trx_no, the lowest 8 bits is rseg's index in trx_sys.rseg_array. */ + class purge_queue + { + public: + typedef std::vector> container_type; + /** Number of bits reseved to shift trx_no in purge queue element */ + static constexpr unsigned TRX_NO_SHIFT= 8; + + bool empty() const { return m_array.empty(); } + void clear() { m_array.clear(); } + + /** Push (trx_no, trx_sys.rseg_array index) into min-heap. + @param trx_no_rseg (trx_no << TRX_NO_SHIFT | (trx_sys.rseg_array index)) */ + void push_trx_no_rseg(container_type::value_type trx_no_rseg) + { + m_array.push_back(trx_no_rseg); + std::push_heap(m_array.begin(), m_array.end(), + std::greater()); + } + + /** Push rseg to priority queue. + @param trx_no trx_no of committed transaction + @param rseg rseg of committed transaction*/ + void push(trx_id_t trx_no, const trx_rseg_t &rseg) + { + ut_ad(trx_no < 1ULL << (DATA_TRX_ID_LEN * CHAR_BIT)); + ut_ad(&rseg >= trx_sys.rseg_array); + ut_ad(&rseg < trx_sys.rseg_array + TRX_SYS_N_RSEGS); + push_trx_no_rseg(trx_no << TRX_NO_SHIFT | + byte(&rseg - trx_sys.rseg_array)); + } + + /** Extracts rseg from (trx_no, trx_sys.rseg_array index) pair. + @param trx_no_rseg (trx_no << TRX_NO_SHIFT | (trx_sys.rseg_array index) + @return pointer to rseg in trx_sys.rseg_array */ + static trx_rseg_t *rseg(container_type::value_type trx_no_rseg) { + byte i= static_cast(trx_no_rseg); + ut_ad(i < TRX_SYS_N_RSEGS); + return &trx_sys.rseg_array[i]; + } + + /** Pop rseg from priority queue. + @return pointer to popped trx_rseg_t object */ + trx_rseg_t *pop() + { + ut_ad(!empty()); + std::pop_heap(m_array.begin(), m_array.end(), + std::greater()); + trx_rseg_t *r = rseg(m_array.back()); + m_array.pop_back(); + return r; + } + + /** Clone m_array. + @return m_array clone */ + container_type clone_container() const{ return m_array; } + + private: + /** Array of (trx_no, trx_sys.rseg_array index) pairs. */ + container_type m_array; + }; + + public: /** latch protecting view, m_enabled */ alignas(CPU_LEVEL1_DCACHE_LINESIZE) mutable srw_spin_lock latch; @@ -244,15 +238,36 @@ private: record */ uint16_t hdr_offset; /*!< Header byte offset on the page */ + /** Binary min-heap of (trx_no, trx_sys.rseg_array index) pairs, ordered on + trx_no. It is protected by the pq_mutex */ + purge_queue purge_queue; + + /** Mutex protecting purge_queue */ + mysql_mutex_t pq_mutex; - TrxUndoRsegsIterator - rseg_iter; /*!< Iterator to get the next rseg - to process */ public: - purge_pq_t purge_queue; /*!< Binary min-heap, ordered on - TrxUndoRsegs::trx_no. It is protected - by the pq_mutex */ - mysql_mutex_t pq_mutex; /*!< Mutex protecting purge_queue */ + + void enqueue(trx_id_t trx_no, const trx_rseg_t &rseg) { + mysql_mutex_assert_owner(&pq_mutex); + purge_queue.push(trx_no, rseg); + } + + /** Push to purge queue without acquiring pq_mutex. + @param rseg rseg to push */ + void enqueue(const trx_rseg_t &rseg) { enqueue(rseg.last_trx_no(), rseg); } + + /** Clone purge queue container. + @return purge queue container clone */ + purge_queue::container_type clone_queue_container() const { + mysql_mutex_assert_owner(&pq_mutex); + return purge_queue.clone_container(); + } + + /** Acquare purge_queue_mutex */ + void queue_lock() { mysql_mutex_lock(&pq_mutex); } + + /** Release purge queue mutex */ + void queue_unlock() { mysql_mutex_unlock(&pq_mutex); } /** innodb_undo_log_truncate=ON state; only modified by purge_coordinator_callback() */ @@ -332,8 +347,9 @@ private: /** Update the last not yet purged history log info in rseg when we have purged a whole undo log. Advances also purge_trx_no - past the purged log. */ - void rseg_get_next_history_log(); + past the purged log. + @return whether anything is to be purged */ + bool rseg_get_next_history_log(); public: /** @@ -438,6 +454,11 @@ public: @param already_stopped True indicates purge threads were already stopped */ void stop_FTS(const dict_table_t &table, bool already_stopped=false); + + /** Cleanse purge queue to remove the rseg that reside in undo-tablespace + marked for truncate. + @param space undo tablespace being truncated */ + void cleanse_purge_queue(const fil_space_t &space); }; /** The global data structure coordinating a purge */ diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 5df59863f32..e0051b2a1d0 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -170,19 +170,21 @@ public: /** Last not yet purged undo log header; FIL_NULL if all purged */ uint32_t last_page_no; - /** trx_t::no | last_offset << 48 */ + /** trx_t::no << 16 | last_offset */ uint64_t last_commit_and_offset; /** @return the commit ID of the last committed transaction */ trx_id_t last_trx_no() const - { return last_commit_and_offset & ((1ULL << 48) - 1); } + { return last_commit_and_offset >> 16; } /** @return header offset of the last committed transaction */ uint16_t last_offset() const - { return static_cast(last_commit_and_offset >> 48); } + { + return static_cast(last_commit_and_offset); + } void set_last_commit(uint16_t last_offset, trx_id_t trx_no) { - last_commit_and_offset= static_cast(last_offset) << 48 | trx_no; + last_commit_and_offset= trx_no << 16 | static_cast(last_offset); } /** @return the page identifier */ diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index bb152e4a9a5..7457addbbb6 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1189,10 +1189,16 @@ public: return UNIV_UNLIKELY(bulk_insert) ? bulk_insert_apply_low(): DB_SUCCESS; } + /** Do the bulk insert for the buffered insert operation of a table. + @param table bulk insert operation + @return DB_SUCCESS or error code. */ + dberr_t bulk_insert_apply_for_table(dict_table_t *table); private: /** Apply the buffered bulk inserts. */ dberr_t bulk_insert_apply_low(); + /** Rollback the bulk insert operation for the transaction */ + void bulk_rollback_low(); /** Assign a rollback segment for modifying temporary tables. @return the assigned rollback segment */ trx_rseg_t *assign_temp_rseg(); diff --git a/storage/innobase/include/trx0undo.inl b/storage/innobase/include/trx0undo.inl index 9f05989f634..023e2b98fb2 100644 --- a/storage/innobase/include/trx0undo.inl +++ b/storage/innobase/include/trx0undo.inl @@ -125,5 +125,6 @@ trx_undo_page_get_next_rec(const buf_block_t *undo_page, uint16_t rec, { uint16_t end= trx_undo_page_get_end(undo_page, page_no, offset); uint16_t next= mach_read_from_2(undo_page->page.frame + rec); - return next == end ? nullptr : undo_page->page.frame + next; + ut_ad(next <= end); + return next >= end ? nullptr : undo_page->page.frame + next; } diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 50b44186d7f..27a0d15482c 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -5586,47 +5586,43 @@ lock_rec_insert_check_and_lock( return err; } -/*********************************************************************//** -Creates an explicit record lock for a running transaction that currently only -has an implicit lock on the record. The transaction instance must have a -reference count > 0 so that it can't be committed and freed before this -function has completed. */ -static -bool -lock_rec_convert_impl_to_expl_for_trx( -/*==================================*/ - trx_t* trx, /*!< in/out: active transaction */ - const page_id_t id, /*!< in: page identifier */ - const rec_t* rec, /*!< in: user record on page */ - dict_index_t* index) /*!< in: index of record */ +/** Create an explicit record lock for a transaction that currently only +has an implicit lock on the record. +@param trx referenced, active transaction, or nullptr +@param id page identifier +@param rec record in the page +@param index the index B-tree that the record belongs to +@return trx, with the reference released */ +static trx_t *lock_rec_convert_impl_to_expl_for_trx(trx_t *trx, + const page_id_t id, + const rec_t *rec, + dict_index_t *index) { - if (!trx) - return false; - - ut_ad(trx->is_referenced()); - ut_ad(page_rec_is_leaf(rec)); - ut_ad(!rec_is_metadata(rec, *index)); - - DEBUG_SYNC_C("before_lock_rec_convert_impl_to_expl_for_trx"); - ulint heap_no= page_rec_get_heap_no(rec); - + if (trx) { - LockGuard g{lock_sys.rec_hash, id}; - trx->mutex_lock(); - ut_ad(!trx_state_eq(trx, TRX_STATE_NOT_STARTED)); + ut_ad(trx->is_referenced()); + ut_ad(page_rec_is_leaf(rec)); + ut_ad(!rec_is_metadata(rec, *index)); - if (!trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY) && - !lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, heap_no, - trx)) - lock_rec_add_to_queue(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, - page_align(rec), heap_no, index, trx, true); + ulint heap_no= page_rec_get_heap_no(rec); + + { + LockGuard g{lock_sys.rec_hash, id}; + trx->mutex_lock(); + ut_ad(!trx_state_eq(trx, TRX_STATE_NOT_STARTED)); + + if (!trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY) && + !lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, heap_no, + trx)) + lock_rec_add_to_queue(LOCK_X | LOCK_REC_NOT_GAP, g.cell(), id, + page_align(rec), heap_no, index, trx, true); + } + + trx->release_reference(); + trx->mutex_unlock(); } - trx->mutex_unlock(); - trx->release_reference(); - - DEBUG_SYNC_C("after_lock_rec_convert_impl_to_expl_for_trx"); - return false; + return trx; } @@ -5717,10 +5713,11 @@ should be created. @param[in] rec record on the leaf page @param[in] index the index of the record @param[in] offsets rec_get_offsets(rec,index) -@return whether caller_trx already holds an exclusive lock on rec */ +@return unsafe pointer to a transaction that held an exclusive lock on rec +@retval nullptr if no transaction held an exclusive lock */ template static -bool +const trx_t * lock_rec_convert_impl_to_expl( trx_t* caller_trx, page_id_t id, @@ -5744,10 +5741,10 @@ lock_rec_convert_impl_to_expl( trx_id = lock_clust_rec_some_has_impl(rec, index, offsets); if (trx_id == 0) { - return false; + return nullptr; } if (UNIV_UNLIKELY(trx_id == caller_trx->id)) { - return true; + return caller_trx; } trx = trx_sys.find(caller_trx, trx_id); @@ -5758,7 +5755,7 @@ lock_rec_convert_impl_to_expl( offsets); if (trx == caller_trx) { trx->release_reference(); - return true; + return trx; } ut_d(lock_rec_other_trx_holds_expl(caller_trx, trx, rec, id)); @@ -5803,11 +5800,18 @@ lock_clust_rec_modify_check_and_lock( /* If a transaction has no explicit x-lock set on the record, set one for it */ - if (lock_rec_convert_impl_to_expl(thr_get_trx(thr), - block->page.id(), + trx_t *trx = thr_get_trx(thr); + if (const trx_t *owner = + lock_rec_convert_impl_to_expl(trx, block->page.id(), rec, index, offsets)) { - /* We already hold an implicit exclusive lock. */ - return DB_SUCCESS; + if (owner == trx) { + /* We already hold an exclusive lock. */ + return DB_SUCCESS; + } + + if (trx->snapshot_isolation && trx->read_view.is_open()) { + return DB_RECORD_CHANGED; + } } err = lock_rec_lock(true, LOCK_X | LOCK_REC_NOT_GAP, @@ -5970,12 +5974,19 @@ lock_sec_rec_read_check_and_lock( return DB_SUCCESS; } - if (!page_rec_is_supremum(rec) - && lock_rec_convert_impl_to_expl( - trx, block->page.id(), rec, index, offsets) - && gap_mode == LOCK_REC_NOT_GAP) { - /* We already hold an implicit exclusive lock. */ - return DB_SUCCESS; + if (page_rec_is_supremum(rec)) { + } else if (const trx_t *owner = + lock_rec_convert_impl_to_expl(trx, block->page.id(), + rec, index, offsets)) { + if (owner == trx) { + if (gap_mode == LOCK_REC_NOT_GAP) { + /* We already hold an exclusive lock. */ + return DB_SUCCESS; + } + } else if (trx->snapshot_isolation + && trx->read_view.is_open()) { + return DB_RECORD_CHANGED; + } } #ifdef WITH_WSREP @@ -6055,13 +6066,20 @@ lock_clust_rec_read_check_and_lock( ulint heap_no = page_rec_get_heap_no(rec); trx_t *trx = thr_get_trx(thr); - if (!lock_table_has(trx, index->table, LOCK_X) - && heap_no != PAGE_HEAP_NO_SUPREMUM - && lock_rec_convert_impl_to_expl(trx, id, - rec, index, offsets) - && gap_mode == LOCK_REC_NOT_GAP) { - /* We already hold an implicit exclusive lock. */ - return DB_SUCCESS; + if (lock_table_has(trx, index->table, LOCK_X) + || heap_no == PAGE_HEAP_NO_SUPREMUM) { + } else if (const trx_t *owner = + lock_rec_convert_impl_to_expl(trx, id, + rec, index, offsets)) { + if (owner == trx) { + if (gap_mode == LOCK_REC_NOT_GAP) { + /* We already hold an exclusive lock. */ + return DB_SUCCESS; + } + } else if (trx->snapshot_isolation + && trx->read_view.is_open()) { + return DB_RECORD_CHANGED; + } } if (heap_no > PAGE_HEAP_NO_SUPREMUM && gap_mode != LOCK_GAP diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 2a217bcedce..9d239ce80b6 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -177,7 +177,7 @@ void log_file_t::write(os_offset_t offset, span buf) noexcept } #ifdef HAVE_PMEM -# include +# include "cache.h" /** Attempt to memory map a file. @param file log file handle @@ -234,7 +234,7 @@ void log_t::attach_low(log_file_t file, os_offset_t size) log.close(); mprotect(ptr, size_t(size), PROT_READ); buf= static_cast(ptr); - max_buf_free= size; + max_buf_free= 1; # if defined __linux__ || defined _WIN32 set_block_size(CPU_LEVEL1_DCACHE_LINESIZE); # endif diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index a3cad2e1b01..90a2007a48d 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -39,19 +39,26 @@ Created 11/26/1995 Heikki Tuuri #include "mariadb_stats.h" #include "my_cpu.h" +#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; void mtr_t::finisher_update() { ut_ad(log_sys.latch_have_wr()); - finisher= #ifdef HAVE_PMEM - log_sys.is_pmem() - ? (spin_wait_delay - ? mtr_t::finish_writer : mtr_t::finish_writer) - : + if (log_sys.is_pmem()) + { + commit_logger= mtr_t::commit_log; + finisher= spin_wait_delay + ? mtr_t::finish_writer : mtr_t::finish_writer; + return; + } + commit_logger= mtr_t::commit_log; #endif + finisher= (spin_wait_delay ? mtr_t::finish_writer : mtr_t::finish_writer); } @@ -335,7 +342,6 @@ inline lsn_t log_t::get_write_target() const ut_ad(latch_have_any()); if (UNIV_LIKELY(buf_free_ok())) return 0; - ut_ad(!is_pmem()); /* The LSN corresponding to the end of buf is write_lsn - (first_lsn & 4095) + buf_free, but we use simpler arithmetics to return a smaller write target in @@ -344,6 +350,134 @@ inline lsn_t log_t::get_write_target() const return write_lsn + max_buf_free / 2; } +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(); + + if (mtr->m_made_dirty) + { + auto it= mtr->m_memo.rbegin(); + + mysql_mutex_lock(&buf_pool.flush_list_mutex); + + buf_page_t *const prev= + buf_pool.prepare_insert_into_flush_list(lsns.first); + + while (it != mtr->m_memo.rend()) + { + const mtr_memo_slot_t &slot= *it++; + if (slot.type & MTR_MEMO_MODIFY) + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY); + modified++; + buf_block_t *b= static_cast(slot.object); + ut_ad(b->page.id() < end_page_id); + ut_d(const auto s= b->page.state()); + ut_ad(s > buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + ut_ad(mach_read_from_8(b->page.frame + FIL_PAGE_LSN) <= + mtr->m_commit_lsn); + mach_write_to_8(b->page.frame + FIL_PAGE_LSN, mtr->m_commit_lsn); + if (UNIV_LIKELY_NULL(b->page.zip.data)) + memcpy_aligned<8>(FIL_PAGE_LSN + b->page.zip.data, + FIL_PAGE_LSN + b->page.frame, 8); + buf_pool.insert_into_flush_list(prev, b, lsns.first); + } + } + + ut_ad(modified); + buf_pool.flush_list_requests+= modified; + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + + if (mtr->m_latch_ex) + { + log_sys.latch.wr_unlock(); + mtr->m_latch_ex= false; + } + else + log_sys.latch.rd_unlock(); + + mtr->release(); + } + else + { + if (mtr->m_latch_ex) + { + log_sys.latch.wr_unlock(); + mtr->m_latch_ex= false; + } + else + log_sys.latch.rd_unlock(); + + for (auto it= mtr->m_memo.rbegin(); it != mtr->m_memo.rend(); ) + { + const mtr_memo_slot_t &slot= *it++; + ut_ad(slot.object); + switch (slot.type) { + case MTR_MEMO_S_LOCK: + static_cast(slot.object)->s_unlock(); + break; + case MTR_MEMO_SPACE_X_LOCK: + static_cast(slot.object)->set_committed_size(); + static_cast(slot.object)->x_unlock(); + break; + case MTR_MEMO_X_LOCK: + case MTR_MEMO_SX_LOCK: + static_cast(slot.object)-> + u_or_x_unlock(slot.type == MTR_MEMO_SX_LOCK); + break; + default: + buf_page_t *bpage= static_cast(slot.object); + ut_d(const auto s=) + bpage->unfix(); + if (slot.type & MTR_MEMO_MODIFY) + { + ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || + slot.type == MTR_MEMO_PAGE_SX_MODIFY); + ut_ad(bpage->oldest_modification() > 1); + ut_ad(bpage->oldest_modification() < mtr->m_commit_lsn); + ut_ad(bpage->id() < end_page_id); + ut_ad(s >= buf_page_t::FREED); + ut_ad(s < buf_page_t::READ_FIX); + ut_ad(mach_read_from_8(bpage->frame + FIL_PAGE_LSN) <= + mtr->m_commit_lsn); + mach_write_to_8(bpage->frame + FIL_PAGE_LSN, mtr->m_commit_lsn); + if (UNIV_LIKELY_NULL(bpage->zip.data)) + memcpy_aligned<8>(FIL_PAGE_LSN + bpage->zip.data, + FIL_PAGE_LSN + bpage->frame, 8); + modified++; + } + switch (auto latch= slot.type & ~MTR_MEMO_MODIFY) { + case MTR_MEMO_PAGE_S_FIX: + bpage->lock.s_unlock(); + continue; + case MTR_MEMO_PAGE_SX_FIX: + case MTR_MEMO_PAGE_X_FIX: + bpage->lock.u_or_x_unlock(latch == MTR_MEMO_PAGE_SX_FIX); + continue; + default: + ut_ad(latch == MTR_MEMO_BUF_FIX); + } + } + } + + buf_pool.add_flush_list_requests(modified); + mtr->m_memo.clear(); + } + + mariadb_increment_pages_updated(modified); + + 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)) + log_write_up_to(write_lsn, false); +} + /** Commit a mini-transaction. */ void mtr_t::commit() { @@ -365,129 +499,11 @@ void mtr_t::commit() ut_ad(!srv_read_only_mode); std::pair lsns{do_write()}; process_freed_pages(); - size_t modified= 0; - const lsn_t write_lsn= log_sys.get_write_target(); - - if (m_made_dirty) - { - auto it= m_memo.rbegin(); - - mysql_mutex_lock(&buf_pool.flush_list_mutex); - - buf_page_t *const prev= - buf_pool.prepare_insert_into_flush_list(lsns.first); - - while (it != m_memo.rend()) - { - const mtr_memo_slot_t &slot= *it++; - if (slot.type & MTR_MEMO_MODIFY) - { - ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || - slot.type == MTR_MEMO_PAGE_SX_MODIFY); - modified++; - buf_block_t *b= static_cast(slot.object); - ut_ad(b->page.id() < end_page_id); - ut_d(const auto s= b->page.state()); - ut_ad(s > buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - ut_ad(mach_read_from_8(b->page.frame + FIL_PAGE_LSN) <= - m_commit_lsn); - mach_write_to_8(b->page.frame + FIL_PAGE_LSN, m_commit_lsn); - if (UNIV_LIKELY_NULL(b->page.zip.data)) - memcpy_aligned<8>(FIL_PAGE_LSN + b->page.zip.data, - FIL_PAGE_LSN + b->page.frame, 8); - buf_pool.insert_into_flush_list(prev, b, lsns.first); - } - } - - ut_ad(modified); - buf_pool.flush_list_requests+= modified; - buf_pool.page_cleaner_wakeup(); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - - if (m_latch_ex) - { - log_sys.latch.wr_unlock(); - m_latch_ex= false; - } - else - log_sys.latch.rd_unlock(); - - release(); - } - else - { - if (m_latch_ex) - { - log_sys.latch.wr_unlock(); - m_latch_ex= false; - } - else - log_sys.latch.rd_unlock(); - - for (auto it= m_memo.rbegin(); it != m_memo.rend(); ) - { - const mtr_memo_slot_t &slot= *it++; - ut_ad(slot.object); - switch (slot.type) { - case MTR_MEMO_S_LOCK: - static_cast(slot.object)->s_unlock(); - break; - case MTR_MEMO_SPACE_X_LOCK: - static_cast(slot.object)->set_committed_size(); - static_cast(slot.object)->x_unlock(); - break; - case MTR_MEMO_X_LOCK: - case MTR_MEMO_SX_LOCK: - static_cast(slot.object)-> - u_or_x_unlock(slot.type == MTR_MEMO_SX_LOCK); - break; - default: - buf_page_t *bpage= static_cast(slot.object); - ut_d(const auto s=) - bpage->unfix(); - if (slot.type & MTR_MEMO_MODIFY) - { - ut_ad(slot.type == MTR_MEMO_PAGE_X_MODIFY || - slot.type == MTR_MEMO_PAGE_SX_MODIFY); - ut_ad(bpage->oldest_modification() > 1); - ut_ad(bpage->oldest_modification() < m_commit_lsn); - ut_ad(bpage->id() < end_page_id); - ut_ad(s >= buf_page_t::FREED); - ut_ad(s < buf_page_t::READ_FIX); - ut_ad(mach_read_from_8(bpage->frame + FIL_PAGE_LSN) <= - m_commit_lsn); - mach_write_to_8(bpage->frame + FIL_PAGE_LSN, m_commit_lsn); - if (UNIV_LIKELY_NULL(bpage->zip.data)) - memcpy_aligned<8>(FIL_PAGE_LSN + bpage->zip.data, - FIL_PAGE_LSN + bpage->frame, 8); - modified++; - } - switch (auto latch= slot.type & ~MTR_MEMO_MODIFY) { - case MTR_MEMO_PAGE_S_FIX: - bpage->lock.s_unlock(); - continue; - case MTR_MEMO_PAGE_SX_FIX: - case MTR_MEMO_PAGE_X_FIX: - bpage->lock.u_or_x_unlock(latch == MTR_MEMO_PAGE_SX_FIX); - continue; - default: - ut_ad(latch == MTR_MEMO_BUF_FIX); - } - } - } - - buf_pool.add_flush_list_requests(modified); - m_memo.clear(); - } - - mariadb_increment_pages_updated(modified); - - if (UNIV_UNLIKELY(lsns.second != PAGE_FLUSH_NO)) - buf_flush_ahead(m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); - - if (UNIV_UNLIKELY(write_lsn != 0)) - log_write_up_to(write_lsn, false); +#ifdef HAVE_PMEM + commit_logger(this, lsns); +#else + commit_log(this, lsns); +#endif } else { @@ -545,7 +561,6 @@ void mtr_t::commit_shrink(fil_space_t &space, uint32_t size) ut_ad(is_active()); ut_ad(!high_level_read_only); ut_ad(m_modifications); - ut_ad(!space.id || m_made_dirty); ut_ad(!m_memo.empty()); ut_ad(!recv_recovery_is_on()); ut_ad(m_log_mode == MTR_LOG_ALL); @@ -1498,7 +1513,7 @@ void mtr_t::upgrade_buffer_fix(ulint savepoint, rw_lock_type_t rw_latch) ut_ad(slot.type == MTR_MEMO_BUF_FIX); buf_block_t *block= static_cast(slot.object); ut_d(const auto state= block->page.state()); - ut_ad(state > buf_page_t::UNFIXED); + ut_ad(state > buf_page_t::FREED); ut_ad(state > buf_page_t::WRITE_FIX || state < buf_page_t::READ_FIX); static_assert(int{MTR_MEMO_PAGE_S_FIX} == int{RW_S_LATCH}, ""); static_assert(int{MTR_MEMO_PAGE_X_FIX} == int{RW_X_LATCH}, ""); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 8c1c957913e..8f067110099 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -322,6 +322,12 @@ private: ssize_t m_n; /** Offset from where to read/write */ os_offset_t m_offset; + + /** Do the read/write + @param request The IO context and type + @param n Number of bytes to read/write + @return the number of bytes read/written or negative value on error */ + ssize_t execute_low(const IORequest& request, ssize_t n); }; #ifndef _WIN32 /* On Microsoft Windows, mandatory locking is used */ @@ -673,30 +679,48 @@ os_file_create_subdirs_if_needed( +/** Do the read/write +@param[in] request The IO context and type +@param[in] n Number of bytes to read/write +@return the number of bytes read/written or negative value on error */ +ssize_t +SyncFileIO::execute_low(const IORequest& request, ssize_t n) +{ + ut_ad(n > 0); + ut_ad(size_t(n) <= os_file_request_size_max); + + if (request.is_read()) + return IF_WIN(tpool::pread(m_fh, m_buf, n, m_offset), pread(m_fh, m_buf, n, m_offset)); + return IF_WIN(tpool::pwrite(m_fh, m_buf, n, m_offset), pwrite(m_fh, m_buf, n, m_offset)); +} + /** Do the read/write @param[in] request The IO context and type @return the number of bytes read/written or negative value on error */ ssize_t SyncFileIO::execute(const IORequest& request) { - ssize_t n_bytes; + ssize_t n_bytes= 0; + ut_ad(m_n > 0); - if (request.is_read()) { -#ifdef _WIN32 - n_bytes = tpool::pread(m_fh, m_buf, m_n, m_offset); -#else - n_bytes = pread(m_fh, m_buf, m_n, m_offset); -#endif - } else { - ut_ad(request.is_write()); -#ifdef _WIN32 - n_bytes = tpool::pwrite(m_fh, m_buf, m_n, m_offset); -#else - n_bytes = pwrite(m_fh, m_buf, m_n, m_offset); -#endif - } + while (size_t(m_n) > os_file_request_size_max) + { + ssize_t n_partial_bytes= execute_low(request, os_file_request_size_max); + if (n_partial_bytes < 0) + return n_partial_bytes; + n_bytes+= n_partial_bytes; + if (n_partial_bytes != os_file_request_size_max) + return n_bytes; + advance(os_file_request_size_max); + } - return(n_bytes); + if (ssize_t n= execute_low(request, m_n)) + { + if (n < 0) + return n; + n_bytes += n; + } + return n_bytes; } #ifndef _WIN32 diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 830a4bef9d9..4eda832253b 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -3265,7 +3265,6 @@ page_zip_validate_low( ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ { - page_zip_des_t temp_page_zip; ibool valid; if (memcmp(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, @@ -3306,7 +3305,7 @@ page_zip_validate_low( MEM_CHECK_DEFINED(page, srv_page_size); MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip)); - temp_page_zip = *page_zip; + page_zip_des_t temp_page_zip(*page_zip); valid = page_zip_decompress_low(&temp_page_zip, temp_page, TRUE); if (!valid) { fputs("page_zip_validate(): failed to decompress\n", stderr); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index fd7d38db7a8..5febd6dfa27 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1885,14 +1885,39 @@ PageConverter::update_records( bool clust_index = m_index->m_srv_index == m_cluster_index; /* This will also position the cursor on the first user record. */ + rec_t* rec = m_rec_iter.open(block, m_index->m_srv_index); - if (!m_rec_iter.open(block, m_index->m_srv_index)) { + if (!rec) { return DB_CORRUPTION; } + ulint deleted; + + if (!page_has_prev(block->page.frame) + && m_index->m_srv_index->is_instant()) { + /* Expect to find the hidden metadata record */ + if (page_rec_is_supremum(rec)) { + return DB_CORRUPTION; + } + + const ulint info_bits = rec_get_info_bits(rec, comp); + + if (!(info_bits & REC_INFO_MIN_REC_FLAG)) { + return DB_CORRUPTION; + } + + if (!(info_bits & REC_INFO_DELETED_FLAG) + != !m_index->m_srv_index->table->instant) { + return DB_CORRUPTION; + } + + deleted = 0; + goto first; + } + while (!m_rec_iter.end()) { - rec_t* rec = m_rec_iter.current(); - ibool deleted = rec_get_deleted_flag(rec, comp); + rec = m_rec_iter.current(); + deleted = rec_get_deleted_flag(rec, comp); /* For the clustered index we have to adjust the BLOB reference and the system fields irrespective of the @@ -1900,6 +1925,7 @@ PageConverter::update_records( cluster records is required for purge to work later. */ if (deleted || clust_index) { +first: m_offsets = rec_get_offsets( rec, m_index->m_srv_index, m_offsets, m_index->m_srv_index->n_core_fields, @@ -3307,7 +3333,7 @@ static dict_table_t *build_fts_hidden_table( return new_table; } -/* find, parse instant metadata, performing variaous checks, +/* find, parse instant metadata, performing various checks, and apply it to dict_table_t @return DB_SUCCESS or some error */ static dberr_t handle_instant_metadata(dict_table_t *table, diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 2c75a12d5fb..952ccee4b24 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1999,7 +1999,7 @@ row_ins_dupl_error_with_rec( /* In a unique secondary index we allow equal key values if they contain SQL NULLs */ - if (!dict_index_is_clust(index) && !index->nulls_equal) { + if (!dict_index_is_clust(index)) { for (i = 0; i < n_unique; i++) { if (dfield_is_null(dtuple_get_nth_field(entry, i))) { @@ -2101,16 +2101,8 @@ row_ins_scan_sec_index_for_duplicate( /* If the secondary index is unique, but one of the fields in the n_unique first fields is NULL, a unique key violation cannot occur, since we define NULL != NULL in this case */ - - if (!index->nulls_equal) { - for (ulint i = 0; i < n_unique; i++) { - if (UNIV_SQL_NULL == dfield_get_len( - dtuple_get_nth_field(entry, i))) { - - DBUG_RETURN(DB_SUCCESS); - } - } - } + if (index->n_nullable && dtuple_contains_null(entry, n_unique)) + DBUG_RETURN(DB_SUCCESS); /* Store old value on n_fields_cmp */ @@ -2718,7 +2710,9 @@ err_exit: && !index->table->n_rec_locks && !index->table->is_active_ddl() && !index->table->has_spatial_index() - && !index->table->versioned()) { + && !index->table->versioned() + && (!dict_table_is_partition(index->table) + || thd_sql_command(trx->mysql_thd) == SQLCOM_INSERT)) { DEBUG_SYNC_C("empty_root_page_insert"); trx->bulk_insert = true; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index b9ce7b7952f..08ccaea279f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -5351,18 +5351,8 @@ dberr_t trx_mod_table_time_t::write_bulk(dict_table_t *table, trx_t *trx) return err; } -dberr_t trx_t::bulk_insert_apply_low() +void trx_t::bulk_rollback_low() { - ut_ad(bulk_insert); - ut_ad(!check_unique_secondary); - ut_ad(!check_foreigns); - dberr_t err; - for (auto& t : mod_tables) - if (t.second.is_bulk_insert()) - if ((err= t.second.write_bulk(t.first, this)) != DB_SUCCESS) - goto bulk_rollback; - return DB_SUCCESS; -bulk_rollback: undo_no_t low_limit= UINT64_MAX; for (auto& t : mod_tables) { @@ -5372,9 +5362,37 @@ bulk_rollback: low_limit= t.second.get_first(); delete t.second.bulk_store; t.second.bulk_store= nullptr; + t.second.end_bulk_insert(); } } trx_savept_t bulk_save{low_limit}; rollback(&bulk_save); - return err; +} + +dberr_t trx_t::bulk_insert_apply_for_table(dict_table_t *table) +{ + auto it= mod_tables.find(table); + if (it != mod_tables.end()) + { + if (dberr_t err= it->second.write_bulk(table, this)) + { + bulk_rollback_low(); + return err; + } + it->second.end_bulk_insert(); + } + return DB_SUCCESS; +} + +dberr_t trx_t::bulk_insert_apply_low() +{ + ut_ad(bulk_insert); + for (auto& t : mod_tables) + if (t.second.is_bulk_insert()) + if (dberr_t err= t.second.write_bulk(t.first, this)) + { + bulk_rollback_low(); + return err; + } + return DB_SUCCESS; } diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index f28953f5bb6..f86dbf2ff77 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -430,6 +430,10 @@ row_quiesce_write_header( /*********************************************************************//** Write the table meta data after quiesce. @return DB_SUCCESS or error code */ + +/* Stack size 20904 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_cfg( @@ -487,6 +491,7 @@ row_quiesce_write_cfg( return(err); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /*********************************************************************//** Check whether a table has an FTS index defined on it. diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 6d4aed377b3..0a38e30bf34 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1189,11 +1189,11 @@ sel_set_rtr_rec_lock( ut_ad(page_align(first_rec) == cur_block->page.frame); ut_ad(match->valid); - match->block.page.lock.x_lock(); + match->block->page.lock.x_lock(); retry: cur_block = btr_pcur_get_block(pcur); - ut_ad(match->block.page.lock.have_x() - || match->block.page.lock.have_s()); + ut_ad(match->block->page.lock.have_x() + || match->block->page.lock.have_s()); ut_ad(page_is_leaf(cur_block->page.frame)); err = lock_sec_rec_read_check_and_lock( @@ -1293,7 +1293,7 @@ re_scan: ULINT_UNDEFINED, &heap); err = lock_sec_rec_read_check_and_lock( - 0, &match->block, rtr_rec->r_rec, index, + 0, match->block, rtr_rec->r_rec, index, my_offsets, static_cast(mode), type, thr); @@ -1309,7 +1309,7 @@ re_scan: match->locked = true; func_end: - match->block.page.lock.x_unlock(); + match->block->page.lock.x_unlock(); if (heap != NULL) { mem_heap_free(heap); } @@ -3406,7 +3406,7 @@ Row_sel_get_clust_rec_for_mysql::operator()( if (dict_index_is_spatial(sec_index) && btr_cur->rtr_info->matches && (page_align(rec) - == btr_cur->rtr_info->matches->block.page.frame + == btr_cur->rtr_info->matches->block->page.frame || rec != btr_pcur_get_rec(prebuilt->pcur))) { #ifdef UNIV_DEBUG rtr_info_t* rtr_info = btr_cur->rtr_info; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index ceb739d8508..7d2a6072c3c 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -304,8 +304,6 @@ unsigned long long srv_stats_modified_counter; based on number of configured pages */ my_bool srv_stats_sample_traditional; -my_bool srv_use_doublewrite_buf; - /** innodb_sync_spin_loops */ ulong srv_n_spin_wait_rounds; /** innodb_spin_wait_delay */ diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 5186a7213e9..35958324932 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -636,6 +636,7 @@ static uint32_t srv_undo_tablespace_open(bool create, const char* name, if (!success) return 0; + ulint n_retries = 5; os_offset_t size= os_file_get_size(fh); ut_a(size != os_offset_t(-1)); @@ -643,15 +644,25 @@ static uint32_t srv_undo_tablespace_open(bool create, const char* name, { page_t *page= static_cast(aligned_malloc(srv_page_size, srv_page_size)); +undo_retry: if (os_file_read(IORequestRead, fh, page, 0, srv_page_size, nullptr) != DB_SUCCESS) { err_exit: + if (n_retries && srv_operation == SRV_OPERATION_BACKUP) + { + sql_print_information("InnoDB: Retrying to read undo " + "tablespace %s", name); + n_retries--; + goto undo_retry; + } ib::error() << "Unable to read first page of file " << name; aligned_free(page); return ~0U; } + DBUG_EXECUTE_IF("undo_space_read_fail", goto err_exit;); + uint32_t id= mach_read_from_4(FIL_PAGE_SPACE_ID + page); if (id == 0 || id >= SRV_SPACE_ID_UPPER_BOUND || memcmp_aligned<2>(FIL_PAGE_SPACE_ID + page, @@ -1192,7 +1203,7 @@ dberr_t srv_start(bool create_new_db) if (srv_read_only_mode) { sql_print_information("InnoDB: Started in read only mode"); - srv_use_doublewrite_buf = false; + buf_dblwr.use = buf_dblwr.USE_NO; } high_level_read_only = srv_read_only_mode diff --git a/storage/innobase/sync/cache.cc b/storage/innobase/sync/cache.cc new file mode 100644 index 00000000000..43d642d05b5 --- /dev/null +++ b/storage/innobase/sync/cache.cc @@ -0,0 +1,160 @@ +/***************************************************************************** + +Copyright (c) 2024, MariaDB plc + +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 02110-1335 USA + +*****************************************************************************/ + +/* This is based on the implementation of pmem_persist() in +https://github.com/pmem/pmdk/, Copyright 2014-2020, Intel Corporation, +last revised in libpmem-1.12.0. */ + +#include "my_global.h" +#include "cache.h" +#include + +#if defined __x86_64__ || defined __aarch64__ || defined __powerpc64__ +# ifdef __x86_64__ +static void pmem_clflush(const void *buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + __asm__ __volatile__("clflush %0" :: + "m"(*reinterpret_cast(u)) : "memory"); +} + +static void pmem_clflushopt(const void *buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + __asm__ __volatile__(".byte 0x66; clflush %0" /* clflushopt */ :: + "m"(*reinterpret_cast(u)) : "memory"); + __asm__ __volatile__("sfence" ::: "memory"); +} + +static void pmem_clwb(const void *buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + __asm__ __volatile__(".byte 0x66; xsaveopt %0" /* clwb */ :: + "m"(*reinterpret_cast(u)) : "memory"); + __asm__ __volatile__("sfence" ::: "memory"); +} + +# include +static decltype(pmem_control::persist) pmem_persist_init() +{ + uint32_t eax= 0, ebx= 0, ecx= 0, edx= 0; + __cpuid_count(7, 0, eax, ebx, ecx, edx); + if (ebx & 1U<<24 /* CLWB */) + return pmem_clwb; + else if (ebx & 1U<<23 /* CLFLUSHOPT */) + return pmem_clflushopt; + else + return pmem_clflush; +} +# elif defined __aarch64__ +static void pmem_cvac(const void* buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + __asm__ __volatile__("dc cvac, %0" :: "r"(u) : "memory"); + __asm__ __volatile__("dmb ishst" ::: "memory"); +} + +static void pmem_cvap(const void* buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + __asm__ __volatile__(".arch armv8.2-a\n dc cvap, %0" :: "r"(u) : "memory"); + __asm__ __volatile__("dmb ishst" ::: "memory"); +} + +# include +# include +# ifndef HWCAP_DCPOP +# define HWCAP_DCPOP (1 << 16) +# endif + +static decltype(pmem_control::persist) pmem_persist_init() +{ + return (getauxval(AT_HWCAP) & HWCAP_DCPOP) ? pmem_cvap : pmem_cvac; +} +# elif defined __powerpc64__ +static void pmem_phwsync(const void* buf, size_t size) +{ + for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE), + end= uintptr_t(buf) + size; + u < end; u+= CPU_LEVEL1_DCACHE_LINESIZE) + { + /* GCC is just passing the inline asm snippets to the assembler, + and it does not even define these mnemonics by itself. Clang does, + and it includes a built-in assembler. + + Let us hope that having a recent enough GCC is an adequate proxy + for having a recent enough assembler. */ +# if __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 12) + __asm__ __volatile__("dcbstps 0,%0" :: "r"(u) : "memory"); +# else + __asm__ __volatile__(".long (0x7cc000AC | %0 << 11)" :: "r"(u) : "memory"); +# endif + } + +# if __GNUC__ >= 11 || (defined __clang_major__ && __clang_major__ >= 18) + __asm__ __volatile__("phwsync" ::: "memory"); +# else + __asm__ __volatile__(".long 0x7c80040a" ::: "memory"); +# endif +} + +# include +static void pmem_fence(const void*, size_t) +{ + std::atomic_thread_fence(std::memory_order_seq_cst); +} + +# include +# ifndef AT_HWCAP2 +# define AT_HWCAP2 26 +# endif +# ifndef PPC_FEATURE2_ARCH_3_1 +# define PPC_FEATURE2_ARCH_3_1 4 +# endif + +static decltype(pmem_control::persist) pmem_persist_init() +{ + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_1) + ? pmem_phwsync : pmem_fence; +} +# endif + +pmem_control::pmem_control() : persist(pmem_persist_init()) {} +const pmem_control pmem; +#else +void pmem_persist(const void *buf, size_t size) +{ +# if defined __riscv && __riscv_xlen == 64 + __asm__ __volatile__("fence w,w" ::: "memory"); +# elif defined __loongarch64 + __asm__ __volatile__("dbar 0" ::: "memory"); +# else +# error "Missing implementation; recompile with cmake -DWITH_INNODB_PMEM=OFF" +# endif +} +#endif diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 72dba8b2d9d..85c6dfdb5c1 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -56,84 +56,6 @@ purge_sys_t purge_sys; my_bool srv_purge_view_update_only_debug; #endif /* UNIV_DEBUG */ -/** Sentinel value */ -static const TrxUndoRsegs NullElement; - -/** Default constructor */ -TrxUndoRsegsIterator::TrxUndoRsegsIterator() - : m_rsegs(NullElement), m_iter(m_rsegs.begin()) -{ -} - -/** Sets the next rseg to purge in purge_sys. -Executed in the purge coordinator thread. -@retval false when nothing is to be purged -@retval true when purge_sys.rseg->latch was locked */ -inline bool TrxUndoRsegsIterator::set_next() -{ - ut_ad(!purge_sys.next_stored); - mysql_mutex_lock(&purge_sys.pq_mutex); - - /* Only purge consumes events from the priority queue, user - threads only produce the events. */ - - /* Check if there are more rsegs to process in the - current element. */ - if (m_iter != m_rsegs.end()) { - /* We are still processing rollback segment from - the same transaction and so expected transaction - number shouldn't increase. Undo the increment of - expected commit done by caller assuming rollback - segments from given transaction are done. */ - purge_sys.tail.trx_no = (*m_iter)->last_trx_no(); - } else if (!purge_sys.purge_queue.empty()) { - m_rsegs = purge_sys.purge_queue.top(); - purge_sys.purge_queue.pop(); - ut_ad(purge_sys.purge_queue.empty() - || purge_sys.purge_queue.top() != m_rsegs); - m_iter = m_rsegs.begin(); - } else { - /* Queue is empty, reset iterator. */ - purge_sys.rseg = NULL; - mysql_mutex_unlock(&purge_sys.pq_mutex); - m_rsegs = NullElement; - m_iter = m_rsegs.begin(); - return false; - } - - purge_sys.rseg = *m_iter++; - mysql_mutex_unlock(&purge_sys.pq_mutex); - - /* We assume in purge of externally stored fields that space - id is in the range of UNDO tablespace space ids */ - ut_ad(purge_sys.rseg->space->id == TRX_SYS_SPACE - || srv_is_undo_tablespace(purge_sys.rseg->space->id)); - - purge_sys.rseg->latch.wr_lock(SRW_LOCK_CALL); - trx_id_t last_trx_no = purge_sys.rseg->last_trx_no(); - purge_sys.hdr_offset = purge_sys.rseg->last_offset(); - purge_sys.hdr_page_no = purge_sys.rseg->last_page_no; - - /* Only the purge_coordinator_task will access this object - purge_sys.rseg_iter, or any of purge_sys.hdr_page_no, - purge_sys.tail. - The field purge_sys.head and purge_sys.view are modified by - purge_sys_t::clone_end_view() - in the purge_coordinator_task - while holding exclusive purge_sys.latch. - The purge_sys.view may also be modified by - purge_sys_t::wake_if_not_active() while holding exclusive - purge_sys.latch. - The purge_sys.head may be read by - purge_truncation_callback(). */ - ut_ad(last_trx_no == m_rsegs.trx_no); - ut_a(purge_sys.hdr_page_no != FIL_NULL); - ut_a(purge_sys.tail.trx_no <= last_trx_no); - purge_sys.tail.trx_no = last_trx_no; - - return(true); -} - /** Build a purge 'query' graph. The actual purge is performed by executing this query graph. @return own: the query graph */ @@ -344,7 +266,8 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) that is known to be corrupted. */ ut_a(flst_add_first(rseg_header, TRX_RSEG + TRX_RSEG_HISTORY, undo_page, uint16_t(page_offset(undo_header) + - TRX_UNDO_HISTORY_NODE), mtr) == DB_SUCCESS); + TRX_UNDO_HISTORY_NODE), rseg->space->free_limit, + mtr) == DB_SUCCESS); mtr->write<2>(*undo_page, TRX_UNDO_SEG_HDR + TRX_UNDO_STATE + undo_page->page.frame, undo_state); @@ -432,6 +355,19 @@ inline dberr_t purge_sys_t::iterator::free_history_rseg(trx_rseg_t &rseg) const mtr_t mtr; bool freed= false; uint32_t rseg_ref= 0; + const auto last_boffset= srv_page_size - TRX_UNDO_LOG_OLD_HDR_SIZE; + /* Technically, rseg.space->free_limit is not protected by + rseg.latch, which we are holding, but rseg.space->latch. The value + that we are reading may become stale (too small) if other pages are + being allocated in this tablespace, for other rollback + segments. Nothing can be added to this rseg without holding + rseg.latch, and hence we can validate the entire file-based list + against the limit that we are reading here. + + Note: The read here may look like a data race. On none of our target + architectures this should be an actual problem, because the uint32_t + value should always fit in a register and be correctly aligned. */ + const auto last_page= rseg.space->free_limit; mtr.start(); @@ -447,13 +383,23 @@ func_exit: } hdr_addr= flst_get_last(TRX_RSEG + TRX_RSEG_HISTORY + rseg_hdr->page.frame); + + if (hdr_addr.page == FIL_NULL) + goto func_exit; + + if (hdr_addr.page >= last_page || + hdr_addr.boffset < TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE || + hdr_addr.boffset >= last_boffset) + { + corrupted: + err= DB_CORRUPTION; + goto func_exit; + } + hdr_addr.boffset= static_cast(hdr_addr.boffset - TRX_UNDO_HISTORY_NODE); loop: - if (hdr_addr.page == FIL_NULL) - goto func_exit; - buf_block_t *b= buf_page_get_gen(page_id_t(rseg.space->id, hdr_addr.page), 0, RW_X_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, @@ -502,11 +448,18 @@ loop: fil_addr_t prev_hdr_addr= flst_get_prev_addr(b->page.frame + hdr_addr.boffset + TRX_UNDO_HISTORY_NODE); + if (prev_hdr_addr.page == FIL_NULL); + else if (prev_hdr_addr.page >= last_page || + prev_hdr_addr.boffset < TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE || + prev_hdr_addr.boffset >= last_boffset) + goto corrupted; + prev_hdr_addr.boffset= static_cast(prev_hdr_addr.boffset - TRX_UNDO_HISTORY_NODE); err= flst_remove(rseg_hdr, TRX_RSEG + TRX_RSEG_HISTORY, b, - uint16_t(hdr_addr.boffset + TRX_UNDO_HISTORY_NODE), &mtr); + uint16_t(hdr_addr.boffset + TRX_UNDO_HISTORY_NODE), + last_page, &mtr); if (UNIV_UNLIKELY(err != DB_SUCCESS)) goto func_exit; @@ -566,45 +519,21 @@ loop: ut_ad(rseg_hdr->page.id() == rseg.page_id()); mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_FIX); + if (hdr_addr.page == FIL_NULL) + goto func_exit; + goto loop; } -/** Cleanse purge queue to remove the rseg that reside in undo-tablespace -marked for truncate. -@param[in] space undo tablespace being truncated */ -static void trx_purge_cleanse_purge_queue(const fil_space_t& space) +void purge_sys_t::cleanse_purge_queue(const fil_space_t &space) { - typedef std::vector purge_elem_list_t; - purge_elem_list_t purge_elem_list; - - mysql_mutex_lock(&purge_sys.pq_mutex); - - /* Remove rseg instances that are in the purge queue before we start - truncate of corresponding UNDO truncate. */ - while (!purge_sys.purge_queue.empty()) { - purge_elem_list.push_back(purge_sys.purge_queue.top()); - purge_sys.purge_queue.pop(); - } - - for (purge_elem_list_t::iterator it = purge_elem_list.begin(); - it != purge_elem_list.end(); - ++it) { - - for (TrxUndoRsegs::iterator it2 = it->begin(); - it2 != it->end(); - ++it2) { - if ((*it2)->space == &space) { - it->erase(it2); - break; - } - } - - if (!it->empty()) { - purge_sys.purge_queue.push(*it); - } - } - - mysql_mutex_unlock(&purge_sys.pq_mutex); + mysql_mutex_lock(&pq_mutex); + auto purge_elem_list= clone_queue_container(); + purge_queue.clear(); + for (auto elem : purge_elem_list) + if (purge_queue::rseg(elem)->space != &space) + purge_queue.push_trx_no_rseg(elem); + mysql_mutex_unlock(&pq_mutex); } dberr_t purge_sys_t::iterator::free_history() const @@ -748,7 +677,7 @@ not_free: const char *file_name= UT_LIST_GET_FIRST(space->chain)->name; sql_print_information("InnoDB: Truncating %s", file_name); - trx_purge_cleanse_purge_queue(*space); + purge_sys.cleanse_purge_queue(*space); /* Lock all modified pages of the tablespace. @@ -867,7 +796,7 @@ buf_block_t *purge_sys_t::get_page(page_id_t id) return nullptr; } -void purge_sys_t::rseg_get_next_history_log() +bool purge_sys_t::rseg_get_next_history_log() { fil_addr_t prev_log_addr; @@ -883,21 +812,24 @@ void purge_sys_t::rseg_get_next_history_log() { const byte *log_hdr= undo_page->page.frame + rseg->last_offset(); prev_log_addr= flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE); + if (prev_log_addr.boffset < TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE || + prev_log_addr.boffset >= srv_page_size - TRX_UNDO_LOG_OLD_HDR_SIZE) + goto corrupted; prev_log_addr.boffset = static_cast(prev_log_addr.boffset - TRX_UNDO_HISTORY_NODE); } else - prev_log_addr.page= FIL_NULL; + goto corrupted; - if (prev_log_addr.page == FIL_NULL) + if (prev_log_addr.page >= rseg->space->free_limit) + corrupted: rseg->last_page_no= FIL_NULL; else { /* Read the previous log header. */ trx_id_t trx_no= 0; if (const buf_block_t* undo_page= - get_page(page_id_t(rseg->space->id, - prev_log_addr.page))) + get_page(page_id_t(rseg->space->id, prev_log_addr.page))) { const byte *log_hdr= undo_page->page.frame + prev_log_addr.boffset; trx_no= mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO); @@ -914,12 +846,13 @@ void purge_sys_t::rseg_get_next_history_log() can never produce events from an empty rollback segment. */ mysql_mutex_lock(&pq_mutex); - purge_queue.push(*rseg); + enqueue(*rseg); mysql_mutex_unlock(&pq_mutex); } } rseg->latch.wr_unlock(); + return choose_next_log(); } /** Position the purge sys "iterator" on the undo record to use for purging. @@ -927,11 +860,37 @@ void purge_sys_t::rseg_get_next_history_log() @retval true when purge_sys.rseg->latch was locked */ bool purge_sys_t::choose_next_log() { - if (!rseg_iter.set_next()) - return false; + ut_ad(!next_stored); - hdr_offset= rseg->last_offset(); - hdr_page_no= rseg->last_page_no; + mysql_mutex_lock(&pq_mutex); + if (purge_queue.empty()) { + rseg = nullptr; + mysql_mutex_unlock(&purge_sys.pq_mutex); + return false; + } + rseg= purge_queue.pop(); + mysql_mutex_unlock(&purge_sys.pq_mutex); + + /* We assume in purge of externally stored fields that space + id is in the range of UNDO tablespace space ids */ + ut_ad(rseg->space == fil_system.sys_space || + srv_is_undo_tablespace(rseg->space->id)); + + rseg->latch.wr_lock(SRW_LOCK_CALL); + trx_id_t last_trx_no = rseg->last_trx_no(); + hdr_offset = rseg->last_offset(); + hdr_page_no = rseg->last_page_no; + + /* Only the purge_coordinator_task will access this any of + purge_sys.hdr_page_no, purge_sys.tail. The field purge_sys.head and + purge_sys.view are modified by clone_end_view() in the + purge_coordinator_task while holding exclusive purge_sys.latch. The + purge_sys.view may also be modified by wake_if_not_active() while holding + exclusive purge_sys.latch. The purge_sys.head may be read by + purge_truncation_callback(). */ + ut_a(hdr_page_no != FIL_NULL); + ut_a(tail.trx_no <= last_trx_no); + tail.trx_no = last_trx_no; if (!rseg->needs_purge) { @@ -962,7 +921,7 @@ bool purge_sys_t::choose_next_log() if (!b) goto purge_nothing; undo_rec= - trx_undo_page_get_first_rec(b, page_no, hdr_offset); + trx_undo_page_get_first_rec(b, hdr_page_no, hdr_offset); if (!undo_rec) goto purge_nothing; } @@ -990,12 +949,9 @@ inline trx_purge_rec_t purge_sys_t::get_next_rec(roll_ptr_t roll_ptr) if (!offset) { - /* It is the dummy undo log record, which means that there is no - need to purge this undo log */ - rseg_get_next_history_log(); - - /* Look for the next undo log and record to purge */ - if (choose_next_log()) + /* It is the dummy undo log record, which means that there is no need to + purge this undo log. Look for the next undo log and record to purge */ + if (rseg_get_next_history_log()) rseg->latch.wr_unlock(); return {nullptr, 1}; } @@ -1043,9 +999,8 @@ inline trx_purge_rec_t purge_sys_t::get_next_rec(roll_ptr_t roll_ptr) else { got_no_rec: - rseg_get_next_history_log(); /* Look for the next undo log and record to purge */ - locked= choose_next_log(); + locked= rseg_get_next_history_log(); } if (locked) diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index a9df0dc8e17..abfdc9202df 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -201,7 +201,7 @@ bool trx_rseg_read_wsrep_checkpoint(const buf_block_t *rseg_header, XID &xid) memcpy(xid.data, TRX_RSEG + TRX_RSEG_WSREP_XID_DATA + rseg_header->page.frame, XIDDATASIZE); - return true; + return wsrep_is_wsrep_xid(&xid); } /** Read the WSREP XID from the TRX_SYS page (in case of upgrade). @@ -237,7 +237,8 @@ static bool trx_rseg_init_wsrep_xid(const page_t* page, XID& xid) memcpy(xid.data, TRX_SYS + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_DATA + page, XIDDATASIZE); - return true; + + return wsrep_is_wsrep_xid(&xid); } /** Recover the latest WSREP checkpoint XID. @@ -453,7 +454,14 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) { if (!rseg->space) return DB_TABLESPACE_NOT_FOUND; + + /* Access the tablespace header page to recover rseg->space->free_limit */ + page_id_t page_id{rseg->space->id, 0}; dberr_t err; + if (!buf_page_get_gen(page_id, 0, RW_X_LATCH, nullptr, BUF_GET, mtr, &err)) + return err; + mtr->release_last_page(); + page_id.set_page_no(rseg->page_no); const buf_block_t *rseg_hdr= buf_page_get_gen(rseg->page_id(), 0, RW_X_LATCH, nullptr, BUF_GET, mtr, &err); @@ -498,10 +506,17 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) trx_sys.recovered_binlog_offset= binlog_offset; trx_sys.recovered_binlog_is_legacy_pos= false; } -#ifdef WITH_WSREP - trx_rseg_read_wsrep_checkpoint(rseg_hdr, trx_sys.recovered_wsrep_xid); -#endif } +#ifdef WITH_WSREP + XID tmp_xid; + tmp_xid.null(); + /* Update recovered wsrep xid only if we found wsrep xid from + rseg header page and read xid seqno is larger than currently + recovered xid seqno. */ + if (trx_rseg_read_wsrep_checkpoint(rseg_hdr, tmp_xid) && + wsrep_xid_seqno(&tmp_xid) > wsrep_xid_seqno(&trx_sys.recovered_wsrep_xid)) + trx_sys.recovered_wsrep_xid.set(&tmp_xid); +#endif } if (srv_operation == SRV_OPERATION_RESTORE) @@ -523,6 +538,11 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) fil_addr_t node_addr= flst_get_last(TRX_RSEG + TRX_RSEG_HISTORY + rseg_hdr->page.frame); + if (node_addr.page >= rseg->space->free_limit || + node_addr.boffset < TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE || + node_addr.boffset >= srv_page_size - TRX_UNDO_LOG_OLD_HDR_SIZE) + return DB_CORRUPTION; + node_addr.boffset= static_cast(node_addr.boffset - TRX_UNDO_HISTORY_NODE); rseg->last_page_no= node_addr.page; @@ -547,7 +567,7 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) if (rseg->last_page_no != FIL_NULL) /* There is no need to cover this operation by the purge mutex because we are still bootstrapping. */ - purge_sys.purge_queue.push(*rseg); + purge_sys.enqueue(*rseg); } trx_sys.set_undo_non_empty(rseg->history_size > 0); @@ -588,7 +608,17 @@ dberr_t trx_rseg_array_init() #endif mtr_t mtr; dberr_t err = DB_SUCCESS; - + /* mariabackup --prepare only deals with the redo log and the data + files, not with transactions or the data dictionary, that's why + trx_lists_init_at_db_start() does not invoke purge_sys.create() and + purge queue mutex stays uninitialized, and trx_rseg_mem_restore() quits + before initializing undo log lists. */ + if (srv_operation != SRV_OPERATION_RESTORE) + /* Acquiring purge queue mutex here should be fine from the + deadlock prevention point of view, because executing that + function is a prerequisite for starting the purge subsystem or + any transactions. */ + purge_sys.queue_lock(); for (ulint rseg_id = 0; rseg_id < TRX_SYS_N_RSEGS; rseg_id++) { mtr.start(); if (const buf_block_t* sys = trx_sysf_get(&mtr, true)) { @@ -658,7 +688,8 @@ dberr_t trx_rseg_array_init() mtr.commit(); } - + if (srv_operation != SRV_OPERATION_RESTORE) + purge_sys.queue_unlock(); if (err != DB_SUCCESS) { for (auto& rseg : trx_sys.rseg_array) { while (auto u = UT_LIST_GET_FIRST(rseg.undo_list)) { diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index c16d704c69e..ff9d8c55119 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1142,15 +1142,23 @@ inline void trx_t::write_serialisation_history(mtr_t *mtr) } else if (rseg->last_page_no == FIL_NULL) { - mysql_mutex_lock(&purge_sys.pq_mutex); + /* trx_sys.assign_new_trx_no() and + purge_sys.enqueue() must be invoked in the same + critical section protected with purge queue mutex to avoid rseg with + greater last commit number to be pushed to purge queue prior to rseg with + lesser last commit number. In other words pushing to purge queue must be + serialized along with assigning trx_no. Otherwise purge coordinator + thread can also fetch redo log records from rseg with greater last commit + number before rseg with lesser one. */ + purge_sys.queue_lock(); trx_sys.assign_new_trx_no(this); const trx_id_t end{rw_trx_hash_element->no}; + rseg->last_page_no= undo->hdr_page_no; /* end cannot be less than anything in rseg. User threads only produce events when a rollback segment is empty. */ - purge_sys.purge_queue.push(TrxUndoRsegs{end, *rseg}); - mysql_mutex_unlock(&purge_sys.pq_mutex); - rseg->last_page_no= undo->hdr_page_no; rseg->set_last_commit(undo->hdr_offset, end); + purge_sys.enqueue(end, *rseg); + purge_sys.queue_unlock(); } else trx_sys.assign_new_trx_no(this); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 566a753fe9e..a249fbaf14e 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -134,8 +134,9 @@ trx_undo_page_get_first_rec(const buf_block_t *block, uint32_t page_no, uint16_t offset) { uint16_t start= trx_undo_page_get_start(block, page_no, offset); - return start == trx_undo_page_get_end(block, page_no, offset) - ? nullptr : block->page.frame + start; + uint16_t end= trx_undo_page_get_end(block, page_no, offset); + ut_ad(start <= end); + return start >= end ? nullptr : block->page.frame + start; } /** Get the last undo log record on a page. @@ -149,8 +150,10 @@ trx_undo_rec_t* trx_undo_page_get_last_rec(const buf_block_t *block, uint32_t page_no, uint16_t offset) { + uint16_t start= trx_undo_page_get_start(block, page_no, offset); uint16_t end= trx_undo_page_get_end(block, page_no, offset); - return trx_undo_page_get_start(block, page_no, offset) == end + ut_ad(start <= end); + return start >= end ? nullptr : block->page.frame + mach_read_from_2(block->page.frame + end - 2); } @@ -510,7 +513,7 @@ trx_undo_seg_create(fil_space_t *space, buf_block_t *rseg_hdr, ulint *id, *err = flst_add_last(block, TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, block, TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, - mtr); + space->free_limit, mtr); *id = slot_no; mtr->write<4>(*rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS @@ -688,7 +691,8 @@ buf_block_t *trx_undo_add_page(trx_undo_t *undo, mtr_t *mtr, dberr_t *err) mtr->undo_create(*new_block); trx_undo_page_init(*new_block); *err= flst_add_last(header_block, TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, - new_block, TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr); + new_block, TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, + rseg->space->free_limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) new_block= nullptr; else @@ -739,9 +743,11 @@ trx_undo_free_page( buf_page_make_young_if_needed(&header_block->page); + const uint32_t limit = rseg->space->free_limit; + *err = flst_remove(header_block, TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, undo_block, TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, - mtr); + limit, mtr); if (UNIV_UNLIKELY(*err != DB_SUCCESS)) { return FIL_NULL; @@ -750,7 +756,13 @@ trx_undo_free_page( const fil_addr_t last_addr = flst_get_last( TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + header_block->page.frame); - if (UNIV_UNLIKELY(last_addr.page == page_no)) { + if (UNIV_UNLIKELY(last_addr.page == page_no) + || UNIV_UNLIKELY(last_addr.page != FIL_NULL + && last_addr.page >= limit) + || UNIV_UNLIKELY(last_addr.boffset < TRX_UNDO_PAGE_HDR + + TRX_UNDO_PAGE_NODE) + || UNIV_UNLIKELY(last_addr.boffset >= srv_page_size + - TRX_UNDO_LOG_OLD_HDR_SIZE)) { *err = DB_CORRUPTION; return FIL_NULL; } @@ -967,8 +979,8 @@ trx_undo_mem_create_at_db_start(trx_rseg_t *rseg, ulint id, uint32_t page_no) ut_ad(id < TRX_RSEG_N_SLOTS); mtr.start(); - const buf_block_t* block = buf_page_get( - page_id_t(rseg->space->id, page_no), 0, RW_X_LATCH, &mtr); + const page_id_t page_id{rseg->space->id, page_no}; + const buf_block_t* block = buf_page_get(page_id, 0, RW_X_LATCH, &mtr); if (UNIV_UNLIKELY(!block)) { corrupted: mtr.commit(); @@ -1070,6 +1082,15 @@ corrupted_type: fil_addr_t last_addr = flst_get_last( TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST + block->page.frame); + if (last_addr.page >= rseg->space->free_limit + || last_addr.boffset < TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE + || last_addr.boffset >= srv_page_size + - TRX_UNDO_LOG_OLD_HDR_SIZE) { + corrupted_undo: + ut_free(undo); + goto corrupted; + } + undo->last_page_no = last_addr.page; undo->top_page_no = last_addr.page; @@ -1078,8 +1099,7 @@ corrupted_type: RW_X_LATCH, &mtr); if (UNIV_UNLIKELY(!last)) { - ut_free(undo); - goto corrupted; + goto corrupted_undo; } if (const trx_undo_rec_t* rec = trx_undo_page_get_last_rec( diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index 033e88bb8e5..9bdd7298400 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -124,7 +124,7 @@ ENDIF() IF (CURL_FOUND) INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) MYSQL_ADD_PLUGIN(s3 ha_s3.cc ${S3_SOURCES} COMPONENT s3-engine - LINK_LIBRARIES ${CURL_LIBRARIES} z STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf) + LINK_LIBRARIES ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} STORAGE_ENGINE NOT_EMBEDDED CONFIG s3.cnf) ENDIF() SET(CPACK_RPM_s3-engine_PACKAGE_SUMMARY "Amazon S3 archival storage engine for MariaDB" PARENT_SCOPE) @@ -132,7 +132,7 @@ SET(CPACK_RPM_s3-engine_PACKAGE_DESCRIPTION "The S3 storage engine allows one to IF(TARGET s3) MYSQL_ADD_EXECUTABLE(aria_s3_copy aria_s3_copy.cc ${S3_SOURCES} COMPONENT s3-engine) - TARGET_LINK_LIBRARIES(aria_s3_copy aria myisam mysys mysys_ssl ${CURL_LIBRARIES} ${ZLIB_LIBRARY}) + TARGET_LINK_LIBRARIES(aria_s3_copy aria myisam mysys mysys_ssl ${CURL_LIBRARIES} ${ZLIB_LIBRARIES}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libmarias3) ADD_DEFINITIONS(-DWITH_S3_STORAGE_ENGINE) INSTALL_MANPAGES(s3-engine aria_s3_copy.1) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 2df1b5a2ed1..eeb613acc4f 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1967,40 +1967,45 @@ int ha_maria::preload_keys(THD * thd, HA_CHECK_OPT *check_opt) SYNOPSIS disable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ disable all non-unique keys - HA_KEY_SWITCH_ALL disable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_ALL_SAVE is not implemented. + DESCRIPTION + See handler::ha_disable_indexes() RETURN 0 ok HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_maria::disable_indexes(uint mode) +int ha_maria::disable_indexes(key_map map, bool persist) { int error; - if (mode == HA_KEY_SWITCH_ALL) + if (!persist) { /* call a storage engine function to switch the key map */ + DBUG_ASSERT(map.is_clear_all()); error= maria_disable_indexes(file); } - else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) - { - maria_extra(file, HA_EXTRA_NO_KEYS, 0); - info(HA_STATUS_CONST); // Read new key info - error= 0; - } else { - /* mode not implemented */ - error= HA_ERR_WRONG_COMMAND; + /* auto-inc key cannot be disabled */ + if (table->s->next_number_index < MAX_KEY) + DBUG_ASSERT(map.is_set(table->s->next_number_index)); + + /* unique keys cannot be disabled either */ + for (uint i=0; i < table->s->keys; i++) + DBUG_ASSERT(!(table->key_info[i].flags & HA_NOSAME) || map.is_set(i)); + + ulonglong ullmap= map.to_ulonglong(); + + /* make sure auto-inc key is enabled even if it's > 64 */ + if (map.length() > MARIA_KEYMAP_BITS && + table->s->next_number_index < MAX_KEY) + maria_set_key_active(ullmap, table->s->next_number_index); + + maria_extra(file, HA_EXTRA_NO_KEYS, &ullmap); + info(HA_STATUS_CONST); // Read new key info + error= 0; } return error; } @@ -2011,21 +2016,14 @@ int ha_maria::disable_indexes(uint mode) SYNOPSIS enable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ enable all non-unique keys - HA_KEY_SWITCH_ALL enable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent DESCRIPTION Enable indexes, which might have been disabled by disable_index() before. - The modes without _SAVE work only if both data and indexes are empty, - since the MARIA repair would enable them persistently. + If persist=false, it works only if both data and indexes are empty, + since the Aria repair would enable them persistently. To be sure in these cases, call handler::delete_all_rows() before. - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_ALL_SAVE is not implemented. + See also handler::ha_enable_indexes() RETURN 0 ok @@ -2034,18 +2032,19 @@ int ha_maria::disable_indexes(uint mode) HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_maria::enable_indexes(uint mode) +int ha_maria::enable_indexes(key_map map, bool persist) { int error; ha_rows start_rows= file->state->records; - DBUG_PRINT("info", ("ha_maria::enable_indexes mode: %d", mode)); + DBUG_PRINT("info", ("ha_maria::enable_indexes mode: %d", persist)); if (maria_is_all_keys_active(file->s->state.key_map, file->s->base.keys)) { /* All indexes are enabled already. */ return 0; } - if (mode == HA_KEY_SWITCH_ALL) + DBUG_ASSERT(map.is_prefix(table->s->keys)); + if (!persist) { error= maria_enable_indexes(file); /* @@ -2054,7 +2053,7 @@ int ha_maria::enable_indexes(uint mode) but mode==HA_KEY_SWITCH_ALL forbids it. */ } - else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) + else { THD *thd= table->in_use; HA_CHECK *param= (HA_CHECK*) thd->alloc(sizeof *param); @@ -2119,11 +2118,6 @@ int ha_maria::enable_indexes(uint mode) info(HA_STATUS_CONST); thd_proc_info(thd, save_proc_info); } - else - { - /* mode not implemented */ - error= HA_ERR_WRONG_COMMAND; - } DBUG_EXECUTE_IF("maria_flush_whole_log", { DBUG_PRINT("maria_flush_whole_log", ("now")); @@ -2326,7 +2320,7 @@ int ha_maria::end_bulk_insert() { int first_error, first_errno= 0, error; my_bool abort= file->s->deleting, empty_table= 0; - uint enable_index_mode= HA_KEY_SWITCH_NONUNIQ_SAVE; + bool enable_persistently= true; DBUG_ENTER("ha_maria::end_bulk_insert"); if ((first_error= maria_end_bulk_insert(file, abort))) @@ -2355,7 +2349,7 @@ int ha_maria::end_bulk_insert() first_error= 1; first_errno= my_errno; } - enable_index_mode= HA_KEY_SWITCH_ALL; + enable_persistently= false; empty_table= 1; /* Ignore all changed pages, required by _ma_renable_logging_for_table() @@ -2367,7 +2361,7 @@ int ha_maria::end_bulk_insert() if (!abort && can_enable_indexes) { - if ((error= enable_indexes(enable_index_mode))) + if ((error= enable_indexes(key_map(table->s->keys), enable_persistently))) { if (!first_error) { diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index c974a7e3bf6..3c0d0cc463e 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -122,8 +122,8 @@ public: int external_lock(THD * thd, int lock_type) override; int start_stmt(THD *thd, thr_lock_type lock_type) override final; int delete_all_rows(void) override final; - int disable_indexes(uint mode) override final; - int enable_indexes(uint mode) override final; + int disable_indexes(key_map map, bool persist) override final; + int enable_indexes(key_map map, bool persist) override final; int indexes_are_disabled(void) override final; void start_bulk_insert(ha_rows rows, uint flags) override final; int end_bulk_insert() override final; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 5e6644ac9f3..8c07e3c67f6 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2508,6 +2508,11 @@ static int initialize_variables_for_repair(HA_CHECK *param, maria_versioning(info, 0); /* remember original number of rows */ *info->state= info->s->state.state; + if (share->data_file_type == BLOCK_RECORD) + share->state.state.data_file_length= MY_ALIGN(sort_info->filelength, + share->block_size); + else + share->state.state.data_file_length= sort_info->filelength; return 0; } @@ -2744,7 +2749,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, READ_CACHE, share->pack.header_length, 1, MYF(MY_WME))) goto err; } - if (sort_info.new_info->s->data_file_type != BLOCK_RECORD) + if (!block_record) { /* When writing to not block records, we need a write buffer */ if (!rep_quick) @@ -2757,7 +2762,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, sort_info.new_info->opt_flag|=WRITE_CACHE_USED; } } - else if (block_record) + else { scan_inited= 1; if (maria_scan_init(sort_info.info)) @@ -3390,7 +3395,7 @@ static int sort_one_index(HA_CHECK *param, MARIA_HA *info, length= page.size; bzero(buff+length,keyinfo->block_length-length); if (write_page(share, new_file, buff, keyinfo->block_length, - new_page_pos, MYF(MY_NABP | MY_WAIT_IF_FULL))) + new_page_pos, MYF(MY_NABP | MY_WAIT_IF_FULL) & param->myf_rw)) { _ma_check_print_error(param,"Can't write indexblock, error: %d",my_errno); goto err; @@ -4117,6 +4122,9 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, _ma_check_print_error(param, "Couldn't change to new data file"); goto err; } + /* Inform sort_delete_record that we are using the new file */ + sort_info.new_info->dfile.file= info->rec_cache.file= info->dfile.file; + if (param->testflag & T_UNPACK) restore_data_file_type(share); diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 08f62f31507..e73ac95cd35 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -239,25 +239,17 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, break; /* we're going to modify pieces of the state, stall Checkpoint */ - mysql_mutex_lock(&share->intern_lock); if (info->lock_type == F_UNLCK) { - mysql_mutex_unlock(&share->intern_lock); error= 1; /* Not possibly if not lock */ break; } + mysql_mutex_lock(&share->intern_lock); if (maria_is_any_key_active(share->state.key_map)) { - MARIA_KEYDEF *key= share->keyinfo; - uint i; - for (i =0 ; i < share->base.keys ; i++,key++) - { - if (!(key->flag & HA_NOSAME) && info->s->base.auto_key != i+1) - { - maria_clear_key_active(share->state.key_map, i); - info->update|= HA_STATE_CHANGED; - } - } + if (share->state.key_map != *(ulonglong*)extra_arg) + info->update|= HA_STATE_CHANGED; + share->state.key_map= *(ulonglong*)extra_arg; if (!share->changed) { @@ -610,6 +602,20 @@ uint _ma_file_callback_to_id(void *callback_data) return share ? share->id : 0; } +/* + Disable MY_WAIT_IF_FULL flag for temporary tables + + Temporary tables does not have MY_WAIT_IF_FULL in share->write_flags +*/ + +uint _ma_write_flags_callback(void *callback_data, myf flags) +{ + MARIA_SHARE *share= (MARIA_SHARE*) callback_data; + if (share) + flags&= ~(~share->write_flag & MY_WAIT_IF_FULL); + return flags; +} + /** @brief flushes the data and/or index file of a table diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 99a7e2099b7..ca19720245e 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -3609,6 +3609,9 @@ static my_bool translog_is_LSN_chunk(uchar type) @retval 1 Error */ +/* Stack size 26120 from clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + my_bool translog_init_with_table(const char *directory, uint32 log_file_max_size, uint32 server_version, @@ -4261,6 +4264,7 @@ err: ma_message_no_user(0, "log initialization failed"); DBUG_RETURN(1); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index 8e311ee715c..35578877a2f 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -171,7 +171,6 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share, mysql_mutex_lock(&share->intern_lock); info.read_record= share->read_record; share->reopen++; - share->write_flag=MYF(MY_NABP | MY_WAIT_IF_FULL); if (share->options & HA_OPTION_READ_ONLY_DATA) { info.lock_type=F_RDLCK; @@ -986,6 +985,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags, share->options|= HA_OPTION_READ_ONLY_DATA; share->is_log_table= FALSE; + share->write_flag=MYF(MY_NABP | MY_WAIT_IF_FULL); if (open_flags & HA_OPEN_TMP_TABLE || share->options & HA_OPTION_TMP_TABLE) { share->options|= HA_OPTION_TMP_TABLE; @@ -1558,6 +1558,9 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) @retval 1 Error */ +/* Stack size 26376 from clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) { uchar buff[MARIA_STATE_INFO_SIZE + MARIA_STATE_EXTRA_SIZE]; @@ -1632,6 +1635,7 @@ uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) MYF(MY_NABP)); DBUG_RETURN(res != 0); } +PRAGMA_REENABLE_CHECK_STACK_FRAME static uchar *_ma_state_info_read(uchar *ptr, MARIA_STATE_INFO *state, myf flag) diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index c4c85d0bdd0..bc92eb66168 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -687,6 +687,8 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache, /* FIXME: ENGINE=Aria occasionally writes uninitialized data */ __msan_unpoison(args.page, pagecache->block_size); #endif + /* Reset MY_WAIT_IF_FULL for temporary tables */ + flags= _ma_write_flags_callback(filedesc->callback_data, flags); res= (int)my_pwrite(filedesc->file, args.page, pagecache->block_size, ((my_off_t) pageno << pagecache->shift), flags); (*filedesc->post_write_hook)(res, &args); diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 90d0ed3c708..f05b366f0bf 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -1165,11 +1165,12 @@ end: /* The record may come from REPAIR, ALTER TABLE ENABLE KEYS, OPTIMIZE. */ + prototype_redo_exec_hook(REDO_REPAIR_TABLE) { int error= 1; MARIA_HA *info; - HA_CHECK param; + HA_CHECK *param; char *name; my_bool quick_repair; DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE"); @@ -1201,35 +1202,39 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE) */ tprint(tracef, " repairing...\n"); - maria_chk_init(¶m); - param.isam_file_name= name= info->s->open_file_name.str; - param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE); - param.tmpdir= maria_tmpdir; - param.max_trid= max_long_trid; + if (!(param= my_malloc(PSI_INSTRUMENT_ME, sizeof(*param), MYF(MY_WME)))) + DBUG_RETURN(0); + + maria_chk_init(param); + param->isam_file_name= name= info->s->open_file_name.str; + param->testflag= uint8korr(rec->header + FILEID_STORE_SIZE); + param->tmpdir= maria_tmpdir; + param->max_trid= max_long_trid; DBUG_ASSERT(maria_tmpdir); info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8); - quick_repair= MY_TEST(param.testflag & T_QUICK); + quick_repair= MY_TEST(param->testflag & T_QUICK); - if (param.testflag & T_REP_PARALLEL) + if (param->testflag & T_REP_PARALLEL) { - if (maria_repair_parallel(¶m, info, name, quick_repair)) + if (maria_repair_parallel(param, info, name, quick_repair)) goto end; } - else if (param.testflag & T_REP_BY_SORT) + else if (param->testflag & T_REP_BY_SORT) { - if (maria_repair_by_sort(¶m, info, name, quick_repair)) + if (maria_repair_by_sort(param, info, name, quick_repair)) goto end; } - else if (maria_repair(¶m, info, name, quick_repair)) + else if (maria_repair(param, info, name, quick_repair)) goto end; if (_ma_update_state_lsns(info->s, rec->lsn, trnman_get_min_safe_trid(), - TRUE, !(param.testflag & T_NO_CREATE_RENAME_LSN))) + TRUE, !(param->testflag & T_NO_CREATE_RENAME_LSN))) goto end; error= 0; end: + my_free(param); DBUG_RETURN(error); } @@ -2581,6 +2586,8 @@ prototype_undo_exec_hook(UNDO_BULK_INSERT) return error; } +/* Stack size 18776 in clang. Ok as this is during recover */ +PRAGMA_DISABLE_CHECK_STACK_FRAME static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply) { @@ -2824,6 +2831,7 @@ err: translog_free_record_header(&rec); DBUG_RETURN(1); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index f8398316130..147dc83d78a 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1778,6 +1778,7 @@ extern my_bool ma_yield_and_check_if_killed(MARIA_HA *info, int inx); extern my_bool ma_killed_standalone(MARIA_HA *); extern uint _ma_file_callback_to_id(void *callback_data); +extern uint _ma_write_flags_callback(void *callback_data, myf flags); extern void free_maria_share(MARIA_SHARE *share); static inline void unmap_file(MARIA_HA *info __attribute__((unused))) diff --git a/storage/maria/unittest/CMakeLists.txt b/storage/maria/unittest/CMakeLists.txt index a2da1507c97..a7b3441044d 100644 --- a/storage/maria/unittest/CMakeLists.txt +++ b/storage/maria/unittest/CMakeLists.txt @@ -15,7 +15,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/unittest/mytap) -LINK_LIBRARIES(aria myisam mytap mysys dbug strings ${ZLIB_LIBRARY}) +LINK_LIBRARIES(aria myisam mytap mysys dbug strings ${ZLIB_LIBRARIES}) MY_ADD_TESTS(ma_control_file trnman) diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c index 49184447356..0a1d396e42e 100644 --- a/storage/maria/unittest/ma_test_loghandler-t.c +++ b/storage/maria/unittest/ma_test_loghandler-t.c @@ -143,6 +143,8 @@ static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec, } +PRAGMA_DISABLE_CHECK_STACK_FRAME + int main(int argc __attribute__((unused)), char *argv[]) { uint32 i; @@ -664,5 +666,6 @@ err: my_end(0); return(MY_TEST(exit_status())); } +PRAGMA_REENABLE_CHECK_STACK_FRAME #include "../ma_check_standalone.h" diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index b398ea1d158..d9d2e85307e 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -4352,9 +4352,9 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint open_options) // TODO: implemented by "reindex" instead of "remove and recreate". // Because "remove and recreate" invalidates opened indexes by // other threads. - error = wrapper_disable_indexes_mroonga(HA_KEY_SWITCH_ALL); + error = wrapper_disable_indexes_mroonga(key_map(table->s->keys), false); if (!error) { - error = wrapper_enable_indexes_mroonga(HA_KEY_SWITCH_ALL); + error = wrapper_enable_indexes_mroonga(key_map(table->s->keys), false); } } } @@ -13678,197 +13678,184 @@ int ha_mroonga::generic_disable_index(int i, KEY *key_info) DBUG_RETURN(error); } -int ha_mroonga::wrapper_disable_indexes_mroonga(uint mode) +int ha_mroonga::wrapper_disable_indexes_mroonga(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { - uint i; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (share->wrap_key_nr[i] < MAX_KEY) { - continue; - } - if (!grn_index_tables[i]) { - DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); - DBUG_RETURN(0); - } + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + for (i = 0; i < table_share->keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + continue; } - KEY *key_info = table_share->key_info; - for (i = 0; i < table_share->keys; i++) { - if (!(key_info[i].flags & HA_FULLTEXT) && - !mrn_is_geo_key(&key_info[i])) { - continue; - } - int sub_error = generic_disable_index(i, key_info); - if (error != 0 && sub_error != 0) { - error = sub_error; - } + int sub_error = generic_disable_index(i, key_info); + if (error != 0 && sub_error != 0) { + error = sub_error; } - } else { - error = HA_ERR_WRONG_COMMAND; } DBUG_RETURN(error); } -int ha_mroonga::wrapper_disable_indexes(uint mode) +int ha_mroonga::wrapper_disable_indexes(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); - error = wrap_handler->ha_disable_indexes(mode); + error = wrap_handler->ha_disable_indexes(map, persist); MRN_SET_BASE_SHARE_KEY(share, table->s); MRN_SET_BASE_TABLE_KEY(this, table); if (error == HA_ERR_WRONG_COMMAND) { error = 0; } if (!error) { - error = wrapper_disable_indexes_mroonga(mode); + error = wrapper_disable_indexes_mroonga(map, persist); } DBUG_RETURN(error); } -int ha_mroonga::storage_disable_indexes(uint mode) +int ha_mroonga::storage_disable_indexes(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { - uint i; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (!grn_index_tables[i]) { - DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); - DBUG_RETURN(0); - } + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (map.is_set(i)) { + continue; } - KEY *key_info = table_share->key_info; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE && - (key_info[i].flags & HA_NOSAME)) { - continue; - } - int sub_error = generic_disable_index(i, key_info); - if (error != 0 && sub_error != 0) { - error = sub_error; - } + int sub_error = generic_disable_index(i, key_info); + if (error != 0 && sub_error != 0) { + error = sub_error; } - } else { - DBUG_RETURN(HA_ERR_WRONG_COMMAND); } DBUG_RETURN(error); } -int ha_mroonga::disable_indexes(uint mode) +int ha_mroonga::disable_indexes(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); if (share->wrapper_mode) { - error = wrapper_disable_indexes(mode); + error = wrapper_disable_indexes(map, persist); } else { - error = storage_disable_indexes(mode); + error = storage_disable_indexes(map, persist); } DBUG_RETURN(error); } -int ha_mroonga::wrapper_enable_indexes_mroonga(uint mode) +int ha_mroonga::wrapper_enable_indexes_mroonga(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { - uint i, j; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (share->wrap_key_nr[i] < MAX_KEY) { - continue; - } - if (!grn_index_columns[i]) { - break; - } + uint i, j; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; } - if (i == table_share->keys) { - DBUG_PRINT("info", ("mroonga: keys are enabled already")); - DBUG_RETURN(0); + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_columns[i]) { + break; + } + } + if (i == table_share->keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + DBUG_RETURN(0); + } + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *key_info = table_share->key_info; + uint n_keys = table_share->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + mrn::PathMapper mapper(share->table_name); + for (i = 0, j = 0; i < n_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + j++; + continue; } - KEY *p_key_info = &table->key_info[table_share->primary_key]; - KEY *key_info = table_share->key_info; - uint n_keys = table_share->keys; - MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); - MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); - bitmap_clear_all(table->read_set); - mrn_set_bitmap_by_key(table->read_set, p_key_info); - mrn::PathMapper mapper(share->table_name); - for (i = 0, j = 0; i < n_keys; i++) { - if (!(key_info[i].flags & HA_FULLTEXT) && - !mrn_is_geo_key(&key_info[i])) { - j++; - continue; - } - if ((error = mrn_add_index_param(share, &key_info[i], i))) - { - break; - } - index_tables[i] = NULL; - index_columns[i] = NULL; - if (!grn_index_columns[i]) { - if ( - (key_info[i].flags & HA_FULLTEXT) && - (error = wrapper_create_index_fulltext(mapper.table_name(), - i, &key_info[i], - index_tables, index_columns, - share)) - ) { - break; - } else if ( - mrn_is_geo_key(&key_info[i]) && - (error = wrapper_create_index_geo(mapper.table_name(), - i, &key_info[i], - index_tables, index_columns, - share)) - ) { - break; - } - grn_index_columns[i] = index_columns[i]; - } - mrn_set_bitmap_by_key(table->read_set, &key_info[i]); - } - if (!error && i > j) + if ((error = mrn_add_index_param(share, &key_info[i], i))) { - error = wrapper_fill_indexes(ha_thd(), table->key_info, index_columns, - n_keys); + break; } - bitmap_set_all(table->read_set); - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); - } else { - error = HA_ERR_WRONG_COMMAND; + index_tables[i] = NULL; + index_columns[i] = NULL; + if (!grn_index_columns[i]) { + if ( + (key_info[i].flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } else if ( + mrn_is_geo_key(&key_info[i]) && + (error = wrapper_create_index_geo(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } + grn_index_columns[i] = index_columns[i]; + } + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); } + if (!error && i > j) + { + error = wrapper_fill_indexes(ha_thd(), table->key_info, index_columns, + n_keys); + } + bitmap_set_all(table->read_set); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); DBUG_RETURN(error); } -int ha_mroonga::wrapper_enable_indexes(uint mode) +int ha_mroonga::wrapper_enable_indexes(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); - int mroonga_error = wrapper_enable_indexes_mroonga(mode); + int mroonga_error = wrapper_enable_indexes_mroonga(map, persist); MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); - error = wrap_handler->ha_enable_indexes(mode); + error = wrap_handler->ha_enable_indexes(map, persist); MRN_SET_BASE_SHARE_KEY(share, table->s); MRN_SET_BASE_TABLE_KEY(this, table); if (error == HA_ERR_WRONG_COMMAND) { @@ -13877,95 +13864,86 @@ int ha_mroonga::wrapper_enable_indexes(uint mode) DBUG_RETURN(error); } -int ha_mroonga::storage_enable_indexes(uint mode) +int ha_mroonga::storage_enable_indexes(key_map map, bool persist) { int error = 0; uint n_keys = table_share->keys; MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); bool have_multiple_column_index = false; - bool skip_unique_key = (mode == HA_KEY_SWITCH_NONUNIQ_SAVE); MRN_DBUG_ENTER_METHOD(); - if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { - uint i; - for (i = 0; i < table_share->keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (!grn_index_columns[i]) { - break; - } + uint i; + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; } - if (i == table_share->keys) { - DBUG_PRINT("info", ("mroonga: keys are enabled already")); - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); - DBUG_RETURN(0); + if (!grn_index_columns[i]) { + break; + } + } + if (i == n_keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(0); + } + KEY *key_info = table->key_info; + bitmap_clear_all(table->read_set); + mrn::PathMapper mapper(share->table_name); + for (; i < n_keys; i++) { + if (!map.is_set(i)) { + continue; } - KEY *key_info = table->key_info; - bitmap_clear_all(table->read_set); - mrn::PathMapper mapper(share->table_name); - for (i = 0; i < n_keys; i++) { - if (i == table->s->primary_key) { - continue; - } - if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) { - continue; - } - if ((error = mrn_add_index_param(share, &key_info[i], i))) + if ((error = mrn_add_index_param(share, &key_info[i], i))) + { + break; + } + index_tables[i] = NULL; + if (!grn_index_columns[i]) { + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + share, &key_info[i], index_tables, + index_columns, i))) { break; } - index_tables[i] = NULL; - if (!grn_index_columns[i]) { - if ((error = storage_create_index(table, mapper.table_name(), grn_table, - share, &key_info[i], index_tables, - index_columns, i))) - { - break; - } - if ( - KEY_N_KEY_PARTS(&(key_info[i])) != 1 && - !(key_info[i].flags & HA_FULLTEXT) - ) { - mrn_set_bitmap_by_key(table->read_set, &key_info[i]); - have_multiple_column_index = true; - } - grn_index_tables[i] = index_tables[i]; - grn_index_columns[i] = index_columns[i]; - } else { - index_columns[i] = NULL; + if ( + KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; } + grn_index_tables[i] = index_tables[i]; + grn_index_columns[i] = index_columns[i]; + } else { + index_columns[i] = NULL; } - if (!error && have_multiple_column_index) - { - error = storage_add_index_multiple_columns(key_info, n_keys, - index_tables, - index_columns, - skip_unique_key); - } - bitmap_set_all(table->read_set); - } else { - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); - MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); - DBUG_RETURN(HA_ERR_WRONG_COMMAND); } + if (!error && have_multiple_column_index) + { + bool skip_unique_key= !table->s->keys_in_use.is_clear_all(); + error = storage_add_index_multiple_columns(key_info, n_keys, + index_tables, + index_columns, + skip_unique_key); + } + bitmap_set_all(table->read_set); MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); DBUG_RETURN(error); } -int ha_mroonga::enable_indexes(uint mode) +int ha_mroonga::enable_indexes(key_map map, bool persist) { int error = 0; MRN_DBUG_ENTER_METHOD(); share->disable_keys = false; if (share->wrapper_mode) { - error = wrapper_enable_indexes(mode); + error = wrapper_enable_indexes(map, persist); } else { - error = storage_enable_indexes(mode); + error = storage_enable_indexes(map, persist); } DBUG_RETURN(error); } diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 52fd0ef9a0e..394eba7eb0e 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -544,8 +544,8 @@ public: bool is_crashed() const mrn_override; bool auto_repair(int error) const mrn_override; bool auto_repair() const; - int disable_indexes(uint mode) mrn_override; - int enable_indexes(uint mode) mrn_override; + int disable_indexes(key_map map, bool persist) mrn_override; + int enable_indexes(key_map map, bool persist) mrn_override; int check(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; int repair(THD* thd, HA_CHECK_OPT* check_opt) mrn_override; bool check_and_repair(THD *thd) mrn_override; @@ -1146,12 +1146,12 @@ private: bool wrapper_auto_repair(int error) const; bool storage_auto_repair(int error) const; int generic_disable_index(int i, KEY *key_info); - int wrapper_disable_indexes_mroonga(uint mode); - int wrapper_disable_indexes(uint mode); - int storage_disable_indexes(uint mode); - int wrapper_enable_indexes_mroonga(uint mode); - int wrapper_enable_indexes(uint mode); - int storage_enable_indexes(uint mode); + int wrapper_disable_indexes_mroonga(key_map map, bool persist); + int wrapper_disable_indexes(key_map map, bool persist); + int storage_disable_indexes(key_map map, bool persist); + int wrapper_enable_indexes_mroonga(key_map map, bool persist); + int wrapper_enable_indexes(key_map map, bool persist); + int storage_enable_indexes(key_map map, bool persist); int wrapper_check(THD* thd, HA_CHECK_OPT* check_opt); int storage_check(THD* thd, HA_CHECK_OPT* check_opt); int wrapper_fill_indexes(THD *thd, KEY *key_info, diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt index 5b25ada4f5b..cdbfb8f160b 100644 --- a/storage/mroonga/vendor/groonga/CMakeLists.txt +++ b/storage/mroonga/vendor/groonga/CMakeLists.txt @@ -200,6 +200,7 @@ endif() include_directories( BEFORE + ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/lib diff --git a/storage/mroonga/vendor/groonga/lib/db.c b/storage/mroonga/vendor/groonga/lib/db.c index c3bbb64f703..65463bdad20 100644 --- a/storage/mroonga/vendor/groonga/lib/db.c +++ b/storage/mroonga/vendor/groonga/lib/db.c @@ -38,6 +38,7 @@ #include "grn_util.h" #include "grn_cache.h" #include "grn_window_functions.h" +#include #include #include @@ -1060,6 +1061,8 @@ grn_table_create_validate(grn_ctx *ctx, const char *name, unsigned int name_size return ctx->rc; } +PRAGMA_DISABLE_CHECK_STACK_FRAME + static grn_obj * grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name, unsigned int name_size, const char *path, @@ -1238,6 +1241,7 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name, } return res; } +PRAGMA_REENABLE_CHECK_STACK_FRAME grn_obj * grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size, @@ -4776,6 +4780,9 @@ _grn_table_key(grn_ctx *ctx, grn_obj *table, grn_id id, uint32_t *key_size) /* column */ + +PRAGMA_DISABLE_CHECK_STACK_FRAME + grn_obj * grn_column_create(grn_ctx *ctx, grn_obj *table, const char *name, unsigned int name_size, @@ -4978,6 +4985,7 @@ exit : if (!res && id) { grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); } GRN_API_RETURN(res); } +PRAGMA_REENABLE_CHECK_STACK_FRAME grn_obj * grn_column_open(grn_ctx *ctx, grn_obj *table, @@ -8540,6 +8548,8 @@ grn_obj_spec_save(grn_ctx *ctx, grn_db_obj *obj) grn_obj_close(ctx, &v); } +PRAGMA_DISABLE_CHECK_STACK_FRAME + inline static void grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx, const char *message, @@ -8590,6 +8600,8 @@ grn_obj_set_info_source_invalid_lexicon_error(grn_ctx *ctx, source_name_size, source_name); } +PRAGMA_REENABLE_CHECK_STACK_FRAME + inline static grn_rc grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value) { @@ -8597,7 +8609,7 @@ grn_obj_set_info_source_validate(grn_ctx *ctx, grn_obj *obj, grn_obj *value) grn_obj *lexicon = NULL; grn_id lexicon_domain_id; grn_obj *lexicon_domain = NULL; - grn_bool lexicon_domain_is_table; + grn_bool lexicon_domain_is_table __attribute__((unused)); grn_bool lexicon_have_tokenizer; grn_id *source_ids; int i, n_source_ids; @@ -9330,7 +9342,7 @@ remove_reference_tables(grn_ctx *ctx, grn_obj *table, grn_obj *db) grn_bool is_close_opened_object_mode = GRN_FALSE; grn_id table_id; char table_name[GRN_TABLE_MAX_KEY_SIZE]; - int table_name_size; + int table_name_size __attribute__((unused)); grn_table_cursor *cursor; if (grn_thread_get_limit() == 1) { @@ -10317,12 +10329,10 @@ grn_db_spec_unpack(grn_ctx *ctx, const char *error_message_tag) { grn_obj *db; - grn_db *db_raw; grn_rc rc; uint32_t spec_size; db = ctx->impl->db; - db_raw = (grn_db *)db; rc = grn_vector_decode(ctx, decoded_spec, diff --git a/storage/mroonga/vendor/groonga/lib/load.c b/storage/mroonga/vendor/groonga/lib/load.c index eb77f2b3849..25d621e7f56 100644 --- a/storage/mroonga/vendor/groonga/lib/load.c +++ b/storage/mroonga/vendor/groonga/lib/load.c @@ -20,6 +20,9 @@ #include "grn_ctx_impl.h" #include "grn_db.h" #include "grn_util.h" +#include + +PRAGMA_DISABLE_CHECK_STACK_FRAME static void grn_loader_save_error(grn_ctx *ctx, grn_loader *loader) @@ -1228,3 +1231,5 @@ grn_load(grn_ctx *ctx, grn_content_type input_type, } GRN_API_RETURN(ctx->rc); } + +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/storage/mroonga/vendor/groonga/lib/operator.c b/storage/mroonga/vendor/groonga/lib/operator.c index 1e1f2cf7e4d..940c0b14a09 100644 --- a/storage/mroonga/vendor/groonga/lib/operator.c +++ b/storage/mroonga/vendor/groonga/lib/operator.c @@ -20,6 +20,7 @@ #include "grn_db.h" #include "grn_str.h" #include "grn_normalizer.h" +#include #include @@ -31,6 +32,8 @@ # include #endif +PRAGMA_DISABLE_CHECK_STACK_FRAME + static const char *operator_names[] = { "push", "pop", @@ -1360,3 +1363,5 @@ grn_operator_exec_regexp(grn_ctx *ctx, grn_obj *target, grn_obj *pattern) } GRN_API_RETURN(matched); } + +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_object_list.c b/storage/mroonga/vendor/groonga/lib/proc/proc_object_list.c index adb4c91bc1f..eaf5504d1fa 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_object_list.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_object_list.c @@ -18,6 +18,7 @@ #include "../grn_proc.h" #include "../grn_db.h" +#include #include @@ -73,6 +74,8 @@ command_object_list_dump_flags(grn_ctx *ctx, grn_obj_spec *spec) GRN_OBJ_FIN(ctx, &flags); } +PRAGMA_DISABLE_CHECK_STACK_FRAME + static grn_obj * command_object_list(grn_ctx *ctx, int nargs, @@ -401,6 +404,7 @@ command_object_list(grn_ctx *ctx, return NULL; } +PRAGMA_REENABLE_CHECK_STACK_FRAME void grn_proc_init_object_list(grn_ctx *ctx) diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_schema.c b/storage/mroonga/vendor/groonga/lib/proc/proc_schema.c index 061c145a112..7c632f45e53 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_schema.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_schema.c @@ -17,9 +17,8 @@ */ #include "../grn_proc.h" - #include "../grn_db.h" - +#include #include typedef struct { @@ -572,6 +571,8 @@ command_schema_table_output_token_filters(grn_ctx *ctx, grn_obj *table) GRN_OBJ_FIN(ctx, &token_filters); } +PRAGMA_DISABLE_CHECK_STACK_FRAME + static void command_schema_table_command_collect_arguments(grn_ctx *ctx, grn_obj *table, @@ -692,6 +693,7 @@ command_schema_table_command_collect_arguments(grn_ctx *ctx, #undef ADD_OBJECT_NAME #undef ADD } +PRAGMA_REENABLE_CHECK_STACK_FRAME static void command_schema_table_output_command(grn_ctx *ctx, grn_obj *table) @@ -875,6 +877,8 @@ command_schema_output_indexes(grn_ctx *ctx, grn_obj *object) } } +PRAGMA_DISABLE_CHECK_STACK_FRAME + static void command_schema_column_command_collect_arguments(grn_ctx *ctx, grn_obj *table, @@ -973,6 +977,7 @@ command_schema_column_command_collect_arguments(grn_ctx *ctx, #undef ADD_OBJECT_NAME #undef ADD } +PRAGMA_REENABLE_CHECK_STACK_FRAME static void command_schema_column_output_command(grn_ctx *ctx, diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_select.c b/storage/mroonga/vendor/groonga/lib/proc/proc_select.c index a665b1cc898..7588b18a17c 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_select.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_select.c @@ -24,6 +24,7 @@ #include "../grn_util.h" #include "../grn_cache.h" #include "../grn_ii.h" +#include #include "../grn_ts.h" @@ -2912,7 +2913,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data) uint32_t nhits; grn_obj *outbuf = ctx->impl->output.buf; grn_content_type output_type = ctx->impl->output.type; - char cache_key[GRN_CACHE_MAX_KEY_SIZE]; + char *cache_key_buffer= 0; uint32_t cache_key_size; long long int threshold, original_threshold = 0; grn_cache *cache_obj = grn_cache_current_get(ctx); @@ -2985,8 +2986,9 @@ grn_select(grn_ctx *ctx, grn_select_data *data) } GRN_HASH_EACH_END(ctx, cursor); } #undef DRILLDOWN_CACHE_SIZE - if (cache_key_size <= GRN_CACHE_MAX_KEY_SIZE) { - char *cp = cache_key; + if (cache_key_size <= GRN_CACHE_MAX_KEY_SIZE && + (cache_key_buffer= (char*) malloc(cache_key_size+1))) { + char *cp = cache_key_buffer; #define PUT_CACHE_KEY(string) \ if ((string).value) \ @@ -3066,11 +3068,12 @@ grn_select(grn_ctx *ctx, grn_select_data *data) { grn_rc rc; - rc = grn_cache_fetch(ctx, cache_obj, cache_key, cache_key_size, outbuf); + rc = grn_cache_fetch(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf); if (rc == GRN_SUCCESS) { GRN_QUERY_LOG(ctx, GRN_QUERY_LOG_CACHE, ":", "cache(%" GRN_FMT_LLD ")", (long long int)GRN_TEXT_LEN(outbuf)); + free(cache_key_buffer); return ctx->rc; } } @@ -3119,7 +3122,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data) data->cache.length != 2 || data->cache.value[0] != 'n' || data->cache.value[1] != 'o')) { - grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf); + grn_cache_update(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf); } goto exit; } @@ -3186,7 +3189,7 @@ grn_select(grn_ctx *ctx, grn_select_data *data) data->cache.length != 2 || data->cache.value[0] != 'n' || data->cache.value[1] != 'o')) { - grn_cache_update(ctx, cache_obj, cache_key, cache_key_size, outbuf); + grn_cache_update(ctx, cache_obj, cache_key_buffer, cache_key_size, outbuf); } if (data->taintable > 0) { grn_db_touch(ctx, DB_OBJ(data->tables.target)->db); @@ -3200,6 +3203,7 @@ exit : /* GRN_LOG(ctx, GRN_LOG_NONE, "%d", ctx->seqno); */ + free(cache_key_buffer); return ctx->rc; } @@ -3424,6 +3428,9 @@ grn_select_data_fill_drilldown_columns(grn_ctx *ctx, strlen(prefix)); } + +PRAGMA_DISABLE_CHECK_STACK_FRAME + static grn_bool grn_select_data_fill_drilldowns(grn_ctx *ctx, grn_user_data *user_data, @@ -3562,6 +3569,7 @@ grn_select_data_fill_drilldowns(grn_ctx *ctx, return succeeded; } } +PRAGMA_REENABLE_CHECK_STACK_FRAME static grn_obj * command_select(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index e050e46c8db..ef798499399 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1581,40 +1581,37 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) SYNOPSIS disable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ disable all non-unique keys - HA_KEY_SWITCH_ALL disable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE dis. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE dis. all keys and make persistent - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_ALL_SAVE is not implemented. + DESCRIPTION + See handler::ha_disable_indexes() RETURN 0 ok HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_myisam::disable_indexes(uint mode) +int ha_myisam::disable_indexes(key_map map, bool persist) { int error; - if (mode == HA_KEY_SWITCH_ALL) + if (!persist) { /* call a storage engine function to switch the key map */ + DBUG_ASSERT(map.is_clear_all()); error= mi_disable_indexes(file); } - else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) - { - mi_extra(file, HA_EXTRA_NO_KEYS, 0); - info(HA_STATUS_CONST); // Read new key info - error= 0; - } else { - /* mode not implemented */ - error= HA_ERR_WRONG_COMMAND; + ulonglong ullmap= map.to_ulonglong(); + + /* make sure auto-inc key is enabled even if it's > 64 */ + if (map.length() > MI_KEYMAP_BITS && + table->s->next_number_index < MAX_KEY) + mi_set_key_active(ullmap, table->s->next_number_index); + + mi_extra(file, HA_EXTRA_NO_KEYS, &ullmap); + info(HA_STATUS_CONST); // Read new key info + error= 0; } return error; } @@ -1625,21 +1622,14 @@ int ha_myisam::disable_indexes(uint mode) SYNOPSIS enable_indexes() - mode mode of operation: - HA_KEY_SWITCH_NONUNIQ enable all non-unique keys - HA_KEY_SWITCH_ALL enable all keys - HA_KEY_SWITCH_NONUNIQ_SAVE en. non-uni. and make persistent - HA_KEY_SWITCH_ALL_SAVE en. all keys and make persistent DESCRIPTION Enable indexes, which might have been disabled by disable_index() before. - The modes without _SAVE work only if both data and indexes are empty, + If persist=false, it works only if both data and indexes are empty, since the MyISAM repair would enable them persistently. To be sure in these cases, call handler::delete_all_rows() before. - IMPLEMENTATION - HA_KEY_SWITCH_NONUNIQ is not implemented. - HA_KEY_SWITCH_ALL_SAVE is not implemented. + See also handler::ha_enable_indexes() RETURN 0 ok @@ -1648,7 +1638,7 @@ int ha_myisam::disable_indexes(uint mode) HA_ERR_WRONG_COMMAND mode not implemented. */ -int ha_myisam::enable_indexes(uint mode) +int ha_myisam::enable_indexes(key_map map, bool persist) { int error; DBUG_ENTER("ha_myisam::enable_indexes"); @@ -1662,7 +1652,8 @@ int ha_myisam::enable_indexes(uint mode) DBUG_RETURN(0); } - if (mode == HA_KEY_SWITCH_ALL) + DBUG_ASSERT(map.is_prefix(table->s->keys)); + if (!persist) { error= mi_enable_indexes(file); /* @@ -1671,7 +1662,7 @@ int ha_myisam::enable_indexes(uint mode) but mode==HA_KEY_SWITCH_ALL forbids it. */ } - else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) + else { THD *thd= table->in_use; int was_error= thd->is_error(); @@ -1731,11 +1722,6 @@ int ha_myisam::enable_indexes(uint mode) restore_vcos_after_repair(); } - else - { - /* mode not implemented */ - error= HA_ERR_WRONG_COMMAND; - } DBUG_RETURN(error); } @@ -1898,7 +1884,7 @@ int ha_myisam::end_bulk_insert() setting the indexes as active and trying to recreate them. */ - if (((first_error= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) && + if (((first_error= enable_indexes(key_map(table->s->keys), true))) && table->in_use->killed) { delete_all_rows(); diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 0914d531788..52d23faf3c4 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -111,8 +111,8 @@ class ha_myisam final : public handler int external_lock(THD *thd, int lock_type) override; int delete_all_rows(void) override; int reset_auto_increment(ulonglong value) override; - int disable_indexes(uint mode) override; - int enable_indexes(uint mode) override; + int disable_indexes(key_map map, bool persist) override; + int enable_indexes(key_map map, bool persist) override; int indexes_are_disabled(void) override; void start_bulk_insert(ha_rows rows, uint flags) override; int end_bulk_insert() override; diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index e7e64edd926..96927a0b57b 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -225,16 +225,9 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) } if (mi_is_any_key_active(share->state.key_map)) { - MI_KEYDEF *key=share->keyinfo; - uint i; - for (i=0 ; i < share->base.keys ; i++,key++) - { - if (!(key->flag & HA_NOSAME) && info->s->base.auto_key != i+1) - { - mi_clear_key_active(share->state.key_map, i); - info->update|= HA_STATE_CHANGED; - } - } + if (share->state.key_map != *(ulonglong*)extra_arg) + info->update|= HA_STATE_CHANGED; + share->state.key_map= *(ulonglong*)extra_arg; if (!share->changed) { diff --git a/storage/perfschema/pfs_buffer_container.h b/storage/perfschema/pfs_buffer_container.h index d5745e76249..b5506fe0195 100644 --- a/storage/perfschema/pfs_buffer_container.h +++ b/storage/perfschema/pfs_buffer_container.h @@ -1084,8 +1084,7 @@ template class PFS_buffer_processor { public: - virtual ~PFS_buffer_processor () - {} + virtual ~PFS_buffer_processor()= default; virtual void operator()(T *element) = 0; }; diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index 2b1a80d3e11..fa85d8610bf 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -55,7 +55,7 @@ Indicate if the performance schema is enabled. This flag is set at startup, and never changes. */ -my_bool pfs_enabled= TRUE; +my_bool pfs_enabled= FALSE; /** PFS_INSTRUMENT option settings array diff --git a/storage/perfschema/table_replication_applier_status.cc b/storage/perfschema/table_replication_applier_status.cc index fda3c9274d9..94981482e56 100644 --- a/storage/perfschema/table_replication_applier_status.cc +++ b/storage/perfschema/table_replication_applier_status.cc @@ -166,7 +166,7 @@ void table_replication_applier_status::make_row(Master_info *mi) m_row.service_state= PS_RPL_NO; m_row.remaining_delay= 0; - if (slave_sql_running_state == Relay_log_info::state_delaying_string) + if (slave_sql_running_state == stage_sql_thd_waiting_until_delay.m_name) { time_t t= my_time(0), sql_delay_end= mi->rli.get_sql_delay_end(); m_row.remaining_delay= (uint)(t < sql_delay_end ? diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 9667d7ff2be..55c4f61997b 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -86,6 +86,8 @@ void test_no_instruments() cleanup_instruments(); } +PRAGMA_DISABLE_CHECK_STACK_FRAME + void test_no_instances() { int rc; @@ -245,6 +247,7 @@ void test_no_instances() cleanup_file_hash(); cleanup_instruments(); } +PRAGMA_REENABLE_CHECK_STACK_FRAME void test_with_instances() { diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index 7651898d684..76e3668d378 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -743,6 +743,7 @@ void do_all_tests() int main(int argc, char **argv) { plan(209); + pfs_enabled= 1; MY_INIT(argv[0]); do_all_tests(); my_end(0); diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index e86781ffdd4..0228703f990 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -204,7 +204,7 @@ ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib ADD_DEPENDENCIES(rocksdb_aux_lib GenError) # MARIAROCKS-TODO: how to properly depend on -lrt ? -TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY}) +TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARIES}) if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt) endif() diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index 27a8616cfda..e89dbfc0627 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -79,7 +79,7 @@ check_lib(Snappy) check_lib(ZSTD ZDICT_trainFromBuffer) add_definitions(-DZLIB) -list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY}) +list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARIES}) ADD_FEATURE_INFO(ROCKSDB_ZLIB "ON" "zlib Compression in the RocksDB storage engine") if(CMAKE_SYSTEM_NAME MATCHES "Cygwin") diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index 627d7da4171..c16c1021141 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -87,6 +87,10 @@ compact_deletes: MDEV-12663 : rocksdb.compact_deletes times out and causes other blind_delete_without_tx_api: MDEV-12286: rocksdb.blind_delete_without_tx_api test fails information_schema: MDEV-14372: unstable testcase +bloomfilter2: MDEV-33789: rocksdb.bloomfilter2 failed on amd64-debian-12-rocksdb +write_sync: MDEV-33866: rocksdb.write_sync fails on amd64-windows-packages +locking_issues_case5_rc: MDEV-33781: rocksdb.locking_issues_case5_rc fails on amd64-windows-packages + ## ## Tests that fail for some other reason ## diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index c6e05888b4a..c2fbb77621d 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -346,12 +346,23 @@ int ha_spider::open( result_list.last = NULL; result_list.current = NULL; result_list.record_num = 0; - if ( - !(result_list.sqls = new spider_string[share->link_count]) || - !(result_list.insert_sqls = new spider_string[share->link_count]) || - !(result_list.update_sqls = new spider_string[share->link_count]) || - !(result_list.tmp_sqls = new spider_string[share->link_count]) - ) { + if (!(result_list.sqls = new spider_string[share->link_count])) + { + error_num = HA_ERR_OUT_OF_MEM; + goto error_init_result_list; + } + if (!(result_list.insert_sqls = new spider_string[share->link_count])) + { + error_num = HA_ERR_OUT_OF_MEM; + goto error_init_result_list; + } + if (!(result_list.update_sqls = new spider_string[share->link_count])) + { + error_num = HA_ERR_OUT_OF_MEM; + goto error_init_result_list; + } + if (!(result_list.tmp_sqls = new spider_string[share->link_count])) + { error_num = HA_ERR_OUT_OF_MEM; goto error_init_result_list; } @@ -8969,27 +8980,35 @@ bool ha_spider::auto_repair() const } int ha_spider::disable_indexes( - uint mode + key_map map, bool persist ) { int error_num; backup_error_status(); DBUG_ENTER("ha_spider::disable_indexes"); DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = spider_db_disable_keys(this))) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); + if (persist) + { + if ((error_num = spider_db_disable_keys(this))) + DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(0); + } + DBUG_RETURN(HA_ERR_WRONG_COMMAND); } int ha_spider::enable_indexes( - uint mode + key_map map, bool persist ) { int error_num; backup_error_status(); DBUG_ENTER("ha_spider::enable_indexes"); DBUG_PRINT("info",("spider this=%p", this)); - if ((error_num = spider_db_enable_keys(this))) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); + if (persist) + { + if ((error_num = spider_db_enable_keys(this))) + DBUG_RETURN(check_error_mode(error_num)); + DBUG_RETURN(0); + } + DBUG_RETURN(HA_ERR_WRONG_COMMAND); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 50266739b63..2e638269ef9 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -482,10 +482,10 @@ public: bool auto_repair() const; #endif int disable_indexes( - uint mode + key_map map, bool persist ); int enable_indexes( - uint mode + key_map map, bool persist ); int check( THD* thd, @@ -791,3 +791,26 @@ public: int lock_tables(); int dml_init(); }; + + +/* This is a hack for ASAN + * Libraries such as libxml2 and libodbc do not like being unloaded before + * exit and will show as a leak in ASAN with no stack trace (as the plugin + * has been unloaded from memory). + * + * The below is designed to trick the compiler into adding a "UNIQUE" symbol + * which can be seen using: + * readelf -s storage/spider/ha_spider.so | grep UNIQUE + * + * Having this symbol means that the plugin remains in memory after dlclose() + * has been called. Thereby letting the libraries clean up properly. + */ +#if defined(__SANITIZE_ADDRESS__) +__attribute__((__used__)) +inline int dummy(void) +{ + static int d; + d++; + return d; +} +#endif diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result index aa734573a1a..e35100428d7 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result +++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result index b793346df4b..361fd336f16 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result +++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result index 9034f95c910..ac3618e5adb 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result index faf0b6efbea..3ce8dfbfdc7 100644 --- a/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result +++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes_part.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc index 739d88970c5..84de2c7d2e6 100644 --- a/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc +++ b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc @@ -19,7 +19,7 @@ if (!$SLAVE1_1_SLAVE_STATUS) MASTER_PORT = $MASTER_1_MYPORT ; } -START SLAVE; +--source include/start_slave.inc --connection master_1 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --connection slave1_1 diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result index cb1b190f71d..8b193975886 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result +++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_default.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; connection master_1; set @old_binlog_format= @@binlog_format; diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result index cb1b190f71d..8b193975886 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result +++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mariadb.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; connection master_1; set @old_binlog_format= @@binlog_format; diff --git a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result index 1131021258d..1e5d7d31686 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result +++ b/storage/spider/mysql-test/spider/bugfix/r/delete_with_float_column_mysql.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; connection master_1; set @old_binlog_format= @@binlog_format; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result index 4386b4cbd4d..dbf0f54c804 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result @@ -72,7 +72,6 @@ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argum argument select `pkey`,`val` from `auto_test_remote`.`tbl_a` select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1 -select 1 from (select 1) t0 select `pkey`,`val` from `auto_test_remote`.`tbl_a` select `pkey`,`val` from `auto_test_remote`.`tbl_a` SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %' @@ -86,7 +85,6 @@ argument select `pkey`,`val` from `auto_test_remote2`.`tbl_a` select `pkey`,`val` from `auto_test_remote2`.`tbl_a` select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2 -select 1 from (select 1) t0 select `pkey`,`val` from `auto_test_remote2`.`tbl_a` SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %' SELECT pkey, val FROM tbl_a ORDER BY pkey; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result index 531e48b880b..60ef8e2dea4 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result @@ -66,9 +66,6 @@ id greeting connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE 'select `id`,`greeting` from %'; argument -select `id`,`greeting` from `auto_test_remote`.`tbl_a` where `greeting` = 'Aloha!' and ((`greeting` = 'Aloha!')) -select `id`,`greeting` from `auto_test_remote`.`tbl_b` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!')) -select `id`,`greeting` from `auto_test_remote`.`tbl_c` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!')) connection child2_1; SET @@global.general_log = @general_log_backup; SET @@global.log_output = @log_output_backup; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result index 7e4fd3cd084..5fd412b69ea 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_28856.result @@ -5,6 +5,8 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set @old_spider_same_server_link=@@global.spider_same_server_link; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); # testing monitoring_* @@ -173,6 +175,7 @@ max(d) 93 drop table t1, t2; drop server srv; +set global spider_same_server_link=@old_spider_same_server_link; for master_1 for child2 for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30727.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30727.result new file mode 100644 index 00000000000..79a383feb83 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30727.result @@ -0,0 +1,24 @@ +CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so'; +SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"'); +ERROR HY000: Can't initialize function 'spider_direct_sql'; Plugin 'SPIDER' is not loaded +CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; +SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"'); +ERROR HY000: Can't initialize function 'spider_bg_direct_sql'; Plugin 'SPIDER' is not loaded +CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so'; +SELECT spider_copy_tables ('t', '0', '0'); +ERROR HY000: Can't initialize function 'spider_copy_tables'; Plugin 'SPIDER' is not loaded +CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so'; +SELECT spider_flush_table_mon_cache (); +spider_flush_table_mon_cache () +1 +install soname 'ha_spider'; +SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"'); +ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error: b +call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'"); +SELECT spider_copy_tables ('t', '0', '0'); +ERROR HY000: Can't find record in 'spider_tables' +SELECT spider_flush_table_mon_cache (); +spider_flush_table_mon_cache () +1 +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33538.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33538.result new file mode 100644 index 00000000000..a5ab3c1d836 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33538.result @@ -0,0 +1,12 @@ +show create table information_schema.SPIDER_ALLOC_MEM; +Table Create Table +SPIDER_ALLOC_MEM CREATE TEMPORARY TABLE `SPIDER_ALLOC_MEM` ( + `ID` int(10) unsigned NOT NULL, + `FUNC_NAME` varchar(64), + `FILE_NAME` varchar(64), + `LINE_NO` int(10) unsigned, + `TOTAL_ALLOC_MEM` bigint(20) unsigned, + `CURRENT_ALLOC_MEM` bigint(20), + `ALLOC_MEM_COUNT` bigint(20) unsigned, + `FREE_MEM_COUNT` bigint(20) unsigned +) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33538_fail_init.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33538_fail_init.result new file mode 100644 index 00000000000..7535da830cc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33538_fail_init.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("\\[ERROR\\] SPIDER plugin initialization failed"); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed."); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_WRAPPER_PROTOCOLS' registration as a INFORMATION SCHEMA failed."); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_ALLOC_MEM' registration as a INFORMATION SCHEMA failed."); +create table mysql.spider_tables (c int); +# restart: --plugin-load-add=ha_spider +SELECT * FROM information_schema.SPIDER_ALLOC_MEM; +ID FUNC_NAME FILE_NAME LINE_NO TOTAL_ALLOC_MEM CURRENT_ALLOC_MEM ALLOC_MEM_COUNT FREE_MEM_COUNT +SELECT * FROM information_schema.SPIDER_WRAPPER_PROTOCOLS; +WRAPPER_NAME WRAPPER_VERSION WRAPPER_DESCRIPTION WRAPPER_MATURITY diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33584.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33584.result new file mode 100644 index 00000000000..796c75cc560 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33584.result @@ -0,0 +1,4 @@ +set @old_sql_mode=@@global.sql_mode; +set global sql_mode='traditional'; +install soname 'ha_spider'; +set global sql_mode=@old_sql_mode; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33679.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33679.result new file mode 100644 index 00000000000..c021bc70e57 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33679.result @@ -0,0 +1,25 @@ +# +# MDEV-33679 spider returns parsing failure on valid left join select by translating the on expression to () +# +for master_1 +for child2 +for child3 +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE `t1` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) ENGINE=MYISAM; +CREATE TABLE `t2` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL ) ENGINE=MYISAM; +SET spider_same_server_link= on; +CREATE TABLE `t1_spider` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) COMMENT='wrapper "mysql",srv "srv", table "t1"' ENGINE=SPIDER; +CREATE TABLE `t2_spider` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL +, PRIMARY KEY (`a`) USING BTREE +) COMMENT='wrapper "mysql",srv "srv",table "t2"' ENGINE=SPIDER; +INSERT INTO t1_spider VALUES(1,'oooo'); +INSERT INTO t2_spider VALUES(1,1); +SELECT t2_spider.a,t1_spider.c FRoM t2_spider LEFT join t1_spider ON (t2_spider.c = t1_spider.c) WHERE t2_spider.a = 1; +a c +1 1 +drop table t1, t2, t1_spider, t2_spider; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33731.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33731.result new file mode 100644 index 00000000000..a63830f194c --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33731.result @@ -0,0 +1,10 @@ +for master_1 +for child2 +for child3 +CREATE TABLE t (a INT) ENGINE=Spider PARTITION BY LIST (a) PARTITIONS 2 (PARTITION p1 VALUES IN (0,1),PARTITION p2 VALUES IN (2,3)); +DELETE FROM t PARTITION (p2); +ERROR HY000: Unable to connect to foreign data source: localhost +drop table t; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result new file mode 100644 index 00000000000..b78f18d19dd --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result @@ -0,0 +1,18 @@ +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 t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (0,1,0),(1,0,0),(2,0,0); +create table t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +SELECT * FROM t1 WHERE c=0; +c c1 c2 +0 1 0 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result index 04e5ed6da68..4d161a2f7fb 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result +++ b/storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result @@ -3,5 +3,9 @@ # select * from mysql.plugin; name dl +select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = "information_schema" and TABLE_NAME like "SPIDER_%"; +TABLE_NAME +SPIDER_ALLOC_MEM +SPIDER_WRAPPER_PROTOCOLS create table t (c int) Engine=SPIDER; drop table t; diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result index c8b1de982eb..83dab07f622 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result +++ b/storage/spider/mysql-test/spider/bugfix/r/slave_transaction_retry_errors_5digit.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result index 2d3c9f1ff8c..c7c06cbb816 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/bugfix/r/slave_trx_isolation.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation; set global spider_slave_trx_isolation= 1; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test index a1642f7a9cd..9ccfc3784ef 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_28856.test @@ -10,6 +10,9 @@ # This test covers some table params under consideration for inclusion # in the engine-defined options to be implemented in MDEV-28856. set spider_same_server_link=1; +set @old_spider_same_server_link=@@global.spider_same_server_link; +set global spider_same_server_link=1; + evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); @@ -153,6 +156,7 @@ select max(d) from t1; drop table t1, t2; drop server srv; +set global spider_same_server_link=@old_spider_same_server_link; --disable_query_log --disable_result_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30727.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30727.test new file mode 100644 index 00000000000..ebd08edce24 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30727.test @@ -0,0 +1,30 @@ +CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so'; +--error ER_CANT_INITIALIZE_UDF +SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"'); + +CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; +--error ER_CANT_INITIALIZE_UDF +SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"'); + +CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so'; +--error ER_CANT_INITIALIZE_UDF +SELECT spider_copy_tables ('t', '0', '0'); + +# spider_flush_table_mon_cache does not require spider init to function +CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so'; +SELECT spider_flush_table_mon_cache (); + +# The function functions properly after the plugin is installed +install soname 'ha_spider'; + +--error ER_FOREIGN_SERVER_DOESNT_EXIST +SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"'); + +call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'"); +--error ER_KEY_NOT_FOUND +SELECT spider_copy_tables ('t', '0', '0'); + +SELECT spider_flush_table_mon_cache (); + +--disable_query_log +--source ../../include/clean_up_spider.inc diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.opt new file mode 100644 index 00000000000..a90c3a39413 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.opt @@ -0,0 +1,2 @@ +--plugin-load-add=ha_spider +--transaction-read-only=on diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.test new file mode 100644 index 00000000000..e2d4d8b46e4 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538.test @@ -0,0 +1,2 @@ +# we check that information_schema.SPIDER_ALLOC_MEM exists +show create table information_schema.SPIDER_ALLOC_MEM; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33538_fail_init.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538_fail_init.test new file mode 100644 index 00000000000..fafc2fdb852 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33538_fail_init.test @@ -0,0 +1,17 @@ +call mtr.add_suppression("\\[ERROR\\] SPIDER plugin initialization failed"); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed."); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_WRAPPER_PROTOCOLS' registration as a INFORMATION SCHEMA failed."); +call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_ALLOC_MEM' registration as a INFORMATION SCHEMA failed."); +# We create a table with identical name of the spider system table, to +# fail the spider init query ([ERROR] SPIDER plugin initialization +# failed at 'alter table mysql.spider_tables add column if not exists +# link_id int not null default 0 after table_name, drop primary key, +# add primary key (db_name, table_name, link_id), algorithm=copy, +# lock=shared;' by 'Unknown column 'table_name' in 'spider_tables'') +# This will cause the init of spider_alloc_mem to fail because it +# depends on the main spider plugin. +create table mysql.spider_tables (c int); +--let $restart_parameters= --plugin-load-add=ha_spider +--source include/restart_mysqld.inc +SELECT * FROM information_schema.SPIDER_ALLOC_MEM; +SELECT * FROM information_schema.SPIDER_WRAPPER_PROTOCOLS; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33584.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33584.test new file mode 100644 index 00000000000..886449716eb --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33584.test @@ -0,0 +1,11 @@ +# This test tests spider init with global no_zero_date sql mode +set @old_sql_mode=@@global.sql_mode; +set global sql_mode='traditional'; +install soname 'ha_spider'; +set global sql_mode=@old_sql_mode; + +--disable_query_log +--disable_result_log +--source ../../include/clean_up_spider.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33679.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33679.test new file mode 100644 index 00000000000..eee47a21163 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33679.test @@ -0,0 +1,29 @@ +--echo # +--echo # MDEV-33679 spider returns parsing failure on valid left join select by translating the on expression to () +--echo # +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE `t1` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) ENGINE=MYISAM; +CREATE TABLE `t2` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL ) ENGINE=MYISAM; +SET spider_same_server_link= on; +CREATE TABLE `t1_spider` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) COMMENT='wrapper "mysql",srv "srv", table "t1"' ENGINE=SPIDER; +CREATE TABLE `t2_spider` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL +, PRIMARY KEY (`a`) USING BTREE +) COMMENT='wrapper "mysql",srv "srv",table "t2"' ENGINE=SPIDER; +INSERT INTO t1_spider VALUES(1,'oooo'); +INSERT INTO t2_spider VALUES(1,1); +SELECT t2_spider.a,t1_spider.c FRoM t2_spider LEFT join t1_spider ON (t2_spider.c = t1_spider.c) WHERE t2_spider.a = 1; + +drop table t1, t2, t1_spider, t2_spider; +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33731.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33731.test new file mode 100644 index 00000000000..b98c9620414 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33731.test @@ -0,0 +1,16 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +CREATE TABLE t (a INT) ENGINE=Spider PARTITION BY LIST (a) PARTITIONS 2 (PARTITION p1 VALUES IN (0,1),PARTITION p2 VALUES IN (2,3)); +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +DELETE FROM t PARTITION (p2); +drop table t; + +--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_34003.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test new file mode 100644 index 00000000000..f81259b99a9 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test @@ -0,0 +1,20 @@ +--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 t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +INSERT INTO t2 VALUES (0,1,0),(1,0,0),(2,0,0); +create table t1 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +SELECT * FROM t1 WHERE c=0; +drop table t1, t2; +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test index 396145fba2e..35242b2092b 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test +++ b/storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test @@ -3,5 +3,6 @@ --echo # # A simple test that tests plugin-load-add=ha_spider select * from mysql.plugin; +select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = "information_schema" and TABLE_NAME like "SPIDER_%"; create table t (c int) Engine=SPIDER; drop table t; diff --git a/storage/spider/mysql-test/spider/feature/r/pushdown_case.result b/storage/spider/mysql-test/spider/feature/r/pushdown_case.result new file mode 100644 index 00000000000..613ce377865 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/pushdown_case.result @@ -0,0 +1,57 @@ +# +# MDEV-28993 Spider: Push down CASE statement +# +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 t2 (c int); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (42), (3), (848), (100); +explain select case c when 3 then "three" when 42 then "answer" else "other" end from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select case c when 3 then "three" when 42 then "answer" else "other" end from t1; +case c when 3 then "three" when 42 then "answer" else "other" end +answer +three +other +other +explain select case c when 3 then "three" when 42 then "answer" end from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select case c when 3 then "three" when 42 then "answer" end from t1; +case c when 3 then "three" when 42 then "answer" end +answer +three +NULL +NULL +explain select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1; +case when c = 3 then "three" when c = 42 then "answer" else "other" end +answer +three +other +other +explain select case when c = 3 then "three" when c = 42 then "answer" end from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select case when c = 3 then "three" when c = 42 then "answer" end from t1; +case when c = 3 then "three" when c = 42 then "answer" end +answer +three +NULL +NULL +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 +# +# end of test pushdown_case +# diff --git a/storage/spider/mysql-test/spider/feature/r/pushdown_timestamp_diff.result b/storage/spider/mysql-test/spider/feature/r/pushdown_timestamp_diff.result new file mode 100644 index 00000000000..3acd89127c0 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/r/pushdown_timestamp_diff.result @@ -0,0 +1,111 @@ +# +# MDEV-28992 Spider: Push down TIMESTAMPDIFF function +# +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 t2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +); +CREATE TABLE t1 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +INSERT INTO t1 (a, b, c) VALUES +(1, 'a', '2018-11-01 10:21:39'), +(2, 'b', '2015-06-30 23:59:59'), +(3, 'c', '2013-11-01 01:01:01'); +interval year +explain select a, b, timestampdiff(year, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(year, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(year, '2000-01-01 00:00:00', c) +1 a 18 +2 b 15 +3 c 13 +interval quarter +explain select a, b, timestampdiff(quarter, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(quarter, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(quarter, '2000-01-01 00:00:00', c) +1 a 75 +2 b 61 +3 c 55 +interval month +explain select a, b, timestampdiff(month, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(month, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(month, '2000-01-01 00:00:00', c) +1 a 226 +2 b 185 +3 c 166 +interval week +explain select a, b, timestampdiff(week, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(week, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(week, '2000-01-01 00:00:00', c) +1 a 982 +2 b 808 +3 c 721 +interval day +explain select a, b, timestampdiff(day, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(day, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(day, '2000-01-01 00:00:00', c) +1 a 6879 +2 b 5659 +3 c 5053 +internal hour +explain select a, b, timestampdiff(hour, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(hour, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(hour, '2000-01-01 00:00:00', c) +1 a 165106 +2 b 135839 +3 c 121273 +internal minute +explain select a, b, timestampdiff(minute, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(minute, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(minute, '2000-01-01 00:00:00', c) +1 a 9906381 +2 b 8150399 +3 c 7276381 +internal second +explain select a, b, timestampdiff(second, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(second, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(second, '2000-01-01 00:00:00', c) +1 a 594382899 +2 b 489023999 +3 c 436582861 +internal microsecond +explain select a, b, timestampdiff(microsecond, '2000-01-01 00:00:00', c) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +select a, b, timestampdiff(microsecond, '2000-01-01 00:00:00', c) from t1; +a b timestampdiff(microsecond, '2000-01-01 00:00:00', c) +1 a 594382899000000 +2 b 489023999000000 +3 c 436582861000000 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result index 1de1ba04528..f7d4341c5da 100644 --- a/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result +++ b/storage/spider/mysql-test/spider/feature/r/slave_transaction_retry_errors.result @@ -5,6 +5,7 @@ child2_2 child2_3 for child3 for slave1_1 +include/start_slave.inc connection slave1_1; SHOW VARIABLES LIKE 'slave_transaction_retry_errors'; diff --git a/storage/spider/mysql-test/spider/feature/t/pushdown_case.test b/storage/spider/mysql-test/spider/feature/t/pushdown_case.test new file mode 100644 index 00000000000..b86edceb615 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/pushdown_case.test @@ -0,0 +1,50 @@ +--echo # +--echo # MDEV-28993 Spider: Push down CASE statement +--echo # +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +create table t2 (c int); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (42), (3), (848), (100); + +# everything +let $query= +select case c when 3 then "three" when 42 then "answer" else "other" end from t1; +eval explain $query; +eval $query; + +# no else +let $query= +select case c when 3 then "three" when 42 then "answer" end from t1; +eval explain $query; +eval $query; + +# no value +let $query= +select case when c = 3 then "three" when c = 42 then "answer" else "other" end from t1; +eval explain $query; +eval $query; + +# neither +let $query= +select case when c = 3 then "three" when c = 42 then "answer" end from t1; +eval explain $query; +eval $query; + +drop table t1, t2; +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log +--echo # +--echo # end of test pushdown_case +--echo # diff --git a/storage/spider/mysql-test/spider/feature/t/pushdown_timestamp_diff.test b/storage/spider/mysql-test/spider/feature/t/pushdown_timestamp_diff.test new file mode 100644 index 00000000000..81251860f74 --- /dev/null +++ b/storage/spider/mysql-test/spider/feature/t/pushdown_timestamp_diff.test @@ -0,0 +1,93 @@ +--echo # +--echo # MDEV-28992 Spider: Push down TIMESTAMPDIFF function +--echo # +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +create table t2 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +); +CREATE TABLE t1 ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; + +INSERT INTO t1 (a, b, c) VALUES + (1, 'a', '2018-11-01 10:21:39'), + (2, 'b', '2015-06-30 23:59:59'), + (3, 'c', '2013-11-01 01:01:01'); + +--echo interval year +let $query= +select a, b, timestampdiff(year, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo interval quarter +let $query= +select a, b, timestampdiff(quarter, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo interval month +let $query= +select a, b, timestampdiff(month, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo interval week +let $query= +select a, b, timestampdiff(week, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo interval day +let $query= +select a, b, timestampdiff(day, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo internal hour +let $query= +select a, b, timestampdiff(hour, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo internal minute +let $query= +select a, b, timestampdiff(minute, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo internal second +let $query= +select a, b, timestampdiff(second, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +--echo internal microsecond +let $query= +select a, b, timestampdiff(microsecond, '2000-01-01 00:00:00', c) from t1; +eval explain $query; +eval $query; + +drop table t1, t2; +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/include/clean_up_spider.inc b/storage/spider/mysql-test/spider/include/clean_up_spider.inc index 1c977bfb66f..249606ec774 100644 --- a/storage/spider/mysql-test/spider/include/clean_up_spider.inc +++ b/storage/spider/mysql-test/spider/include/clean_up_spider.inc @@ -3,7 +3,6 @@ DROP FUNCTION spider_copy_tables; DROP FUNCTION spider_ping_table; DROP FUNCTION spider_bg_direct_sql; DROP FUNCTION spider_direct_sql; ---replace_regex /\.dll/.so/ UNINSTALL SONAME IF EXISTS 'ha_spider'; DROP TABLE IF EXISTS mysql.spider_xa; DROP TABLE IF EXISTS mysql.spider_xa_member; diff --git a/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result b/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result index 850546fa1e9..3eed8df28bf 100644 --- a/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result +++ b/storage/spider/mysql-test/spider/r/partition_join_pushdown_for_single_partition.result @@ -86,10 +86,8 @@ SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argum argument select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5 select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5 -select sum('5') `sum(a.value)`,count('5') `count(b.value2)` from (select 1) t0 join (select 1) t1 select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5 select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5 -select sum('5') `sum(a.value)`,count('5') `count(b.value2)` from (select 1) t0 join (select 1) t1 SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %' SELECT value FROM tbl_a ORDER BY value; value diff --git a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result index b572da16eb2..943251d11b3 100644 --- a/storage/spider/mysql-test/spider/r/slave_trx_isolation.result +++ b/storage/spider/mysql-test/spider/r/slave_trx_isolation.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc connection slave1_1; set @old_spider_slave_trx_isolation= @@spider_slave_trx_isolation; set global spider_slave_trx_isolation= 1; diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes.result b/storage/spider/mysql-test/spider/r/spider3_fixes.result index 7a80e102462..614920bee65 100644 --- a/storage/spider/mysql-test/spider/r/spider3_fixes.result +++ b/storage/spider/mysql-test/spider/r/spider3_fixes.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result index 937f222f02f..94390ff71b5 100644 --- a/storage/spider/mysql-test/spider/r/spider3_fixes_part.result +++ b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result index d141dbde341..9eec1733990 100644 --- a/storage/spider/mysql-test/spider/r/spider_fixes.result +++ b/storage/spider/mysql-test/spider/r/spider_fixes.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; diff --git a/storage/spider/mysql-test/spider/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/r/spider_fixes_part.result index 571af94c1f2..a59d2d2bfdb 100644 --- a/storage/spider/mysql-test/spider/r/spider_fixes_part.result +++ b/storage/spider/mysql-test/spider/r/spider_fixes_part.result @@ -8,6 +8,7 @@ child3_1 child3_2 child3_3 for slave1_1 +include/start_slave.inc drop and create databases connection master_1; @@ -109,6 +110,7 @@ a b c 2.26 auto_increment with partition connection master_1; +include/save_master_pos.inc connection slave1_1; connection master_1; DROP TABLE IF EXISTS t1; diff --git a/storage/spider/mysql-test/spider/t/slave_test_init.inc b/storage/spider/mysql-test/spider/t/slave_test_init.inc index 739d88970c5..84de2c7d2e6 100644 --- a/storage/spider/mysql-test/spider/t/slave_test_init.inc +++ b/storage/spider/mysql-test/spider/t/slave_test_init.inc @@ -19,7 +19,7 @@ if (!$SLAVE1_1_SLAVE_STATUS) MASTER_PORT = $MASTER_1_MYPORT ; } -START SLAVE; +--source include/start_slave.inc --connection master_1 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --connection slave1_1 diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.opt b/storage/spider/mysql-test/spider/t/spider_fixes_part.opt new file mode 100644 index 00000000000..1f24df45b33 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.opt @@ -0,0 +1 @@ +--log-warnings=3 diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/t/spider_fixes_part.test index bff2e574cc4..9604f83b283 100644 --- a/storage/spider/mysql-test/spider/t/spider_fixes_part.test +++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.test @@ -488,7 +488,23 @@ if ($HAVE_PARTITION) if ($USE_REPLICATION) { save_master_pos; + --source include/save_master_pos.inc --connection slave1_1 + --let $rc= `select master_pos_wait('$_master_file', $_master_pos, 300, '')` + if (`select $rc is NULL OR $rc < 0`) + { + --vertical_results + show slave status; + --horizontal_results + show global status; + show global variables; + --let $MYSQLD_DATADIR= `select @@datadir` + --exec $MYSQL_BINLOG -v $MYSQLD_DATADIR/mysqld-relay-bin.000001; + # Check that the relay-log file is fully on disk. + --exec ls -l $MYSQLD_DATADIR; + # After that try to restart the slave SQL thread + start slave sql_thread; + } sync_with_master; --connection master_1 --disable_query_log diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index b2079f5286f..fed6bc2728f 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -56,7 +56,7 @@ extern struct charset_info_st *spd_charset_utf8mb3_bin; extern LEX_CSTRING spider_unique_id; pthread_mutex_t spider_conn_id_mutex; pthread_mutex_t spider_ipport_conn_mutex; -ulonglong spider_conn_id = 1; +ulonglong spider_conn_id; extern pthread_attr_t spider_pt_attr; @@ -93,7 +93,7 @@ extern sql_mode_t pushdown_sql_mode; HASH spider_open_connections; uint spider_open_connections_id; HASH spider_ipport_conns; -long spider_conn_mutex_id = 0; +long spider_conn_mutex_id; const char *spider_open_connections_func_name; const char *spider_open_connections_file_name; diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 44bf57e443a..1a6bd861c0a 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -298,7 +298,7 @@ int spider_udf_get_copy_tgt_tables( if ( (error_num = spider_get_sys_tables_connect_info( - table_tables, tmp_share, 0, mem_root)) || + table_tables, tmp_share, mem_root)) || (error_num = spider_get_sys_tables_link_status( table_tables, tmp_share->link_statuses, mem_root)) || (error_num = spider_get_sys_tables_link_idx( @@ -965,7 +965,12 @@ long long spider_copy_tables_body( all_link_cnt = copy_tables->link_idx_count[0] + copy_tables->link_idx_count[1]; if ( - !(tmp_sql = new spider_string[all_link_cnt]) || + !(tmp_sql = new spider_string[all_link_cnt]) + ) { + my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); + goto error; + } + if ( !(spider = new ha_spider[all_link_cnt]) ) { my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); @@ -994,13 +999,6 @@ long long spider_copy_tables_body( tmp_spider->share = table_conn->share; tmp_spider->wide_handler = wide_handler; wide_handler->trx = copy_tables->trx; -/* - if (spider_db_append_set_names(table_conn->share)) - { - my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); - goto error_append_set_names; - } -*/ tmp_spider->conns = &table_conn->conn; tmp_sql[roop_count].init_calc_mem(SPD_MID_COPY_TABLES_BODY_3); tmp_sql[roop_count].set_charset(copy_tables->access_charset); @@ -1040,13 +1038,6 @@ long long spider_copy_tables_body( tmp_spider->share = table_conn->share; tmp_spider->wide_handler = wide_handler; wide_handler->trx = copy_tables->trx; -/* - if (spider_db_append_set_names(table_conn->share)) - { - my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM); - goto error_append_set_names; - } -*/ tmp_spider->conns = &table_conn->conn; tmp_sql[roop_count].init_calc_mem(SPD_MID_COPY_TABLES_BODY_5); tmp_sql[roop_count].set_charset(copy_tables->access_charset); @@ -1073,14 +1064,6 @@ long long spider_copy_tables_body( bulk_insert_rows))) goto error_db_udf_copy_tables; -/* - for (table_conn = copy_tables->table_conn[0]; - table_conn; table_conn = table_conn->next) - spider_db_free_set_names(table_conn->share); - for (table_conn = copy_tables->table_conn[1]; - table_conn; table_conn = table_conn->next) - spider_db_free_set_names(table_conn->share); -*/ if (table_list->table) { (thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd)); @@ -1101,8 +1084,7 @@ long long spider_copy_tables_body( } delete [] spider; } - if (tmp_sql) - delete [] tmp_sql; + delete [] tmp_sql; spider_udf_free_copy_tables_alloc(copy_tables); DBUG_RETURN(1); @@ -1110,17 +1092,6 @@ long long spider_copy_tables_body( error_db_udf_copy_tables: error_create_dbton_handler: error_init_dbton_handler: -/* -error_append_set_names: -*/ -/* - for (table_conn = copy_tables->table_conn[0]; - table_conn; table_conn = table_conn->next) - spider_db_free_set_names(table_conn->share); - for (table_conn = copy_tables->table_conn[1]; - table_conn; table_conn = table_conn->next) - spider_db_free_set_names(table_conn->share); -*/ error: if (spider) { @@ -1178,6 +1149,11 @@ my_bool spider_copy_tables_init_body( char *message ) { DBUG_ENTER("spider_copy_tables_init_body"); + if (!spider_hton_ptr) + { + strcpy(message, "Plugin 'SPIDER' is not loaded"); + goto error; + } if (args->arg_count != 3 && args->arg_count != 4) { strcpy(message, "spider_copy_tables() requires 3 or 4 arguments"); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index bca71de52b1..5f816d47b70 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -63,7 +63,7 @@ pthread_mutex_t spider_open_conn_mutex; const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /* UTC time zone for timestamp columns */ -Time_zone *UTC = 0; +Time_zone *UTC; int spider_db_connect( const SPIDER_SHARE *share, @@ -9115,6 +9115,9 @@ int spider_db_udf_ping_table_append_select( DBUG_RETURN(0); } +/* Stack size 33032 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + int spider_db_udf_ping_table_mon_next( THD *thd, SPIDER_TABLE_MON *table_mon, @@ -9261,6 +9264,7 @@ int spider_db_udf_ping_table_mon_next( delete res; DBUG_RETURN(error_num); } +PRAGMA_REENABLE_CHECK_STACK_FRAME int spider_db_udf_copy_key_row( spider_string *str, diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 5b82f3bf89a..87985584b60 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -86,7 +86,6 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_HS_LTEQUAL_STR "<=" #define SPIDER_SQL_HS_LTEQUAL_LEN (sizeof(SPIDER_SQL_HS_LTEQUAL_STR) - 1) -#ifdef ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC #define SPIDER_SQL_CASE_STR "case " #define SPIDER_SQL_CASE_LEN (sizeof(SPIDER_SQL_CASE_STR) - 1) #define SPIDER_SQL_WHEN_STR " when " @@ -97,7 +96,6 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_ELSE_LEN (sizeof(SPIDER_SQL_ELSE_STR) - 1) #define SPIDER_SQL_END_STR " end" #define SPIDER_SQL_END_LEN (sizeof(SPIDER_SQL_END_STR) - 1) -#endif #define SPIDER_SQL_USING_STR " using " #define SPIDER_SQL_USING_LEN (sizeof(SPIDER_SQL_USING_STR) - 1) diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index e3c4384aeeb..636395cff22 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -1193,7 +1193,7 @@ int spider_db_mbase_result::fetch_table_cardinality( uint num_fields = this->num_fields(); if (num_fields < 12 || num_fields > 14) { - DBUG_PRINT("info",("spider num_fields < 12 || num_fields > 13")); + DBUG_PRINT("info",("spider num_fields < 12 || num_fields > 14")); DBUG_RETURN(ER_SPIDER_INVALID_REMOTE_TABLE_INFO_NUM); } @@ -5410,14 +5410,6 @@ int spider_db_mbase_util::open_item_func( alias_length, use_fields, fields)); } -static bool item_func_is_timestampdiff( - const char *func_name, - int func_name_length -) { - return func_name_length == 13 && - !strncasecmp("timestampdiff", func_name, func_name_length); -} - static bool not_func_should_be_skipped( Item_func *item_func ){ @@ -5487,16 +5479,10 @@ int spider_db_mbase_util::check_item_func( Item_func::Functype func_type = item_func->functype(); DBUG_PRINT("info",("spider functype = %d", func_type)); - const char *func_name = (char*) item_func->func_name(); - int func_name_length = strlen(func_name); - DBUG_PRINT("info",("spider func_name = %s", func_name)); - /* The blacklist of the functions that cannot be pushed down */ switch (func_type) { case Item_func::TRIG_COND_FUNC: - case Item_func::CASE_SEARCHED_FUNC: - case Item_func::CASE_SIMPLE_FUNC: DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); case Item_func::NOT_FUNC: /* Why the following check is necessary? */ @@ -5505,13 +5491,6 @@ int spider_db_mbase_util::check_item_func( break; case Item_func::FUNC_SP: case Item_func::UDF_FUNC: - /* Notes on merging regarding MDEV-29447: please refer to the - following commits for build error or merge conflicts: - 10.6: 1ed20b993b0dd4e95450cab2e8347e5bf4617a69 - 10.9: dd316b6e20265cfd832bb5585cb4c96e716387c8 - 10.10-11: 3f67f110ba1b23a89c5ede0fbeeb203cf5e164f4 - 11.0-1: 17ba6748afa8834df5658361088e6c8e65aca16f - Please remove this comment after merging. */ use_pushdown_udf= spider_param_use_pushdown_udf( spider->wide_handler->trx->thd, spider->share->use_pushdown_udf); if (!use_pushdown_udf) @@ -5521,12 +5500,18 @@ int spider_db_mbase_util::check_item_func( if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY) DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); break; -#ifndef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC - case Item_func::UNKNOWN_FUNC: - if (item_func_is_timestampdiff(func_name, func_name_length)) - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); - break; -#endif + case Item_func::MULT_EQUAL_FUNC: + /* If there is still Item_equal by the time of + JOIN::make_aggr_tables_info() where the spider group by handler + is created, it indicates a bug in the optimizer, because there + shouldn't be any. */ + push_warning_printf( + spider->wide_handler->trx->thd, SPIDER_WARN_LEVEL_WARN, + ER_INTERNAL_ERROR, + ER_THD(spider->wide_handler->trx->thd, ER_INTERNAL_ERROR), + "Spider group by handler: Encountered multiple equalities, likely " + "an optimizer bug"); + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); default: break; } @@ -5568,7 +5553,7 @@ int spider_db_mbase_util::print_item_func( Item *item, **item_list = item_func->arguments(); Field *field; spider_string tmp_str; - uint roop_count, item_count = item_func->argument_count(), start_item = 0; + uint i, item_count = item_func->argument_count(), start_item = 0; LEX_CSTRING org_func_name= {SPIDER_SQL_NULL_CHAR_STR, SPIDER_SQL_NULL_CHAR_LEN}; const char *func_name = SPIDER_SQL_NULL_CHAR_STR, @@ -5577,8 +5562,8 @@ int spider_db_mbase_util::print_item_func( int func_name_length = SPIDER_SQL_NULL_CHAR_LEN, separator_str_length = SPIDER_SQL_NULL_CHAR_LEN, last_str_length = SPIDER_SQL_NULL_CHAR_LEN; - int use_pushdown_udf; - bool merge_func = FALSE; + int use_pushdown_udf, case_when_start, case_when_count; + bool merge_func = FALSE, case_with_else; DBUG_ENTER("spider_db_mbase_util::print_item_func"); DBUG_ASSERT(!check_item_func(item_func, spider, alias, alias_length, use_fields, fields)); @@ -5896,7 +5881,82 @@ int spider_db_mbase_util::print_item_func( alias, alias_length, dbton_id, use_fields, fields)); } else if (!strncasecmp("timestampdiff", func_name, func_name_length)) { - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); + Item_func_timestamp_diff *item_func_timestamp_diff = + (Item_func_timestamp_diff *) item_func; + const char *interval_str; + uint interval_len; + switch (item_func_timestamp_diff->get_int_type()) + { + case INTERVAL_YEAR: + interval_str = SPIDER_SQL_YEAR_STR; + interval_len = SPIDER_SQL_YEAR_LEN; + break; + case INTERVAL_QUARTER: + interval_str = SPIDER_SQL_QUARTER_STR; + interval_len = SPIDER_SQL_QUARTER_LEN; + break; + case INTERVAL_MONTH: + interval_str = SPIDER_SQL_MONTH_STR; + interval_len = SPIDER_SQL_MONTH_LEN; + break; + case INTERVAL_WEEK: + interval_str = SPIDER_SQL_WEEK_STR; + interval_len = SPIDER_SQL_WEEK_LEN; + break; + case INTERVAL_DAY: + interval_str = SPIDER_SQL_DAY_STR; + interval_len = SPIDER_SQL_DAY_LEN; + break; + case INTERVAL_HOUR: + interval_str = SPIDER_SQL_HOUR_STR; + interval_len = SPIDER_SQL_HOUR_LEN; + break; + case INTERVAL_MINUTE: + interval_str = SPIDER_SQL_MINUTE_STR; + interval_len = SPIDER_SQL_MINUTE_LEN; + break; + case INTERVAL_SECOND: + interval_str = SPIDER_SQL_SECOND_STR; + interval_len = SPIDER_SQL_SECOND_LEN; + break; + case INTERVAL_MICROSECOND: + interval_str = SPIDER_SQL_MICROSECOND_STR; + interval_len = SPIDER_SQL_MICROSECOND_LEN; + break; + default: + interval_str = ""; + interval_len = 0; + break; + } + str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN); + if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN + + interval_len + SPIDER_SQL_COMMA_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(func_name, func_name_length); + str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN); + str->q_append(interval_str, interval_len); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + + if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider, + str, alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + if (str) + { + if (str->reserve(SPIDER_SQL_COMMA_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); + } + if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider, + str, alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + if (str) + { + if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, + SPIDER_SQL_CLOSE_PAREN_LEN); + } + DBUG_RETURN(0); } } else if (func_name_length == 14) { @@ -6390,7 +6450,83 @@ int spider_db_mbase_util::print_item_func( DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); case Item_func::CASE_SEARCHED_FUNC: case Item_func::CASE_SIMPLE_FUNC: - DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); + /* + Arrangement of arguments: + - Item_func_case_searched: + when1 when2 ... whenk then1 then2 .. thenk [else] + - Item_func_case_simple: + value when1 when2 ... whenk then1 then2 .. thenk [else] + */ + if (item_func->functype() == Item_func::CASE_SEARCHED_FUNC) + { + case_when_start= 0; + case_when_count= item_count / 2; + case_with_else= item_count % 2; + } + else + { + case_when_start= 1; + case_when_count= (item_count - 1) / 2; + case_with_else= item_count % 2 == 0; + } + if (str) + { + if (str->reserve(SPIDER_SQL_CASE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_CASE_STR, SPIDER_SQL_CASE_LEN); + } + if (case_when_start > 0) + { + if ((error_num = spider_db_print_item_type( + item_list[0], NULL, spider, str, + alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + } + for (i = 0; i < (uint) case_when_count; i++) + { + if (str) + { + if (str->reserve(SPIDER_SQL_WHEN_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN); + } + if ((error_num = spider_db_print_item_type( + item_list[i + case_when_start], NULL, spider, str, + alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + if (str) + { + if (str->reserve(SPIDER_SQL_THEN_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN); + } + if ((error_num = spider_db_print_item_type( + item_list[i + case_when_start + case_when_count], NULL, spider, str, + alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + } + if (case_with_else) + { + if (str) + { + if (str->reserve(SPIDER_SQL_ELSE_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN); + } + if ((error_num = spider_db_print_item_type( + item_list[item_count - 1], NULL, spider, str, + alias, alias_length, dbton_id, use_fields, fields))) + DBUG_RETURN(error_num); + } + if (str) + { + if (str->reserve(SPIDER_SQL_END_LEN + SPIDER_SQL_CLOSE_PAREN_LEN)) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + str->q_append(SPIDER_SQL_END_STR, SPIDER_SQL_END_LEN); + str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, + SPIDER_SQL_CLOSE_PAREN_LEN); + } + DBUG_RETURN(0); case Item_func::JSON_EXTRACT_FUNC: func_name = (char*) item_func->func_name(); func_name_length = strlen(func_name); @@ -6405,6 +6541,18 @@ int spider_db_mbase_util::print_item_func( last_str = SPIDER_SQL_CLOSE_PAREN_STR; last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN; break; + case Item_func::MULT_EQUAL_FUNC: + /* If there is still Item_equal by the time of + JOIN::make_aggr_tables_info() where the spider group by handler + is created, it indicates a bug in the optimizer, because there + shouldn't be any. */ + push_warning_printf( + spider->wide_handler->trx->thd, + SPIDER_WARN_LEVEL_WARN, ER_INTERNAL_ERROR, + ER_THD(spider->wide_handler->trx->thd, ER_INTERNAL_ERROR), + "Spider group by handler: Encountered multiple equalities, likely " + "an optimizer bug"); + DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM); default: THD *thd = spider->wide_handler->trx->thd; SPIDER_SHARE *share = spider->share; @@ -6434,13 +6582,13 @@ int spider_db_mbase_util::print_item_func( Loop through the items of the current function expression to print its portion of the statement */ - for (roop_count = start_item; roop_count < item_count; roop_count++) + for (i = start_item; i < item_count; i++) { - item = item_list[roop_count]; + item = item_list[i]; if ((error_num = spider_db_print_item_type(item, field, spider, str, alias, alias_length, dbton_id, use_fields, fields))) DBUG_RETURN(error_num); - if (roop_count == 1) + if (i == 1) { /* Remaining operands need to be preceded by the separator */ func_name = separator_str; @@ -6454,7 +6602,7 @@ int spider_db_mbase_util::print_item_func( } /* Print the last operand value */ - item = item_list[roop_count]; + item = item_list[i]; if ((error_num = spider_db_print_item_type(item, field, spider, str, alias, alias_length, dbton_id, use_fields, fields))) DBUG_RETURN(error_num); @@ -7087,11 +7235,9 @@ int spider_mbase_share::init() DBUG_RETURN(HA_ERR_OUT_OF_MEM); } - if (keys > 0 && - !(key_hint = new spider_string[keys]) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } + if (keys > 0) + if (!(key_hint = new spider_string[keys])) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); for (roop_count = 0; roop_count < keys; roop_count++) { key_hint[roop_count].init_calc_mem(SPD_MID_MBASE_SHARE_INIT_2); @@ -7099,12 +7245,12 @@ int spider_mbase_share::init() } DBUG_PRINT("info",("spider key_hint=%p", key_hint)); - if ( - !(table_select = new spider_string[1]) || - (keys > 0 && - !(key_select = new spider_string[keys]) - ) || - (error_num = create_table_names_str()) || + if (!(table_select = new spider_string[1])) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if (keys > 0) + if (!(key_select = new spider_string[keys])) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if ((error_num = create_table_names_str()) || (table_share && ( (error_num = create_column_name_str()) || @@ -7255,11 +7401,18 @@ int spider_mbase_share::create_table_names_str() table_names_str = NULL; db_names_str = NULL; db_table_str = NULL; - if ( - !(table_names_str = new spider_string[spider_share->all_link_count]) || - !(db_names_str = new spider_string[spider_share->all_link_count]) || - !(db_table_str = new spider_string[spider_share->all_link_count]) - ) { + if (!(table_names_str = new spider_string[spider_share->all_link_count])) + { + error_num = HA_ERR_OUT_OF_MEM; + goto error; + } + if (!(db_names_str = new spider_string[spider_share->all_link_count])) + { + error_num = HA_ERR_OUT_OF_MEM; + goto error; + } + if (!(db_table_str = new spider_string[spider_share->all_link_count])) + { error_num = HA_ERR_OUT_OF_MEM; goto error; } @@ -7408,11 +7561,9 @@ int spider_mbase_share::create_column_name_str() Field **field; TABLE_SHARE *table_share = spider_share->table_share; DBUG_ENTER("spider_mbase_share::create_column_name_str"); - if ( - table_share->fields && - !(column_name_str = new spider_string[table_share->fields]) - ) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); + if (table_share->fields) + if (!(column_name_str = new spider_string[table_share->fields])) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); for (field = table_share->field, str = column_name_str; *field; field++, str++) { diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 2f593ddc2e2..6d0af8cc015 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -1617,6 +1617,11 @@ my_bool spider_direct_sql_init_body( ) { SPIDER_BG_DIRECT_SQL *bg_direct_sql; DBUG_ENTER("spider_direct_sql_init_body"); + if (!spider_hton_ptr) + { + strcpy(message, "Plugin 'SPIDER' is not loaded"); + goto error; + } if (args->arg_count != 3) { strcpy(message, "spider_(bg)_direct_sql() requires 3 arguments"); diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc index 7db9537136a..8ae88102e81 100644 --- a/storage/spider/spd_i_s.cc +++ b/storage/spider/spd_i_s.cc @@ -28,6 +28,7 @@ #include "spd_table.h" extern pthread_mutex_t spider_mem_calc_mutex; +extern handlerton *spider_hton_ptr; extern const char *spider_alloc_func_name[SPIDER_MEM_CALC_LIST_NUM]; extern const char *spider_alloc_file_name[SPIDER_MEM_CALC_LIST_NUM]; @@ -63,6 +64,8 @@ static int spider_i_s_alloc_mem_fill_table( uint roop_count; TABLE *table = tables->table; DBUG_ENTER("spider_i_s_alloc_mem_fill_table"); + if (!spider_hton_ptr) + DBUG_RETURN(0); for (roop_count = 0; roop_count < SPIDER_MEM_CALC_LIST_NUM; roop_count++) { table->field[0]->store(roop_count, TRUE); @@ -177,6 +180,8 @@ static int spider_i_s_wrapper_protocols_fill_table( SPIDER_DBTON *dbton; TABLE *table = tables->table; DBUG_ENTER("spider_i_s_wrapper_protocols_fill_table"); + if (!spider_hton_ptr) + DBUG_RETURN(0); for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; roop_count++) { dbton = &spider_dbton[roop_count]; diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 4adf9a911f0..33fd26af4b4 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -1454,6 +1454,7 @@ typedef struct st_spider_table_mon st_spider_table_mon *next; } SPIDER_TABLE_MON; +/* List of `SPIDER_TABLE_MON's */ typedef struct st_spider_table_mon_list { char *key; diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h index 0e42e228481..ced68e03d08 100644 --- a/storage/spider/spd_init_query.h +++ b/storage/spider/spd_init_query.h @@ -20,12 +20,17 @@ */ static LEX_STRING spider_init_queries[] = { + /* Use the default SQL_MODE for this connection. */ {C_STRING_WITH_LEN( - "SET @@SQL_MODE = REGEXP_REPLACE(@@SQL_MODE, '(ORACLE|NO_ZERO_DATE)', '');" + "SET @@SQL_MODE = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO," + "NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';" )}, {C_STRING_WITH_LEN( "SET @@OLD_MODE = CONCAT(@@OLD_MODE, ',UTF8_IS_UTF8MB3');" )}, + {C_STRING_WITH_LEN( + "SET tx_read_only = off;" + )}, {C_STRING_WITH_LEN( "create table if not exists mysql.spider_xa(" " format_id int not null default 0," diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index edad3163c0b..2597150d7aa 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -50,6 +50,8 @@ extern PSI_mutex_key spd_key_mutex_mon_list_update_status; extern PSI_mutex_key spd_key_mutex_mon_table_cache; #endif +/* Array (of size `spider_udf_table_mon_mutex_count') of hashes of +`SPIDER_TABLE_MON_LIST'. */ HASH *spider_udf_table_mon_list_hash; uint spider_udf_table_mon_list_hash_id; const char *spider_udf_table_mon_list_hash_func_name; @@ -59,23 +61,43 @@ pthread_mutex_t *spider_udf_table_mon_mutexes; pthread_cond_t *spider_udf_table_mon_conds; pthread_mutex_t spider_mon_table_cache_mutex; +/* A cache to store distinct SPIDER_MON_KEYs with db name, table name +and link id read from mysql.spider_link_mon_servers table. Initialised +and populated in spider_init_ping_table_mon_cache(), and used in +spider_ping_table_cache_compare(). The udf +spider_flush_table_mon_cache is used to flag a initialisation. */ DYNAMIC_ARRAY spider_mon_table_cache; uint spider_mon_table_cache_id; const char *spider_mon_table_cache_func_name; const char *spider_mon_table_cache_file_name; ulong spider_mon_table_cache_line_no; -volatile ulonglong spider_mon_table_cache_version = 0; -volatile ulonglong spider_mon_table_cache_version_req = 1; +/* The mon table cache version, initialised at 0, and always no +greater than spider_mon_table_cache_version_req. When the inequality +is strict, an initialisation of spider_mon_table_cache will be +triggered. */ +volatile ulonglong spider_mon_table_cache_version; +/* The required mon table cache version, incremented by one by the +udf spider_flush_table_mon_cache */ +volatile ulonglong spider_mon_table_cache_version_req; + /* Get or create a `SPIDER_TABLE_MON_LIST' for a key `str' */ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( SPIDER_TRX *trx, THD *thd, - spider_string *str, + spider_string *str, /* The key to search in + `spider_udf_table_mon_list_hash', + usually in the format of + "./$db_name/$table_name000000000$link_idx" */ uint conv_name_length, int link_idx, char *static_link_id, uint static_link_id_length, - uint32 server_id, + uint32 server_id, /* The server id of the monitor + server, used for creating a new + table mon list having a + `SPIDER_TABLE_MON' corresponding to + the server id as the `current' + field */ bool need_lock, int *error_num ) { @@ -85,6 +107,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( ulonglong mon_table_cache_version; my_hash_value_type hash_value; DBUG_ENTER("spider_get_ping_table_mon_list"); + /* Reset the cache if the version does not match the requirement */ if (spider_mon_table_cache_version != spider_mon_table_cache_version_req) { SPD_INIT_ALLOC_ROOT(&mem_root, 4096, 0, MYF(MY_WME)); @@ -97,6 +120,9 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( free_root(&mem_root, MYF(0)); } + /* Search for the table mon list in the hash, if one is not found or + if it is found but has the wrong cache version, create and + initialise a new one. */ mutex_hash= spider_udf_calc_hash(str->c_ptr(), spider_udf_table_mon_mutex_count); DBUG_PRINT("info",("spider hash key=%s", str->c_ptr())); @@ -113,12 +139,15 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( table_mon_list->mon_table_cache_version != mon_table_cache_version ) { + /* If table_mon_list is found but the cache version does not + match, remove it from the hash and free it. */ if ( table_mon_list && table_mon_list->mon_table_cache_version != mon_table_cache_version ) spider_release_ping_table_mon_list_loop(mutex_hash, table_mon_list); - + /* create and initialise `table_mon_list' and insert it into the + hash */ if (!(table_mon_list = spider_get_ping_table_tgt(thd, str->c_ptr(), conv_name_length, link_idx, static_link_id, static_link_id_length, server_id, str, need_lock, error_num))) @@ -240,6 +269,14 @@ int spider_release_ping_table_mon_list( DBUG_RETURN(0); } +/* + Look for a `SPIDER_MON_KEY` in `spider_mon_table_cache' whose db and + table name and link_idx matching `name' and `link_idx' with wild + card matching. If a match is found, create `SPIDER_TABLE_MON's from + all rows in mysql.spider_link_mon_servers that match the info in the + `SPIDER_MON_KEY' and populate the `table_mon_list' with these + `SPIDER_TABLE_MON's. +*/ int spider_get_ping_table_mon( THD *thd, SPIDER_TABLE_MON_LIST *table_mon_list, @@ -316,6 +353,8 @@ int spider_get_ping_table_mon( goto error; create_table_mon: + /* Find the first row in mysql.spider_link_mon_servers matching the + db name, table name and link_idx */ if ((error_num = spider_get_sys_table_by_idx(table_link_mon, table_key, table_link_mon->s->primary_key, 3))) { @@ -323,6 +362,9 @@ create_table_mon: goto error; } + /* create one `SPIDER_TABLE_MON' per row in + mysql.spider_link_mon_servers with matching db name, table name and + link_idx, and add it to `table_mon_list'. */ do { if (!(table_mon = (SPIDER_TABLE_MON *) spider_bulk_malloc(spider_current_trx, SPD_MID_GET_PING_TABLE_MON_1, MYF(MY_WME | MY_ZEROFILL), @@ -356,7 +398,7 @@ create_table_mon: (error_num = spider_get_sys_link_mon_server_id( table_link_mon, &table_mon->server_id, mem_root)) || (error_num = spider_get_sys_link_mon_connect_info( - table_link_mon, tmp_share, 0, mem_root)) + table_link_mon, tmp_share, mem_root)) ) { table_link_mon->file->print_error(error_num, MYF(0)); spider_sys_index_end(table_link_mon); @@ -416,15 +458,21 @@ error: DBUG_RETURN(error_num); } +/* + creates and return table_mon_list associated with table with `name' + and `link_idx'th link. +*/ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( THD *thd, - char *name, + char *name, /* The table name, usually fully qualified */ uint name_length, int link_idx, char *static_link_id, uint static_link_id_length, - uint32 server_id, - spider_string *str, + uint32 server_id, /* The server_id will determine the + `current' field of the returned + `SPIDER_TABLE_MON_LIST'. */ + spider_string *str, /* str->c_ptr() == name */ bool need_lock, int *error_num ) { @@ -469,6 +517,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( memcpy(key_str, str->ptr(), table_mon_list->key_length); tmp_share->access_charset = thd->variables.character_set_client; + /* Open mysql.spider_tables */ if ( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, @@ -478,6 +527,8 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( my_error(*error_num, MYF(0)); goto error; } + /* store db and table names and link idx in mysql.spider_tables for + reading */ spider_store_tables_name(table_tables, name, name_length); if (static_link_id) { @@ -501,9 +552,10 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( goto error; } } + /* Populate tmp_share with info read from mysql.spider_tables */ if ( (*error_num = spider_get_sys_tables_connect_info( - table_tables, tmp_share, 0, &mem_root)) || + table_tables, tmp_share, &mem_root)) || (*error_num = spider_get_sys_tables_link_status( table_tables, tmp_share->link_statuses, &mem_root)) ) { @@ -524,9 +576,8 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( tmp_share, name, name_length )) || (*error_num = spider_create_conn_keys(tmp_share)) || -/* - (*error_num = spider_db_create_table_names_str(tmp_share)) || -*/ + /* Pinally, populate `table_mon_list' with newly created + `SPIDER_TABLE_MON's */ (*error_num = spider_get_ping_table_mon( thd, table_mon_list, name, name_length, link_idx, server_id, &mem_root, need_lock)) @@ -811,6 +862,11 @@ error_open_table_tables: DBUG_RETURN(error_num); } +/* + Initialise `spider_mon_table_cache' by scanning the + mysql.spider_link_mon_servers table, creating distinct + `SPIDER_MON_KEY's with the info and inserting them into the cache. +*/ int spider_init_ping_table_mon_cache( THD *thd, MEM_ROOT *mem_root, @@ -839,6 +895,7 @@ int spider_init_ping_table_mon_cache( /* reset */ spider_mon_table_cache.elements = 0; + /* start at the first row */ if ((error_num = spider_sys_index_first(table_link_mon, table_link_mon->s->primary_key))) { @@ -855,10 +912,16 @@ int spider_init_ping_table_mon_cache( mon_key.table_name_length = SPIDER_SYS_LINK_MON_TABLE_TABLE_NAME_SIZE + 1; mon_key.link_id_length = SPIDER_SYS_LINK_MON_TABLE_LINK_ID_SIZE + 1; do { + /* update content of `mon_key' */ if ((error_num = spider_get_sys_link_mon_key(table_link_mon, &mon_key, mem_root, &same))) goto error_get_sys_link_mon_key; + /* `mon_key' has changed content. since + mysql.spider_link_mon_servers is indexed by db_name, + table_name, link_idx, and server_id, it is possible that + different server_ids share the same mon_key which only has + db_name, table_name, link_idx */ if (!same) { mon_key.sort = spider_calc_for_sort(3, mon_key.db_name, @@ -929,6 +992,13 @@ error_open_sys_table: DBUG_RETURN(error_num); } +/* + Read from msyql.spider_link_mon_servers table fields the db name, + table name and link_id and search for them with wild card matching + in `spider_mon_table_cache'. store the db name, table name, and + link_id of the matching `SPIDER_MON_KEY' back to the table field on + success. +*/ int spider_ping_table_cache_compare( TABLE *table, MEM_ROOT *mem_root @@ -1205,9 +1275,6 @@ long long spider_ping_table_body( DBUG_PRINT("info",("spider mon_table_result->result_status=SPIDER_LINK_MON_NG 2")); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { -/* - pthread_mutex_lock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_lock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { @@ -1222,9 +1289,6 @@ long long spider_ping_table_body( conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } -/* - pthread_mutex_unlock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_unlock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (status_changed_to_ng) { @@ -1278,9 +1342,6 @@ long long spider_ping_table_body( DBUG_PRINT("info",("spider mon_table_result->result_status=SPIDER_LINK_MON_NG 3")); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { -/* - pthread_mutex_lock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_lock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { @@ -1295,9 +1356,6 @@ long long spider_ping_table_body( conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } -/* - pthread_mutex_unlock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_unlock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (status_changed_to_ng) { @@ -1341,9 +1399,6 @@ long long spider_ping_table_body( mon_table_result->result_status == SPIDER_LINK_MON_NG && table_mon_list->mon_status != SPIDER_LINK_MON_NG ) { -/* - pthread_mutex_lock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_lock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { @@ -1358,9 +1413,6 @@ long long spider_ping_table_body( conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } -/* - pthread_mutex_unlock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_unlock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (status_changed_to_ng) { @@ -1531,9 +1583,9 @@ int spider_ping_table_mon_from_table( SPIDER_SHARE *share, int base_link_idx, uint32 server_id, - char *conv_name, + char *conv_name, /* Usually fully qualified table name */ uint conv_name_length, - int link_idx, + int link_idx, /* The link id to ping */ char *where_clause, uint where_clause_length, long monitoring_kind, @@ -1543,9 +1595,6 @@ int spider_ping_table_mon_from_table( ) { int error_num = 0, current_mon_count, flags; uint32 first_sid; -/* - THD *thd = trx->thd; -*/ SPIDER_TABLE_MON_LIST *table_mon_list; SPIDER_TABLE_MON *table_mon; SPIDER_MON_TABLE_RESULT mon_table_result; @@ -1614,6 +1663,7 @@ int spider_ping_table_mon_from_table( if (monitoring_flag & 1) flags |= SPIDER_UDF_PING_TABLE_USE_ALL_MONITORING_NODES; + /* Get or create `table_mon_list' for `conv_name_str'. */ if (!(table_mon_list = spider_get_ping_table_mon_list(trx, thd, &conv_name_str, conv_name_length, link_idx, share->static_link_ids[link_idx], @@ -1645,6 +1695,8 @@ int spider_ping_table_mon_from_table( table_mon = table_mon_list->current; first_sid = table_mon->server_id; current_mon_count = 1; + /* Call spider_ping_table on each table_mon of `table_mon_list', + until one succeeds */ while (TRUE) { DBUG_PRINT("info",("spider thd->killed=%s", @@ -1689,16 +1741,13 @@ int spider_ping_table_mon_from_table( if (!spider_db_udf_ping_table_mon_next( thd, table_mon, mon_conn, &mon_table_result, conv_name, conv_name_length, link_idx, - where_clause, where_clause_length, -1, table_mon_list->list_size, + where_clause, where_clause_length, /*first_sid=*/-1, table_mon_list->list_size, 0, 0, 0, flags, monitoring_limit)) { if ( mon_table_result.result_status == SPIDER_LINK_MON_NG && table_mon_list->mon_status != SPIDER_LINK_MON_NG ) { -/* - pthread_mutex_lock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_lock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); if (table_mon_list->mon_status != SPIDER_LINK_MON_NG) { @@ -1713,9 +1762,6 @@ int spider_ping_table_mon_from_table( spider_sys_log_tables_link_failed(thd, conv_name, conv_name_length, link_idx); } -/* - pthread_mutex_unlock(&table_mon_list->update_status_mutex); -*/ pthread_mutex_unlock(&spider_udf_table_mon_mutexes[table_mon_list->mutex_hash]); } table_mon_list->last_caller_result = mon_table_result.result_status; diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 08eea15a76e..5cbae605ca5 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -562,6 +562,11 @@ int spider_check_sys_table_for_update_all_columns( HA_WHOLE_KEY, HA_READ_KEY_EXACT)); } +/* + Creates a key (`table_key') consisting of `col_count' key parts of + `idx'th index of the table, then positions an index cursor to that + key. +*/ int spider_get_sys_table_by_idx( TABLE *table, char *table_key, @@ -617,7 +622,7 @@ int spider_sys_index_next_same( int spider_sys_index_first( TABLE *table, - const int idx + const int idx /* which index to use */ ) { int error_num; DBUG_ENTER("spider_sys_index_first"); @@ -2147,14 +2152,16 @@ int spider_get_sys_tables( DBUG_RETURN(0); } +/* Read table info from mysql.spider_tables into a `SPIDER_SHARE' */ int spider_get_sys_tables_connect_info( - TABLE *table, - SPIDER_SHARE *share, - int link_idx, + TABLE *table, /* The mysql.spider_tables table */ + SPIDER_SHARE *share, /* The `SPIDER_SHARE' to + update info */ MEM_ROOT *mem_root ) { char *ptr; int error_num = 0; + const int link_idx= 0; DBUG_ENTER("spider_get_sys_tables_connect_info"); DBUG_PRINT("info",("spider link_idx:%d", link_idx)); if ((ptr = get_field(mem_root, table->field[SPIDER_TABLES_PRIORITY_POS]))) @@ -2588,11 +2595,17 @@ error: DBUG_RETURN(error_num); } +/* Populate `mon_key' from the current row in `table' */ int spider_get_sys_link_mon_key( - TABLE *table, - SPIDER_MON_KEY *mon_key, + TABLE *table, /* the mysql.spider_link_mon_servers + table */ + SPIDER_MON_KEY *mon_key, /* output, to be populated in this + function */ MEM_ROOT *mem_root, - int *same + int *same /* output, true if the data from the + current row in the table agrees with + existing data in `mon_key' and false + otherwise */ ) { char *db_name, *table_name, *link_id; uint db_name_length, table_name_length, link_id_length; @@ -2608,6 +2621,7 @@ int spider_get_sys_link_mon_key( DBUG_RETURN(ER_SPIDER_SYS_TABLE_VERSION_NUM); } + /* get data for `mon_key' from the table record */ if (!(db_name= get_field(mem_root, table->field[SPIDER_LINK_MON_SERVERS_DB_NAME_POS]))) @@ -2659,9 +2673,12 @@ int spider_get_sys_link_mon_key( DBUG_RETURN(0); } +/* Get the server id from the spider_link_mon_servers table field */ int spider_get_sys_link_mon_server_id( - TABLE *table, - uint32 *server_id, + TABLE *table, /* the + mysql.spider_link_mon_servers + table */ + uint32 *server_id, /* output to server_id */ MEM_ROOT *mem_root ) { char *ptr; @@ -2675,14 +2692,17 @@ int spider_get_sys_link_mon_server_id( DBUG_RETURN(error_num); } +/* Get connect info from the spider_link_mon_servers table fields */ int spider_get_sys_link_mon_connect_info( - TABLE *table, - SPIDER_SHARE *share, - int link_idx, + TABLE *table, /* The + mysql.spider_link_mon_servers + table */ + SPIDER_SHARE *share, /* The output spider_share */ MEM_ROOT *mem_root ) { char *ptr; int error_num = 0; + const int link_idx= 0; DBUG_ENTER("spider_get_sys_link_mon_connect_info"); if ( !table->field[SPIDER_LINK_MON_SERVERS_SERVER_POS]->is_null() && diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h index a51d6914c71..cef44df9a93 100644 --- a/storage/spider/spd_sys_table.h +++ b/storage/spider/spd_sys_table.h @@ -56,6 +56,7 @@ #define SPIDER_SYS_LINK_MON_TABLE_TABLE_NAME_SIZE 64 #define SPIDER_SYS_LINK_MON_TABLE_LINK_ID_SIZE 64 +/* For insertion into `spider_mon_table_cache'. */ class SPIDER_MON_KEY: public SPIDER_SORT { public: @@ -393,7 +394,6 @@ int spider_get_sys_tables( int spider_get_sys_tables_connect_info( TABLE *table, SPIDER_SHARE *share, - int link_idx, MEM_ROOT *mem_root ); @@ -460,7 +460,6 @@ int spider_get_sys_link_mon_server_id( int spider_get_sys_link_mon_connect_info( TABLE *table, SPIDER_SHARE *share, - int link_idx, MEM_ROOT *mem_root ); diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index fe3eea24854..0593c8f5b0b 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -125,6 +125,11 @@ extern SPIDER_DBTON spider_dbton_mysql; extern SPIDER_DBTON spider_dbton_mariadb; SPIDER_THREAD *spider_table_sts_threads; SPIDER_THREAD *spider_table_crd_threads; +extern volatile ulonglong spider_mon_table_cache_version; +extern volatile ulonglong spider_mon_table_cache_version_req; +extern ulonglong spider_conn_id; +extern Time_zone *UTC; +extern ulonglong spider_thread_id; #ifdef HAVE_PSI_INTERFACE PSI_mutex_key spd_key_mutex_tbl; @@ -3489,11 +3494,13 @@ error_alloc_conn_string: DBUG_RETURN(error_num); } +/* Set default connect info of a SPIDER_SHARE if needed */ int spider_set_connect_info_default( - SPIDER_SHARE *share, - partition_element *part_elem, - partition_element *sub_elem, - TABLE_SHARE *table_share + SPIDER_SHARE *share, /* The `SPIDER_SHARE' to set + default connect info */ + partition_element *part_elem, /* partition info used as input */ + partition_element *sub_elem, /* subpartition info used as input */ + TABLE_SHARE *table_share /* table share info used as input */ ) { bool check_socket; bool check_database; @@ -3727,22 +3734,6 @@ int spider_set_connect_info_default( } } -/* - if (!share->static_link_ids[roop_count]) - { - DBUG_PRINT("info",("spider create default static_link_ids")); - share->static_link_ids_lengths[roop_count] = - SPIDER_DB_STATIC_LINK_ID_LEN; - if ( - !(share->static_link_ids[roop_count] = spider_create_string( - SPIDER_DB_STATIC_LINK_ID_STR, - share->static_link_ids_lengths[roop_count])) - ) { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } -*/ - if (port_has_default_value) { share->tgt_ports[roop_count] = MYSQL_PORT; @@ -3832,7 +3823,11 @@ int spider_set_connect_info_default( DBUG_RETURN(0); } - +/* + This function is a no-op if all share->tgt_dbs and + share->tgt_table_names are non-null, otherwise it may assign them + with db_name and table_name +*/ int spider_set_connect_info_default_db_table( SPIDER_SHARE *share, const char *db_name, @@ -3918,6 +3913,11 @@ int spider_set_connect_info_default_db_table( DBUG_RETURN(0); } +/* + Parse `dbtable_name' into db name and table name, and call + spider_set_connect_info_default_db_table() to set the db/table name + values of `share' if needed +*/ int spider_set_connect_info_default_dbtable( SPIDER_SHARE *share, const char *dbtable_name, @@ -4287,12 +4287,12 @@ SPIDER_SHARE *spider_create_share( share->table.key_info = table_share->key_info; share->table.read_set = &table_share->all_set; - if (table_share->keys > 0 && - !(share->key_hint = new spider_string[table_share->keys]) - ) { - *error_num = HA_ERR_OUT_OF_MEM; - goto error_init_hint_string; - } + if (table_share->keys > 0) + if (!(share->key_hint = new spider_string[table_share->keys])) + { + *error_num = HA_ERR_OUT_OF_MEM; + goto error_init_hint_string; + } for (roop_count = 0; roop_count < (int) table_share->keys; roop_count++) share->key_hint[roop_count].init_calc_mem(SPD_MID_CREATE_SHARE_2); DBUG_PRINT("info",("spider share->key_hint=%p", share->key_hint)); @@ -5476,7 +5476,7 @@ int spider_open_all_tables( (error_num = spider_get_sys_tables( table_tables, &db_name, &table_name, &mem_root)) || (error_num = spider_get_sys_tables_connect_info( - table_tables, &tmp_share, 0, &mem_root)) || + table_tables, &tmp_share, &mem_root)) || (error_num = spider_set_connect_info_default( &tmp_share, NULL, @@ -5749,7 +5749,11 @@ int spider_close_connection( } spider_rollback(spider_hton_ptr, thd, TRUE); + + Dummy_error_handler deh; // suppress network errors at this stage + thd->push_internal_handler(&deh); spider_free_trx(trx, TRUE, false); + thd->pop_internal_handler(); DBUG_RETURN(0); } @@ -5920,6 +5924,7 @@ int spider_db_done( pthread_mutex_destroy(&spider_tbl_mutex); pthread_attr_destroy(&spider_pt_attr); + spider_hton_ptr= NULL; for (roop_count = 0; roop_count < SPIDER_MEM_CALC_LIST_NUM; roop_count++) { if (spider_alloc_func_name[roop_count]) @@ -6029,6 +6034,12 @@ int spider_db_init( handlerton *spider_hton = (handlerton *)p; DBUG_ENTER("spider_db_init"); + spider_mon_table_cache_version= 0; + spider_mon_table_cache_version_req= 1; + spider_conn_id= 1; + spider_conn_mutex_id= 0; + UTC = 0; + spider_thread_id = 1; const LEX_CSTRING aria_name={STRING_WITH_LEN("Aria")}; if (!plugin_is_ready(&aria_name, MYSQL_STORAGE_ENGINE_PLUGIN)) DBUG_RETURN(HA_ERR_RETRY_INIT); @@ -6263,11 +6274,6 @@ int spider_db_init( spider_udf_table_mon_list_hash[roop_count].array.size_of_element); } - if (spider_init_system_tables()) - { - goto error_system_table_creation; - } - if (!(spider_table_sts_threads = (SPIDER_THREAD *) spider_bulk_malloc(NULL, SPD_MID_DB_INIT_12, MYF(MY_WME | MY_ZEROFILL), &spider_table_sts_threads, (uint) (sizeof(SPIDER_THREAD) * @@ -6276,7 +6282,7 @@ int spider_db_init( spider_param_table_crd_thread_count()), NullS)) ) - goto error_alloc_mon_mutxes; + goto error_alloc_table_sts_crd_threads; for (roop_count = 0; roop_count < (int) spider_param_table_sts_thread_count(); @@ -6333,6 +6339,7 @@ error_init_table_sts_threads: { spider_free_sts_threads(&spider_table_sts_threads[roop_count]); } +error_alloc_table_sts_crd_threads: spider_free(NULL, spider_table_sts_threads, MYF(0)); roop_count= spider_udf_table_mon_mutex_count - 1; error_init_udf_table_mon_list_hash: @@ -6348,7 +6355,6 @@ error_init_udf_table_mon_list_hash: error_init_udf_table_mon_cond: for (; roop_count >= 0; roop_count--) pthread_cond_destroy(&spider_udf_table_mon_conds[roop_count]); -error_system_table_creation: roop_count= spider_udf_table_mon_mutex_count - 1; error_init_udf_table_mon_mutex: for (; roop_count >= 0; roop_count--) diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index b6a2bcd8494..124e47364e6 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -41,7 +41,7 @@ extern struct charset_info_st *spd_charset_utf8mb3_bin; extern handlerton *spider_hton_ptr; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; pthread_mutex_t spider_thread_id_mutex; -ulonglong spider_thread_id = 1; +ulonglong spider_thread_id; #ifdef HAVE_PSI_INTERFACE extern PSI_mutex_key spd_key_mutex_udf_table; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index aa4d366208f..a79a0764840 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -39437,18 +39437,24 @@ my_uca1400_collation_definition_init(MY_CHARSET_LOADER *loader, *dst= nopad ? my_charset_utf8mb4_unicode_520_nopad_ci : my_charset_utf8mb4_unicode_520_ci; break; +#ifdef HAVE_CHARSET_ucs2 case MY_CS_ENCODING_UCS2: *dst= nopad ? my_charset_ucs2_unicode_520_nopad_ci : my_charset_ucs2_unicode_520_ci; break; +#endif +#ifdef HAVE_CHARSET_utf16 case MY_CS_ENCODING_UTF16: *dst= nopad ? my_charset_utf16_unicode_520_nopad_ci : my_charset_utf16_unicode_520_ci; break; +#endif +#ifdef HAVE_CHARSET_utf32 case MY_CS_ENCODING_UTF32: *dst= nopad ? my_charset_utf32_unicode_520_nopad_ci : my_charset_utf32_unicode_520_ci; break; +#endif } dst->number= id; diff --git a/support-files/mini-benchmark.sh b/support-files/mini-benchmark.sh index a7bf3591a39..a405b6c469c 100755 --- a/support-files/mini-benchmark.sh +++ b/support-files/mini-benchmark.sh @@ -26,6 +26,8 @@ display_help() { echo " sysbench runs" echo " --perf-flamegraph record performance counters in perf.data.* and" echo " generate flamegraphs automatically" + echo " --cpu-limit upper limit on the number of CPU cycles (in billions) used for the benchmark" + echo " default: 750" echo " -h, --help display this help and exit" } @@ -79,6 +81,11 @@ do PERF_RECORD=true shift ;; + --cpu-limit) + shift + CPU_CYCLE_LIMIT=$1 + shift + ;; -*) echo "Error: Unknown option: $1" >&2 ## or call function display_help @@ -247,12 +254,21 @@ then echo "Total: $(grep -h -e instructions sysbench-run-*.log | sort -k 1 | awk '{s+=$1}END{print s}')" echo # Newline improves readability + if [ -z "$CPU_CYCLE_LIMIT" ] + then + # 04-04-2024: We found this to be an appropriate default limit after running a few benchmarks + # Configure the limit with --cpu-limit if needed + CPU_CYCLE_LIMIT=750 + fi + CPU_CYCLE_LIMIT_LONG="${CPU_CYCLE_LIMIT}000000000" + # Final verdict based on cpu cycle count RESULT="$(grep -h -e cycles sysbench-run-*.log | sort -k 1 | awk '{s+=$1}END{print s}')" - if [ "$RESULT" -gt 850 ] + if [ "$RESULT" -gt "$CPU_CYCLE_LIMIT_LONG" ] then echo # Newline improves readability - echo "Benchmark exceeded 850 billion cpu cycles, performance most likely regressed!" + echo "Benchmark exceeded the allowed limit of ${CPU_CYCLE_LIMIT} billion CPU cycles" + echo "Performance most likely regressed!" exit 1 fi fi @@ -294,4 +310,4 @@ case $RESULT in esac # Record the output into the log file, if requested ) 2>&1 | ($LOG && tee "$BENCHMARK_NAME"-"$TIMESTAMP".log) - +exit ${PIPESTATUS[0]} # Propagate errors in the sub-shell diff --git a/tests/async_queries.c b/tests/async_queries.c index 8509b414f6e..f0b4fab870a 100644 --- a/tests/async_queries.c +++ b/tests/async_queries.c @@ -358,6 +358,7 @@ handle_option(const struct my_option *opt, const char *arg, return 0; } +PRAGMA_DISABLE_CHECK_STACK_FRAME int main(int argc, char *argv[]) @@ -433,3 +434,4 @@ main(int argc, char *argv[]) return 0; } +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c index 3f259d22917..3301fba3f75 100644 --- a/tests/mysql_client_fw.c +++ b/tests/mysql_client_fw.c @@ -569,6 +569,9 @@ static int my_process_result(MYSQL *mysql_arg) #define MAX_RES_FIELDS 50 #define MAX_FIELD_DATA_SIZE 255 +/* Stack usage 18888 with clang */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static int my_process_stmt_result(MYSQL_STMT *stmt) { int field_count; @@ -657,6 +660,7 @@ static int my_process_stmt_result(MYSQL_STMT *stmt) mysql_free_result(result); return row_count; } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* Prepare statement, execute, and process result set for given query */ @@ -1430,12 +1434,14 @@ int main(int argc, char **argv) tests_to_run[i]= NULL; } -#ifdef _WIN32 - /* must be the same in C/C and embedded, 1208 on 64bit, 968 on 32bit */ - compile_time_assert(sizeof(MYSQL) == 60*sizeof(void*)+728); -#else - /* must be the same in C/C and embedded, 1272 on 64bit, 964 on 32bit */ - compile_time_assert(sizeof(MYSQL) == 77*sizeof(void*)+656); +/* + this limited check is enough, if sizeof(MYSQL) changes, it changes + everywhere +*/ +#if defined __x86_64__ + compile_time_assert(sizeof(MYSQL) == 1272); +#elif defined __i386__ + compile_time_assert(sizeof(MYSQL) == 964); #endif if (mysql_server_init(embedded_server_arg_count, diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc index fd97b4464af..a4d6c405bdf 100644 --- a/tpool/tpool_generic.cc +++ b/tpool/tpool_generic.cc @@ -628,7 +628,7 @@ void thread_pool_generic::check_idle(std::chrono::system_clock::time_point now) } /* Switch timer off after 1 minute of idle time */ - if (now - idle_since > max_idle_time) + if (now - idle_since > max_idle_time && m_active_threads.empty()) { idle_since= invalid_timestamp; switch_timer(timer_state_t::OFF); @@ -722,13 +722,17 @@ static int throttling_interval_ms(size_t n_threads,size_t concurrency) /* Create a new worker.*/ bool thread_pool_generic::add_thread() { - if (m_thread_creation_pending.test_and_set()) - return false; - size_t n_threads = thread_count(); if (n_threads >= m_max_threads) return false; + + /* + Deadlock danger exists, so monitor pool health + with maintenance timer. + */ + switch_timer(timer_state_t::ON); + if (n_threads >= m_min_threads) { auto now = std::chrono::system_clock::now(); @@ -739,12 +743,18 @@ bool thread_pool_generic::add_thread() Throttle thread creation and wakeup deadlock detection timer, if is it off. */ - switch_timer(timer_state_t::ON); - return false; } } + /* Check and set "thread creation pending" flag before creating the thread. We + reset the flag in thread_pool_generic::worker_main in new thread created. The + flag must be reset back in case we fail to create the thread. If this flag is + not reset all future attempt to create thread for this pool would not work as + we would return from here. */ + if (m_thread_creation_pending.test_and_set()) + return false; + worker_data *thread_data = m_thread_data_cache.get(); m_active_threads.push_back(thread_data); try @@ -764,6 +774,7 @@ bool thread_pool_generic::add_thread() "current number of threads in pool %zu\n", e.what(), thread_count()); warning_written = true; } + m_thread_creation_pending.clear(); return false; } return true; @@ -801,6 +812,7 @@ thread_pool_generic::thread_pool_generic(int min_threads, int max_threads) : m_tasks_dequeued(), m_wakeups(), m_spurious_wakeups(), + m_timer_state(timer_state_t::ON), m_in_shutdown(), m_timestamp(), m_long_tasks_count(), @@ -813,6 +825,7 @@ thread_pool_generic::thread_pool_generic(int min_threads, int max_threads) : m_maintenance_timer(thread_pool_generic::maintenance_func, this, nullptr) { set_concurrency(); + // start the timer m_maintenance_timer.set_time(0, (int)m_timer_interval.count()); } diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index 4b947ab780f..9dd5e5dbd9c 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -19,7 +19,7 @@ MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl) ADD_DEFINITIONS(${SSL_DEFINES}) -INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) MY_ADD_TESTS(ma_dyncol LINK_LIBRARIES mysys) IF(WIN32) diff --git a/unittest/mysys/bitmap-t.c b/unittest/mysys/bitmap-t.c index 9fc61c6e787..8e12b2b8ca7 100644 --- a/unittest/mysys/bitmap-t.c +++ b/unittest/mysys/bitmap-t.c @@ -123,6 +123,8 @@ error6: return TRUE; } +PRAGMA_DISABLE_CHECK_STACK_FRAME + my_bool test_compare_operators(MY_BITMAP *map, uint bitsize) { uint i, j, test_bit1, test_bit2, test_bit3,test_bit4; @@ -228,6 +230,8 @@ error5: test_bit1); return TRUE; } +PRAGMA_REENABLE_CHECK_STACK_FRAME + my_bool test_count_bits_set(MY_BITMAP *map, uint bitsize) { diff --git a/unittest/mysys/crc32-t.c b/unittest/mysys/crc32-t.c index 9834d21769b..7079aeb614a 100644 --- a/unittest/mysys/crc32-t.c +++ b/unittest/mysys/crc32-t.c @@ -1,4 +1,4 @@ -/* Copyright (c) MariaDB 2020 +/* Copyright (c) MariaDB 2020, 2024 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -19,51 +19,127 @@ #include #include #include -#include /* - Check that optimized crc32 (ieee, or ethernet polynomical) returns the same - result as zlib (not so well optimized, yet, but trustworthy) + The following lookup table oriented computation of CRC-32 + is based on the Public Domain / Creative Commons CC0 Perl code from + http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/ */ -#define DO_TEST_CRC32(crc,str) \ - ok(crc32(crc,(const Bytef *)str,(uint)(sizeof(str)-1)) == my_checksum(crc, str, sizeof(str)-1), "crc32 '%s'",str) -/* Check that CRC32-C calculation returns correct result*/ -#define DO_TEST_CRC32C(crc,str,expected) \ - do { \ - unsigned int v = my_crc32c(crc, str, sizeof(str)-1); \ - printf("crc32(%u,'%s',%zu)=%u\n",crc,str,sizeof(str)-1,v); \ - ok(expected == my_crc32c(crc, str, sizeof(str)-1),"crc32c '%s'",str); \ - }while(0) +/** Lookup tables */ +static uint32 tab_3309[256], tab_castagnoli[256]; +/** Initialize a lookup table for a CRC-32 polynomial */ +static void init_lookup(uint32 *tab, uint32 polynomial) +{ + unsigned i; + for (i= 0; i < 256; i++) + { + uint32 x= i; + unsigned j; + for (j= 0; j < 8; j++) + if (x & 1) + x= (x >> 1) ^ polynomial; + else + x>>= 1; + tab[i]= x; + } +} -#define LONG_STR "1234567890234568900212345678901231213123321212123123123123123"\ - "............................................................................." \ - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ - "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" \ - "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" +/** Compute a CRC-32 one octet at a time based on a lookup table */ +static uint crc_(uint32 crc, const void *buf, size_t len, const uint32 *tab) +{ + const unsigned char *b= buf; + const unsigned char *const end = b + len; + crc^= 0xffffffff; + while (b != end) + crc= ((crc >> 8) & 0xffffff) ^ tab[(crc ^ *b++) & 0xff]; + crc^= 0xffffffff; + return crc; +} + +static uint crc32(uint32 crc, const void *buf, size_t len) +{ return crc_(crc, buf, len, tab_3309); } +static uint crc32c(uint32 crc, const void *buf, size_t len) +{ return crc_(crc, buf, len, tab_castagnoli); } + +static char buf[16384]; + +typedef uint (*check)(uint32, const void*, size_t); + +static size_t test_buf(check c1, check c2) +{ + size_t s; + for (s= sizeof buf; s; s--) + if (c1(0, buf, s) != c2(0, buf, s)) + break; + return s; +} + +#define DO_TEST_CRC32(crc,str,len) \ + ok(crc32(crc,str,len) == my_checksum(crc, str, len), \ + "crc32(%u,'%.*s')", crc, (int) len, str) + +/* Check that CRC-32C calculation returns correct result*/ +#define DO_TEST_CRC32C(crc,str,len) \ + ok(crc32c(crc,str,len) == my_crc32c(crc, str, len), \ + "crc32c(%u,'%.*s')", crc, (int) len, str) + +static const char STR[]= + "123456789012345678900212345678901231213123321212123123123123123" + "..........................................................................." + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" + "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"; int main(int argc __attribute__((unused)),char *argv[]) { MY_INIT(argv[0]); - plan(14); + init_lookup(tab_3309, 0xedb88320); + init_lookup(tab_castagnoli, 0x82f63b78); + + plan(36); printf("%s\n",my_crc32c_implementation()); - DO_TEST_CRC32(0,""); - DO_TEST_CRC32(1,""); - DO_TEST_CRC32(0,"12345"); - DO_TEST_CRC32(1,"12345"); - DO_TEST_CRC32(0,"1234567890123456789"); - DO_TEST_CRC32(0, LONG_STR); + DO_TEST_CRC32(0,STR,0); + DO_TEST_CRC32(1,STR,0); + DO_TEST_CRC32(0,STR,3); + DO_TEST_CRC32(0,STR,5); + DO_TEST_CRC32(1,STR,5); + DO_TEST_CRC32(0,STR,15); + DO_TEST_CRC32(0,STR,16); + DO_TEST_CRC32(0,STR,19); + DO_TEST_CRC32(0,STR,32); + DO_TEST_CRC32(0,STR,63); + DO_TEST_CRC32(0,STR,64); + DO_TEST_CRC32(0,STR,65); + DO_TEST_CRC32(0,STR,255); + DO_TEST_CRC32(0,STR,256); + DO_TEST_CRC32(0,STR,257); + DO_TEST_CRC32(0,STR,(sizeof(STR)-1)); ok(0 == my_checksum(0, NULL, 0) , "crc32 data = NULL, length = 0"); - DO_TEST_CRC32C(0,"", 0); - DO_TEST_CRC32C(1,"", 1); - DO_TEST_CRC32C(0, "12345", 416359221); - DO_TEST_CRC32C(1, "12345", 549473433); - DO_TEST_CRC32C(0, "1234567890123456789", 2366987449U); - DO_TEST_CRC32C(0, LONG_STR, 3009234172U); + DO_TEST_CRC32C(0,STR,0); + DO_TEST_CRC32C(1,STR,0); + DO_TEST_CRC32C(0,STR,3); + DO_TEST_CRC32C(0,STR,5); + DO_TEST_CRC32C(1,STR,5); + DO_TEST_CRC32C(0,STR,15); + DO_TEST_CRC32C(0,STR,16); + DO_TEST_CRC32C(0,STR,19); + DO_TEST_CRC32C(0,STR,32); + DO_TEST_CRC32C(0,STR,63); + DO_TEST_CRC32C(0,STR,64); + DO_TEST_CRC32C(0,STR,65); + DO_TEST_CRC32C(0,STR,255); + DO_TEST_CRC32C(0,STR,256); + DO_TEST_CRC32C(0,STR,257); + DO_TEST_CRC32C(0,STR,(sizeof(STR)-1)); ok(0 == my_crc32c(0, NULL, 0), "crc32c data = NULL, length = 0"); + memset(buf, 0x5a, sizeof buf); + ok(0 == test_buf(my_checksum, crc32), "crc32 with various lengths"); + ok(0 == test_buf(my_crc32c, crc32c), "crc32c with various lengths"); + my_end(0); return exit_status(); } diff --git a/unittest/mysys/my_getopt-t.c b/unittest/mysys/my_getopt-t.c index 6ffbfb20789..a71c4676d63 100644 --- a/unittest/mysys/my_getopt-t.c +++ b/unittest/mysys/my_getopt-t.c @@ -378,10 +378,10 @@ int main(int argc __attribute__((unused)), char **argv) "res:%d, argc:%d, opt_ull:%llu", res, arg_c, opt_ull); run("--ull=-100", NULL); - ok(res==9 && arg_c==1 && opt_ull==0ULL, + ok(res==13 && arg_c==0 && opt_ull==0ULL, "res:%d, argc:%d, opt_ull:%llu", res, arg_c, opt_ull); run("--ul=-100", NULL); - ok(res==9 && arg_c==1 && opt_ul==0UL, + ok(res==13 && arg_c==0 && opt_ul==0UL, "res:%d, argc:%d, opt_ul:%lu", res, arg_c, opt_ul); my_end(0); diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc index cc97d3b221a..c72e6b7c7e2 100644 --- a/unittest/sql/mf_iocache-t.cc +++ b/unittest/sql/mf_iocache-t.cc @@ -96,6 +96,8 @@ void sql_print_error(const char *format, ...) /*** end of encryption tweaks and stubs ****************************/ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static IO_CACHE info; #define CACHE_SIZE 16384 @@ -472,3 +474,4 @@ int main(int argc __attribute__((unused)),char *argv[]) return exit_status(); } +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index afd05745b3c..51eb076d329 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -63,7 +63,7 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server") #Miscellaneous (hidden) components, part of server / or client programs - FOREACH(comp connect-engine ClientPlugins gssapi-server gssapi-client aws-key-management rocksdb-engine) + FOREACH(comp connect-engine ClientPlugins gssapi-server gssapi-client aws-key-management rocksdb-engine plugin-hashicorp-key-management) STRING(TOUPPER "${comp}" comp) SET(CPACK_COMPONENT_${comp}_GROUP "MySQLServer") SET(CPACK_COMPONENT_${comp}_HIDDEN 1) diff --git a/wsrep-lib b/wsrep-lib index 7d108eb8706..dfc4bdb8a5d 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 7d108eb8706962abc74705bedfc60cfc3f296ea6 +Subproject commit dfc4bdb8a5dcbd6fbea007ad3beff899a6b5b7bd diff --git a/zlib/ChangeLog b/zlib/ChangeLog index 8707988ac18..b801a1031ec 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 diff --git a/zlib/FAQ b/zlib/FAQ index 55f1cdc22f6..92f5d3e29fa 100644 --- a/zlib/FAQ +++ b/zlib/FAQ @@ -14,8 +14,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? diff --git a/zlib/README b/zlib/README index e02fc5aa206..c5f917540b6 100644 --- a/zlib/README +++ b/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/zlib/contrib/nuget/nuget.csproj b/zlib/contrib/nuget/nuget.csproj new file mode 100644 index 00000000000..68627f034aa --- /dev/null +++ b/zlib/contrib/nuget/nuget.csproj @@ -0,0 +1,43 @@ + + + + net6.0 + madler.zlib.redist + $(PackageId).win + $(PackageId).linux + $(PackageId).osx + (C) 1995-2024 Jean-loup Gailly and Mark Adler + 1.3.1 + NuGet Package for consuming native builds of zlib into .NET without complexity. + + NU5128 + $(MSBuildProjectDirectory) + Jean-loup Gailly and Mark Adler + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/zlib/contrib/nuget/nuget.sln b/zlib/contrib/nuget/nuget.sln new file mode 100644 index 00000000000..46ee8deab8f --- /dev/null +++ b/zlib/contrib/nuget/nuget.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget", "nuget.csproj", "{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/zlib/contrib/vstudio/vc17/miniunz.vcxproj b/zlib/contrib/vstudio/vc17/miniunz.vcxproj new file mode 100644 index 00000000000..68ef16588b2 --- /dev/null +++ b/zlib/contrib/vstudio/vc17/miniunz.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694382A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + true + false + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/zlib/contrib/vstudio/vc17/minizip.vcxproj b/zlib/contrib/vstudio/vc17/minizip.vcxproj new file mode 100644 index 00000000000..dd3c52e70c9 --- /dev/null +++ b/zlib/contrib/vstudio/vc17/minizip.vcxproj @@ -0,0 +1,405 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + true + false + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + false + x64\$(Configuration)\ + x64\$(Configuration)\ + true + true + true + false + false + false + x64\$(Configuration)\ + x64\$(Configuration)\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/zlib/contrib/vstudio/vc17/testzlib.vcxproj b/zlib/contrib/vstudio/vc17/testzlib.vcxproj new file mode 100644 index 00000000000..4cc99b3ffe1 --- /dev/null +++ b/zlib/contrib/vstudio/vc17/testzlib.vcxproj @@ -0,0 +1,473 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} + testzlib + Win32Proj + 10.0 + + + + Application + MultiByte + true + v143 + + + Application + MultiByte + true + v143 + + + Application + Unicode + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + v143 + + + Application + v143 + + + Application + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + true + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + false + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj b/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj new file mode 100644 index 00000000000..73bba55da80 --- /dev/null +++ b/zlib/contrib/vstudio/vc17/testzlibdll.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694366A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + true + false + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/zlib/contrib/vstudio/vc17/zlib.rc b/zlib/contrib/vstudio/vc17/zlib.rc new file mode 100644 index 00000000000..a55f341c74c --- /dev/null +++ b/zlib/contrib/vstudio/vc17/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.3.1\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/zlib/contrib/vstudio/vc17/zlibstat.vcxproj b/zlib/contrib/vstudio/vc17/zlibstat.vcxproj new file mode 100644 index 00000000000..b946ac2a90f --- /dev/null +++ b/zlib/contrib/vstudio/vc17/zlibstat.vcxproj @@ -0,0 +1,602 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + 10.0 + + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + Unicode + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zlib/contrib/vstudio/vc17/zlibvc.def b/zlib/contrib/vstudio/vc17/zlibvc.def new file mode 100644 index 00000000000..53947cc31b7 --- /dev/null +++ b/zlib/contrib/vstudio/vc17/zlibvc.def @@ -0,0 +1,158 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.3.1 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/zlib/contrib/vstudio/vc17/zlibvc.sln b/zlib/contrib/vstudio/vc17/zlibvc.sln new file mode 100644 index 00000000000..67896b7470d --- /dev/null +++ b/zlib/contrib/vstudio/vc17/zlibvc.sln @@ -0,0 +1,179 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33015.44 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|ARM = ReleaseWithoutAsm|ARM + ReleaseWithoutAsm|ARM64 = ReleaseWithoutAsm|ARM64 + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.ActiveCfg = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.Build.0 = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.Build.0 = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.ActiveCfg = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.Build.0 = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.ActiveCfg = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.Build.0 = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.ActiveCfg = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.Build.0 = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.Build.0 = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.ActiveCfg = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.Build.0 = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.ActiveCfg = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.Build.0 = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAA58685-56D9-43F2-8703-FD2CB020745E} + EndGlobalSection +EndGlobal diff --git a/zlib/contrib/vstudio/vc17/zlibvc.vcxproj b/zlib/contrib/vstudio/vc17/zlibvc.vcxproj new file mode 100644 index 00000000000..10a7a901efe --- /dev/null +++ b/zlib/contrib/vstudio/vc17/zlibvc.vcxproj @@ -0,0 +1,875 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + 10.0 + + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + Unicode + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + true + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + false + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN32;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + + + + + + + + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zlib/deflate.c b/zlib/deflate.c index bd011751920..012ea8148e8 100644 --- a/zlib/deflate.c +++ b/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) { */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { diff --git a/zlib/deflate.h b/zlib/deflate.h index 8696791429f..300c6ada62b 100644 --- a/zlib/deflate.h +++ b/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ diff --git a/zlib/gzguts.h b/zlib/gzguts.h index f9375047e8c..eba72085bb7 100644 --- a/zlib/gzguts.h +++ b/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) diff --git a/zlib/gzlib.c b/zlib/gzlib.c index 29fc4486fba..983153cc8e4 100644 --- a/zlib/gzlib.c +++ b/zlib/gzlib.c @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) { #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} diff --git a/zlib/inflate.c b/zlib/inflate.c index b0757a9b249..94ecff015a9 100644 --- a/zlib/inflate.c +++ b/zlib/inflate.c @@ -1387,7 +1387,7 @@ int ZEXPORT inflateSync(z_streamp strm) { /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { diff --git a/zlib/inftrees.c b/zlib/inftrees.c index 8a208c2daa8..98cfe164458 100644 --- a/zlib/inftrees.c +++ b/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/zlib/inftrees.h b/zlib/inftrees.h index a10712d8cb5..396f74b5da7 100644 --- a/zlib/inftrees.h +++ b/zlib/inftrees.h @@ -41,8 +41,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ diff --git a/zlib/qnx/package.qpg b/zlib/qnx/package.qpg index d882af2bfb3..4877e0ef013 100644 --- a/zlib/qnx/package.qpg +++ b/zlib/qnx/package.qpg @@ -25,10 +25,10 @@ - - - - + + + + @@ -63,7 +63,7 @@ - 1.3.0 + 1.3.1 Medium Stable diff --git a/zlib/treebuild.xml b/zlib/treebuild.xml index 1d1b007707c..930b00be4a8 100644 --- a/zlib/treebuild.xml +++ b/zlib/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/zlib/trees.c b/zlib/trees.c index 8dbdc40bacc..6a523ef34e3 100644 --- a/zlib/trees.c +++ b/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ local void compress_block(deflate_state *s, const ct_data *ltree, } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; diff --git a/zlib/win32/DLL_FAQ.txt b/zlib/win32/DLL_FAQ.txt index 12c009018c3..d8cf5f31e3d 100644 --- a/zlib/win32/DLL_FAQ.txt +++ b/zlib/win32/DLL_FAQ.txt @@ -3,7 +3,7 @@ This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have +of the common DLL build of zlib, named ZLIB1.DLL. If you have general questions about zlib, you should see the file "FAQ" found in the zlib distribution, or at the following location: http://www.gzip.org/zlib/zlib_faq.html @@ -11,13 +11,9 @@ in the zlib distribution, or at the following location: 1. What is ZLIB1.DLL, and how can I get it? - - ZLIB1.DLL is the official build of zlib as a DLL. + - ZLIB1.DLL is the common build of zlib as a DLL. (Please remark the character '1' in the name.) - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.net/ - Applications that link to ZLIB1.DLL can rely on the following specification: @@ -379,18 +375,6 @@ in the zlib distribution, or at the following location: code. But you can make your own private DLL build, under a different file name, as suggested in the previous answer. - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - ** This document is written and maintained by diff --git a/zlib/win32/README-WIN32.txt b/zlib/win32/README-WIN32.txt index 384c988fa84..14e6398ef3a 100644 --- a/zlib/win32/README-WIN32.txt +++ b/zlib/win32/README-WIN32.txt @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3.0 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) @@ -16,13 +16,13 @@ is http://zlib.net/ . Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. -PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html -before asking for help. +PLEASE read DLL_FAQ.txt, and the zlib FAQ http://zlib.net/zlib_faq.html before +asking for help. Manifest: -The package zlib-1.3.0-win32-x86.zip will contain the following files: +The package zlib-1.3.1-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages diff --git a/zlib/zconf.h.cmakein b/zlib/zconf.h.cmakein index 310c43928a2..0abe3bc9d8f 100644 --- a/zlib/zconf.h.cmakein +++ b/zlib/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -302,14 +302,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/zlib/zconf.h.in b/zlib/zconf.h.in index fb76ffe312a..62adc8d8431 100644 --- a/zlib/zconf.h.in +++ b/zlib/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/zlib/zlib.3 b/zlib/zlib.3 index 4dd28967534..c716020ea9c 100644 --- a/zlib/zlib.3 +++ b/zlib/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "18 Aug 2023" +.TH ZLIB 3 "22 Jan 2024" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -105,9 +105,9 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS AND LICENSE -Version 1.3 +Version 1.3.1 .LP -Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler +Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler .LP This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/zlib/zlib.h b/zlib/zlib.h index da09785ed1d..32dc34b6670 100644 --- a/zlib/zlib.h +++ b/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ ZEXTERN int ZEXPORT inflateSync(z_streamp strm); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); diff --git a/zlib/zutil.h b/zlib/zutil.h index 902a304cc2d..48dd7febae6 100644 --- a/zlib/zutil.h +++ b/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ typedef unsigned long ulg; extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008