From 4adf52a04872d6cf8e9a230989335c311764099f Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Wed, 22 May 2019 12:53:35 +0200 Subject: [PATCH 01/22] Add missing script header --- .../rocksdb_hotbackup/include/create_slocket_socket.sh | 2 ++ .../mysql-test/rocksdb_hotbackup/include/create_table.sh | 2 ++ .../rocksdb/mysql-test/rocksdb_hotbackup/include/load_data.sh | 2 ++ .../mysql-test/rocksdb_hotbackup/include/load_data_and_run.sh | 2 ++ .../mysql-test/rocksdb_hotbackup/include/load_data_slocket.sh | 2 ++ .../rocksdb_hotbackup/include/remove_slocket_socket.sh | 2 ++ .../rocksdb_hotbackup/include/setup_replication_gtid.sh | 2 ++ 7 files changed, 14 insertions(+) diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_slocket_socket.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_slocket_socket.sh index 6174e5d1864..db470f527ca 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_slocket_socket.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_slocket_socket.sh @@ -1,2 +1,4 @@ +#!/bin/bash + src_data_dir="${MYSQLTEST_VARDIR}/mysqld.1/data/" python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('${src_data_dir}/slocket')" diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_table.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_table.sh index a4d60dc864c..2004caca160 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_table.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/create_table.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e COPY_LOG=$1 diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data.sh index f3836ab75e5..80f1a5e2567 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e # Insert 100 batches of 100 records each to a table with following schema: diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_and_run.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_and_run.sh index a4e4afab9d4..a8e6fc445bb 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_and_run.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_and_run.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e # Initially loads a chunk of data. diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_slocket.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_slocket.sh index ed0b3cb5c1c..036d68662d4 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_slocket.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/load_data_slocket.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e # Insert 10 batches of 10 records each to a table with following schema: diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/remove_slocket_socket.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/remove_slocket_socket.sh index 0c2c71aad68..9114629ba31 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/remove_slocket_socket.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/remove_slocket_socket.sh @@ -1,2 +1,4 @@ +#!/bin/bash + src_data_dir="${MYSQLTEST_VARDIR}/mysqld.1/data/" rm "${src_data_dir}/slocket" diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/setup_replication_gtid.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/setup_replication_gtid.sh index 18e1feeda96..3c95068a488 100755 --- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/setup_replication_gtid.sh +++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/setup_replication_gtid.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e binlog_line=($(grep -o "Last binlog file position [0-9]*, file name .*\.[0-9]*" ${MYSQLTEST_VARDIR}/log/mysqld.2.err | tail -1)) From 80a142f14622e4c578ebc3bb47d307ddb860f3f9 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 30 May 2019 17:19:13 +0400 Subject: [PATCH 02/22] Lintian complains about script-not-executable Removed #! sequence from non-executable script. --- storage/rocksdb/mysql-test/rocksdb/slow_query_log.awk | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/rocksdb/mysql-test/rocksdb/slow_query_log.awk b/storage/rocksdb/mysql-test/rocksdb/slow_query_log.awk index 4617b6d9fc3..a921f47243e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/slow_query_log.awk +++ b/storage/rocksdb/mysql-test/rocksdb/slow_query_log.awk @@ -1,5 +1,3 @@ -#!/bin/awk - /Query_time:/ { results["Rows_examined:"] = "uninit"; results["RocksDB_key_skipped:"] = "uninit"; From 9d142a895c4ac9e34f839222df70b967dfb840e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 30 May 2019 20:59:34 +0300 Subject: [PATCH 03/22] Define page_id_t in buf0types.h --- storage/innobase/include/buf0buf.h | 71 ---------------------------- storage/innobase/include/buf0types.h | 71 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 58314bed71a..086bfb12710 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -215,77 +215,6 @@ struct buf_pools_list_size_t { }; #endif /* !UNIV_INNOCHECKSUM */ -/** Page identifier. */ -class page_id_t { -public: - - /** Constructor from (space, page_no). - @param[in] space tablespace id - @param[in] page_no page number */ - page_id_t(ulint space, ulint page_no) - : m_space(uint32_t(space)), m_page_no(uint32(page_no)) - { - ut_ad(space <= 0xFFFFFFFFU); - ut_ad(page_no <= 0xFFFFFFFFU); - } - - bool operator==(const page_id_t& rhs) const - { - return m_space == rhs.m_space && m_page_no == rhs.m_page_no; - } - bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); } - - bool operator<(const page_id_t& rhs) const - { - if (m_space == rhs.m_space) { - return m_page_no < rhs.m_page_no; - } - - return m_space < rhs.m_space; - } - - /** Retrieve the tablespace id. - @return tablespace id */ - uint32_t space() const { return m_space; } - - /** Retrieve the page number. - @return page number */ - uint32_t page_no() const { return m_page_no; } - - /** Retrieve the fold value. - @return fold value */ - ulint fold() const { return (m_space << 20) + m_space + m_page_no; } - - /** Reset the page number only. - @param[in] page_no page number */ - inline void set_page_no(ulint page_no) - { - m_page_no = uint32_t(page_no); - - ut_ad(page_no <= 0xFFFFFFFFU); - } - -private: - - /** Tablespace id. */ - uint32_t m_space; - - /** Page number. */ - uint32_t m_page_no; - - /** Declare the overloaded global operator<< as a friend of this - class. Refer to the global declaration for further details. Print - the given page_id_t object. - @param[in,out] out the output stream - @param[in] page_id the page_id_t object to be printed - @return the output stream */ - friend - std::ostream& - operator<<( - std::ostream& out, - const page_id_t page_id); -}; - /** Print the given page_id_t object. @param[in,out] out the output stream @param[in] page_id the page_id_t object to be printed diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index 2523c0054d3..63299681823 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -125,6 +125,77 @@ this must be equal to UNIV_PAGE_SIZE */ #define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES) /* @} */ +/** Page identifier. */ +class page_id_t { +public: + + /** Constructor from (space, page_no). + @param[in] space tablespace id + @param[in] page_no page number */ + page_id_t(ulint space, ulint page_no) + : m_space(uint32_t(space)), m_page_no(uint32(page_no)) + { + ut_ad(space <= 0xFFFFFFFFU); + ut_ad(page_no <= 0xFFFFFFFFU); + } + + bool operator==(const page_id_t& rhs) const + { + return m_space == rhs.m_space && m_page_no == rhs.m_page_no; + } + bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); } + + bool operator<(const page_id_t& rhs) const + { + if (m_space == rhs.m_space) { + return m_page_no < rhs.m_page_no; + } + + return m_space < rhs.m_space; + } + + /** Retrieve the tablespace id. + @return tablespace id */ + uint32_t space() const { return m_space; } + + /** Retrieve the page number. + @return page number */ + uint32_t page_no() const { return m_page_no; } + + /** Retrieve the fold value. + @return fold value */ + ulint fold() const { return (m_space << 20) + m_space + m_page_no; } + + /** Reset the page number only. + @param[in] page_no page number */ + void set_page_no(ulint page_no) + { + m_page_no = uint32_t(page_no); + + ut_ad(page_no <= 0xFFFFFFFFU); + } + +private: + + /** Tablespace id. */ + uint32_t m_space; + + /** Page number. */ + uint32_t m_page_no; + + /** Declare the overloaded global operator<< as a friend of this + class. Refer to the global declaration for further details. Print + the given page_id_t object. + @param[in,out] out the output stream + @param[in] page_id the page_id_t object to be printed + @return the output stream */ + friend + std::ostream& + operator<<( + std::ostream& out, + const page_id_t page_id); +}; + #ifndef UNIV_INNOCHECKSUM #include "ut0mutex.h" From c9b49a4be723c18a8fad2bf4fd549079d45a33a5 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Fri, 24 May 2019 13:09:13 +0300 Subject: [PATCH 04/22] MDEV-18207: ASAN heap-use-after-free in _ma_get_status upon concurrent operations with sequence The issue is that two MARIA_HA instances shares the same MARIA_STATUS_INFO object during UNION execution, so the second MARIA_HA instance state pointer MARIA_HA::state points to the MARIA_HA::state_save of the first MARIA instance. This happens in thr_multi_lock(...) { ... for (first_lock=data, pos= data+1 ; pos < end ; pos++) { ... if (pos[0]->lock == pos[-1]->lock && pos[0]->lock->copy_status) (pos[0]->lock->copy_status)((*pos)->status_param, (*first_lock)->status_param); ... } ... } Usually the state is restored from ha_maria::external_lock(...): \#0 _ma_update_status (param=0x6290000e6270) at ./storage/maria/ma_state.c:309 \#1 0x00005555577ccb15 in _ma_update_status_with_lock (info=0x6290000e6270) at ./storage/maria/ma_state.c:361 \#2 0x00005555577c7dcc in maria_lock_database (info=0x6290000e6270, lock_type=2) at ./storage/maria/ma_locking.c:66 \#3 0x0000555557802ccd in ha_maria::external_lock (this=0x61d0001b1308, thd=0x62a000048270, lock_type=2) at ./storage/maria/ha_maria.cc:2727 But _ma_update_status() does not take into account the case when MARIA_HA::status points to the MARIA_HA::state_save of the other MARIA_HA instance. The fix is to restore MARIA_HA::state in ha_maria::external_lock() after maria_lock_database() call for transactional tables. --- storage/maria/ha_maria.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 5a371a07fc3..f64ea4b1edb 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2798,9 +2798,12 @@ int ha_maria::external_lock(THD *thd, int lock_type) } } } /* if transactional table */ - DBUG_RETURN(maria_lock_database(file, !table->s->tmp_table ? + int result = maria_lock_database(file, !table->s->tmp_table ? lock_type : ((lock_type == F_UNLCK) ? - F_UNLCK : F_EXTRA_LCK))); + F_UNLCK : F_EXTRA_LCK)); + if (!file->s->base.born_transactional) + file->state= &file->s->state.state; // Restore state if clone + DBUG_RETURN(result); } int ha_maria::start_stmt(THD *thd, thr_lock_type lock_type) From e730ea1e3ebe2a5f3b6d93d5c05c3c387fab8c57 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 3 Jun 2019 09:55:40 +0200 Subject: [PATCH 05/22] Only link mysys_ssl when required. Do not use TARGET_LINK_LIBRARIES(mysys mysys_ssl), this means that mysys_ssl is linked to practically everything. --- client/CMakeLists.txt | 4 ++-- mysys/CMakeLists.txt | 4 ++-- plugin/auth_ed25519/CMakeLists.txt | 2 +- unittest/mysys/CMakeLists.txt | 4 ++-- unittest/sql/CMakeLists.txt | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 96346808a62..37087b7c6c6 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -72,10 +72,10 @@ MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c) TARGET_LINK_LIBRARIES(mysql_plugin ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc) -TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB}) +TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB} mysys_ssl) MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc ../sql/password.c) -TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB}) +TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB} mysys_ssl) MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 5afc3a079e7..22d758d45a5 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -73,8 +73,8 @@ IF(HAVE_MLOCK) ENDIF() ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES}) -TARGET_LINK_LIBRARIES(mysys dbug strings mysys_ssl ${ZLIB_LIBRARY} - ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_VPMSUM_LIBRARY}) +TARGET_LINK_LIBRARIES(mysys dbug strings + ${ZLIB_LIBRARY} ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_VPMSUM_LIBRARY}) DTRACE_INSTRUMENT(mysys) IF(HAVE_BFD_H) diff --git a/plugin/auth_ed25519/CMakeLists.txt b/plugin/auth_ed25519/CMakeLists.txt index 73d8eeb208b..8ed50e8fec9 100644 --- a/plugin/auth_ed25519/CMakeLists.txt +++ b/plugin/auth_ed25519/CMakeLists.txt @@ -28,5 +28,5 @@ MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY CLIENT LINK_LIBRARIES mysys_ssl ref10 COMPONENT ClientPlugins) IF(WITH_UNIT_TESTS) - MY_ADD_TESTS(ed25519 LINK_LIBRARIES mysys ref10) + MY_ADD_TESTS(ed25519 LINK_LIBRARIES ref10 mysys_ssl) ENDIF() diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index f06d63d05fb..1d97340784d 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -14,10 +14,10 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring - aes byte_order + byte_order LINK_LIBRARIES mysys) MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) - +MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl) ADD_DEFINITIONS(${SSL_DEFINES}) MY_ADD_TESTS(ma_dyncol LINK_LIBRARIES mysys) diff --git a/unittest/sql/CMakeLists.txt b/unittest/sql/CMakeLists.txt index f63dc0b2a21..a4ba1019e49 100644 --- a/unittest/sql/CMakeLists.txt +++ b/unittest/sql/CMakeLists.txt @@ -31,6 +31,6 @@ TARGET_LINK_LIBRARIES(explain_filename-t sql mytap) MY_ADD_TEST(explain_filename) ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc) -TARGET_LINK_LIBRARIES(mf_iocache-t mysys mytap) +TARGET_LINK_LIBRARIES(mf_iocache-t mysys mytap mysys_ssl) ADD_DEPENDENCIES(mf_iocache-t GenError) MY_ADD_TEST(mf_iocache) From 724aefa56d5837e8ecaacd87477f4ebe00601b0f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 3 Jun 2019 13:52:33 +0200 Subject: [PATCH 06/22] Fix linking error, for GNU linker. --- plugin/auth_ed25519/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/auth_ed25519/CMakeLists.txt b/plugin/auth_ed25519/CMakeLists.txt index 8ed50e8fec9..ff6651c528d 100644 --- a/plugin/auth_ed25519/CMakeLists.txt +++ b/plugin/auth_ed25519/CMakeLists.txt @@ -25,7 +25,7 @@ MYSQL_ADD_PLUGIN(auth_ed25519 server_ed25519.c ${REF10_SOURCES} MODULE_ONLY) # client plugin and unit test ed25519-t can use the library MYSQL_ADD_PLUGIN(client_ed25519 client_ed25519.c MODULE_ONLY - CLIENT LINK_LIBRARIES mysys_ssl ref10 COMPONENT ClientPlugins) + CLIENT LINK_LIBRARIES ref10 mysys_ssl COMPONENT ClientPlugins) IF(WITH_UNIT_TESTS) MY_ADD_TESTS(ed25519 LINK_LIBRARIES ref10 mysys_ssl) From 2d89a70facaf9c9f71bad1c805c44b625b0f607d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 2 Jun 2019 11:35:12 +0300 Subject: [PATCH 07/22] Fix plugin linking on Windows --- sql/handler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/handler.h b/sql/handler.h index a777b7c595a..fcf9e7b0a6e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -777,7 +777,7 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len, const char *file, size_t file_len, const char *status, size_t status_len); enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; -extern st_plugin_int *hton2plugin[MAX_HA]; +extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA]; /* Transaction log maintains type definitions */ enum log_status From 76f14be10f5e6cebf44a93e48673930fdeb50442 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 2 Jun 2019 11:47:36 +0300 Subject: [PATCH 08/22] Ensure that tests and programs can restore variables - --default-character-set can now be disabled in mysqldump - --skip-resolve can be be disabled in mysqld - mysql_client_test now resets global variables it changes - mtr couldn't handle [mysqldump] in config files (wrong regexp used) --- client/mysqldump.c | 4 ++++ mysql-test/lib/My/ConfigFactory.pm | 6 +++--- sql/mysqld.cc | 6 ++++-- tests/mysql_client_test.c | 30 ++++++++++++++++++++++++------ 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 2195786e7ea..b9ff8caed8c 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -967,6 +967,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), exit(1); } break; + case (int) OPT_DEFAULT_CHARSET: + if (default_charset == disabled_my_option) + default_charset= (char *)mysql_universal_client_charset; + break; } return 0; } diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index cae2c8c33e5..6d4c7f43390 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -311,7 +311,7 @@ sub post_check_client_groups { $first_mysqld->name()); # Then generate [client.] for each [mysqld.] - foreach my $mysqld ( $config->like('mysqld.') ) { + foreach my $mysqld ( $config->like('mysqld\.') ) { $self->post_check_client_group($config, 'client'.$mysqld->after('mysqld'), $mysqld->name()) @@ -333,7 +333,7 @@ sub post_check_embedded_group { my $mysqld= $config->group('mysqld') or croak "Can't run with embedded, config has no default mysqld section"; - my $first_mysqld= $config->first_like('mysqld.') or + my $first_mysqld= $config->first_like('mysqld\.') or croak "Can't run with embedded, config has no mysqld"; my %no_copy = map { $_ => 1 } @@ -457,7 +457,7 @@ sub new_config { } $self->run_section_rules($config, - 'mysqld.', + 'mysqld\.', @mysqld_rules); # [mysqlbinlog] need additional settings diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 263a9b4645a..60dce5a7ff3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9254,8 +9254,10 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) opt_specialflag|= SPECIAL_NO_HOST_CACHE; break; case (int) OPT_SKIP_RESOLVE: - opt_skip_name_resolve= 1; - opt_specialflag|=SPECIAL_NO_RESOLVE; + if ((opt_skip_name_resolve= (argument != disabled_my_option))) + opt_specialflag|= SPECIAL_NO_RESOLVE; + else + opt_specialflag&= ~SPECIAL_NO_RESOLVE; break; case (int) OPT_WANT_CORE: test_flags |= TEST_CORE_ON_SIGNAL; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 04717f1946b..c544e20f2fe 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -2341,6 +2341,12 @@ static void test_ps_query_cache() "(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')"); myquery(rc); + rc= mysql_query(mysql, + "set @save_query_cache_type=" + "@@global.query_cache_type," + "@save_query_cache_size=" + "@@global.query_cache_size"); + myquery(rc); rc= mysql_query(lmysql, "set global query_cache_type=ON"); myquery(rc); rc= mysql_query(lmysql, "set local query_cache_type=ON"); @@ -2497,9 +2503,9 @@ static void test_ps_query_cache() if (lmysql != mysql) mysql_close(lmysql); - rc= mysql_query(mysql, "set global query_cache_size=default"); + rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size"); myquery(rc); - rc= mysql_query(mysql, "set global query_cache_type=default"); + rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type"); myquery(rc); } @@ -13364,6 +13370,12 @@ static void test_open_cursor_prepared_statement_query_cache() return; } + rc= mysql_query(mysql, + "set @save_query_cache_type=" + "@@global.query_cache_type," + "@save_query_cache_size=" + "@@global.query_cache_size"); + myquery(rc); rc= mysql_query(mysql, "set global query_cache_type=ON"); myquery(rc); rc= mysql_query(mysql, "set local query_cache_type=ON"); @@ -13390,9 +13402,9 @@ static void test_open_cursor_prepared_statement_query_cache() check_execute(stmt, rc); mysql_stmt_close(stmt); - rc= mysql_query(mysql, "set global query_cache_type=default"); + rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type"); myquery(rc); - rc= mysql_query(mysql, "set global query_cache_size=default"); + rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size"); myquery(rc); } @@ -18177,6 +18189,12 @@ static void test_bug36326() myquery(rc); rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)"); myquery(rc); + rc= mysql_query(mysql, + "set @save_query_cache_type=" + "@@global.query_cache_type," + "@save_query_cache_size=" + "@@global.query_cache_size"); + myquery(rc); rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1"); myquery(rc); rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1"); @@ -18204,8 +18222,8 @@ static void test_bug36326() DIE_UNLESS(rc == 1); rc= mysql_query(mysql, "DROP TABLE t1"); myquery(rc); - rc= mysql_query(mysql, "SET GLOBAL query_cache_size = default"); - rc= mysql_query(mysql, "SET GLOBAL query_cache_type = default"); + rc= mysql_query(mysql, "SET GLOBAL query_cache_size = @save_query_cache_size"); + rc= mysql_query(mysql, "SET GLOBAL query_cache_type = @save_query_cache_type"); myquery(rc); DBUG_VOID_RETURN; From 05f8120d0ebaccba6c8dbad1124592315bd1f355 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 2 Jun 2019 13:53:16 +0300 Subject: [PATCH 09/22] Fixed compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrong compiler warning from GCC: ‘snprintf’ output 2 or more bytes (assuming 4001) into a destination of size 4000 --- extra/mariabackup/xtrabackup.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3d5e8a690a4..4163fd1d210 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -5235,7 +5235,11 @@ next_file_item_1: goto next_datadir_item; } - snprintf(dbpath, sizeof(dbpath), "%s/%s", path, dbinfo.name); + snprintf(dbpath, sizeof(dbpath), "%.*s/%.*s", + OS_FILE_MAX_PATH/2-1, + path, + OS_FILE_MAX_PATH/2-1, + dbinfo.name); os_normalize_path(dbpath); From 1bfa7ceb72c779171791bf424909074518028124 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 2 Jun 2019 13:53:48 +0300 Subject: [PATCH 10/22] Supress some valgrind warnings --- mysql-test/valgrind.supp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index ab3d1ba1efe..a8ca80e203a 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1751,3 +1751,23 @@ ... } +# +# OpenSSL 1.0.1l problems +# + +{ + OpenSSL 1.0.1l wrong jump + Memcheck:Cond + fun:bcmp + obj:/usr/lib64/libcrypto.so* + fun:FIPS_selftest +} + +{ + OpenSSL 1.0.1l wrong jump 2 + Memcheck:Cond + obj:/usr/lib64/libcrypto.so* + fun:FIPS_mode_set + obj:/usr/lib64/libcrypto.so* +} + From 40becbc3c7a6555d0a4bb186b4336a2899d5995c Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 2 Jun 2019 16:30:33 +0300 Subject: [PATCH 11/22] Fixed bug in online alter table when not compiled with performance schema os_file_write_func() and os_file_read_no_error_handling_func() returned different result values depending on if UNIV_PFS_IO was defined or not. Other things: - Added some comments about return values for some functions --- storage/innobase/include/os0file.h | 4 ++-- storage/innobase/include/os0file.ic | 12 ++++++------ storage/innobase/row/row0merge.cc | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 5be476ff109..324ff99f67b 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1197,12 +1197,12 @@ to original un-instrumented file I/O APIs */ # define os_file_read_no_error_handling(type, file, buf, offset, n, o) \ os_file_read_no_error_handling_func(type, file, buf, offset, n, o) # define os_file_read_no_error_handling_int_fd(type, file, buf, offset, n) \ - os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL) + (os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL) == 0) # define os_file_write(type, name, file, buf, offset, n) \ os_file_write_func(type, name, file, buf, offset, n) # define os_file_write_int_fd(type, name, file, buf, offset, n) \ - os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n) + (os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n) == 0) # define os_file_flush(file) os_file_flush_func(file) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 89eceb77e5f..7a490bf775a 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -348,7 +348,7 @@ a synchronous read operation. @param[in] n number of bytes to read @param[in] src_file caller file name @param[in] src_line caller line number -@return whether the request was successful */ +@return 0 on error, 1 on success */ UNIV_INLINE bool pfs_os_file_read_no_error_handling_int_fd_func( @@ -371,14 +371,14 @@ pfs_os_file_read_no_error_handling_int_fd_func( __FILE__, __LINE__); } - bool success = DB_SUCCESS == os_file_read_no_error_handling_func( + bool success = os_file_read_no_error_handling_func( type, OS_FILE_FROM_FD(file), buf, offset, n, NULL); if (locker != NULL) { PSI_FILE_CALL(end_file_wait)(locker, n); } - return(success); + return(success == DB_SUCCESS); // Reverse result } /** NOTE! Please use the corresponding macro os_file_write(), not directly @@ -435,7 +435,7 @@ os_file_write_int_fd() which requests a synchronous write operation. @param[in] n number of bytes @param[in] src_file file name where func invoked @param[in] src_line line where the func invoked -@return whether the request was successful */ +@return 0 on error, 1 on success */ UNIV_INLINE bool pfs_os_file_write_int_fd_func( @@ -459,14 +459,14 @@ pfs_os_file_write_int_fd_func( __FILE__, __LINE__); } - bool success = DB_SUCCESS == os_file_write_func( + bool success = os_file_write_func( type, name, OS_FILE_FROM_FD(file), buf, offset, n); if (locker != NULL) { PSI_FILE_CALL(end_file_wait)(locker, n); } - return(success); + return(success == DB_SUCCESS); // Reverse result } /** NOTE! Please use the corresponding macro os_file_flush(), not directly diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index c7f628339e0..e0c819bea4b 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1115,7 +1115,7 @@ row_merge_read( /********************************************************************//** Write a merge block to the file system. -@return whether the request was completed successfully */ +@return 0 on error, 1 if write succeded */ UNIV_INTERN bool row_merge_write( From aa83b9cf4f23d7f61b1f6abf92e8280e8c1757cb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 18 May 2019 11:38:43 +0200 Subject: [PATCH 12/22] update a test result, followup fae6539ef72 --- mysql-test/suite/plugins/r/feedback_plugin_send.result | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result index 35db81fa6c1..70dfbcb62dc 100644 --- a/mysql-test/suite/plugins/r/feedback_plugin_send.result +++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result @@ -2,9 +2,9 @@ select plugin_status from information_schema.plugins where plugin_name='feedback plugin_status ACTIVE SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used'; -SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used'; -variable_value = @feedback_used + 1 -0 +SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used'; +MUST BE 1 +1 select * from information_schema.feedback where variable_name like 'feed%' and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used' and variable_name not like '%debug%'; From 7906bee67bf3b9f9124da12dd1492d7b766bd53e Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 4 Jun 2019 12:41:52 +0530 Subject: [PATCH 13/22] MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF , window functions and views Adding destructor for Group_bound_tracker to free Cached_item_str. The Cached_item for window functions are allocated on THD:mem_root but the Cached_item_str has value of type string which is allocated on the heap, so we need to call free() for it --- mysql-test/r/win.result | 27 +++++++++++++++++++++++++++ mysql-test/t/win.test | 16 ++++++++++++++++ sql/item_windowfunc.h | 12 ++++-------- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index 5da8a7f8a3c..13d452f3ef2 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3607,5 +3607,32 @@ b row_number() over (partition by sum(a)+1) 2000 1 drop table t1; # +# MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF, +# window functions and views +# +create table t1 (id int, n1 int); +insert into t1 values (1,1),(2,1),(3,2),(4,4); +explain +select max(n1) over (partition by 'abc') from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary +select max(n1) over (partition by 'abc') from t1; +max(n1) over (partition by 'abc') +4 +4 +4 +4 +explain +select rank() over (partition by 'abc' order by 'xyz') from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary +select rank() over (partition by 'abc' order by 'xyz') from t1; +rank() over (partition by 'abc' order by 'xyz') +1 +1 +1 +1 +drop table t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index 15c48c31250..a4d42ce2b91 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2325,6 +2325,22 @@ select b, row_number() over (partition by sum(a)+1) from t1 group by b; drop table t1; +--echo # +--echo # MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF, +--echo # window functions and views +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1),(2,1),(3,2),(4,4); +explain +select max(n1) over (partition by 'abc') from t1; +select max(n1) over (partition by 'abc') from t1; + +explain +select rank() over (partition by 'abc' order by 'xyz') from t1; +select rank() over (partition by 'abc' order by 'xyz') from t1; +drop table t1; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 21270733051..b9df1b7482b 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -28,11 +28,6 @@ public: first_check= true; } - void cleanup() - { - group_fields.empty(); - } - /* Check if the current row is in a different group than the previous row this function was called for. @@ -70,6 +65,10 @@ public: } return 0; } + ~Group_bound_tracker() + { + group_fields.delete_elements(); + } private: List group_fields; @@ -199,7 +198,6 @@ public: { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } @@ -269,7 +267,6 @@ class Item_sum_dense_rank: public Item_sum_int { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } @@ -537,7 +534,6 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count { if (peer_tracker) { - peer_tracker->cleanup(); delete peer_tracker; peer_tracker= NULL; } From b4287ec3865d90920f0cc440c36f4873dcf51703 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 5 Jun 2019 16:36:51 +0530 Subject: [PATCH 14/22] MDEV-19541 InnoDB crashes when trying to recover a corrupted page - Use corrupt page id instead of whole block after releasing it from LRU list. --- storage/innobase/buf/buf0buf.cc | 4 +++- storage/innobase/include/log0recv.h | 4 ++-- storage/innobase/log/log0recv.cc | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 756caac1f54..18decb492f3 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -6051,10 +6051,12 @@ database_corrupted: if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { + const page_id_t corrupt_page_id = bpage->id; + buf_corrupt_page_release(bpage, space); if (recv_recovery_is_on()) { - recv_recover_corrupt_page(bpage); + recv_recover_corrupt_page(corrupt_page_id); } fil_space_release_for_io(space); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 9bb54960058..03f6a6ff878 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -51,8 +51,8 @@ recv_find_max_checkpoint(ulint* max_field) /** Reduces recv_sys->n_addrs for the corrupted page. This function should called when srv_force_recovery > 0. -@param[in] bpage buffer pool page */ -void recv_recover_corrupt_page(buf_page_t* bpage); +@param[in] page_id page id of the corrupted page */ +void recv_recover_corrupt_page(page_id_t page_id); /** Apply any buffered redo log to a page that was just read from a data file. @param[in,out] bpage buffer pool page */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index c0521f1dba4..dbce6f90fc2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2214,8 +2214,8 @@ skip_log: /** Reduces recv_sys->n_addrs for the corrupted page. This function should called when srv_force_recovery > 0. -@param[in] bpage buffer pool page */ -void recv_recover_corrupt_page(buf_page_t* bpage) +@param[in] page_id page id of the corrupted page */ +void recv_recover_corrupt_page(page_id_t page_id) { ut_ad(srv_force_recovery); mutex_enter(&recv_sys->mutex); @@ -2226,7 +2226,7 @@ void recv_recover_corrupt_page(buf_page_t* bpage) } recv_addr_t* recv_addr = recv_get_fil_addr_struct( - bpage->id.space(), bpage->id.page_no()); + page_id.space(), page_id.page_no()); ut_ad(recv_addr->state != RECV_WILL_NOT_READ); From d7c8423a3d44a5eb9bb22efd957eab3f32497b0f Mon Sep 17 00:00:00 2001 From: Zicheng Huang Date: Wed, 27 Feb 2019 08:31:35 +0000 Subject: [PATCH 15/22] fix MDEV-18750: failed to flashback large-size binlog file fix MDEV-18750: failed to flashback large-size binlog file fix mysqlbinlog flashback failure caused by reading io_cache without MY_FULL_IO flag fix MDEV-18750: mysqlbinlog flashback failure on large binlog --- .../binlog/r/flashback-largebinlog.result | 71 +++++++++++ .../suite/binlog/t/flashback-largebinlog.test | 110 ++++++++++++++++++ mysys/mf_iocache.c | 8 +- 3 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/binlog/r/flashback-largebinlog.result create mode 100644 mysql-test/suite/binlog/t/flashback-largebinlog.test diff --git a/mysql-test/suite/binlog/r/flashback-largebinlog.result b/mysql-test/suite/binlog/r/flashback-largebinlog.result new file mode 100644 index 00000000000..526204f259f --- /dev/null +++ b/mysql-test/suite/binlog/r/flashback-largebinlog.result @@ -0,0 +1,71 @@ +# +# Preparatory cleanup. +# +drop database if exists mysqltest; +create database mysqltest; +use mysqltest; +DROP TABLE IF EXISTS t1; +# +# We need a fixed timestamp to avoid varying results. +# +SET timestamp=1000000000; +# +# We need big packets. +# +# Capture initial value to reset at the end of the test +# Now adjust max_allowed_packet +SET @@global.max_allowed_packet= 10*1024*1024*1024; +Warnings: +Warning 1292 Truncated incorrect max_allowed_packet value: '10737418240' +max_allowed_packet is a global variable. +In order for the preceding change in max_allowed_packets' value +to be seen and used, we must start a new connection. +The change does not take effect with the current one. +For simplicity, we just disconnect / reconnect connection default here. +disconnect default; +connect default, localhost,root,,; +# +# Delete all existing binary logs. +# +RESET MASTER; +# +# Create a test table. +# +use mysqltest; +CREATE TABLE t1 ( +c1 LONGTEXT +) DEFAULT CHARSET latin1; +# +# Show how many rows are affected by each statement. +# +# +# Insert some big rows. +# +insert 1024MB data twice +INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 67108864)); +affected rows: 1 +INSERT INTO t1 VALUES (REPEAT('MegaByteBlckMany', 67108864)); +affected rows: 1 +# +# Flush all log buffers to the log file. +# +FLUSH LOGS; +affected rows: 0 +# +# Call mysqlbinlog to display the log file contents. +# NOTE: The output of mysqlbinlog is redirected to +# $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out +# If you want to examine it, disable remove_file +# at the bottom of the test script. +# +# +# Cleanup. +# +# reset variable value to pass testcase checks +SET @@global.max_allowed_packet = 16777216; +affected rows: 0 +DROP TABLE t1; +affected rows: 0 +drop database if exists mysqltest; +affected rows: 0 +remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out diff --git a/mysql-test/suite/binlog/t/flashback-largebinlog.test b/mysql-test/suite/binlog/t/flashback-largebinlog.test new file mode 100644 index 00000000000..6ff58b706d3 --- /dev/null +++ b/mysql-test/suite/binlog/t/flashback-largebinlog.test @@ -0,0 +1,110 @@ +# mysqlbinlog_big.test +# +# Show that mysqlbinlog can handle big rows. +# + +# +# The *huge* output of mysqlbinlog will be redirected to +# $MYSQLTEST_VARDIR/$mysqlbinlog_output +# +--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out + +--source include/have_binlog_format_row.inc + +--source include/have_log_bin.inc + +# This is a big test. +--source include/big_test.inc + +--echo # +--echo # Preparatory cleanup. +--echo # +--disable_warnings +drop database if exists mysqltest; +create database mysqltest; +use mysqltest; +DROP TABLE IF EXISTS t1; +--enable_warnings + +--echo # +--echo # We need a fixed timestamp to avoid varying results. +--echo # +SET timestamp=1000000000; + +--echo # +--echo # We need big packets. +--echo # +--echo # Capture initial value to reset at the end of the test +# use let $ = query_get_value as FLUSH statements +# in the test will set @ values to NULL +let $orig_max_allowed_packet = +query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1); + +--echo # Now adjust max_allowed_packet +SET @@global.max_allowed_packet= 10*1024*1024*1024; + +--echo max_allowed_packet is a global variable. +--echo In order for the preceding change in max_allowed_packets' value +--echo to be seen and used, we must start a new connection. +--echo The change does not take effect with the current one. +--echo For simplicity, we just disconnect / reconnect connection default here. +disconnect default; +connect (default, localhost,root,,); + +--echo # +--echo # Delete all existing binary logs. +--echo # +RESET MASTER; + +--echo # +--echo # Create a test table. +--echo # +use mysqltest; +eval CREATE TABLE t1 ( + c1 LONGTEXT + ) DEFAULT CHARSET latin1; + +--echo # +--echo # Show how many rows are affected by each statement. +--echo # +--enable_info + +--echo # +--echo # Insert some big rows. +--echo # + +--echo insert 1024MB data twice +INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 67108864)); +INSERT INTO t1 VALUES (REPEAT('MegaByteBlckMany', 67108864)); + +--echo # +--echo # Flush all log buffers to the log file. +--echo # +FLUSH LOGS; + +--echo # +--echo # Call mysqlbinlog to display the log file contents. +--echo # NOTE: The output of mysqlbinlog is redirected to +--echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output +--echo # If you want to examine it, disable remove_file +--echo # at the bottom of the test script. +--echo # +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLTEST_VARDIR +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ +--exec $MYSQL_BINLOG -B -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output + +--echo # +--echo # Cleanup. +--echo # +--echo # reset variable value to pass testcase checks +eval SET @@global.max_allowed_packet = $orig_max_allowed_packet; +DROP TABLE t1; +drop database if exists mysqltest; + +--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output +# +# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line: +# +--remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output + diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 92bca16c24f..d7689e204b6 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -120,6 +120,10 @@ init_functions(IO_CACHE* info) DBUG_ASSERT(0); break; } + if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND) + info->myflags|= MY_FULL_IO; + else + info->myflags&= ~MY_FULL_IO; } @@ -296,10 +300,6 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, } info->inited=info->aio_result.pending=0; #endif - if (type == READ_CACHE || type == WRITE_CACHE || type == SEQ_READ_APPEND) - info->myflags|= MY_FULL_IO; - else - info->myflags&= ~MY_FULL_IO; DBUG_RETURN(0); } /* init_io_cache */ From bb5d04c9b809b6e5542a0739124fc214807d1615 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 6 Jun 2019 12:49:34 +0530 Subject: [PATCH 16/22] MDEV-19695 Import tablespace doesn't work with ROW_FORMAT=COMPRESSED encrypted tablespace Problem: ======= fil_iterate() writes imported tablespace page0 as it is to discarded tablespace. Space id wasn't even changed. While opening the tablespace, tablespace fails with space id mismatch error. Fix: ==== fil_iterate() copies the page0 with discarded space id to imported tablespace. --- .../r/compressed_import_tablespace.result | 37 +++++++++++++++ .../t/compressed_import_tablespace.opt | 3 ++ .../t/compressed_import_tablespace.test | 46 +++++++++++++++++++ storage/innobase/row/row0import.cc | 14 ++++-- 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/encryption/r/compressed_import_tablespace.result create mode 100644 mysql-test/suite/encryption/t/compressed_import_tablespace.opt create mode 100644 mysql-test/suite/encryption/t/compressed_import_tablespace.test diff --git a/mysql-test/suite/encryption/r/compressed_import_tablespace.result b/mysql-test/suite/encryption/r/compressed_import_tablespace.result new file mode 100644 index 00000000000..aafe4447884 --- /dev/null +++ b/mysql-test/suite/encryption/r/compressed_import_tablespace.result @@ -0,0 +1,37 @@ +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES; +INSERT INTO t1 VALUES(1, repeat('Nesamani', 10)); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `a` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `ENCRYPTED`=YES +# Wait max 10 min for key encryption threads to encrypt all spaces +t1.frm +t1.ibd +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +t1.cfg +t1.frm +t1.ibd +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES; +ALTER TABLE t1 DISCARD TABLESPACE; +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `a` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `ENCRYPTED`=YES +DROP TABLE t1; diff --git a/mysql-test/suite/encryption/t/compressed_import_tablespace.opt b/mysql-test/suite/encryption/t/compressed_import_tablespace.opt new file mode 100644 index 00000000000..a9893ed4b29 --- /dev/null +++ b/mysql-test/suite/encryption/t/compressed_import_tablespace.opt @@ -0,0 +1,3 @@ +--innodb-encrypt-tables=ON +--innodb-encryption-threads=4 +--innodb-tablespaces-encryption diff --git a/mysql-test/suite/encryption/t/compressed_import_tablespace.test b/mysql-test/suite/encryption/t/compressed_import_tablespace.test new file mode 100644 index 00000000000..b9e4913584b --- /dev/null +++ b/mysql-test/suite/encryption/t/compressed_import_tablespace.test @@ -0,0 +1,46 @@ +-- source include/have_innodb.inc +-- source include/have_example_key_management_plugin.inc +-- source include/not_valgrind.inc +-- source include/not_embedded.inc + +let MYSQLD_DATADIR = `SELECT @@datadir`; +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES; +INSERT INTO t1 VALUES(1, repeat('Nesamani', 10)); + +SELECT COUNT(*) FROM t1; +SHOW CREATE TABLE t1; + +--echo # Wait max 10 min for key encryption threads to encrypt all spaces +--let $wait_timeout= 600 +--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING <> 0 +--source include/wait_condition.inc + +--source include/shutdown_mysqld.inc + +--source include/start_mysqld.inc +let MYSQLD_DATADIR =`SELECT @@datadir`; + +--list_files $MYSQLD_DATADIR/test +FLUSH TABLES t1 FOR EXPORT; +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF +--list_files $MYSQLD_DATADIR/test +UNLOCK TABLES; +DROP TABLE t1; + +CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES; +ALTER TABLE t1 DISCARD TABLESPACE; +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1"); +ib_restore_tablespaces("test", "t1"); +EOF + +ALTER TABLE t1 IMPORT TABLESPACE; + +SELECT COUNT(*) FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 036b657e36c..abadeafba9c 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3421,8 +3421,12 @@ page_corrupted: FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + src)) { not_encrypted: - if (!page_compressed - && !block->page.zip.data) { + if (block->page.id.page_no() == 0 + && block->page.zip.data) { + block->page.zip.data = src; + frame_changed = true; + } else if (!page_compressed + && !block->page.zip.data) { block->frame = src; frame_changed = true; } else { @@ -3513,7 +3517,11 @@ not_encrypted: } if (frame_changed) { - block->frame = dst; + if (block->page.zip.data) { + block->page.zip.data = dst; + } else { + block->frame = dst; + } } src = io_buffer + (i * size); From d6d5c168cf106535d719c4715986dac4767254ea Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 6 Jun 2019 15:23:12 +0300 Subject: [PATCH 17/22] Fixed that test suite doesn't remove duplicate options - multiple usage of plugin-load-add and optimizer-switch are now included in generated config files --- mysql-test/lib/My/Config.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm index 12647edf0a4..e148fa1dcb7 100644 --- a/mysql-test/lib/My/Config.pm +++ b/mysql-test/lib/My/Config.pm @@ -21,6 +21,17 @@ use strict; use warnings; use Carp; +# Define all MariaDB options that the user should be able to specify +# many times in the config file. Note that options must be written +# using '-' instead of '_' here! + +my %multipart_options= + ( + "plugin-load-add" => 1, + "optimizer-switch" => 1, +); + + sub new { my ($class, $option_name, $option_value)= @_; my $self= bless { name => $option_name, @@ -327,7 +338,6 @@ sub new { # Skip comment next; } - else { croak "Unexpected line '$line' found in '$path'"; } @@ -355,6 +365,11 @@ sub insert { if ( defined $option ) { #print "option: $option, value: $value\n"; + my $tmp_option= $option; + $tmp_option =~ s/_/-/g; + + # If the option is an option that one can specify many times, always add + $if_not_exist= 1 if (@multipart_options{$tmp_option}); # Add the option to the group $group->insert($option, $value, $if_not_exist); From b83aff56f10caaa24a11d2fa9d17fd7930d5de25 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 6 Jun 2019 15:25:15 +0300 Subject: [PATCH 18/22] Support skip-plugin-load - --disable-plugin-load or --skip-plugin-load will now reset plugin load list. Needed for future changes to mtr tests --- sql/mysqld.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 60dce5a7ff3..bafc92696c4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9316,6 +9316,8 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) break; case OPT_PLUGIN_LOAD: free_list(opt_plugin_load_list_ptr); + if (argument == disabled_my_option) + break; // Resets plugin list /* fall through */ case OPT_PLUGIN_LOAD_ADD: opt_plugin_load_list_ptr->push_back(new i_string(argument)); From dfe7968c6ed55b32916b7b84a54abdc66debef4c Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 6 Jun 2019 16:38:03 +0300 Subject: [PATCH 19/22] Fixed typo in Config.pgm --- mysql-test/lib/My/Config.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm index e148fa1dcb7..ecc0830c3df 100644 --- a/mysql-test/lib/My/Config.pm +++ b/mysql-test/lib/My/Config.pm @@ -369,7 +369,7 @@ sub insert { $tmp_option =~ s/_/-/g; # If the option is an option that one can specify many times, always add - $if_not_exist= 1 if (@multipart_options{$tmp_option}); + $if_not_exist= 1 if ($multipart_options{$tmp_option}); # Add the option to the group $group->insert($option, $value, $if_not_exist); From 9b22354a594570e23cc675d90836743ce7a3ba1c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 7 Jun 2019 00:07:14 +0200 Subject: [PATCH 20/22] Fix mysql-test-run.pl to work after d6d5c168cf1 option values now have to be edited in-place, instead of replacing an option with another one that has the same name but a new value. --- mysql-test/lib/My/ConfigFactory.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 6d4c7f43390..72d7600e8df 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -372,7 +372,7 @@ sub resolve_at_variable { } $res .= $after; - $config->insert($group->name(), $option->name(), $res) + $option->{value}= $res; } From 5d06edfb2616ab0b4b067580c281afbbef8fdc74 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sat, 8 Jun 2019 02:28:29 +0300 Subject: [PATCH 21/22] MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON Make it visible --- mysql-test/r/subselect_no_semijoin.result | 55 +++++++++++++++++++++++ mysql-test/t/subselect_no_semijoin.test | 23 ++++++++++ sql/sql_explain.cc | 5 +++ sql/sql_explain.h | 1 + sql/sql_select.cc | 1 + 5 files changed, 85 insertions(+) diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index a0625246e2b..55d408c54fc 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -7291,5 +7291,60 @@ pk i c pk i c 1 10 foo 1 10 foo DROP TABLE t; # End of 10.2 tests +# +# MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON +# +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1),(5); +CREATE TABLE t2 ( b INT ) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1); +CREATE TABLE t3 ( c INT ); +INSERT INTO t3 VALUES (4),(5); +SET @tmp19714=@@optimizer_switch; +SET optimizer_switch='subquery_cache=off'; +explain format=json +SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "pseudo_bits_condition": "1 = t1.a or (1,(subquery#3))", + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 = t3.c" + } + } + } + ] + } + } + ] + } +} +SET optimizer_switch=@tmp19714; +drop table t1,t2,t3; set @optimizer_switch_for_subselect_test=null; set @join_cache_level_for_subselect_test=NULL; diff --git a/mysql-test/t/subselect_no_semijoin.test b/mysql-test/t/subselect_no_semijoin.test index 46791667173..eda95b93503 100644 --- a/mysql-test/t/subselect_no_semijoin.test +++ b/mysql-test/t/subselect_no_semijoin.test @@ -8,5 +8,28 @@ set @join_cache_level_for_subselect_test=@@join_cache_level; --source t/subselect.test +--echo # +--echo # MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON +--echo # +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1),(5); + +# t2 must be MyISAM or Aria and contain 1 row +CREATE TABLE t2 ( b INT ) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1); + +CREATE TABLE t3 ( c INT ); +INSERT INTO t3 VALUES (4),(5); + +SET @tmp19714=@@optimizer_switch; +SET optimizer_switch='subquery_cache=off'; + +explain format=json +SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; + +SET optimizer_switch=@tmp19714; + +drop table t1,t2,t3; + set @optimizer_switch_for_subselect_test=null; set @join_cache_level_for_subselect_test=NULL; diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 1ab10fb3c37..3ebd44dc0bb 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -857,6 +857,11 @@ void Explain_select::print_explain_json(Explain_query *query, writer->add_member("outer_ref_condition"); write_item(writer, outer_ref_cond); } + if (pseudo_bits_cond) + { + writer->add_member("pseudo_bits_condition"); + write_item(writer, pseudo_bits_cond); + } /* we do not print HAVING which always evaluates to TRUE */ if (having || (having_value == Item::COND_FALSE)) diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 3ca816477fc..08af84b3562 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -232,6 +232,7 @@ public: /* Expensive constant condition */ Item *exec_const_cond; Item *outer_ref_cond; + Item *pseudo_bits_cond; /* HAVING condition */ Item *having; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 182e913c16c..0ee3735c464 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25025,6 +25025,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, xpl_sel->exec_const_cond= exec_const_cond; xpl_sel->outer_ref_cond= outer_ref_cond; + xpl_sel->pseudo_bits_cond= pseudo_bits_cond; if (tmp_having) xpl_sel->having= tmp_having; else From cbac8f935182ecc5bb907de3ae48942467f0b8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Jun 2019 18:15:25 +0300 Subject: [PATCH 22/22] MDEV-19725 Incorrect error handling in ALTER TABLE Some I/O functions and macros that are declared in os0file.h used to return a Boolean status code (nonzero on success). In MySQL 5.7, they were changed to return dberr_t instead. Alas, in MariaDB Server 10.2, some uses of functions were not adjusted to the changed return value. Until MDEV-19231, the valid values of dberr_t were always nonzero. This means that some code that was incorrectly checking for a zero return value from the functions would never detect a failure. After MDEV-19231, some tests for ALTER ONLINE TABLE would fail with cmake -DPLUGIN_PERFSCHEMA=NO. It turned out that the wrappers pfs_os_file_read_no_error_handling_int_fd_func() and pfs_os_file_write_int_fd_func() were wrongly returning bool instead of dberr_t. Also the callers of these functions were wrongly expecting bool (nonzero on success) instead of dberr_t. This mistake had been made when the addition of these functions was merged from MySQL 5.6.36 and 5.7.18 into MariaDB Server 10.2.7. This fix also reverts commit 40becbc3c7a6555d0a4bb186b4336a2899d5995c which attempted to work around the problem. --- storage/innobase/include/os0file.h | 6 +++--- storage/innobase/include/os0file.ic | 20 +++++++++++--------- storage/innobase/include/row0merge.h | 4 +++- storage/innobase/os/os0file.cc | 6 ++++-- storage/innobase/row/row0log.cc | 8 ++++---- storage/innobase/row/row0merge.cc | 11 +++++++---- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 324ff99f67b..e85bf74201a 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1197,12 +1197,12 @@ to original un-instrumented file I/O APIs */ # define os_file_read_no_error_handling(type, file, buf, offset, n, o) \ os_file_read_no_error_handling_func(type, file, buf, offset, n, o) # define os_file_read_no_error_handling_int_fd(type, file, buf, offset, n) \ - (os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL) == 0) + os_file_read_no_error_handling_func(type, OS_FILE_FROM_FD(file), buf, offset, n, NULL) # define os_file_write(type, name, file, buf, offset, n) \ os_file_write_func(type, name, file, buf, offset, n) # define os_file_write_int_fd(type, name, file, buf, offset, n) \ - (os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n) == 0) + os_file_write_func(type, name, OS_FILE_FROM_FD(file), buf, offset, n) # define os_file_flush(file) os_file_flush_func(file) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 7a490bf775a..f363bd5135a 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -348,9 +348,10 @@ a synchronous read operation. @param[in] n number of bytes to read @param[in] src_file caller file name @param[in] src_line caller line number -@return 0 on error, 1 on success */ +@return error code +@retval DB_SUCCESS if the operation succeeded */ UNIV_INLINE -bool +dberr_t pfs_os_file_read_no_error_handling_int_fd_func( const IORequest& type, int file, @@ -371,14 +372,14 @@ pfs_os_file_read_no_error_handling_int_fd_func( __FILE__, __LINE__); } - bool success = os_file_read_no_error_handling_func( + dberr_t err = os_file_read_no_error_handling_func( type, OS_FILE_FROM_FD(file), buf, offset, n, NULL); if (locker != NULL) { PSI_FILE_CALL(end_file_wait)(locker, n); } - return(success == DB_SUCCESS); // Reverse result + return err; } /** NOTE! Please use the corresponding macro os_file_write(), not directly @@ -435,9 +436,10 @@ os_file_write_int_fd() which requests a synchronous write operation. @param[in] n number of bytes @param[in] src_file file name where func invoked @param[in] src_line line where the func invoked -@return 0 on error, 1 on success */ +@return error code +@retval DB_SUCCESS if the operation succeeded */ UNIV_INLINE -bool +dberr_t pfs_os_file_write_int_fd_func( const IORequest& type, const char* name, @@ -459,14 +461,14 @@ pfs_os_file_write_int_fd_func( __FILE__, __LINE__); } - bool success = os_file_write_func( + dberr_t err = os_file_write_func( type, name, OS_FILE_FROM_FD(file), buf, offset, n); if (locker != NULL) { PSI_FILE_CALL(end_file_wait)(locker, n); } - return(success == DB_SUCCESS); // Reverse result + return err; } /** NOTE! Please use the corresponding macro os_file_flush(), not directly diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 3b66597c0d7..a1719e0448e 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -370,7 +370,9 @@ row_merge_buf_sort( /********************************************************************//** Write a merge block to the file system. -@return whether the request was completed successfully */ +@return whether the request was completed successfully +@retval false on error +@retval true on success */ UNIV_INTERN bool row_merge_write( diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 8445f635062..2a89a6fc982 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -5038,7 +5038,8 @@ Requests a synchronous write operation. @param[out] buf buffer from which to write @param[in] offset file offset from the start where to read @param[in] n number of bytes to read, starting from offset -@return DB_SUCCESS if request was successful, false if fail */ +@return error code +@retval DB_SUCCESS if the operation succeeded */ dberr_t os_file_write_func( const IORequest& type, @@ -5497,7 +5498,8 @@ Requests a synchronous positioned read operation. @param[out] buf buffer where to read @param[in] offset file offset from the start where to read @param[in] n number of bytes to read, starting from offset -@return DB_SUCCESS or error code */ +@return error code +@retval DB_SUCCESS if the operation succeeded */ dberr_t os_file_read_func( const IORequest& type, diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 0013fabd98e..012cf8b2963 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -396,7 +396,7 @@ row_log_online_op( } log->tail.blocks++; - if (!os_file_write_int_fd( + if (DB_SUCCESS != os_file_write_int_fd( request, "(modification log)", log->fd, @@ -534,7 +534,7 @@ row_log_table_close_func( } log->tail.blocks++; - if (!os_file_write_int_fd( + if (DB_SUCCESS != os_file_write_int_fd( request, "(modification log)", log->fd, @@ -2658,7 +2658,7 @@ all_done: IORequest request(IORequest::READ); byte* buf = index->online_log->head.block; - if (!os_file_read_no_error_handling_int_fd( + if (DB_SUCCESS != os_file_read_no_error_handling_int_fd( request, index->online_log->fd, buf, ofs, srv_sort_buf_size)) { ib::error() @@ -3529,7 +3529,7 @@ all_done: byte* buf = index->online_log->head.block; - if (!os_file_read_no_error_handling_int_fd( + if (DB_SUCCESS != os_file_read_no_error_handling_int_fd( request, index->online_log->fd, buf, ofs, srv_sort_buf_size)) { ib::error() diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index e0c819bea4b..3f8bcb0a430 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1087,8 +1087,9 @@ row_merge_read( DBUG_EXECUTE_IF("row_merge_read_failure", DBUG_RETURN(FALSE);); IORequest request(IORequest::READ); - const bool success = os_file_read_no_error_handling_int_fd( - request, fd, buf, ofs, srv_sort_buf_size); + const bool success = DB_SUCCESS + == os_file_read_no_error_handling_int_fd( + request, fd, buf, ofs, srv_sort_buf_size); /* If encryption is enabled decrypt buffer */ if (success && log_tmp_is_encrypted()) { @@ -1115,7 +1116,9 @@ row_merge_read( /********************************************************************//** Write a merge block to the file system. -@return 0 on error, 1 if write succeded */ +@return whether the request was completed successfully +@retval false on error +@retval true on success */ UNIV_INTERN bool row_merge_write( @@ -1149,7 +1152,7 @@ row_merge_write( } IORequest request(IORequest::WRITE); - const bool success = os_file_write_int_fd( + const bool success = DB_SUCCESS == os_file_write_int_fd( request, "(merge)", fd, out_buf, ofs, buf_len); #ifdef POSIX_FADV_DONTNEED