diff --git a/.gitignore b/.gitignore index b4c0ca40894a..5b6e5c23c2e1 100644 --- a/.gitignore +++ b/.gitignore @@ -30,14 +30,8 @@ __pycache__/ heatwaveml.* automl.egg-info/ _userconf.sh -<<<<<<< HEAD -scalability_jobs_* -||||||| ce0de82d3aa -scalability_jobs_* -======= scalability_jobs_* # Configuration files for Eclipse .cproject .project .settings/ ->>>>>>> mysql-8.0.33 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bd722d22f25..c251fd61eeb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1395,21 +1395,11 @@ IF(CMAKE_C_LINK_FLAGS MATCHES "-fuse-ld=gold" OR "-fuse-ld=gold" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") ENDIF() -<<<<<<< HEAD # Linker/binutils bug in Fedora 28, Ubuntu 16.04, Debian 8 and Debian 9, # undefined reference to symbol '__bss_start' # Fedora 34: undefined reference to symbol 'crc32_z@@ZLIB_1.2.9' IF(LINUX_FEDORA_34 OR LINUX_RHEL9 OR LINUX_DEBIAN_8 OR LINUX_DEBIAN_9) - IF(NOT CMAKE_CXX_LINK_FLAGS MATCHES "-fuse-ld=lld") -||||||| ce0de82d3aa -# Fedora 34, RHEL9: undefined reference to symbol 'crc32_z@@ZLIB_1.2.9' -IF(LINUX_FEDORA_34 OR LINUX_RHEL9) - IF(NOT CMAKE_CXX_LINK_FLAGS MATCHES "-fuse-ld=lld") -======= -# Fedora 34, RHEL9: undefined reference to symbol 'crc32_z@@ZLIB_1.2.9' -IF(LINUX_FEDORA_34 OR LINUX_RHEL9) IF(NOT USING_LD_LLD) ->>>>>>> mysql-8.0.33 STRING_APPEND(CMAKE_CXX_LINK_FLAGS " -Wl,--copy-dt-needed-entries") ENDIF() ENDIF() diff --git a/MYSQL_VERSION b/MYSQL_VERSION index 04435e74bae1..ecc0dd0b386b 100644 --- a/MYSQL_VERSION +++ b/MYSQL_VERSION @@ -1,12 +1,4 @@ MYSQL_VERSION_MAJOR=8 MYSQL_VERSION_MINOR=0 -<<<<<<< HEAD -MYSQL_VERSION_PATCH=32 -MYSQL_VERSION_EXTRA=-24 -||||||| ce0de82d3aa -MYSQL_VERSION_PATCH=32 -MYSQL_VERSION_EXTRA= -======= MYSQL_VERSION_PATCH=33 -MYSQL_VERSION_EXTRA= ->>>>>>> mysql-8.0.33 +MYSQL_VERSION_EXTRA=-25 diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index b6bf6b27d6f5..65635c6e4a61 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2920,8 +2920,8 @@ class Mysqlbinlog_event_data_istream : public Binlog_event_data_istream { return error || rewrite_db(buffer, length); } - bool start_decryption( - binary_log::Start_encryption_event *see [[maybe_unused]]) { + bool start_decryption(binary_log::Start_encryption_event *see + [[maybe_unused]]) { m_binlog_5_7_encrypted = true; return false; } diff --git a/client/mysqldump.cc b/client/mysqldump.cc index d56b933d5f2f..ad2792574442 100644 --- a/client/mysqldump.cc +++ b/client/mysqldump.cc @@ -753,7 +753,6 @@ bool is_infoschema_db(const char *db); static char *primary_key_fields(const char *table_name, const bool desc); static bool get_view_structure(char *table, char *db); static bool dump_all_views_in_db(char *database); -static bool get_gtid_mode(MYSQL *mysql_con); static int dump_all_tablespaces(); static int dump_tablespaces_for_tables(char *db, char **table_names, int tables); @@ -6279,38 +6278,6 @@ static int replace(DYNAMIC_STRING *ds_str, const char *search_str, return 0; } -/** - This function checks if GTIDs are enabled on the server. - - @param[in] mysql_con the connection to the server - - @retval true if GTIDs are enabled on the server - - @retval false if GTIDs are disabled on the server -*/ -static bool get_gtid_mode(MYSQL *mysql_con) { - MYSQL_RES *gtid_mode_res; - MYSQL_ROW gtid_mode_row; - bool gtid_mode = false; - char *gtid_mode_val = nullptr; - - if (mysql_query_with_error_report(mysql_con, >id_mode_res, - "SHOW VARIABLES LIKE 'gtid_mode'")) - return false; - - gtid_mode_row = mysql_fetch_row(gtid_mode_res); - - /* - gtid_mode_row is NULL for pre 5.6 versions. For versions >= 5.6, - get the gtid_mode value from the second column. - */ - gtid_mode_val = gtid_mode_row ? (char *)gtid_mode_row[1] : nullptr; - gtid_mode = (gtid_mode_val && strcmp(gtid_mode_val, "OFF")) ? true : false; - mysql_free_result(gtid_mode_res); - - return gtid_mode; -} - /** This function sets the session binlog in the dump file. When --set-gtid-purged is used, this function is called to @@ -6441,34 +6408,39 @@ static bool add_set_gtid_purged(MYSQL *mysql_con, bool ftwrl_done) { @param[in] mysql_con the connection to the server @param[in] ftwrl_done FLUSH TABLES WITH READ LOCK query was issued - @param[in] is_gtid_enabled true if server has gtid_mode on - @retval false successful according to the value of opt_set_gtid_purged. @retval true fail. */ -<<<<<<< HEAD static bool process_set_gtid_purged(MYSQL *mysql_con, bool ftwrl_done) { MYSQL_RES *gtid_mode_res; MYSQL_ROW gtid_mode_row; char *gtid_mode_val = nullptr; char buf[32], query[64]; -||||||| ce0de82d3aa -static bool process_set_gtid_purged(MYSQL *mysql_con) { - MYSQL_RES *gtid_mode_res; - MYSQL_ROW gtid_mode_row; - char *gtid_mode_val = nullptr; - char buf[32], query[64]; - -======= -static bool process_set_gtid_purged(MYSQL *mysql_con, bool is_gtid_enabled) { ->>>>>>> mysql-8.0.33 if (opt_set_gtid_purged_mode == SET_GTID_PURGED_OFF) return false; /* nothing to be done */ - if (is_gtid_enabled) { + /* + Check if the server has the knowledge of GTIDs(pre mysql-5.6) + or if the gtid_mode is ON or OFF. + */ + snprintf(query, sizeof(query), "SHOW VARIABLES LIKE %s", + quote_for_like("gtid_mode", buf)); + + if (mysql_query_with_error_report(mysql_con, >id_mode_res, query)) + return true; + + gtid_mode_row = mysql_fetch_row(gtid_mode_res); + + /* + gtid_mode_row is NULL for pre 5.6 versions. For versions >= 5.6, + get the gtid_mode value from the second column. + */ + gtid_mode_val = gtid_mode_row ? (char *)gtid_mode_row[1] : nullptr; + + if (gtid_mode_val && strcmp(gtid_mode_val, "OFF")) { /* For any gtid_mode !=OFF and irrespective of --set-gtid-purged being AUTO or ON, add GTID_PURGED in the output. @@ -6485,15 +6457,8 @@ static bool process_set_gtid_purged(MYSQL *mysql_con, bool is_gtid_enabled) { } set_session_binlog(false); -<<<<<<< HEAD if (add_set_gtid_purged(mysql_con, ftwrl_done)) { mysql_free_result(gtid_mode_res); -||||||| ce0de82d3aa - if (add_set_gtid_purged(mysql_con)) { - mysql_free_result(gtid_mode_res); -======= - if (add_set_gtid_purged(mysql_con)) { ->>>>>>> mysql-8.0.33 return true; } } else /* gtid_mode is off */ @@ -6501,10 +6466,12 @@ static bool process_set_gtid_purged(MYSQL *mysql_con, bool is_gtid_enabled) { if (opt_set_gtid_purged_mode == SET_GTID_PURGED_ON || opt_set_gtid_purged_mode == SET_GTID_PURGED_COMMENTED) { fprintf(stderr, "Error: Server has GTIDs disabled.\n"); + mysql_free_result(gtid_mode_res); return true; } } + mysql_free_result(gtid_mode_res); return false; } @@ -6858,8 +6825,6 @@ static int execute_sql_file(const char *sql_file) { #endif // NDEBUG int main(int argc, char **argv) { - bool server_with_gtids_and_opt_purge_not_off = false; - bool server_has_gtid_enabled = false; char bin_log_name[FN_REFLEN]; int exit_code, md_result_fd = 0; bool has_consistent_binlog_pos = false; @@ -6911,7 +6876,6 @@ int main(int argc, char **argv) { if (opt_slave_data && do_stop_slave_sql(mysql)) goto err; -<<<<<<< HEAD if (opt_single_transaction && opt_master_data) { /* See if we can avoid FLUSH TABLES WITH READ LOCK with Binlog_snapshot_* @@ -6947,39 +6911,14 @@ int main(int argc, char **argv) { if (do_flush_tables_read_lock(mysql)) goto err; ftwrl_done = true; } else if (opt_lock_for_backup && do_lock_tables_for_backup(mysql)) -||||||| ce0de82d3aa - if ((opt_lock_all_tables || opt_master_data || opt_single_transaction) && - do_flush_tables_read_lock(mysql)) -======= - server_has_gtid_enabled = get_gtid_mode(mysql); - - server_with_gtids_and_opt_purge_not_off = - (server_has_gtid_enabled && - (opt_set_gtid_purged_mode != SET_GTID_PURGED_OFF)); - - if ((opt_lock_all_tables || opt_master_data || - (opt_single_transaction && - (flush_logs || server_with_gtids_and_opt_purge_not_off))) && - do_flush_tables_read_lock(mysql)) ->>>>>>> mysql-8.0.33 goto err; /* Flush logs before starting transaction since this causes implicit commit starting mysql-5.5. */ -<<<<<<< HEAD if (opt_lock_all_tables || opt_master_data || (opt_single_transaction && flush_logs) || opt_delete_master_logs) { -||||||| ce0de82d3aa - if (opt_lock_all_tables || opt_master_data || opt_single_transaction || - opt_delete_master_logs) { -======= - if (opt_lock_all_tables || opt_master_data || - (opt_single_transaction && - (flush_logs || server_with_gtids_and_opt_purge_not_off)) || - opt_delete_master_logs) { ->>>>>>> mysql-8.0.33 if (flush_logs || opt_delete_master_logs) { if (mysql_refresh(mysql, REFRESH_LOG)) { DB_error(mysql, "when doing refresh"); @@ -7008,13 +6947,7 @@ int main(int argc, char **argv) { /* Process opt_set_gtid_purged and add SET @@GLOBAL.GTID_PURGED if required. */ -<<<<<<< HEAD if (process_set_gtid_purged(mysql, ftwrl_done)) goto err; -||||||| ce0de82d3aa - if (process_set_gtid_purged(mysql)) goto err; -======= - if (process_set_gtid_purged(mysql, server_has_gtid_enabled)) goto err; ->>>>>>> mysql-8.0.33 if (opt_master_data && do_show_master_status(mysql, has_consistent_binlog_pos)) diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake index 08129f8f2a99..8ed2d9fa4b68 100644 --- a/cmake/do_abi_check.cmake +++ b/cmake/do_abi_check.cmake @@ -123,11 +123,5 @@ FOREACH(file ${ABI_HEADERS}) "ABI check found difference between ${file}.pp and ${abi_check_out}, " "compilation error file can be found here: ${errorfile}") ENDIF() -<<<<<<< HEAD FILE(REMOVE ${errorfile}) - FILE(REMOVE ${abi_check_out}) -||||||| ce0de82d3aa - FILE(REMOVE ${abi_check_out}) -======= ->>>>>>> mysql-8.0.33 ENDFOREACH() diff --git a/cmake/lz4.cmake b/cmake/lz4.cmake index 35629aa06127..7df3f2e1677a 100644 --- a/cmake/lz4.cmake +++ b/cmake/lz4.cmake @@ -23,15 +23,9 @@ # cmake -DWITH_LZ4=system|bundled # bundled is the default -<<<<<<< HEAD SET(LIBLZ4_VERSION_REQUIRED "1.9.3") -MACRO(FIND_LZ4_VERSION) -||||||| ce0de82d3aa -MACRO(FIND_LZ4_VERSION) -======= FUNCTION(FIND_LZ4_VERSION LZ4_INCLUDE_DIR) ->>>>>>> mysql-8.0.33 FOREACH(version_part LZ4_VERSION_MAJOR LZ4_VERSION_MINOR @@ -47,20 +41,11 @@ FUNCTION(FIND_LZ4_VERSION LZ4_INCLUDE_DIR) "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}") MESSAGE(STATUS "LZ4_VERSION (${WITH_LZ4}) is ${LZ4_VERSION}") MESSAGE(STATUS "LZ4_INCLUDE_DIR ${LZ4_INCLUDE_DIR}") -<<<<<<< HEAD - MESSAGE(STATUS "LZ4_LIBRARY ${LZ4_LIBRARY}") IF (${LZ4_VERSION} VERSION_LESS ${LIBLZ4_VERSION_REQUIRED}) MESSAGE(FATAL_ERROR "Required liblz4 ${LIBLZ4_VERSION_REQUIRED} and installed version is ${LZ4_VERSION}") ENDIF() -ENDMACRO() -||||||| ce0de82d3aa - MESSAGE(STATUS "LZ4_LIBRARY ${LZ4_LIBRARY}") -ENDMACRO() -======= ENDFUNCTION(FIND_LZ4_VERSION) ->>>>>>> mysql-8.0.33 - FUNCTION(FIND_SYSTEM_LZ4) FIND_PATH(LZ4_INCLUDE_DIR diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 25f08eb0f5db..7415abfeb947 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -1,13 +1,5 @@ -<<<<<<< HEAD -# Copyright (c) 2009, 2022, Oracle and/or its affiliates. -# -||||||| ce0de82d3aa -# Copyright (c) 2009, 2022, Oracle and/or its affiliates. -# -======= # Copyright (c) 2009, 2023, Oracle and/or its affiliates. -# ->>>>>>> mysql-8.0.33 +# # 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. diff --git a/cmake/zstd.cmake b/cmake/zstd.cmake index 2a8f6621bc54..d07a3a97e4da 100644 --- a/cmake/zstd.cmake +++ b/cmake/zstd.cmake @@ -80,15 +80,7 @@ FUNCTION(MYSQL_USE_BUNDLED_ZSTD) FIND_ZSTD_VERSION(${BUNDLED_ZSTD_PATH}) ADD_SUBDIRECTORY(extra/zstd) -<<<<<<< HEAD - # The following flag is still used by RocksDB - SET(BUILD_BUNDLED_ZSTD 1) -ENDMACRO() -||||||| ce0de82d3aa -ENDMACRO() -======= ENDFUNCTION(MYSQL_USE_BUNDLED_ZSTD) ->>>>>>> mysql-8.0.33 MACRO (MYSQL_CHECK_ZSTD) IF(NOT WITH_ZSTD) diff --git a/include/my_alloc.h b/include/my_alloc.h index 8f1e306965c9..1463bb842d27 100644 --- a/include/my_alloc.h +++ b/include/my_alloc.h @@ -32,6 +32,7 @@ #include +#include #include #include #include diff --git a/include/my_sys.h b/include/my_sys.h index 8a626bcc565c..c729ba8d5374 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,11 +1,5 @@ -<<<<<<< HEAD -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. - Copyright (c) 2018, Percona and/or its affiliates. -||||||| ce0de82d3aa -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= /* Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2018, Percona and/or its affiliates. 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, diff --git a/include/mysql/components/services/psi_thread_service.h b/include/mysql/components/services/psi_thread_service.h index fa7b247305e6..17f4ef43ff7a 100644 --- a/include/mysql/components/services/psi_thread_service.h +++ b/include/mysql/components/services/psi_thread_service.h @@ -339,6 +339,12 @@ set_thread_command_v1_t set_thread_command; set_connection_type_v1_t set_connection_type; /** @sa set_thread_start_time_v1_t. */ set_thread_start_time_v1_t set_thread_start_time; +/** @sa set_thread_start_time_usec_v4_t. */ +set_thread_start_time_usec_v4_t set_thread_start_time_usec; +/** @sa set_thread_rows_sent_v4_t. */ +set_thread_rows_sent_v4_t set_thread_rows_sent; +/** @sa set_thread_rows_examined_v4_t. */ +set_thread_rows_examined_v4_t set_thread_rows_examined; /** @sa set_thread_info_v1_t. */ set_thread_info_v1_t set_thread_info; /** @sa set_thread_secondary_engine_v6_t. */ diff --git a/include/mysql/innodb_priv.h b/include/mysql/innodb_priv.h deleted file mode 100644 index a71099c09d8d..000000000000 --- a/include/mysql/innodb_priv.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2010, 2022, Oracle and/or its affiliates. - - 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 */ - -#ifndef INNODB_PRIV_INCLUDED -#define INNODB_PRIV_INCLUDED - -/** - @file include/mysql/innodb_priv.h - Declaring server-internal functions that are used by InnoDB. -*/ - -class THD; -struct MYSQL_TIME; - -int get_quote_char_for_identifier(THD *thd, const char *name, size_t length); -bool schema_table_store_record(THD *thd, TABLE *table); -void localtime_to_TIME(MYSQL_TIME *to, struct tm *from); -bool check_global_access(THD *thd, ulong want_access); -size_t strconvert(CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, - char *to, size_t to_length, uint *errors); -// void sql_print_error(const char *format, ...); - -/** - Store record to I_S table, convert HEAP table to InnoDB table if necessary. - - @param[in] thd thread handler - @param[in] table Information schema table to be updated - @param[in] make_ondisk if true, convert heap table to on disk table. - default value is true. - @return 0 on success - @return error code on failure. -*/ -int schema_table_store_record2(THD *thd, TABLE *table, bool make_ondisk); - -/** - Convert HEAP table to InnoDB table if necessary - - @param[in] thd thread handler - @param[in] table Information schema table to be converted. - @param[in] error the error code returned previously. - @return false on success, true on error. -*/ -bool convert_heap_table_to_ondisk(THD *thd, TABLE *table, int error); - -#endif /* INNODB_PRIV_INCLUDED */ diff --git a/include/mysql/psi/psi_abi_thread_v1.h.pp b/include/mysql/psi/psi_abi_thread_v1.h.pp index dcb03b766e90..43875b7789b0 100644 --- a/include/mysql/psi/psi_abi_thread_v1.h.pp +++ b/include/mysql/psi/psi_abi_thread_v1.h.pp @@ -311,6 +311,9 @@ set_thread_command_v1_t set_thread_command; set_connection_type_v1_t set_connection_type; set_thread_start_time_v1_t set_thread_start_time; + set_thread_start_time_usec_v4_t set_thread_start_time_usec; + set_thread_rows_sent_v4_t set_thread_rows_sent; + set_thread_rows_examined_v4_t set_thread_rows_examined; set_thread_info_v1_t set_thread_info; set_thread_secondary_engine_v6_t set_thread_secondary_engine; set_thread_resource_group_v1_t set_thread_resource_group; diff --git a/include/mysql/psi/psi_thread.h b/include/mysql/psi/psi_thread.h index 854b101ec8ee..9bfa3275ffe3 100644 --- a/include/mysql/psi/psi_thread.h +++ b/include/mysql/psi/psi_thread.h @@ -419,6 +419,12 @@ struct PSI_thread_service_v7 { set_connection_type_v1_t set_connection_type; /** @sa set_thread_start_time_v1_t. */ set_thread_start_time_v1_t set_thread_start_time; + /** @sa set_thread_start_time_usec_v4_t. */ + set_thread_start_time_usec_v4_t set_thread_start_time_usec; + /** @sa set_thread_rows_sent_v4_t. */ + set_thread_rows_sent_v4_t set_thread_rows_sent; + /** @sa set_thread_rows_examined_v4_t. */ + set_thread_rows_examined_v4_t set_thread_rows_examined; /** @sa set_thread_info_v1_t. */ set_thread_info_v1_t set_thread_info; /** @sa set_thread_secondary_engine_v6_t. */ diff --git a/include/mysql_com_server.h b/include/mysql_com_server.h index 01f3451d75a0..0ab682de618c 100644 --- a/include/mysql_com_server.h +++ b/include/mysql_com_server.h @@ -74,7 +74,6 @@ inline void net_server_ext_init(NET_SERVER *ns) { ns->m_after_header = nullptr; ns->compress_ctx.algorithm = MYSQL_UNCOMPRESSED; ns->timeout_on_full_packet = false; - ns->max_interval_packet = 0; } #endif diff --git a/libbinlogevents/include/debug_vars.h b/libbinlogevents/include/debug_vars.h index 77c916d57670..dc867a4324c0 100644 --- a/libbinlogevents/include/debug_vars.h +++ b/libbinlogevents/include/debug_vars.h @@ -35,14 +35,8 @@ namespace binary_log_debug { extern bool debug_checksum_test; extern bool debug_query_mts_corrupt_db_names; extern bool debug_simulate_invalid_address; -<<<<<<< HEAD -extern bool debug_pretend_version_50034_in_binlog; extern bool debug_expect_unknown_event; -||||||| ce0de82d3aa -extern bool debug_pretend_version_50034_in_binlog; -======= ->>>>>>> mysql-8.0.33 // TODO(WL#7546):Add variables here as we move methods into libbinlogevent // from the server while implementing the WL#7546(Moving binlog event // encoding into a separate package) diff --git a/libbinlogevents/src/binlog_event.cpp b/libbinlogevents/src/binlog_event.cpp index fcc17219f641..cb15eec0f274 100644 --- a/libbinlogevents/src/binlog_event.cpp +++ b/libbinlogevents/src/binlog_event.cpp @@ -35,14 +35,7 @@ namespace binary_log_debug { bool debug_query_mts_corrupt_db_names = false; bool debug_checksum_test = false; bool debug_simulate_invalid_address = false; -<<<<<<< HEAD -bool debug_pretend_version_50034_in_binlog = false; bool debug_expect_unknown_event = false; -||||||| ce0de82d3aa -bool debug_pretend_version_50034_in_binlog = false; -======= - ->>>>>>> mysql-8.0.33 } // namespace binary_log_debug namespace binary_log { diff --git a/libbinlogevents/src/compression/zstd_comp.cpp b/libbinlogevents/src/compression/zstd_comp.cpp index 5e45d7f55475..b8759bcd405d 100644 --- a/libbinlogevents/src/compression/zstd_comp.cpp +++ b/libbinlogevents/src/compression/zstd_comp.cpp @@ -162,172 +162,6 @@ bool Zstd_comp::expand_buffer(size_t const &extra_bytes) { return false; } -<<<<<<< HEAD:libbinlogevents/src/compression/zstd.cpp -/* - **************************************************************** - Decompressor - **************************************************************** - */ - -Zstd_dec::Zstd_dec() : m_ctx(nullptr) { - // create the stream context - m_ctx = ZSTD_createDStream(); - if (m_ctx != nullptr) { - size_t ret = ZSTD_initDStream(m_ctx); - if (ZSTD_isError(ret)) { - ZSTD_freeDStream(m_ctx); - m_ctx = nullptr; - } - } -} - -Zstd_dec::~Zstd_dec() { - if (m_ctx != nullptr) ZSTD_freeDStream(m_ctx); -} - -type Zstd_dec::compression_type_code() { return ALGORITHM_ZSTD; } - -bool Zstd_dec::open() { - size_t ret{0}; - if (m_ctx == nullptr) return true; - /* - The advanced compression API used below as declared stable in - 1.4.0. - - The advanced API allows reusing the same context instead of - creating a new one every time we open the compressor. This - is useful within the binary log compression. - */ -#if ZSTD_VERSION_NUMBER >= 10400 - /** Reset session only. Dictionary will remain. */ - ret = ZSTD_DCtx_reset(m_ctx, ZSTD_reset_session_only); -#else - ret = ZSTD_initDStream(m_ctx); -#endif - - return ZSTD_isError(ret); -} - -bool Zstd_dec::close() { - if (m_ctx == nullptr) return true; - return false; -} - -std::tuple Zstd_dec::decompress(const unsigned char *in, - size_t in_size) { - ZSTD_outBuffer obuf{m_buffer, capacity(), size()}; - ZSTD_inBuffer ibuf{in, in_size, 0}; - std::size_t ret{0}; - auto err{false}; - - do { - auto min_buffer_len{ZSTD_DStreamOutSize()}; - - // make sure that we have buffer space to hold the results - if ((err = reserve(min_buffer_len))) break; - - // update the obuf buffer pointer and offset - obuf.dst = m_buffer; - obuf.size = capacity(); - - // decompress - ret = ZSTD_decompressStream(m_ctx, &obuf, &ibuf); - - // update the cursor - m_buffer_cursor = m_buffer + obuf.pos; - - // error handling - if ((err = ZSTD_isError(ret))) break; - - } while (obuf.size == obuf.pos); - - return std::make_tuple((ibuf.size - ibuf.pos), err); -} - -||||||| ce0de82d3aa:libbinlogevents/src/compression/zstd.cpp -/* - **************************************************************** - Decompressor - **************************************************************** - */ - -Zstd_dec::Zstd_dec() : m_ctx(nullptr) { - // create the stream context - m_ctx = ZSTD_createDStream(); - if (m_ctx != nullptr) { - size_t ret = ZSTD_initDStream(m_ctx); - if (ZSTD_isError(ret)) { - ZSTD_freeDStream(m_ctx); - m_ctx = nullptr; - } - } -} - -Zstd_dec::~Zstd_dec() { - if (m_ctx != nullptr) ZSTD_freeDStream(m_ctx); -} - -type Zstd_dec::compression_type_code() { return ZSTD; } - -bool Zstd_dec::open() { - size_t ret{0}; - if (m_ctx == nullptr) return true; - /* - The advanced compression API used below as declared stable in - 1.4.0. - - The advanced API allows reusing the same context instead of - creating a new one every time we open the compressor. This - is useful within the binary log compression. - */ -#if ZSTD_VERSION_NUMBER >= 10400 - /** Reset session only. Dictionary will remain. */ - ret = ZSTD_DCtx_reset(m_ctx, ZSTD_reset_session_only); -#else - ret = ZSTD_initDStream(m_ctx); -#endif - - return ZSTD_isError(ret); -} - -bool Zstd_dec::close() { - if (m_ctx == nullptr) return true; - return false; -} - -std::tuple Zstd_dec::decompress(const unsigned char *in, - size_t in_size) { - ZSTD_outBuffer obuf{m_buffer, capacity(), size()}; - ZSTD_inBuffer ibuf{in, in_size, 0}; - std::size_t ret{0}; - auto err{false}; - - do { - auto min_buffer_len{ZSTD_DStreamOutSize()}; - - // make sure that we have buffer space to hold the results - if ((err = reserve(min_buffer_len))) break; - - // update the obuf buffer pointer and offset - obuf.dst = m_buffer; - obuf.size = capacity(); - - // decompress - ret = ZSTD_decompressStream(m_ctx, &obuf, &ibuf); - - // update the cursor - m_buffer_cursor = m_buffer + obuf.pos; - - // error handling - if ((err = ZSTD_isError(ret))) break; - - } while (obuf.size == obuf.pos); - - return std::make_tuple((ibuf.size - ibuf.pos), err); -} - -======= ->>>>>>> mysql-8.0.33:libbinlogevents/src/compression/zstd_comp.cpp } // namespace compression } // namespace transaction } // namespace binary_log diff --git a/libbinlogevents/src/compression/zstd_dec.cpp b/libbinlogevents/src/compression/zstd_dec.cpp index 4b55e57f79d1..7f09b432c79d 100644 --- a/libbinlogevents/src/compression/zstd_dec.cpp +++ b/libbinlogevents/src/compression/zstd_dec.cpp @@ -45,7 +45,7 @@ Zstd_dec::~Zstd_dec() { if (m_ctx != nullptr) ZSTD_freeDStream(m_ctx); } -type Zstd_dec::compression_type_code() { return ZSTD; } +type Zstd_dec::compression_type_code() { return ALGORITHM_ZSTD; } bool Zstd_dec::open() { size_t ret{0}; diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1 index 9cf71f39e30c..6495ceda54e9 100644 --- a/man/mysqldumpslow.1 +++ b/man/mysqldumpslow.1 @@ -4,7 +4,7 @@ .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 03/03/2023 .\" Manual: MySQL Database System -.\" Source: MySQL 5.7 +.\" Source: MySQL 8.0 .\" Language: English .\" .TH "MYSQLDUMPSLOW" "1" "03/03/2023" "MySQL 8\&.0" "MySQL Database System" @@ -42,15 +42,9 @@ from \fBPercona Toolkit\fR instead (https://www.percona.com/doc/percona-toolkit/ .SH "COPYRIGHT" .br .PP -<<<<<<< HEAD -Copyright \(co 1997, 2022, Oracle and/or its affiliates. +Copyright \(co 1997, 2023, Oracle and/or its affiliates. .br Copyright \(co 2016, Percona Inc. -||||||| ce0de82d3aa -Copyright \(co 1997, 2022, Oracle and/or its affiliates. -======= -Copyright \(co 1997, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/mysql-test/collections/disabled.def b/mysql-test/collections/disabled.def index 1082a57bac0b..52d5bfcca097 100644 --- a/mysql-test/collections/disabled.def +++ b/mysql-test/collections/disabled.def @@ -42,15 +42,12 @@ innodb.slow_shutdown : Bug#31763837 mtr hits this d innodb.upgrade_fts_aux : Bug#33034679 Test needs an upgrade of its 5.7 data files innodb.instant_ddl_recovery_old : WL#12527 Redo format has changed - crashed_datadir.zip needs to be recreated. innodb.log_logical_size : WL#12527 Test is shaky - needs to be fixed. -<<<<<<< HEAD -# innodb_fts suite test -innodb_fts.sync_block : BUG#2232 percona https://jira.percona.com/browse/PS-2232 -||||||| ce0de82d3aa -======= innodb.doublewrite_on_to_reduced : Bug#35087987 Mtr test doublewrite_on_to_reduced hangs innodb.doublewrite_reduced : Bug#35087987 Mtr test doublewrite_on_to_reduced hangs innodb.doublewrite_reduced_odirect : Bug#35087987 Mtr test doublewrite_on_to_reduced hangs ->>>>>>> mysql-8.0.33 + +# innodb_fts suite test +innodb_fts.sync_block : BUG#2232 percona https://jira.percona.com/browse/PS-2232 # keyring tests keyring_encrypted_file.keyring_migration_bugs @darwin : Bug#31041633 diff --git a/mysql-test/extra/rpl_tests/rpl_multi_source_corrupt_repository.inc b/mysql-test/extra/rpl_tests/rpl_multi_source_corrupt_repository.inc index eb1b95d67c4e..fbe39abba8cb 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_source_corrupt_repository.inc +++ b/mysql-test/extra/rpl_tests/rpl_multi_source_corrupt_repository.inc @@ -202,29 +202,13 @@ SELECT SOURCE_POS_WAIT('server1-bin.000001', 120, 5); SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('01010101-0101-0101-0101-010101010101:1', 1); ############################################################################### -<<<<<<< HEAD # Step-3.6: CHANGE REPLICATION SOURCE TO without 'FOR CHANNEL' clause when we # have multiple channels, should throw error -# ER_SLAVE_MULTIPLE_CHANNELS_CMD. -||||||| ce0de82d3aa -# Step-3.6: CHANGE MASTER TO without 'FOR CHANNEL' clause when we have multiple -# channels, should throw error ER_SLAVE_MULTIPLE_CHANNELS_CMD. -======= -# Step-3.6: CHANGE MASTER TO without 'FOR CHANNEL' clause when we have multiple -# channels, should throw error ER_REPLICA_MULTIPLE_CHANNELS_CMD. ->>>>>>> mysql-8.0.33 +# ER_REPLICA_MULTIPLE_CHANNELS_CMD. ############################################################################### -<<<<<<< HEAD --echo ===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. ---error ER_SLAVE_MULTIPLE_CHANNELS_CMD -||||||| ce0de82d3aa ---echo ===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. ---error ER_SLAVE_MULTIPLE_CHANNELS_CMD -======= ---echo ===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. --error ER_REPLICA_MULTIPLE_CHANNELS_CMD ->>>>>>> mysql-8.0.33 CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD=10, SOURCE_CONNECT_RETRY=10, SOURCE_RETRY_COUNT=10; ############################################################################### diff --git a/mysql-test/extra/rpl_tests/rpl_parallel_load_tokudb.test b/mysql-test/extra/rpl_tests/rpl_parallel_load_tokudb.test index ca30e63607a8..fa2cbe8478ab 100644 --- a/mysql-test/extra/rpl_tests/rpl_parallel_load_tokudb.test +++ b/mysql-test/extra/rpl_tests/rpl_parallel_load_tokudb.test @@ -37,7 +37,7 @@ let $databases = 16; connection slave; --source include/only_mts_replica_parallel_workers.inc -call mtr.add_suppression('Slave: Error dropping database'); ## todo: fix +call mtr.add_suppression('Replica: Error dropping database'); ## todo: fix source include/stop_slave.inc; start replica; diff --git a/mysql-test/include/plugin.defs b/mysql-test/include/plugin.defs index e8547b5aa85d..9cdc794c5e9b 100644 --- a/mysql-test/include/plugin.defs +++ b/mysql-test/include/plugin.defs @@ -178,7 +178,12 @@ test_services_command_services plugin_output_directory no TEST_SERVICES_CO # component test_status_var_reader component_test_status_var_reader plugin_output_directory no TEST_STATUS_VAR_READER -<<<<<<< HEAD + +# component test_server_telemetry_traces +component_test_server_telemetry_traces plugin_output_directory no TEST_SERVER_TELEMETRY_TRACES_COMPONENT + +# component_test_mysql_thd_store_service +component_test_mysql_thd_store_service plugin_output_directory no COMPONENT_TEST_MYSQL_THD_STORE_SERVICE # Percona additions auth_socket plugin_output_directory no SOCKET_AUTH @@ -195,12 +200,3 @@ test_udf_wrappers plugin_output_directory no TEST_UDF_WRAPPERS_LIB binlog_utils_udf plugin_output_directory no BINLOG_UTILS_UDF_LIB procfs plugin_output_directory no PROCFS_PLUGIN procfs component_encryption_udf plugin_output_directory no ENCRYPTION_UDF_COMPONENT -||||||| ce0de82d3aa -======= - -# component test_server_telemetry_traces -component_test_server_telemetry_traces plugin_output_directory no TEST_SERVER_TELEMETRY_TRACES_COMPONENT - -# component_test_mysql_thd_store_service -component_test_mysql_thd_store_service plugin_output_directory no COMPONENT_TEST_MYSQL_THD_STORE_SERVICE ->>>>>>> mysql-8.0.33 diff --git a/mysql-test/r/information_schema_cs.result b/mysql-test/r/information_schema_cs.result index 10da01c18e66..2c5bc1e062ca 100644 --- a/mysql-test/r/information_schema_cs.result +++ b/mysql-test/r/information_schema_cs.result @@ -916,7 +916,7 @@ table_schema IN ('mysql', 'information_schema', 'test', 'mysqltest') AND table_name not like 'ndb%' AND table_name COLLATE utf8_general_ci not like 'innodb_%' GROUP BY TABLE_SCHEMA; TABLE_SCHEMA count(*) -information_schema 57 +information_schema 55 mysql 35 create table t1 (i int, j int); create trigger trg1 before insert on t1 for each row diff --git a/mysql-test/r/mysqldump_single_trans_min_privs.result b/mysql-test/r/mysqldump_single_trans_min_privs.result deleted file mode 100644 index 84d1454c64d1..000000000000 --- a/mysql-test/r/mysqldump_single_trans_min_privs.result +++ /dev/null @@ -1,42 +0,0 @@ -# Create the test database -CREATE DATABASE bug_test; -USE bug_test; -# Create the test table -CREATE TABLE bug(n INT); -# Enter random data which could be dumped -INSERT INTO bug VALUES(10); -INSERT INTO bug VALUES(20); -INSERT INTO bug VALUES(30); -# Create the test user -CREATE USER test@localhost; -# Grant only SELECT privilege on the test database -GRANT SELECT ON bug_test.* TO test@localhost; -SHOW GRANTS FOR test@localhost; -Grants for test@localhost -GRANT USAGE ON *.* TO `test`@`localhost` -GRANT SELECT ON `bug_test`.* TO `test`@`localhost` -# Create the dump file -# Start the dump tests -# ----- Test 1 ----- -# GTID enabled on the server, --set-gtid-purged is set to it's default value (AUTO). -# Should fail because of insufficient privileges. -# Start the dump -# ----- Test 1 succeeded ----- -# ----- Test 2 ----- -# GTID enabled on the server, --set-gtid-purged is set to OFF -# Should succeed -# ----- Test 2 succeeded ----- -# ----- Test 3 ----- -# Increase the privileges of test user by granting RELOAD privilege -GRANT RELOAD ON *.* TO test@localhost; -SHOW GRANTS FOR test@localhost; -Grants for test@localhost -GRANT RELOAD ON *.* TO `test`@`localhost` -GRANT SELECT ON `bug_test`.* TO `test`@`localhost` -# Start the dump with --set-gtid-purged=ON -# Should succeed -# ----- Test 3 succeeded ----- -# ----- End of tests ----- -DROP USER test@localhost; -DROP DATABASE bug_test; -RESET MASTER; diff --git a/mysql-test/r/server_offline_7.test b/mysql-test/r/server_offline_7.test deleted file mode 100644 index c38a4032e66b..000000000000 --- a/mysql-test/r/server_offline_7.test +++ /dev/null @@ -1,75 +0,0 @@ -# -# WL#3836: Method to bring servers off line -# -SET @global_saved_tmp = @@global.offline_mode; -CREATE DATABASE wl3836; -USE wl3836; -# Should report 1 -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836'; -COUNT(USER) -1 -CREATE USER 'user1'@'localhost'; -CREATE USER 'user2'@'localhost'; -GRANT ALL ON wl3836.* TO 'user1'@'localhost', 'user2'@'localhost'; -SET GLOBAL offline_mode=ON; -ERROR 42000: Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation -CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MYISAM; -CREATE TABLE t2 (id INT UNSIGNED NOT NULL); -INSERT INTO t1 VALUES -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0), -(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0); -INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032; -INSERT INTO t2 SELECT id FROM t1; -SELECT id FROM t1 WHERE id IN -(SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d -GROUP BY ACOS(1/a.id), b.id, c.id, d.id -HAVING a.id BETWEEN 10 AND 20); -# Should report 3 -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836'; -COUNT(USER) -3 -SET GLOBAL offline_mode = ON; -# Should report 1 -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836'; -COUNT(USER) -1 -# Root user should be allowed to connect -# Should report 2 -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836'; -COUNT(USER) -2 -SET GLOBAL offline_mode=OFF; -DROP DATABASE wl3836; -DROP USER 'user1'@'localhost'; -DROP USER 'user2'@'localhost'; -# Test for replication slave threads -include/master-slave.inc -Warnings: -Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. -[connection master] -# Should report 7 root processes -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST; -COUNT(USER) -8 -SET GLOBAL offline_mode=ON; -# Should report 7 root processes -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST; -COUNT(USER) -8 -SET @slave_saved_tmp = @@global.offline_mode; -# Should report 6 root processes -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST; -COUNT(USER) -7 -SET GLOBAL offline_mode=ON; -# Should report 6 root processes -SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST; -COUNT(USER) -7 -SET GLOBAL offline_mode = @slave_saved_tmp; -include/rpl_end.inc -# Restoring the original values. -SET @@global.offline_mode = @global_saved_tmp; diff --git a/mysql-test/suite/component_keyring_file/r/mysqldump.result b/mysql-test/suite/component_keyring_file/r/mysqldump.result index d7209284f580..dfe05a1229cb 100644 --- a/mysql-test/suite/component_keyring_file/r/mysqldump.result +++ b/mysql-test/suite/component_keyring_file/r/mysqldump.result @@ -39,7 +39,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -80,7 +80,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, @@ -144,7 +144,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -185,7 +185,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, @@ -250,7 +250,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -270,7 +270,7 @@ SHOW CREATE TABLE db1.i_ts3; Table Create Table i_ts3 CREATE TABLE `i_ts3` ( `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ +) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i_ts4; Table Create Table i_ts4 CREATE TABLE `i_ts4` ( @@ -291,7 +291,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, diff --git a/mysql-test/suite/encryption/r/mysqldump.result b/mysql-test/suite/encryption/r/mysqldump.result index 5b77294e87f1..153b9b517524 100644 --- a/mysql-test/suite/encryption/r/mysqldump.result +++ b/mysql-test/suite/encryption/r/mysqldump.result @@ -33,7 +33,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -74,7 +74,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, @@ -138,7 +138,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -179,7 +179,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, @@ -244,7 +244,7 @@ SHOW CREATE TABLE db1.i2; Table Create Table i2 CREATE TABLE `i2` ( `f1` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i3; Table Create Table i3 CREATE TABLE `i3` ( @@ -264,7 +264,7 @@ SHOW CREATE TABLE db1.i_ts3; Table Create Table i_ts3 CREATE TABLE `i_ts3` ( `f1` int DEFAULT NULL -) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!80016 ENCRYPTION='y' */ +) /*!50100 TABLESPACE `ts3` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SHOW CREATE TABLE db1.i_ts4; Table Create Table i_ts4 CREATE TABLE `i_ts4` ( @@ -285,7 +285,7 @@ Table Create Table i_part2 CREATE TABLE `i_part2` ( `id` int DEFAULT NULL, `name` varchar(50) DEFAULT NULL -) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ENCRYPTION='y' +) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci /*!50100 PARTITION BY RANGE (`id`) (PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (20) ENGINE = InnoDB, diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result index 9546acc2faad..986045198f23 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result @@ -214,6 +214,7 @@ SHOW/SELECT shows all processes/threads. SHOW GRANTS; Grants for @localhost GRANT PROCESS ON *.* TO ``@`localhost` +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `test`.* TO ``@`localhost` SHOW processlist; Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined ID HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED @@ -264,6 +265,7 @@ Again only the processes of the anonymous user are visible. SHOW GRANTS FOR ''@'localhost'; Grants for @localhost GRANT USAGE ON *.* TO ``@`localhost` +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `test`.* TO ``@`localhost` SELECT * FROM information_schema.processlist; ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED ID HOST_NAME information_schema Query TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result index 48e3a9b66607..6f87add2f1ba 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result @@ -31,34 +31,31 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `COMMAND` varchar(16) NOT NULL DEFAULT '', `TIME` int NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext, - `TIME_MS` bigint NOT NULL DEFAULT '0', - `ROWS_SENT` bigint unsigned NOT NULL DEFAULT '0', - `ROWS_EXAMINED` bigint unsigned NOT NULL DEFAULT '0' + `INFO` longtext ) ENGINE=TMP_TABLE_ENGINE DEFAULT CHARSET=utf8mb3 SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Query TIME STATE SHOW processlist SELECT * FROM processlist ORDER BY id; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Execute TIME executing SELECT * FROM processlist ORDER BY id TIME_MS ROWS_SENT ROWS_EXAMINED -SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED FROM processlist ORDER BY id; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Execute TIME executing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED FROM processlist ORDER BY id TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Execute TIME executing SELECT * FROM processlist ORDER BY id +SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id; +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Execute TIME executing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist; UPDATE test.t_processlist SET user='horst' WHERE id=1 ; INSERT INTO processlist SELECT * FROM test.t_processlist; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' DROP TABLE test.t_processlist; -CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED) AS SELECT * FROM processlist WITH CHECK OPTION; +CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION; ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist' -CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED) AS SELECT * FROM processlist; +CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist; UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' DROP VIEW test.v_processlist; @@ -73,13 +70,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ SHOW GRANTS; Grants for root@localhost GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION -<<<<<<< HEAD -GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ABORT_EXEMPT,AUDIT_ADMIN,AUTHENTICATION_POLICY_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FIREWALL_EXEMPT,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,GROUP_REPLICATION_STREAM,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PASSWORDLESS_USER_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SENSITIVE_VARIABLES_OBSERVER,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION -||||||| ce0de82d3aa -GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ABORT_EXEMPT,AUDIT_ADMIN,AUTHENTICATION_POLICY_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,GROUP_REPLICATION_STREAM,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PASSWORDLESS_USER_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SENSITIVE_VARIABLES_OBSERVER,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION -======= GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ABORT_EXEMPT,AUDIT_ADMIN,AUTHENTICATION_POLICY_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,GROUP_REPLICATION_STREAM,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PASSWORDLESS_USER_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SENSITIVE_VARIABLES_OBSERVER,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,TELEMETRY_LOG_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION ->>>>>>> mysql-8.0.33 GRANT PROXY ON ``@`` TO `root`@`localhost` WITH GRANT OPTION CREATE INDEX i_processlist ON processlist (user); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' @@ -113,28 +104,25 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `COMMAND` varchar(16) NOT NULL DEFAULT '', `TIME` int NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, - `INFO` longtext, - `TIME_MS` bigint NOT NULL DEFAULT '0', - `ROWS_SENT` bigint unsigned NOT NULL DEFAULT '0', - `ROWS_EXAMINED` bigint unsigned NOT NULL DEFAULT '0' + `INFO` longtext ) ENGINE=TMP_TABLE_ENGINE DEFAULT CHARSET=utf8mb3 SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist SELECT * FROM processlist ORDER BY id; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM processlist ORDER BY id TIME_MS ROWS_SENT ROWS_EXAMINED -SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED FROM processlist ORDER BY id; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED FROM processlist ORDER BY id TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM processlist ORDER BY id +SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id; +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist; UPDATE test.t_processlist SET user='horst' WHERE id=1 ; INSERT INTO processlist SELECT * FROM test.t_processlist; ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' DROP TABLE test.t_processlist; -CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED) AS SELECT * FROM processlist WITH CHECK OPTION; +CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION; ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist' -CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO, TIME_MS, ROWS_SENT, ROWS_EXAMINED) AS SELECT * FROM processlist; +CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist; UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1; ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema' DROP VIEW test.v_processlist; @@ -182,11 +170,11 @@ SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist #################################################################################### 4.2 New connection con101 (ddicttestuser1 with PROCESS privilege) SHOW/SELECT shows all processes/threads. @@ -195,17 +183,17 @@ SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT PROCESS ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL #################################################################################### 5 Grant PROCESS privilege to anonymous user. connection default (user=root) @@ -221,19 +209,19 @@ SHOW GRANTS; Grants for @localhost GRANT PROCESS ON *.* TO ``@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL #################################################################################### 6 Revoke PROCESS privilege from ddicttestuser1 connection default (user=root) @@ -248,15 +236,15 @@ SHOW GRANTS; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 7 Revoke PROCESS privilege from anonymous user connection default (user=root) @@ -271,9 +259,9 @@ SHOW GRANTS FOR ''@'localhost'; Grants for @localhost GRANT USAGE ON *.* TO ``@`localhost` SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID HOST_NAME information_schema Sleep TIME NULL #################################################################################### 8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1 connection default (user=root) @@ -289,17 +277,17 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT SUPER ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 9 Revoke SUPER privilege from user ddicttestuser1 connection default (user=root) @@ -316,19 +304,19 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 10 Grant SUPER privilege with grant option to user ddicttestuser1. connection default (user=root) @@ -368,33 +356,33 @@ SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; Grants for ddicttestuser2@localhost GRANT PROCESS ON *.* TO `ddicttestuser2`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser2 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID HOST_NAME information_schema Sleep TIME NULL +ID HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser2 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser2 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID HOST_NAME information_schema Sleep TIME NULL +ID HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser2 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID event_scheduler HOST_NAME NULL Daemon TIME Waiting on empty queue NULL +ID root HOST_NAME information_schema Sleep TIME NULL #################################################################################### 11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2 connection ddicttestuser1; @@ -408,13 +396,13 @@ SHOW GRANTS; Grants for ddicttestuser2@localhost GRANT USAGE ON *.* TO `ddicttestuser2`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser2 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser2 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser2 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser2 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1 connection default (user=root) @@ -433,25 +421,25 @@ GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES) SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 12 Revoke the SELECT privilege from user ddicttestuser1 connection default (user=root) @@ -468,27 +456,27 @@ SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; Grants for ddicttestuser1@localhost GRANT USAGE ON *.* TO `ddicttestuser1`@`localhost` SHOW processlist; -Id User Host db Command Time State Info Time_ms Rows_sent Rows_examined -ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +Id User Host db Command Time State Info +ID ddicttestuser1 HOST_NAME information_schema Query TIME STATE SHOW processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL SELECT * FROM information_schema.processlist; -ID USER HOST DB COMMAND TIME STATE INFO TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED -ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS ROWS_SENT ROWS_EXAMINED +ID USER HOST DB COMMAND TIME STATE INFO +ID ddicttestuser1 HOST_NAME information_schema Execute TIME executing SELECT * FROM information_schema.processlist +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL +ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL #################################################################################### 12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1. connection default (user=root) diff --git a/mysql-test/suite/group_replication/r/gr_change_master_hidden.result b/mysql-test/suite/group_replication/r/gr_change_master_hidden.result index 75ddcbde3bd2..5837796e15e2 100644 --- a/mysql-test/suite/group_replication/r/gr_change_master_hidden.result +++ b/mysql-test/suite/group_replication/r/gr_change_master_hidden.result @@ -34,15 +34,7 @@ SET sql_log_bin=1; SET @@global.log_output= @old_log_output; TRUNCATE TABLE mysql.general_log; include/group_replication_end.inc -<<<<<<< HEAD # MASTER_PASSWORD value for the CHANGE REPLICATION SOURCE command will not be logged in the error log. -Occurrences of 'master_password' in the input file: 0 -||||||| ce0de82d3aa -# MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log. -Occurrences of 'master_password' in the input file: 0 -======= -# MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log. Occurrences of 'source_password' in the input file: 0 ->>>>>>> mysql-8.0.33 # The password value 'unique_password' is not logged in the error log. Occurrences of 'unique_password' in the input file: 0 diff --git a/mysql-test/suite/group_replication/r/gr_change_master_hidden_ps_protocol.result b/mysql-test/suite/group_replication/r/gr_change_master_hidden_ps_protocol.result index 75ddcbde3bd2..5837796e15e2 100644 --- a/mysql-test/suite/group_replication/r/gr_change_master_hidden_ps_protocol.result +++ b/mysql-test/suite/group_replication/r/gr_change_master_hidden_ps_protocol.result @@ -34,15 +34,7 @@ SET sql_log_bin=1; SET @@global.log_output= @old_log_output; TRUNCATE TABLE mysql.general_log; include/group_replication_end.inc -<<<<<<< HEAD # MASTER_PASSWORD value for the CHANGE REPLICATION SOURCE command will not be logged in the error log. -Occurrences of 'master_password' in the input file: 0 -||||||| ce0de82d3aa -# MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log. -Occurrences of 'master_password' in the input file: 0 -======= -# MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log. Occurrences of 'source_password' in the input file: 0 ->>>>>>> mysql-8.0.33 # The password value 'unique_password' is not logged in the error log. Occurrences of 'unique_password' in the input file: 0 diff --git a/mysql-test/suite/group_replication/r/gr_change_master_not_replicated.result b/mysql-test/suite/group_replication/r/gr_change_master_not_replicated.result index 7449e5079c0f..61b1b42d0de0 100644 --- a/mysql-test/suite/group_replication/r/gr_change_master_not_replicated.result +++ b/mysql-test/suite/group_replication/r/gr_change_master_not_replicated.result @@ -24,29 +24,13 @@ GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%'; FLUSH PRIVILEGES; SET sql_log_bin=1; include/start_group_replication.inc -<<<<<<< HEAD # Asserting that CHANGE REPLICATION SOURCE is not logged in the binary log of the server 2. Occurrences of 'CHANGE REPLICATION SOURCE' in the input file: 0 -||||||| ce0de82d3aa -# Asserting that CHANGE MASTER is not logged in the binary log of the server 2. -Occurrences of 'CHANGE MASTER' in the input file: 0 -======= -# Asserting that CHANGE MASTER is not logged in the binary log of the server 2. -Occurrences of 'CHANGE REPLICATION SOURCE' in the input file: 0 ->>>>>>> mysql-8.0.33 # Ensuring the the two members are online. [connection server1] include/rpl_gr_wait_for_number_of_members.inc -<<<<<<< HEAD # Asserting that CHANGE REPLICATION SOURCE is not replicated in the binary log of the server. Occurrences of 'CHANGE REPLICATION SOURCE' in the input file: 0 -||||||| ce0de82d3aa -# Asserting that CHANGE MASTER is not replicated in the binary log of the server. -Occurrences of 'CHANGE MASTER' in the input file: 0 -======= -# Asserting that CHANGE MASTER is not replicated in the binary log of the server. -Occurrences of 'CHANGE REPLICATION SOURCE' in the input file: 0 ->>>>>>> mysql-8.0.33 [connection server2] RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery'; Warnings: diff --git a/mysql-test/suite/innodb/r/auto_increment.result b/mysql-test/suite/innodb/r/auto_increment.result index 0fae300f3939..c1e113e58fa4 100644 --- a/mysql-test/suite/innodb/r/auto_increment.result +++ b/mysql-test/suite/innodb/r/auto_increment.result @@ -1977,7 +1977,82 @@ ALTER TABLE t1 DROP INDEX `PRIMARY`, ADD COLUMN c INT NOT NULL AUTO_INCREMENT, ADD KEY (c); DROP TABLE t1; SET @@SESSION.information_schema_stats_expiry = DEFAULT; -<<<<<<< HEAD +# +# Bug#33419246 AUTO_INCREMENT can be set to less than MAX + 1 and not forced to MAX + 1 +# Bug#34418341 AUTOINC counter resets to 1 after ALTER TABLE following by restart +# Bug#34951259 alter table... auto_increment=1 does not work as expected +# +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; +AUTO_INCREMENT +4 +# restart: +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; +AUTO_INCREMENT +4 +SET SESSION information_schema_stats_expiry=0; +INSERT INTO `t1` (`id`) VALUES (NULL); +SELECT * FROM `t1`; +id +1 +2 +3 +4 +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; +AUTO_INCREMENT +5 +SET SESSION information_schema_stats_expiry=DEFAULT; +DROP TABLE t1; +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; +ALTER TABLE `t1` AUTO_INCREMENT=1; +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +INSERT INTO `t1` (`id`) VALUES (NULL); +DROP TABLE t1; +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +SET SESSION debug= "+d, crash_create_after_autoinc_persisted_update"; +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; +ERROR HY000: Lost connection to MySQL server during query +SHOW CREATE TABLE `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +DROP TABLE t1; # # PS-8577: ALTER TABLE ... AUTO_INCREMENT=1 does not work as expected, # @@ -2329,82 +2404,3 @@ id DROP TABLE t_imp_into_20_no_cfg; # Clean up. DROP TABLE t_exp; -||||||| ce0de82d3aa -======= -# -# Bug#33419246 AUTO_INCREMENT can be set to less than MAX + 1 and not forced to MAX + 1 -# Bug#34418341 AUTOINC counter resets to 1 after ALTER TABLE following by restart -# Bug#34951259 alter table... auto_increment=1 does not work as expected -# -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; -SHOW CREATE TABLE `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; -AUTO_INCREMENT -4 -# restart: -SHOW CREATE TABLE `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; -AUTO_INCREMENT -4 -SET SESSION information_schema_stats_expiry=0; -INSERT INTO `t1` (`id`) VALUES (NULL); -SELECT * FROM `t1`; -id -1 -2 -3 -4 -SHOW CREATE TABLE `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; -AUTO_INCREMENT -5 -SET SESSION information_schema_stats_expiry=DEFAULT; -DROP TABLE t1; -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; -ALTER TABLE `t1` AUTO_INCREMENT=1; -SHOW CREATE TABLE `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -INSERT INTO `t1` (`id`) VALUES (NULL); -DROP TABLE t1; -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -SET SESSION debug= "+d, crash_create_after_autoinc_persisted_update"; -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; -ERROR HY000: Lost connection to MySQL server during query -SHOW CREATE TABLE `t1`; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci -DROP TABLE t1; ->>>>>>> mysql-8.0.33 diff --git a/mysql-test/suite/innodb/t/auto_increment.test b/mysql-test/suite/innodb/t/auto_increment.test index 02e64542e6c8..3545a8fdb97a 100644 --- a/mysql-test/suite/innodb/t/auto_increment.test +++ b/mysql-test/suite/innodb/t/auto_increment.test @@ -2306,8 +2306,75 @@ ADD KEY (c); DROP TABLE t1; SET @@SESSION.information_schema_stats_expiry = DEFAULT; -<<<<<<< HEAD +--echo # +--echo # Bug#33419246 AUTO_INCREMENT can be set to less than MAX + 1 and not forced to MAX + 1 +--echo # Bug#34418341 AUTOINC counter resets to 1 after ALTER TABLE following by restart +--echo # Bug#34951259 alter table... auto_increment=1 does not work as expected +--echo # + +#Test 1 +#This test will check whether after modifying existing column to auto increment column, +#The auto increment value is persisted even after the restart of server +#Also whether Auto increment value from information_schema matches the auto increment value of table +#Also if the insert after restart works fine + +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; +SHOW CREATE TABLE `t1`; +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; + +--source include/restart_mysqld.inc +--source include/wait_until_connected_again.inc + +SHOW CREATE TABLE `t1`; +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; + +SET SESSION information_schema_stats_expiry=0; +INSERT INTO `t1` (`id`) VALUES (NULL); +SELECT * FROM `t1`; + +SHOW CREATE TABLE `t1`; +select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; + +SET SESSION information_schema_stats_expiry=DEFAULT; + +DROP TABLE t1; + +#Test 2 +#This test will check if after the existing column is modified to auto increment column, +#whether the auto increment forced to lower value than the existing is ignored +#And whether the insert into table after this ignore works fine + +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; +ALTER TABLE `t1` AUTO_INCREMENT=1; +SHOW CREATE TABLE `t1`; +INSERT INTO `t1` (`id`) VALUES (NULL); +DROP TABLE t1; + +#Test 3 +#This test will check if the recovery works fine or it has any adverse effects +#After the alter table statement which is modifying the existing column to be an auto increment column, +#We are crashing the server to verify if the alter table will not have any effect, which is the expected behaviour + +CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); +INSERT INTO `t1` (`id`) VALUES (1), (2), (3); +show create table t1; +SET SESSION debug= "+d, crash_create_after_autoinc_persisted_update"; + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--error 2013 + +ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +SHOW CREATE TABLE `t1`; +DROP TABLE t1; --echo # --echo # PS-8577: ALTER TABLE ... AUTO_INCREMENT=1 does not work as expected, @@ -2541,75 +2608,3 @@ DROP TABLE t_imp_into_20_no_cfg; --remove_file $MYSQLD_DATADIR/t_exp_10.cfg_back --remove_file $MYSQLD_DATADIR/t_exp_10.ibd_back DROP TABLE t_exp; -||||||| ce0de82d3aa -======= - ---echo # ---echo # Bug#33419246 AUTO_INCREMENT can be set to less than MAX + 1 and not forced to MAX + 1 ---echo # Bug#34418341 AUTOINC counter resets to 1 after ALTER TABLE following by restart ---echo # Bug#34951259 alter table... auto_increment=1 does not work as expected ---echo # - -#Test 1 -#This test will check whether after modifying existing column to auto increment column, -#The auto increment value is persisted even after the restart of server -#Also whether Auto increment value from information_schema matches the auto increment value of table -#Also if the insert after restart works fine - -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; -SHOW CREATE TABLE `t1`; -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; - ---source include/restart_mysqld.inc ---source include/wait_until_connected_again.inc - -SHOW CREATE TABLE `t1`; -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; - -SET SESSION information_schema_stats_expiry=0; -INSERT INTO `t1` (`id`) VALUES (NULL); -SELECT * FROM `t1`; - -SHOW CREATE TABLE `t1`; -select `AUTO_INCREMENT` from information_schema.tables where table_name='t1'; - -SET SESSION information_schema_stats_expiry=DEFAULT; - -DROP TABLE t1; - -#Test 2 -#This test will check if after the existing column is modified to auto increment column, -#whether the auto increment forced to lower value than the existing is ignored -#And whether the insert into table after this ignore works fine - -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; -ALTER TABLE `t1` AUTO_INCREMENT=1; -SHOW CREATE TABLE `t1`; -INSERT INTO `t1` (`id`) VALUES (NULL); -DROP TABLE t1; - -#Test 3 -#This test will check if the recovery works fine or it has any adverse effects -#After the alter table statement which is modifying the existing column to be an auto increment column, -#We are crashing the server to verify if the alter table will not have any effect, which is the expected behaviour - -CREATE TABLE `t1` (`id` INT NOT NULL PRIMARY KEY); -INSERT INTO `t1` (`id`) VALUES (1), (2), (3); -show create table t1; -SET SESSION debug= "+d, crash_create_after_autoinc_persisted_update"; - ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---error 2013 - -ALTER TABLE `t1` MODIFY `id` INT NOT NULL AUTO_INCREMENT; - ---enable_reconnect ---source include/wait_until_connected_again.inc - -SHOW CREATE TABLE `t1`; -DROP TABLE t1; ->>>>>>> mysql-8.0.33 diff --git a/mysql-test/suite/perfschema/r/dml_setup_threads.result b/mysql-test/suite/perfschema/r/dml_setup_threads.result index 6f75584cd512..18908e4ba806 100644 --- a/mysql-test/suite/perfschema/r/dml_setup_threads.result +++ b/mysql-test/suite/perfschema/r/dml_setup_threads.result @@ -13,13 +13,7 @@ thread/innodb/fts_optimize_thread YES YES singleton 0 NULL thread/innodb/fts_parallel_merge_thread YES YES 0 NULL thread/innodb/fts_parallel_tokenization_thread YES YES 0 NULL thread/innodb/io_ibuf_thread YES YES singleton 0 NULL -<<<<<<< HEAD -||||||| ce0de82d3aa -thread/innodb/io_log_thread YES YES singleton 0 NULL -======= thread/innodb/io_read_thread YES YES 0 NULL -thread/innodb/io_write_thread YES YES 0 NULL ->>>>>>> mysql-8.0.33 select * from performance_schema.setup_threads where enabled='YES'; insert into performance_schema.setup_threads diff --git a/mysql-test/suite/perfschema/r/telemetry_traces_server.result b/mysql-test/suite/perfschema/r/telemetry_traces_server.result index e32ab3ffb8b3..c7fe160dacb3 100644 --- a/mysql-test/suite/perfschema/r/telemetry_traces_server.result +++ b/mysql-test/suite/perfschema/r/telemetry_traces_server.result @@ -758,7 +758,7 @@ End of init > tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=, query='') > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='/*!80000 SET SESSION information_schema_stats_expiry=0 */') > tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=, query='') - > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SHOW VARIABLES LIKE 'gtid_mode'') + > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SHOW VARIABLES LIKE 'gtid\_mode'') > tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=, query='') > tm_stmt_notify_qa: skip tracing, no qa (depth=1, with_qa=0, user=root, query='SHOW VARIABLES LIKE 'ndbinfo\_version'') > tm_stmt_start: proceed further (depth=1, user=root, host=localhost, db=, query='') diff --git a/mysql-test/suite/perfschema/t/dd_version_check.test b/mysql-test/suite/perfschema/t/dd_version_check.test index 4b2d3ef63ed0..d134affc9daf 100644 --- a/mysql-test/suite/perfschema/t/dd_version_check.test +++ b/mysql-test/suite/perfschema/t/dd_version_check.test @@ -127,7 +127,7 @@ insert into test.pfs_published_schema insert into test.pfs_published_schema values("MySQL 8.0.33", - "00421db55e31bdc58161e2051c78e6b2040250db74f63afe3e473441d43769b4"); + "66e6294207291da0314d4992b23e60fa1c6e0d5bf41929a6e481969597f7207f"); create table test.pfs_check_table (id int NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/suite/rpl/r/bug71374.result b/mysql-test/suite/rpl/r/bug71374.result index 1ce3b31526a3..9ed627ce70e1 100644 --- a/mysql-test/suite/rpl/r/bug71374.result +++ b/mysql-test/suite/rpl/r/bug71374.result @@ -1,13 +1,13 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] -call mtr.add_suppression("Slave I/O: Get master clock failed with error: , Error_code: 1159"); -call mtr.add_suppression("Get master SERVER_ID failed with error: , Error_code: 1159"); -call mtr.add_suppression("Slave I/O: SET @master_heartbeat_period to master failed with error: , Error_code: 1159"); -call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +call mtr.add_suppression("Replica I/O: Get source clock failed with error: , Error_code: 1159"); +call mtr.add_suppression("Get source SERVER_ID failed with error: , Error_code: 1159"); +call mtr.add_suppression("Replica I/O: SET @master_heartbeat_period to source failed with error: , Error_code: 1159"); +call mtr.add_suppression("Replica I/O: Master command COM_REGISTER_SLAVE failed: .*"); +call mtr.add_suppression("Replica SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); SET @debug_saved=@@global.debug; include/stop_slave.inc SET @@global.debug="+d,get_master_version.heartbeat.ER_NET_READ_INTERRUPTED"; diff --git a/mysql-test/suite/rpl/r/bug72878.result b/mysql-test/suite/rpl/r/bug72878.result index df17addf08fe..954b8238f880 100644 --- a/mysql-test/suite/rpl/r/bug72878.result +++ b/mysql-test/suite/rpl/r/bug72878.result @@ -1,7 +1,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] create table a(id int) engine=InnoDB; drop table a; diff --git a/mysql-test/suite/rpl/r/bug80821.result b/mysql-test/suite/rpl/r/bug80821.result index ec12ce4e0c3f..e8b3cd910d7e 100644 --- a/mysql-test/suite/rpl/r/bug80821.result +++ b/mysql-test/suite/rpl/r/bug80821.result @@ -1,7 +1,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] CREATE TABLE t0 ( f0 INT PRIMARY KEY diff --git a/mysql-test/suite/rpl/r/percona_bug1008278.result b/mysql-test/suite/rpl/r/percona_bug1008278.result index a8352ae899fa..14b8b95e24fb 100644 --- a/mysql-test/suite/rpl/r/percona_bug1008278.result +++ b/mysql-test/suite/rpl/r/percona_bug1008278.result @@ -1,7 +1,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] CREATE TABLE t(id INT,data CHAR(30)); INSERT INTO t VALUES diff --git a/mysql-test/suite/rpl/r/percona_bug_ps3885.result b/mysql-test/suite/rpl/r/percona_bug_ps3885.result index b40155b52f42..e90cf69bfeb8 100644 --- a/mysql-test/suite/rpl/r/percona_bug_ps3885.result +++ b/mysql-test/suite/rpl/r/percona_bug_ps3885.result @@ -1,19 +1,19 @@ include/rpl_init.inc [topology=1->2->3] Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. include/stop_slave_io.inc CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=SERVER_MYPORT_1, SOURCE_LOG_FILE='mysqld-1.000001';; Warnings: -Warning 3023 CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file. +Warning 3023 CHANGE REPLICATION SOURCE TO with a SOURCE_LOG_FILE clause but no SOURCE_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file. include/start_slave_io.inc SHOW SLAVE STATUS; include/stop_slave_io.inc CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=SERVER_MYPORT_2, SOURCE_LOG_FILE='mysqld-two.000001';; Warnings: -Warning 3023 CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file. +Warning 3023 CHANGE REPLICATION SOURCE TO with a SOURCE_LOG_FILE clause but no SOURCE_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file. include/start_slave_io.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index 8fccd4549906..7e7e5cdd3631 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -3,25 +3,12 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] -<<<<<<< HEAD -call mtr.add_suppression("Master command COM_REGISTER_SLAVE failed"); -call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); -call mtr.add_suppression("Slave I/O thread .* register on master"); -call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on master"); -call mtr.add_suppression("Get master clock failed with error"); -||||||| ce0de82d3aa -call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); -call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); -call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); -call mtr.add_suppression("Slave I/O thread .* register on master"); -call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on master"); -======= -call mtr.add_suppression("Replica I/O: Source command COM_REGISTER_REPLICA failed: .*"); +call mtr.add_suppression("Replica I/O .* Source command COM_REGISTER_REPLICA failed:"); call mtr.add_suppression("Replica I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); call mtr.add_suppression("Fatal error: The replica I/O thread stops because source and replica have equal MySQL server ids; .*"); call mtr.add_suppression("Replica I/O thread .* register on source"); call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on source"); ->>>>>>> mysql-8.0.33 +call mtr.add_suppression("Get source clock failed with error"); include/stop_slave.inc SET @@global.debug= "+d,dbug.before_get_UNIX_TIMESTAMP"; START REPLICA; diff --git a/mysql-test/suite/rpl/r/rpl_ignore_super_read_only.result b/mysql-test/suite/rpl/r/rpl_ignore_super_read_only.result index 7f91b4a3252f..52212f8cddd6 100644 --- a/mysql-test/suite/rpl/r/rpl_ignore_super_read_only.result +++ b/mysql-test/suite/rpl/r/rpl_ignore_super_read_only.result @@ -8,7 +8,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] create table t1(a int); insert into t1 values(1); diff --git a/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_assertion.result b/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_assertion.result index 335d5400fba8..748b4eb1821d 100644 --- a/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_assertion.result +++ b/mysql-test/suite/rpl/r/rpl_mts_spco_deadlock_slave_trans_retries_assertion.result @@ -73,7 +73,7 @@ SET GLOBAL replica_preserve_commit_order = @saved_replica_preserve_commit_order; SET GLOBAL innodb_lock_wait_timeout = @saved_innodb_lock_wait_timeout; include/start_slave_sql.inc CALL mtr.add_suppression("Consider raising the value of the replica_transaction_retries variable"); -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state."); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); CALL mtr.add_suppression("Worker .* failed executing transaction"); [connection master] DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_multi_source_corrupt_repository.result b/mysql-test/suite/rpl/r/rpl_multi_source_corrupt_repository.result index bd9bf6dfc7a8..757528ceb430 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_source_corrupt_repository.result +++ b/mysql-test/suite/rpl/r/rpl_multi_source_corrupt_repository.result @@ -86,16 +86,8 @@ SELECT SOURCE_POS_WAIT('server1-bin.000001', 120, 5); ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(...) without 'FOR CHANNEL' argument should throw error. SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('01010101-0101-0101-0101-010101010101:1', 1); -<<<<<<< HEAD -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. -||||||| ce0de82d3aa -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. -======= ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. ->>>>>>> mysql-8.0.33 +===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD=10, SOURCE_CONNECT_RETRY=10, SOURCE_RETRY_COUNT=10; ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== FLUSH RELAY LOGS without 'FOR CHANNEL' clause. @@ -303,16 +295,8 @@ SELECT SOURCE_POS_WAIT('server1-bin.000001', 120, 5); ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(...) without 'FOR CHANNEL' argument should throw error. SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('01010101-0101-0101-0101-010101010101:1', 1); -<<<<<<< HEAD -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. -||||||| ce0de82d3aa -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. -======= ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. ->>>>>>> mysql-8.0.33 +===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD=10, SOURCE_CONNECT_RETRY=10, SOURCE_RETRY_COUNT=10; ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== FLUSH RELAY LOGS without 'FOR CHANNEL' clause. @@ -520,16 +504,8 @@ SELECT SOURCE_POS_WAIT('server1-bin.000001', 120, 5); ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(...) without 'FOR CHANNEL' argument should throw error. SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('01010101-0101-0101-0101-010101010101:1', 1); -<<<<<<< HEAD -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. -||||||| ce0de82d3aa -ERROR HY000: Multiple channels exist on the slave. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. -======= ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. -===== CHANGE MASTER without 'FOR CHANNEL' clause should throw error. ->>>>>>> mysql-8.0.33 +===== CHANGE REPLICATION SOURCE without 'FOR CHANNEL' clause should throw error. CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD=10, SOURCE_CONNECT_RETRY=10, SOURCE_RETRY_COUNT=10; ERROR HY000: Multiple channels exist on the replica. Please provide channel name as an argument. ===== FLUSH RELAY LOGS without 'FOR CHANNEL' clause. diff --git a/mysql-test/suite/rpl/r/rpl_multi_source_mts_recovery.result b/mysql-test/suite/rpl/r/rpl_multi_source_mts_recovery.result index a1c8be8689d3..cfe0c404ea4b 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_source_mts_recovery.result +++ b/mysql-test/suite/rpl/r/rpl_multi_source_mts_recovery.result @@ -3,14 +3,8 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. include/rpl_default_connections.inc -<<<<<<< HEAD [connection slave] -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped"); -||||||| ce0de82d3aa -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped"); -======= CALL mtr.add_suppression("The replica coordinator and worker threads are stopped"); ->>>>>>> mysql-8.0.33 SET @save.innodb_lock_wait_timeout=@@GLOBAL.innodb_lock_wait_timeout; SET @@global.innodb_lock_wait_timeout=1; SET @save.replica_transaction_retries= @@global.replica_transaction_retries; diff --git a/mysql-test/suite/rpl/r/rpl_multi_source_mts_reset_worker_info.result b/mysql-test/suite/rpl/r/rpl_multi_source_mts_reset_worker_info.result index 99508c361eda..b1c0dbb00355 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_source_mts_reset_worker_info.result +++ b/mysql-test/suite/rpl/r/rpl_multi_source_mts_reset_worker_info.result @@ -6,14 +6,8 @@ Note #### Storing MySQL user name or password information in the connection meta [connection slave] call mtr.add_suppression("Recovery from source pos .*"); call mtr.add_suppression("Corrupted table mysql.slave_worker_info"); -<<<<<<< HEAD -call mtr.add_suppression("Could not delete from Slave Workers info repository"); -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); -||||||| ce0de82d3aa -call mtr.add_suppression("Could not delete from Slave Workers info repository"); -======= call mtr.add_suppression("Could not delete from Replica Workers info repository"); ->>>>>>> mysql-8.0.33 +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); include/stop_slave.inc RESET SLAVE ALL; Warnings: diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index aa1ef09daa95..1ef346ac2c78 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -3,15 +3,9 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] -<<<<<<< HEAD [connection slave] [connection master] -call mtr.add_suppression('Slave: Error dropping database'); -||||||| ce0de82d3aa -call mtr.add_suppression('Slave: Error dropping database'); -======= call mtr.add_suppression('Replica: Error dropping database'); ->>>>>>> mysql-8.0.33 include/stop_slave.inc start slave; Warnings: diff --git a/mysql-test/suite/rpl/r/rpl_parallel_recovery.result b/mysql-test/suite/rpl/r/rpl_parallel_recovery.result index a86d42a3f3a2..123a9bd44127 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_recovery.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_recovery.result @@ -3,14 +3,8 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] -<<<<<<< HEAD [connection slave] -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped"); -||||||| ce0de82d3aa -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped"); -======= CALL mtr.add_suppression("The replica coordinator and worker threads are stopped"); ->>>>>>> mysql-8.0.33 SET @save.innodb_lock_wait_timeout=@@GLOBAL.innodb_lock_wait_timeout; SET @@global.innodb_lock_wait_timeout=1; SET @save.replica_transaction_retries= @@global.replica_transaction_retries; diff --git a/mysql-test/suite/rpl/t/bug71374.test b/mysql-test/suite/rpl/t/bug71374.test index dcd4bf2b85a4..272587430d02 100644 --- a/mysql-test/suite/rpl/t/bug71374.test +++ b/mysql-test/suite/rpl/t/bug71374.test @@ -1,5 +1,5 @@ # Bug #71374 -# Slave I/O thread won't attempt to automatically reconnect to the master +# Replica I/O thread won't attempt to automatically reconnect to the master # on ER_NET_READ_INTERRUPTED network error. # # The bug is in get_master_version_and_clock(). There are two places in this @@ -15,11 +15,11 @@ source include/have_debug_sync.inc; # Hence it's enough it to run only with one binlog format source include/have_binlog_format_mixed.inc; -call mtr.add_suppression("Slave I/O: Get master clock failed with error: , Error_code: 1159"); -call mtr.add_suppression("Get master SERVER_ID failed with error: , Error_code: 1159"); -call mtr.add_suppression("Slave I/O: SET @master_heartbeat_period to master failed with error: , Error_code: 1159"); -call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +call mtr.add_suppression("Replica I/O: Get source clock failed with error: , Error_code: 1159"); +call mtr.add_suppression("Get source SERVER_ID failed with error: , Error_code: 1159"); +call mtr.add_suppression("Replica I/O: SET @master_heartbeat_period to source failed with error: , Error_code: 1159"); +call mtr.add_suppression("Replica I/O: Master command COM_REGISTER_SLAVE failed: .*"); +call mtr.add_suppression("Replica SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); --let SEARCH_FILE=$MYSQL_TMP_DIR/rpl_bug71374.mysqld.2.err diff --git a/mysql-test/suite/rpl/t/bug72878.test b/mysql-test/suite/rpl/t/bug72878.test index c0aaa4225443..4d5931e1b06f 100644 --- a/mysql-test/suite/rpl/t/bug72878.test +++ b/mysql-test/suite/rpl/t/bug72878.test @@ -6,7 +6,7 @@ --source include/master-slave.inc --disable_query_log -call mtr.add_suppression("Slave:*"); +call mtr.add_suppression("Replica:*"); --enable_query_log create table a(id int) engine=InnoDB; diff --git a/mysql-test/suite/rpl/t/bug73066.test b/mysql-test/suite/rpl/t/bug73066.test index afcbd7848f81..d7866d67745b 100644 --- a/mysql-test/suite/rpl/t/bug73066.test +++ b/mysql-test/suite/rpl/t/bug73066.test @@ -3,7 +3,7 @@ --source include/master-slave.inc --source include/have_binlog_format_statement.inc -call mtr.add_suppression("Slave:*"); +call mtr.add_suppression("Replica:*"); create table a(id int); insert into a values(11); diff --git a/mysql-test/suite/rpl/t/rpl_create_drop_temp_table.test b/mysql-test/suite/rpl/t/rpl_create_drop_temp_table.test index 26cc91ce771f..348b99e92254 100644 --- a/mysql-test/suite/rpl/t/rpl_create_drop_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_create_drop_temp_table.test @@ -1,6 +1,6 @@ ############################################################################### # Bug#18364070 BACKPORT BUG#18236612 TO MYSQL-5.6 -# Problem & Analysis : When Slave SQL thread detects that Master was restarted +# Problem & Analysis : When Replica SQL thread detects that Master was restarted # with the help of information sent by Master through 'FormatDescription' # event, slave SQL drops all the opened temporary tables in order to have # proper cleanup. While slave SQL thread is dropping the temporary tables, it @@ -20,7 +20,7 @@ # This same test steps with gtid enabled mode, works to test the following # bug as well. # Bug#18069107 SLAVE CRASHES WITH GTIDS,TEMP TABLE, STOP IO_THREAD, START SLAVE -# Problem & Analysis : When Slave SQL thread detects that Master was restarted +# Problem & Analysis : When Replica SQL thread detects that Master was restarted # with the help of information sent by Master through 'FormatDescription' # event, slave SQL drops all the opened temporary tables in order to have # proper cleanup. When Gtid mode is on and while slave SQL thread is diff --git a/mysql-test/suite/rpl/t/rpl_filter_warnings.test b/mysql-test/suite/rpl/t/rpl_filter_warnings.test index 30ce1c370604..66dc4386377b 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_warnings.test +++ b/mysql-test/suite/rpl/t/rpl_filter_warnings.test @@ -6,7 +6,7 @@ # If a slave is configured with replication filters and log-error-verbosity=3, # every statement which is filtered writes an entry to the error log: # -# [Warning] Slave SQL: Could not execute Query event. Detailed error: Slave +# [Warning] Replica SQL: Could not execute Query event. Detailed error: Slave # SQL thread ignored the query because of replicate-*-table rules # For busy servers which generate a lot of statements that get filtered, the # result is an error log which can quickly grow into the GB range. diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 1a228146d367..99b1ca16dac8 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -20,25 +20,12 @@ source include/have_binlog_format_mixed.inc; connection slave; -<<<<<<< HEAD -call mtr.add_suppression("Master command COM_REGISTER_SLAVE failed"); -call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); -call mtr.add_suppression("Slave I/O thread .* register on master"); -call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on master"); -call mtr.add_suppression("Get master clock failed with error"); -||||||| ce0de82d3aa -call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); -call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); -call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); -call mtr.add_suppression("Slave I/O thread .* register on master"); -call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on master"); -======= -call mtr.add_suppression("Replica I/O: Source command COM_REGISTER_REPLICA failed: .*"); +call mtr.add_suppression("Replica I/O .* Source command COM_REGISTER_REPLICA failed:"); call mtr.add_suppression("Replica I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'"); call mtr.add_suppression("Fatal error: The replica I/O thread stops because source and replica have equal MySQL server ids; .*"); call mtr.add_suppression("Replica I/O thread .* register on source"); call mtr.add_suppression("Unknown system variable 'SERVER_UUID' on source"); ->>>>>>> mysql-8.0.33 +call mtr.add_suppression("Get source clock failed with error"); #Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection diff --git a/mysql-test/suite/rpl/t/rpl_insert_on_update.test b/mysql-test/suite/rpl/t/rpl_insert_on_update.test index a3ce72bbb1ce..50201a8a31eb 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_on_update.test +++ b/mysql-test/suite/rpl/t/rpl_insert_on_update.test @@ -7,7 +7,7 @@ # After upgrading a MySQL 5.5.23 slave to 5.6.14 (the master still runs 5.5.23) # on executing INSERT ON DUPLICATE KEY following error is reported in SBR. # -# [ERROR] Slave SQL: Error 'Auto-increment value in UPDATE conflicts with +# [ERROR] Replica SQL: Error 'Auto-increment value in UPDATE conflicts with # internally generated values' on query. # # Test: diff --git a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_assertion.test b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_assertion.test index 867620f71dbf..610f03b6aeb0 100644 --- a/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_assertion.test +++ b/mysql-test/suite/rpl/t/rpl_mts_spco_deadlock_slave_trans_retries_assertion.test @@ -150,7 +150,7 @@ SET GLOBAL innodb_lock_wait_timeout = @saved_innodb_lock_wait_timeout; # Add suppressions on replica server. CALL mtr.add_suppression("Consider raising the value of the replica_transaction_retries variable"); -CALL mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state."); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); CALL mtr.add_suppression("Worker .* failed executing transaction"); diff --git a/mysql-test/suite/rpl/t/rpl_multi_source_mts_reset_worker_info.test b/mysql-test/suite/rpl/t/rpl_multi_source_mts_reset_worker_info.test index 9a26f1065fbc..c5e7c16ae339 100644 --- a/mysql-test/suite/rpl/t/rpl_multi_source_mts_reset_worker_info.test +++ b/mysql-test/suite/rpl/t/rpl_multi_source_mts_reset_worker_info.test @@ -12,19 +12,13 @@ call mtr.add_suppression("Recovery from source pos .*"); call mtr.add_suppression("Corrupted table mysql.slave_worker_info"); -<<<<<<< HEAD -call mtr.add_suppression("Could not delete from Slave Workers info repository"); +call mtr.add_suppression("Could not delete from Replica Workers info repository"); # The following suppression is needed because of the Percona patch for # PS-5824 "MTS STOP SLAVE takes over a minute when master crashed during event logging" # (https://jira.percona.com/browse/PS-5824) # Oracle Bug #96400 "MTS STOP SLAVE takes over a minute when master crashed during event logging" # (https://bugs.mysql.com/bug.php?id=96400) -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); -||||||| ce0de82d3aa -call mtr.add_suppression("Could not delete from Slave Workers info repository"); -======= -call mtr.add_suppression("Could not delete from Replica Workers info repository"); ->>>>>>> mysql-8.0.33 +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); --source include/stop_slave.inc RESET SLAVE ALL; diff --git a/mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test b/mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test index e3b89ec41c47..d12ee4cedcc6 100644 --- a/mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test +++ b/mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test @@ -7,7 +7,7 @@ # Setting replica-skip-errors=all on the slave will make mysql slave # error log to grow continuously with the following warnings. # -# [Warning] Slave SQL: Could not execute Query event. +# [Warning] Replica SQL: Could not execute Query event. # Detailed error: ;, Error_code: 0 # # Test: diff --git a/mysql-test/suite/rpl/t/rpl_sql_thread_error.test b/mysql-test/suite/rpl/t/rpl_sql_thread_error.test index 95de0dae384c..44566220d111 100644 --- a/mysql-test/suite/rpl/t/rpl_sql_thread_error.test +++ b/mysql-test/suite/rpl/t/rpl_sql_thread_error.test @@ -24,7 +24,7 @@ --let rpl_skip_start_slave=1 --source include/master-slave.inc -# Step 1) Set a simulation on Slave SQL thread so that it enters +# Step 1) Set a simulation on Replica SQL thread so that it enters # into faulty code (before fix) path. --source include/rpl_connection_slave.inc CALL mtr.add_suppression("Relay log read failure"); diff --git a/mysql-test/suite/rpl_gtid/r/rpl_gtid_slave_persister_validation.result b/mysql-test/suite/rpl_gtid/r/rpl_gtid_slave_persister_validation.result index 0ce6431b2328..71f604ac914a 100644 --- a/mysql-test/suite/rpl_gtid/r/rpl_gtid_slave_persister_validation.result +++ b/mysql-test/suite/rpl_gtid/r/rpl_gtid_slave_persister_validation.result @@ -1,7 +1,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection master] # # 1. Create an InnoDB table and insert 2 rows. diff --git a/mysql-test/suite/rpl_gtid/r/rpl_invalid_position_with_gtid_only.result b/mysql-test/suite/rpl_gtid/r/rpl_invalid_position_with_gtid_only.result index 9e7340699e38..bf59a5e05df8 100644 --- a/mysql-test/suite/rpl_gtid/r/rpl_invalid_position_with_gtid_only.result +++ b/mysql-test/suite/rpl_gtid/r/rpl_invalid_position_with_gtid_only.result @@ -9,7 +9,7 @@ Note #### Storing MySQL user name or password information in the connection meta # Add some data in the source and replicate it # Restart the replica but don't start replication [connection slave] -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); SET @@GLOBAL.replica_checkpoint_period= 1; CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT = 1, GTID_ONLY = 1; include/start_slave.inc diff --git a/mysql-test/suite/rpl_gtid/t/rpl_gtid_mem_leak_with_skipped_rows_query_log_event.test b/mysql-test/suite/rpl_gtid/t/rpl_gtid_mem_leak_with_skipped_rows_query_log_event.test index 01fca1d52a18..b66a12cc2bc9 100644 --- a/mysql-test/suite/rpl_gtid/t/rpl_gtid_mem_leak_with_skipped_rows_query_log_event.test +++ b/mysql-test/suite/rpl_gtid/t/rpl_gtid_mem_leak_with_skipped_rows_query_log_event.test @@ -2,7 +2,7 @@ # Bug#25695434 MEMORY LEAK IN MULTI-SOURCE REPLICATION WHEN # BINLOG_ROWS_QUERY_LOG_EVENTS=1 # -# Problem: In multi source replication, Slave SQL Thread leaks memory +# Problem: In multi source replication, Replica SQL Thread leaks memory # when replicating using two channels from master-master pair # when binlog_rows_query_log_events is enabled. # diff --git a/mysql-test/suite/rpl_gtid/t/rpl_invalid_position_with_gtid_only.test b/mysql-test/suite/rpl_gtid/t/rpl_invalid_position_with_gtid_only.test index f567d9b54bf6..2a835046a9bc 100644 --- a/mysql-test/suite/rpl_gtid/t/rpl_invalid_position_with_gtid_only.test +++ b/mysql-test/suite/rpl_gtid/t/rpl_invalid_position_with_gtid_only.test @@ -42,7 +42,7 @@ # (https://jira.percona.com/browse/PS-5824) # Oracle Bug #96400 "MTS STOP SLAVE takes over a minute when master crashed during event logging" # (https://bugs.mysql.com/bug.php?id=96400) -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); # Reduce this to a minimum --let $replica_checkpoint_period_value = `SELECT @@global.replica_checkpoint_period` diff --git a/mysql-test/suite/rpl_nogtid/r/rpl_begin_commit_rollback.result b/mysql-test/suite/rpl_nogtid/r/rpl_begin_commit_rollback.result index 6690ce8bfb60..86707c52fdcc 100644 --- a/mysql-test/suite/rpl_nogtid/r/rpl_begin_commit_rollback.result +++ b/mysql-test/suite/rpl_nogtid/r/rpl_begin_commit_rollback.result @@ -172,7 +172,7 @@ in savepoint mixed_cases SELECT * FROM replicate_do_db.t1 WHERE a IN (30, 40); a -# BUG#55798 Slave SQL retry on transaction inserts extra data into +# BUG#55798 Replica SQL retry on transaction inserts extra data into # non-transaction table # ---------------------------------------------------------------- # To verify that SQL thread does not retry a transaction which can diff --git a/mysql-test/suite/rpl_nogtid/r/rpl_semi_sync_ack_thread.result b/mysql-test/suite/rpl_nogtid/r/rpl_semi_sync_ack_thread.result index 23cbe2265609..ce55b75a66d3 100644 --- a/mysql-test/suite/rpl_nogtid/r/rpl_semi_sync_ack_thread.result +++ b/mysql-test/suite/rpl_nogtid/r/rpl_semi_sync_ack_thread.result @@ -9,14 +9,8 @@ Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. [connection server_1] -<<<<<<< HEAD -CALL mtr.add_suppression("Semi-sync master failed on net_flush().*"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); -||||||| ce0de82d3aa -CALL mtr.add_suppression("Semi-sync master failed on net_flush().*"); -======= CALL mtr.add_suppression("Semi-sync source failed on net_flush().*"); ->>>>>>> mysql-8.0.33 +call mtr.add_suppression("Replica SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); #################################################################### # Test Case: semisync master can be enabled and disabled sucessfully # without any live slave connection and also test ON, OFF can be set diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_begin_commit_rollback.test b/mysql-test/suite/rpl_nogtid/t/rpl_begin_commit_rollback.test index 7245e49fa302..42faaec31919 100644 --- a/mysql-test/suite/rpl_nogtid/t/rpl_begin_commit_rollback.test +++ b/mysql-test/suite/rpl_nogtid/t/rpl_begin_commit_rollback.test @@ -17,7 +17,7 @@ # # BUG#43263 BEGIN skipped in some replicate-do-db cases # BUG#50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs -# BUG#55798 Slave SQL retry on transaction inserts extra data into non-transaction table +# BUG#55798 Replica SQL retry on transaction inserts extra data into non-transaction table source include/force_myisam_default.inc; source include/have_myisam.inc; source include/have_binlog_format_statement.inc; @@ -190,7 +190,7 @@ SELECT * FROM replicate_do_db.t2 WHERE s LIKE '% savepoint %'; SELECT * FROM replicate_do_db.t1 WHERE a IN (30, 40); --echo ---echo # BUG#55798 Slave SQL retry on transaction inserts extra data into +--echo # BUG#55798 Replica SQL retry on transaction inserts extra data into --echo # non-transaction table --echo # ---------------------------------------------------------------- --echo # To verify that SQL thread does not retry a transaction which can diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_parallel_worker_error.test b/mysql-test/suite/rpl_nogtid/t/rpl_parallel_worker_error.test index b18a7ce05482..3a38700f45f7 100644 --- a/mysql-test/suite/rpl_nogtid/t/rpl_parallel_worker_error.test +++ b/mysql-test/suite/rpl_nogtid/t/rpl_parallel_worker_error.test @@ -14,17 +14,9 @@ # via replication --connection slave -<<<<<<< HEAD --source include/only_mts_replica_parallel_workers.inc -call mtr.add_suppression("Slave SQL for channel '': Worker.*failed executing transaction"); -call mtr.add_suppression("Slave SQL for channel '':.*The slave coordinator and worker threads are stopped"); -||||||| ce0de82d3aa -call mtr.add_suppression("Slave SQL for channel '': Worker.*failed executing transaction"); -call mtr.add_suppression("Slave SQL for channel '':.*The slave coordinator and worker threads are stopped"); -======= call mtr.add_suppression("Replica SQL for channel '': Worker.*failed executing transaction"); call mtr.add_suppression("Replica SQL for channel '':.*The replica coordinator and worker threads are stopped"); ->>>>>>> mysql-8.0.33 --eval CREATE TABLE t (a TEXT) select "a" as a @@ -83,7 +75,7 @@ DROP TABLE t; # printed three times. # Steps that are executed above ensure that MTS slave stops with an error. -# Following lines check that "The slave coordinator and worker threads are +# Following lines check that "The replica coordinator and worker threads are # stopped..." error message is printed only once in the error log. --let $expected_errno= convert_error(ER_MTA_INCONSISTENT_DATA) diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_semi_sync_ack_thread.test b/mysql-test/suite/rpl_nogtid/t/rpl_semi_sync_ack_thread.test index 70674723ba2b..ade2c9f420fd 100644 --- a/mysql-test/suite/rpl_nogtid/t/rpl_semi_sync_ack_thread.test +++ b/mysql-test/suite/rpl_nogtid/t/rpl_semi_sync_ack_thread.test @@ -21,7 +21,7 @@ # "Semi-sync master failed on net_flush() before waiting for replica reply" CALL mtr.add_suppression("Semi-sync source failed on net_flush().*"); -call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +call mtr.add_suppression("Replica SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); --echo #################################################################### --echo # Test Case: semisync master can be enabled and disabled sucessfully diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_server_uuid.test b/mysql-test/suite/rpl_nogtid/t/rpl_server_uuid.test index 31dcd9523788..ee8dd26de13a 100644 --- a/mysql-test/suite/rpl_nogtid/t/rpl_server_uuid.test +++ b/mysql-test/suite/rpl_nogtid/t/rpl_server_uuid.test @@ -267,15 +267,7 @@ eval CHANGE REPLICATION SOURCE TO --let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.1.err # Grep only after the message that the server_2 has connected to the master -<<<<<<< HEAD ---let $assert_only_after=Start binlog_dump to master_thread_id\($slave_thread_id\) -||||||| ce0de82d3aa ---let $assert_only_after=Start binlog_dump to master_thread_id\($slave_thread_id\) ---let $assert_count= 1 -======= --let $assert_only_after=Start binlog_dump to source_thread_id\($replica_thread_id\) ---let $assert_count= 1 ->>>>>>> mysql-8.0.33 --let $assert_select=found a zombie dump thread with the same UUID --let $assert_match= ($assert_select)+ --let $assert_text= Found the expected line in master's error log for server 2 disconnection @@ -302,18 +294,10 @@ eval CHANGE REPLICATION SOURCE TO # Step-4: Check for error messages on slaves --let $assert_file=$MYSQLTEST_VARDIR/log/mysqld.2.err # Assert only the occurrences after the last CHANGE MASTER -<<<<<<< HEAD ---let $assert_only_after=CHANGE MASTER .* executed ---let $assert_select= Slave .* Got fatal error .* from master .* slave with the same server_uuid/server_id as this slave ---let $assert_match= ---let $assert_count= 1 -||||||| ce0de82d3aa ---let $assert_only_after=CHANGE MASTER .* executed ---let $assert_select= Slave .* Got fatal error .* from master .* slave with the same server_uuid/server_id as this slave -======= --let $assert_only_after=CHANGE REPLICATION SOURCE .* executed --let $assert_select= Replica .* Got fatal error .* from source .* replica with the same server_uuid/server_id as this replica ->>>>>>> mysql-8.0.33 +--let $assert_match= +--let $assert_count= 1 --let $assert_text= Found the expected line in server 2 error log --source include/assert_grep.inc diff --git a/mysql-test/suite/rpl_nogtid/t/rpl_slave_server_id_equal_to_zero.test b/mysql-test/suite/rpl_nogtid/t/rpl_slave_server_id_equal_to_zero.test index a1a07187529b..5e3d2462b6d6 100644 --- a/mysql-test/suite/rpl_nogtid/t/rpl_slave_server_id_equal_to_zero.test +++ b/mysql-test/suite/rpl_nogtid/t/rpl_slave_server_id_equal_to_zero.test @@ -116,32 +116,16 @@ DROP TABLE t1; --error ER_REPLICA_CONFIGURATION START SLAVE; -<<<<<<< HEAD # Change replication source should fail as slave not configured ---error ER_SLAVE_CONFIGURATION -||||||| ce0de82d3aa -# Change master should fail as slave not configured ---error ER_SLAVE_CONFIGURATION -======= -# Change master should fail as slave not configured --error ER_REPLICA_CONFIGURATION ->>>>>>> mysql-8.0.33 CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS=4; # Start slave for channel should fail as not configured --error ER_REPLICA_CONFIGURATION START SLAVE FOR CHANNEL 'any_channel'; -<<<<<<< HEAD # Change replication source for channel should fail as slave not configured ---error ER_SLAVE_CONFIGURATION -||||||| ce0de82d3aa -# Change master for channel should fail as slave not configured ---error ER_SLAVE_CONFIGURATION -======= -# Change master for channel should fail as slave not configured --error ER_REPLICA_CONFIGURATION ->>>>>>> mysql-8.0.33 CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS=4 FOR CHANNEL 'any_channel'; # Set original slave's server_id into @@GLOBAL.server_id @@ -151,32 +135,16 @@ CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS=4 FOR CHANNEL 'any_channel'; --error ER_REPLICA_CONFIGURATION START SLAVE; -<<<<<<< HEAD # Change replication source should still fail as slave not configured ---error ER_SLAVE_CONFIGURATION -||||||| ce0de82d3aa -# Change master should still fail as slave not configured ---error ER_SLAVE_CONFIGURATION -======= -# Change master should still fail as slave not configured --error ER_REPLICA_CONFIGURATION ->>>>>>> mysql-8.0.33 CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS=4; # Start slave for channel should still fail as not configured --error ER_REPLICA_CONFIGURATION START SLAVE FOR CHANNEL 'any_channel'; -<<<<<<< HEAD # Change replication source for channel should still fail as slave not configured ---error ER_SLAVE_CONFIGURATION -||||||| ce0de82d3aa -# Change master for channel should still fail as slave not configured ---error ER_SLAVE_CONFIGURATION -======= -# Change master for channel should still fail as slave not configured --error ER_REPLICA_CONFIGURATION ->>>>>>> mysql-8.0.33 CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS=4 FOR CHANNEL 'any_channel'; # Set server_id to 0 with PERSIST option diff --git a/mysql-test/suite/service_sys_var_registration/r/sys_var_service_errors.result b/mysql-test/suite/service_sys_var_registration/r/sys_var_service_errors.result index f14fe81a81ef..253e7246e8ab 100644 --- a/mysql-test/suite/service_sys_var_registration/r/sys_var_service_errors.result +++ b/mysql-test/suite/service_sys_var_registration/r/sys_var_service_errors.result @@ -5,22 +5,6 @@ call mtr.add_suppression("duplicate variable name"); # Setup INSTALL COMPONENT "file://component_test_sys_var_service"; SET PERSIST_ONLY test_component.bool_sys_var = 12; -<<<<<<< HEAD -ERROR 42000: Variable 'test_component.bool_sys_var' can't be set to the value of '12' -||||||| ce0de82d3aa -UNINSTALL COMPONENT "file://component_test_sys_var_service"; -# Should pass and should produce warnings -INSTALL COMPONENT "file://component_test_sys_var_service"; -Warnings: -Warning 1231 Variable 'test_component.bool_sys_var' can't be set to the value of '12' -Warning 4159 Failed to set persisted options. -Warning 1231 Variable 'test_component.bool_sys_var' can't be set to the value of '12' -Warning 4159 Failed to set persisted options. -Warning 1231 Variable 'test_component.bool_sys_var' can't be set to the value of '12' -Warning 4159 Failed to set persisted options. -# cleanup -RESET PERSIST test_component.bool_sys_var; -======= UNINSTALL COMPONENT "file://component_test_sys_var_service"; # Should pass and should produce warnings INSTALL COMPONENT "file://component_test_sys_var_service"; @@ -29,6 +13,5 @@ Warning 1231 Variable 'test_component.bool_sys_var' can't be set to the value of Warning 4159 Failed to set persisted options. # cleanup RESET PERSIST test_component.bool_sys_var; ->>>>>>> mysql-8.0.33 UNINSTALL COMPONENT "file://component_test_sys_var_service"; # End of 8.0 tests diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_deadlock_tokudb.result b/mysql-test/suite/tokudb_rpl/r/rpl_deadlock_tokudb.result index c2d04f125fc4..91b2a999c213 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_deadlock_tokudb.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_deadlock_tokudb.result @@ -144,6 +144,6 @@ include/start_slave.inc DROP TABLE t1,t2,t3; SET global max_relay_log_size= @my_max_relay_log_size; CALL mtr.add_suppression(".*worker thread retried transaction.*"); -CALL mtr.add_suppression(".*The slave coordinator and worker threads are stopped.*"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); End of 5.1 tests include/rpl_end.inc diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_extra_col_slave_tokudb.result b/mysql-test/suite/tokudb_rpl/r/rpl_extra_col_slave_tokudb.result index cb8462e2679f..b7f532358f02 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_extra_col_slave_tokudb.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_extra_col_slave_tokudb.result @@ -6,7 +6,7 @@ Note #### Storing MySQL user name or password information in the master info rep CALL mtr.add_suppression("Slave: .*Duplicate column name"); call mtr.add_suppression("Slave: Unknown table 'test.t6' Error_code: 1051"); call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot be converted from type.* Error_code: MY-013146"); -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_row_basic_3tokudb.result b/mysql-test/suite/tokudb_rpl/r/rpl_row_basic_3tokudb.result index f1b6fb77e888..e50facc064a6 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_row_basic_3tokudb.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_row_basic_3tokudb.result @@ -549,7 +549,7 @@ SET GLOBAL REPLICA_TYPE_CONVERSIONS = @saved_replica_type_conversions; call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: MY-001535"); call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: MY-001032"); call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t.. cannot be converted from type.*, Error_code: MY-013146"); -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); include/rpl_reset.inc [expecting slave to replicate correctly] INSERT INTO t4 VALUES (1, "", 1); diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_row_tabledefs_3tokudb.result b/mysql-test/suite/tokudb_rpl/r/rpl_row_tabledefs_3tokudb.result index bcf2932e61b4..5539d566c499 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_row_tabledefs_3tokudb.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_row_tabledefs_3tokudb.result @@ -124,7 +124,7 @@ INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: MY-001535"); call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]. cannot be converted from type.* Error_code: MY-013146"); -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); include/wait_for_slave_sql_error_and_skip.inc [errno=13146] INSERT INTO t9 VALUES (5); INSERT INTO t5 VALUES (5,10,25); diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_commit_after_flush.result b/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_commit_after_flush.result index 29b42f083ff4..02582b51e117 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_commit_after_flush.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_commit_after_flush.result @@ -1,7 +1,7 @@ include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. -Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=tokudb; begin; diff --git a/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_row_img_eng_full.result b/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_row_img_eng_full.result index e25aa8edfc8a..873071732180 100644 --- a/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_row_img_eng_full.result +++ b/mysql-test/suite/tokudb_rpl/r/rpl_tokudb_row_img_eng_full.result @@ -3649,7 +3649,7 @@ c1 c2 SET SQL_LOG_BIN=0; call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: MY-001032"); call mtr.add_suppression("Slave SQL for channel '': .*Could not execute Update_rows event on table test.t1; Can.t find record in .t1.* Error_code: MY-001032"); -call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); SET SQL_LOG_BIN=1; include/wait_for_slave_sql_error_and_skip.inc [errno=1032] DROP TABLE t1; diff --git a/mysql-test/suite/tokudb_rpl/t/rpl_extra_col_slave_tokudb.test b/mysql-test/suite/tokudb_rpl/t/rpl_extra_col_slave_tokudb.test index 53721c6b68a1..041a0c241482 100644 --- a/mysql-test/suite/tokudb_rpl/t/rpl_extra_col_slave_tokudb.test +++ b/mysql-test/suite/tokudb_rpl/t/rpl_extra_col_slave_tokudb.test @@ -2,7 +2,7 @@ -- source include/not_group_replication_plugin.inc -- source include/have_binlog_format_row.inc -- source include/master-slave.inc -CALL mtr.add_suppression("Slave: .*Duplicate column name"); +CALL mtr.add_suppression("Replica: .*Duplicate column name"); let $engine_type='TokuDB'; -- source extra/rpl_tests/rpl_extra_col_slave.test diff --git a/mysql-test/t/mysqldump_single_trans_min_privs-master.opt b/mysql-test/t/mysqldump_single_trans_min_privs-master.opt deleted file mode 100644 index 76f274d27224..000000000000 --- a/mysql-test/t/mysqldump_single_trans_min_privs-master.opt +++ /dev/null @@ -1 +0,0 @@ ---gtid-mode=ON --enforce-gtid-consistency --log-bin=ON diff --git a/mysql-test/t/mysqldump_single_trans_min_privs.test b/mysql-test/t/mysqldump_single_trans_min_privs.test deleted file mode 100644 index 00f9ef2375c6..000000000000 --- a/mysql-test/t/mysqldump_single_trans_min_privs.test +++ /dev/null @@ -1,58 +0,0 @@ -# -# BUG 35020512 - Provide an option in mysqldump to disable -# 'FLUSH TABLES WITH READ LOCK' so that RELOAD privilege is not required -# - ---echo # Create the test database -CREATE DATABASE bug_test; -USE bug_test; - ---echo # Create the test table -CREATE TABLE bug(n INT); - ---echo # Enter random data which could be dumped -INSERT INTO bug VALUES(10); -INSERT INTO bug VALUES(20); -INSERT INTO bug VALUES(30); - ---echo # Create the test user -CREATE USER test@localhost; - ---echo # Grant only SELECT privilege on the test database -GRANT SELECT ON bug_test.* TO test@localhost; -SHOW GRANTS FOR test@localhost; - ---echo # Create the dump file -let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/bug35020512_dump.sql; - ---echo # Start the dump tests ---echo # ----- Test 1 ----- ---echo # GTID enabled on the server, --set-gtid-purged is set to it's default value (AUTO). ---echo # Should fail because of insufficient privileges. ---echo # Start the dump ---error 2 ---exec $MYSQL_DUMP bug_test -utest --single-transaction --no-tablespaces> $mysqldumpfile ---echo # ----- Test 1 succeeded ----- - ---echo # ----- Test 2 ----- ---echo # GTID enabled on the server, --set-gtid-purged is set to OFF ---echo # Should succeed ---exec $MYSQL_DUMP bug_test -utest --single-transaction --set-gtid-purged=off --no-tablespaces > $mysqldumpfile ---echo # ----- Test 2 succeeded ----- - ---echo # ----- Test 3 ----- ---echo # Increase the privileges of test user by granting RELOAD privilege -GRANT RELOAD ON *.* TO test@localhost; -SHOW GRANTS FOR test@localhost; ---echo # Start the dump with --set-gtid-purged=ON ---echo # Should succeed ---exec $MYSQL_DUMP bug_test -utest --single-transaction --set-gtid-purged=ON --no-tablespaces > $mysqldumpfile ---echo # ----- Test 3 succeeded ----- - ---echo # ----- End of tests ----- - -# Cleanup -DROP USER test@localhost; -DROP DATABASE bug_test; -RESET MASTER; ---remove_file $mysqldumpfile diff --git a/plugin/authentication_fido/CMakeLists.txt b/plugin/authentication_fido/CMakeLists.txt index 1c44e84c69a4..82637e7234c1 100644 --- a/plugin/authentication_fido/CMakeLists.txt +++ b/plugin/authentication_fido/CMakeLists.txt @@ -26,13 +26,11 @@ ADD_DEFINITIONS(-DLOG_COMPONENT_TAG="authentication_fido") INCLUDE_DIRECTORIES(SYSTEM ${BOOST_PATCHES_DIR} ${BOOST_INCLUDE_DIR}) -MY_INCLUDE_SYSTEM_DIRECTORIES(FIDO) - DISABLE_MISSING_PROFILE_WARNING() MYSQL_ADD_PLUGIN(auth_fido ${AUTH_FIDO_SOURCES} LINK_LIBRARIES - ${FIDO_LIBRARY} ${OPENSSL_LIBRARIES} + ext::fido MODULE_ONLY MODULE_OUTPUT_NAME "authentication_fido" ) diff --git a/plugin/binlog_utils_udf/CMakeLists.txt b/plugin/binlog_utils_udf/CMakeLists.txt index 96dc94d6ad7f..7f7876b7d04b 100644 --- a/plugin/binlog_utils_udf/CMakeLists.txt +++ b/plugin/binlog_utils_udf/CMakeLists.txt @@ -1,4 +1,8 @@ -MYSQL_ADD_PLUGIN(binlog_utils_udf binlog_utils_udf.cc MODULE_ONLY MODULE_OUTPUT_NAME "binlog_utils_udf") +MYSQL_ADD_PLUGIN(binlog_utils_udf + binlog_utils_udf.cc + MODULE_ONLY MODULE_OUTPUT_NAME "binlog_utils_udf" + LINK_LIBRARIES extra::rapidjson +) ADD_DEFINITIONS(-DMYSQL_SERVER) diff --git a/plugin/keyring_vault/CMakeLists.txt b/plugin/keyring_vault/CMakeLists.txt index abec90d64720..ab9bd861005d 100644 --- a/plugin/keyring_vault/CMakeLists.txt +++ b/plugin/keyring_vault/CMakeLists.txt @@ -52,7 +52,8 @@ MYSQL_ADD_PLUGIN(keyring_vault vault_keyring.cc LINK_LIBRARIES ${CURL_LIBRARY} ${SSL_LIBRARIES} MODULE_ONLY - MODULE_OUTPUT_NAME "keyring_vault") + MODULE_OUTPUT_NAME "keyring_vault" + LINK_LIBRARIES extra::rapidjson) # We limit symbols exported on Linux to only those required by server. IF(LINK_FLAG_NO_UNDEFINED) diff --git a/plugin/keyring_vault/keyring_vault-test/CMakeLists.txt b/plugin/keyring_vault/keyring_vault-test/CMakeLists.txt index 254e4078ceea..a0ae17598e43 100644 --- a/plugin/keyring_vault/keyring_vault-test/CMakeLists.txt +++ b/plugin/keyring_vault/keyring_vault-test/CMakeLists.txt @@ -34,5 +34,5 @@ MYSQL_ADD_EXECUTABLE(keyring_vault-test ADD_TEST keyring_vault-test) TARGET_LINK_LIBRARIES(keyring_vault-test strings mysys sql_main minchassis) -TARGET_LINK_LIBRARIES(keyring_vault-test binlog rpl master slave) +TARGET_LINK_LIBRARIES(keyring_vault-test binlog rpl rpl_source rpl_replica) TARGET_LINK_LIBRARIES(keyring_vault-test ${CURL_LIBRARY} ${SSL_LIBRARIES}) diff --git a/plugin/keyring_vault/tests/mtr/rpl_key_rotation.test b/plugin/keyring_vault/tests/mtr/rpl_key_rotation.test index 9efd8eb60fff..6a057f8cff16 100644 --- a/plugin/keyring_vault/tests/mtr/rpl_key_rotation.test +++ b/plugin/keyring_vault/tests/mtr/rpl_key_rotation.test @@ -32,9 +32,9 @@ call mtr.add_suppression("Plugin keyring_vault reported: 'keyring_vault initiali call mtr.add_suppression("Can't generate new master key, please check the keyring is loaded."); call mtr.add_suppression("Encryption can't find master key, please check the keyring is loaded."); call mtr.add_suppression("Error 'Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully.'"); -call mtr.add_suppression("Slave: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully."); +call mtr.add_suppression("Replica: Can't find master key from keyring, please check in the server log if a keyring is loaded and initialized successfully."); call mtr.add_suppression("InnoDB: Can't generate new master key for tablespace encryption, please check the keyring is loaded."); -call mtr.add_suppression("The slave coordinator and worker threads are stopped"); +call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state"); call mtr.add_suppression("keyring_vault initialization failure"); call mtr.add_suppression("A message intended for a client cannot be sent there as no client-session is attached"); call mtr.add_suppression("Plugin keyring_vault reported: 'vault_ca is not specified but vault_url is https://"); diff --git a/plugin/procfs/CMakeLists.txt b/plugin/procfs/CMakeLists.txt index a0d980375c74..0dd2688f1d0c 100644 --- a/plugin/procfs/CMakeLists.txt +++ b/plugin/procfs/CMakeLists.txt @@ -1,5 +1,6 @@ MYSQL_ADD_PLUGIN(procfs procfs.cc - MODULE_ONLY) + MODULE_ONLY + LINK_LIBRARIES extra::rapidjson) ADD_DEFINITIONS(-DMYSQL_SERVER) diff --git a/plugin/tokudb-backup-plugin/CMakeLists.txt b/plugin/tokudb-backup-plugin/CMakeLists.txt index 7e6d1fd301ba..4386cde6ed9d 100644 --- a/plugin/tokudb-backup-plugin/CMakeLists.txt +++ b/plugin/tokudb-backup-plugin/CMakeLists.txt @@ -1,3 +1,5 @@ +RETURN() # Disable TokuDB + # TokuDB only supports x86-64 and cmake-2.8.9+ IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT CMAKE_VERSION VERSION_LESS "2.8.9" AND diff --git a/router/src/router/src/CMakeLists.txt b/router/src/router/src/CMakeLists.txt index 5ac22e4a3caf..466dc85c2b17 100644 --- a/router/src/router/src/CMakeLists.txt +++ b/router/src/router/src/CMakeLists.txt @@ -60,14 +60,8 @@ TARGET_LINK_LIBRARIES(router_lib ${CMAKE_DL_LIBS} harness-library harness_stdx -<<<<<<< HEAD - perconaserverclient -||||||| ce0de82d3aa - mysqlclient -======= harness_tls - mysqlclient ->>>>>>> mysql-8.0.33 + perconaserverclient ${SSL_LIBRARIES} io_component extra::rapidjson diff --git a/router/src/router/tests/CMakeLists.txt b/router/src/router/tests/CMakeLists.txt index 52f78c48f66a..27c667eed897 100644 --- a/router/src/router/tests/CMakeLists.txt +++ b/router/src/router/tests/CMakeLists.txt @@ -141,98 +141,6 @@ SET_TARGET_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS ROUTER_LIB_STATIC_DEFINE=1) -<<<<<<< HEAD -ADD_HARNESS_TEST_FILE(test_metadata_check.cc - MODULE ${TEST_MODULE} - LIB_DEPENDS - test-helpers perconaserverclient - EXTRA_SOURCES - ../src/common/mysql_session.cc - ../src/common/log_filter.cc - ../src/common/utils_sqlstring.cc - ../src/cluster_metadata.cc - ../src/uri.cc - ../src/utils.cc - ../../../tests/helpers/mysql_session_replayer.cc - INCLUDE_DIRS - $ - ../src/ - ../../../tests/helpers/ - SYSTEM_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) -SET_TARGET_PROPERTIES( - routertest_${TEST_MODULE}_metadata_check - PROPERTIES - COMPILE_DEFINITIONS ROUTER_LIB_STATIC_DEFINE=1) - -ADD_HARNESS_TEST_FILE(test_cluster_metadata.cc - MODULE ${TEST_MODULE} - LIB_DEPENDS - test-helpers perconaserverclient - EXTRA_SOURCES - ../src/common/mysql_session.cc - ../src/common/log_filter.cc - ../src/common/utils_sqlstring.cc - ../src/cluster_metadata.cc - ../src/uri.cc - ../src/utils.cc - ../../../tests/helpers/mysql_session_replayer.cc - INCLUDE_DIRS - $ - ../src/ - ../../../tests/helpers/ - SYSTEM_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) -SET_TARGET_PROPERTIES( - routertest_${TEST_MODULE}_cluster_metadata - PROPERTIES - COMPILE_DEFINITIONS ROUTER_LIB_STATIC_DEFINE=1) - -||||||| ce0de82d3aa -ADD_HARNESS_TEST_FILE(test_metadata_check.cc - MODULE ${TEST_MODULE} - LIB_DEPENDS - test-helpers mysqlclient - EXTRA_SOURCES - ../src/common/mysql_session.cc - ../src/common/log_filter.cc - ../src/common/utils_sqlstring.cc - ../src/cluster_metadata.cc - ../src/uri.cc - ../src/utils.cc - ../../../tests/helpers/mysql_session_replayer.cc - INCLUDE_DIRS - $ - ../src/ - ../../../tests/helpers/ - SYSTEM_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) -SET_TARGET_PROPERTIES( - routertest_${TEST_MODULE}_metadata_check - PROPERTIES - COMPILE_DEFINITIONS ROUTER_LIB_STATIC_DEFINE=1) - -ADD_HARNESS_TEST_FILE(test_cluster_metadata.cc - MODULE ${TEST_MODULE} - LIB_DEPENDS - test-helpers mysqlclient - EXTRA_SOURCES - ../src/common/mysql_session.cc - ../src/common/log_filter.cc - ../src/common/utils_sqlstring.cc - ../src/cluster_metadata.cc - ../src/uri.cc - ../src/utils.cc - ../../../tests/helpers/mysql_session_replayer.cc - INCLUDE_DIRS - $ - ../src/ - ../../../tests/helpers/ - SYSTEM_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS}) -SET_TARGET_PROPERTIES( - routertest_${TEST_MODULE}_cluster_metadata - PROPERTIES - COMPILE_DEFINITIONS ROUTER_LIB_STATIC_DEFINE=1) - -======= ->>>>>>> mysql-8.0.33 ADD_HARNESS_TEST_FILE(test_windows_service.cc MODULE ${TEST_MODULE} LIB_DEPENDS diff --git a/router/src/routing/tests/CMakeLists.txt b/router/src/routing/tests/CMakeLists.txt index f88f890545f3..56131340f2d5 100644 --- a/router/src/routing/tests/CMakeLists.txt +++ b/router/src/routing/tests/CMakeLists.txt @@ -120,7 +120,7 @@ IF(LIBFUZZER_COMPILE_FLAGS) ../src/sql_lexer.cc ${CMAKE_SOURCE_DIR}/sql/sql_lex_hash.cc COMPONENT Router - DEPENDENCIES GenServerSource + DEPENDENCIES GenServerSource GenError LINK_LIBRARIES harness_stdx;mysys SKIP_INSTALL ) diff --git a/router/src/routing/tests/mysql_client.h b/router/src/routing/tests/mysql_client.h index 10b7060fefb2..4a528976d8ac 100644 --- a/router/src/routing/tests/mysql_client.h +++ b/router/src/routing/tests/mysql_client.h @@ -883,14 +883,7 @@ class MysqlClient { return stdx::make_unexpected(make_mysql_error_code(m_.get())); } -<<<<<<< HEAD - mysql_free_result(res); - return {res}; -||||||| ce0de82d3aa - return {res}; -======= return {std::in_place, m_.get(), res}; ->>>>>>> mysql-8.0.33 } stdx::expected list_fields( @@ -901,14 +894,7 @@ class MysqlClient { return stdx::make_unexpected(make_mysql_error_code(m_.get())); } -<<<<<<< HEAD - mysql_free_result(res); - return {m_.get()}; -||||||| ce0de82d3aa - return {m_.get()}; -======= return {std::in_place, m_.get(), res}; ->>>>>>> mysql-8.0.33 } template diff --git a/router/tests/helpers/shared_server.cc b/router/tests/helpers/shared_server.cc index 456bced9b8b6..43821104d4dd 100644 --- a/router/tests/helpers/shared_server.cc +++ b/router/tests/helpers/shared_server.cc @@ -90,7 +90,7 @@ stdx::expected SharedServer::shutdown() { // from that into mysqld_dir_ void SharedServer::initialize_server(const std::string &datadir) { auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join("mysqld" EXE_EXTENSION); + auto mysqld = bindir.join(MYSQLD_BIN EXE_EXTENSION); if (!mysqld.exists()) { mysqld_failed_to_start_ = true; @@ -218,7 +218,7 @@ void SharedServer::spawn_server_with_datadir( auto &proc = process_manager() - .spawner(bindir.join("mysqld").str()) + .spawner(bindir.join(MYSQLD_BIN).str()) #ifdef _WIN32 // on windows, mysqld has no notify-socket .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) diff --git a/router/tests/helpers/shared_server.h b/router/tests/helpers/shared_server.h index 444dddeaa9c2..3f96dcb1e6cb 100644 --- a/router/tests/helpers/shared_server.h +++ b/router/tests/helpers/shared_server.h @@ -169,7 +169,7 @@ class SharedServer { private: static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; + TempDirectory mysqld_dir_{MYSQLD_BIN}; integration_tests::Procs procs_; TcpPortPool &port_pool_; diff --git a/router/tests/integration/test_routing_direct.cc b/router/tests/integration/test_routing_direct.cc index f789437825e6..640891486bc5 100644 --- a/router/tests/integration/test_routing_direct.cc +++ b/router/tests/integration/test_routing_direct.cc @@ -338,906 +338,6 @@ const ConnectionParam connection_params[] = { }, }; -<<<<<<< HEAD -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - [[nodiscard]] std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#else -#define EXE_EXTENSION "" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join(MYSQLD_BIN EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1M", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1M", // - "--innodb_buffer_pool_size=5M", // - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - auto &proc = - process_manager() - .spawner(bindir.join(MYSQLD_BIN).str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -||||||| ce0de82d3aa -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - [[nodiscard]] std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#else -#define EXE_EXTENSION "" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join("mysqld" EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1M", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1M", // - "--innodb_buffer_pool_size=5M", // - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - auto &proc = - process_manager() - .spawner(bindir.join("mysqld").str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -======= ->>>>>>> mysql-8.0.33 class SharedRouter { public: SharedRouter(TcpPortPool &port_pool) diff --git a/router/tests/integration/test_routing_reuse.cc b/router/tests/integration/test_routing_reuse.cc index e5995b98b8f7..1be4710b84e4 100644 --- a/router/tests/integration/test_routing_reuse.cc +++ b/router/tests/integration/test_routing_reuse.cc @@ -500,7 +500,7 @@ class SharedServer { } private: - TempDirectory mysqld_dir_{"mysqld"}; + TempDirectory mysqld_dir_{MYSQLD_BIN}; integration_tests::Procs procs_; TcpPortPool &port_pool_; diff --git a/router/tests/integration/test_routing_sharing.cc b/router/tests/integration/test_routing_sharing.cc index a39a2573db11..4fc5af55b781 100644 --- a/router/tests/integration/test_routing_sharing.cc +++ b/router/tests/integration/test_routing_sharing.cc @@ -367,1018 +367,6 @@ const ShareConnectionParam share_connection_params[] = { }, }; -<<<<<<< HEAD -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join(MYSQLD_BIN EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - auto &proc = - process_manager() - .spawner(bindir.join(MYSQLD_BIN).str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -||||||| ce0de82d3aa -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join("mysqld" EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - auto &proc = - process_manager() - .spawner(bindir.join("mysqld").str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -======= ->>>>>>> mysql-8.0.33 class SharedRouter { public: SharedRouter(TcpPortPool &port_pool, uint64_t pool_size) diff --git a/router/tests/integration/test_routing_sharing_constrained_pools.cc b/router/tests/integration/test_routing_sharing_constrained_pools.cc index 6c0a2c51f8b2..67e697ddc168 100644 --- a/router/tests/integration/test_routing_sharing_constrained_pools.cc +++ b/router/tests/integration/test_routing_sharing_constrained_pools.cc @@ -382,1028 +382,6 @@ const ShareConnectionParam share_connection_params[] = { }, }; -<<<<<<< HEAD -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join(MYSQLD_BIN EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - SCOPED_TRACE("// starting mysqld from " + bindir.str() + " with datadir " + - datadir); - - auto &proc = - process_manager() - .spawner(bindir.join(MYSQLD_BIN).str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) { - process_manager().dump_logs(); - mysqld_failed_to_start_ = true; - } - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - process_manager().dump_logs(); - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -||||||| ce0de82d3aa -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join("mysqld" EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - SCOPED_TRACE("// starting mysqld from " + bindir.str() + " with datadir " + - datadir); - - auto &proc = - process_manager() - .spawner(bindir.join("mysqld").str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) { - process_manager().dump_logs(); - mysqld_failed_to_start_ = true; - } - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - process_manager().dump_logs(); - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -======= ->>>>>>> mysql-8.0.33 class SharedRouter { public: SharedRouter(TcpPortPool &port_pool, uint64_t pool_size, bool split_routes) diff --git a/router/tests/integration/test_routing_sharing_restart.cc b/router/tests/integration/test_routing_sharing_restart.cc index 9536100ed1aa..043f71e4c870 100644 --- a/router/tests/integration/test_routing_sharing_restart.cc +++ b/router/tests/integration/test_routing_sharing_restart.cc @@ -272,1018 +272,6 @@ const ShareConnectionParam share_connection_params[] = { }, }; -<<<<<<< HEAD -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join(MYSQLD_BIN EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - auto &proc = - process_manager() - .spawner(bindir.join(MYSQLD_BIN).str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -||||||| ce0de82d3aa -static void copy_tree(const mysql_harness::Directory &from_dir, - const mysql_harness::Directory &to_dir) { - for (const auto &path : from_dir) { - auto from = path; - auto to = to_dir.join(path.basename()); - - if (path.is_directory()) { - mysql_harness::mkdir(to.str(), mysql_harness::kStrictDirectoryPerm); - copy_tree(from, to); - } else { - mysqlrouter::copy_file(from.str(), to.str()); - } - } -} - -/** - * A manager of a mysql-server. - * - * allows: - * - * - initializing a server - * - copying data directories. - * - stopping servers - * - setting up accounts for testing - * - closing all connections - */ -class SharedServer { - public: - SharedServer(TcpPortPool &port_pool) : port_pool_(port_pool) {} - - ~SharedServer() { - // shutdown via API to get a clean exit-code on windows. - shutdown(); - process_manager().wait_for_exit(); - } - - stdx::expected shutdown() { - auto cli_res = admin_cli(); - if (!cli_res) return stdx::make_unexpected(cli_res.error()); - - auto shutdown_res = cli_res->shutdown(); - if (!shutdown_res) return stdx::make_unexpected(shutdown_res.error()); - - return {}; - } - - std::string mysqld_init_once_dir_name() const { - return mysqld_init_once_dir_->name(); - } - - [[nodiscard]] std::string mysqld_dir_name() const { - return mysqld_dir_.name(); - } - - integration_tests::Procs &process_manager() { return procs_; } -#ifdef _WIN32 -#define EXE_EXTENSION ".exe" -#define SO_EXTENSION ".dll" -#else -#define EXE_EXTENSION "" -#define SO_EXTENSION ".so" -#endif - - // initialize the server - // - // initializes the server once into mysqld_init_once_dir_ and creates copies - // from that into mysqld_dir_ - void initialize_server(const std::string &datadir) { - auto bindir = process_manager().get_origin(); - auto mysqld = bindir.join("mysqld" EXE_EXTENSION); - - if (!mysqld.exists()) { - mysqld_failed_to_start_ = true; - return; - } - - auto &proc = - process_manager() - .spawner(mysqld.str()) - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) - .spawn({ - "--no-defaults", - "--initialize-insecure", - "--loose-skip-ndbcluster", - "--innodb_redo_log_capacity=8M", - "--innodb_autoextend_increment=1", - "--innodb_use_native_aio=0", - "--datadir=" + datadir, - "--log-error=" + datadir + - mysql_harness::Path::directory_separator + - "mysqld-init.err", - }); - proc.set_logging_path(datadir, "mysqld-init.err"); - ASSERT_NO_THROW(proc.wait_for_exit(60s)); - if (proc.exit_code() != 0) mysqld_failed_to_start_ = true; - } - - void prepare_datadir() { - if (mysqld_init_once_dir_ == nullptr) { - mysqld_init_once_dir_ = new TempDirectory("mysqld-init-once"); - - initialize_server(mysqld_init_once_dir_name()); - - if (!mysqld_failed_to_start()) { - spawn_server_with_datadir(mysqld_init_once_dir_name()); - setup_mysqld_accounts(); - - shutdown(); - process_manager().wait_for_exit(); - process_manager().clear(); - } - } - - // copy the init-once dir to the datadir. - copy_tree(mysqld_init_once_dir_name(), mysqld_dir_name()); - - // remove the auto.cnf to get a unique server-uuid - unlink(mysqld_dir_.file("auto.cnf").c_str()); - } - - void spawn_server_with_datadir( - const std::string &datadir, - const std::vector &extra_args = {}) { - SCOPED_TRACE("// start server"); - - // parent is either: - // - // - runtime_output_directory/ or - // - runtime_output_directory/Debug/ - auto bindir = process_manager().get_origin().real_path(); - - // if this is a multi-config-build, remember the build-type. - auto build_type = bindir.basename().str(); - if (build_type == "runtime_output_directory") { - // no multi-config build. - build_type = {}; - } - - auto builddir = bindir.dirname(); - if (!build_type.empty()) { - builddir = builddir.dirname(); - } - auto sharedir = builddir.join("share"); - auto plugindir = builddir.join("plugin_output_directory"); - if (!build_type.empty()) { - plugindir = plugindir.join(build_type); - } - auto lc_messages_dir = sharedir; - - auto lc_messages80_dir = sharedir.join("mysql-8.0"); - - if (lc_messages80_dir.join("english").join("errmsg.sys").exists()) { - lc_messages_dir = lc_messages80_dir; - } - - std::string log_file_name = "mysqld-" + std::to_string(starts_) + ".err"; - - std::vector args{ - "--no-defaults-file", // - "--lc-messages-dir=" + lc_messages_dir.str(), - "--datadir=" + datadir, // - "--plugin_dir=" + plugindir.str(), // - "--log-error=" + datadir + mysql_harness::Path::directory_separator + - log_file_name, - "--port=" + std::to_string(server_port_), - // defaults to {datadir}/mysql.socket - "--socket=" + Path(datadir).join("mysql.sock").str(), - "--mysqlx-port=" + std::to_string(server_mysqlx_port_), - // defaults to {datadir}/mysqlx.socket - "--mysqlx-socket=" + Path(datadir).join("mysqlx.sock").str(), - // disable LOAD DATA/SELECT INTO on the server - "--secure-file-priv=NULL", // - "--innodb_redo_log_capacity=8M", // fast startups - "--innodb_autoextend_increment=1", // - "--innodb_buffer_pool_size=5M", // - "--innodb_use_native_aio=0", // avoid 'Cannot initialize AIO - // subsystem' - "--gtid_mode=ON", // group-replication - "--enforce_gtid_consistency=ON", // - "--relay-log=relay-log", - }; - - for (const auto &arg : extra_args) { - args.push_back(arg); - } - - // remember the extra args for "restart_server()" - started_args_ = extra_args; - - auto &proc = - process_manager() - .spawner(bindir.join("mysqld").str()) -#ifdef _WIN32 - // on windows, mysqld has no notify-socket - .wait_for_sync_point(ProcessManager::Spawner::SyncPoint::NONE) -#endif - .spawn(args); - proc.set_logging_path(datadir, log_file_name); - if (!proc.wait_for_sync_point_result()) mysqld_failed_to_start_ = true; - -#ifdef _WIN32 - // on windows, wait until port is ready as there is no notify-socket. - if (!(wait_for_port_ready(server_port_, 10s) && - wait_for_port_ready(server_mysqlx_port_, 10s))) { - mysqld_failed_to_start_ = true; - } -#endif - - ++starts_; - } - - void spawn_server(const std::vector &extra_args = {}) { - spawn_server_with_datadir(mysqld_dir_name(), extra_args); - } - - struct Account { - std::string username; - std::string password; - std::string auth_method; - }; - - stdx::expected admin_cli() { - MysqlClient cli; - - auto account = admin_account(); - - cli.username(account.username); - cli.password(account.password); - - auto connect_res = cli.connect(server_host(), server_port()); - if (!connect_res) return connect_res.get_unexpected(); - - return cli; - } - - void create_schema(MysqlClient &cli, const std::string &schema) { - std::ostringstream oss; - oss << "CREATE SCHEMA " << std::quoted(schema, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON *.* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void grant_access(MysqlClient &cli, const Account &account, - const std::string &rights, const std::string &schema) { - std::ostringstream oss; - oss << "GRANT " << rights << " ON " << std::quoted(schema, '`') << ".* TO " - << std::quoted(account.username, '`'); - - auto q = oss.str(); - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void create_account(MysqlClient &cli, Account account) { - const std::string q = "CREATE USER " + account.username + " " + // - "IDENTIFIED WITH " + account.auth_method + " " + // - "BY '" + account.password + "'"; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void drop_account(MysqlClient &cli, Account account) { - const std::string q = "DROP USER " + account.username; - - SCOPED_TRACE("// " + q); - ASSERT_NO_ERROR(cli.query(q)) << q; - } - - void setup_mysqld_accounts() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - auto cli = std::move(cli_res.value()); - - create_schema(cli, "testing"); - - ASSERT_NO_ERROR(cli.query(R"(CREATE PROCEDURE testing.multiple_results() -BEGIN - SELECT 1; - SELECT 2; -END)")); - - for (auto account : { - native_password_account(), - native_empty_password_account(), - caching_sha2_password_account(), - caching_sha2_empty_password_account(), - sha256_password_account(), - sha256_empty_password_account(), - }) { - create_account(cli, account); - grant_access(cli, account, "FLUSH_TABLES, BACKUP_ADMIN"); - grant_access(cli, account, "ALL", "testing"); - grant_access(cli, account, "SELECT", "performance_schema"); - } - - // locking_service - // - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_read_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_get_write_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION service_release_locks" - " RETURNS INT" - " SONAME 'locking_service" SO_EXTENSION "'")); - - // version_token - - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_shared" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - ASSERT_NO_ERROR( - cli.query("CREATE FUNCTION version_tokens_lock_exclusive" - " RETURNS INT" - " SONAME 'version_token" SO_EXTENSION "'")); - - // clone - - ASSERT_NO_ERROR( - cli.query("INSTALL PLUGIN clone" - " SONAME 'mysql_clone" SO_EXTENSION "'")); - } - - void flush_privileges() { - SCOPED_TRACE("// flushing privileges"); - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - flush_privileges(*cli_res); - } - - void flush_privileges(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("FLUSH PRIVILEGES")); - } - - // get all connections, but ignore internal connections and this - // connection. - static stdx::expected, MysqlError> user_connection_ids( - MysqlClient &cli) { - auto ids_res = cli.query(R"(SELECT id - FROM performance_schema.processlist -WHERE id != CONNECTION_ID() AND - Command != "Daemon")"); - if (!ids_res) return stdx::make_unexpected(ids_res.error()); - - std::vector ids; - for (const auto &res : *ids_res) { - for (auto row : res.rows()) { - ids.push_back(strtol(row[0], nullptr, 10)); - } - } - - return ids; - } - - // close all connections. - void close_all_connections() { - SCOPED_TRACE("// closing all connections at the server."); - - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - close_all_connections(*cli_res); - } - - void close_all_connections(MysqlClient &cli) { - { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - for (auto id : *ids_res) { - auto kill_res = cli.kill(id); - - // either it succeeds or "Unknown thread id" because it closed itself - // between the SELECT and this kill - EXPECT_TRUE(kill_res || kill_res.error().value() == 1094) - << kill_res.error(); - } - } - - SCOPED_TRACE("// checking all connections are closed now."); - { - // wait a bit until all connections are really closed. - using clock_type = std::chrono::steady_clock; - auto end = clock_type::now() + 1000ms; - do { - auto ids_res = user_connection_ids(cli); - ASSERT_NO_ERROR(ids_res); - - if ((*ids_res).empty()) break; - - ASSERT_LT(clock_type::now(), end) << ": timeout"; - - std::this_thread::sleep_for(10ms); - } while (true); - } - } - - // set global settings to default values. - void reset_to_defaults() { - auto cli_res = admin_cli(); - ASSERT_NO_ERROR(cli_res); - - reset_to_defaults(*cli_res); - } - - // set global settings to default values. - void reset_to_defaults(MysqlClient &cli) { - ASSERT_NO_ERROR(cli.query("SET GLOBAL max_connections = DEFAULT")); - } - - [[nodiscard]] bool mysqld_failed_to_start() const { - return mysqld_failed_to_start_; - } - - [[nodiscard]] uint16_t server_port() const { return server_port_; } - [[nodiscard]] uint16_t server_mysqlx_port() const { - return server_mysqlx_port_; - } - [[nodiscard]] std::string server_host() const { return server_host_; } - - static Account caching_sha2_password_account() { - return {"caching_sha2", "somepass", "caching_sha2_password"}; - } - - static Account caching_sha2_empty_password_account() { - return {"caching_sha2_empty", "", "caching_sha2_password"}; - } - - static Account caching_sha2_single_use_password_account() { - return {"caching_sha2_single_use", "notusedyet", "caching_sha2_password"}; - } - - static Account native_password_account() { - return {"native", "somepass", "mysql_native_password"}; - } - - static Account native_empty_password_account() { - return {"native_empty", "", "mysql_native_password"}; - } - - static Account sha256_password_account() { - return {"sha256_pass", "sha256pass", "sha256_password"}; - } - - static Account sha256_empty_password_account() { - return {"sha256_empty", "", "sha256_password"}; - } - - static Account admin_account() { - return {"root", "", "caching_sha2_password"}; - } - - static void destroy_statics() { - if (mysqld_init_once_dir_) { - delete mysqld_init_once_dir_; - mysqld_init_once_dir_ = nullptr; - } - } - - private: - static TempDirectory *mysqld_init_once_dir_; - TempDirectory mysqld_dir_{"mysqld"}; - - integration_tests::Procs procs_; - TcpPortPool &port_pool_; - - static const constexpr char server_host_[] = "127.0.0.1"; - uint16_t server_port_{port_pool_.get_next_available()}; - uint16_t server_mysqlx_port_{port_pool_.get_next_available()}; - - bool mysqld_failed_to_start_{false}; - - std::vector started_args_; - - uint32_t starts_{}; -}; - -TempDirectory *SharedServer::mysqld_init_once_dir_ = nullptr; - -======= ->>>>>>> mysql-8.0.33 class SharedRouter { public: SharedRouter(TcpPortPool &port_pool, uint64_t pool_size) diff --git a/scripts/mysqldumpslow.pl.in b/scripts/mysqldumpslow.pl.in index 72248c773b9e..43dea90d69be 100755 --- a/scripts/mysqldumpslow.pl.in +++ b/scripts/mysqldumpslow.pl.in @@ -1,13 +1,7 @@ #!@PERL_PATH@ -<<<<<<< HEAD -# Copyright (c) 2000, 2022, Oracle and/or its affiliates. -# Copyright (c) 2016, Percona Inc. -||||||| ce0de82d3aa -# Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= # Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +# Copyright (c) 2016, Percona Inc. # # 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, diff --git a/scripts/systemd/mysqlrouter.service.in b/scripts/systemd/mysqlrouter.service.in index 828188f7a66e..01e759808a10 100644 --- a/scripts/systemd/mysqlrouter.service.in +++ b/scripts/systemd/mysqlrouter.service.in @@ -21,17 +21,9 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA [Unit] -<<<<<<< HEAD Description=Percona MySQL Router -After=network.target -||||||| ce0de82d3aa -Description=MySQL Router -After=network.target -======= -Description=MySQL Router After=network-online.target Wants=network-online.target ->>>>>>> mysql-8.0.33 After=syslog.target diff --git a/sql/auth/sql_authentication.cc b/sql/auth/sql_authentication.cc index 530fa147d853..af64648d72e6 100644 --- a/sql/auth/sql_authentication.cc +++ b/sql/auth/sql_authentication.cc @@ -1083,10 +1083,6 @@ plugin_ref Cached_authentication_plugins::get_cached_plugin_ref( return cached_plugin; } -<<<<<<< HEAD -external_roles_t g_external_roles; -||||||| ce0de82d3aa -======= /* Fetch the SSL security level */ @@ -1118,7 +1114,7 @@ int security_level(void) { return current_sec_level; } ->>>>>>> mysql-8.0.33 +external_roles_t g_external_roles; Cached_authentication_plugins *g_cached_authentication_plugins = nullptr; bool disconnect_on_expired_password = true; diff --git a/sql/auth/sql_authorization.cc b/sql/auth/sql_authorization.cc index 0c531fc3653b..62e6d7146bd9 100644 --- a/sql/auth/sql_authorization.cc +++ b/sql/auth/sql_authorization.cc @@ -228,7 +228,6 @@ opt_always_activate_roles_on_login is set to true. */ -<<<<<<< HEAD static const char *command_array[] = {"SELECT", "INSERT", "UPDATE", @@ -266,11 +265,6 @@ TYPELIB utility_user_privileges_typelib = {array_elements(command_array) - 1, "utility_user_privileges_typelib", command_array, nullptr}; -namespace { -||||||| ce0de82d3aa -namespace { -======= ->>>>>>> mysql-8.0.33 /** Class to handle sanity checks for GRANT ... AS ... statement */ diff --git a/sql/binlog.cc b/sql/binlog.cc index b32a4368a980..7749aa57b6e0 100644 --- a/sql/binlog.cc +++ b/sql/binlog.cc @@ -4213,7 +4213,6 @@ static bool read_gtids_and_update_trx_parser_from_relaylog( // This is not a fatal error; the log may just be truncated. // @todo but what other errors could happen? IO error? LogErr(WARNING_LEVEL, ER_BINLOG_ERROR_READING_GTIDS_FROM_RELAY_LOG, -1); - sql_print_warning(relaylog_file_reader.get_error_str()); } #ifndef NDEBUG @@ -4450,7 +4449,6 @@ static enum_read_gtids_from_binlog_status read_gtids_from_binlog( // @todo but what other errors could happen? IO error? LogErr(WARNING_LEVEL, ER_BINLOG_ERROR_READING_GTIDS_FROM_BINARY_LOG, -1); - sql_print_warning(binlog_file_reader.get_error_str()); } if (all_gtids) @@ -12029,8 +12027,8 @@ static int show_binlog_vars(THD *thd, SHOW_VAR *var, return 0; } -static int show_binlog_snapshot_gtid_executed( - THD *thd, SHOW_VAR *var, char *buff [[maybe_unused]]) { +static int show_binlog_snapshot_gtid_executed(THD *thd, SHOW_VAR *var, + char *buff [[maybe_unused]]) { mysql_mutex_assert_owner(&LOCK_status); const binlog_cache_mngr *cache_mngr = get_cache_mngr(thd); diff --git a/sql/binlog.h b/sql/binlog.h index 8ebeb4f00e23..edc757ce5ff7 100644 --- a/sql/binlog.h +++ b/sql/binlog.h @@ -44,7 +44,7 @@ #include "mysql/psi/mysql_cond.h" #include "mysql/psi/mysql_mutex.h" #include "mysql/udf_registration_types.h" -#include "mysql_com.h" // Item_result +#include "mysql_com.h" // Item_result #include "sql/binlog_reader.h" // Binlog_file_reader #include "sql/rpl_commit_stage_manager.h" #include "sql/rpl_trx_tracking.h" @@ -300,6 +300,7 @@ class MYSQL_BIN_LOG : public TC_LOG { uint32 new_index_number); int generate_new_name(char *new_name, const char *log_name, uint32 new_index_number = 0); +#if defined(MYSQL_SERVER) /** * Read binary log stream header and Format_desc event from * binlog_file_reader. Check for LOG_EVENT_BINLOG_IN_USE_F flag. @@ -309,6 +310,7 @@ class MYSQL_BIN_LOG : public TC_LOG { * while reading log events */ bool read_binlog_in_use_flag(Binlog_file_reader &binlog_file_reader); +#endif /* defined(MYSQL_SERVER) */ protected: /** @@ -961,12 +963,8 @@ class MYSQL_BIN_LOG : public TC_LOG { const char *get_name() const { return name; } inline mysql_mutex_t *get_log_lock() { return &LOCK_log; } inline mysql_mutex_t *get_commit_lock() { return &LOCK_commit; } -<<<<<<< HEAD - inline mysql_mutex_t *get_sync_lock() { return &LOCK_sync; } -||||||| ce0de82d3aa -======= inline mysql_mutex_t *get_after_commit_lock() { return &LOCK_after_commit; } ->>>>>>> mysql-8.0.33 + inline mysql_mutex_t *get_sync_lock() { return &LOCK_sync; } inline mysql_cond_t *get_log_cond() { return &update_cond; } inline Binlog_ofile *get_binlog_file() { return m_binlog_file; } @@ -1051,12 +1049,6 @@ class MYSQL_BIN_LOG : public TC_LOG { True while rotating binlog, which is caused by logging Incident_log_event. */ bool is_rotating_caused_by_incident; -<<<<<<< HEAD - - private: - void publish_coordinates_for_global_status(void) const; -||||||| ce0de82d3aa -======= public: /** @@ -1102,7 +1094,9 @@ class MYSQL_BIN_LOG : public TC_LOG { // Set of log info objects that are in usage and might prevent some other // operations from executing. std::set log_info_set; ->>>>>>> mysql-8.0.33 + + private: + void publish_coordinates_for_global_status(void) const; }; struct LOAD_FILE_INFO { diff --git a/sql/filesort.cc b/sql/filesort.cc index 67f0cd661b18..421caf5a1d39 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1,12 +1,6 @@ /* -<<<<<<< HEAD - Copyright (c) 2000, 2022, Oracle and/or its affiliates. - Copyright (c) 2018, Percona and/or its affiliates. All rights reserved. -||||||| ce0de82d3aa - Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2018, Percona and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc index 65b4c4633a5f..b9de572cd143 100644 --- a/sql/gen_lex_token.cc +++ b/sql/gen_lex_token.cc @@ -144,13 +144,7 @@ struct gen_lex_token_string { - mode named tokens from bison (sql_yacc.yy). See also YYMAXUTOK. */ -<<<<<<< HEAD const int MY_MAX_TOKEN = 1400; -||||||| ce0de82d3aa -const int MY_MAX_TOKEN = 1250; -======= -const int MY_MAX_TOKEN = 1251; ->>>>>>> mysql-8.0.33 gen_lex_token_string compiled_token_array[MY_MAX_TOKEN]; diff --git a/sql/handler.h b/sql/handler.h index 7c023627af05..a51ed7507d4b 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2951,7 +2951,17 @@ constexpr const decltype( * secondary. */ #define HTON_SECONDARY_ENGINE_SUPPORTS_DDL (1 << 19) -<<<<<<< HEAD +/** Whether the engine does not support triggers. */ +#define HTON_NO_TRIGGER_SUPPORT (1 << 20) + +/** Whether the primary engine supports external data sources. This case refers + to having tables with data in object store and the engine does not store any + of those data, only metadata. Table contents can be accessed only after + loading the table in the secondary storage engine. The flag is used for + a primary engine only. + */ +#define HTON_SUPPORTS_EXTERNAL_SOURCE (1 << 21) + /** Start of Percona specific HTON_* defines */ /** @@ -2975,20 +2985,6 @@ constexpr const decltype( /** End of Percona specific HTON_* defines */ -||||||| ce0de82d3aa -======= -/** Whether the engine does not support triggers. */ -#define HTON_NO_TRIGGER_SUPPORT (1 << 20) - -/** Whether the primary engine supports external data sources. This case refers - to having tables with data in object store and the engine does not store any - of those data, only metadata. Table contents can be accessed only after - loading the table in the secondary storage engine. The flag is used for - a primary engine only. - */ -#define HTON_SUPPORTS_EXTERNAL_SOURCE (1 << 21) - ->>>>>>> mysql-8.0.33 inline bool secondary_engine_supports_ddl(const handlerton *hton) { assert(hton->flags & HTON_IS_SECONDARY_ENGINE); diff --git a/sql/log_event.cc b/sql/log_event.cc index 9b8ec24211d6..2584a119ca9a 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,13 +1,7 @@ /* -<<<<<<< HEAD - Copyright (c) 2000, 2022, Oracle and/or its affiliates. + Copyright (c) 2000, 2023, Oracle and/or its affiliates. Copyright (c) 2018, Percona and/or its affiliates. Copyright (c) 2009, 2016, MariaDB -||||||| ce0de82d3aa - Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= - Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 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, @@ -4870,8 +4864,8 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, "time. Query: '"); message.append(thd->query().str); message.append("'"); - rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, - ER_THD(thd, ER_SLAVE_FATAL_ERROR), message.c_ptr()); + rli->report(ERROR_LEVEL, ER_REPLICA_FATAL_ERROR, + ER_THD(thd, ER_REPLICA_FATAL_ERROR), message.c_ptr()); thd->is_slave_error = true; goto end; } @@ -5571,8 +5565,7 @@ int Start_encryption_log_event::do_update_pos(Relay_log_info *rli) { #ifndef MYSQL_SERVER void Start_encryption_log_event::print( - FILE *file [[maybe_unused]], - PRINT_EVENT_INFO *print_event_info) const { + FILE *file [[maybe_unused]], PRINT_EVENT_INFO *print_event_info) const { // Need 2 characters per one hex + 2 for 0x + 1 for \0 char nonce_buf[NONCE_LENGTH * 2 + 2 + 1]; str_to_hex(nonce_buf, reinterpret_cast(nonce), NONCE_LENGTH); diff --git a/sql/log_event.h b/sql/log_event.h index 13b578f2763d..e3e78d329255 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1515,7 +1515,7 @@ class Start_encryption_log_event final Start_encryption_log_event(const char *buf, const Format_description_event *description_event); - Log_event_type get_type_code() noexcept { + Log_event_type get_type_code() const override { return binary_log::START_5_7_ENCRYPTION_EVENT; } @@ -1524,8 +1524,8 @@ class Start_encryption_log_event final protected: #ifdef MYSQL_SERVER virtual int do_update_pos(Relay_log_info *rli) override; - virtual enum_skip_reason do_shall_skip( - Relay_log_info *rli [[maybe_unused]]) noexcept override { + virtual enum_skip_reason do_shall_skip(Relay_log_info *rli + [[maybe_unused]]) noexcept override { return Log_event::EVENT_SKIP_NOT; } #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 19bd19c26549..1c4ffb7e6b1e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -10106,12 +10106,6 @@ static int show_resource_group_support(THD *, SHOW_VAR *var, char *buf) { return 0; } -<<<<<<< HEAD -/* - Variables shown by SHOW STATUS in alphabetical order -*/ -||||||| ce0de82d3aa -======= static int show_telemetry_traces_support(THD * /*unused*/, SHOW_VAR *var, char *buf) { var->type = SHOW_BOOL; @@ -10124,7 +10118,9 @@ static int show_telemetry_traces_support(THD * /*unused*/, SHOW_VAR *var, return 0; } ->>>>>>> mysql-8.0.33 +/* + Variables shown by SHOW STATUS in alphabetical order +*/ SHOW_VAR status_vars[] = { {"Aborted_clients", (char *)&aborted_threads, SHOW_LONG, SHOW_SCOPE_GLOBAL}, {"Aborted_connects", (char *)&show_aborted_connects, SHOW_FUNC, diff --git a/sql/protocol_classic.cc b/sql/protocol_classic.cc index 03126594c53d..ee2694658fed 100644 --- a/sql/protocol_classic.cc +++ b/sql/protocol_classic.cc @@ -3408,19 +3408,13 @@ bool Protocol_text::store_null() { } int Protocol_classic::shutdown(bool) { -<<<<<<< HEAD - return m_thd->net.vio ? vio_shutdown(m_thd->net.vio, SHUT_RDWR) : 0; -||||||| ce0de82d3aa - return m_thd->net.vio ? vio_shutdown(m_thd->net.vio) : 0; -======= #ifdef USE_PPOLL_IN_VIO // Test code calls this directly, so we need to set it here as well if (m_thd->net.vio && !m_thd->net.vio->thread_id.has_value()) { m_thd->net.vio->thread_id = m_thd->real_id; } #endif /* USE_PPOLL_IN_VIO */ - return m_thd->net.vio ? vio_shutdown(m_thd->net.vio) : 0; ->>>>>>> mysql-8.0.33 + return m_thd->net.vio ? vio_shutdown(m_thd->net.vio, SHUT_RDWR) : 0; } bool Protocol_classic::store_string(const char *from, size_t length, diff --git a/sql/rpl_rli_pdb.cc b/sql/rpl_rli_pdb.cc index 7bb63d76387d..11245a5b8736 100644 --- a/sql/rpl_rli_pdb.cc +++ b/sql/rpl_rli_pdb.cc @@ -694,22 +694,10 @@ bool Slave_worker::commit_positions(Log_event *ev, Slave_job_group *ptr_g, */ set_group_master_log_name(c_rli->get_group_master_log_name()); -<<<<<<< HEAD - DBUG_PRINT("mts", ("Committing worker-id %lu group master log pos %llu " - "group master log name %s checkpoint sequence number %lu.", - id, get_group_master_log_pos(), - get_group_master_log_name(), worker_checkpoint_seqno)); -||||||| ce0de82d3aa - DBUG_PRINT("mts", ("Committing worker-id %lu group master log pos %llu " - "group master log name %s checkpoint sequence number %lu.", - id, group_master_log_pos, group_master_log_name, - worker_checkpoint_seqno)); -======= DBUG_PRINT("mta", ("Committing worker-id %lu group source log pos %llu " "group source log name %s checkpoint sequence number %lu.", - id, group_master_log_pos, group_master_log_name, - worker_checkpoint_seqno)); ->>>>>>> mysql-8.0.33 + id, get_group_master_log_pos(), + get_group_master_log_name(), worker_checkpoint_seqno)); DBUG_EXECUTE_IF("mta_debug_concurrent_access", { mta_debug_concurrent_access++; };); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 942f11ea05b9..0ea76b25bc56 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,12 +1,6 @@ /* -<<<<<<< HEAD - Copyright (c) 2000, 2022, Oracle and/or its affiliates. - Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa - Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, @@ -724,15 +718,9 @@ THD::THD(bool enable_plugins) m_is_plugin_fake_ddl(false), m_inside_system_variable_global_update(false), bind_parameter_values(nullptr), -<<<<<<< HEAD - bind_parameter_values_count(0), - is_rpl_stmt_event_format_used(true) { -||||||| ce0de82d3aa - bind_parameter_values_count(0) { -======= bind_parameter_values_count(0), + is_rpl_stmt_event_format_used(true), external_store_() { ->>>>>>> mysql-8.0.33 main_lex->reset(); set_psi(nullptr); mdl_context.init(this); @@ -1515,6 +1503,7 @@ extern "C" void thd_report_innodb_stat(THD *thd, unsigned long long trx_id, uint64_t value) { assert(thd); assert(!thd_is_background_thread(thd)); + (void)thd; thd->mark_innodb_used(trx_id); switch (type) { case MYSQL_TRX_STAT_IO_READ_BYTES: diff --git a/sql/sql_class.h b/sql/sql_class.h index 97f4570c6545..ca83d9064b7b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3015,13 +3015,6 @@ class THD : public MDL_context_owner, /** number of name_const() substitutions, see sp_head.cc:subst_spvars() */ uint query_name_consts; -<<<<<<< HEAD - /* - If we do a purge of binary logs, log index info of the threads - that are currently reading it needs to be adjusted. To do that - each thread that is using LOG_INFO needs to adjust the pointer to it - */ - LOG_INFO *current_linfo; /* Used to update global user stats. The global user stats are updated @@ -3065,15 +3058,6 @@ class THD : public MDL_context_owner, // milliseconds before every SQL command. ulonglong query_delay_millis; -||||||| ce0de82d3aa - /* - If we do a purge of binary logs, log index info of the threads - that are currently reading it needs to be adjusted. To do that - each thread that is using LOG_INFO needs to adjust the pointer to it - */ - LOG_INFO *current_linfo; -======= ->>>>>>> mysql-8.0.33 /* Used by the sys_var class to store temporary values */ union { bool bool_value; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index f1dcf6d6754d..6f1297ac31c4 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1799,7 +1799,6 @@ static int lex_one_token(Lexer_yystype *yylval, THD *thd) { state = MY_LEX_USER_VARIABLE_DELIMITER; break; } - // fallthrough /* " used for strings */ [[fallthrough]]; case MY_LEX_STRING: // Incomplete text string diff --git a/sql/sql_lex.h b/sql/sql_lex.h index f3a5ef3cab68..b8d65293226a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2803,8 +2803,8 @@ class Query_tables_list { @retval false if the statement is not marked as unsafe. @retval true if it is. */ - inline bool is_stmt_unsafe(enum_binlog_stmt_unsafe unsafe_type) const - noexcept { + inline bool is_stmt_unsafe( + enum_binlog_stmt_unsafe unsafe_type) const noexcept { return ((binlog_stmt_flags & (1U << unsafe_type)) != 0); } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 650f1f4dfcb2..113a0bb7d7c6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1972,25 +1972,8 @@ bool dispatch_command(THD *thd, const COM_DATA *com_data, break; } case COM_CHANGE_USER: { -<<<<<<< HEAD -||||||| ce0de82d3aa - /* - LOCK_thd_security_ctx protects the THD's security-context from - inspection by SHOW PROCESSLIST while we're updating it. Nested - acquiring of LOCK_thd_data is fine (see below). - */ - MUTEX_LOCK(grd_secctx, &thd->LOCK_thd_security_ctx); - -======= MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(thd->m_statement_psi, false); - /* - LOCK_thd_security_ctx protects the THD's security-context from - inspection by SHOW PROCESSLIST while we're updating it. Nested - acquiring of LOCK_thd_data is fine (see below). - */ - MUTEX_LOCK(grd_secctx, &thd->LOCK_thd_security_ctx); ->>>>>>> mysql-8.0.33 int auth_rc; thd->status_var.com_other++; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index b4129b652ab2..ccba0a397c91 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1879,6 +1879,7 @@ static void reset_stmt_parameters(Prepared_statement *stmt) { void mysqld_stmt_execute(THD *thd, Prepared_statement *stmt, bool has_new_types, ulong execute_flags, PS_PARAM *parameters) { DBUG_TRACE; + statement_id_to_session(thd); #if defined(ENABLED_PROFILING) thd->profiling->set_query_source(stmt->m_query_string.str, diff --git a/sql/sql_resolver.cc b/sql/sql_resolver.cc index 375eae66b5a6..785f2b6228a4 100644 --- a/sql/sql_resolver.cc +++ b/sql/sql_resolver.cc @@ -97,7 +97,7 @@ #include "sql/sql_const.h" #include "sql/sql_derived.h" //Condition_pushdown #include "sql/sql_error.h" -#include "sql/sql_executor.h" // is_rollup_group_wrapper +#include "sql/sql_executor.h" // is_rollup_sum_wrapper, is_rollup_group_wrapper #include "sql/sql_lex.h" #include "sql/sql_list.h" #include "sql/sql_optimizer.h" // build_bitmap_for_nested_joins @@ -5100,15 +5100,6 @@ static bool fulltext_uses_rollup_column(const Query_block *query_block) { bool Query_block::resolve_rollup_wfs(THD *thd) { DBUG_TRACE; for (auto it = fields.begin(); it != fields.end(); ++it) { - /* - Do not replace references to grouped expressions with - Item_rollup_group_item objects if they belong to a top-level aggregate - expression (which were wrapped into Item_rollup_sum_switcher earlier). - */ - if ((*it)->type() == Item::SUM_FUNC_ITEM && - down_cast(*it)->is_rollup_sum_wrapper()) - continue; - Item *new_item = resolve_rollup_item(thd, *it); if (new_item == nullptr) return true; *it = new_item; diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 9370be4907da..af9f958e5cf9 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -422,17 +422,11 @@ class Sys_var_alias : public sys_var { void saved_value_to_string(THD *thd, set_var *var, char *def_val) override { return m_base_var.saved_value_to_string(thd, var, def_val); } -<<<<<<< HEAD - virtual void persist_only_to_string(THD *thd, set_var *var, - String *dest) override { + void persist_only_to_string(THD *thd, set_var *var, + String *dest) override { return m_base_var.persist_only_to_string(thd, var, dest); } - virtual bool check_update_type(Item_result type) override { -||||||| ce0de82d3aa - virtual bool check_update_type(Item_result type) override { -======= bool check_update_type(Item_result type) override { ->>>>>>> mysql-8.0.33 return m_base_var.check_update_type(type); } enum_variable_source get_source() override { return m_base_var.get_source(); } diff --git a/sql/tc_log.cc b/sql/tc_log.cc index 323ee993af66..d94e962aca57 100644 --- a/sql/tc_log.cc +++ b/sql/tc_log.cc @@ -1,12 +1,6 @@ -<<<<<<< HEAD -/* Copyright (c) 2015, 2022, Oracle and/or its affiliates. +/* Copyright (c) 2015, 2023, Oracle and/or its affiliates. Copyright (c) 2009, 2013, Monty Program Ab Copyright (C) 2012 Percona Inc. -||||||| ce0de82d3aa -/* Copyright (c) 2015, 2022, Oracle and/or its affiliates. -======= -/* Copyright (c) 2015, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 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, diff --git a/sql/uniques.cc b/sql/uniques.cc index edfac59f9802..dcc3d794750f 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -1,11 +1,5 @@ -<<<<<<< HEAD -/* Copyright (c) 2001, 2022, Oracle and/or its affiliates. - Copyright (c) 2018, Percona and/or its affiliates. -||||||| ce0de82d3aa -/* Copyright (c) 2001, 2022, Oracle and/or its affiliates. -======= /* Copyright (c) 2001, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2018, Percona and/or its affiliates. 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, diff --git a/storage/heap/hp_record.cc b/storage/heap/hp_record.cc index 49fda5e7b989..e1928e11f36e 100644 --- a/storage/heap/hp_record.cc +++ b/storage/heap/hp_record.cc @@ -131,7 +131,7 @@ static inline bool hp_process_field_data_to_chunkset( if (to_copy == 0) { /* Jump to the next chunk */ #if !defined(NDEBUG) && defined(EXTRA_HEAP_DEBUG) - dump_chunk(info, curr_chunk); + dump_chunk(info, curr_chunk); #endif memcpy(&curr_chunk, curr_chunk + info.recordspace.offset_link, sizeof(uchar *)); diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index d89867e10219..860baa4428d7 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the @@ -2495,16 +2489,10 @@ file::Block *dblwr::get_encrypted_frame(buf_page_t *bpage) noexcept { compressed_block = os_file_compress_page(type, frame, &n); } -<<<<<<< HEAD - space->get_encryption_info(type.get_encryption_info()); - type.encryption_algorithm(Encryption::AES); + type.get_encryption_info().set(space->m_encryption_metadata); + type.set_encryption_algorithm(Encryption::AES); page_size_t page_size(space->flags); -||||||| ce0de82d3aa - space->get_encryption_info(type.get_encryption_info()); -======= - type.get_encryption_info().set(space->m_encryption_metadata); ->>>>>>> mysql-8.0.33 auto e_block = os_file_encrypt_page(type, frame, n); if (compressed_block != nullptr) { @@ -2979,14 +2967,8 @@ static bool is_dblwr_page_corrupted(byte *page, fil_space_t *space, IORequest req_type; size_t z_page_size; -<<<<<<< HEAD - space->get_encryption_info(en); - req_type.encryption_algorithm(Encryption::AES); -||||||| ce0de82d3aa - space->get_encryption_info(en); -======= en.set(space->m_encryption_metadata); ->>>>>>> mysql-8.0.33 + req_type.set_encryption_algorithm(Encryption::AES); fil_node_t *node = space->get_file_node(&page_no); req_type.block_size(node->block_size); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 73ef4196f5d2..48a44563e494 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 144dde404368..3b2c77327dcf 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -288,14 +288,8 @@ static mysql_cond_t commit_cond; static mysql_mutex_t commit_cond_m; mysql_cond_t resume_encryption_cond; mysql_mutex_t resume_encryption_cond_m; -<<<<<<< HEAD -bool innodb_inited = false; -||||||| ce0de82d3aa -static bool innodb_inited = false; -======= os_event_t recovery_lock_taken; -static bool innodb_inited = false; ->>>>>>> mysql-8.0.33 +bool innodb_inited = false; [[maybe_unused]] static inline bool EQ_CURRENT_THD(THD *thd) { return thd == current_thd; @@ -1792,15 +1786,7 @@ static int innodb_shutdown(handlerton *, ha_panic_function) { mysql_cond_destroy(&commit_cond); mysql_mutex_destroy(&resume_encryption_cond_m); mysql_cond_destroy(&resume_encryption_cond); -<<<<<<< HEAD -||||||| ce0de82d3aa - - os_event_global_destroy(); -======= os_event_destroy(recovery_lock_taken); - - os_event_global_destroy(); ->>>>>>> mysql-8.0.33 } os_event_global_destroy(); @@ -2866,7 +2852,6 @@ bool Encryption::is_none(const char *algorithm) noexcept { return (false); } -<<<<<<< HEAD /** Check if the NO algorithm was explicitly specified. @param[in] algorithm Encryption algorithm to check @return true if no algorithm explicitly requested */ @@ -2879,39 +2864,6 @@ bool Encryption::none_explicitly_specified(bool explicit_encryption, return false; } -dberr_t Encryption::set_algorithm(const char *option, - Encryption *encryption) noexcept { - if (is_none(option)) { - encryption->m_type = NONE; - - } else if (innobase_strcasecmp(option, "y") == 0) { - encryption->m_type = AES; - - } else { - return (DB_UNSUPPORTED); - } - - return (DB_SUCCESS); -} - -||||||| ce0de82d3aa -dberr_t Encryption::set_algorithm(const char *option, - Encryption *encryption) noexcept { - if (is_none(option)) { - encryption->m_type = NONE; - - } else if (innobase_strcasecmp(option, "y") == 0) { - encryption->m_type = AES; - - } else { - return (DB_UNSUPPORTED); - } - - return (DB_SUCCESS); -} - -======= ->>>>>>> mysql-8.0.33 dberr_t Encryption::validate(const char *option) noexcept { return (is_none(option) || (innobase_strcasecmp(option, "y") == 0)) ? DB_SUCCESS @@ -22385,6 +22337,8 @@ static void innodb_sched_priority_purge_update(THD *thd, SYS_VAR *var, srv_sched_priority_purge = priority; } +extern std::atomic io_tid_i; + /** Update the innodb_sched_priority_io variable and set the thread priorities accordingly. @param[in] thd thread handle @@ -22395,7 +22349,7 @@ static void innodb_sched_priority_io_update(THD *thd, SYS_VAR *var, void *var_ptr, const void *save) { const ulint priority = *static_cast(save); - for (ulint i = 0; i < srv_n_file_io_threads; i++) { + for (ulint i = 0; i < io_tid_i.load(); i++) { const ulint actual_priority = os_thread_set_priority(srv_io_tids[i], priority); if (UNIV_UNLIKELY(actual_priority != priority)) { diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index a5edc6e0b2d3..8ecbeadc9850 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -7501,4 +7501,3 @@ struct st_mysql_plugin i_s_innodb_session_temp_tablespaces = { /* unsigned long */ STRUCT_FLD(flags, 0UL), }; - diff --git a/storage/innobase/handler/xtradb_i_s.cc b/storage/innobase/handler/xtradb_i_s.cc index b13edf49c381..2f4c42d69d5d 100644 --- a/storage/innobase/handler/xtradb_i_s.cc +++ b/storage/innobase/handler/xtradb_i_s.cc @@ -26,7 +26,6 @@ this program; if not, write to the Free Software Foundation, Inc., #include "m_ctype.h" #include "my_sys.h" #include "myisampack.h" -#include "mysql/innodb_priv.h" #include "mysys_err.h" #include "sql/sql_plugin.h" @@ -38,6 +37,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include "read0i_s.h" #include "sql/auth/auth_acls.h" #include "sql/field.h" +#include "sql/sql_show.h" /* schema_table_store_record */ #include "sql/table.h" #include "srv0start.h" /* for srv_was_started */ #include "trx0i_s.h" diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 3006854dafdb..829524ad769c 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -184,9 +184,11 @@ page_t *btr_root_get(const dict_index_t *index, /*!< in: index tree */ buffer tree @param[in,out] mtr Mini-transaction @return block */ -static inline buf_block_t *btr_block_get_func( - const page_id_t &page_id, const page_size_t &page_size, ulint mode, - ut::Location location, const dict_index_t *index, mtr_t *mtr); +static inline buf_block_t *btr_block_get_func(const page_id_t &page_id, + const page_size_t &page_size, + ulint mode, ut::Location location, + const dict_index_t *index, + mtr_t *mtr); /** Gets a buffer page and declares its latching order level. @param page_id Tablespace/page identifier @@ -201,8 +203,7 @@ static inline buf_block_t *btr_block_get(const page_id_t &page_id, ulint mode, ut::Location location, const dict_index_t *index, mtr_t *mtr) { - return btr_block_get_func(page_id, page_size, mode, location, - index, mtr); + return btr_block_get_func(page_id, page_size, mode, location, index, mtr); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index db0f10457037..ecd5516c543b 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -682,7 +682,6 @@ static inline buf_page_t *buf_page_alloc_descriptor(void) { bpage->m_space = nullptr; #ifdef UNIV_DEBUG bpage->buf_fix_count.store(0); - bpage->is_corrupt = false; #endif return (bpage); diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index 670b3725f739..687eac546016 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 959f49c7d1a8..9ba06f8cfcc5 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 410b631f5e81..ee11c19c6d7e 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1729,9 +1729,11 @@ number should be zero. @return error code @retval DB_SUCCESS on success @retval DB_TABLESPACE_DELETED if the tablespace does not exist */ -[[nodiscard]] dberr_t _fil_io(const IORequest &type, bool sync, const page_id_t &page_id, - const page_size_t &page_size, ulint byte_offset, ulint len, - void *buf, void *message, trx_t *trx, bool should_buffer); +[[nodiscard]] dberr_t _fil_io(const IORequest &type, bool sync, + const page_id_t &page_id, + const page_size_t &page_size, ulint byte_offset, + ulint len, void *buf, void *message, trx_t *trx, + bool should_buffer); #define fil_io(type, sync, page_id, page_size, byte_offset, len, buf, message) \ _fil_io(type, sync, page_id, page_size, byte_offset, len, buf, message, \ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 18dc0bac08ae..b4e37e6a5f14 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1,15 +1,7 @@ /*********************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2009, 2017, Percona Inc. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2009, Percona Inc. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. -Copyright (c) 2009, Percona Inc. ->>>>>>> mysql-8.0.33 +Copyright (c) 2009, 2017, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -535,13 +527,12 @@ class IORequest { /** Disable transformations. */ void disable_compression() { m_type |= NO_COMPRESSION; } -<<<<<<< HEAD /** Disable encryption of a page in encrypted tablespace */ void disable_encryption() noexcept { m_type |= NO_ENCRYPTION; } /** Set encryption algorithm @param[in] type The encryption algorithm to use */ - void encryption_algorithm(Encryption::Type type) { + void set_encryption_algorithm(Encryption::Type type) { if (type == Encryption::NONE) { return; } @@ -549,39 +540,6 @@ class IORequest { m_encryption.set_type(type); } - /** Set encryption key and iv - @param[in] key The encryption key to use - @param[in] key_len length of the encryption key - @param[in] iv The encryption iv to use */ - void encryption_key(const byte *key, ulint key_len, const byte *iv) { - m_encryption.set_key(key); - m_encryption.set_key_length(key_len); - m_encryption.set_initial_vector(iv); - } - -||||||| ce0de82d3aa - /** Set encryption algorithm - @param[in] type The encryption algorithm to use */ - void encryption_algorithm(Encryption::Type type) { - if (type == Encryption::NONE) { - return; - } - - m_encryption.set_type(type); - } - - /** Set encryption key and iv - @param[in] key The encryption key to use - @param[in] key_len length of the encryption key - @param[in] iv The encryption iv to use */ - void encryption_key(const byte *key, ulint key_len, const byte *iv) { - m_encryption.set_key(key); - m_encryption.set_key_length(key_len); - m_encryption.set_initial_vector(iv); - } - -======= ->>>>>>> mysql-8.0.33 /** Get the encryption algorithm. @return the encryption algorithm */ [[nodiscard]] Encryption encryption_algorithm() const { @@ -1687,8 +1645,9 @@ Requests a synchronous read operation of page 0 of IBD file. @param[in] n number of bytes to read @return DB_SUCCESS if request was successful, DB_IO_ERROR on failure */ [[nodiscard]] dberr_t os_file_read_func(IORequest &type, const char *file_name, - os_file_t file, void *buf, os_offset_t offset, - ulint n, trx_t *trx); + os_file_t file, void *buf, + os_offset_t offset, ulint n, + trx_t *trx); /** NOTE! Use the corresponding macro os_file_read_first_page(), not directly this function! @@ -1701,9 +1660,9 @@ Requests a synchronous read operation of page 0 of IBD file @param[in] exit_on_err if true then exit on error @return DB_SUCCESS if request was successful, DB_IO_ERROR on failure */ [[nodiscard]] dberr_t os_file_read_first_page_func(IORequest &type, - const char *file_name, - os_file_t file, void *buf, - ulint n, bool exit_on_err); + const char *file_name, + os_file_t file, void *buf, + ulint n, bool exit_on_err); /** Copy data from one file to another file. Data is read/written at current file offset. diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 7b4b7fc68c64..653a305dbe52 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -650,7 +650,6 @@ extern ulint srv_show_locks_held; extern ulint srv_lock_table_size; -<<<<<<< HEAD extern ulint srv_cleaner_max_lru_time; /*!< the maximum time limit for a single LRU tail flush iteration by the page cleaner thread */ @@ -667,11 +666,6 @@ extern ulong srv_empty_free_list_algorithm; /*!< Empty free list for a query thread handling algorithm option */ -extern ulint srv_n_file_io_threads; -||||||| ce0de82d3aa -extern ulint srv_n_file_io_threads; -======= ->>>>>>> mysql-8.0.33 extern bool srv_random_read_ahead; extern ulong srv_read_ahead_threshold; extern ulong srv_n_read_io_threads; diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index e9c0769c2f0c..9de6eb48a771 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1529,8 +1529,8 @@ inline void trx_stats::bump_io_read(trx_t *trx, ulint n) noexcept { if (UNIV_LIKELY_NULL(trx)) bump_io_read(*trx, n); } -inline void trx_stats::bump_innodb_enter_wait(const trx_t &trx, ulint us) const - noexcept { +inline void trx_stats::bump_innodb_enter_wait(const trx_t &trx, + ulint us) const noexcept { if (UNIV_LIKELY(!take_stats)) return; thd_report_innodb_stat(trx.mysql_thd, trx.id, MYSQL_TRX_STAT_INNODB_QUEUE_WAIT_USECS, us); @@ -1546,8 +1546,7 @@ inline void trx_stats::stop_lock_wait(const trx_t &trx) noexcept { #pragma GCC diagnostic ignored "-Wunknown-warning-option" #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #pragma GCC diagnostic ignored "-Wuninitialized" - ut_d(lock_que_wait_ustarted = - std::chrono::steady_clock::time_point{}); + ut_d(lock_que_wait_ustarted = std::chrono::steady_clock::time_point{}); #pragma GCC diagnostic pop } diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index a89096b9c863..04d0f9fb6716 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -55,7 +55,7 @@ this program; if not, write to the Free Software Foundation, Inc., #define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 24 +#define PERCONA_INNODB_VERSION 25 #endif /* The following is the InnoDB version as shown in diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index b51d42cc2bce..4a7aa5e6f183 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 2014, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 2014, 2022, Oracle and/or its affiliates. -======= Copyright (c) 2014, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 4a9a9b6f92b7..3a2a521e2512 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3897,43 +3897,7 @@ MetadataRecover *recv_recovery_from_checkpoint_finish(bool aborting) { /* Now wait for currently in progress batches to finish. */ buf_flush_wait_LRU_batch_end(); -<<<<<<< HEAD - MetadataRecover *metadata; -||||||| ce0de82d3aa - mutex_exit(&recv_sys->writer_mutex); - - uint32_t count = 0; - - while (recv_writer_is_active()) { - ++count; - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - if (count >= 600) { - ib::info(ER_IB_MSG_738); - count = 0; - } - } - - MetadataRecover *metadata; -======= - mutex_exit(&recv_sys->writer_mutex); - - uint32_t count = 0; - - while (recv_writer_is_active()) { - ++count; - - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - if (count >= 600) { - ib::info(ER_IB_MSG_738); - count = 0; - } - } - MetadataRecover *metadata{}; ->>>>>>> mysql-8.0.33 if (!aborting) { std::swap(metadata, recv_sys->metadata_recover); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 5e150490ba67..a66264c9e7ce 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1,15 +1,7 @@ /*********************************************************************** -<<<<<<< HEAD -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2009, 2016, Percona Inc. -||||||| ce0de82d3aa -Copyright (c) 1995, 2022, Oracle and/or its affiliates. -Copyright (c) 2009, Percona Inc. -======= Copyright (c) 1995, 2023, Oracle and/or its affiliates. -Copyright (c) 2009, Percona Inc. ->>>>>>> mysql-8.0.33 +Copyright (c) 2009, 2016, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -6603,11 +6595,23 @@ bool AIO::start(ulint n_per_seg, ulint n_readers, ulint n_writers) { return true; } +std::atomic io_tid_i(0); + /** I/o-handler thread function. @param[in] segment The AIO segment the thread will work on */ static void io_handler_thread(ulint segment) { + const auto tid_i = io_tid_i.fetch_add(1, std::memory_order_relaxed); + srv_io_tids[tid_i] = os_thread_get_tid(); + const auto actual_priority = + os_thread_set_priority(srv_io_tids[tid_i], srv_sched_priority_io); + if (UNIV_UNLIKELY(actual_priority != srv_sched_priority_purge)) + ib::warn() << "Failed to set I/O thread priority to " + << srv_sched_priority_master << " the current priority is " + << actual_priority; + while (srv_shutdown_state.load() != SRV_SHUTDOWN_EXIT_THREADS || - buf_flush_page_cleaner_is_active() || !os_aio_all_slots_free()) { + buf_flush_page_cleaner_is_active() || !os_aio_all_slots_free() || + buf_flush_active_lru_managers() > 0) { fil_aio_wait(segment); } } @@ -6899,14 +6903,8 @@ ulint AIO::get_segment_no_from_slot(const AIO *array, const Slot *slot) { Slot *AIO::reserve_slot(IORequest &type, fil_node_t *m1, void *m2, pfs_os_file_t file, const char *name, void *buf, os_offset_t offset, ulint len, -<<<<<<< HEAD const file::Block *e_block, space_id_t space_id) { -||||||| ce0de82d3aa - const file::Block *e_block) { -======= - const file::Block *e_block) { ut_a(!type.is_log()); ->>>>>>> mysql-8.0.33 #ifdef WIN_ASYNC_IO ut_a((len & 0xFFFFFFFFUL) == len); #endif /* WIN_ASYNC_IO */ @@ -7358,15 +7356,9 @@ static dberr_t os_aio_windows_handler(ulint segment, fil_node_t **m1, void **m2, dberr_t os_aio_func(IORequest &type, AIO_mode aio_mode, const char *name, pfs_os_file_t file, void *buf, os_offset_t offset, ulint n, -<<<<<<< HEAD bool read_only, fil_node_t *m1, void *m2, space_id_t space_id, trx_t *trx, bool should_buffer) { -||||||| ce0de82d3aa - bool read_only, fil_node_t *m1, void *m2) { -======= - bool read_only, fil_node_t *m1, void *m2) { ut_a(!type.is_log()); ->>>>>>> mysql-8.0.33 #ifdef WIN_ASYNC_IO BOOL ret = TRUE; #endif /* WIN_ASYNC_IO */ diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index 800d3e88756f..c04731a274b2 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -124,7 +124,7 @@ returns tid. On other systems currently returns os_thread_get_curr_id(). @return current thread identifier */ os_tid_t os_thread_get_tid() noexcept { -#if defined(HAVE_PTHREAD_THREADID_NP) // macOS +#if defined(HAVE_PTHREAD_THREADID_NP) // macOS uint64_t tid64; pthread_threadid_np(nullptr, &tid64); return (os_tid_t)tid64; diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index 404359c20c7b..ad6c34925df9 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1072,19 +1072,13 @@ static rec_t *rec_convert_dtuple_to_rec_new(byte *buf, &extra_size); rec = buf + extra_size; -<<<<<<< HEAD #ifdef UNIV_DEBUG /* Suppress Valgrind warnings in mach_read_from_1() called from * rec_set_bit_field_1() */ mach_write_to_1(rec - REC_NEW_INFO_BITS, 0xFF); #endif /* UNIV_DEBUG */ - bool instant = rec_convert_dtuple_to_rec_comp( -||||||| ce0de82d3aa - bool instant = rec_convert_dtuple_to_rec_comp( -======= auto rec_state = rec_convert_dtuple_to_rec_comp( ->>>>>>> mysql-8.0.33 rec, index, dtuple->fields, dtuple->n_fields, nullptr, status, false, index->table->current_row_version); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index e92956c1c1bd..f098799ea059 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -4393,15 +4393,7 @@ dberr_t row_import_for_mysql(dict_table_t *table, dd::Table *table_def, /* Prevent DDL operations while we are checking. */ rw_lock_s_lock_func(dict_operation_lock, 0, UT_LOCATION_HERE); -<<<<<<< HEAD - row_import cfg; -||||||| ce0de82d3aa - row_import cfg; - ulint space_flags = 0; -======= row_import cfg{}; - ulint space_flags = 0; ->>>>>>> mysql-8.0.33 /* Read CFP file */ if (dd_is_table_in_encrypted_tablespace(table)) { diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 8520fed11f2a..e4aa0dfa6ba0 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -199,7 +199,7 @@ struct row_log_t { is being created online */ dict_table_t *table; - /** index to be built */ + /** index to be built */ dict_index_t *index; /** Whether the definition of the PRIMARY KEY has remained the same */ @@ -229,7 +229,7 @@ struct row_log_t { row_log_apply_ops() */ row_log_buf_t head; - /** reader context; temporary buffer used in encryption, decryption or NULL */ + /** reader context; temporary buffer used in encryption, decryption or NULL */ byte *crypt_head; /** number of non-virtual column in old table */ diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 8ae798075baa..86afd88340f4 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -3713,8 +3713,7 @@ static ulint row_sel_try_search_shortcut_for_mysql( ut_ad(trx->has_search_latch); pcur->open_no_init(index, search_tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, - RW_S_LATCH, mtr, - UT_LOCATION_HERE); + RW_S_LATCH, mtr, UT_LOCATION_HERE); rec = pcur->get_rec(); if (!page_rec_is_user_rec(rec)) { diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 9d43bd82c231..62827a94b736 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1701,14 +1701,6 @@ void srv_export_innodb_status(void) { export_vars.innodb_data_pending_writes = os_n_pending_writes; export_vars.innodb_data_pending_fsyncs = -<<<<<<< HEAD - log_pending_flushes() + fil_n_pending_tablespace_flushes; - export_vars.innodb_adaptive_hash_hash_searches = btr_cur_n_sea; - export_vars.innodb_adaptive_hash_non_hash_searches = btr_cur_n_non_sea; - export_vars.innodb_background_log_sync = srv_log_writes_and_flush; -||||||| ce0de82d3aa - log_pending_flushes() + fil_n_pending_tablespace_flushes; -======= log_pending_flushes() + fil_n_pending_tablespace_flushes.load(); // Check against unsigned underflow in debug - values close to max value @@ -1716,7 +1708,10 @@ void srv_export_innodb_status(void) { // on failure ut_ad(export_vars.innodb_data_pending_fsyncs <= std::numeric_limits::max() - 1000); ->>>>>>> mysql-8.0.33 + + export_vars.innodb_adaptive_hash_hash_searches = btr_cur_n_sea; + export_vars.innodb_adaptive_hash_non_hash_searches = btr_cur_n_non_sea; + export_vars.innodb_background_log_sync = srv_log_writes_and_flush; export_vars.innodb_data_fsyncs = os_n_fsyncs; @@ -2803,7 +2798,8 @@ void undo_rotate_default_master_key() { space = fil_space_get(undo_space->id()); - if (space == nullptr || space->m_encryption_metadata.m_type != Encryption::AES) { + if (space == nullptr || + space->m_encryption_metadata.m_type != Encryption::AES) { continue; } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 530a2622b782..c34036f965ed 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -218,41 +218,6 @@ or other policy for timed out wait is applied. */ static constexpr uint32_t SHUTDOWN_SLEEP_ROUNDS = 60 * 1000 * 1000 / SHUTDOWN_SLEEP_TIME_US; -<<<<<<< HEAD -static std::atomic io_tid_i(0); - -/** I/o-handler thread function. -@param[in] segment The AIO segment the thread will work on */ -static void io_handler_thread(ulint segment) { - const auto tid_i = io_tid_i.fetch_add(1, std::memory_order_relaxed); - ut_ad(tid_i < srv_n_file_io_threads); - srv_io_tids[tid_i] = os_thread_get_tid(); - const auto actual_priority = - os_thread_set_priority(srv_io_tids[tid_i], srv_sched_priority_io); - if (UNIV_UNLIKELY(actual_priority != srv_sched_priority_purge)) - ib::warn() << "Failed to set I/O thread priority to " - << srv_sched_priority_master << " the current priority is " - << actual_priority; - - while (srv_shutdown_state.load() != SRV_SHUTDOWN_EXIT_THREADS || - buf_flush_page_cleaner_is_active() || !os_aio_all_slots_free() || - buf_flush_active_lru_managers() > 0) { - fil_aio_wait(segment); - } -} - -||||||| ce0de82d3aa -/** I/o-handler thread function. -@param[in] segment The AIO segment the thread will work on */ -static void io_handler_thread(ulint segment) { - while (srv_shutdown_state.load() != SRV_SHUTDOWN_EXIT_THREADS || - buf_flush_page_cleaner_is_active() || !os_aio_all_slots_free()) { - fil_aio_wait(segment); - } -} - -======= ->>>>>>> mysql-8.0.33 /** Create undo tablespace. @param[in] undo_space Undo Tablespace @return DB_SUCCESS or error code */ @@ -1543,67 +1508,11 @@ static dberr_t srv_init_abort_low(bool create_new_db, return (err); } -<<<<<<< HEAD -/** Enable encryption of system tablespace if requested. At -startup load the encryption information from first datafile -to tablespace object -@return DB_SUCCESS on succes, others on failure */ -static dberr_t srv_sys_enable_encryption(bool create_new_db) { - fil_space_t *space = fil_space_get(TRX_SYS_SPACE); - dberr_t err = DB_SUCCESS; - - if (create_new_db && srv_sys_tablespace_encrypt) { - fsp_flags_set_encryption(space->flags); - srv_sys_space.set_flags(space->flags); - - err = fil_set_encryption(space->id, Encryption::AES, nullptr, nullptr); - ut_ad(err == DB_SUCCESS); - } else { - const auto fsp_flags = srv_sys_space.m_files.begin()->flags(); - const bool is_encrypted = FSP_FLAGS_GET_ENCRYPTION(fsp_flags); - - if (is_encrypted && !srv_sys_tablespace_encrypt) { - ib::error() << "The system tablespace is encrypted but" - << " --innodb_sys_tablespace_encrypt is" - << " OFF. Enable the option and start server"; - return (DB_ERROR); - } - - if (!is_encrypted && srv_sys_tablespace_encrypt) { - ib::error() << "The system tablespace is not encrypted but" - << " --innodb_sys_tablespace_encrypt is" - << " ON. This instance was not bootstrapped" - << " with --innodb_sys_tablespace_encrypt=ON." - << " Disable this option and start server"; - return (DB_ERROR); - } - - if (is_encrypted) { - fsp_flags_set_encryption(space->flags); - srv_sys_space.set_flags(space->flags); - - err = fil_set_encryption(space->id, Encryption::AES, - srv_sys_space.m_files.begin()->m_encryption_key, - srv_sys_space.m_files.begin()->m_encryption_iv); - ut_ad(err == DB_SUCCESS); - } - } - - return (err); -} - -dberr_t srv_start(bool create_new_db) { - lsn_t flushed_lsn; -||||||| ce0de82d3aa -dberr_t srv_start(bool create_new_db) { - lsn_t flushed_lsn; -======= /** Recreate REDO log files. @param[in,out] flushed_lsn flushed_lsn @return DB_SUCCESS or error code */ static dberr_t recreate_redo_files(lsn_t &flushed_lsn) { ut_d(log_sys->disable_redo_writes = true); ->>>>>>> mysql-8.0.33 /* Emit a message to the error log. */ const auto target_size = log_sys->m_capacity.target_physical_capacity(); @@ -1653,6 +1562,54 @@ static dberr_t recreate_redo_files(lsn_t &flushed_lsn) { return DB_SUCCESS; } +/** Enable encryption of system tablespace if requested. At +startup load the encryption information from first datafile +to tablespace object +@return DB_SUCCESS on succes, others on failure */ +static dberr_t srv_sys_enable_encryption(bool create_new_db) { + fil_space_t *space = fil_space_get(TRX_SYS_SPACE); + dberr_t err = DB_SUCCESS; + + if (create_new_db && srv_sys_tablespace_encrypt) { + fsp_flags_set_encryption(space->flags); + srv_sys_space.set_flags(space->flags); + + err = fil_set_encryption(space->id, Encryption::AES, nullptr, nullptr); + ut_ad(err == DB_SUCCESS); + } else { + const auto fsp_flags = srv_sys_space.m_files.begin()->flags(); + const bool is_encrypted = FSP_FLAGS_GET_ENCRYPTION(fsp_flags); + + if (is_encrypted && !srv_sys_tablespace_encrypt) { + ib::error() << "The system tablespace is encrypted but" + << " --innodb_sys_tablespace_encrypt is" + << " OFF. Enable the option and start server"; + return (DB_ERROR); + } + + if (!is_encrypted && srv_sys_tablespace_encrypt) { + ib::error() << "The system tablespace is not encrypted but" + << " --innodb_sys_tablespace_encrypt is" + << " ON. This instance was not bootstrapped" + << " with --innodb_sys_tablespace_encrypt=ON." + << " Disable this option and start server"; + return (DB_ERROR); + } + + if (is_encrypted) { + fsp_flags_set_encryption(space->flags); + srv_sys_space.set_flags(space->flags); + + err = fil_set_encryption(space->id, Encryption::AES, + srv_sys_space.m_files.begin()->m_encryption_key, + srv_sys_space.m_files.begin()->m_encryption_iv); + ut_ad(err == DB_SUCCESS); + } + } + + return (err); +} + dberr_t srv_start(bool create_new_db) { page_no_t sum_of_data_file_sizes; page_no_t tablespace_size_in_header; @@ -2652,33 +2609,9 @@ void srv_start_threads() { return; } -<<<<<<< HEAD - if (!bootstrap && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO && - trx_sys_need_rollback()) { - /* Rollback all recovered transactions that are - not in committed nor in XA PREPARE state. */ - srv_threads.m_trx_recovery_rollback = os_thread_create( - trx_recovery_rollback_thread_key, 0, trx_recovery_rollback_thread); - - srv_threads.m_trx_recovery_rollback.start(); - } - /* Enable row log encryption if it is set */ log_tmp_enable_encryption_if_set(); -||||||| ce0de82d3aa - if (!bootstrap && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO && - trx_sys_need_rollback()) { - /* Rollback all recovered transactions that are - not in committed nor in XA PREPARE state. */ - srv_threads.m_trx_recovery_rollback = os_thread_create( - trx_recovery_rollback_thread_key, 0, trx_recovery_rollback_thread); - - srv_threads.m_trx_recovery_rollback.start(); - } - -======= ->>>>>>> mysql-8.0.33 /* Create the master thread which does purge and other utility operations */ srv_threads.m_master = diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 1b8991d2fabb..d8da90fd1d04 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1289,8 +1289,10 @@ static void trx_assign_id_for_rw(trx_t *trx) { if (trx->preallocated_id) { // preallocated_id might not be received in ascending order, - // so we need to maintain ordering in rw_trx_ids and update min_active_trx_id - auto upper_bound_it = std::upper_bound(trx_sys->rw_trx_ids.begin(), trx_sys->rw_trx_ids.end(), trx->id); + // so we need to maintain ordering in rw_trx_ids and update + // min_active_trx_id + auto upper_bound_it = std::upper_bound(trx_sys->rw_trx_ids.begin(), + trx_sys->rw_trx_ids.end(), trx->id); trx_sys->rw_trx_ids.insert(upper_bound_it, trx->id); } else { // The id is known to be greatest diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index a2d4979d06c7..ccbde0fb2c4f 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -2112,7 +2112,8 @@ bool trx_undo_truncate_tablespace(undo::Tablespace *marked_space) { /* If tablespace is to be encrypted, encrypt it now */ if (is_encrypted && srv_undo_log_encrypt) { - ut_d(bool ret =) set_undo_tablespace_encryption(nullptr, new_space_id, &mtr); + ut_d(bool ret =) + set_undo_tablespace_encryption(nullptr, new_space_id, &mtr); /* Don't expect any error here (unless keyring plugin is uninstalled). In that case too, continue truncation processing of tablespace. */ ut_ad(!ret); diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc index a54127b5ff86..9633caf60846 100644 --- a/storage/innobase/ut/ut0new.cc +++ b/storage/innobase/ut/ut0new.cc @@ -1,13 +1,7 @@ /***************************************************************************** -<<<<<<< HEAD -Copyright (c) 2014, 2022, Oracle and/or its affiliates. -Copyright (c) 2016, Percona Inc. All Rights Reserved. -||||||| ce0de82d3aa -Copyright (c) 2014, 2022, Oracle and/or its affiliates. -======= Copyright (c) 2014, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 +Copyright (c) 2016, Percona Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the diff --git a/storage/myisam/mi_cache.cc b/storage/myisam/mi_cache.cc index d21da97da243..f3f5c746704a 100644 --- a/storage/myisam/mi_cache.cc +++ b/storage/myisam/mi_cache.cc @@ -1,11 +1,5 @@ -<<<<<<< HEAD -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. - Copyright (c) 2018, Percona and/or its affiliates. -||||||| ce0de82d3aa -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= /* Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2018, Percona and/or its affiliates. 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, diff --git a/storage/myisam/sort.cc b/storage/myisam/sort.cc index f9ad20f4eff3..b4e3e9b7c639 100644 --- a/storage/myisam/sort.cc +++ b/storage/myisam/sort.cc @@ -1,11 +1,5 @@ -<<<<<<< HEAD -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. - Copyright (c) 2018, Percona and/or its affiliates. -||||||| ce0de82d3aa -/* Copyright (c) 2000, 2022, Oracle and/or its affiliates. -======= /* Copyright (c) 2000, 2023, Oracle and/or its affiliates. ->>>>>>> mysql-8.0.33 + Copyright (c) 2018, Percona and/or its affiliates. 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, diff --git a/storage/ndb/CMakeLists.txt b/storage/ndb/CMakeLists.txt index 35e725f88a65..89f9b09c532c 100644 --- a/storage/ndb/CMakeLists.txt +++ b/storage/ndb/CMakeLists.txt @@ -20,6 +20,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# older gcc doesn't support "#include " +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.1) + MESSAGE(WARNING "Skips building NDB for gcc older than 8.1") + RETURN() +ENDIF() + # Add both MySQL and NDB cmake repositories to search path SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake diff --git a/storage/ndb/test/src/UtilTransactions.cpp b/storage/ndb/test/src/UtilTransactions.cpp index f7fbd9eba2ab..3d79cb5b5314 100644 --- a/storage/ndb/test/src/UtilTransactions.cpp +++ b/storage/ndb/test/src/UtilTransactions.cpp @@ -1578,316 +1578,10 @@ UtilTransactions::verifyTableReplicasWithSource(Ndb* pNdb, Uint32 sourceNodeId) while (true){ -<<<<<<< HEAD - if (retryAttempt >= retryMax){ - g_err << "ERROR: has retried this operation " << retryAttempt - << " times, failing!, line: " << __LINE__ << endl; - return NDBT_FAILED; - } - pTrans = pNdb->startTransaction(sourceNodeId, 0); - if (pTrans == NULL) { - const NdbError err = pNdb->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - return NDBT_FAILED; - } - if (sourceNodeId && pTrans->getConnectedNodeId() != sourceNodeId) - { - g_err << "Transaction requested on node " << sourceNodeId - << " but running on node " << pTrans->getConnectedNodeId() - << " continuing..." << endl; - } - - /* Scan table */ - pOp = pTrans->getNdbScanOperation(tab.getName()); - - if (pOp == NULL) { - NDB_ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - if( pOp->readTuples(NdbScanOperation::LM_Read) ) { - NDB_ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - if(get_values(pOp, scanRow)) - { - abort(); - } - - check = pTrans->execute(NoCommit, AbortOnError); - if( check == -1 ) { - const NdbError err = pTrans->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - closeTransaction(pNdb); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - int eof = 0; - int rows = 0; - int checks = 0; - int mismatchRows = 0; - int mismatchReplicas = 0; - while(check == 0 && (eof = pOp->nextResult()) == 0){ - rows++; - NdbTransaction* nodeTrans = NULL; - - int mismatches = 0; - for (Uint32 n=0; n < numDataNodes; n++) - { - nodeTrans = pNdb->startTransaction(dataNodes[n], 0); - if (nodeTrans->getConnectedNodeId() != dataNodes[n]) - { - g_err << "Tried to start transaction on node " << dataNodes[n] - << " but started on node " << nodeTrans->getConnectedNodeId() << endl; - closeTransaction(pNdb); - return NDBT_FAILED; - } - - // Do pk lookup using simpleRead - NdbOperation * pk = nodeTrans->getNdbOperation(tab.getName()); - if(!pk || pk->simpleRead()) - goto lookuperror; - if(equal(&tab, pk, scanRow) || get_values(pk, pkRow)) - goto lookuperror; - - check = nodeTrans->execute(Commit, AbortOnError); - if(check) - { - goto lookuperror; - } - - if(scanRow.c_str() != pkRow.c_str()){ - g_err << "Error when comparing records" << endl; - g_err << " scanRow (from node " - << pTrans->getConnectedNodeId() - << ") : \n" << scanRow.c_str().c_str() << endl; - g_err << " pkRow from node " << dataNodes[n] << " : \n" - << pkRow.c_str().c_str() << endl; - mismatches++; - } - else - { - //g_err << "Pk ok" << endl; - } - - nodeTrans->close(); - continue; - lookuperror: - const NdbError err = nodeTrans->getNdbError(); - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - nodeTrans->close(); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - nodeTrans->close(); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - checks += numDataNodes; - mismatchReplicas += mismatches; - if (mismatches) - mismatchRows++; - } // while 'pOp->nextResult()' - - pOp->close(); - pOp = NULL; - if (eof == -1 || check == -1) { - const NdbError err = pTrans->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - iop = 0; - closeTransaction(pNdb); - NdbSleep_MilliSleep(50); - retryAttempt++; - rows--; - continue; - } - NDB_ERR(err); - closeTransaction(pNdb); - return NDBT_FAILED; - } - -||||||| ce0de82d3aa - if (retryAttempt >= retryMax){ - g_err << "ERROR: has retried this operation " << retryAttempt - << " times, failing!, line: " << __LINE__ << endl; - return NDBT_FAILED; - } - pTrans = pNdb->startTransaction(sourceNodeId, 0); - if (pTrans == NULL) { - const NdbError err = pNdb->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - return NDBT_FAILED; - } - if (sourceNodeId && pTrans->getConnectedNodeId() != sourceNodeId) - { - g_err << "Transaction requested on node " << sourceNodeId - << " but running on node " << pTrans->getConnectedNodeId() - << " continuing..." << endl; - } - - /* Scan table */ - pOp = pTrans->getNdbScanOperation(tab.getName()); - - if (pOp == NULL) { - NDB_ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - if( pOp->readTuples(NdbScanOperation::LM_Read) ) { - NDB_ERR(pTrans->getNdbError()); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - if(get_values(pOp, scanRow)) - { - abort(); - } - - check = pTrans->execute(NoCommit, AbortOnError); - if( check == -1 ) { - const NdbError err = pTrans->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - closeTransaction(pNdb); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - int eof; - int rows = 0; - int checks = 0; - int mismatchRows = 0; - int mismatchReplicas = 0; - while(check == 0 && (eof = pOp->nextResult()) == 0){ - rows++; - NdbTransaction* nodeTrans = NULL; - - int mismatches = 0; - for (Uint32 n=0; n < numDataNodes; n++) - { - nodeTrans = pNdb->startTransaction(dataNodes[n], 0); - if (nodeTrans->getConnectedNodeId() != dataNodes[n]) - { - g_err << "Tried to start transaction on node " << dataNodes[n] - << " but started on node " << nodeTrans->getConnectedNodeId() << endl; - closeTransaction(pNdb); - return NDBT_FAILED; - } - - // Do pk lookup using simpleRead - NdbOperation * pk = nodeTrans->getNdbOperation(tab.getName()); - if(!pk || pk->simpleRead()) - goto lookuperror; - if(equal(&tab, pk, scanRow) || get_values(pk, pkRow)) - goto lookuperror; - - check = nodeTrans->execute(Commit, AbortOnError); - if(check) - { - goto lookuperror; - } - - if(scanRow.c_str() != pkRow.c_str()){ - g_err << "Error when comparing records" << endl; - g_err << " scanRow (from node " - << pTrans->getConnectedNodeId() - << ") : \n" << scanRow.c_str().c_str() << endl; - g_err << " pkRow from node " << dataNodes[n] << " : \n" - << pkRow.c_str().c_str() << endl; - mismatches++; - } - else - { - //g_err << "Pk ok" << endl; - } - - nodeTrans->close(); - continue; - lookuperror: - const NdbError err = nodeTrans->getNdbError(); - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - nodeTrans->close(); - NdbSleep_MilliSleep(50); - retryAttempt++; - continue; - } - NDB_ERR(err); - nodeTrans->close(); - closeTransaction(pNdb); - return NDBT_FAILED; - } - - checks += numDataNodes; - mismatchReplicas += mismatches; - if (mismatches) - mismatchRows++; - } // while 'pOp->nextResult()' - - pOp->close(); - pOp = NULL; - if (eof == -1 || check == -1) { - const NdbError err = pTrans->getNdbError(); - - if (err.status == NdbError::TemporaryError){ - NDB_ERR(err); - iop = 0; - closeTransaction(pNdb); - NdbSleep_MilliSleep(50); - retryAttempt++; - rows--; - continue; - } - NDB_ERR(err); - closeTransaction(pNdb); - return NDBT_FAILED; - } - -======= const int result = verifyTableReplicasScanAndCompareNodes(pNdb, sourceNodeId, numDataNodes, dataNodes); ->>>>>>> mysql-8.0.33 closeTransaction(pNdb); if (result != NDBT_TEMPORARY) { diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index f17ba1c37a48..99fa4cd8dff0 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -9301,6 +9301,9 @@ PSI_thread_service_v7 pfs_thread_service_v7 = { pfs_set_thread_command_vc, pfs_set_connection_type_vc, pfs_set_thread_start_time_vc, + pfs_set_thread_start_time_usec_vc, + pfs_set_thread_rows_sent_vc, + pfs_set_thread_rows_examined_vc, pfs_set_thread_info_vc, pfs_set_thread_secondary_engine_vc, pfs_set_thread_resource_group_vc, @@ -9343,6 +9346,9 @@ SERVICE_IMPLEMENTATION(performance_schema, psi_thread_v7) = { pfs_set_thread_command_vc, pfs_set_connection_type_vc, pfs_set_thread_start_time_vc, + pfs_set_thread_start_time_usec_vc, + pfs_set_thread_rows_sent_vc, + pfs_set_thread_rows_examined_vc, pfs_set_thread_info_vc, pfs_set_thread_secondary_engine_vc, pfs_set_thread_vc, diff --git a/storage/perfschema/pfs_variable.cc b/storage/perfschema/pfs_variable.cc index ca9f8d91ee9a..b143def9c0b0 100644 --- a/storage/perfschema/pfs_variable.cc +++ b/storage/perfschema/pfs_variable.cc @@ -1247,15 +1247,9 @@ int PFS_status_variable_cache::do_materialize_all(THD *unsafe_thd) { /* Get and lock a validated THD from the thread manager. */ THD_ptr thd_ptr = get_THD(unsafe_thd); -<<<<<<< HEAD - if ((m_safe_thd = thd_ptr.get()) != nullptr) { - DEBUG_SYNC(m_current_thd, "materialize_session_status_array_THD_locked"); -||||||| ce0de82d3aa - if ((m_safe_thd = thd_ptr.get()) != nullptr) { -======= m_safe_thd = thd_ptr.get(); if (m_safe_thd != nullptr) { ->>>>>>> mysql-8.0.33 + DEBUG_SYNC(m_current_thd, "materialize_session_status_array_THD_locked"); /* Build the status variable cache using the SHOW_VAR array as a reference. Use the status values from the THD protected by the thread manager lock. diff --git a/storage/perfschema/table_log_status.cc b/storage/perfschema/table_log_status.cc index 4b1459cf0345..9d79114ef1e3 100644 --- a/storage/perfschema/table_log_status.cc +++ b/storage/perfschema/table_log_status.cc @@ -225,18 +225,10 @@ int table_log_status::make_row() { */ { Log_resource *res; -<<<<<<< HEAD res = Log_resource_factory::get_wrapper(gtid_state, &mysql_bin_log, &json_local); - if ((error = DBUG_EVALUATE_IF("log_status_oom_gtid", 1, !res))) { -||||||| ce0de82d3aa - res = Log_resource_factory::get_wrapper(gtid_state, &json_local); - if ((error = DBUG_EVALUATE_IF("log_status_oom_gtid", 1, !res))) { -======= - res = Log_resource_factory::get_wrapper(gtid_state, &json_local); error = DBUG_EVALUATE_IF("log_status_oom_gtid", 1, !res); if (error) { ->>>>>>> mysql-8.0.33 my_error(ER_UNABLE_TO_COLLECT_LOG_STATUS, MYF(0), "LOCAL", "failed to allocate memory to collect " "gtid_executed information"); diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 7bdb6b1e7ce3..59d27355006f 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -373,7 +373,7 @@ IF(HAVE_EXTERNAL_ROCKSDB) SET(rocksdb_static_libs ${rocksdb_static_libs} "${ROCKSDB_LIB_PATH}/${ROCKSDB_LIB_NAME}") ENDIF() -SET(rocksdb_static_libs ${rocksdb_static_libs} ${ZLIB_LIBRARY} ${ZSTD_LIBRARY} ${LZ4_LIBRARY} "-ldl" ${PLUGIN_LD}) +SET(rocksdb_static_libs ${rocksdb_static_libs} ext::zlib ext::zstd ext::lz4 extra::rapidjson "-ldl" ${PLUGIN_LD}) IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt") ENDIF() diff --git a/testclients/CMakeLists.txt b/testclients/CMakeLists.txt index 084e9333e5a8..a7714869fe5e 100644 --- a/testclients/CMakeLists.txt +++ b/testclients/CMakeLists.txt @@ -23,13 +23,7 @@ ADD_WSHADOW_WARNING() MYSQL_ADD_EXECUTABLE(mysql_client_test mysql_client_test.cc COMPONENT Test) -<<<<<<< HEAD -TARGET_LINK_LIBRARIES(mysql_client_test perconaserverclient) -||||||| ce0de82d3aa -TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient) -======= -TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient extra::rapidjson) ->>>>>>> mysql-8.0.33 +TARGET_LINK_LIBRARIES(mysql_client_test perconaserverclient extra::rapidjson) IF(WITH_UNIT_TESTS) MYSQL_ADD_EXECUTABLE(bug25714 bug25714.cc SKIP_INSTALL) diff --git a/unittest/gunit/keyring/keys_container-t.cc b/unittest/gunit/keyring/keys_container-t.cc deleted file mode 100644 index 3d9f67cfd66a..000000000000 --- a/unittest/gunit/keyring/keys_container-t.cc +++ /dev/null @@ -1,1482 +0,0 @@ -/* Copyright (c) 2016, 2023, Oracle and/or its affiliates. - - 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 -#include -#include -#include - -#include "my_inttypes.h" -#include "plugin/keyring/buffered_file_io.h" -#include "plugin/keyring/common/i_serialized_object.h" -#include "plugin/keyring/common/keys_container.h" -#include "unittest/gunit/keyring/buffered_file_io_10.h" -#include "unittest/gunit/keyring/mock_logger.h" - -namespace keyring__keys_container_unittest { -using namespace keyring; -using ::testing::_; -using ::testing::DoAll; -using ::testing::InSequence; -using ::testing::Return; -using ::testing::SetArgPointee; -using ::testing::StrEq; - -bool check_if_file_exists_and_TAG_is_correct(const char *file_name) { - char tag[4]; - std::fstream file; - - file.open(file_name, std::fstream::in | std::fstream::binary); - if (!file.is_open()) return false; - file.seekg(0, file.end); - if (file.tellg() < (3 + 32)) // tag + sha256 - return false; // File do not contains tag - file.seekg(-(3 + 32), file.end); - if (file.good() == false) return false; - file.read(tag, 3); - size_t chars_read = file.gcount(); - if (file.good() == false || chars_read < 3) return false; - tag[3] = '\0'; - file.close(); - return strcmp(tag, "EOF") == 0; -} - -class Keys_container_test : public ::testing::Test { - public: - Keys_container_test() : file_name("./keyring") {} - - protected: - void SetUp() override { - sample_key_data = "Robi"; - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - - remove(file_name.c_str()); - remove("./keyring.backup"); - - logger = new Mock_logger(); - keys_container = new Keys_container(logger); - } - void TearDown() override { - remove(file_name.c_str()); - delete keys_container; - delete logger; - } - void create_keyring_file(const char *file_name, const char *keyring_buffer); - void generate_keyring_file_with_correct_ver_1_0_structure( - const char *file_name); - void generate_keyring_file_with_correct_ver_2_0_structure( - const char *file_name); - void generate_keyring_file_with_incorrect_file_version(const char *file_name); - void generate_keyring_file_with_incorrect_TAG(const char *file_name); - - protected: - Keys_container *keys_container; - ILogger *logger; - Key *sample_key; - std::string sample_key_data; - std::string file_name; -}; - -void Keys_container_test::create_keyring_file(const char *file_name, - const char *keyring_buffer) { - std::fstream file; - file.open(file_name, - std::fstream::out | std::fstream::binary | std::fstream::trunc); - ASSERT_TRUE(file.is_open()); - file.write(keyring_buffer, strlen(keyring_buffer)); - file.close(); -} - -void Keys_container_test::generate_keyring_file_with_correct_ver_1_0_structure( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:1.0EOF"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_correct_ver_2_0_structure( - const char *file_name) { - static const char *keyring_buffer = - "Keyring file version:2.0EOF" - "01234567890123456789012345678901"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_incorrect_file_version( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:3.0EOF"; - create_keyring_file(file_name, keyring_buffer); -} - -void Keys_container_test::generate_keyring_file_with_incorrect_TAG( - const char *file_name) { - static const char *keyring_buffer = "Keyring file version:2.0EF"; - create_keyring_file(file_name, keyring_buffer); -} - -TEST_F(Keys_container_test, InitWithFileWithCorrect_1_0_Struct) { - const char *keyring_correct_struct = "./keyring_correct_1_0_struct"; - remove(keyring_correct_struct); - std::vector allowedFileVersionsToInit; - // this keyring will work with keyring files in the following versions: - allowedFileVersionsToInit.push_back(keyring::keyring_file_version_2_0); - allowedFileVersionsToInit.push_back(keyring::keyring_file_version_1_0); - generate_keyring_file_with_correct_ver_1_0_structure(keyring_correct_struct); - IKeyring_io *keyring_io = - new Buffered_file_io(logger, &allowedFileVersionsToInit); - EXPECT_EQ(keys_container->init(keyring_io, keyring_correct_struct), 0); - remove(keyring_correct_struct); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithCorrect_2_0_Struct) { - const char *keyring_correct_struct = "./keyring_correct_2_0_struct"; - remove(keyring_correct_struct); - generate_keyring_file_with_correct_ver_2_0_structure(keyring_correct_struct); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, keyring_correct_struct), 0); - remove(keyring_correct_struct); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithIncorrectKeyringVersion) { - const char *keyring_incorrect_version = "./keyring_incorrect_version"; - remove(keyring_incorrect_version); - generate_keyring_file_with_incorrect_file_version(keyring_incorrect_version); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Error while loading keyring content." - " The keyring might be malformed"))); - EXPECT_EQ(keys_container->init(keyring_io, keyring_incorrect_version), 1); - remove(keyring_incorrect_version); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, InitWithFileWithIncorrectTAG) { - const char *keyring_incorrect_tag = "./keyring_incorrect_tag"; - remove(keyring_incorrect_tag); - generate_keyring_file_with_incorrect_TAG(keyring_incorrect_tag); - Buffered_file_io *keyring_io = new Buffered_file_io(logger); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Error while loading keyring content. The " - "keyring might be malformed"))); - EXPECT_EQ(keys_container->init(keyring_io, keyring_incorrect_tag), 1); - remove(keyring_incorrect_tag); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, StoreFetchRemove) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_keyRobert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(sample_key_data.c_str(), - reinterpret_cast(key_data_fetched)); - EXPECT_STREQ("AES", fetched_key->get_key_type_as_string()->c_str()); - ASSERT_TRUE(sample_key_data.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_id); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - my_free(fetched_key->release_key_data()); -} - -TEST_F(Keys_container_test, FetchNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key == nullptr); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, RemoveNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - Key key_id("Roberts_key", "AES", "Robert", nullptr, 0); - ASSERT_TRUE(keys_container->remove_key(&key_id) == true); - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_test, StoreFetchNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key key_id("NotRoberts_key", nullptr, "NotRobert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key == nullptr); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -TEST_F(Keys_container_test, StoreRemoveNotExisting) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key key_id("NotRoberts_key", "AES", "NotRobert", nullptr, 0); - // Failed to remove key - ASSERT_TRUE(keys_container->remove_key(&key_id) == true); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -TEST_F(Keys_container_test, StoreStoreStoreFetchRemove) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - - EXPECT_EQ(keys_container->store_key(key1), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - - std::string key_data3("Robi3"); - Key *key3 = new Key("Roberts_key3", "AES", "Robert", key_data3.c_str(), - key_data3.length() + 1); - - EXPECT_EQ(keys_container->store_key(key3), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 4); - - Key key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key2_id); - - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_key2Robert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(key_data2.c_str(), - reinterpret_cast(key_data_fetched)); - ASSERT_TRUE(key_data2.length() + 1 == key_data_fetched_size); - - Key key3_id("Roberts_key3", "AES", "Robert", nullptr, 0); - keys_container->remove_key(&key3_id); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - - my_free(fetched_key->release_key_data()); -} - -TEST_F(Keys_container_test, StoreTwiceTheSame) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); -} - -class Buffered_file_io_20 : public Buffered_file_io { - public: - Buffered_file_io_20(ILogger *logger) : Buffered_file_io(logger) {} - void set_memory_needed_for_buffer(size_t memory_needed) { - memory_needed_for_buffer = memory_needed; - } -}; - -TEST_F(Keys_container_test, StoreKeyInVer10StoreKeyInVer20FetchKeyInVer20) { - size_t memory_needed_for_buffer; - { - Buffered_file_io_10 keyring_io_10(logger); - EXPECT_EQ(keys_container->init(&keyring_io_10, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - memory_needed_for_buffer = keyring_io_10.get_memory_needed_for_buffer(); - } - Buffered_file_io_20 *keyring_io_20 = new Buffered_file_io_20(logger); - EXPECT_EQ(keyring_io_20->init(&file_name), 0); - keyring_io_20->set_memory_needed_for_buffer(memory_needed_for_buffer); - keys_container->set_keyring_io(keyring_io_20); - - std::string key_data1("Robi1"); - Key key_1_id("Roberts_key1", nullptr, "Robert", nullptr, 0); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_EQ(keys_container->store_key(key1), 0); - - Key key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetched_key = keys_container->fetch_key(&key_id); - ASSERT_TRUE(fetched_key != nullptr); - std::string expected_key_signature = "Roberts_keyRobert"; - EXPECT_STREQ(fetched_key->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key->get_key_signature()->length(), - expected_key_signature.length()); - uchar *key_data_fetched = fetched_key->get_key_data(); - size_t key_data_fetched_size = fetched_key->get_key_data_size(); - EXPECT_STREQ(sample_key_data.c_str(), - reinterpret_cast(key_data_fetched)); - ASSERT_TRUE(sample_key_data.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_id); - - IKey *fetched_key_1 = keys_container->fetch_key(&key_1_id); - ASSERT_TRUE(fetched_key_1 != nullptr); - expected_key_signature = "Roberts_key1Robert"; - EXPECT_STREQ(fetched_key_1->get_key_signature()->c_str(), - expected_key_signature.c_str()); - EXPECT_EQ(fetched_key_1->get_key_signature()->length(), - expected_key_signature.length()); - key_data_fetched = fetched_key_1->get_key_data(); - key_data_fetched_size = fetched_key_1->get_key_data_size(); - EXPECT_STREQ(key_data1.c_str(), - reinterpret_cast(key_data_fetched)); - ASSERT_TRUE(key_data1.length() + 1 == key_data_fetched_size); - - keys_container->remove_key(&key_1_id); - - my_free(fetched_key->release_key_data()); - my_free(fetched_key_1->release_key_data()); -} - -TEST_F(Keys_container_test, - CheckIfKeyIsNotDumpedIntoKeyringFileIfKeyringFileDoesnotExist) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - remove("./keyring"); - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_CALL( - *((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - // it should not be possible to store_key if the keyring file does not exist - EXPECT_EQ(keys_container->store_key(key1), 1); - delete key1; - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), 0); -} - -TEST_F(Keys_container_test, - CheckIfKeyIsNotDumpedIntoKeyringFileIfKeyringFileHasInvalidDigest) { - IKeyring_io *keyring_io = new Buffered_file_io(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - - std::fstream keyring_file("./keyring"); - ASSERT_TRUE(keyring_file.is_open()); - keyring_file.seekp(-3, std::ios_base::end); - keyring_file.write("a", 1); // changed digest - keyring_file.close(); - EXPECT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring")); - - std::string key_data1("Robi1"); - Key *key1 = new Key("Roberts_key1", "AES", "Robert", key_data1.c_str(), - key_data1.length() + 1); - EXPECT_CALL( - *((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - - // it should not be possible to store_key if the keyring file was changed - EXPECT_EQ(keys_container->store_key(key1), 1); - delete key1; - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); -} - -class Buffered_file_io_dont_remove_backup : public Buffered_file_io { - public: - Buffered_file_io_dont_remove_backup(ILogger *logger) - : Buffered_file_io(logger) {} - - bool remove_backup(myf) { return false; } -}; - -class Keys_container_test_dont_close : public ::testing::Test { - public: - Keys_container_test_dont_close() : file_name("./keyring") {} - - protected: - void SetUp() override { - sample_key_data = "Robi"; - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - std::string sample_key_data2 = "xobi2"; - sample_key2 = - new Key("Roberts_key2", "AES", "Robert", sample_key_data2.c_str(), - sample_key_data2.length() + 1); - - // Remove Keyring files just to be save - remove(file_name.c_str()); - remove("./keyring.backup"); - remove("./keyring.backup.backup"); - } - void TearDown() override { remove(file_name.c_str()); } - void generate_malformed_keyring_file_without_tag(const char *file_name); - - protected: - Key *sample_key; - Key *sample_key2; - std::string sample_key_data; - std::string file_name; -}; - -void Keys_container_test_dont_close:: - generate_malformed_keyring_file_without_tag(const char *file_name) { - static const char *malformed_keyring_buffer = - "Key1AESRobertKEYDATA" - "Key2AESZibiDATAKey3DATA...crashing"; - - std::fstream file; - file.open(file_name, - std::fstream::out | std::fstream::binary | std::fstream::trunc); - ASSERT_TRUE(file.is_open()); - file.write(malformed_keyring_buffer, strlen(malformed_keyring_buffer)); - file.close(); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedAfterStoringOneKey) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - - // Check if backup file is empty - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - ASSERT_TRUE(keys_container->init(keyring_io, "./keyring.backup") == 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - delete sample_key2; // unused in this test -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedAfterStoringTwoKeys) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - delete keys_container; - delete logger; - - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - // Check that backup file contains sample_key only - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io_2, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "Robi", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfCorrectBackupFileIsCreatedBeforeRemovingKey) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - ASSERT_TRUE(keys_container->init(keyring_io_dont_remove_backup, file_name) == - 0); - Key sample_key_id("Roberts_key", "AES", "Robert", nullptr, 0); - EXPECT_EQ(keys_container->remove_key(&sample_key_id), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - // Check that backup file contains sample_key and sample_key2 - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io_2, "./keyring.backup"), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove("./keyring.backup.backup"); // leftover from initializing keyring with - // backup file - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - CheckIfBackupFileIsNotCreatedForFetching) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - // check if the backup file was not created - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - KeyringfileIsMalformedCheckIfBackupIsLoaded) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - // Now we have correct backup file - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - logger = new Mock_logger(); - IKeyring_io *keyring_io_dont_remove_backup = - new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - - // this key will not be in backup file thus we do not care about it - Key *sample_key3 = - new Key("Roberts_key3", "ZZZZ", "MaybeRobert", "DATA", strlen("DATA")); - - EXPECT_EQ(keys_container->init(keyring_io_dont_remove_backup, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key3), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 3); - // Now we have correct backup file - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - remove("./keyring"); - generate_malformed_keyring_file_without_tag("./keyring"); - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - - ASSERT_TRUE(keys_container->init(keyring_io_2, file_name) == 0); - // Check that keyring from backup was loaded as the keyring file is corrupted - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - IKey *fetchedKey2 = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey2 != nullptr); - ASSERT_TRUE(*fetchedKey2->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey2->get_key_data(), "Robi", - fetchedKey2->get_key_data_size()) == 0); - - // check if the backup file was removed - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - my_free(fetchedKey2->release_key_data()); -} - -TEST_F(Keys_container_test_dont_close, - BackupfileIsMalformedCheckItIsIgnoredAndDeleted) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io(logger); - Keys_container *keys_container = new Keys_container(logger); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - // successfully stored the key - backup file does not exist - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - delete keys_container; - delete logger; - generate_malformed_keyring_file_without_tag("./keyring.backup"); - logger = new Mock_logger(); - IKeyring_io *keyring_io_2 = new Buffered_file_io(logger); - keys_container = new Keys_container(logger); - - // Check that backup file was ignored (as backup file is malformed) - EXPECT_CALL(*((Mock_logger *)logger), - log(ERROR_LEVEL, StrEq("Incorrect Keyring file"))); - EXPECT_CALL(*((Mock_logger *)logger), - log(WARNING_LEVEL, - StrEq("Found malformed keyring backup file - removing it"))); - EXPECT_EQ(keys_container->init(keyring_io_2, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - Key sample_key2_id("Roberts_key2", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key2_id); - ASSERT_TRUE(fetchedKey != nullptr); - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_key2Robert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "xobi2", - fetchedKey->get_key_data_size()) == 0); - IKey *fetchedKey2 = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey2 != nullptr); - ASSERT_TRUE(*fetchedKey2->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey2->get_key_data(), "Robi", - fetchedKey2->get_key_data_size()) == 0); - - // check if the backup file was removed - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), false); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - my_free(fetchedKey2->release_key_data()); -} - -TEST_F( - Keys_container_test_dont_close, - CheckIfBackupIsCreatedAfterEachOperationAndIsUsedWhenKeyringDoesNotExist) { - ILogger *logger = new Mock_logger(); - IKeyring_io *keyring_io = new Buffered_file_io_dont_remove_backup(logger); - Keys_container *keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == true); - - remove("./keyring.backup"); - rename("keyring", "keyring.backup"); - ASSERT_TRUE(check_if_file_exists_and_TAG_is_correct("./keyring") == false); - // Now keyring file should be recreated based on keyring.backup - delete keys_container; - keyring_io = new Buffered_file_io_dont_remove_backup(logger); - keys_container = new Keys_container(logger); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - EXPECT_EQ(keys_container->store_key(sample_key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring.backup"), true); - EXPECT_EQ(check_if_file_exists_and_TAG_is_correct("./keyring"), true); - - Key sample_key_id("Roberts_key", nullptr, "Robert", nullptr, 0); - IKey *fetchedKey = keys_container->fetch_key(&sample_key_id); - ASSERT_TRUE(fetchedKey != nullptr); - - ASSERT_TRUE(*fetchedKey->get_key_signature() == "Roberts_keyRobert"); - ASSERT_TRUE(memcmp(fetchedKey->get_key_data(), "Robi", - fetchedKey->get_key_data_size()) == 0); - - remove("./keyring.backup"); - remove(file_name.c_str()); - delete keys_container; - delete logger; - my_free(fetchedKey->release_key_data()); - // fetchedKey->release_key_data(); -} - -class Mock_keyring_io : public IKeyring_io { - public: - MOCK_METHOD1(init, bool(std::string *keyring_filename)); - MOCK_METHOD1(flush_to_backup, bool(ISerialized_object *serialized_object)); - MOCK_METHOD1(flush_to_storage, bool(ISerialized_object *serialized_object)); - MOCK_METHOD0(get_serializer, ISerializer *()); - MOCK_METHOD1(get_serialized_object, - bool(ISerialized_object **serialized_object)); - MOCK_METHOD0(has_next_serialized_object, bool()); -}; - -class Mock_serialized_object : public ISerialized_object { - public: - MOCK_METHOD1(get_next_key, bool(IKey **key)); - MOCK_METHOD0(has_next_key, bool()); - MOCK_METHOD0(get_key_operation, Key_operation()); - MOCK_METHOD1(set_key_operation, void(Key_operation)); -}; - -class Mock_serializer : public ISerializer { - public: - MOCK_METHOD3( - serialize, - ISerialized_object *( - const collation_unordered_map> &, - IKey *, Key_operation)); -}; - -class Keys_container_with_mocked_io_test : public ::testing::Test { - protected: - void SetUp() override { - std::string sample_key_data("Robi"); - sample_key = new Key("Roberts_key", "AES", "Robert", - sample_key_data.c_str(), sample_key_data.length() + 1); - - file_name = "/home/rob/write_key"; - } - void TearDown() override { - remove(file_name.c_str()); - delete keys_container; - } - - protected: - Keys_container *keys_container; - Mock_keyring_io *keyring_io; - Key *sample_key; - char *sample_key_data; - std::string file_name; - - void expect_calls_on_init(); - void expect_calls_on_store_sample_key(); -}; - -void Keys_container_with_mocked_io_test::expect_calls_on_init() { - Mock_serialized_object *mock_serialized_object = new Mock_serialized_object; - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce(DoAll(SetArgPointee<0>(mock_serialized_object), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()) - .WillOnce(Return(false)); // no keys to read - EXPECT_CALL(*keyring_io, has_next_serialized_object()) - .WillOnce(Return(false)); -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIODuringInitOnGettingSerializedObject) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - EXPECT_CALL(*keyring_io, get_serialized_object(_)).WillOnce(Return(true)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. The " - "keyring might be malformed"))); - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - delete logger; - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIODuringInitInvalidKeyAndMockedSerializedObject) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - IKey *invalid_key = new Key(); - std::string invalid_key_type("ZZZ"); - invalid_key->set_key_type(&invalid_key_type); - - Mock_serialized_object *mock_serialized_object = new Mock_serialized_object; - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - { - InSequence dummy; - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce( - DoAll(SetArgPointee<0>(mock_serialized_object), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()).WillOnce(Return(true)); - EXPECT_CALL(*mock_serialized_object, get_next_key(_)) - .WillOnce(DoAll(SetArgPointee<0>(sample_key), Return(false))); - EXPECT_CALL(*mock_serialized_object, has_next_key()).WillOnce(Return(true)); - EXPECT_CALL(*mock_serialized_object, get_next_key(_)) - .WillOnce(DoAll(SetArgPointee<0>(invalid_key), Return(false))); - - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. " - "The keyring might be malformed"))); - } - - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_EQ(0u, keys_container->get_number_of_keys()); - delete logger; -} - -TEST_F(Keys_container_with_mocked_io_test, ErrorFromIODuringInitInvalidKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - - IKey *invalid_key = new Key(); - std::string invalid_key_type("ZZZ"); - invalid_key->set_key_type(&invalid_key_type); - - Buffer *buffer = new Buffer(sample_key->get_key_pod_size() + - invalid_key->get_key_pod_size()); - sample_key->store_in_buffer(buffer->data, &(buffer->position)); - invalid_key->store_in_buffer(buffer->data, &(buffer->position)); - buffer->position = 0; // rewind buffer - - EXPECT_CALL(*keyring_io, init(Pointee(StrEq(file_name)))) - .WillOnce(Return(0)); // init successful - { - InSequence dummy; - EXPECT_CALL(*keyring_io, get_serialized_object(_)) - .WillOnce(DoAll(SetArgPointee<0>(buffer), Return(false))); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Error while loading keyring content. " - "The keyring might be malformed"))); - } - EXPECT_EQ(keys_container->init(keyring_io, file_name), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - delete logger; - delete invalid_key; - delete sample_key; // unused in this test -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToBackupWhenStoringKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - { - InSequence dummy; - - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL( - *logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - } - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete sample_key; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToKeyringWhenStoringKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - EXPECT_EQ(keys_container->store_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete sample_key; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToBackupWhenRemovingKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - { - InSequence dummy; - - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL( - *logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring's backup"))); - } - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromSerializerOnFlushToKeyringWhenRemovingKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, StoreAndRemoveKey) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - // recreate serialized objects - empty_serialized_object = new Buffer; - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_storage(empty_serialized_object)); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, - ErrorFromIOWhileRemovingKeyAfterAdding2Keys) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - Buffer *serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key_and_key2)); - } - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key_and_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return((ISerialized_object *)nullptr)); - EXPECT_CALL(*logger, - log(ERROR_LEVEL, StrEq("Could not flush keys to keyring"))); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 1); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - delete logger; - delete mock_serializer; -} - -TEST_F(Keys_container_with_mocked_io_test, Store2KeysAndRemoveThem) { - keyring_io = new Mock_keyring_io(); - Mock_logger *logger = new Mock_logger(); - keys_container = new Keys_container(logger); - expect_calls_on_init(); - EXPECT_EQ(keys_container->init(keyring_io, file_name), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - Mock_serializer *mock_serializer = new Mock_serializer; - - ISerialized_object *empty_serialized_object = new Buffer; - Buffer *serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_backup(empty_serialized_object)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key)); - } - EXPECT_EQ(keys_container->store_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - std::string key_data2("Robi2"); - Key *key2 = new Key("Roberts_key2", "AES", "Robert", key_data2.c_str(), - key_data2.length() + 1); - - serialized_object_with_sample_key = - new Buffer(sample_key->get_key_pod_size()); - sample_key->store_in_buffer(serialized_object_with_sample_key->data, - &(serialized_object_with_sample_key->position)); - serialized_object_with_sample_key->position = 0; // rewind buffer - - Buffer *serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, STORE_KEY)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_storage(serialized_object_with_sample_key_and_key2)); - } - EXPECT_EQ(keys_container->store_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 2); - - serialized_object_with_sample_key_and_key2 = - new Buffer(sample_key->get_key_pod_size() + key2->get_key_pod_size()); - sample_key->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - key2->store_in_buffer( - serialized_object_with_sample_key_and_key2->data, - &(serialized_object_with_sample_key_and_key2->position)); - serialized_object_with_sample_key_and_key2->position = 0; // rewind buffer - - Buffer *serialized_object_with_key2 = new Buffer(key2->get_key_pod_size()); - key2->store_in_buffer(serialized_object_with_key2->data, - &(serialized_object_with_key2->position)); - serialized_object_with_key2->position = 0; // rewind buffer - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_sample_key_and_key2)); - EXPECT_CALL(*keyring_io, - flush_to_backup(serialized_object_with_sample_key_and_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, sample_key, REMOVE_KEY)) - .WillOnce(Return(serialized_object_with_key2)); - EXPECT_CALL(*keyring_io, flush_to_storage(serialized_object_with_key2)); - } - - EXPECT_EQ(keys_container->remove_key(sample_key), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 1); - - serialized_object_with_key2 = new Buffer(key2->get_key_pod_size()); - key2->store_in_buffer(serialized_object_with_key2->data, - &(serialized_object_with_key2->position)); - serialized_object_with_key2->position = 0; // rewind buffer - - empty_serialized_object = new Buffer; - - { - InSequence dummy; - // flush to backup - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, NULL, NONE)) - .WillOnce(Return(serialized_object_with_key2)); - EXPECT_CALL(*keyring_io, flush_to_backup(serialized_object_with_key2)); - // flush to keyring - EXPECT_CALL(*keyring_io, get_serializer()) - .WillOnce(Return(mock_serializer)); - EXPECT_CALL(*mock_serializer, serialize(_, key2, REMOVE_KEY)) - .WillOnce(Return(empty_serialized_object)); - EXPECT_CALL(*keyring_io, flush_to_storage(empty_serialized_object)); - } - - EXPECT_EQ(keys_container->remove_key(key2), 0); - ASSERT_TRUE(keys_container->get_number_of_keys() == 0); - - delete logger; - delete mock_serializer; -} - -} // namespace keyring__keys_container_unittest diff --git a/unittest/gunit/keyring_vault/CMakeLists.txt b/unittest/gunit/keyring_vault/CMakeLists.txt index 1ecba4d34597..f12e6b6f1825 100644 --- a/unittest/gunit/keyring_vault/CMakeLists.txt +++ b/unittest/gunit/keyring_vault/CMakeLists.txt @@ -60,6 +60,7 @@ LIST(APPEND SRC_FILES ADD_LIBRARY(keyring_vault_test STATIC ${SRC_FILES}) ADD_DEPENDENCIES(keyring_vault_test GenError) +TARGET_LINK_LIBRARIES(keyring_vault_test extra::rapidjson) SET(ALL_KEYRING_VAULT_TESTS) FOREACH(test ${TESTS}) @@ -83,8 +84,8 @@ TARGET_LINK_LIBRARIES(merge_keyring_vault_tests-t minchassis binlog rpl - master - slave + rpl_source + rpl_replica ${CURL_LIBRARY} ${SSL_LIBRARIES} ${ICU_LIBRARIES}) diff --git a/unittest/gunit/optimizer_test.h b/unittest/gunit/optimizer_test.h index 3aa2fdbc07a2..a4584aa31e45 100644 --- a/unittest/gunit/optimizer_test.h +++ b/unittest/gunit/optimizer_test.h @@ -362,6 +362,7 @@ inline handlerton *OptimizerTestBase::EnableSecondaryEngine( hton->secondary_engine_modify_access_path_cost = nullptr; for (const auto &[name, table] : m_fake_tables) { + (void)name; table->file->ht = hton; static_cast(table->s)->set_secondary_engine(true); ON_CALL(table->mock_handler, table_type()) diff --git a/unittest/gunit/xplugin/xcl/CMakeLists.txt b/unittest/gunit/xplugin/xcl/CMakeLists.txt index fc0ce9ad015d..11952ee928a9 100644 --- a/unittest/gunit/xplugin/xcl/CMakeLists.txt +++ b/unittest/gunit/xplugin/xcl/CMakeLists.txt @@ -67,16 +67,8 @@ TARGET_LINK_LIBRARIES(${XCL_UNIT_TESTS} ${MYSQLX_CLIENT_FULL_LIB} ${MYSQLX_PROTOCOL_FULL_LIB} ${PROTOBUF_LIBRARY} -<<<<<<< HEAD - ${LZ4_LIBRARY} - perconaserverclient -||||||| ce0de82d3aa - ${LZ4_LIBRARY} - mysqlclient -======= ext::lz4 - mysqlclient ->>>>>>> mysql-8.0.33 + perconaserverclient gtest gmock )